001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Record details about an anatomical structure.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.
047 */
048@ResourceDef(name="BodyStructure", profile="http://hl7.org/fhir/StructureDefinition/BodyStructure")
049public class BodyStructure extends DomainResource {
050
051    /**
052     * Identifier for this instance of the anatomical structure.
053     */
054    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
055    @Description(shortDefinition="Bodystructure identifier", formalDefinition="Identifier for this instance of the anatomical structure." )
056    protected List<Identifier> identifier;
057
058    /**
059     * Whether this body site is in active use.
060     */
061    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
062    @Description(shortDefinition="Whether this record is in active use", formalDefinition="Whether this body site is in active use." )
063    protected BooleanType active;
064
065    /**
066     * The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.
067     */
068    @Child(name = "morphology", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
069    @Description(shortDefinition="Kind of Structure", formalDefinition="The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies." )
070    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-code")
071    protected CodeableConcept morphology;
072
073    /**
074     * The anatomical location or region of the specimen, lesion, or body structure.
075     */
076    @Child(name = "location", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
077    @Description(shortDefinition="Body site", formalDefinition="The anatomical location or region of the specimen, lesion, or body structure." )
078    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
079    protected CodeableConcept location;
080
081    /**
082     * Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.
083     */
084    @Child(name = "locationQualifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
085    @Description(shortDefinition="Body site modifier", formalDefinition="Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane." )
086    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
087    protected List<CodeableConcept> locationQualifier;
088
089    /**
090     * A summary, charactarization or explanation of the body structure.
091     */
092    @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
093    @Description(shortDefinition="Text description", formalDefinition="A summary, charactarization or explanation of the body structure." )
094    protected StringType description;
095
096    /**
097     * Image or images used to identify a location.
098     */
099    @Child(name = "image", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
100    @Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
101    protected List<Attachment> image;
102
103    /**
104     * The person to which the body site belongs.
105     */
106    @Child(name = "patient", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
107    @Description(shortDefinition="Who this is about", formalDefinition="The person to which the body site belongs." )
108    protected Reference patient;
109
110    /**
111     * The actual object that is the target of the reference (The person to which the body site belongs.)
112     */
113    protected Patient patientTarget;
114
115    private static final long serialVersionUID = 1437500387L;
116
117  /**
118   * Constructor
119   */
120    public BodyStructure() {
121      super();
122    }
123
124  /**
125   * Constructor
126   */
127    public BodyStructure(Reference patient) {
128      super();
129      this.patient = patient;
130    }
131
132    /**
133     * @return {@link #identifier} (Identifier for this instance of the anatomical structure.)
134     */
135    public List<Identifier> getIdentifier() { 
136      if (this.identifier == null)
137        this.identifier = new ArrayList<Identifier>();
138      return this.identifier;
139    }
140
141    /**
142     * @return Returns a reference to <code>this</code> for easy method chaining
143     */
144    public BodyStructure setIdentifier(List<Identifier> theIdentifier) { 
145      this.identifier = theIdentifier;
146      return this;
147    }
148
149    public boolean hasIdentifier() { 
150      if (this.identifier == null)
151        return false;
152      for (Identifier item : this.identifier)
153        if (!item.isEmpty())
154          return true;
155      return false;
156    }
157
158    public Identifier addIdentifier() { //3
159      Identifier t = new Identifier();
160      if (this.identifier == null)
161        this.identifier = new ArrayList<Identifier>();
162      this.identifier.add(t);
163      return t;
164    }
165
166    public BodyStructure addIdentifier(Identifier t) { //3
167      if (t == null)
168        return this;
169      if (this.identifier == null)
170        this.identifier = new ArrayList<Identifier>();
171      this.identifier.add(t);
172      return this;
173    }
174
175    /**
176     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
177     */
178    public Identifier getIdentifierFirstRep() { 
179      if (getIdentifier().isEmpty()) {
180        addIdentifier();
181      }
182      return getIdentifier().get(0);
183    }
184
185    /**
186     * @return {@link #active} (Whether this body site is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
187     */
188    public BooleanType getActiveElement() { 
189      if (this.active == null)
190        if (Configuration.errorOnAutoCreate())
191          throw new Error("Attempt to auto-create BodyStructure.active");
192        else if (Configuration.doAutoCreate())
193          this.active = new BooleanType(); // bb
194      return this.active;
195    }
196
197    public boolean hasActiveElement() { 
198      return this.active != null && !this.active.isEmpty();
199    }
200
201    public boolean hasActive() { 
202      return this.active != null && !this.active.isEmpty();
203    }
204
205    /**
206     * @param value {@link #active} (Whether this body site is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
207     */
208    public BodyStructure setActiveElement(BooleanType value) { 
209      this.active = value;
210      return this;
211    }
212
213    /**
214     * @return Whether this body site is in active use.
215     */
216    public boolean getActive() { 
217      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
218    }
219
220    /**
221     * @param value Whether this body site is in active use.
222     */
223    public BodyStructure setActive(boolean value) { 
224        if (this.active == null)
225          this.active = new BooleanType();
226        this.active.setValue(value);
227      return this;
228    }
229
230    /**
231     * @return {@link #morphology} (The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.)
232     */
233    public CodeableConcept getMorphology() { 
234      if (this.morphology == null)
235        if (Configuration.errorOnAutoCreate())
236          throw new Error("Attempt to auto-create BodyStructure.morphology");
237        else if (Configuration.doAutoCreate())
238          this.morphology = new CodeableConcept(); // cc
239      return this.morphology;
240    }
241
242    public boolean hasMorphology() { 
243      return this.morphology != null && !this.morphology.isEmpty();
244    }
245
246    /**
247     * @param value {@link #morphology} (The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.)
248     */
249    public BodyStructure setMorphology(CodeableConcept value) { 
250      this.morphology = value;
251      return this;
252    }
253
254    /**
255     * @return {@link #location} (The anatomical location or region of the specimen, lesion, or body structure.)
256     */
257    public CodeableConcept getLocation() { 
258      if (this.location == null)
259        if (Configuration.errorOnAutoCreate())
260          throw new Error("Attempt to auto-create BodyStructure.location");
261        else if (Configuration.doAutoCreate())
262          this.location = new CodeableConcept(); // cc
263      return this.location;
264    }
265
266    public boolean hasLocation() { 
267      return this.location != null && !this.location.isEmpty();
268    }
269
270    /**
271     * @param value {@link #location} (The anatomical location or region of the specimen, lesion, or body structure.)
272     */
273    public BodyStructure setLocation(CodeableConcept value) { 
274      this.location = value;
275      return this;
276    }
277
278    /**
279     * @return {@link #locationQualifier} (Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.)
280     */
281    public List<CodeableConcept> getLocationQualifier() { 
282      if (this.locationQualifier == null)
283        this.locationQualifier = new ArrayList<CodeableConcept>();
284      return this.locationQualifier;
285    }
286
287    /**
288     * @return Returns a reference to <code>this</code> for easy method chaining
289     */
290    public BodyStructure setLocationQualifier(List<CodeableConcept> theLocationQualifier) { 
291      this.locationQualifier = theLocationQualifier;
292      return this;
293    }
294
295    public boolean hasLocationQualifier() { 
296      if (this.locationQualifier == null)
297        return false;
298      for (CodeableConcept item : this.locationQualifier)
299        if (!item.isEmpty())
300          return true;
301      return false;
302    }
303
304    public CodeableConcept addLocationQualifier() { //3
305      CodeableConcept t = new CodeableConcept();
306      if (this.locationQualifier == null)
307        this.locationQualifier = new ArrayList<CodeableConcept>();
308      this.locationQualifier.add(t);
309      return t;
310    }
311
312    public BodyStructure addLocationQualifier(CodeableConcept t) { //3
313      if (t == null)
314        return this;
315      if (this.locationQualifier == null)
316        this.locationQualifier = new ArrayList<CodeableConcept>();
317      this.locationQualifier.add(t);
318      return this;
319    }
320
321    /**
322     * @return The first repetition of repeating field {@link #locationQualifier}, creating it if it does not already exist
323     */
324    public CodeableConcept getLocationQualifierFirstRep() { 
325      if (getLocationQualifier().isEmpty()) {
326        addLocationQualifier();
327      }
328      return getLocationQualifier().get(0);
329    }
330
331    /**
332     * @return {@link #description} (A summary, charactarization or explanation of the body structure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
333     */
334    public StringType getDescriptionElement() { 
335      if (this.description == null)
336        if (Configuration.errorOnAutoCreate())
337          throw new Error("Attempt to auto-create BodyStructure.description");
338        else if (Configuration.doAutoCreate())
339          this.description = new StringType(); // bb
340      return this.description;
341    }
342
343    public boolean hasDescriptionElement() { 
344      return this.description != null && !this.description.isEmpty();
345    }
346
347    public boolean hasDescription() { 
348      return this.description != null && !this.description.isEmpty();
349    }
350
351    /**
352     * @param value {@link #description} (A summary, charactarization or explanation of the body structure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
353     */
354    public BodyStructure setDescriptionElement(StringType value) { 
355      this.description = value;
356      return this;
357    }
358
359    /**
360     * @return A summary, charactarization or explanation of the body structure.
361     */
362    public String getDescription() { 
363      return this.description == null ? null : this.description.getValue();
364    }
365
366    /**
367     * @param value A summary, charactarization or explanation of the body structure.
368     */
369    public BodyStructure setDescription(String value) { 
370      if (Utilities.noString(value))
371        this.description = null;
372      else {
373        if (this.description == null)
374          this.description = new StringType();
375        this.description.setValue(value);
376      }
377      return this;
378    }
379
380    /**
381     * @return {@link #image} (Image or images used to identify a location.)
382     */
383    public List<Attachment> getImage() { 
384      if (this.image == null)
385        this.image = new ArrayList<Attachment>();
386      return this.image;
387    }
388
389    /**
390     * @return Returns a reference to <code>this</code> for easy method chaining
391     */
392    public BodyStructure setImage(List<Attachment> theImage) { 
393      this.image = theImage;
394      return this;
395    }
396
397    public boolean hasImage() { 
398      if (this.image == null)
399        return false;
400      for (Attachment item : this.image)
401        if (!item.isEmpty())
402          return true;
403      return false;
404    }
405
406    public Attachment addImage() { //3
407      Attachment t = new Attachment();
408      if (this.image == null)
409        this.image = new ArrayList<Attachment>();
410      this.image.add(t);
411      return t;
412    }
413
414    public BodyStructure addImage(Attachment t) { //3
415      if (t == null)
416        return this;
417      if (this.image == null)
418        this.image = new ArrayList<Attachment>();
419      this.image.add(t);
420      return this;
421    }
422
423    /**
424     * @return The first repetition of repeating field {@link #image}, creating it if it does not already exist
425     */
426    public Attachment getImageFirstRep() { 
427      if (getImage().isEmpty()) {
428        addImage();
429      }
430      return getImage().get(0);
431    }
432
433    /**
434     * @return {@link #patient} (The person to which the body site belongs.)
435     */
436    public Reference getPatient() { 
437      if (this.patient == null)
438        if (Configuration.errorOnAutoCreate())
439          throw new Error("Attempt to auto-create BodyStructure.patient");
440        else if (Configuration.doAutoCreate())
441          this.patient = new Reference(); // cc
442      return this.patient;
443    }
444
445    public boolean hasPatient() { 
446      return this.patient != null && !this.patient.isEmpty();
447    }
448
449    /**
450     * @param value {@link #patient} (The person to which the body site belongs.)
451     */
452    public BodyStructure setPatient(Reference value) { 
453      this.patient = value;
454      return this;
455    }
456
457    /**
458     * @return {@link #patient} 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. (The person to which the body site belongs.)
459     */
460    public Patient getPatientTarget() { 
461      if (this.patientTarget == null)
462        if (Configuration.errorOnAutoCreate())
463          throw new Error("Attempt to auto-create BodyStructure.patient");
464        else if (Configuration.doAutoCreate())
465          this.patientTarget = new Patient(); // aa
466      return this.patientTarget;
467    }
468
469    /**
470     * @param value {@link #patient} 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. (The person to which the body site belongs.)
471     */
472    public BodyStructure setPatientTarget(Patient value) { 
473      this.patientTarget = value;
474      return this;
475    }
476
477      protected void listChildren(List<Property> children) {
478        super.listChildren(children);
479        children.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier));
480        children.add(new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active));
481        children.add(new Property("morphology", "CodeableConcept", "The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.", 0, 1, morphology));
482        children.add(new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location));
483        children.add(new Property("locationQualifier", "CodeableConcept", "Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.", 0, java.lang.Integer.MAX_VALUE, locationQualifier));
484        children.add(new Property("description", "string", "A summary, charactarization or explanation of the body structure.", 0, 1, description));
485        children.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
486        children.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient));
487      }
488
489      @Override
490      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
491        switch (_hash) {
492        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier);
493        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active);
494        case 1807231644: /*morphology*/  return new Property("morphology", "CodeableConcept", "The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.", 0, 1, morphology);
495        case 1901043637: /*location*/  return new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location);
496        case 433081461: /*locationQualifier*/  return new Property("locationQualifier", "CodeableConcept", "Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.", 0, java.lang.Integer.MAX_VALUE, locationQualifier);
497        case -1724546052: /*description*/  return new Property("description", "string", "A summary, charactarization or explanation of the body structure.", 0, 1, description);
498        case 100313435: /*image*/  return new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image);
499        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient);
500        default: return super.getNamedProperty(_hash, _name, _checkValid);
501        }
502
503      }
504
505      @Override
506      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
507        switch (hash) {
508        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
509        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
510        case 1807231644: /*morphology*/ return this.morphology == null ? new Base[0] : new Base[] {this.morphology}; // CodeableConcept
511        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // CodeableConcept
512        case 433081461: /*locationQualifier*/ return this.locationQualifier == null ? new Base[0] : this.locationQualifier.toArray(new Base[this.locationQualifier.size()]); // CodeableConcept
513        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
514        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
515        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
516        default: return super.getProperty(hash, name, checkValid);
517        }
518
519      }
520
521      @Override
522      public Base setProperty(int hash, String name, Base value) throws FHIRException {
523        switch (hash) {
524        case -1618432855: // identifier
525          this.getIdentifier().add(castToIdentifier(value)); // Identifier
526          return value;
527        case -1422950650: // active
528          this.active = castToBoolean(value); // BooleanType
529          return value;
530        case 1807231644: // morphology
531          this.morphology = castToCodeableConcept(value); // CodeableConcept
532          return value;
533        case 1901043637: // location
534          this.location = castToCodeableConcept(value); // CodeableConcept
535          return value;
536        case 433081461: // locationQualifier
537          this.getLocationQualifier().add(castToCodeableConcept(value)); // CodeableConcept
538          return value;
539        case -1724546052: // description
540          this.description = castToString(value); // StringType
541          return value;
542        case 100313435: // image
543          this.getImage().add(castToAttachment(value)); // Attachment
544          return value;
545        case -791418107: // patient
546          this.patient = castToReference(value); // Reference
547          return value;
548        default: return super.setProperty(hash, name, value);
549        }
550
551      }
552
553      @Override
554      public Base setProperty(String name, Base value) throws FHIRException {
555        if (name.equals("identifier")) {
556          this.getIdentifier().add(castToIdentifier(value));
557        } else if (name.equals("active")) {
558          this.active = castToBoolean(value); // BooleanType
559        } else if (name.equals("morphology")) {
560          this.morphology = castToCodeableConcept(value); // CodeableConcept
561        } else if (name.equals("location")) {
562          this.location = castToCodeableConcept(value); // CodeableConcept
563        } else if (name.equals("locationQualifier")) {
564          this.getLocationQualifier().add(castToCodeableConcept(value));
565        } else if (name.equals("description")) {
566          this.description = castToString(value); // StringType
567        } else if (name.equals("image")) {
568          this.getImage().add(castToAttachment(value));
569        } else if (name.equals("patient")) {
570          this.patient = castToReference(value); // Reference
571        } else
572          return super.setProperty(name, value);
573        return value;
574      }
575
576      @Override
577      public Base makeProperty(int hash, String name) throws FHIRException {
578        switch (hash) {
579        case -1618432855:  return addIdentifier(); 
580        case -1422950650:  return getActiveElement();
581        case 1807231644:  return getMorphology(); 
582        case 1901043637:  return getLocation(); 
583        case 433081461:  return addLocationQualifier(); 
584        case -1724546052:  return getDescriptionElement();
585        case 100313435:  return addImage(); 
586        case -791418107:  return getPatient(); 
587        default: return super.makeProperty(hash, name);
588        }
589
590      }
591
592      @Override
593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
594        switch (hash) {
595        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
596        case -1422950650: /*active*/ return new String[] {"boolean"};
597        case 1807231644: /*morphology*/ return new String[] {"CodeableConcept"};
598        case 1901043637: /*location*/ return new String[] {"CodeableConcept"};
599        case 433081461: /*locationQualifier*/ return new String[] {"CodeableConcept"};
600        case -1724546052: /*description*/ return new String[] {"string"};
601        case 100313435: /*image*/ return new String[] {"Attachment"};
602        case -791418107: /*patient*/ return new String[] {"Reference"};
603        default: return super.getTypesForProperty(hash, name);
604        }
605
606      }
607
608      @Override
609      public Base addChild(String name) throws FHIRException {
610        if (name.equals("identifier")) {
611          return addIdentifier();
612        }
613        else if (name.equals("active")) {
614          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.active");
615        }
616        else if (name.equals("morphology")) {
617          this.morphology = new CodeableConcept();
618          return this.morphology;
619        }
620        else if (name.equals("location")) {
621          this.location = new CodeableConcept();
622          return this.location;
623        }
624        else if (name.equals("locationQualifier")) {
625          return addLocationQualifier();
626        }
627        else if (name.equals("description")) {
628          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.description");
629        }
630        else if (name.equals("image")) {
631          return addImage();
632        }
633        else if (name.equals("patient")) {
634          this.patient = new Reference();
635          return this.patient;
636        }
637        else
638          return super.addChild(name);
639      }
640
641  public String fhirType() {
642    return "BodyStructure";
643
644  }
645
646      public BodyStructure copy() {
647        BodyStructure dst = new BodyStructure();
648        copyValues(dst);
649        if (identifier != null) {
650          dst.identifier = new ArrayList<Identifier>();
651          for (Identifier i : identifier)
652            dst.identifier.add(i.copy());
653        };
654        dst.active = active == null ? null : active.copy();
655        dst.morphology = morphology == null ? null : morphology.copy();
656        dst.location = location == null ? null : location.copy();
657        if (locationQualifier != null) {
658          dst.locationQualifier = new ArrayList<CodeableConcept>();
659          for (CodeableConcept i : locationQualifier)
660            dst.locationQualifier.add(i.copy());
661        };
662        dst.description = description == null ? null : description.copy();
663        if (image != null) {
664          dst.image = new ArrayList<Attachment>();
665          for (Attachment i : image)
666            dst.image.add(i.copy());
667        };
668        dst.patient = patient == null ? null : patient.copy();
669        return dst;
670      }
671
672      protected BodyStructure typedCopy() {
673        return copy();
674      }
675
676      @Override
677      public boolean equalsDeep(Base other_) {
678        if (!super.equalsDeep(other_))
679          return false;
680        if (!(other_ instanceof BodyStructure))
681          return false;
682        BodyStructure o = (BodyStructure) other_;
683        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(morphology, o.morphology, true)
684           && compareDeep(location, o.location, true) && compareDeep(locationQualifier, o.locationQualifier, true)
685           && compareDeep(description, o.description, true) && compareDeep(image, o.image, true) && compareDeep(patient, o.patient, true)
686          ;
687      }
688
689      @Override
690      public boolean equalsShallow(Base other_) {
691        if (!super.equalsShallow(other_))
692          return false;
693        if (!(other_ instanceof BodyStructure))
694          return false;
695        BodyStructure o = (BodyStructure) other_;
696        return compareValues(active, o.active, true) && compareValues(description, o.description, true);
697      }
698
699      public boolean isEmpty() {
700        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, morphology
701          , location, locationQualifier, description, image, patient);
702      }
703
704  @Override
705  public ResourceType getResourceType() {
706    return ResourceType.BodyStructure;
707   }
708
709 /**
710   * Search parameter: <b>identifier</b>
711   * <p>
712   * Description: <b>Bodystructure identifier</b><br>
713   * Type: <b>token</b><br>
714   * Path: <b>BodyStructure.identifier</b><br>
715   * </p>
716   */
717  @SearchParamDefinition(name="identifier", path="BodyStructure.identifier", description="Bodystructure identifier", type="token" )
718  public static final String SP_IDENTIFIER = "identifier";
719 /**
720   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
721   * <p>
722   * Description: <b>Bodystructure identifier</b><br>
723   * Type: <b>token</b><br>
724   * Path: <b>BodyStructure.identifier</b><br>
725   * </p>
726   */
727  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
728
729 /**
730   * Search parameter: <b>morphology</b>
731   * <p>
732   * Description: <b>Kind of Structure</b><br>
733   * Type: <b>token</b><br>
734   * Path: <b>BodyStructure.morphology</b><br>
735   * </p>
736   */
737  @SearchParamDefinition(name="morphology", path="BodyStructure.morphology", description="Kind of Structure", type="token" )
738  public static final String SP_MORPHOLOGY = "morphology";
739 /**
740   * <b>Fluent Client</b> search parameter constant for <b>morphology</b>
741   * <p>
742   * Description: <b>Kind of Structure</b><br>
743   * Type: <b>token</b><br>
744   * Path: <b>BodyStructure.morphology</b><br>
745   * </p>
746   */
747  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MORPHOLOGY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MORPHOLOGY);
748
749 /**
750   * Search parameter: <b>patient</b>
751   * <p>
752   * Description: <b>Who this is about</b><br>
753   * Type: <b>reference</b><br>
754   * Path: <b>BodyStructure.patient</b><br>
755   * </p>
756   */
757  @SearchParamDefinition(name="patient", path="BodyStructure.patient", description="Who this is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
758  public static final String SP_PATIENT = "patient";
759 /**
760   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
761   * <p>
762   * Description: <b>Who this is about</b><br>
763   * Type: <b>reference</b><br>
764   * Path: <b>BodyStructure.patient</b><br>
765   * </p>
766   */
767  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
768
769/**
770   * Constant for fluent queries to be used to add include statements. Specifies
771   * the path value of "<b>BodyStructure:patient</b>".
772   */
773  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("BodyStructure:patient").toLocked();
774
775 /**
776   * Search parameter: <b>location</b>
777   * <p>
778   * Description: <b>Body site</b><br>
779   * Type: <b>token</b><br>
780   * Path: <b>BodyStructure.location</b><br>
781   * </p>
782   */
783  @SearchParamDefinition(name="location", path="BodyStructure.location", description="Body site", type="token" )
784  public static final String SP_LOCATION = "location";
785 /**
786   * <b>Fluent Client</b> search parameter constant for <b>location</b>
787   * <p>
788   * Description: <b>Body site</b><br>
789   * Type: <b>token</b><br>
790   * Path: <b>BodyStructure.location</b><br>
791   * </p>
792   */
793  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOCATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOCATION);
794
795
796}
797