001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
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.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * 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.
070 */
071@ResourceDef(name="BodyStructure", profile="http://hl7.org/fhir/StructureDefinition/BodyStructure")
072public class BodyStructure extends DomainResource {
073
074    /**
075     * Identifier for this instance of the anatomical structure.
076     */
077    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
078    @Description(shortDefinition="Bodystructure identifier", formalDefinition="Identifier for this instance of the anatomical structure." )
079    protected List<Identifier> identifier;
080
081    /**
082     * Whether this body site is in active use.
083     */
084    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
085    @Description(shortDefinition="Whether this record is in active use", formalDefinition="Whether this body site is in active use." )
086    protected BooleanType active;
087
088    /**
089     * The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.
090     */
091    @Child(name = "morphology", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
092    @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." )
093    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-code")
094    protected CodeableConcept morphology;
095
096    /**
097     * The anatomical location or region of the specimen, lesion, or body structure.
098     */
099    @Child(name = "location", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
100    @Description(shortDefinition="Body site", formalDefinition="The anatomical location or region of the specimen, lesion, or body structure." )
101    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
102    protected CodeableConcept location;
103
104    /**
105     * Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.
106     */
107    @Child(name = "locationQualifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
108    @Description(shortDefinition="Body site modifier", formalDefinition="Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane." )
109    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
110    protected List<CodeableConcept> locationQualifier;
111
112    /**
113     * A summary, characterization or explanation of the body structure.
114     */
115    @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
116    @Description(shortDefinition="Text description", formalDefinition="A summary, characterization or explanation of the body structure." )
117    protected StringType description;
118
119    /**
120     * Image or images used to identify a location.
121     */
122    @Child(name = "image", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
123    @Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
124    protected List<Attachment> image;
125
126    /**
127     * The person to which the body site belongs.
128     */
129    @Child(name = "patient", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
130    @Description(shortDefinition="Who this is about", formalDefinition="The person to which the body site belongs." )
131    protected Reference patient;
132
133    private static final long serialVersionUID = 101980276L;
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, 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
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, 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
371     */
372    public BodyStructure setDescriptionElement(StringType value) { 
373      this.description = value;
374      return this;
375    }
376
377    /**
378     * @return A summary, characterization 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, characterization 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      protected void listChildren(List<Property> children) {
476        super.listChildren(children);
477        children.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier));
478        children.add(new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active));
479        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));
480        children.add(new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location));
481        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));
482        children.add(new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description));
483        children.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
484        children.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient));
485      }
486
487      @Override
488      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
489        switch (_hash) {
490        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier);
491        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active);
492        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);
493        case 1901043637: /*location*/  return new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location);
494        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);
495        case -1724546052: /*description*/  return new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description);
496        case 100313435: /*image*/  return new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image);
497        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient);
498        default: return super.getNamedProperty(_hash, _name, _checkValid);
499        }
500
501      }
502
503      @Override
504      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
505        switch (hash) {
506        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
507        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
508        case 1807231644: /*morphology*/ return this.morphology == null ? new Base[0] : new Base[] {this.morphology}; // CodeableConcept
509        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // CodeableConcept
510        case 433081461: /*locationQualifier*/ return this.locationQualifier == null ? new Base[0] : this.locationQualifier.toArray(new Base[this.locationQualifier.size()]); // CodeableConcept
511        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
512        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
513        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
514        default: return super.getProperty(hash, name, checkValid);
515        }
516
517      }
518
519      @Override
520      public Base setProperty(int hash, String name, Base value) throws FHIRException {
521        switch (hash) {
522        case -1618432855: // identifier
523          this.getIdentifier().add(castToIdentifier(value)); // Identifier
524          return value;
525        case -1422950650: // active
526          this.active = castToBoolean(value); // BooleanType
527          return value;
528        case 1807231644: // morphology
529          this.morphology = castToCodeableConcept(value); // CodeableConcept
530          return value;
531        case 1901043637: // location
532          this.location = castToCodeableConcept(value); // CodeableConcept
533          return value;
534        case 433081461: // locationQualifier
535          this.getLocationQualifier().add(castToCodeableConcept(value)); // CodeableConcept
536          return value;
537        case -1724546052: // description
538          this.description = castToString(value); // StringType
539          return value;
540        case 100313435: // image
541          this.getImage().add(castToAttachment(value)); // Attachment
542          return value;
543        case -791418107: // patient
544          this.patient = castToReference(value); // Reference
545          return value;
546        default: return super.setProperty(hash, name, value);
547        }
548
549      }
550
551      @Override
552      public Base setProperty(String name, Base value) throws FHIRException {
553        if (name.equals("identifier")) {
554          this.getIdentifier().add(castToIdentifier(value));
555        } else if (name.equals("active")) {
556          this.active = castToBoolean(value); // BooleanType
557        } else if (name.equals("morphology")) {
558          this.morphology = castToCodeableConcept(value); // CodeableConcept
559        } else if (name.equals("location")) {
560          this.location = castToCodeableConcept(value); // CodeableConcept
561        } else if (name.equals("locationQualifier")) {
562          this.getLocationQualifier().add(castToCodeableConcept(value));
563        } else if (name.equals("description")) {
564          this.description = castToString(value); // StringType
565        } else if (name.equals("image")) {
566          this.getImage().add(castToAttachment(value));
567        } else if (name.equals("patient")) {
568          this.patient = castToReference(value); // Reference
569        } else
570          return super.setProperty(name, value);
571        return value;
572      }
573
574      @Override
575      public Base makeProperty(int hash, String name) throws FHIRException {
576        switch (hash) {
577        case -1618432855:  return addIdentifier(); 
578        case -1422950650:  return getActiveElement();
579        case 1807231644:  return getMorphology();
580        case 1901043637:  return getLocation();
581        case 433081461:  return addLocationQualifier(); 
582        case -1724546052:  return getDescriptionElement();
583        case 100313435:  return addImage(); 
584        case -791418107:  return getPatient();
585        default: return super.makeProperty(hash, name);
586        }
587
588      }
589
590      @Override
591      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
592        switch (hash) {
593        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
594        case -1422950650: /*active*/ return new String[] {"boolean"};
595        case 1807231644: /*morphology*/ return new String[] {"CodeableConcept"};
596        case 1901043637: /*location*/ return new String[] {"CodeableConcept"};
597        case 433081461: /*locationQualifier*/ return new String[] {"CodeableConcept"};
598        case -1724546052: /*description*/ return new String[] {"string"};
599        case 100313435: /*image*/ return new String[] {"Attachment"};
600        case -791418107: /*patient*/ return new String[] {"Reference"};
601        default: return super.getTypesForProperty(hash, name);
602        }
603
604      }
605
606      @Override
607      public Base addChild(String name) throws FHIRException {
608        if (name.equals("identifier")) {
609          return addIdentifier();
610        }
611        else if (name.equals("active")) {
612          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.active");
613        }
614        else if (name.equals("morphology")) {
615          this.morphology = new CodeableConcept();
616          return this.morphology;
617        }
618        else if (name.equals("location")) {
619          this.location = new CodeableConcept();
620          return this.location;
621        }
622        else if (name.equals("locationQualifier")) {
623          return addLocationQualifier();
624        }
625        else if (name.equals("description")) {
626          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.description");
627        }
628        else if (name.equals("image")) {
629          return addImage();
630        }
631        else if (name.equals("patient")) {
632          this.patient = new Reference();
633          return this.patient;
634        }
635        else
636          return super.addChild(name);
637      }
638
639  public String fhirType() {
640    return "BodyStructure";
641
642  }
643
644      public BodyStructure copy() {
645        BodyStructure dst = new BodyStructure();
646        copyValues(dst);
647        return dst;
648      }
649
650      public void copyValues(BodyStructure dst) {
651        super.copyValues(dst);
652        if (identifier != null) {
653          dst.identifier = new ArrayList<Identifier>();
654          for (Identifier i : identifier)
655            dst.identifier.add(i.copy());
656        };
657        dst.active = active == null ? null : active.copy();
658        dst.morphology = morphology == null ? null : morphology.copy();
659        dst.location = location == null ? null : location.copy();
660        if (locationQualifier != null) {
661          dst.locationQualifier = new ArrayList<CodeableConcept>();
662          for (CodeableConcept i : locationQualifier)
663            dst.locationQualifier.add(i.copy());
664        };
665        dst.description = description == null ? null : description.copy();
666        if (image != null) {
667          dst.image = new ArrayList<Attachment>();
668          for (Attachment i : image)
669            dst.image.add(i.copy());
670        };
671        dst.patient = patient == null ? null : patient.copy();
672      }
673
674      protected BodyStructure typedCopy() {
675        return copy();
676      }
677
678      @Override
679      public boolean equalsDeep(Base other_) {
680        if (!super.equalsDeep(other_))
681          return false;
682        if (!(other_ instanceof BodyStructure))
683          return false;
684        BodyStructure o = (BodyStructure) other_;
685        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(morphology, o.morphology, true)
686           && compareDeep(location, o.location, true) && compareDeep(locationQualifier, o.locationQualifier, true)
687           && compareDeep(description, o.description, true) && compareDeep(image, o.image, true) && compareDeep(patient, o.patient, true)
688          ;
689      }
690
691      @Override
692      public boolean equalsShallow(Base other_) {
693        if (!super.equalsShallow(other_))
694          return false;
695        if (!(other_ instanceof BodyStructure))
696          return false;
697        BodyStructure o = (BodyStructure) other_;
698        return compareValues(active, o.active, true) && compareValues(description, o.description, true);
699      }
700
701      public boolean isEmpty() {
702        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, morphology
703          , location, locationQualifier, description, image, patient);
704      }
705
706  @Override
707  public ResourceType getResourceType() {
708    return ResourceType.BodyStructure;
709   }
710
711 /**
712   * Search parameter: <b>identifier</b>
713   * <p>
714   * Description: <b>Bodystructure identifier</b><br>
715   * Type: <b>token</b><br>
716   * Path: <b>BodyStructure.identifier</b><br>
717   * </p>
718   */
719  @SearchParamDefinition(name="identifier", path="BodyStructure.identifier", description="Bodystructure identifier", type="token" )
720  public static final String SP_IDENTIFIER = "identifier";
721 /**
722   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
723   * <p>
724   * Description: <b>Bodystructure identifier</b><br>
725   * Type: <b>token</b><br>
726   * Path: <b>BodyStructure.identifier</b><br>
727   * </p>
728   */
729  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
730
731 /**
732   * Search parameter: <b>morphology</b>
733   * <p>
734   * Description: <b>Kind of Structure</b><br>
735   * Type: <b>token</b><br>
736   * Path: <b>BodyStructure.morphology</b><br>
737   * </p>
738   */
739  @SearchParamDefinition(name="morphology", path="BodyStructure.morphology", description="Kind of Structure", type="token" )
740  public static final String SP_MORPHOLOGY = "morphology";
741 /**
742   * <b>Fluent Client</b> search parameter constant for <b>morphology</b>
743   * <p>
744   * Description: <b>Kind of Structure</b><br>
745   * Type: <b>token</b><br>
746   * Path: <b>BodyStructure.morphology</b><br>
747   * </p>
748   */
749  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MORPHOLOGY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MORPHOLOGY);
750
751 /**
752   * Search parameter: <b>patient</b>
753   * <p>
754   * Description: <b>Who this is about</b><br>
755   * Type: <b>reference</b><br>
756   * Path: <b>BodyStructure.patient</b><br>
757   * </p>
758   */
759  @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 } )
760  public static final String SP_PATIENT = "patient";
761 /**
762   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
763   * <p>
764   * Description: <b>Who this is about</b><br>
765   * Type: <b>reference</b><br>
766   * Path: <b>BodyStructure.patient</b><br>
767   * </p>
768   */
769  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
770
771/**
772   * Constant for fluent queries to be used to add include statements. Specifies
773   * the path value of "<b>BodyStructure:patient</b>".
774   */
775  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("BodyStructure:patient").toLocked();
776
777 /**
778   * Search parameter: <b>location</b>
779   * <p>
780   * Description: <b>Body site</b><br>
781   * Type: <b>token</b><br>
782   * Path: <b>BodyStructure.location</b><br>
783   * </p>
784   */
785  @SearchParamDefinition(name="location", path="BodyStructure.location", description="Body site", type="token" )
786  public static final String SP_LOCATION = "location";
787 /**
788   * <b>Fluent Client</b> search parameter constant for <b>location</b>
789   * <p>
790   * Description: <b>Body site</b><br>
791   * Type: <b>token</b><br>
792   * Path: <b>BodyStructure.location</b><br>
793   * </p>
794   */
795  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOCATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOCATION);
796
797
798}
799