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