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