001package org.hl7.fhir.dstu2016may.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import org.hl7.fhir.exceptions.FHIRException; 041 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.Description; 044import ca.uhn.fhir.model.api.annotation.ResourceDef; 045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 046/** 047 * Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification. 048 */ 049@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic") 050public class Basic extends DomainResource { 051 052 /** 053 * Identifier assigned to the resource for business purposes, outside the context of FHIR. 054 */ 055 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 056 @Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the resource for business purposes, outside the context of FHIR." ) 057 protected List<Identifier> identifier; 058 059 /** 060 * Identifies the 'type' of resource - equivalent to the resource name for other resources. 061 */ 062 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=true, summary=true) 063 @Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." ) 064 protected CodeableConcept code; 065 066 /** 067 * Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource. 068 */ 069 @Child(name = "subject", type = {}, order=2, min=0, max=1, modifier=false, summary=true) 070 @Description(shortDefinition="Identifies the focus of this resource", formalDefinition="Identifies the patient, practitioner, device or any other resource that is the \"focus\" of this resource." ) 071 protected Reference subject; 072 073 /** 074 * The actual object that is the target of the reference (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.) 075 */ 076 protected Resource subjectTarget; 077 078 /** 079 * Identifies when the resource was first created. 080 */ 081 @Child(name = "created", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=true) 082 @Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." ) 083 protected DateType created; 084 085 /** 086 * Indicates who was responsible for creating the resource instance. 087 */ 088 @Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=true) 089 @Description(shortDefinition="Who created", formalDefinition="Indicates who was responsible for creating the resource instance." ) 090 protected Reference author; 091 092 /** 093 * The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.) 094 */ 095 protected Resource authorTarget; 096 097 private static final long serialVersionUID = 650756402L; 098 099 /** 100 * Constructor 101 */ 102 public Basic() { 103 super(); 104 } 105 106 /** 107 * Constructor 108 */ 109 public Basic(CodeableConcept code) { 110 super(); 111 this.code = code; 112 } 113 114 /** 115 * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.) 116 */ 117 public List<Identifier> getIdentifier() { 118 if (this.identifier == null) 119 this.identifier = new ArrayList<Identifier>(); 120 return this.identifier; 121 } 122 123 public boolean hasIdentifier() { 124 if (this.identifier == null) 125 return false; 126 for (Identifier item : this.identifier) 127 if (!item.isEmpty()) 128 return true; 129 return false; 130 } 131 132 /** 133 * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.) 134 */ 135 // syntactic sugar 136 public Identifier addIdentifier() { //3 137 Identifier t = new Identifier(); 138 if (this.identifier == null) 139 this.identifier = new ArrayList<Identifier>(); 140 this.identifier.add(t); 141 return t; 142 } 143 144 // syntactic sugar 145 public Basic addIdentifier(Identifier t) { //3 146 if (t == null) 147 return this; 148 if (this.identifier == null) 149 this.identifier = new ArrayList<Identifier>(); 150 this.identifier.add(t); 151 return this; 152 } 153 154 /** 155 * @return {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.) 156 */ 157 public CodeableConcept getCode() { 158 if (this.code == null) 159 if (Configuration.errorOnAutoCreate()) 160 throw new Error("Attempt to auto-create Basic.code"); 161 else if (Configuration.doAutoCreate()) 162 this.code = new CodeableConcept(); // cc 163 return this.code; 164 } 165 166 public boolean hasCode() { 167 return this.code != null && !this.code.isEmpty(); 168 } 169 170 /** 171 * @param value {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.) 172 */ 173 public Basic setCode(CodeableConcept value) { 174 this.code = value; 175 return this; 176 } 177 178 /** 179 * @return {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.) 180 */ 181 public Reference getSubject() { 182 if (this.subject == null) 183 if (Configuration.errorOnAutoCreate()) 184 throw new Error("Attempt to auto-create Basic.subject"); 185 else if (Configuration.doAutoCreate()) 186 this.subject = new Reference(); // cc 187 return this.subject; 188 } 189 190 public boolean hasSubject() { 191 return this.subject != null && !this.subject.isEmpty(); 192 } 193 194 /** 195 * @param value {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.) 196 */ 197 public Basic setSubject(Reference value) { 198 this.subject = value; 199 return this; 200 } 201 202 /** 203 * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.) 204 */ 205 public Resource getSubjectTarget() { 206 return this.subjectTarget; 207 } 208 209 /** 210 * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.) 211 */ 212 public Basic setSubjectTarget(Resource value) { 213 this.subjectTarget = value; 214 return this; 215 } 216 217 /** 218 * @return {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 219 */ 220 public DateType getCreatedElement() { 221 if (this.created == null) 222 if (Configuration.errorOnAutoCreate()) 223 throw new Error("Attempt to auto-create Basic.created"); 224 else if (Configuration.doAutoCreate()) 225 this.created = new DateType(); // bb 226 return this.created; 227 } 228 229 public boolean hasCreatedElement() { 230 return this.created != null && !this.created.isEmpty(); 231 } 232 233 public boolean hasCreated() { 234 return this.created != null && !this.created.isEmpty(); 235 } 236 237 /** 238 * @param value {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 239 */ 240 public Basic setCreatedElement(DateType value) { 241 this.created = value; 242 return this; 243 } 244 245 /** 246 * @return Identifies when the resource was first created. 247 */ 248 public Date getCreated() { 249 return this.created == null ? null : this.created.getValue(); 250 } 251 252 /** 253 * @param value Identifies when the resource was first created. 254 */ 255 public Basic setCreated(Date value) { 256 if (value == null) 257 this.created = null; 258 else { 259 if (this.created == null) 260 this.created = new DateType(); 261 this.created.setValue(value); 262 } 263 return this; 264 } 265 266 /** 267 * @return {@link #author} (Indicates who was responsible for creating the resource instance.) 268 */ 269 public Reference getAuthor() { 270 if (this.author == null) 271 if (Configuration.errorOnAutoCreate()) 272 throw new Error("Attempt to auto-create Basic.author"); 273 else if (Configuration.doAutoCreate()) 274 this.author = new Reference(); // cc 275 return this.author; 276 } 277 278 public boolean hasAuthor() { 279 return this.author != null && !this.author.isEmpty(); 280 } 281 282 /** 283 * @param value {@link #author} (Indicates who was responsible for creating the resource instance.) 284 */ 285 public Basic setAuthor(Reference value) { 286 this.author = value; 287 return this; 288 } 289 290 /** 291 * @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.) 292 */ 293 public Resource getAuthorTarget() { 294 return this.authorTarget; 295 } 296 297 /** 298 * @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.) 299 */ 300 public Basic setAuthorTarget(Resource value) { 301 this.authorTarget = value; 302 return this; 303 } 304 305 protected void listChildren(List<Property> childrenList) { 306 super.listChildren(childrenList); 307 childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the resource for business purposes, outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier)); 308 childrenList.add(new Property("code", "CodeableConcept", "Identifies the 'type' of resource - equivalent to the resource name for other resources.", 0, java.lang.Integer.MAX_VALUE, code)); 309 childrenList.add(new Property("subject", "Reference(Any)", "Identifies the patient, practitioner, device or any other resource that is the \"focus\" of this resource.", 0, java.lang.Integer.MAX_VALUE, subject)); 310 childrenList.add(new Property("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created)); 311 childrenList.add(new Property("author", "Reference(Practitioner|Patient|RelatedPerson)", "Indicates who was responsible for creating the resource instance.", 0, java.lang.Integer.MAX_VALUE, author)); 312 } 313 314 @Override 315 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 316 switch (hash) { 317 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 318 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 319 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 320 case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateType 321 case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference 322 default: return super.getProperty(hash, name, checkValid); 323 } 324 325 } 326 327 @Override 328 public void setProperty(int hash, String name, Base value) throws FHIRException { 329 switch (hash) { 330 case -1618432855: // identifier 331 this.getIdentifier().add(castToIdentifier(value)); // Identifier 332 break; 333 case 3059181: // code 334 this.code = castToCodeableConcept(value); // CodeableConcept 335 break; 336 case -1867885268: // subject 337 this.subject = castToReference(value); // Reference 338 break; 339 case 1028554472: // created 340 this.created = castToDate(value); // DateType 341 break; 342 case -1406328437: // author 343 this.author = castToReference(value); // Reference 344 break; 345 default: super.setProperty(hash, name, value); 346 } 347 348 } 349 350 @Override 351 public void setProperty(String name, Base value) throws FHIRException { 352 if (name.equals("identifier")) 353 this.getIdentifier().add(castToIdentifier(value)); 354 else if (name.equals("code")) 355 this.code = castToCodeableConcept(value); // CodeableConcept 356 else if (name.equals("subject")) 357 this.subject = castToReference(value); // Reference 358 else if (name.equals("created")) 359 this.created = castToDate(value); // DateType 360 else if (name.equals("author")) 361 this.author = castToReference(value); // Reference 362 else 363 super.setProperty(name, value); 364 } 365 366 @Override 367 public Base makeProperty(int hash, String name) throws FHIRException { 368 switch (hash) { 369 case -1618432855: return addIdentifier(); // Identifier 370 case 3059181: return getCode(); // CodeableConcept 371 case -1867885268: return getSubject(); // Reference 372 case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateType 373 case -1406328437: return getAuthor(); // Reference 374 default: return super.makeProperty(hash, name); 375 } 376 377 } 378 379 @Override 380 public Base addChild(String name) throws FHIRException { 381 if (name.equals("identifier")) { 382 return addIdentifier(); 383 } 384 else if (name.equals("code")) { 385 this.code = new CodeableConcept(); 386 return this.code; 387 } 388 else if (name.equals("subject")) { 389 this.subject = new Reference(); 390 return this.subject; 391 } 392 else if (name.equals("created")) { 393 throw new FHIRException("Cannot call addChild on a primitive type Basic.created"); 394 } 395 else if (name.equals("author")) { 396 this.author = new Reference(); 397 return this.author; 398 } 399 else 400 return super.addChild(name); 401 } 402 403 public String fhirType() { 404 return "Basic"; 405 406 } 407 408 public Basic copy() { 409 Basic dst = new Basic(); 410 copyValues(dst); 411 if (identifier != null) { 412 dst.identifier = new ArrayList<Identifier>(); 413 for (Identifier i : identifier) 414 dst.identifier.add(i.copy()); 415 }; 416 dst.code = code == null ? null : code.copy(); 417 dst.subject = subject == null ? null : subject.copy(); 418 dst.created = created == null ? null : created.copy(); 419 dst.author = author == null ? null : author.copy(); 420 return dst; 421 } 422 423 protected Basic typedCopy() { 424 return copy(); 425 } 426 427 @Override 428 public boolean equalsDeep(Base other) { 429 if (!super.equalsDeep(other)) 430 return false; 431 if (!(other instanceof Basic)) 432 return false; 433 Basic o = (Basic) other; 434 return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) 435 && compareDeep(created, o.created, true) && compareDeep(author, o.author, true); 436 } 437 438 @Override 439 public boolean equalsShallow(Base other) { 440 if (!super.equalsShallow(other)) 441 return false; 442 if (!(other instanceof Basic)) 443 return false; 444 Basic o = (Basic) other; 445 return compareValues(created, o.created, true); 446 } 447 448 public boolean isEmpty() { 449 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty()) 450 && (subject == null || subject.isEmpty()) && (created == null || created.isEmpty()) && (author == null || author.isEmpty()) 451 ; 452 } 453 454 @Override 455 public ResourceType getResourceType() { 456 return ResourceType.Basic; 457 } 458 459 /** 460 * Search parameter: <b>author</b> 461 * <p> 462 * Description: <b>Who created</b><br> 463 * Type: <b>reference</b><br> 464 * Path: <b>Basic.author</b><br> 465 * </p> 466 */ 467 @SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" ) 468 public static final String SP_AUTHOR = "author"; 469 /** 470 * <b>Fluent Client</b> search parameter constant for <b>author</b> 471 * <p> 472 * Description: <b>Who created</b><br> 473 * Type: <b>reference</b><br> 474 * Path: <b>Basic.author</b><br> 475 * </p> 476 */ 477 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR); 478 479/** 480 * Constant for fluent queries to be used to add include statements. Specifies 481 * the path value of "<b>Basic:author</b>". 482 */ 483 public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Basic:author").toLocked(); 484 485 /** 486 * Search parameter: <b>patient</b> 487 * <p> 488 * Description: <b>Identifies the focus of this resource</b><br> 489 * Type: <b>reference</b><br> 490 * Path: <b>Basic.subject</b><br> 491 * </p> 492 */ 493 @SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the focus of this resource", type="reference" ) 494 public static final String SP_PATIENT = "patient"; 495 /** 496 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 497 * <p> 498 * Description: <b>Identifies the focus of this resource</b><br> 499 * Type: <b>reference</b><br> 500 * Path: <b>Basic.subject</b><br> 501 * </p> 502 */ 503 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 504 505/** 506 * Constant for fluent queries to be used to add include statements. Specifies 507 * the path value of "<b>Basic:patient</b>". 508 */ 509 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Basic:patient").toLocked(); 510 511 /** 512 * Search parameter: <b>created</b> 513 * <p> 514 * Description: <b>When created</b><br> 515 * Type: <b>date</b><br> 516 * Path: <b>Basic.created</b><br> 517 * </p> 518 */ 519 @SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" ) 520 public static final String SP_CREATED = "created"; 521 /** 522 * <b>Fluent Client</b> search parameter constant for <b>created</b> 523 * <p> 524 * Description: <b>When created</b><br> 525 * Type: <b>date</b><br> 526 * Path: <b>Basic.created</b><br> 527 * </p> 528 */ 529 public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED); 530 531 /** 532 * Search parameter: <b>subject</b> 533 * <p> 534 * Description: <b>Identifies the focus of this resource</b><br> 535 * Type: <b>reference</b><br> 536 * Path: <b>Basic.subject</b><br> 537 * </p> 538 */ 539 @SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the focus of this resource", type="reference" ) 540 public static final String SP_SUBJECT = "subject"; 541 /** 542 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 543 * <p> 544 * Description: <b>Identifies the focus of this resource</b><br> 545 * Type: <b>reference</b><br> 546 * Path: <b>Basic.subject</b><br> 547 * </p> 548 */ 549 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 550 551/** 552 * Constant for fluent queries to be used to add include statements. Specifies 553 * the path value of "<b>Basic:subject</b>". 554 */ 555 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Basic:subject").toLocked(); 556 557 /** 558 * Search parameter: <b>code</b> 559 * <p> 560 * Description: <b>Kind of Resource</b><br> 561 * Type: <b>token</b><br> 562 * Path: <b>Basic.code</b><br> 563 * </p> 564 */ 565 @SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" ) 566 public static final String SP_CODE = "code"; 567 /** 568 * <b>Fluent Client</b> search parameter constant for <b>code</b> 569 * <p> 570 * Description: <b>Kind of Resource</b><br> 571 * Type: <b>token</b><br> 572 * Path: <b>Basic.code</b><br> 573 * </p> 574 */ 575 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 576 577 /** 578 * Search parameter: <b>identifier</b> 579 * <p> 580 * Description: <b>Business identifier</b><br> 581 * Type: <b>token</b><br> 582 * Path: <b>Basic.identifier</b><br> 583 * </p> 584 */ 585 @SearchParamDefinition(name="identifier", path="Basic.identifier", description="Business identifier", type="token" ) 586 public static final String SP_IDENTIFIER = "identifier"; 587 /** 588 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 589 * <p> 590 * Description: <b>Business identifier</b><br> 591 * Type: <b>token</b><br> 592 * Path: <b>Basic.identifier</b><br> 593 * </p> 594 */ 595 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 596 597 598}