001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * 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.
052 */
053@ResourceDef(name="BodyStructure", profile="http://hl7.org/fhir/StructureDefinition/BodyStructure")
054public class BodyStructure extends DomainResource {
055
056    @Block()
057    public static class BodyStructureIncludedStructureComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Code that represents the included structure.
060         */
061        @Child(name = "structure", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
062        @Description(shortDefinition="Code that represents the included structure", formalDefinition="Code that represents the included structure." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
064        protected CodeableConcept structure;
065
066        /**
067         * Code that represents the included structure laterality.
068         */
069        @Child(name = "laterality", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="Code that represents the included structure laterality", formalDefinition="Code that represents the included structure laterality." )
071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
072        protected CodeableConcept laterality;
073
074        /**
075         * Code that represents the included structure qualifier.
076         */
077        @Child(name = "qualifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
078        @Description(shortDefinition="Code that represents the included structure qualifier", formalDefinition="Code that represents the included structure qualifier." )
079        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
080        protected List<CodeableConcept> qualifier;
081
082        private static final long serialVersionUID = -2036673377L;
083
084    /**
085     * Constructor
086     */
087      public BodyStructureIncludedStructureComponent() {
088        super();
089      }
090
091    /**
092     * Constructor
093     */
094      public BodyStructureIncludedStructureComponent(CodeableConcept structure) {
095        super();
096        this.setStructure(structure);
097      }
098
099        /**
100         * @return {@link #structure} (Code that represents the included structure.)
101         */
102        public CodeableConcept getStructure() { 
103          if (this.structure == null)
104            if (Configuration.errorOnAutoCreate())
105              throw new Error("Attempt to auto-create BodyStructureIncludedStructureComponent.structure");
106            else if (Configuration.doAutoCreate())
107              this.structure = new CodeableConcept(); // cc
108          return this.structure;
109        }
110
111        public boolean hasStructure() { 
112          return this.structure != null && !this.structure.isEmpty();
113        }
114
115        /**
116         * @param value {@link #structure} (Code that represents the included structure.)
117         */
118        public BodyStructureIncludedStructureComponent setStructure(CodeableConcept value) { 
119          this.structure = value;
120          return this;
121        }
122
123        /**
124         * @return {@link #laterality} (Code that represents the included structure laterality.)
125         */
126        public CodeableConcept getLaterality() { 
127          if (this.laterality == null)
128            if (Configuration.errorOnAutoCreate())
129              throw new Error("Attempt to auto-create BodyStructureIncludedStructureComponent.laterality");
130            else if (Configuration.doAutoCreate())
131              this.laterality = new CodeableConcept(); // cc
132          return this.laterality;
133        }
134
135        public boolean hasLaterality() { 
136          return this.laterality != null && !this.laterality.isEmpty();
137        }
138
139        /**
140         * @param value {@link #laterality} (Code that represents the included structure laterality.)
141         */
142        public BodyStructureIncludedStructureComponent setLaterality(CodeableConcept value) { 
143          this.laterality = value;
144          return this;
145        }
146
147        /**
148         * @return {@link #qualifier} (Code that represents the included structure qualifier.)
149         */
150        public List<CodeableConcept> getQualifier() { 
151          if (this.qualifier == null)
152            this.qualifier = new ArrayList<CodeableConcept>();
153          return this.qualifier;
154        }
155
156        /**
157         * @return Returns a reference to <code>this</code> for easy method chaining
158         */
159        public BodyStructureIncludedStructureComponent setQualifier(List<CodeableConcept> theQualifier) { 
160          this.qualifier = theQualifier;
161          return this;
162        }
163
164        public boolean hasQualifier() { 
165          if (this.qualifier == null)
166            return false;
167          for (CodeableConcept item : this.qualifier)
168            if (!item.isEmpty())
169              return true;
170          return false;
171        }
172
173        public CodeableConcept addQualifier() { //3
174          CodeableConcept t = new CodeableConcept();
175          if (this.qualifier == null)
176            this.qualifier = new ArrayList<CodeableConcept>();
177          this.qualifier.add(t);
178          return t;
179        }
180
181        public BodyStructureIncludedStructureComponent addQualifier(CodeableConcept t) { //3
182          if (t == null)
183            return this;
184          if (this.qualifier == null)
185            this.qualifier = new ArrayList<CodeableConcept>();
186          this.qualifier.add(t);
187          return this;
188        }
189
190        /**
191         * @return The first repetition of repeating field {@link #qualifier}, creating it if it does not already exist {3}
192         */
193        public CodeableConcept getQualifierFirstRep() { 
194          if (getQualifier().isEmpty()) {
195            addQualifier();
196          }
197          return getQualifier().get(0);
198        }
199
200        protected void listChildren(List<Property> children) {
201          super.listChildren(children);
202          children.add(new Property("structure", "CodeableConcept", "Code that represents the included structure.", 0, 1, structure));
203          children.add(new Property("laterality", "CodeableConcept", "Code that represents the included structure laterality.", 0, 1, laterality));
204          children.add(new Property("qualifier", "CodeableConcept", "Code that represents the included structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier));
205        }
206
207        @Override
208        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
209          switch (_hash) {
210          case 144518515: /*structure*/  return new Property("structure", "CodeableConcept", "Code that represents the included structure.", 0, 1, structure);
211          case -170291817: /*laterality*/  return new Property("laterality", "CodeableConcept", "Code that represents the included structure laterality.", 0, 1, laterality);
212          case -1247940438: /*qualifier*/  return new Property("qualifier", "CodeableConcept", "Code that represents the included structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier);
213          default: return super.getNamedProperty(_hash, _name, _checkValid);
214          }
215
216        }
217
218      @Override
219      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
220        switch (hash) {
221        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : new Base[] {this.structure}; // CodeableConcept
222        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // CodeableConcept
223        case -1247940438: /*qualifier*/ return this.qualifier == null ? new Base[0] : this.qualifier.toArray(new Base[this.qualifier.size()]); // CodeableConcept
224        default: return super.getProperty(hash, name, checkValid);
225        }
226
227      }
228
229      @Override
230      public Base setProperty(int hash, String name, Base value) throws FHIRException {
231        switch (hash) {
232        case 144518515: // structure
233          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
234          return value;
235        case -170291817: // laterality
236          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
237          return value;
238        case -1247940438: // qualifier
239          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
240          return value;
241        default: return super.setProperty(hash, name, value);
242        }
243
244      }
245
246      @Override
247      public Base setProperty(String name, Base value) throws FHIRException {
248        if (name.equals("structure")) {
249          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
250        } else if (name.equals("laterality")) {
251          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
252        } else if (name.equals("qualifier")) {
253          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value));
254        } else
255          return super.setProperty(name, value);
256        return value;
257      }
258
259      @Override
260      public Base makeProperty(int hash, String name) throws FHIRException {
261        switch (hash) {
262        case 144518515:  return getStructure();
263        case -170291817:  return getLaterality();
264        case -1247940438:  return addQualifier(); 
265        default: return super.makeProperty(hash, name);
266        }
267
268      }
269
270      @Override
271      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
272        switch (hash) {
273        case 144518515: /*structure*/ return new String[] {"CodeableConcept"};
274        case -170291817: /*laterality*/ return new String[] {"CodeableConcept"};
275        case -1247940438: /*qualifier*/ return new String[] {"CodeableConcept"};
276        default: return super.getTypesForProperty(hash, name);
277        }
278
279      }
280
281      @Override
282      public Base addChild(String name) throws FHIRException {
283        if (name.equals("structure")) {
284          this.structure = new CodeableConcept();
285          return this.structure;
286        }
287        else if (name.equals("laterality")) {
288          this.laterality = new CodeableConcept();
289          return this.laterality;
290        }
291        else if (name.equals("qualifier")) {
292          return addQualifier();
293        }
294        else
295          return super.addChild(name);
296      }
297
298      public BodyStructureIncludedStructureComponent copy() {
299        BodyStructureIncludedStructureComponent dst = new BodyStructureIncludedStructureComponent();
300        copyValues(dst);
301        return dst;
302      }
303
304      public void copyValues(BodyStructureIncludedStructureComponent dst) {
305        super.copyValues(dst);
306        dst.structure = structure == null ? null : structure.copy();
307        dst.laterality = laterality == null ? null : laterality.copy();
308        if (qualifier != null) {
309          dst.qualifier = new ArrayList<CodeableConcept>();
310          for (CodeableConcept i : qualifier)
311            dst.qualifier.add(i.copy());
312        };
313      }
314
315      @Override
316      public boolean equalsDeep(Base other_) {
317        if (!super.equalsDeep(other_))
318          return false;
319        if (!(other_ instanceof BodyStructureIncludedStructureComponent))
320          return false;
321        BodyStructureIncludedStructureComponent o = (BodyStructureIncludedStructureComponent) other_;
322        return compareDeep(structure, o.structure, true) && compareDeep(laterality, o.laterality, true)
323           && compareDeep(qualifier, o.qualifier, true);
324      }
325
326      @Override
327      public boolean equalsShallow(Base other_) {
328        if (!super.equalsShallow(other_))
329          return false;
330        if (!(other_ instanceof BodyStructureIncludedStructureComponent))
331          return false;
332        BodyStructureIncludedStructureComponent o = (BodyStructureIncludedStructureComponent) other_;
333        return true;
334      }
335
336      public boolean isEmpty() {
337        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(structure, laterality, qualifier
338          );
339      }
340
341  public String fhirType() {
342    return "BodyStructure.includedStructure";
343
344  }
345
346  }
347
348    @Block()
349    public static class BodyStructureExcludedStructureComponent extends BackboneElement implements IBaseBackboneElement {
350        /**
351         * Code that represents the excluded structure.
352         */
353        @Child(name = "structure", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
354        @Description(shortDefinition="Code that represents the excluded structure", formalDefinition="Code that represents the excluded structure." )
355        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
356        protected CodeableConcept structure;
357
358        /**
359         * Code that represents the excluded structure laterality.
360         */
361        @Child(name = "laterality", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
362        @Description(shortDefinition="Code that represents the excluded structure laterality", formalDefinition="Code that represents the excluded structure laterality." )
363        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
364        protected CodeableConcept laterality;
365
366        /**
367         * Code that represents the excluded structure qualifier.
368         */
369        @Child(name = "qualifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
370        @Description(shortDefinition="Code that represents the excluded structure qualifier", formalDefinition="Code that represents the excluded structure qualifier." )
371        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
372        protected List<CodeableConcept> qualifier;
373
374        private static final long serialVersionUID = -2036673377L;
375
376    /**
377     * Constructor
378     */
379      public BodyStructureExcludedStructureComponent() {
380        super();
381      }
382
383    /**
384     * Constructor
385     */
386      public BodyStructureExcludedStructureComponent(CodeableConcept structure) {
387        super();
388        this.setStructure(structure);
389      }
390
391        /**
392         * @return {@link #structure} (Code that represents the excluded structure.)
393         */
394        public CodeableConcept getStructure() { 
395          if (this.structure == null)
396            if (Configuration.errorOnAutoCreate())
397              throw new Error("Attempt to auto-create BodyStructureExcludedStructureComponent.structure");
398            else if (Configuration.doAutoCreate())
399              this.structure = new CodeableConcept(); // cc
400          return this.structure;
401        }
402
403        public boolean hasStructure() { 
404          return this.structure != null && !this.structure.isEmpty();
405        }
406
407        /**
408         * @param value {@link #structure} (Code that represents the excluded structure.)
409         */
410        public BodyStructureExcludedStructureComponent setStructure(CodeableConcept value) { 
411          this.structure = value;
412          return this;
413        }
414
415        /**
416         * @return {@link #laterality} (Code that represents the excluded structure laterality.)
417         */
418        public CodeableConcept getLaterality() { 
419          if (this.laterality == null)
420            if (Configuration.errorOnAutoCreate())
421              throw new Error("Attempt to auto-create BodyStructureExcludedStructureComponent.laterality");
422            else if (Configuration.doAutoCreate())
423              this.laterality = new CodeableConcept(); // cc
424          return this.laterality;
425        }
426
427        public boolean hasLaterality() { 
428          return this.laterality != null && !this.laterality.isEmpty();
429        }
430
431        /**
432         * @param value {@link #laterality} (Code that represents the excluded structure laterality.)
433         */
434        public BodyStructureExcludedStructureComponent setLaterality(CodeableConcept value) { 
435          this.laterality = value;
436          return this;
437        }
438
439        /**
440         * @return {@link #qualifier} (Code that represents the excluded structure qualifier.)
441         */
442        public List<CodeableConcept> getQualifier() { 
443          if (this.qualifier == null)
444            this.qualifier = new ArrayList<CodeableConcept>();
445          return this.qualifier;
446        }
447
448        /**
449         * @return Returns a reference to <code>this</code> for easy method chaining
450         */
451        public BodyStructureExcludedStructureComponent setQualifier(List<CodeableConcept> theQualifier) { 
452          this.qualifier = theQualifier;
453          return this;
454        }
455
456        public boolean hasQualifier() { 
457          if (this.qualifier == null)
458            return false;
459          for (CodeableConcept item : this.qualifier)
460            if (!item.isEmpty())
461              return true;
462          return false;
463        }
464
465        public CodeableConcept addQualifier() { //3
466          CodeableConcept t = new CodeableConcept();
467          if (this.qualifier == null)
468            this.qualifier = new ArrayList<CodeableConcept>();
469          this.qualifier.add(t);
470          return t;
471        }
472
473        public BodyStructureExcludedStructureComponent addQualifier(CodeableConcept t) { //3
474          if (t == null)
475            return this;
476          if (this.qualifier == null)
477            this.qualifier = new ArrayList<CodeableConcept>();
478          this.qualifier.add(t);
479          return this;
480        }
481
482        /**
483         * @return The first repetition of repeating field {@link #qualifier}, creating it if it does not already exist {3}
484         */
485        public CodeableConcept getQualifierFirstRep() { 
486          if (getQualifier().isEmpty()) {
487            addQualifier();
488          }
489          return getQualifier().get(0);
490        }
491
492        protected void listChildren(List<Property> children) {
493          super.listChildren(children);
494          children.add(new Property("structure", "CodeableConcept", "Code that represents the excluded structure.", 0, 1, structure));
495          children.add(new Property("laterality", "CodeableConcept", "Code that represents the excluded structure laterality.", 0, 1, laterality));
496          children.add(new Property("qualifier", "CodeableConcept", "Code that represents the excluded structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier));
497        }
498
499        @Override
500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
501          switch (_hash) {
502          case 144518515: /*structure*/  return new Property("structure", "CodeableConcept", "Code that represents the excluded structure.", 0, 1, structure);
503          case -170291817: /*laterality*/  return new Property("laterality", "CodeableConcept", "Code that represents the excluded structure laterality.", 0, 1, laterality);
504          case -1247940438: /*qualifier*/  return new Property("qualifier", "CodeableConcept", "Code that represents the excluded structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier);
505          default: return super.getNamedProperty(_hash, _name, _checkValid);
506          }
507
508        }
509
510      @Override
511      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
512        switch (hash) {
513        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : new Base[] {this.structure}; // CodeableConcept
514        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // CodeableConcept
515        case -1247940438: /*qualifier*/ return this.qualifier == null ? new Base[0] : this.qualifier.toArray(new Base[this.qualifier.size()]); // CodeableConcept
516        default: return super.getProperty(hash, name, checkValid);
517        }
518
519      }
520
521      @Override
522      public Base setProperty(int hash, String name, Base value) throws FHIRException {
523        switch (hash) {
524        case 144518515: // structure
525          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
526          return value;
527        case -170291817: // laterality
528          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
529          return value;
530        case -1247940438: // qualifier
531          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
532          return value;
533        default: return super.setProperty(hash, name, value);
534        }
535
536      }
537
538      @Override
539      public Base setProperty(String name, Base value) throws FHIRException {
540        if (name.equals("structure")) {
541          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
542        } else if (name.equals("laterality")) {
543          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
544        } else if (name.equals("qualifier")) {
545          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value));
546        } else
547          return super.setProperty(name, value);
548        return value;
549      }
550
551      @Override
552      public Base makeProperty(int hash, String name) throws FHIRException {
553        switch (hash) {
554        case 144518515:  return getStructure();
555        case -170291817:  return getLaterality();
556        case -1247940438:  return addQualifier(); 
557        default: return super.makeProperty(hash, name);
558        }
559
560      }
561
562      @Override
563      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
564        switch (hash) {
565        case 144518515: /*structure*/ return new String[] {"CodeableConcept"};
566        case -170291817: /*laterality*/ return new String[] {"CodeableConcept"};
567        case -1247940438: /*qualifier*/ return new String[] {"CodeableConcept"};
568        default: return super.getTypesForProperty(hash, name);
569        }
570
571      }
572
573      @Override
574      public Base addChild(String name) throws FHIRException {
575        if (name.equals("structure")) {
576          this.structure = new CodeableConcept();
577          return this.structure;
578        }
579        else if (name.equals("laterality")) {
580          this.laterality = new CodeableConcept();
581          return this.laterality;
582        }
583        else if (name.equals("qualifier")) {
584          return addQualifier();
585        }
586        else
587          return super.addChild(name);
588      }
589
590      public BodyStructureExcludedStructureComponent copy() {
591        BodyStructureExcludedStructureComponent dst = new BodyStructureExcludedStructureComponent();
592        copyValues(dst);
593        return dst;
594      }
595
596      public void copyValues(BodyStructureExcludedStructureComponent dst) {
597        super.copyValues(dst);
598        dst.structure = structure == null ? null : structure.copy();
599        dst.laterality = laterality == null ? null : laterality.copy();
600        if (qualifier != null) {
601          dst.qualifier = new ArrayList<CodeableConcept>();
602          for (CodeableConcept i : qualifier)
603            dst.qualifier.add(i.copy());
604        };
605      }
606
607      @Override
608      public boolean equalsDeep(Base other_) {
609        if (!super.equalsDeep(other_))
610          return false;
611        if (!(other_ instanceof BodyStructureExcludedStructureComponent))
612          return false;
613        BodyStructureExcludedStructureComponent o = (BodyStructureExcludedStructureComponent) other_;
614        return compareDeep(structure, o.structure, true) && compareDeep(laterality, o.laterality, true)
615           && compareDeep(qualifier, o.qualifier, true);
616      }
617
618      @Override
619      public boolean equalsShallow(Base other_) {
620        if (!super.equalsShallow(other_))
621          return false;
622        if (!(other_ instanceof BodyStructureExcludedStructureComponent))
623          return false;
624        BodyStructureExcludedStructureComponent o = (BodyStructureExcludedStructureComponent) other_;
625        return true;
626      }
627
628      public boolean isEmpty() {
629        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(structure, laterality, qualifier
630          );
631      }
632
633  public String fhirType() {
634    return "BodyStructure.excludedStructure";
635
636  }
637
638  }
639
640    /**
641     * Identifier for this instance of the anatomical structure.
642     */
643    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
644    @Description(shortDefinition="Bodystructure identifier", formalDefinition="Identifier for this instance of the anatomical structure." )
645    protected List<Identifier> identifier;
646
647    /**
648     * Whether this body site is in active use.
649     */
650    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
651    @Description(shortDefinition="Whether this record is in active use", formalDefinition="Whether this body site is in active use." )
652    protected BooleanType active;
653
654    /**
655     * The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.
656     */
657    @Child(name = "morphology", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
658    @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." )
659    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-code")
660    protected CodeableConcept morphology;
661
662    /**
663     * The anatomical location or region of the specimen, lesion, or body structure.
664     */
665    @Child(name = "location", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
666    @Description(shortDefinition="Body site", formalDefinition="The anatomical location or region of the specimen, lesion, or body structure." )
667    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
668    protected CodeableConcept location;
669
670    /**
671     * The anatomical location(s) or region(s) of the specimen, lesion, or body structure.
672     */
673    @Child(name = "includedStructure", type = {}, order=4, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
674    @Description(shortDefinition="Included anatomic location(s)", formalDefinition="The anatomical location(s) or region(s) of the specimen, lesion, or body structure." )
675    protected List<BodyStructureIncludedStructureComponent> includedStructure;
676
677    /**
678     * The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.
679     */
680    @Child(name = "excludedStructure", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
681    @Description(shortDefinition="Excluded anatomic locations(s)", formalDefinition="The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure." )
682    protected List<BodyStructureExcludedStructureComponent> excludedStructure;
683
684    /**
685     * A summary, characterization or explanation of the body structure.
686     */
687    @Child(name = "description", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
688    @Description(shortDefinition="Text description", formalDefinition="A summary, characterization or explanation of the body structure." )
689    protected StringType description;
690
691    /**
692     * Image or images used to identify a location.
693     */
694    @Child(name = "image", type = {Attachment.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
695    @Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
696    protected List<Attachment> image;
697
698    /**
699     * The person to which the body site belongs.
700     */
701    @Child(name = "patient", type = {Patient.class}, order=8, min=1, max=1, modifier=false, summary=true)
702    @Description(shortDefinition="Who this is about", formalDefinition="The person to which the body site belongs." )
703    protected Reference patient;
704
705    private static final long serialVersionUID = 1435296914L;
706
707  /**
708   * Constructor
709   */
710    public BodyStructure() {
711      super();
712    }
713
714  /**
715   * Constructor
716   */
717    public BodyStructure(BodyStructureIncludedStructureComponent includedStructure, Reference patient) {
718      super();
719      this.addIncludedStructure(includedStructure);
720      this.setPatient(patient);
721    }
722
723    /**
724     * @return {@link #identifier} (Identifier for this instance of the anatomical structure.)
725     */
726    public List<Identifier> getIdentifier() { 
727      if (this.identifier == null)
728        this.identifier = new ArrayList<Identifier>();
729      return this.identifier;
730    }
731
732    /**
733     * @return Returns a reference to <code>this</code> for easy method chaining
734     */
735    public BodyStructure setIdentifier(List<Identifier> theIdentifier) { 
736      this.identifier = theIdentifier;
737      return this;
738    }
739
740    public boolean hasIdentifier() { 
741      if (this.identifier == null)
742        return false;
743      for (Identifier item : this.identifier)
744        if (!item.isEmpty())
745          return true;
746      return false;
747    }
748
749    public Identifier addIdentifier() { //3
750      Identifier t = new Identifier();
751      if (this.identifier == null)
752        this.identifier = new ArrayList<Identifier>();
753      this.identifier.add(t);
754      return t;
755    }
756
757    public BodyStructure addIdentifier(Identifier t) { //3
758      if (t == null)
759        return this;
760      if (this.identifier == null)
761        this.identifier = new ArrayList<Identifier>();
762      this.identifier.add(t);
763      return this;
764    }
765
766    /**
767     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
768     */
769    public Identifier getIdentifierFirstRep() { 
770      if (getIdentifier().isEmpty()) {
771        addIdentifier();
772      }
773      return getIdentifier().get(0);
774    }
775
776    /**
777     * @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
778     */
779    public BooleanType getActiveElement() { 
780      if (this.active == null)
781        if (Configuration.errorOnAutoCreate())
782          throw new Error("Attempt to auto-create BodyStructure.active");
783        else if (Configuration.doAutoCreate())
784          this.active = new BooleanType(); // bb
785      return this.active;
786    }
787
788    public boolean hasActiveElement() { 
789      return this.active != null && !this.active.isEmpty();
790    }
791
792    public boolean hasActive() { 
793      return this.active != null && !this.active.isEmpty();
794    }
795
796    /**
797     * @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
798     */
799    public BodyStructure setActiveElement(BooleanType value) { 
800      this.active = value;
801      return this;
802    }
803
804    /**
805     * @return Whether this body site is in active use.
806     */
807    public boolean getActive() { 
808      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
809    }
810
811    /**
812     * @param value Whether this body site is in active use.
813     */
814    public BodyStructure setActive(boolean value) { 
815        if (this.active == null)
816          this.active = new BooleanType();
817        this.active.setValue(value);
818      return this;
819    }
820
821    /**
822     * @return {@link #morphology} (The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.)
823     */
824    public CodeableConcept getMorphology() { 
825      if (this.morphology == null)
826        if (Configuration.errorOnAutoCreate())
827          throw new Error("Attempt to auto-create BodyStructure.morphology");
828        else if (Configuration.doAutoCreate())
829          this.morphology = new CodeableConcept(); // cc
830      return this.morphology;
831    }
832
833    public boolean hasMorphology() { 
834      return this.morphology != null && !this.morphology.isEmpty();
835    }
836
837    /**
838     * @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.)
839     */
840    public BodyStructure setMorphology(CodeableConcept value) { 
841      this.morphology = value;
842      return this;
843    }
844
845    /**
846     * @return {@link #location} (The anatomical location or region of the specimen, lesion, or body structure.)
847     */
848    public CodeableConcept getLocation() { 
849      if (this.location == null)
850        if (Configuration.errorOnAutoCreate())
851          throw new Error("Attempt to auto-create BodyStructure.location");
852        else if (Configuration.doAutoCreate())
853          this.location = new CodeableConcept(); // cc
854      return this.location;
855    }
856
857    public boolean hasLocation() { 
858      return this.location != null && !this.location.isEmpty();
859    }
860
861    /**
862     * @param value {@link #location} (The anatomical location or region of the specimen, lesion, or body structure.)
863     */
864    public BodyStructure setLocation(CodeableConcept value) { 
865      this.location = value;
866      return this;
867    }
868
869    /**
870     * @return {@link #includedStructure} (The anatomical location(s) or region(s) of the specimen, lesion, or body structure.)
871     */
872    public List<BodyStructureIncludedStructureComponent> getIncludedStructure() { 
873      if (this.includedStructure == null)
874        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
875      return this.includedStructure;
876    }
877
878    /**
879     * @return Returns a reference to <code>this</code> for easy method chaining
880     */
881    public BodyStructure setIncludedStructure(List<BodyStructureIncludedStructureComponent> theIncludedStructure) { 
882      this.includedStructure = theIncludedStructure;
883      return this;
884    }
885
886    public boolean hasIncludedStructure() { 
887      if (this.includedStructure == null)
888        return false;
889      for (BodyStructureIncludedStructureComponent item : this.includedStructure)
890        if (!item.isEmpty())
891          return true;
892      return false;
893    }
894
895    public BodyStructureIncludedStructureComponent addIncludedStructure() { //3
896      BodyStructureIncludedStructureComponent t = new BodyStructureIncludedStructureComponent();
897      if (this.includedStructure == null)
898        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
899      this.includedStructure.add(t);
900      return t;
901    }
902
903    public BodyStructure addIncludedStructure(BodyStructureIncludedStructureComponent t) { //3
904      if (t == null)
905        return this;
906      if (this.includedStructure == null)
907        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
908      this.includedStructure.add(t);
909      return this;
910    }
911
912    /**
913     * @return The first repetition of repeating field {@link #includedStructure}, creating it if it does not already exist {3}
914     */
915    public BodyStructureIncludedStructureComponent getIncludedStructureFirstRep() { 
916      if (getIncludedStructure().isEmpty()) {
917        addIncludedStructure();
918      }
919      return getIncludedStructure().get(0);
920    }
921
922    /**
923     * @return {@link #excludedStructure} (The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.)
924     */
925    public List<BodyStructureExcludedStructureComponent> getExcludedStructure() { 
926      if (this.excludedStructure == null)
927        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
928      return this.excludedStructure;
929    }
930
931    /**
932     * @return Returns a reference to <code>this</code> for easy method chaining
933     */
934    public BodyStructure setExcludedStructure(List<BodyStructureExcludedStructureComponent> theExcludedStructure) { 
935      this.excludedStructure = theExcludedStructure;
936      return this;
937    }
938
939    public boolean hasExcludedStructure() { 
940      if (this.excludedStructure == null)
941        return false;
942      for (BodyStructureExcludedStructureComponent item : this.excludedStructure)
943        if (!item.isEmpty())
944          return true;
945      return false;
946    }
947
948    public BodyStructureExcludedStructureComponent addExcludedStructure() { //3
949      BodyStructureExcludedStructureComponent t = new BodyStructureExcludedStructureComponent();
950      if (this.excludedStructure == null)
951        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
952      this.excludedStructure.add(t);
953      return t;
954    }
955
956    public BodyStructure addExcludedStructure(BodyStructureExcludedStructureComponent t) { //3
957      if (t == null)
958        return this;
959      if (this.excludedStructure == null)
960        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
961      this.excludedStructure.add(t);
962      return this;
963    }
964
965    /**
966     * @return The first repetition of repeating field {@link #excludedStructure}, creating it if it does not already exist {3}
967     */
968    public BodyStructureExcludedStructureComponent getExcludedStructureFirstRep() { 
969      if (getExcludedStructure().isEmpty()) {
970        addExcludedStructure();
971      }
972      return getExcludedStructure().get(0);
973    }
974
975    /**
976     * @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
977     */
978    public StringType getDescriptionElement() { 
979      if (this.description == null)
980        if (Configuration.errorOnAutoCreate())
981          throw new Error("Attempt to auto-create BodyStructure.description");
982        else if (Configuration.doAutoCreate())
983          this.description = new StringType(); // bb
984      return this.description;
985    }
986
987    public boolean hasDescriptionElement() { 
988      return this.description != null && !this.description.isEmpty();
989    }
990
991    public boolean hasDescription() { 
992      return this.description != null && !this.description.isEmpty();
993    }
994
995    /**
996     * @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
997     */
998    public BodyStructure setDescriptionElement(StringType value) { 
999      this.description = value;
1000      return this;
1001    }
1002
1003    /**
1004     * @return A summary, characterization or explanation of the body structure.
1005     */
1006    public String getDescription() { 
1007      return this.description == null ? null : this.description.getValue();
1008    }
1009
1010    /**
1011     * @param value A summary, characterization or explanation of the body structure.
1012     */
1013    public BodyStructure setDescription(String value) { 
1014      if (Utilities.noString(value))
1015        this.description = null;
1016      else {
1017        if (this.description == null)
1018          this.description = new StringType();
1019        this.description.setValue(value);
1020      }
1021      return this;
1022    }
1023
1024    /**
1025     * @return {@link #image} (Image or images used to identify a location.)
1026     */
1027    public List<Attachment> getImage() { 
1028      if (this.image == null)
1029        this.image = new ArrayList<Attachment>();
1030      return this.image;
1031    }
1032
1033    /**
1034     * @return Returns a reference to <code>this</code> for easy method chaining
1035     */
1036    public BodyStructure setImage(List<Attachment> theImage) { 
1037      this.image = theImage;
1038      return this;
1039    }
1040
1041    public boolean hasImage() { 
1042      if (this.image == null)
1043        return false;
1044      for (Attachment item : this.image)
1045        if (!item.isEmpty())
1046          return true;
1047      return false;
1048    }
1049
1050    public Attachment addImage() { //3
1051      Attachment t = new Attachment();
1052      if (this.image == null)
1053        this.image = new ArrayList<Attachment>();
1054      this.image.add(t);
1055      return t;
1056    }
1057
1058    public BodyStructure addImage(Attachment t) { //3
1059      if (t == null)
1060        return this;
1061      if (this.image == null)
1062        this.image = new ArrayList<Attachment>();
1063      this.image.add(t);
1064      return this;
1065    }
1066
1067    /**
1068     * @return The first repetition of repeating field {@link #image}, creating it if it does not already exist {3}
1069     */
1070    public Attachment getImageFirstRep() { 
1071      if (getImage().isEmpty()) {
1072        addImage();
1073      }
1074      return getImage().get(0);
1075    }
1076
1077    /**
1078     * @return {@link #patient} (The person to which the body site belongs.)
1079     */
1080    public Reference getPatient() { 
1081      if (this.patient == null)
1082        if (Configuration.errorOnAutoCreate())
1083          throw new Error("Attempt to auto-create BodyStructure.patient");
1084        else if (Configuration.doAutoCreate())
1085          this.patient = new Reference(); // cc
1086      return this.patient;
1087    }
1088
1089    public boolean hasPatient() { 
1090      return this.patient != null && !this.patient.isEmpty();
1091    }
1092
1093    /**
1094     * @param value {@link #patient} (The person to which the body site belongs.)
1095     */
1096    public BodyStructure setPatient(Reference value) { 
1097      this.patient = value;
1098      return this;
1099    }
1100
1101      protected void listChildren(List<Property> children) {
1102        super.listChildren(children);
1103        children.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier));
1104        children.add(new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active));
1105        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));
1106        children.add(new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location));
1107        children.add(new Property("includedStructure", "", "The anatomical location(s) or region(s) of the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, includedStructure));
1108        children.add(new Property("excludedStructure", "", "The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, excludedStructure));
1109        children.add(new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description));
1110        children.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
1111        children.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient));
1112      }
1113
1114      @Override
1115      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1116        switch (_hash) {
1117        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier);
1118        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active);
1119        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);
1120        case 1901043637: /*location*/  return new Property("location", "CodeableConcept", "The anatomical location or region of the specimen, lesion, or body structure.", 0, 1, location);
1121        case -1174069225: /*includedStructure*/  return new Property("includedStructure", "", "The anatomical location(s) or region(s) of the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, includedStructure);
1122        case 1192252105: /*excludedStructure*/  return new Property("excludedStructure", "", "The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, excludedStructure);
1123        case -1724546052: /*description*/  return new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description);
1124        case 100313435: /*image*/  return new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image);
1125        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient);
1126        default: return super.getNamedProperty(_hash, _name, _checkValid);
1127        }
1128
1129      }
1130
1131      @Override
1132      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1133        switch (hash) {
1134        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1135        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
1136        case 1807231644: /*morphology*/ return this.morphology == null ? new Base[0] : new Base[] {this.morphology}; // CodeableConcept
1137        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // CodeableConcept
1138        case -1174069225: /*includedStructure*/ return this.includedStructure == null ? new Base[0] : this.includedStructure.toArray(new Base[this.includedStructure.size()]); // BodyStructureIncludedStructureComponent
1139        case 1192252105: /*excludedStructure*/ return this.excludedStructure == null ? new Base[0] : this.excludedStructure.toArray(new Base[this.excludedStructure.size()]); // BodyStructureExcludedStructureComponent
1140        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1141        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
1142        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1143        default: return super.getProperty(hash, name, checkValid);
1144        }
1145
1146      }
1147
1148      @Override
1149      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1150        switch (hash) {
1151        case -1618432855: // identifier
1152          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1153          return value;
1154        case -1422950650: // active
1155          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1156          return value;
1157        case 1807231644: // morphology
1158          this.morphology = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1159          return value;
1160        case 1901043637: // location
1161          this.location = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1162          return value;
1163        case -1174069225: // includedStructure
1164          this.getIncludedStructure().add((BodyStructureIncludedStructureComponent) value); // BodyStructureIncludedStructureComponent
1165          return value;
1166        case 1192252105: // excludedStructure
1167          this.getExcludedStructure().add((BodyStructureExcludedStructureComponent) value); // BodyStructureExcludedStructureComponent
1168          return value;
1169        case -1724546052: // description
1170          this.description = TypeConvertor.castToString(value); // StringType
1171          return value;
1172        case 100313435: // image
1173          this.getImage().add(TypeConvertor.castToAttachment(value)); // Attachment
1174          return value;
1175        case -791418107: // patient
1176          this.patient = TypeConvertor.castToReference(value); // Reference
1177          return value;
1178        default: return super.setProperty(hash, name, value);
1179        }
1180
1181      }
1182
1183      @Override
1184      public Base setProperty(String name, Base value) throws FHIRException {
1185        if (name.equals("identifier")) {
1186          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1187        } else if (name.equals("active")) {
1188          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1189        } else if (name.equals("morphology")) {
1190          this.morphology = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1191        } else if (name.equals("location")) {
1192          this.location = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1193        } else if (name.equals("includedStructure")) {
1194          this.getIncludedStructure().add((BodyStructureIncludedStructureComponent) value);
1195        } else if (name.equals("excludedStructure")) {
1196          this.getExcludedStructure().add((BodyStructureExcludedStructureComponent) value);
1197        } else if (name.equals("description")) {
1198          this.description = TypeConvertor.castToString(value); // StringType
1199        } else if (name.equals("image")) {
1200          this.getImage().add(TypeConvertor.castToAttachment(value));
1201        } else if (name.equals("patient")) {
1202          this.patient = TypeConvertor.castToReference(value); // Reference
1203        } else
1204          return super.setProperty(name, value);
1205        return value;
1206      }
1207
1208      @Override
1209      public Base makeProperty(int hash, String name) throws FHIRException {
1210        switch (hash) {
1211        case -1618432855:  return addIdentifier(); 
1212        case -1422950650:  return getActiveElement();
1213        case 1807231644:  return getMorphology();
1214        case 1901043637:  return getLocation();
1215        case -1174069225:  return addIncludedStructure(); 
1216        case 1192252105:  return addExcludedStructure(); 
1217        case -1724546052:  return getDescriptionElement();
1218        case 100313435:  return addImage(); 
1219        case -791418107:  return getPatient();
1220        default: return super.makeProperty(hash, name);
1221        }
1222
1223      }
1224
1225      @Override
1226      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1227        switch (hash) {
1228        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1229        case -1422950650: /*active*/ return new String[] {"boolean"};
1230        case 1807231644: /*morphology*/ return new String[] {"CodeableConcept"};
1231        case 1901043637: /*location*/ return new String[] {"CodeableConcept"};
1232        case -1174069225: /*includedStructure*/ return new String[] {};
1233        case 1192252105: /*excludedStructure*/ return new String[] {};
1234        case -1724546052: /*description*/ return new String[] {"string"};
1235        case 100313435: /*image*/ return new String[] {"Attachment"};
1236        case -791418107: /*patient*/ return new String[] {"Reference"};
1237        default: return super.getTypesForProperty(hash, name);
1238        }
1239
1240      }
1241
1242      @Override
1243      public Base addChild(String name) throws FHIRException {
1244        if (name.equals("identifier")) {
1245          return addIdentifier();
1246        }
1247        else if (name.equals("active")) {
1248          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.active");
1249        }
1250        else if (name.equals("morphology")) {
1251          this.morphology = new CodeableConcept();
1252          return this.morphology;
1253        }
1254        else if (name.equals("location")) {
1255          this.location = new CodeableConcept();
1256          return this.location;
1257        }
1258        else if (name.equals("includedStructure")) {
1259          return addIncludedStructure();
1260        }
1261        else if (name.equals("excludedStructure")) {
1262          return addExcludedStructure();
1263        }
1264        else if (name.equals("description")) {
1265          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.description");
1266        }
1267        else if (name.equals("image")) {
1268          return addImage();
1269        }
1270        else if (name.equals("patient")) {
1271          this.patient = new Reference();
1272          return this.patient;
1273        }
1274        else
1275          return super.addChild(name);
1276      }
1277
1278  public String fhirType() {
1279    return "BodyStructure";
1280
1281  }
1282
1283      public BodyStructure copy() {
1284        BodyStructure dst = new BodyStructure();
1285        copyValues(dst);
1286        return dst;
1287      }
1288
1289      public void copyValues(BodyStructure dst) {
1290        super.copyValues(dst);
1291        if (identifier != null) {
1292          dst.identifier = new ArrayList<Identifier>();
1293          for (Identifier i : identifier)
1294            dst.identifier.add(i.copy());
1295        };
1296        dst.active = active == null ? null : active.copy();
1297        dst.morphology = morphology == null ? null : morphology.copy();
1298        dst.location = location == null ? null : location.copy();
1299        if (includedStructure != null) {
1300          dst.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
1301          for (BodyStructureIncludedStructureComponent i : includedStructure)
1302            dst.includedStructure.add(i.copy());
1303        };
1304        if (excludedStructure != null) {
1305          dst.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
1306          for (BodyStructureExcludedStructureComponent i : excludedStructure)
1307            dst.excludedStructure.add(i.copy());
1308        };
1309        dst.description = description == null ? null : description.copy();
1310        if (image != null) {
1311          dst.image = new ArrayList<Attachment>();
1312          for (Attachment i : image)
1313            dst.image.add(i.copy());
1314        };
1315        dst.patient = patient == null ? null : patient.copy();
1316      }
1317
1318      protected BodyStructure typedCopy() {
1319        return copy();
1320      }
1321
1322      @Override
1323      public boolean equalsDeep(Base other_) {
1324        if (!super.equalsDeep(other_))
1325          return false;
1326        if (!(other_ instanceof BodyStructure))
1327          return false;
1328        BodyStructure o = (BodyStructure) other_;
1329        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(morphology, o.morphology, true)
1330           && compareDeep(location, o.location, true) && compareDeep(includedStructure, o.includedStructure, true)
1331           && compareDeep(excludedStructure, o.excludedStructure, true) && compareDeep(description, o.description, true)
1332           && compareDeep(image, o.image, true) && compareDeep(patient, o.patient, true);
1333      }
1334
1335      @Override
1336      public boolean equalsShallow(Base other_) {
1337        if (!super.equalsShallow(other_))
1338          return false;
1339        if (!(other_ instanceof BodyStructure))
1340          return false;
1341        BodyStructure o = (BodyStructure) other_;
1342        return compareValues(active, o.active, true) && compareValues(description, o.description, true);
1343      }
1344
1345      public boolean isEmpty() {
1346        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, morphology
1347          , location, includedStructure, excludedStructure, description, image, patient);
1348      }
1349
1350  @Override
1351  public ResourceType getResourceType() {
1352    return ResourceType.BodyStructure;
1353   }
1354
1355 /**
1356   * Search parameter: <b>identifier</b>
1357   * <p>
1358   * Description: <b>Bodystructure identifier</b><br>
1359   * Type: <b>token</b><br>
1360   * Path: <b>BodyStructure.identifier</b><br>
1361   * </p>
1362   */
1363  @SearchParamDefinition(name="identifier", path="BodyStructure.identifier", description="Bodystructure identifier", type="token" )
1364  public static final String SP_IDENTIFIER = "identifier";
1365 /**
1366   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1367   * <p>
1368   * Description: <b>Bodystructure identifier</b><br>
1369   * Type: <b>token</b><br>
1370   * Path: <b>BodyStructure.identifier</b><br>
1371   * </p>
1372   */
1373  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1374
1375 /**
1376   * Search parameter: <b>location</b>
1377   * <p>
1378   * Description: <b>Body site</b><br>
1379   * Type: <b>token</b><br>
1380   * Path: <b>BodyStructure.location</b><br>
1381   * </p>
1382   */
1383  @SearchParamDefinition(name="location", path="BodyStructure.location", description="Body site", type="token" )
1384  public static final String SP_LOCATION = "location";
1385 /**
1386   * <b>Fluent Client</b> search parameter constant for <b>location</b>
1387   * <p>
1388   * Description: <b>Body site</b><br>
1389   * Type: <b>token</b><br>
1390   * Path: <b>BodyStructure.location</b><br>
1391   * </p>
1392   */
1393  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOCATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOCATION);
1394
1395 /**
1396   * Search parameter: <b>morphology</b>
1397   * <p>
1398   * Description: <b>Kind of Structure</b><br>
1399   * Type: <b>token</b><br>
1400   * Path: <b>BodyStructure.morphology</b><br>
1401   * </p>
1402   */
1403  @SearchParamDefinition(name="morphology", path="BodyStructure.morphology", description="Kind of Structure", type="token" )
1404  public static final String SP_MORPHOLOGY = "morphology";
1405 /**
1406   * <b>Fluent Client</b> search parameter constant for <b>morphology</b>
1407   * <p>
1408   * Description: <b>Kind of Structure</b><br>
1409   * Type: <b>token</b><br>
1410   * Path: <b>BodyStructure.morphology</b><br>
1411   * </p>
1412   */
1413  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MORPHOLOGY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MORPHOLOGY);
1414
1415 /**
1416   * Search parameter: <b>patient</b>
1417   * <p>
1418   * Description: <b>Who this is about</b><br>
1419   * Type: <b>reference</b><br>
1420   * Path: <b>BodyStructure.patient</b><br>
1421   * </p>
1422   */
1423  @SearchParamDefinition(name="patient", path="BodyStructure.patient", description="Who this is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
1424  public static final String SP_PATIENT = "patient";
1425 /**
1426   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1427   * <p>
1428   * Description: <b>Who this is about</b><br>
1429   * Type: <b>reference</b><br>
1430   * Path: <b>BodyStructure.patient</b><br>
1431   * </p>
1432   */
1433  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1434
1435/**
1436   * Constant for fluent queries to be used to add include statements. Specifies
1437   * the path value of "<b>BodyStructure:patient</b>".
1438   */
1439  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("BodyStructure:patient").toLocked();
1440
1441
1442}
1443