001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common context.  A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of different modalities.
047 */
048@ResourceDef(name="ImagingStudy", profile="http://hl7.org/fhir/StructureDefinition/ImagingStudy")
049public class ImagingStudy extends DomainResource {
050
051    public enum ImagingStudyStatus {
052        /**
053         * The existence of the imaging study is registered, but there is nothing yet available.
054         */
055        REGISTERED, 
056        /**
057         * At least one instance has been associated with this imaging study.
058         */
059        AVAILABLE, 
060        /**
061         * The imaging study is unavailable because the imaging study was not started or not completed (also sometimes called "aborted").
062         */
063        CANCELLED, 
064        /**
065         * The imaging study has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".).
066         */
067        ENTEREDINERROR, 
068        /**
069         * The system does not know which of the status values currently applies for this request. Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
070         */
071        UNKNOWN, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static ImagingStudyStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("registered".equals(codeString))
080          return REGISTERED;
081        if ("available".equals(codeString))
082          return AVAILABLE;
083        if ("cancelled".equals(codeString))
084          return CANCELLED;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        if ("unknown".equals(codeString))
088          return UNKNOWN;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown ImagingStudyStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case REGISTERED: return "registered";
097            case AVAILABLE: return "available";
098            case CANCELLED: return "cancelled";
099            case ENTEREDINERROR: return "entered-in-error";
100            case UNKNOWN: return "unknown";
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case REGISTERED: return "http://hl7.org/fhir/imagingstudy-status";
107            case AVAILABLE: return "http://hl7.org/fhir/imagingstudy-status";
108            case CANCELLED: return "http://hl7.org/fhir/imagingstudy-status";
109            case ENTEREDINERROR: return "http://hl7.org/fhir/imagingstudy-status";
110            case UNKNOWN: return "http://hl7.org/fhir/imagingstudy-status";
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case REGISTERED: return "The existence of the imaging study is registered, but there is nothing yet available.";
117            case AVAILABLE: return "At least one instance has been associated with this imaging study.";
118            case CANCELLED: return "The imaging study is unavailable because the imaging study was not started or not completed (also sometimes called \"aborted\").";
119            case ENTEREDINERROR: return "The imaging study has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
120            case UNKNOWN: return "The system does not know which of the status values currently applies for this request. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case REGISTERED: return "Registered";
127            case AVAILABLE: return "Available";
128            case CANCELLED: return "Cancelled";
129            case ENTEREDINERROR: return "Entered in Error";
130            case UNKNOWN: return "Unknown";
131            default: return "?";
132          }
133        }
134    }
135
136  public static class ImagingStudyStatusEnumFactory implements EnumFactory<ImagingStudyStatus> {
137    public ImagingStudyStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("registered".equals(codeString))
142          return ImagingStudyStatus.REGISTERED;
143        if ("available".equals(codeString))
144          return ImagingStudyStatus.AVAILABLE;
145        if ("cancelled".equals(codeString))
146          return ImagingStudyStatus.CANCELLED;
147        if ("entered-in-error".equals(codeString))
148          return ImagingStudyStatus.ENTEREDINERROR;
149        if ("unknown".equals(codeString))
150          return ImagingStudyStatus.UNKNOWN;
151        throw new IllegalArgumentException("Unknown ImagingStudyStatus code '"+codeString+"'");
152        }
153        public Enumeration<ImagingStudyStatus> fromType(Base code) throws FHIRException {
154          if (code == null)
155            return null;
156          if (code.isEmpty())
157            return new Enumeration<ImagingStudyStatus>(this);
158          String codeString = ((PrimitiveType) code).asStringValue();
159          if (codeString == null || "".equals(codeString))
160            return null;
161        if ("registered".equals(codeString))
162          return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.REGISTERED);
163        if ("available".equals(codeString))
164          return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.AVAILABLE);
165        if ("cancelled".equals(codeString))
166          return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.CANCELLED);
167        if ("entered-in-error".equals(codeString))
168          return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.ENTEREDINERROR);
169        if ("unknown".equals(codeString))
170          return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.UNKNOWN);
171        throw new FHIRException("Unknown ImagingStudyStatus code '"+codeString+"'");
172        }
173    public String toCode(ImagingStudyStatus code) {
174      if (code == ImagingStudyStatus.REGISTERED)
175        return "registered";
176      if (code == ImagingStudyStatus.AVAILABLE)
177        return "available";
178      if (code == ImagingStudyStatus.CANCELLED)
179        return "cancelled";
180      if (code == ImagingStudyStatus.ENTEREDINERROR)
181        return "entered-in-error";
182      if (code == ImagingStudyStatus.UNKNOWN)
183        return "unknown";
184      return "?";
185      }
186    public String toSystem(ImagingStudyStatus code) {
187      return code.getSystem();
188      }
189    }
190
191    @Block()
192    public static class ImagingStudySeriesComponent extends BackboneElement implements IBaseBackboneElement {
193        /**
194         * Formal identifier for this series.
195         */
196        @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
197        @Description(shortDefinition="Formal DICOM identifier for this series", formalDefinition="Formal identifier for this series." )
198        protected Identifier identifier;
199
200        /**
201         * The numeric identifier of this series in the study.
202         */
203        @Child(name = "number", type = {UnsignedIntType.class}, order=2, min=0, max=1, modifier=false, summary=true)
204        @Description(shortDefinition="Numeric identifier of this series", formalDefinition="The numeric identifier of this series in the study." )
205        protected UnsignedIntType number;
206
207        /**
208         * The modality of this series sequence.
209         */
210        @Child(name = "modality", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
211        @Description(shortDefinition="The modality of the instances in the series", formalDefinition="The modality of this series sequence." )
212        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html")
213        protected Coding modality;
214
215        /**
216         * A description of the series.
217         */
218        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
219        @Description(shortDefinition="A short human readable summary of the series", formalDefinition="A description of the series." )
220        protected StringType description;
221
222        /**
223         * Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
224         */
225        @Child(name = "numberOfInstances", type = {UnsignedIntType.class}, order=5, min=0, max=1, modifier=false, summary=true)
226        @Description(shortDefinition="Number of Series Related Instances", formalDefinition="Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present." )
227        protected UnsignedIntType numberOfInstances;
228
229        /**
230         * The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType.
231         */
232        @Child(name = "endpoint", type = {Endpoint.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
233        @Description(shortDefinition="Series access endpoint", formalDefinition="The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType." )
234        protected List<Reference> endpoint;
235        /**
236         * The actual objects that are the target of the reference (The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType.)
237         */
238        protected List<Endpoint> endpointTarget;
239
240
241        /**
242         * The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.
243         */
244        @Child(name = "bodySite", type = {Coding.class}, order=7, min=0, max=1, modifier=false, summary=true)
245        @Description(shortDefinition="Body part examined", formalDefinition="The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality." )
246        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
247        protected Coding bodySite;
248
249        /**
250         * The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.
251         */
252        @Child(name = "laterality", type = {Coding.class}, order=8, min=0, max=1, modifier=false, summary=true)
253        @Description(shortDefinition="Body part laterality", formalDefinition="The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite." )
254        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodysite-laterality")
255        protected Coding laterality;
256
257        /**
258         * The specimen imaged, e.g., for whole slide imaging of a biopsy.
259         */
260        @Child(name = "specimen", type = {Specimen.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
261        @Description(shortDefinition="Specimen imaged", formalDefinition="The specimen imaged, e.g., for whole slide imaging of a biopsy." )
262        protected List<Reference> specimen;
263        /**
264         * The actual objects that are the target of the reference (The specimen imaged, e.g., for whole slide imaging of a biopsy.)
265         */
266        protected List<Specimen> specimenTarget;
267
268
269        /**
270         * The date and time the series was started.
271         */
272        @Child(name = "started", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
273        @Description(shortDefinition="When the series started", formalDefinition="The date and time the series was started." )
274        protected DateTimeType started;
275
276        /**
277         * Indicates who or what performed the series and how they were involved.
278         */
279        @Child(name = "performer", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
280        @Description(shortDefinition="Who performed the series", formalDefinition="Indicates who or what performed the series and how they were involved." )
281        protected List<ImagingStudySeriesPerformerComponent> performer;
282
283        /**
284         * A single SOP instance within the series, e.g. an image, or presentation state.
285         */
286        @Child(name = "instance", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
287        @Description(shortDefinition="A single SOP instance from the series", formalDefinition="A single SOP instance within the series, e.g. an image, or presentation state." )
288        protected List<ImagingStudySeriesInstanceComponent> instance;
289
290        private static final long serialVersionUID = 1215869106L;
291
292    /**
293     * Constructor
294     */
295      public ImagingStudySeriesComponent() {
296        super();
297      }
298
299    /**
300     * Constructor
301     */
302      public ImagingStudySeriesComponent(Identifier identifier, Coding modality) {
303        super();
304        this.identifier = identifier;
305        this.modality = modality;
306      }
307
308        /**
309         * @return {@link #identifier} (Formal identifier for this series.)
310         */
311        public Identifier getIdentifier() { 
312          if (this.identifier == null)
313            if (Configuration.errorOnAutoCreate())
314              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.identifier");
315            else if (Configuration.doAutoCreate())
316              this.identifier = new Identifier(); // cc
317          return this.identifier;
318        }
319
320        public boolean hasIdentifier() { 
321          return this.identifier != null && !this.identifier.isEmpty();
322        }
323
324        /**
325         * @param value {@link #identifier} (Formal identifier for this series.)
326         */
327        public ImagingStudySeriesComponent setIdentifier(Identifier value) { 
328          this.identifier = value;
329          return this;
330        }
331
332        /**
333         * @return {@link #number} (The numeric identifier of this series in the study.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
334         */
335        public UnsignedIntType getNumberElement() { 
336          if (this.number == null)
337            if (Configuration.errorOnAutoCreate())
338              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.number");
339            else if (Configuration.doAutoCreate())
340              this.number = new UnsignedIntType(); // bb
341          return this.number;
342        }
343
344        public boolean hasNumberElement() { 
345          return this.number != null && !this.number.isEmpty();
346        }
347
348        public boolean hasNumber() { 
349          return this.number != null && !this.number.isEmpty();
350        }
351
352        /**
353         * @param value {@link #number} (The numeric identifier of this series in the study.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
354         */
355        public ImagingStudySeriesComponent setNumberElement(UnsignedIntType value) { 
356          this.number = value;
357          return this;
358        }
359
360        /**
361         * @return The numeric identifier of this series in the study.
362         */
363        public int getNumber() { 
364          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
365        }
366
367        /**
368         * @param value The numeric identifier of this series in the study.
369         */
370        public ImagingStudySeriesComponent setNumber(int value) { 
371            if (this.number == null)
372              this.number = new UnsignedIntType();
373            this.number.setValue(value);
374          return this;
375        }
376
377        /**
378         * @return {@link #modality} (The modality of this series sequence.)
379         */
380        public Coding getModality() { 
381          if (this.modality == null)
382            if (Configuration.errorOnAutoCreate())
383              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.modality");
384            else if (Configuration.doAutoCreate())
385              this.modality = new Coding(); // cc
386          return this.modality;
387        }
388
389        public boolean hasModality() { 
390          return this.modality != null && !this.modality.isEmpty();
391        }
392
393        /**
394         * @param value {@link #modality} (The modality of this series sequence.)
395         */
396        public ImagingStudySeriesComponent setModality(Coding value) { 
397          this.modality = value;
398          return this;
399        }
400
401        /**
402         * @return {@link #description} (A description of the series.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
403         */
404        public StringType getDescriptionElement() { 
405          if (this.description == null)
406            if (Configuration.errorOnAutoCreate())
407              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.description");
408            else if (Configuration.doAutoCreate())
409              this.description = new StringType(); // bb
410          return this.description;
411        }
412
413        public boolean hasDescriptionElement() { 
414          return this.description != null && !this.description.isEmpty();
415        }
416
417        public boolean hasDescription() { 
418          return this.description != null && !this.description.isEmpty();
419        }
420
421        /**
422         * @param value {@link #description} (A description of the series.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
423         */
424        public ImagingStudySeriesComponent setDescriptionElement(StringType value) { 
425          this.description = value;
426          return this;
427        }
428
429        /**
430         * @return A description of the series.
431         */
432        public String getDescription() { 
433          return this.description == null ? null : this.description.getValue();
434        }
435
436        /**
437         * @param value A description of the series.
438         */
439        public ImagingStudySeriesComponent setDescription(String value) { 
440          if (Utilities.noString(value))
441            this.description = null;
442          else {
443            if (this.description == null)
444              this.description = new StringType();
445            this.description.setValue(value);
446          }
447          return this;
448        }
449
450        /**
451         * @return {@link #numberOfInstances} (Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
452         */
453        public UnsignedIntType getNumberOfInstancesElement() { 
454          if (this.numberOfInstances == null)
455            if (Configuration.errorOnAutoCreate())
456              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.numberOfInstances");
457            else if (Configuration.doAutoCreate())
458              this.numberOfInstances = new UnsignedIntType(); // bb
459          return this.numberOfInstances;
460        }
461
462        public boolean hasNumberOfInstancesElement() { 
463          return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
464        }
465
466        public boolean hasNumberOfInstances() { 
467          return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
468        }
469
470        /**
471         * @param value {@link #numberOfInstances} (Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
472         */
473        public ImagingStudySeriesComponent setNumberOfInstancesElement(UnsignedIntType value) { 
474          this.numberOfInstances = value;
475          return this;
476        }
477
478        /**
479         * @return Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
480         */
481        public int getNumberOfInstances() { 
482          return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
483        }
484
485        /**
486         * @param value Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
487         */
488        public ImagingStudySeriesComponent setNumberOfInstances(int value) { 
489            if (this.numberOfInstances == null)
490              this.numberOfInstances = new UnsignedIntType();
491            this.numberOfInstances.setValue(value);
492          return this;
493        }
494
495        /**
496         * @return {@link #endpoint} (The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType.)
497         */
498        public List<Reference> getEndpoint() { 
499          if (this.endpoint == null)
500            this.endpoint = new ArrayList<Reference>();
501          return this.endpoint;
502        }
503
504        /**
505         * @return Returns a reference to <code>this</code> for easy method chaining
506         */
507        public ImagingStudySeriesComponent setEndpoint(List<Reference> theEndpoint) { 
508          this.endpoint = theEndpoint;
509          return this;
510        }
511
512        public boolean hasEndpoint() { 
513          if (this.endpoint == null)
514            return false;
515          for (Reference item : this.endpoint)
516            if (!item.isEmpty())
517              return true;
518          return false;
519        }
520
521        public Reference addEndpoint() { //3
522          Reference t = new Reference();
523          if (this.endpoint == null)
524            this.endpoint = new ArrayList<Reference>();
525          this.endpoint.add(t);
526          return t;
527        }
528
529        public ImagingStudySeriesComponent addEndpoint(Reference t) { //3
530          if (t == null)
531            return this;
532          if (this.endpoint == null)
533            this.endpoint = new ArrayList<Reference>();
534          this.endpoint.add(t);
535          return this;
536        }
537
538        /**
539         * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist
540         */
541        public Reference getEndpointFirstRep() { 
542          if (getEndpoint().isEmpty()) {
543            addEndpoint();
544          }
545          return getEndpoint().get(0);
546        }
547
548        /**
549         * @deprecated Use Reference#setResource(IBaseResource) instead
550         */
551        @Deprecated
552        public List<Endpoint> getEndpointTarget() { 
553          if (this.endpointTarget == null)
554            this.endpointTarget = new ArrayList<Endpoint>();
555          return this.endpointTarget;
556        }
557
558        /**
559         * @deprecated Use Reference#setResource(IBaseResource) instead
560         */
561        @Deprecated
562        public Endpoint addEndpointTarget() { 
563          Endpoint r = new Endpoint();
564          if (this.endpointTarget == null)
565            this.endpointTarget = new ArrayList<Endpoint>();
566          this.endpointTarget.add(r);
567          return r;
568        }
569
570        /**
571         * @return {@link #bodySite} (The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.)
572         */
573        public Coding getBodySite() { 
574          if (this.bodySite == null)
575            if (Configuration.errorOnAutoCreate())
576              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.bodySite");
577            else if (Configuration.doAutoCreate())
578              this.bodySite = new Coding(); // cc
579          return this.bodySite;
580        }
581
582        public boolean hasBodySite() { 
583          return this.bodySite != null && !this.bodySite.isEmpty();
584        }
585
586        /**
587         * @param value {@link #bodySite} (The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.)
588         */
589        public ImagingStudySeriesComponent setBodySite(Coding value) { 
590          this.bodySite = value;
591          return this;
592        }
593
594        /**
595         * @return {@link #laterality} (The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.)
596         */
597        public Coding getLaterality() { 
598          if (this.laterality == null)
599            if (Configuration.errorOnAutoCreate())
600              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.laterality");
601            else if (Configuration.doAutoCreate())
602              this.laterality = new Coding(); // cc
603          return this.laterality;
604        }
605
606        public boolean hasLaterality() { 
607          return this.laterality != null && !this.laterality.isEmpty();
608        }
609
610        /**
611         * @param value {@link #laterality} (The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.)
612         */
613        public ImagingStudySeriesComponent setLaterality(Coding value) { 
614          this.laterality = value;
615          return this;
616        }
617
618        /**
619         * @return {@link #specimen} (The specimen imaged, e.g., for whole slide imaging of a biopsy.)
620         */
621        public List<Reference> getSpecimen() { 
622          if (this.specimen == null)
623            this.specimen = new ArrayList<Reference>();
624          return this.specimen;
625        }
626
627        /**
628         * @return Returns a reference to <code>this</code> for easy method chaining
629         */
630        public ImagingStudySeriesComponent setSpecimen(List<Reference> theSpecimen) { 
631          this.specimen = theSpecimen;
632          return this;
633        }
634
635        public boolean hasSpecimen() { 
636          if (this.specimen == null)
637            return false;
638          for (Reference item : this.specimen)
639            if (!item.isEmpty())
640              return true;
641          return false;
642        }
643
644        public Reference addSpecimen() { //3
645          Reference t = new Reference();
646          if (this.specimen == null)
647            this.specimen = new ArrayList<Reference>();
648          this.specimen.add(t);
649          return t;
650        }
651
652        public ImagingStudySeriesComponent addSpecimen(Reference t) { //3
653          if (t == null)
654            return this;
655          if (this.specimen == null)
656            this.specimen = new ArrayList<Reference>();
657          this.specimen.add(t);
658          return this;
659        }
660
661        /**
662         * @return The first repetition of repeating field {@link #specimen}, creating it if it does not already exist
663         */
664        public Reference getSpecimenFirstRep() { 
665          if (getSpecimen().isEmpty()) {
666            addSpecimen();
667          }
668          return getSpecimen().get(0);
669        }
670
671        /**
672         * @deprecated Use Reference#setResource(IBaseResource) instead
673         */
674        @Deprecated
675        public List<Specimen> getSpecimenTarget() { 
676          if (this.specimenTarget == null)
677            this.specimenTarget = new ArrayList<Specimen>();
678          return this.specimenTarget;
679        }
680
681        /**
682         * @deprecated Use Reference#setResource(IBaseResource) instead
683         */
684        @Deprecated
685        public Specimen addSpecimenTarget() { 
686          Specimen r = new Specimen();
687          if (this.specimenTarget == null)
688            this.specimenTarget = new ArrayList<Specimen>();
689          this.specimenTarget.add(r);
690          return r;
691        }
692
693        /**
694         * @return {@link #started} (The date and time the series was started.). This is the underlying object with id, value and extensions. The accessor "getStarted" gives direct access to the value
695         */
696        public DateTimeType getStartedElement() { 
697          if (this.started == null)
698            if (Configuration.errorOnAutoCreate())
699              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.started");
700            else if (Configuration.doAutoCreate())
701              this.started = new DateTimeType(); // bb
702          return this.started;
703        }
704
705        public boolean hasStartedElement() { 
706          return this.started != null && !this.started.isEmpty();
707        }
708
709        public boolean hasStarted() { 
710          return this.started != null && !this.started.isEmpty();
711        }
712
713        /**
714         * @param value {@link #started} (The date and time the series was started.). This is the underlying object with id, value and extensions. The accessor "getStarted" gives direct access to the value
715         */
716        public ImagingStudySeriesComponent setStartedElement(DateTimeType value) { 
717          this.started = value;
718          return this;
719        }
720
721        /**
722         * @return The date and time the series was started.
723         */
724        public Date getStarted() { 
725          return this.started == null ? null : this.started.getValue();
726        }
727
728        /**
729         * @param value The date and time the series was started.
730         */
731        public ImagingStudySeriesComponent setStarted(Date value) { 
732          if (value == null)
733            this.started = null;
734          else {
735            if (this.started == null)
736              this.started = new DateTimeType();
737            this.started.setValue(value);
738          }
739          return this;
740        }
741
742        /**
743         * @return {@link #performer} (Indicates who or what performed the series and how they were involved.)
744         */
745        public List<ImagingStudySeriesPerformerComponent> getPerformer() { 
746          if (this.performer == null)
747            this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
748          return this.performer;
749        }
750
751        /**
752         * @return Returns a reference to <code>this</code> for easy method chaining
753         */
754        public ImagingStudySeriesComponent setPerformer(List<ImagingStudySeriesPerformerComponent> thePerformer) { 
755          this.performer = thePerformer;
756          return this;
757        }
758
759        public boolean hasPerformer() { 
760          if (this.performer == null)
761            return false;
762          for (ImagingStudySeriesPerformerComponent item : this.performer)
763            if (!item.isEmpty())
764              return true;
765          return false;
766        }
767
768        public ImagingStudySeriesPerformerComponent addPerformer() { //3
769          ImagingStudySeriesPerformerComponent t = new ImagingStudySeriesPerformerComponent();
770          if (this.performer == null)
771            this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
772          this.performer.add(t);
773          return t;
774        }
775
776        public ImagingStudySeriesComponent addPerformer(ImagingStudySeriesPerformerComponent t) { //3
777          if (t == null)
778            return this;
779          if (this.performer == null)
780            this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
781          this.performer.add(t);
782          return this;
783        }
784
785        /**
786         * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
787         */
788        public ImagingStudySeriesPerformerComponent getPerformerFirstRep() { 
789          if (getPerformer().isEmpty()) {
790            addPerformer();
791          }
792          return getPerformer().get(0);
793        }
794
795        /**
796         * @return {@link #instance} (A single SOP instance within the series, e.g. an image, or presentation state.)
797         */
798        public List<ImagingStudySeriesInstanceComponent> getInstance() { 
799          if (this.instance == null)
800            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
801          return this.instance;
802        }
803
804        /**
805         * @return Returns a reference to <code>this</code> for easy method chaining
806         */
807        public ImagingStudySeriesComponent setInstance(List<ImagingStudySeriesInstanceComponent> theInstance) { 
808          this.instance = theInstance;
809          return this;
810        }
811
812        public boolean hasInstance() { 
813          if (this.instance == null)
814            return false;
815          for (ImagingStudySeriesInstanceComponent item : this.instance)
816            if (!item.isEmpty())
817              return true;
818          return false;
819        }
820
821        public ImagingStudySeriesInstanceComponent addInstance() { //3
822          ImagingStudySeriesInstanceComponent t = new ImagingStudySeriesInstanceComponent();
823          if (this.instance == null)
824            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
825          this.instance.add(t);
826          return t;
827        }
828
829        public ImagingStudySeriesComponent addInstance(ImagingStudySeriesInstanceComponent t) { //3
830          if (t == null)
831            return this;
832          if (this.instance == null)
833            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
834          this.instance.add(t);
835          return this;
836        }
837
838        /**
839         * @return The first repetition of repeating field {@link #instance}, creating it if it does not already exist
840         */
841        public ImagingStudySeriesInstanceComponent getInstanceFirstRep() { 
842          if (getInstance().isEmpty()) {
843            addInstance();
844          }
845          return getInstance().get(0);
846        }
847
848        protected void listChildren(List<Property> children) {
849          super.listChildren(children);
850          children.add(new Property("identifier", "Identifier", "Formal identifier for this series.", 0, 1, identifier));
851          children.add(new Property("number", "unsignedInt", "The numeric identifier of this series in the study.", 0, 1, number));
852          children.add(new Property("modality", "Coding", "The modality of this series sequence.", 0, 1, modality));
853          children.add(new Property("description", "string", "A description of the series.", 0, 1, description));
854          children.add(new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.", 0, 1, numberOfInstances));
855          children.add(new Property("endpoint", "Reference(Endpoint)", "The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType.", 0, java.lang.Integer.MAX_VALUE, endpoint));
856          children.add(new Property("bodySite", "Coding", "The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.", 0, 1, bodySite));
857          children.add(new Property("laterality", "Coding", "The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.", 0, 1, laterality));
858          children.add(new Property("specimen", "Reference(Specimen)", "The specimen imaged, e.g., for whole slide imaging of a biopsy.", 0, java.lang.Integer.MAX_VALUE, specimen));
859          children.add(new Property("started", "dateTime", "The date and time the series was started.", 0, 1, started));
860          children.add(new Property("performer", "", "Indicates who or what performed the series and how they were involved.", 0, java.lang.Integer.MAX_VALUE, performer));
861          children.add(new Property("instance", "", "A single SOP instance within the series, e.g. an image, or presentation state.", 0, java.lang.Integer.MAX_VALUE, instance));
862        }
863
864        @Override
865        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
866          switch (_hash) {
867          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Formal identifier for this series.", 0, 1, identifier);
868          case -1034364087: /*number*/  return new Property("number", "unsignedInt", "The numeric identifier of this series in the study.", 0, 1, number);
869          case -622722335: /*modality*/  return new Property("modality", "Coding", "The modality of this series sequence.", 0, 1, modality);
870          case -1724546052: /*description*/  return new Property("description", "string", "A description of the series.", 0, 1, description);
871          case -1043544226: /*numberOfInstances*/  return new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.", 0, 1, numberOfInstances);
872          case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.connectionType.", 0, java.lang.Integer.MAX_VALUE, endpoint);
873          case 1702620169: /*bodySite*/  return new Property("bodySite", "Coding", "The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.", 0, 1, bodySite);
874          case -170291817: /*laterality*/  return new Property("laterality", "Coding", "The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.", 0, 1, laterality);
875          case -2132868344: /*specimen*/  return new Property("specimen", "Reference(Specimen)", "The specimen imaged, e.g., for whole slide imaging of a biopsy.", 0, java.lang.Integer.MAX_VALUE, specimen);
876          case -1897185151: /*started*/  return new Property("started", "dateTime", "The date and time the series was started.", 0, 1, started);
877          case 481140686: /*performer*/  return new Property("performer", "", "Indicates who or what performed the series and how they were involved.", 0, java.lang.Integer.MAX_VALUE, performer);
878          case 555127957: /*instance*/  return new Property("instance", "", "A single SOP instance within the series, e.g. an image, or presentation state.", 0, java.lang.Integer.MAX_VALUE, instance);
879          default: return super.getNamedProperty(_hash, _name, _checkValid);
880          }
881
882        }
883
884      @Override
885      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
886        switch (hash) {
887        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
888        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // UnsignedIntType
889        case -622722335: /*modality*/ return this.modality == null ? new Base[0] : new Base[] {this.modality}; // Coding
890        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
891        case -1043544226: /*numberOfInstances*/ return this.numberOfInstances == null ? new Base[0] : new Base[] {this.numberOfInstances}; // UnsignedIntType
892        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
893        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Coding
894        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // Coding
895        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
896        case -1897185151: /*started*/ return this.started == null ? new Base[0] : new Base[] {this.started}; // DateTimeType
897        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // ImagingStudySeriesPerformerComponent
898        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : this.instance.toArray(new Base[this.instance.size()]); // ImagingStudySeriesInstanceComponent
899        default: return super.getProperty(hash, name, checkValid);
900        }
901
902      }
903
904      @Override
905      public Base setProperty(int hash, String name, Base value) throws FHIRException {
906        switch (hash) {
907        case -1618432855: // identifier
908          this.identifier = castToIdentifier(value); // Identifier
909          return value;
910        case -1034364087: // number
911          this.number = castToUnsignedInt(value); // UnsignedIntType
912          return value;
913        case -622722335: // modality
914          this.modality = castToCoding(value); // Coding
915          return value;
916        case -1724546052: // description
917          this.description = castToString(value); // StringType
918          return value;
919        case -1043544226: // numberOfInstances
920          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
921          return value;
922        case 1741102485: // endpoint
923          this.getEndpoint().add(castToReference(value)); // Reference
924          return value;
925        case 1702620169: // bodySite
926          this.bodySite = castToCoding(value); // Coding
927          return value;
928        case -170291817: // laterality
929          this.laterality = castToCoding(value); // Coding
930          return value;
931        case -2132868344: // specimen
932          this.getSpecimen().add(castToReference(value)); // Reference
933          return value;
934        case -1897185151: // started
935          this.started = castToDateTime(value); // DateTimeType
936          return value;
937        case 481140686: // performer
938          this.getPerformer().add((ImagingStudySeriesPerformerComponent) value); // ImagingStudySeriesPerformerComponent
939          return value;
940        case 555127957: // instance
941          this.getInstance().add((ImagingStudySeriesInstanceComponent) value); // ImagingStudySeriesInstanceComponent
942          return value;
943        default: return super.setProperty(hash, name, value);
944        }
945
946      }
947
948      @Override
949      public Base setProperty(String name, Base value) throws FHIRException {
950        if (name.equals("identifier")) {
951          this.identifier = castToIdentifier(value); // Identifier
952        } else if (name.equals("number")) {
953          this.number = castToUnsignedInt(value); // UnsignedIntType
954        } else if (name.equals("modality")) {
955          this.modality = castToCoding(value); // Coding
956        } else if (name.equals("description")) {
957          this.description = castToString(value); // StringType
958        } else if (name.equals("numberOfInstances")) {
959          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
960        } else if (name.equals("endpoint")) {
961          this.getEndpoint().add(castToReference(value));
962        } else if (name.equals("bodySite")) {
963          this.bodySite = castToCoding(value); // Coding
964        } else if (name.equals("laterality")) {
965          this.laterality = castToCoding(value); // Coding
966        } else if (name.equals("specimen")) {
967          this.getSpecimen().add(castToReference(value));
968        } else if (name.equals("started")) {
969          this.started = castToDateTime(value); // DateTimeType
970        } else if (name.equals("performer")) {
971          this.getPerformer().add((ImagingStudySeriesPerformerComponent) value);
972        } else if (name.equals("instance")) {
973          this.getInstance().add((ImagingStudySeriesInstanceComponent) value);
974        } else
975          return super.setProperty(name, value);
976        return value;
977      }
978
979      @Override
980      public Base makeProperty(int hash, String name) throws FHIRException {
981        switch (hash) {
982        case -1618432855:  return getIdentifier(); 
983        case -1034364087:  return getNumberElement();
984        case -622722335:  return getModality(); 
985        case -1724546052:  return getDescriptionElement();
986        case -1043544226:  return getNumberOfInstancesElement();
987        case 1741102485:  return addEndpoint(); 
988        case 1702620169:  return getBodySite(); 
989        case -170291817:  return getLaterality(); 
990        case -2132868344:  return addSpecimen(); 
991        case -1897185151:  return getStartedElement();
992        case 481140686:  return addPerformer(); 
993        case 555127957:  return addInstance(); 
994        default: return super.makeProperty(hash, name);
995        }
996
997      }
998
999      @Override
1000      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1001        switch (hash) {
1002        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1003        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
1004        case -622722335: /*modality*/ return new String[] {"Coding"};
1005        case -1724546052: /*description*/ return new String[] {"string"};
1006        case -1043544226: /*numberOfInstances*/ return new String[] {"unsignedInt"};
1007        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
1008        case 1702620169: /*bodySite*/ return new String[] {"Coding"};
1009        case -170291817: /*laterality*/ return new String[] {"Coding"};
1010        case -2132868344: /*specimen*/ return new String[] {"Reference"};
1011        case -1897185151: /*started*/ return new String[] {"dateTime"};
1012        case 481140686: /*performer*/ return new String[] {};
1013        case 555127957: /*instance*/ return new String[] {};
1014        default: return super.getTypesForProperty(hash, name);
1015        }
1016
1017      }
1018
1019      @Override
1020      public Base addChild(String name) throws FHIRException {
1021        if (name.equals("identifier")) {
1022          this.identifier = new Identifier();
1023          return this.identifier;
1024        }
1025        else if (name.equals("number")) {
1026          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.number");
1027        }
1028        else if (name.equals("modality")) {
1029          this.modality = new Coding();
1030          return this.modality;
1031        }
1032        else if (name.equals("description")) {
1033          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.description");
1034        }
1035        else if (name.equals("numberOfInstances")) {
1036          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfInstances");
1037        }
1038        else if (name.equals("endpoint")) {
1039          return addEndpoint();
1040        }
1041        else if (name.equals("bodySite")) {
1042          this.bodySite = new Coding();
1043          return this.bodySite;
1044        }
1045        else if (name.equals("laterality")) {
1046          this.laterality = new Coding();
1047          return this.laterality;
1048        }
1049        else if (name.equals("specimen")) {
1050          return addSpecimen();
1051        }
1052        else if (name.equals("started")) {
1053          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.started");
1054        }
1055        else if (name.equals("performer")) {
1056          return addPerformer();
1057        }
1058        else if (name.equals("instance")) {
1059          return addInstance();
1060        }
1061        else
1062          return super.addChild(name);
1063      }
1064
1065      public ImagingStudySeriesComponent copy() {
1066        ImagingStudySeriesComponent dst = new ImagingStudySeriesComponent();
1067        copyValues(dst);
1068        dst.identifier = identifier == null ? null : identifier.copy();
1069        dst.number = number == null ? null : number.copy();
1070        dst.modality = modality == null ? null : modality.copy();
1071        dst.description = description == null ? null : description.copy();
1072        dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
1073        if (endpoint != null) {
1074          dst.endpoint = new ArrayList<Reference>();
1075          for (Reference i : endpoint)
1076            dst.endpoint.add(i.copy());
1077        };
1078        dst.bodySite = bodySite == null ? null : bodySite.copy();
1079        dst.laterality = laterality == null ? null : laterality.copy();
1080        if (specimen != null) {
1081          dst.specimen = new ArrayList<Reference>();
1082          for (Reference i : specimen)
1083            dst.specimen.add(i.copy());
1084        };
1085        dst.started = started == null ? null : started.copy();
1086        if (performer != null) {
1087          dst.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
1088          for (ImagingStudySeriesPerformerComponent i : performer)
1089            dst.performer.add(i.copy());
1090        };
1091        if (instance != null) {
1092          dst.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
1093          for (ImagingStudySeriesInstanceComponent i : instance)
1094            dst.instance.add(i.copy());
1095        };
1096        return dst;
1097      }
1098
1099      @Override
1100      public boolean equalsDeep(Base other_) {
1101        if (!super.equalsDeep(other_))
1102          return false;
1103        if (!(other_ instanceof ImagingStudySeriesComponent))
1104          return false;
1105        ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other_;
1106        return compareDeep(identifier, o.identifier, true) && compareDeep(number, o.number, true) && compareDeep(modality, o.modality, true)
1107           && compareDeep(description, o.description, true) && compareDeep(numberOfInstances, o.numberOfInstances, true)
1108           && compareDeep(endpoint, o.endpoint, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(laterality, o.laterality, true)
1109           && compareDeep(specimen, o.specimen, true) && compareDeep(started, o.started, true) && compareDeep(performer, o.performer, true)
1110           && compareDeep(instance, o.instance, true);
1111      }
1112
1113      @Override
1114      public boolean equalsShallow(Base other_) {
1115        if (!super.equalsShallow(other_))
1116          return false;
1117        if (!(other_ instanceof ImagingStudySeriesComponent))
1118          return false;
1119        ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other_;
1120        return compareValues(number, o.number, true) && compareValues(description, o.description, true) && compareValues(numberOfInstances, o.numberOfInstances, true)
1121           && compareValues(started, o.started, true);
1122      }
1123
1124      public boolean isEmpty() {
1125        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, number, modality
1126          , description, numberOfInstances, endpoint, bodySite, laterality, specimen, started
1127          , performer, instance);
1128      }
1129
1130  public String fhirType() {
1131    return "ImagingStudy.series";
1132
1133  }
1134
1135  }
1136
1137    @Block()
1138    public static class ImagingStudySeriesPerformerComponent extends BackboneElement implements IBaseBackboneElement {
1139        /**
1140         * Distinguishes the type of involvement of the performer in the series.
1141         */
1142        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1143        @Description(shortDefinition="Type of performance", formalDefinition="Distinguishes the type of involvement of the performer in the series." )
1144        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/series-performer-function")
1145        protected CodeableConcept function;
1146
1147        /**
1148         * Indicates who or what performed the series.
1149         */
1150        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=true)
1151        @Description(shortDefinition="Who performed the series", formalDefinition="Indicates who or what performed the series." )
1152        protected Reference actor;
1153
1154        /**
1155         * The actual object that is the target of the reference (Indicates who or what performed the series.)
1156         */
1157        protected Resource actorTarget;
1158
1159        private static final long serialVersionUID = 1424001049L;
1160
1161    /**
1162     * Constructor
1163     */
1164      public ImagingStudySeriesPerformerComponent() {
1165        super();
1166      }
1167
1168    /**
1169     * Constructor
1170     */
1171      public ImagingStudySeriesPerformerComponent(Reference actor) {
1172        super();
1173        this.actor = actor;
1174      }
1175
1176        /**
1177         * @return {@link #function} (Distinguishes the type of involvement of the performer in the series.)
1178         */
1179        public CodeableConcept getFunction() { 
1180          if (this.function == null)
1181            if (Configuration.errorOnAutoCreate())
1182              throw new Error("Attempt to auto-create ImagingStudySeriesPerformerComponent.function");
1183            else if (Configuration.doAutoCreate())
1184              this.function = new CodeableConcept(); // cc
1185          return this.function;
1186        }
1187
1188        public boolean hasFunction() { 
1189          return this.function != null && !this.function.isEmpty();
1190        }
1191
1192        /**
1193         * @param value {@link #function} (Distinguishes the type of involvement of the performer in the series.)
1194         */
1195        public ImagingStudySeriesPerformerComponent setFunction(CodeableConcept value) { 
1196          this.function = value;
1197          return this;
1198        }
1199
1200        /**
1201         * @return {@link #actor} (Indicates who or what performed the series.)
1202         */
1203        public Reference getActor() { 
1204          if (this.actor == null)
1205            if (Configuration.errorOnAutoCreate())
1206              throw new Error("Attempt to auto-create ImagingStudySeriesPerformerComponent.actor");
1207            else if (Configuration.doAutoCreate())
1208              this.actor = new Reference(); // cc
1209          return this.actor;
1210        }
1211
1212        public boolean hasActor() { 
1213          return this.actor != null && !this.actor.isEmpty();
1214        }
1215
1216        /**
1217         * @param value {@link #actor} (Indicates who or what performed the series.)
1218         */
1219        public ImagingStudySeriesPerformerComponent setActor(Reference value) { 
1220          this.actor = value;
1221          return this;
1222        }
1223
1224        /**
1225         * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates who or what performed the series.)
1226         */
1227        public Resource getActorTarget() { 
1228          return this.actorTarget;
1229        }
1230
1231        /**
1232         * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates who or what performed the series.)
1233         */
1234        public ImagingStudySeriesPerformerComponent setActorTarget(Resource value) { 
1235          this.actorTarget = value;
1236          return this;
1237        }
1238
1239        protected void listChildren(List<Property> children) {
1240          super.listChildren(children);
1241          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the series.", 0, 1, function));
1242          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what performed the series.", 0, 1, actor));
1243        }
1244
1245        @Override
1246        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1247          switch (_hash) {
1248          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the series.", 0, 1, function);
1249          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what performed the series.", 0, 1, actor);
1250          default: return super.getNamedProperty(_hash, _name, _checkValid);
1251          }
1252
1253        }
1254
1255      @Override
1256      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1257        switch (hash) {
1258        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
1259        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
1260        default: return super.getProperty(hash, name, checkValid);
1261        }
1262
1263      }
1264
1265      @Override
1266      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1267        switch (hash) {
1268        case 1380938712: // function
1269          this.function = castToCodeableConcept(value); // CodeableConcept
1270          return value;
1271        case 92645877: // actor
1272          this.actor = castToReference(value); // Reference
1273          return value;
1274        default: return super.setProperty(hash, name, value);
1275        }
1276
1277      }
1278
1279      @Override
1280      public Base setProperty(String name, Base value) throws FHIRException {
1281        if (name.equals("function")) {
1282          this.function = castToCodeableConcept(value); // CodeableConcept
1283        } else if (name.equals("actor")) {
1284          this.actor = castToReference(value); // Reference
1285        } else
1286          return super.setProperty(name, value);
1287        return value;
1288      }
1289
1290      @Override
1291      public Base makeProperty(int hash, String name) throws FHIRException {
1292        switch (hash) {
1293        case 1380938712:  return getFunction(); 
1294        case 92645877:  return getActor(); 
1295        default: return super.makeProperty(hash, name);
1296        }
1297
1298      }
1299
1300      @Override
1301      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1302        switch (hash) {
1303        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
1304        case 92645877: /*actor*/ return new String[] {"Reference"};
1305        default: return super.getTypesForProperty(hash, name);
1306        }
1307
1308      }
1309
1310      @Override
1311      public Base addChild(String name) throws FHIRException {
1312        if (name.equals("function")) {
1313          this.function = new CodeableConcept();
1314          return this.function;
1315        }
1316        else if (name.equals("actor")) {
1317          this.actor = new Reference();
1318          return this.actor;
1319        }
1320        else
1321          return super.addChild(name);
1322      }
1323
1324      public ImagingStudySeriesPerformerComponent copy() {
1325        ImagingStudySeriesPerformerComponent dst = new ImagingStudySeriesPerformerComponent();
1326        copyValues(dst);
1327        dst.function = function == null ? null : function.copy();
1328        dst.actor = actor == null ? null : actor.copy();
1329        return dst;
1330      }
1331
1332      @Override
1333      public boolean equalsDeep(Base other_) {
1334        if (!super.equalsDeep(other_))
1335          return false;
1336        if (!(other_ instanceof ImagingStudySeriesPerformerComponent))
1337          return false;
1338        ImagingStudySeriesPerformerComponent o = (ImagingStudySeriesPerformerComponent) other_;
1339        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
1340      }
1341
1342      @Override
1343      public boolean equalsShallow(Base other_) {
1344        if (!super.equalsShallow(other_))
1345          return false;
1346        if (!(other_ instanceof ImagingStudySeriesPerformerComponent))
1347          return false;
1348        ImagingStudySeriesPerformerComponent o = (ImagingStudySeriesPerformerComponent) other_;
1349        return true;
1350      }
1351
1352      public boolean isEmpty() {
1353        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
1354      }
1355
1356  public String fhirType() {
1357    return "ImagingStudy.series.performer";
1358
1359  }
1360
1361  }
1362
1363    @Block()
1364    public static class ImagingStudySeriesInstanceComponent extends BackboneElement implements IBaseBackboneElement {
1365        /**
1366         * Formal identifier for this image or other content.
1367         */
1368        @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=false)
1369        @Description(shortDefinition="Formal DICOM identifier for this instance", formalDefinition="Formal identifier for this image or other content." )
1370        protected Identifier identifier;
1371
1372        /**
1373         * The number of instance in the series.
1374         */
1375        @Child(name = "number", type = {UnsignedIntType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1376        @Description(shortDefinition="The number of this instance in the series", formalDefinition="The number of instance in the series." )
1377        protected UnsignedIntType number;
1378
1379        /**
1380         * DICOM instance  type.
1381         */
1382        @Child(name = "sopClass", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=false)
1383        @Description(shortDefinition="DICOM class type", formalDefinition="DICOM instance  type." )
1384        protected Coding sopClass;
1385
1386        /**
1387         * The description of the instance.
1388         */
1389        @Child(name = "title", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1390        @Description(shortDefinition="Description of instance", formalDefinition="The description of the instance." )
1391        protected StringType title;
1392
1393        private static final long serialVersionUID = -2106153652L;
1394
1395    /**
1396     * Constructor
1397     */
1398      public ImagingStudySeriesInstanceComponent() {
1399        super();
1400      }
1401
1402    /**
1403     * Constructor
1404     */
1405      public ImagingStudySeriesInstanceComponent(Identifier identifier, Coding sopClass) {
1406        super();
1407        this.identifier = identifier;
1408        this.sopClass = sopClass;
1409      }
1410
1411        /**
1412         * @return {@link #identifier} (Formal identifier for this image or other content.)
1413         */
1414        public Identifier getIdentifier() { 
1415          if (this.identifier == null)
1416            if (Configuration.errorOnAutoCreate())
1417              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.identifier");
1418            else if (Configuration.doAutoCreate())
1419              this.identifier = new Identifier(); // cc
1420          return this.identifier;
1421        }
1422
1423        public boolean hasIdentifier() { 
1424          return this.identifier != null && !this.identifier.isEmpty();
1425        }
1426
1427        /**
1428         * @param value {@link #identifier} (Formal identifier for this image or other content.)
1429         */
1430        public ImagingStudySeriesInstanceComponent setIdentifier(Identifier value) { 
1431          this.identifier = value;
1432          return this;
1433        }
1434
1435        /**
1436         * @return {@link #number} (The number of instance in the series.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
1437         */
1438        public UnsignedIntType getNumberElement() { 
1439          if (this.number == null)
1440            if (Configuration.errorOnAutoCreate())
1441              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.number");
1442            else if (Configuration.doAutoCreate())
1443              this.number = new UnsignedIntType(); // bb
1444          return this.number;
1445        }
1446
1447        public boolean hasNumberElement() { 
1448          return this.number != null && !this.number.isEmpty();
1449        }
1450
1451        public boolean hasNumber() { 
1452          return this.number != null && !this.number.isEmpty();
1453        }
1454
1455        /**
1456         * @param value {@link #number} (The number of instance in the series.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
1457         */
1458        public ImagingStudySeriesInstanceComponent setNumberElement(UnsignedIntType value) { 
1459          this.number = value;
1460          return this;
1461        }
1462
1463        /**
1464         * @return The number of instance in the series.
1465         */
1466        public int getNumber() { 
1467          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
1468        }
1469
1470        /**
1471         * @param value The number of instance in the series.
1472         */
1473        public ImagingStudySeriesInstanceComponent setNumber(int value) { 
1474            if (this.number == null)
1475              this.number = new UnsignedIntType();
1476            this.number.setValue(value);
1477          return this;
1478        }
1479
1480        /**
1481         * @return {@link #sopClass} (DICOM instance  type.)
1482         */
1483        public Coding getSopClass() { 
1484          if (this.sopClass == null)
1485            if (Configuration.errorOnAutoCreate())
1486              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.sopClass");
1487            else if (Configuration.doAutoCreate())
1488              this.sopClass = new Coding(); // cc
1489          return this.sopClass;
1490        }
1491
1492        public boolean hasSopClass() { 
1493          return this.sopClass != null && !this.sopClass.isEmpty();
1494        }
1495
1496        /**
1497         * @param value {@link #sopClass} (DICOM instance  type.)
1498         */
1499        public ImagingStudySeriesInstanceComponent setSopClass(Coding value) { 
1500          this.sopClass = value;
1501          return this;
1502        }
1503
1504        /**
1505         * @return {@link #title} (The description of the instance.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1506         */
1507        public StringType getTitleElement() { 
1508          if (this.title == null)
1509            if (Configuration.errorOnAutoCreate())
1510              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.title");
1511            else if (Configuration.doAutoCreate())
1512              this.title = new StringType(); // bb
1513          return this.title;
1514        }
1515
1516        public boolean hasTitleElement() { 
1517          return this.title != null && !this.title.isEmpty();
1518        }
1519
1520        public boolean hasTitle() { 
1521          return this.title != null && !this.title.isEmpty();
1522        }
1523
1524        /**
1525         * @param value {@link #title} (The description of the instance.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1526         */
1527        public ImagingStudySeriesInstanceComponent setTitleElement(StringType value) { 
1528          this.title = value;
1529          return this;
1530        }
1531
1532        /**
1533         * @return The description of the instance.
1534         */
1535        public String getTitle() { 
1536          return this.title == null ? null : this.title.getValue();
1537        }
1538
1539        /**
1540         * @param value The description of the instance.
1541         */
1542        public ImagingStudySeriesInstanceComponent setTitle(String value) { 
1543          if (Utilities.noString(value))
1544            this.title = null;
1545          else {
1546            if (this.title == null)
1547              this.title = new StringType();
1548            this.title.setValue(value);
1549          }
1550          return this;
1551        }
1552
1553        protected void listChildren(List<Property> children) {
1554          super.listChildren(children);
1555          children.add(new Property("identifier", "Identifier", "Formal identifier for this image or other content.", 0, 1, identifier));
1556          children.add(new Property("number", "unsignedInt", "The number of instance in the series.", 0, 1, number));
1557          children.add(new Property("sopClass", "Coding", "DICOM instance  type.", 0, 1, sopClass));
1558          children.add(new Property("title", "string", "The description of the instance.", 0, 1, title));
1559        }
1560
1561        @Override
1562        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1563          switch (_hash) {
1564          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Formal identifier for this image or other content.", 0, 1, identifier);
1565          case -1034364087: /*number*/  return new Property("number", "unsignedInt", "The number of instance in the series.", 0, 1, number);
1566          case 1560041540: /*sopClass*/  return new Property("sopClass", "Coding", "DICOM instance  type.", 0, 1, sopClass);
1567          case 110371416: /*title*/  return new Property("title", "string", "The description of the instance.", 0, 1, title);
1568          default: return super.getNamedProperty(_hash, _name, _checkValid);
1569          }
1570
1571        }
1572
1573      @Override
1574      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1575        switch (hash) {
1576        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1577        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // UnsignedIntType
1578        case 1560041540: /*sopClass*/ return this.sopClass == null ? new Base[0] : new Base[] {this.sopClass}; // Coding
1579        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1580        default: return super.getProperty(hash, name, checkValid);
1581        }
1582
1583      }
1584
1585      @Override
1586      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1587        switch (hash) {
1588        case -1618432855: // identifier
1589          this.identifier = castToIdentifier(value); // Identifier
1590          return value;
1591        case -1034364087: // number
1592          this.number = castToUnsignedInt(value); // UnsignedIntType
1593          return value;
1594        case 1560041540: // sopClass
1595          this.sopClass = castToCoding(value); // Coding
1596          return value;
1597        case 110371416: // title
1598          this.title = castToString(value); // StringType
1599          return value;
1600        default: return super.setProperty(hash, name, value);
1601        }
1602
1603      }
1604
1605      @Override
1606      public Base setProperty(String name, Base value) throws FHIRException {
1607        if (name.equals("identifier")) {
1608          this.identifier = castToIdentifier(value); // Identifier
1609        } else if (name.equals("number")) {
1610          this.number = castToUnsignedInt(value); // UnsignedIntType
1611        } else if (name.equals("sopClass")) {
1612          this.sopClass = castToCoding(value); // Coding
1613        } else if (name.equals("title")) {
1614          this.title = castToString(value); // StringType
1615        } else
1616          return super.setProperty(name, value);
1617        return value;
1618      }
1619
1620      @Override
1621      public Base makeProperty(int hash, String name) throws FHIRException {
1622        switch (hash) {
1623        case -1618432855:  return getIdentifier(); 
1624        case -1034364087:  return getNumberElement();
1625        case 1560041540:  return getSopClass(); 
1626        case 110371416:  return getTitleElement();
1627        default: return super.makeProperty(hash, name);
1628        }
1629
1630      }
1631
1632      @Override
1633      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1634        switch (hash) {
1635        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1636        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
1637        case 1560041540: /*sopClass*/ return new String[] {"Coding"};
1638        case 110371416: /*title*/ return new String[] {"string"};
1639        default: return super.getTypesForProperty(hash, name);
1640        }
1641
1642      }
1643
1644      @Override
1645      public Base addChild(String name) throws FHIRException {
1646        if (name.equals("identifier")) {
1647          this.identifier = new Identifier();
1648          return this.identifier;
1649        }
1650        else if (name.equals("number")) {
1651          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.number");
1652        }
1653        else if (name.equals("sopClass")) {
1654          this.sopClass = new Coding();
1655          return this.sopClass;
1656        }
1657        else if (name.equals("title")) {
1658          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.title");
1659        }
1660        else
1661          return super.addChild(name);
1662      }
1663
1664      public ImagingStudySeriesInstanceComponent copy() {
1665        ImagingStudySeriesInstanceComponent dst = new ImagingStudySeriesInstanceComponent();
1666        copyValues(dst);
1667        dst.identifier = identifier == null ? null : identifier.copy();
1668        dst.number = number == null ? null : number.copy();
1669        dst.sopClass = sopClass == null ? null : sopClass.copy();
1670        dst.title = title == null ? null : title.copy();
1671        return dst;
1672      }
1673
1674      @Override
1675      public boolean equalsDeep(Base other_) {
1676        if (!super.equalsDeep(other_))
1677          return false;
1678        if (!(other_ instanceof ImagingStudySeriesInstanceComponent))
1679          return false;
1680        ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other_;
1681        return compareDeep(identifier, o.identifier, true) && compareDeep(number, o.number, true) && compareDeep(sopClass, o.sopClass, true)
1682           && compareDeep(title, o.title, true);
1683      }
1684
1685      @Override
1686      public boolean equalsShallow(Base other_) {
1687        if (!super.equalsShallow(other_))
1688          return false;
1689        if (!(other_ instanceof ImagingStudySeriesInstanceComponent))
1690          return false;
1691        ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other_;
1692        return compareValues(number, o.number, true) && compareValues(title, o.title, true);
1693      }
1694
1695      public boolean isEmpty() {
1696        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, number, sopClass
1697          , title);
1698      }
1699
1700  public String fhirType() {
1701    return "ImagingStudy.series.instance";
1702
1703  }
1704
1705  }
1706
1707    /**
1708     * DICOM Study Instance UID, and Accession Number.
1709     */
1710    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1711    @Description(shortDefinition="Identifiers for the whole study", formalDefinition="DICOM Study Instance UID, and Accession Number." )
1712    protected List<Identifier> identifier;
1713
1714    /**
1715     * The current state of the ImagingStudy.
1716     */
1717    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1718    @Description(shortDefinition="registered | available | cancelled | entered-in-error | unknown", formalDefinition="The current state of the ImagingStudy." )
1719    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/imagingstudy-status")
1720    protected Enumeration<ImagingStudyStatus> status;
1721
1722    /**
1723     * A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).
1724     */
1725    @Child(name = "modality", type = {Coding.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1726    @Description(shortDefinition="All series modality if actual acquisition modalities", formalDefinition="A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19)." )
1727    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html")
1728    protected List<Coding> modality;
1729
1730    /**
1731     * The subject, typically a patient, of the imaging study.
1732     */
1733    @Child(name = "subject", type = {Patient.class, Device.class, Group.class}, order=3, min=1, max=1, modifier=false, summary=true)
1734    @Description(shortDefinition="Who or what is the subject of the study", formalDefinition="The subject, typically a patient, of the imaging study." )
1735    protected Reference subject;
1736
1737    /**
1738     * The actual object that is the target of the reference (The subject, typically a patient, of the imaging study.)
1739     */
1740    protected Resource subjectTarget;
1741
1742    /**
1743     * The encounter or episode at which the request is initiated.
1744     */
1745    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=4, min=0, max=1, modifier=false, summary=true)
1746    @Description(shortDefinition="Originating context", formalDefinition="The encounter or episode at which the request is initiated." )
1747    protected Reference context;
1748
1749    /**
1750     * The actual object that is the target of the reference (The encounter or episode at which the request is initiated.)
1751     */
1752    protected Resource contextTarget;
1753
1754    /**
1755     * Date and time the study started.
1756     */
1757    @Child(name = "started", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1758    @Description(shortDefinition="When the study was started", formalDefinition="Date and time the study started." )
1759    protected DateTimeType started;
1760
1761    /**
1762     * A list of the diagnostic requests that resulted in this imaging study being performed.
1763     */
1764    @Child(name = "basedOn", type = {CarePlan.class, ServiceRequest.class, Appointment.class, AppointmentResponse.class, Task.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1765    @Description(shortDefinition="Request fulfilled", formalDefinition="A list of the diagnostic requests that resulted in this imaging study being performed." )
1766    protected List<Reference> basedOn;
1767    /**
1768     * The actual objects that are the target of the reference (A list of the diagnostic requests that resulted in this imaging study being performed.)
1769     */
1770    protected List<Resource> basedOnTarget;
1771
1772
1773    /**
1774     * The requesting/referring physician.
1775     */
1776    @Child(name = "referrer", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=true)
1777    @Description(shortDefinition="Referring physician", formalDefinition="The requesting/referring physician." )
1778    protected Reference referrer;
1779
1780    /**
1781     * The actual object that is the target of the reference (The requesting/referring physician.)
1782     */
1783    protected Practitioner referrerTarget;
1784
1785    /**
1786     * Who read the study and interpreted the images or other content.
1787     */
1788    @Child(name = "interpreter", type = {Practitioner.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1789    @Description(shortDefinition="Who interpreted images", formalDefinition="Who read the study and interpreted the images or other content." )
1790    protected List<Reference> interpreter;
1791    /**
1792     * The actual objects that are the target of the reference (Who read the study and interpreted the images or other content.)
1793     */
1794    protected List<Practitioner> interpreterTarget;
1795
1796
1797    /**
1798     * The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType.
1799     */
1800    @Child(name = "endpoint", type = {Endpoint.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1801    @Description(shortDefinition="Study access endpoint", formalDefinition="The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType." )
1802    protected List<Reference> endpoint;
1803    /**
1804     * The actual objects that are the target of the reference (The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType.)
1805     */
1806    protected List<Endpoint> endpointTarget;
1807
1808
1809    /**
1810     * Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.
1811     */
1812    @Child(name = "numberOfSeries", type = {UnsignedIntType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1813    @Description(shortDefinition="Number of Study Related Series", formalDefinition="Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present." )
1814    protected UnsignedIntType numberOfSeries;
1815
1816    /**
1817     * Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
1818     */
1819    @Child(name = "numberOfInstances", type = {UnsignedIntType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1820    @Description(shortDefinition="Number of Study Related Instances", formalDefinition="Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present." )
1821    protected UnsignedIntType numberOfInstances;
1822
1823    /**
1824     * A reference to the performed Procedure.
1825     */
1826    @Child(name = "procedureReference", type = {Procedure.class}, order=12, min=0, max=1, modifier=false, summary=true)
1827    @Description(shortDefinition="The performed Procedure reference", formalDefinition="A reference to the performed Procedure." )
1828    protected Reference procedureReference;
1829
1830    /**
1831     * The actual object that is the target of the reference (A reference to the performed Procedure.)
1832     */
1833    protected Procedure procedureReferenceTarget;
1834
1835    /**
1836     * The code for the performed procedure type.
1837     */
1838    @Child(name = "procedureCode", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1839    @Description(shortDefinition="The performed procedure code", formalDefinition="The code for the performed procedure type." )
1840    protected List<CodeableConcept> procedureCode;
1841
1842    /**
1843     * The principal physical location where the ImagingStudy was performed.
1844     */
1845    @Child(name = "location", type = {Location.class}, order=14, min=0, max=1, modifier=false, summary=true)
1846    @Description(shortDefinition="Where ImagingStudy occurred", formalDefinition="The principal physical location where the ImagingStudy was performed." )
1847    protected Reference location;
1848
1849    /**
1850     * The actual object that is the target of the reference (The principal physical location where the ImagingStudy was performed.)
1851     */
1852    protected Location locationTarget;
1853
1854    /**
1855     * Description of clinical condition indicating why the ImagingStudy was requested.
1856     */
1857    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1858    @Description(shortDefinition="Why the study was requested", formalDefinition="Description of clinical condition indicating why the ImagingStudy was requested." )
1859    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-reason")
1860    protected List<CodeableConcept> reasonCode;
1861
1862    /**
1863     * Indicates another resource whose existence justifies this Study.
1864     */
1865    @Child(name = "reasonReference", type = {Condition.class, Observation.class, Media.class, DiagnosticReport.class, DocumentReference.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1866    @Description(shortDefinition="Why was study performed", formalDefinition="Indicates another resource whose existence justifies this Study." )
1867    protected List<Reference> reasonReference;
1868    /**
1869     * The actual objects that are the target of the reference (Indicates another resource whose existence justifies this Study.)
1870     */
1871    protected List<Resource> reasonReferenceTarget;
1872
1873
1874    /**
1875     * Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.
1876     */
1877    @Child(name = "note", type = {Annotation.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1878    @Description(shortDefinition="User-defined comments", formalDefinition="Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element." )
1879    protected List<Annotation> note;
1880
1881    /**
1882     * The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.
1883     */
1884    @Child(name = "description", type = {StringType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1885    @Description(shortDefinition="Institution-generated description", formalDefinition="The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed." )
1886    protected StringType description;
1887
1888    /**
1889     * Each study has one or more series of images or other content.
1890     */
1891    @Child(name = "series", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1892    @Description(shortDefinition="Each study has one or more series of instances", formalDefinition="Each study has one or more series of images or other content." )
1893    protected List<ImagingStudySeriesComponent> series;
1894
1895    private static final long serialVersionUID = -1711589612L;
1896
1897  /**
1898   * Constructor
1899   */
1900    public ImagingStudy() {
1901      super();
1902    }
1903
1904  /**
1905   * Constructor
1906   */
1907    public ImagingStudy(Enumeration<ImagingStudyStatus> status, Reference subject) {
1908      super();
1909      this.status = status;
1910      this.subject = subject;
1911    }
1912
1913    /**
1914     * @return {@link #identifier} (DICOM Study Instance UID, and Accession Number.)
1915     */
1916    public List<Identifier> getIdentifier() { 
1917      if (this.identifier == null)
1918        this.identifier = new ArrayList<Identifier>();
1919      return this.identifier;
1920    }
1921
1922    /**
1923     * @return Returns a reference to <code>this</code> for easy method chaining
1924     */
1925    public ImagingStudy setIdentifier(List<Identifier> theIdentifier) { 
1926      this.identifier = theIdentifier;
1927      return this;
1928    }
1929
1930    public boolean hasIdentifier() { 
1931      if (this.identifier == null)
1932        return false;
1933      for (Identifier item : this.identifier)
1934        if (!item.isEmpty())
1935          return true;
1936      return false;
1937    }
1938
1939    public Identifier addIdentifier() { //3
1940      Identifier t = new Identifier();
1941      if (this.identifier == null)
1942        this.identifier = new ArrayList<Identifier>();
1943      this.identifier.add(t);
1944      return t;
1945    }
1946
1947    public ImagingStudy addIdentifier(Identifier t) { //3
1948      if (t == null)
1949        return this;
1950      if (this.identifier == null)
1951        this.identifier = new ArrayList<Identifier>();
1952      this.identifier.add(t);
1953      return this;
1954    }
1955
1956    /**
1957     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1958     */
1959    public Identifier getIdentifierFirstRep() { 
1960      if (getIdentifier().isEmpty()) {
1961        addIdentifier();
1962      }
1963      return getIdentifier().get(0);
1964    }
1965
1966    /**
1967     * @return {@link #status} (The current state of the ImagingStudy.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1968     */
1969    public Enumeration<ImagingStudyStatus> getStatusElement() { 
1970      if (this.status == null)
1971        if (Configuration.errorOnAutoCreate())
1972          throw new Error("Attempt to auto-create ImagingStudy.status");
1973        else if (Configuration.doAutoCreate())
1974          this.status = new Enumeration<ImagingStudyStatus>(new ImagingStudyStatusEnumFactory()); // bb
1975      return this.status;
1976    }
1977
1978    public boolean hasStatusElement() { 
1979      return this.status != null && !this.status.isEmpty();
1980    }
1981
1982    public boolean hasStatus() { 
1983      return this.status != null && !this.status.isEmpty();
1984    }
1985
1986    /**
1987     * @param value {@link #status} (The current state of the ImagingStudy.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1988     */
1989    public ImagingStudy setStatusElement(Enumeration<ImagingStudyStatus> value) { 
1990      this.status = value;
1991      return this;
1992    }
1993
1994    /**
1995     * @return The current state of the ImagingStudy.
1996     */
1997    public ImagingStudyStatus getStatus() { 
1998      return this.status == null ? null : this.status.getValue();
1999    }
2000
2001    /**
2002     * @param value The current state of the ImagingStudy.
2003     */
2004    public ImagingStudy setStatus(ImagingStudyStatus value) { 
2005        if (this.status == null)
2006          this.status = new Enumeration<ImagingStudyStatus>(new ImagingStudyStatusEnumFactory());
2007        this.status.setValue(value);
2008      return this;
2009    }
2010
2011    /**
2012     * @return {@link #modality} (A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).)
2013     */
2014    public List<Coding> getModality() { 
2015      if (this.modality == null)
2016        this.modality = new ArrayList<Coding>();
2017      return this.modality;
2018    }
2019
2020    /**
2021     * @return Returns a reference to <code>this</code> for easy method chaining
2022     */
2023    public ImagingStudy setModality(List<Coding> theModality) { 
2024      this.modality = theModality;
2025      return this;
2026    }
2027
2028    public boolean hasModality() { 
2029      if (this.modality == null)
2030        return false;
2031      for (Coding item : this.modality)
2032        if (!item.isEmpty())
2033          return true;
2034      return false;
2035    }
2036
2037    public Coding addModality() { //3
2038      Coding t = new Coding();
2039      if (this.modality == null)
2040        this.modality = new ArrayList<Coding>();
2041      this.modality.add(t);
2042      return t;
2043    }
2044
2045    public ImagingStudy addModality(Coding t) { //3
2046      if (t == null)
2047        return this;
2048      if (this.modality == null)
2049        this.modality = new ArrayList<Coding>();
2050      this.modality.add(t);
2051      return this;
2052    }
2053
2054    /**
2055     * @return The first repetition of repeating field {@link #modality}, creating it if it does not already exist
2056     */
2057    public Coding getModalityFirstRep() { 
2058      if (getModality().isEmpty()) {
2059        addModality();
2060      }
2061      return getModality().get(0);
2062    }
2063
2064    /**
2065     * @return {@link #subject} (The subject, typically a patient, of the imaging study.)
2066     */
2067    public Reference getSubject() { 
2068      if (this.subject == null)
2069        if (Configuration.errorOnAutoCreate())
2070          throw new Error("Attempt to auto-create ImagingStudy.subject");
2071        else if (Configuration.doAutoCreate())
2072          this.subject = new Reference(); // cc
2073      return this.subject;
2074    }
2075
2076    public boolean hasSubject() { 
2077      return this.subject != null && !this.subject.isEmpty();
2078    }
2079
2080    /**
2081     * @param value {@link #subject} (The subject, typically a patient, of the imaging study.)
2082     */
2083    public ImagingStudy setSubject(Reference value) { 
2084      this.subject = value;
2085      return this;
2086    }
2087
2088    /**
2089     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The subject, typically a patient, of the imaging study.)
2090     */
2091    public Resource getSubjectTarget() { 
2092      return this.subjectTarget;
2093    }
2094
2095    /**
2096     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The subject, typically a patient, of the imaging study.)
2097     */
2098    public ImagingStudy setSubjectTarget(Resource value) { 
2099      this.subjectTarget = value;
2100      return this;
2101    }
2102
2103    /**
2104     * @return {@link #context} (The encounter or episode at which the request is initiated.)
2105     */
2106    public Reference getContext() { 
2107      if (this.context == null)
2108        if (Configuration.errorOnAutoCreate())
2109          throw new Error("Attempt to auto-create ImagingStudy.context");
2110        else if (Configuration.doAutoCreate())
2111          this.context = new Reference(); // cc
2112      return this.context;
2113    }
2114
2115    public boolean hasContext() { 
2116      return this.context != null && !this.context.isEmpty();
2117    }
2118
2119    /**
2120     * @param value {@link #context} (The encounter or episode at which the request is initiated.)
2121     */
2122    public ImagingStudy setContext(Reference value) { 
2123      this.context = value;
2124      return this;
2125    }
2126
2127    /**
2128     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter or episode at which the request is initiated.)
2129     */
2130    public Resource getContextTarget() { 
2131      return this.contextTarget;
2132    }
2133
2134    /**
2135     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter or episode at which the request is initiated.)
2136     */
2137    public ImagingStudy setContextTarget(Resource value) { 
2138      this.contextTarget = value;
2139      return this;
2140    }
2141
2142    /**
2143     * @return {@link #started} (Date and time the study started.). This is the underlying object with id, value and extensions. The accessor "getStarted" gives direct access to the value
2144     */
2145    public DateTimeType getStartedElement() { 
2146      if (this.started == null)
2147        if (Configuration.errorOnAutoCreate())
2148          throw new Error("Attempt to auto-create ImagingStudy.started");
2149        else if (Configuration.doAutoCreate())
2150          this.started = new DateTimeType(); // bb
2151      return this.started;
2152    }
2153
2154    public boolean hasStartedElement() { 
2155      return this.started != null && !this.started.isEmpty();
2156    }
2157
2158    public boolean hasStarted() { 
2159      return this.started != null && !this.started.isEmpty();
2160    }
2161
2162    /**
2163     * @param value {@link #started} (Date and time the study started.). This is the underlying object with id, value and extensions. The accessor "getStarted" gives direct access to the value
2164     */
2165    public ImagingStudy setStartedElement(DateTimeType value) { 
2166      this.started = value;
2167      return this;
2168    }
2169
2170    /**
2171     * @return Date and time the study started.
2172     */
2173    public Date getStarted() { 
2174      return this.started == null ? null : this.started.getValue();
2175    }
2176
2177    /**
2178     * @param value Date and time the study started.
2179     */
2180    public ImagingStudy setStarted(Date value) { 
2181      if (value == null)
2182        this.started = null;
2183      else {
2184        if (this.started == null)
2185          this.started = new DateTimeType();
2186        this.started.setValue(value);
2187      }
2188      return this;
2189    }
2190
2191    /**
2192     * @return {@link #basedOn} (A list of the diagnostic requests that resulted in this imaging study being performed.)
2193     */
2194    public List<Reference> getBasedOn() { 
2195      if (this.basedOn == null)
2196        this.basedOn = new ArrayList<Reference>();
2197      return this.basedOn;
2198    }
2199
2200    /**
2201     * @return Returns a reference to <code>this</code> for easy method chaining
2202     */
2203    public ImagingStudy setBasedOn(List<Reference> theBasedOn) { 
2204      this.basedOn = theBasedOn;
2205      return this;
2206    }
2207
2208    public boolean hasBasedOn() { 
2209      if (this.basedOn == null)
2210        return false;
2211      for (Reference item : this.basedOn)
2212        if (!item.isEmpty())
2213          return true;
2214      return false;
2215    }
2216
2217    public Reference addBasedOn() { //3
2218      Reference t = new Reference();
2219      if (this.basedOn == null)
2220        this.basedOn = new ArrayList<Reference>();
2221      this.basedOn.add(t);
2222      return t;
2223    }
2224
2225    public ImagingStudy addBasedOn(Reference t) { //3
2226      if (t == null)
2227        return this;
2228      if (this.basedOn == null)
2229        this.basedOn = new ArrayList<Reference>();
2230      this.basedOn.add(t);
2231      return this;
2232    }
2233
2234    /**
2235     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
2236     */
2237    public Reference getBasedOnFirstRep() { 
2238      if (getBasedOn().isEmpty()) {
2239        addBasedOn();
2240      }
2241      return getBasedOn().get(0);
2242    }
2243
2244    /**
2245     * @deprecated Use Reference#setResource(IBaseResource) instead
2246     */
2247    @Deprecated
2248    public List<Resource> getBasedOnTarget() { 
2249      if (this.basedOnTarget == null)
2250        this.basedOnTarget = new ArrayList<Resource>();
2251      return this.basedOnTarget;
2252    }
2253
2254    /**
2255     * @return {@link #referrer} (The requesting/referring physician.)
2256     */
2257    public Reference getReferrer() { 
2258      if (this.referrer == null)
2259        if (Configuration.errorOnAutoCreate())
2260          throw new Error("Attempt to auto-create ImagingStudy.referrer");
2261        else if (Configuration.doAutoCreate())
2262          this.referrer = new Reference(); // cc
2263      return this.referrer;
2264    }
2265
2266    public boolean hasReferrer() { 
2267      return this.referrer != null && !this.referrer.isEmpty();
2268    }
2269
2270    /**
2271     * @param value {@link #referrer} (The requesting/referring physician.)
2272     */
2273    public ImagingStudy setReferrer(Reference value) { 
2274      this.referrer = value;
2275      return this;
2276    }
2277
2278    /**
2279     * @return {@link #referrer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The requesting/referring physician.)
2280     */
2281    public Practitioner getReferrerTarget() { 
2282      if (this.referrerTarget == null)
2283        if (Configuration.errorOnAutoCreate())
2284          throw new Error("Attempt to auto-create ImagingStudy.referrer");
2285        else if (Configuration.doAutoCreate())
2286          this.referrerTarget = new Practitioner(); // aa
2287      return this.referrerTarget;
2288    }
2289
2290    /**
2291     * @param value {@link #referrer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The requesting/referring physician.)
2292     */
2293    public ImagingStudy setReferrerTarget(Practitioner value) { 
2294      this.referrerTarget = value;
2295      return this;
2296    }
2297
2298    /**
2299     * @return {@link #interpreter} (Who read the study and interpreted the images or other content.)
2300     */
2301    public List<Reference> getInterpreter() { 
2302      if (this.interpreter == null)
2303        this.interpreter = new ArrayList<Reference>();
2304      return this.interpreter;
2305    }
2306
2307    /**
2308     * @return Returns a reference to <code>this</code> for easy method chaining
2309     */
2310    public ImagingStudy setInterpreter(List<Reference> theInterpreter) { 
2311      this.interpreter = theInterpreter;
2312      return this;
2313    }
2314
2315    public boolean hasInterpreter() { 
2316      if (this.interpreter == null)
2317        return false;
2318      for (Reference item : this.interpreter)
2319        if (!item.isEmpty())
2320          return true;
2321      return false;
2322    }
2323
2324    public Reference addInterpreter() { //3
2325      Reference t = new Reference();
2326      if (this.interpreter == null)
2327        this.interpreter = new ArrayList<Reference>();
2328      this.interpreter.add(t);
2329      return t;
2330    }
2331
2332    public ImagingStudy addInterpreter(Reference t) { //3
2333      if (t == null)
2334        return this;
2335      if (this.interpreter == null)
2336        this.interpreter = new ArrayList<Reference>();
2337      this.interpreter.add(t);
2338      return this;
2339    }
2340
2341    /**
2342     * @return The first repetition of repeating field {@link #interpreter}, creating it if it does not already exist
2343     */
2344    public Reference getInterpreterFirstRep() { 
2345      if (getInterpreter().isEmpty()) {
2346        addInterpreter();
2347      }
2348      return getInterpreter().get(0);
2349    }
2350
2351    /**
2352     * @deprecated Use Reference#setResource(IBaseResource) instead
2353     */
2354    @Deprecated
2355    public List<Practitioner> getInterpreterTarget() { 
2356      if (this.interpreterTarget == null)
2357        this.interpreterTarget = new ArrayList<Practitioner>();
2358      return this.interpreterTarget;
2359    }
2360
2361    /**
2362     * @deprecated Use Reference#setResource(IBaseResource) instead
2363     */
2364    @Deprecated
2365    public Practitioner addInterpreterTarget() { 
2366      Practitioner r = new Practitioner();
2367      if (this.interpreterTarget == null)
2368        this.interpreterTarget = new ArrayList<Practitioner>();
2369      this.interpreterTarget.add(r);
2370      return r;
2371    }
2372
2373    /**
2374     * @return {@link #endpoint} (The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType.)
2375     */
2376    public List<Reference> getEndpoint() { 
2377      if (this.endpoint == null)
2378        this.endpoint = new ArrayList<Reference>();
2379      return this.endpoint;
2380    }
2381
2382    /**
2383     * @return Returns a reference to <code>this</code> for easy method chaining
2384     */
2385    public ImagingStudy setEndpoint(List<Reference> theEndpoint) { 
2386      this.endpoint = theEndpoint;
2387      return this;
2388    }
2389
2390    public boolean hasEndpoint() { 
2391      if (this.endpoint == null)
2392        return false;
2393      for (Reference item : this.endpoint)
2394        if (!item.isEmpty())
2395          return true;
2396      return false;
2397    }
2398
2399    public Reference addEndpoint() { //3
2400      Reference t = new Reference();
2401      if (this.endpoint == null)
2402        this.endpoint = new ArrayList<Reference>();
2403      this.endpoint.add(t);
2404      return t;
2405    }
2406
2407    public ImagingStudy addEndpoint(Reference t) { //3
2408      if (t == null)
2409        return this;
2410      if (this.endpoint == null)
2411        this.endpoint = new ArrayList<Reference>();
2412      this.endpoint.add(t);
2413      return this;
2414    }
2415
2416    /**
2417     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist
2418     */
2419    public Reference getEndpointFirstRep() { 
2420      if (getEndpoint().isEmpty()) {
2421        addEndpoint();
2422      }
2423      return getEndpoint().get(0);
2424    }
2425
2426    /**
2427     * @deprecated Use Reference#setResource(IBaseResource) instead
2428     */
2429    @Deprecated
2430    public List<Endpoint> getEndpointTarget() { 
2431      if (this.endpointTarget == null)
2432        this.endpointTarget = new ArrayList<Endpoint>();
2433      return this.endpointTarget;
2434    }
2435
2436    /**
2437     * @deprecated Use Reference#setResource(IBaseResource) instead
2438     */
2439    @Deprecated
2440    public Endpoint addEndpointTarget() { 
2441      Endpoint r = new Endpoint();
2442      if (this.endpointTarget == null)
2443        this.endpointTarget = new ArrayList<Endpoint>();
2444      this.endpointTarget.add(r);
2445      return r;
2446    }
2447
2448    /**
2449     * @return {@link #numberOfSeries} (Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSeries" gives direct access to the value
2450     */
2451    public UnsignedIntType getNumberOfSeriesElement() { 
2452      if (this.numberOfSeries == null)
2453        if (Configuration.errorOnAutoCreate())
2454          throw new Error("Attempt to auto-create ImagingStudy.numberOfSeries");
2455        else if (Configuration.doAutoCreate())
2456          this.numberOfSeries = new UnsignedIntType(); // bb
2457      return this.numberOfSeries;
2458    }
2459
2460    public boolean hasNumberOfSeriesElement() { 
2461      return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2462    }
2463
2464    public boolean hasNumberOfSeries() { 
2465      return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2466    }
2467
2468    /**
2469     * @param value {@link #numberOfSeries} (Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSeries" gives direct access to the value
2470     */
2471    public ImagingStudy setNumberOfSeriesElement(UnsignedIntType value) { 
2472      this.numberOfSeries = value;
2473      return this;
2474    }
2475
2476    /**
2477     * @return Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.
2478     */
2479    public int getNumberOfSeries() { 
2480      return this.numberOfSeries == null || this.numberOfSeries.isEmpty() ? 0 : this.numberOfSeries.getValue();
2481    }
2482
2483    /**
2484     * @param value Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.
2485     */
2486    public ImagingStudy setNumberOfSeries(int value) { 
2487        if (this.numberOfSeries == null)
2488          this.numberOfSeries = new UnsignedIntType();
2489        this.numberOfSeries.setValue(value);
2490      return this;
2491    }
2492
2493    /**
2494     * @return {@link #numberOfInstances} (Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
2495     */
2496    public UnsignedIntType getNumberOfInstancesElement() { 
2497      if (this.numberOfInstances == null)
2498        if (Configuration.errorOnAutoCreate())
2499          throw new Error("Attempt to auto-create ImagingStudy.numberOfInstances");
2500        else if (Configuration.doAutoCreate())
2501          this.numberOfInstances = new UnsignedIntType(); // bb
2502      return this.numberOfInstances;
2503    }
2504
2505    public boolean hasNumberOfInstancesElement() { 
2506      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
2507    }
2508
2509    public boolean hasNumberOfInstances() { 
2510      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
2511    }
2512
2513    /**
2514     * @param value {@link #numberOfInstances} (Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
2515     */
2516    public ImagingStudy setNumberOfInstancesElement(UnsignedIntType value) { 
2517      this.numberOfInstances = value;
2518      return this;
2519    }
2520
2521    /**
2522     * @return Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
2523     */
2524    public int getNumberOfInstances() { 
2525      return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
2526    }
2527
2528    /**
2529     * @param value Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.
2530     */
2531    public ImagingStudy setNumberOfInstances(int value) { 
2532        if (this.numberOfInstances == null)
2533          this.numberOfInstances = new UnsignedIntType();
2534        this.numberOfInstances.setValue(value);
2535      return this;
2536    }
2537
2538    /**
2539     * @return {@link #procedureReference} (A reference to the performed Procedure.)
2540     */
2541    public Reference getProcedureReference() { 
2542      if (this.procedureReference == null)
2543        if (Configuration.errorOnAutoCreate())
2544          throw new Error("Attempt to auto-create ImagingStudy.procedureReference");
2545        else if (Configuration.doAutoCreate())
2546          this.procedureReference = new Reference(); // cc
2547      return this.procedureReference;
2548    }
2549
2550    public boolean hasProcedureReference() { 
2551      return this.procedureReference != null && !this.procedureReference.isEmpty();
2552    }
2553
2554    /**
2555     * @param value {@link #procedureReference} (A reference to the performed Procedure.)
2556     */
2557    public ImagingStudy setProcedureReference(Reference value) { 
2558      this.procedureReference = value;
2559      return this;
2560    }
2561
2562    /**
2563     * @return {@link #procedureReference} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to the performed Procedure.)
2564     */
2565    public Procedure getProcedureReferenceTarget() { 
2566      if (this.procedureReferenceTarget == null)
2567        if (Configuration.errorOnAutoCreate())
2568          throw new Error("Attempt to auto-create ImagingStudy.procedureReference");
2569        else if (Configuration.doAutoCreate())
2570          this.procedureReferenceTarget = new Procedure(); // aa
2571      return this.procedureReferenceTarget;
2572    }
2573
2574    /**
2575     * @param value {@link #procedureReference} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to the performed Procedure.)
2576     */
2577    public ImagingStudy setProcedureReferenceTarget(Procedure value) { 
2578      this.procedureReferenceTarget = value;
2579      return this;
2580    }
2581
2582    /**
2583     * @return {@link #procedureCode} (The code for the performed procedure type.)
2584     */
2585    public List<CodeableConcept> getProcedureCode() { 
2586      if (this.procedureCode == null)
2587        this.procedureCode = new ArrayList<CodeableConcept>();
2588      return this.procedureCode;
2589    }
2590
2591    /**
2592     * @return Returns a reference to <code>this</code> for easy method chaining
2593     */
2594    public ImagingStudy setProcedureCode(List<CodeableConcept> theProcedureCode) { 
2595      this.procedureCode = theProcedureCode;
2596      return this;
2597    }
2598
2599    public boolean hasProcedureCode() { 
2600      if (this.procedureCode == null)
2601        return false;
2602      for (CodeableConcept item : this.procedureCode)
2603        if (!item.isEmpty())
2604          return true;
2605      return false;
2606    }
2607
2608    public CodeableConcept addProcedureCode() { //3
2609      CodeableConcept t = new CodeableConcept();
2610      if (this.procedureCode == null)
2611        this.procedureCode = new ArrayList<CodeableConcept>();
2612      this.procedureCode.add(t);
2613      return t;
2614    }
2615
2616    public ImagingStudy addProcedureCode(CodeableConcept t) { //3
2617      if (t == null)
2618        return this;
2619      if (this.procedureCode == null)
2620        this.procedureCode = new ArrayList<CodeableConcept>();
2621      this.procedureCode.add(t);
2622      return this;
2623    }
2624
2625    /**
2626     * @return The first repetition of repeating field {@link #procedureCode}, creating it if it does not already exist
2627     */
2628    public CodeableConcept getProcedureCodeFirstRep() { 
2629      if (getProcedureCode().isEmpty()) {
2630        addProcedureCode();
2631      }
2632      return getProcedureCode().get(0);
2633    }
2634
2635    /**
2636     * @return {@link #location} (The principal physical location where the ImagingStudy was performed.)
2637     */
2638    public Reference getLocation() { 
2639      if (this.location == null)
2640        if (Configuration.errorOnAutoCreate())
2641          throw new Error("Attempt to auto-create ImagingStudy.location");
2642        else if (Configuration.doAutoCreate())
2643          this.location = new Reference(); // cc
2644      return this.location;
2645    }
2646
2647    public boolean hasLocation() { 
2648      return this.location != null && !this.location.isEmpty();
2649    }
2650
2651    /**
2652     * @param value {@link #location} (The principal physical location where the ImagingStudy was performed.)
2653     */
2654    public ImagingStudy setLocation(Reference value) { 
2655      this.location = value;
2656      return this;
2657    }
2658
2659    /**
2660     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The principal physical location where the ImagingStudy was performed.)
2661     */
2662    public Location getLocationTarget() { 
2663      if (this.locationTarget == null)
2664        if (Configuration.errorOnAutoCreate())
2665          throw new Error("Attempt to auto-create ImagingStudy.location");
2666        else if (Configuration.doAutoCreate())
2667          this.locationTarget = new Location(); // aa
2668      return this.locationTarget;
2669    }
2670
2671    /**
2672     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The principal physical location where the ImagingStudy was performed.)
2673     */
2674    public ImagingStudy setLocationTarget(Location value) { 
2675      this.locationTarget = value;
2676      return this;
2677    }
2678
2679    /**
2680     * @return {@link #reasonCode} (Description of clinical condition indicating why the ImagingStudy was requested.)
2681     */
2682    public List<CodeableConcept> getReasonCode() { 
2683      if (this.reasonCode == null)
2684        this.reasonCode = new ArrayList<CodeableConcept>();
2685      return this.reasonCode;
2686    }
2687
2688    /**
2689     * @return Returns a reference to <code>this</code> for easy method chaining
2690     */
2691    public ImagingStudy setReasonCode(List<CodeableConcept> theReasonCode) { 
2692      this.reasonCode = theReasonCode;
2693      return this;
2694    }
2695
2696    public boolean hasReasonCode() { 
2697      if (this.reasonCode == null)
2698        return false;
2699      for (CodeableConcept item : this.reasonCode)
2700        if (!item.isEmpty())
2701          return true;
2702      return false;
2703    }
2704
2705    public CodeableConcept addReasonCode() { //3
2706      CodeableConcept t = new CodeableConcept();
2707      if (this.reasonCode == null)
2708        this.reasonCode = new ArrayList<CodeableConcept>();
2709      this.reasonCode.add(t);
2710      return t;
2711    }
2712
2713    public ImagingStudy addReasonCode(CodeableConcept t) { //3
2714      if (t == null)
2715        return this;
2716      if (this.reasonCode == null)
2717        this.reasonCode = new ArrayList<CodeableConcept>();
2718      this.reasonCode.add(t);
2719      return this;
2720    }
2721
2722    /**
2723     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
2724     */
2725    public CodeableConcept getReasonCodeFirstRep() { 
2726      if (getReasonCode().isEmpty()) {
2727        addReasonCode();
2728      }
2729      return getReasonCode().get(0);
2730    }
2731
2732    /**
2733     * @return {@link #reasonReference} (Indicates another resource whose existence justifies this Study.)
2734     */
2735    public List<Reference> getReasonReference() { 
2736      if (this.reasonReference == null)
2737        this.reasonReference = new ArrayList<Reference>();
2738      return this.reasonReference;
2739    }
2740
2741    /**
2742     * @return Returns a reference to <code>this</code> for easy method chaining
2743     */
2744    public ImagingStudy setReasonReference(List<Reference> theReasonReference) { 
2745      this.reasonReference = theReasonReference;
2746      return this;
2747    }
2748
2749    public boolean hasReasonReference() { 
2750      if (this.reasonReference == null)
2751        return false;
2752      for (Reference item : this.reasonReference)
2753        if (!item.isEmpty())
2754          return true;
2755      return false;
2756    }
2757
2758    public Reference addReasonReference() { //3
2759      Reference t = new Reference();
2760      if (this.reasonReference == null)
2761        this.reasonReference = new ArrayList<Reference>();
2762      this.reasonReference.add(t);
2763      return t;
2764    }
2765
2766    public ImagingStudy addReasonReference(Reference t) { //3
2767      if (t == null)
2768        return this;
2769      if (this.reasonReference == null)
2770        this.reasonReference = new ArrayList<Reference>();
2771      this.reasonReference.add(t);
2772      return this;
2773    }
2774
2775    /**
2776     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
2777     */
2778    public Reference getReasonReferenceFirstRep() { 
2779      if (getReasonReference().isEmpty()) {
2780        addReasonReference();
2781      }
2782      return getReasonReference().get(0);
2783    }
2784
2785    /**
2786     * @deprecated Use Reference#setResource(IBaseResource) instead
2787     */
2788    @Deprecated
2789    public List<Resource> getReasonReferenceTarget() { 
2790      if (this.reasonReferenceTarget == null)
2791        this.reasonReferenceTarget = new ArrayList<Resource>();
2792      return this.reasonReferenceTarget;
2793    }
2794
2795    /**
2796     * @return {@link #note} (Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.)
2797     */
2798    public List<Annotation> getNote() { 
2799      if (this.note == null)
2800        this.note = new ArrayList<Annotation>();
2801      return this.note;
2802    }
2803
2804    /**
2805     * @return Returns a reference to <code>this</code> for easy method chaining
2806     */
2807    public ImagingStudy setNote(List<Annotation> theNote) { 
2808      this.note = theNote;
2809      return this;
2810    }
2811
2812    public boolean hasNote() { 
2813      if (this.note == null)
2814        return false;
2815      for (Annotation item : this.note)
2816        if (!item.isEmpty())
2817          return true;
2818      return false;
2819    }
2820
2821    public Annotation addNote() { //3
2822      Annotation t = new Annotation();
2823      if (this.note == null)
2824        this.note = new ArrayList<Annotation>();
2825      this.note.add(t);
2826      return t;
2827    }
2828
2829    public ImagingStudy addNote(Annotation t) { //3
2830      if (t == null)
2831        return this;
2832      if (this.note == null)
2833        this.note = new ArrayList<Annotation>();
2834      this.note.add(t);
2835      return this;
2836    }
2837
2838    /**
2839     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2840     */
2841    public Annotation getNoteFirstRep() { 
2842      if (getNote().isEmpty()) {
2843        addNote();
2844      }
2845      return getNote().get(0);
2846    }
2847
2848    /**
2849     * @return {@link #description} (The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2850     */
2851    public StringType getDescriptionElement() { 
2852      if (this.description == null)
2853        if (Configuration.errorOnAutoCreate())
2854          throw new Error("Attempt to auto-create ImagingStudy.description");
2855        else if (Configuration.doAutoCreate())
2856          this.description = new StringType(); // bb
2857      return this.description;
2858    }
2859
2860    public boolean hasDescriptionElement() { 
2861      return this.description != null && !this.description.isEmpty();
2862    }
2863
2864    public boolean hasDescription() { 
2865      return this.description != null && !this.description.isEmpty();
2866    }
2867
2868    /**
2869     * @param value {@link #description} (The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2870     */
2871    public ImagingStudy setDescriptionElement(StringType value) { 
2872      this.description = value;
2873      return this;
2874    }
2875
2876    /**
2877     * @return The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.
2878     */
2879    public String getDescription() { 
2880      return this.description == null ? null : this.description.getValue();
2881    }
2882
2883    /**
2884     * @param value The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.
2885     */
2886    public ImagingStudy setDescription(String value) { 
2887      if (Utilities.noString(value))
2888        this.description = null;
2889      else {
2890        if (this.description == null)
2891          this.description = new StringType();
2892        this.description.setValue(value);
2893      }
2894      return this;
2895    }
2896
2897    /**
2898     * @return {@link #series} (Each study has one or more series of images or other content.)
2899     */
2900    public List<ImagingStudySeriesComponent> getSeries() { 
2901      if (this.series == null)
2902        this.series = new ArrayList<ImagingStudySeriesComponent>();
2903      return this.series;
2904    }
2905
2906    /**
2907     * @return Returns a reference to <code>this</code> for easy method chaining
2908     */
2909    public ImagingStudy setSeries(List<ImagingStudySeriesComponent> theSeries) { 
2910      this.series = theSeries;
2911      return this;
2912    }
2913
2914    public boolean hasSeries() { 
2915      if (this.series == null)
2916        return false;
2917      for (ImagingStudySeriesComponent item : this.series)
2918        if (!item.isEmpty())
2919          return true;
2920      return false;
2921    }
2922
2923    public ImagingStudySeriesComponent addSeries() { //3
2924      ImagingStudySeriesComponent t = new ImagingStudySeriesComponent();
2925      if (this.series == null)
2926        this.series = new ArrayList<ImagingStudySeriesComponent>();
2927      this.series.add(t);
2928      return t;
2929    }
2930
2931    public ImagingStudy addSeries(ImagingStudySeriesComponent t) { //3
2932      if (t == null)
2933        return this;
2934      if (this.series == null)
2935        this.series = new ArrayList<ImagingStudySeriesComponent>();
2936      this.series.add(t);
2937      return this;
2938    }
2939
2940    /**
2941     * @return The first repetition of repeating field {@link #series}, creating it if it does not already exist
2942     */
2943    public ImagingStudySeriesComponent getSeriesFirstRep() { 
2944      if (getSeries().isEmpty()) {
2945        addSeries();
2946      }
2947      return getSeries().get(0);
2948    }
2949
2950      protected void listChildren(List<Property> children) {
2951        super.listChildren(children);
2952        children.add(new Property("identifier", "Identifier", "DICOM Study Instance UID, and Accession Number.", 0, java.lang.Integer.MAX_VALUE, identifier));
2953        children.add(new Property("status", "code", "The current state of the ImagingStudy.", 0, 1, status));
2954        children.add(new Property("modality", "Coding", "A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).", 0, java.lang.Integer.MAX_VALUE, modality));
2955        children.add(new Property("subject", "Reference(Patient|Device|Group)", "The subject, typically a patient, of the imaging study.", 0, 1, subject));
2956        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode at which the request is initiated.", 0, 1, context));
2957        children.add(new Property("started", "dateTime", "Date and time the study started.", 0, 1, started));
2958        children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest|Appointment|AppointmentResponse|Task)", "A list of the diagnostic requests that resulted in this imaging study being performed.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2959        children.add(new Property("referrer", "Reference(Practitioner)", "The requesting/referring physician.", 0, 1, referrer));
2960        children.add(new Property("interpreter", "Reference(Practitioner)", "Who read the study and interpreted the images or other content.", 0, java.lang.Integer.MAX_VALUE, interpreter));
2961        children.add(new Property("endpoint", "Reference(Endpoint)", "The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType.", 0, java.lang.Integer.MAX_VALUE, endpoint));
2962        children.add(new Property("numberOfSeries", "unsignedInt", "Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.", 0, 1, numberOfSeries));
2963        children.add(new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.", 0, 1, numberOfInstances));
2964        children.add(new Property("procedureReference", "Reference(Procedure)", "A reference to the performed Procedure.", 0, 1, procedureReference));
2965        children.add(new Property("procedureCode", "CodeableConcept", "The code for the performed procedure type.", 0, java.lang.Integer.MAX_VALUE, procedureCode));
2966        children.add(new Property("location", "Reference(Location)", "The principal physical location where the ImagingStudy was performed.", 0, 1, location));
2967        children.add(new Property("reasonCode", "CodeableConcept", "Description of clinical condition indicating why the ImagingStudy was requested.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2968        children.add(new Property("reasonReference", "Reference(Condition|Observation|Media|DiagnosticReport|DocumentReference)", "Indicates another resource whose existence justifies this Study.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2969        children.add(new Property("note", "Annotation", "Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.", 0, java.lang.Integer.MAX_VALUE, note));
2970        children.add(new Property("description", "string", "The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.", 0, 1, description));
2971        children.add(new Property("series", "", "Each study has one or more series of images or other content.", 0, java.lang.Integer.MAX_VALUE, series));
2972      }
2973
2974      @Override
2975      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2976        switch (_hash) {
2977        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "DICOM Study Instance UID, and Accession Number.", 0, java.lang.Integer.MAX_VALUE, identifier);
2978        case -892481550: /*status*/  return new Property("status", "code", "The current state of the ImagingStudy.", 0, 1, status);
2979        case -622722335: /*modality*/  return new Property("modality", "Coding", "A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).", 0, java.lang.Integer.MAX_VALUE, modality);
2980        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Device|Group)", "The subject, typically a patient, of the imaging study.", 0, 1, subject);
2981        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode at which the request is initiated.", 0, 1, context);
2982        case -1897185151: /*started*/  return new Property("started", "dateTime", "Date and time the study started.", 0, 1, started);
2983        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|ServiceRequest|Appointment|AppointmentResponse|Task)", "A list of the diagnostic requests that resulted in this imaging study being performed.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2984        case -722568161: /*referrer*/  return new Property("referrer", "Reference(Practitioner)", "The requesting/referring physician.", 0, 1, referrer);
2985        case -2008009094: /*interpreter*/  return new Property("interpreter", "Reference(Practitioner)", "Who read the study and interpreted the images or other content.", 0, java.lang.Integer.MAX_VALUE, interpreter);
2986        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.connectionType.", 0, java.lang.Integer.MAX_VALUE, endpoint);
2987        case 1920000407: /*numberOfSeries*/  return new Property("numberOfSeries", "unsignedInt", "Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.", 0, 1, numberOfSeries);
2988        case -1043544226: /*numberOfInstances*/  return new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.", 0, 1, numberOfInstances);
2989        case 881809848: /*procedureReference*/  return new Property("procedureReference", "Reference(Procedure)", "A reference to the performed Procedure.", 0, 1, procedureReference);
2990        case -698023072: /*procedureCode*/  return new Property("procedureCode", "CodeableConcept", "The code for the performed procedure type.", 0, java.lang.Integer.MAX_VALUE, procedureCode);
2991        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The principal physical location where the ImagingStudy was performed.", 0, 1, location);
2992        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Description of clinical condition indicating why the ImagingStudy was requested.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2993        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|Media|DiagnosticReport|DocumentReference)", "Indicates another resource whose existence justifies this Study.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2994        case 3387378: /*note*/  return new Property("note", "Annotation", "Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.", 0, java.lang.Integer.MAX_VALUE, note);
2995        case -1724546052: /*description*/  return new Property("description", "string", "The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.", 0, 1, description);
2996        case -905838985: /*series*/  return new Property("series", "", "Each study has one or more series of images or other content.", 0, java.lang.Integer.MAX_VALUE, series);
2997        default: return super.getNamedProperty(_hash, _name, _checkValid);
2998        }
2999
3000      }
3001
3002      @Override
3003      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3004        switch (hash) {
3005        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3006        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ImagingStudyStatus>
3007        case -622722335: /*modality*/ return this.modality == null ? new Base[0] : this.modality.toArray(new Base[this.modality.size()]); // Coding
3008        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3009        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
3010        case -1897185151: /*started*/ return this.started == null ? new Base[0] : new Base[] {this.started}; // DateTimeType
3011        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3012        case -722568161: /*referrer*/ return this.referrer == null ? new Base[0] : new Base[] {this.referrer}; // Reference
3013        case -2008009094: /*interpreter*/ return this.interpreter == null ? new Base[0] : this.interpreter.toArray(new Base[this.interpreter.size()]); // Reference
3014        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
3015        case 1920000407: /*numberOfSeries*/ return this.numberOfSeries == null ? new Base[0] : new Base[] {this.numberOfSeries}; // UnsignedIntType
3016        case -1043544226: /*numberOfInstances*/ return this.numberOfInstances == null ? new Base[0] : new Base[] {this.numberOfInstances}; // UnsignedIntType
3017        case 881809848: /*procedureReference*/ return this.procedureReference == null ? new Base[0] : new Base[] {this.procedureReference}; // Reference
3018        case -698023072: /*procedureCode*/ return this.procedureCode == null ? new Base[0] : this.procedureCode.toArray(new Base[this.procedureCode.size()]); // CodeableConcept
3019        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3020        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
3021        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
3022        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3023        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3024        case -905838985: /*series*/ return this.series == null ? new Base[0] : this.series.toArray(new Base[this.series.size()]); // ImagingStudySeriesComponent
3025        default: return super.getProperty(hash, name, checkValid);
3026        }
3027
3028      }
3029
3030      @Override
3031      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3032        switch (hash) {
3033        case -1618432855: // identifier
3034          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3035          return value;
3036        case -892481550: // status
3037          value = new ImagingStudyStatusEnumFactory().fromType(castToCode(value));
3038          this.status = (Enumeration) value; // Enumeration<ImagingStudyStatus>
3039          return value;
3040        case -622722335: // modality
3041          this.getModality().add(castToCoding(value)); // Coding
3042          return value;
3043        case -1867885268: // subject
3044          this.subject = castToReference(value); // Reference
3045          return value;
3046        case 951530927: // context
3047          this.context = castToReference(value); // Reference
3048          return value;
3049        case -1897185151: // started
3050          this.started = castToDateTime(value); // DateTimeType
3051          return value;
3052        case -332612366: // basedOn
3053          this.getBasedOn().add(castToReference(value)); // Reference
3054          return value;
3055        case -722568161: // referrer
3056          this.referrer = castToReference(value); // Reference
3057          return value;
3058        case -2008009094: // interpreter
3059          this.getInterpreter().add(castToReference(value)); // Reference
3060          return value;
3061        case 1741102485: // endpoint
3062          this.getEndpoint().add(castToReference(value)); // Reference
3063          return value;
3064        case 1920000407: // numberOfSeries
3065          this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
3066          return value;
3067        case -1043544226: // numberOfInstances
3068          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
3069          return value;
3070        case 881809848: // procedureReference
3071          this.procedureReference = castToReference(value); // Reference
3072          return value;
3073        case -698023072: // procedureCode
3074          this.getProcedureCode().add(castToCodeableConcept(value)); // CodeableConcept
3075          return value;
3076        case 1901043637: // location
3077          this.location = castToReference(value); // Reference
3078          return value;
3079        case 722137681: // reasonCode
3080          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
3081          return value;
3082        case -1146218137: // reasonReference
3083          this.getReasonReference().add(castToReference(value)); // Reference
3084          return value;
3085        case 3387378: // note
3086          this.getNote().add(castToAnnotation(value)); // Annotation
3087          return value;
3088        case -1724546052: // description
3089          this.description = castToString(value); // StringType
3090          return value;
3091        case -905838985: // series
3092          this.getSeries().add((ImagingStudySeriesComponent) value); // ImagingStudySeriesComponent
3093          return value;
3094        default: return super.setProperty(hash, name, value);
3095        }
3096
3097      }
3098
3099      @Override
3100      public Base setProperty(String name, Base value) throws FHIRException {
3101        if (name.equals("identifier")) {
3102          this.getIdentifier().add(castToIdentifier(value));
3103        } else if (name.equals("status")) {
3104          value = new ImagingStudyStatusEnumFactory().fromType(castToCode(value));
3105          this.status = (Enumeration) value; // Enumeration<ImagingStudyStatus>
3106        } else if (name.equals("modality")) {
3107          this.getModality().add(castToCoding(value));
3108        } else if (name.equals("subject")) {
3109          this.subject = castToReference(value); // Reference
3110        } else if (name.equals("context")) {
3111          this.context = castToReference(value); // Reference
3112        } else if (name.equals("started")) {
3113          this.started = castToDateTime(value); // DateTimeType
3114        } else if (name.equals("basedOn")) {
3115          this.getBasedOn().add(castToReference(value));
3116        } else if (name.equals("referrer")) {
3117          this.referrer = castToReference(value); // Reference
3118        } else if (name.equals("interpreter")) {
3119          this.getInterpreter().add(castToReference(value));
3120        } else if (name.equals("endpoint")) {
3121          this.getEndpoint().add(castToReference(value));
3122        } else if (name.equals("numberOfSeries")) {
3123          this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
3124        } else if (name.equals("numberOfInstances")) {
3125          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
3126        } else if (name.equals("procedureReference")) {
3127          this.procedureReference = castToReference(value); // Reference
3128        } else if (name.equals("procedureCode")) {
3129          this.getProcedureCode().add(castToCodeableConcept(value));
3130        } else if (name.equals("location")) {
3131          this.location = castToReference(value); // Reference
3132        } else if (name.equals("reasonCode")) {
3133          this.getReasonCode().add(castToCodeableConcept(value));
3134        } else if (name.equals("reasonReference")) {
3135          this.getReasonReference().add(castToReference(value));
3136        } else if (name.equals("note")) {
3137          this.getNote().add(castToAnnotation(value));
3138        } else if (name.equals("description")) {
3139          this.description = castToString(value); // StringType
3140        } else if (name.equals("series")) {
3141          this.getSeries().add((ImagingStudySeriesComponent) value);
3142        } else
3143          return super.setProperty(name, value);
3144        return value;
3145      }
3146
3147      @Override
3148      public Base makeProperty(int hash, String name) throws FHIRException {
3149        switch (hash) {
3150        case -1618432855:  return addIdentifier(); 
3151        case -892481550:  return getStatusElement();
3152        case -622722335:  return addModality(); 
3153        case -1867885268:  return getSubject(); 
3154        case 951530927:  return getContext(); 
3155        case -1897185151:  return getStartedElement();
3156        case -332612366:  return addBasedOn(); 
3157        case -722568161:  return getReferrer(); 
3158        case -2008009094:  return addInterpreter(); 
3159        case 1741102485:  return addEndpoint(); 
3160        case 1920000407:  return getNumberOfSeriesElement();
3161        case -1043544226:  return getNumberOfInstancesElement();
3162        case 881809848:  return getProcedureReference(); 
3163        case -698023072:  return addProcedureCode(); 
3164        case 1901043637:  return getLocation(); 
3165        case 722137681:  return addReasonCode(); 
3166        case -1146218137:  return addReasonReference(); 
3167        case 3387378:  return addNote(); 
3168        case -1724546052:  return getDescriptionElement();
3169        case -905838985:  return addSeries(); 
3170        default: return super.makeProperty(hash, name);
3171        }
3172
3173      }
3174
3175      @Override
3176      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3177        switch (hash) {
3178        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3179        case -892481550: /*status*/ return new String[] {"code"};
3180        case -622722335: /*modality*/ return new String[] {"Coding"};
3181        case -1867885268: /*subject*/ return new String[] {"Reference"};
3182        case 951530927: /*context*/ return new String[] {"Reference"};
3183        case -1897185151: /*started*/ return new String[] {"dateTime"};
3184        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3185        case -722568161: /*referrer*/ return new String[] {"Reference"};
3186        case -2008009094: /*interpreter*/ return new String[] {"Reference"};
3187        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
3188        case 1920000407: /*numberOfSeries*/ return new String[] {"unsignedInt"};
3189        case -1043544226: /*numberOfInstances*/ return new String[] {"unsignedInt"};
3190        case 881809848: /*procedureReference*/ return new String[] {"Reference"};
3191        case -698023072: /*procedureCode*/ return new String[] {"CodeableConcept"};
3192        case 1901043637: /*location*/ return new String[] {"Reference"};
3193        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
3194        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
3195        case 3387378: /*note*/ return new String[] {"Annotation"};
3196        case -1724546052: /*description*/ return new String[] {"string"};
3197        case -905838985: /*series*/ return new String[] {};
3198        default: return super.getTypesForProperty(hash, name);
3199        }
3200
3201      }
3202
3203      @Override
3204      public Base addChild(String name) throws FHIRException {
3205        if (name.equals("identifier")) {
3206          return addIdentifier();
3207        }
3208        else if (name.equals("status")) {
3209          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.status");
3210        }
3211        else if (name.equals("modality")) {
3212          return addModality();
3213        }
3214        else if (name.equals("subject")) {
3215          this.subject = new Reference();
3216          return this.subject;
3217        }
3218        else if (name.equals("context")) {
3219          this.context = new Reference();
3220          return this.context;
3221        }
3222        else if (name.equals("started")) {
3223          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.started");
3224        }
3225        else if (name.equals("basedOn")) {
3226          return addBasedOn();
3227        }
3228        else if (name.equals("referrer")) {
3229          this.referrer = new Reference();
3230          return this.referrer;
3231        }
3232        else if (name.equals("interpreter")) {
3233          return addInterpreter();
3234        }
3235        else if (name.equals("endpoint")) {
3236          return addEndpoint();
3237        }
3238        else if (name.equals("numberOfSeries")) {
3239          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfSeries");
3240        }
3241        else if (name.equals("numberOfInstances")) {
3242          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfInstances");
3243        }
3244        else if (name.equals("procedureReference")) {
3245          this.procedureReference = new Reference();
3246          return this.procedureReference;
3247        }
3248        else if (name.equals("procedureCode")) {
3249          return addProcedureCode();
3250        }
3251        else if (name.equals("location")) {
3252          this.location = new Reference();
3253          return this.location;
3254        }
3255        else if (name.equals("reasonCode")) {
3256          return addReasonCode();
3257        }
3258        else if (name.equals("reasonReference")) {
3259          return addReasonReference();
3260        }
3261        else if (name.equals("note")) {
3262          return addNote();
3263        }
3264        else if (name.equals("description")) {
3265          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.description");
3266        }
3267        else if (name.equals("series")) {
3268          return addSeries();
3269        }
3270        else
3271          return super.addChild(name);
3272      }
3273
3274  public String fhirType() {
3275    return "ImagingStudy";
3276
3277  }
3278
3279      public ImagingStudy copy() {
3280        ImagingStudy dst = new ImagingStudy();
3281        copyValues(dst);
3282        if (identifier != null) {
3283          dst.identifier = new ArrayList<Identifier>();
3284          for (Identifier i : identifier)
3285            dst.identifier.add(i.copy());
3286        };
3287        dst.status = status == null ? null : status.copy();
3288        if (modality != null) {
3289          dst.modality = new ArrayList<Coding>();
3290          for (Coding i : modality)
3291            dst.modality.add(i.copy());
3292        };
3293        dst.subject = subject == null ? null : subject.copy();
3294        dst.context = context == null ? null : context.copy();
3295        dst.started = started == null ? null : started.copy();
3296        if (basedOn != null) {
3297          dst.basedOn = new ArrayList<Reference>();
3298          for (Reference i : basedOn)
3299            dst.basedOn.add(i.copy());
3300        };
3301        dst.referrer = referrer == null ? null : referrer.copy();
3302        if (interpreter != null) {
3303          dst.interpreter = new ArrayList<Reference>();
3304          for (Reference i : interpreter)
3305            dst.interpreter.add(i.copy());
3306        };
3307        if (endpoint != null) {
3308          dst.endpoint = new ArrayList<Reference>();
3309          for (Reference i : endpoint)
3310            dst.endpoint.add(i.copy());
3311        };
3312        dst.numberOfSeries = numberOfSeries == null ? null : numberOfSeries.copy();
3313        dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
3314        dst.procedureReference = procedureReference == null ? null : procedureReference.copy();
3315        if (procedureCode != null) {
3316          dst.procedureCode = new ArrayList<CodeableConcept>();
3317          for (CodeableConcept i : procedureCode)
3318            dst.procedureCode.add(i.copy());
3319        };
3320        dst.location = location == null ? null : location.copy();
3321        if (reasonCode != null) {
3322          dst.reasonCode = new ArrayList<CodeableConcept>();
3323          for (CodeableConcept i : reasonCode)
3324            dst.reasonCode.add(i.copy());
3325        };
3326        if (reasonReference != null) {
3327          dst.reasonReference = new ArrayList<Reference>();
3328          for (Reference i : reasonReference)
3329            dst.reasonReference.add(i.copy());
3330        };
3331        if (note != null) {
3332          dst.note = new ArrayList<Annotation>();
3333          for (Annotation i : note)
3334            dst.note.add(i.copy());
3335        };
3336        dst.description = description == null ? null : description.copy();
3337        if (series != null) {
3338          dst.series = new ArrayList<ImagingStudySeriesComponent>();
3339          for (ImagingStudySeriesComponent i : series)
3340            dst.series.add(i.copy());
3341        };
3342        return dst;
3343      }
3344
3345      protected ImagingStudy typedCopy() {
3346        return copy();
3347      }
3348
3349      @Override
3350      public boolean equalsDeep(Base other_) {
3351        if (!super.equalsDeep(other_))
3352          return false;
3353        if (!(other_ instanceof ImagingStudy))
3354          return false;
3355        ImagingStudy o = (ImagingStudy) other_;
3356        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(modality, o.modality, true)
3357           && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true) && compareDeep(started, o.started, true)
3358           && compareDeep(basedOn, o.basedOn, true) && compareDeep(referrer, o.referrer, true) && compareDeep(interpreter, o.interpreter, true)
3359           && compareDeep(endpoint, o.endpoint, true) && compareDeep(numberOfSeries, o.numberOfSeries, true)
3360           && compareDeep(numberOfInstances, o.numberOfInstances, true) && compareDeep(procedureReference, o.procedureReference, true)
3361           && compareDeep(procedureCode, o.procedureCode, true) && compareDeep(location, o.location, true)
3362           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3363           && compareDeep(note, o.note, true) && compareDeep(description, o.description, true) && compareDeep(series, o.series, true)
3364          ;
3365      }
3366
3367      @Override
3368      public boolean equalsShallow(Base other_) {
3369        if (!super.equalsShallow(other_))
3370          return false;
3371        if (!(other_ instanceof ImagingStudy))
3372          return false;
3373        ImagingStudy o = (ImagingStudy) other_;
3374        return compareValues(status, o.status, true) && compareValues(started, o.started, true) && compareValues(numberOfSeries, o.numberOfSeries, true)
3375           && compareValues(numberOfInstances, o.numberOfInstances, true) && compareValues(description, o.description, true)
3376          ;
3377      }
3378
3379      public boolean isEmpty() {
3380        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, modality
3381          , subject, context, started, basedOn, referrer, interpreter, endpoint, numberOfSeries
3382          , numberOfInstances, procedureReference, procedureCode, location, reasonCode, reasonReference
3383          , note, description, series);
3384      }
3385
3386  @Override
3387  public ResourceType getResourceType() {
3388    return ResourceType.ImagingStudy;
3389   }
3390
3391 /**
3392   * Search parameter: <b>identifier</b>
3393   * <p>
3394   * Description: <b>Other identifiers for the Study</b><br>
3395   * Type: <b>token</b><br>
3396   * Path: <b>ImagingStudy.identifier</b><br>
3397   * </p>
3398   */
3399  @SearchParamDefinition(name="identifier", path="ImagingStudy.identifier", description="Other identifiers for the Study", type="token" )
3400  public static final String SP_IDENTIFIER = "identifier";
3401 /**
3402   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3403   * <p>
3404   * Description: <b>Other identifiers for the Study</b><br>
3405   * Type: <b>token</b><br>
3406   * Path: <b>ImagingStudy.identifier</b><br>
3407   * </p>
3408   */
3409  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3410
3411 /**
3412   * Search parameter: <b>reason</b>
3413   * <p>
3414   * Description: <b>The reason for the study</b><br>
3415   * Type: <b>token</b><br>
3416   * Path: <b>ImagingStudy.reasonCode</b><br>
3417   * </p>
3418   */
3419  @SearchParamDefinition(name="reason", path="ImagingStudy.reasonCode", description="The reason for the study", type="token" )
3420  public static final String SP_REASON = "reason";
3421 /**
3422   * <b>Fluent Client</b> search parameter constant for <b>reason</b>
3423   * <p>
3424   * Description: <b>The reason for the study</b><br>
3425   * Type: <b>token</b><br>
3426   * Path: <b>ImagingStudy.reasonCode</b><br>
3427   * </p>
3428   */
3429  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON);
3430
3431 /**
3432   * Search parameter: <b>study</b>
3433   * <p>
3434   * Description: <b>The study identifier for the image</b><br>
3435   * Type: <b>token</b><br>
3436   * Path: <b>ImagingStudy.identifier</b><br>
3437   * </p>
3438   */
3439  @SearchParamDefinition(name="study", path="ImagingStudy.identifier", description="The study identifier for the image", type="token" )
3440  public static final String SP_STUDY = "study";
3441 /**
3442   * <b>Fluent Client</b> search parameter constant for <b>study</b>
3443   * <p>
3444   * Description: <b>The study identifier for the image</b><br>
3445   * Type: <b>token</b><br>
3446   * Path: <b>ImagingStudy.identifier</b><br>
3447   * </p>
3448   */
3449  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STUDY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STUDY);
3450
3451 /**
3452   * Search parameter: <b>dicom-class</b>
3453   * <p>
3454   * Description: <b>The type of the instance</b><br>
3455   * Type: <b>token</b><br>
3456   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
3457   * </p>
3458   */
3459  @SearchParamDefinition(name="dicom-class", path="ImagingStudy.series.instance.sopClass", description="The type of the instance", type="token" )
3460  public static final String SP_DICOM_CLASS = "dicom-class";
3461 /**
3462   * <b>Fluent Client</b> search parameter constant for <b>dicom-class</b>
3463   * <p>
3464   * Description: <b>The type of the instance</b><br>
3465   * Type: <b>token</b><br>
3466   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
3467   * </p>
3468   */
3469  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DICOM_CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DICOM_CLASS);
3470
3471 /**
3472   * Search parameter: <b>modality</b>
3473   * <p>
3474   * Description: <b>The modality of the series</b><br>
3475   * Type: <b>token</b><br>
3476   * Path: <b>ImagingStudy.series.modality</b><br>
3477   * </p>
3478   */
3479  @SearchParamDefinition(name="modality", path="ImagingStudy.series.modality", description="The modality of the series", type="token" )
3480  public static final String SP_MODALITY = "modality";
3481 /**
3482   * <b>Fluent Client</b> search parameter constant for <b>modality</b>
3483   * <p>
3484   * Description: <b>The modality of the series</b><br>
3485   * Type: <b>token</b><br>
3486   * Path: <b>ImagingStudy.series.modality</b><br>
3487   * </p>
3488   */
3489  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MODALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MODALITY);
3490
3491 /**
3492   * Search parameter: <b>bodysite</b>
3493   * <p>
3494   * Description: <b>The body site studied</b><br>
3495   * Type: <b>token</b><br>
3496   * Path: <b>ImagingStudy.series.bodySite</b><br>
3497   * </p>
3498   */
3499  @SearchParamDefinition(name="bodysite", path="ImagingStudy.series.bodySite", description="The body site studied", type="token" )
3500  public static final String SP_BODYSITE = "bodysite";
3501 /**
3502   * <b>Fluent Client</b> search parameter constant for <b>bodysite</b>
3503   * <p>
3504   * Description: <b>The body site studied</b><br>
3505   * Type: <b>token</b><br>
3506   * Path: <b>ImagingStudy.series.bodySite</b><br>
3507   * </p>
3508   */
3509  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODYSITE);
3510
3511 /**
3512   * Search parameter: <b>performer</b>
3513   * <p>
3514   * Description: <b>The person who performed the study</b><br>
3515   * Type: <b>reference</b><br>
3516   * Path: <b>ImagingStudy.series.performer.actor</b><br>
3517   * </p>
3518   */
3519  @SearchParamDefinition(name="performer", path="ImagingStudy.series.performer.actor", description="The person who performed the study", type="reference", target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3520  public static final String SP_PERFORMER = "performer";
3521 /**
3522   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3523   * <p>
3524   * Description: <b>The person who performed the study</b><br>
3525   * Type: <b>reference</b><br>
3526   * Path: <b>ImagingStudy.series.performer.actor</b><br>
3527   * </p>
3528   */
3529  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3530
3531/**
3532   * Constant for fluent queries to be used to add include statements. Specifies
3533   * the path value of "<b>ImagingStudy:performer</b>".
3534   */
3535  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("ImagingStudy:performer").toLocked();
3536
3537 /**
3538   * Search parameter: <b>subject</b>
3539   * <p>
3540   * Description: <b>Who the study is about</b><br>
3541   * Type: <b>reference</b><br>
3542   * Path: <b>ImagingStudy.subject</b><br>
3543   * </p>
3544   */
3545  @SearchParamDefinition(name="subject", path="ImagingStudy.subject", description="Who the study is about", type="reference", target={Device.class, Group.class, Patient.class } )
3546  public static final String SP_SUBJECT = "subject";
3547 /**
3548   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3549   * <p>
3550   * Description: <b>Who the study is about</b><br>
3551   * Type: <b>reference</b><br>
3552   * Path: <b>ImagingStudy.subject</b><br>
3553   * </p>
3554   */
3555  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3556
3557/**
3558   * Constant for fluent queries to be used to add include statements. Specifies
3559   * the path value of "<b>ImagingStudy:subject</b>".
3560   */
3561  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ImagingStudy:subject").toLocked();
3562
3563 /**
3564   * Search parameter: <b>started</b>
3565   * <p>
3566   * Description: <b>When the study was started</b><br>
3567   * Type: <b>date</b><br>
3568   * Path: <b>ImagingStudy.started</b><br>
3569   * </p>
3570   */
3571  @SearchParamDefinition(name="started", path="ImagingStudy.started", description="When the study was started", type="date" )
3572  public static final String SP_STARTED = "started";
3573 /**
3574   * <b>Fluent Client</b> search parameter constant for <b>started</b>
3575   * <p>
3576   * Description: <b>When the study was started</b><br>
3577   * Type: <b>date</b><br>
3578   * Path: <b>ImagingStudy.started</b><br>
3579   * </p>
3580   */
3581  public static final ca.uhn.fhir.rest.gclient.DateClientParam STARTED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_STARTED);
3582
3583 /**
3584   * Search parameter: <b>accession</b>
3585   * <p>
3586   * Description: <b>The accession identifier for the study</b><br>
3587   * Type: <b>token</b><br>
3588   * Path: <b>ImagingStudy.identifier</b><br>
3589   * </p>
3590   */
3591  @SearchParamDefinition(name="accession", path="ImagingStudy.identifier", description="The accession identifier for the study", type="token" )
3592  public static final String SP_ACCESSION = "accession";
3593 /**
3594   * <b>Fluent Client</b> search parameter constant for <b>accession</b>
3595   * <p>
3596   * Description: <b>The accession identifier for the study</b><br>
3597   * Type: <b>token</b><br>
3598   * Path: <b>ImagingStudy.identifier</b><br>
3599   * </p>
3600   */
3601  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACCESSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACCESSION);
3602
3603 /**
3604   * Search parameter: <b>inst-id</b>
3605   * <p>
3606   * Description: <b>The instance unique identifier</b><br>
3607   * Type: <b>token</b><br>
3608   * Path: <b>ImagingStudy.series.instance.identifier</b><br>
3609   * </p>
3610   */
3611  @SearchParamDefinition(name="inst-id", path="ImagingStudy.series.instance.identifier", description="The instance unique identifier", type="token" )
3612  public static final String SP_INST_ID = "inst-id";
3613 /**
3614   * <b>Fluent Client</b> search parameter constant for <b>inst-id</b>
3615   * <p>
3616   * Description: <b>The instance unique identifier</b><br>
3617   * Type: <b>token</b><br>
3618   * Path: <b>ImagingStudy.series.instance.identifier</b><br>
3619   * </p>
3620   */
3621  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INST_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INST_ID);
3622
3623 /**
3624   * Search parameter: <b>endpoint</b>
3625   * <p>
3626   * Description: <b>The endpoint for the study or series</b><br>
3627   * Type: <b>reference</b><br>
3628   * Path: <b>ImagingStudy.endpoint, ImagingStudy.series.endpoint</b><br>
3629   * </p>
3630   */
3631  @SearchParamDefinition(name="endpoint", path="ImagingStudy.endpoint | ImagingStudy.series.endpoint", description="The endpoint for the study or series", type="reference", target={Endpoint.class } )
3632  public static final String SP_ENDPOINT = "endpoint";
3633 /**
3634   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
3635   * <p>
3636   * Description: <b>The endpoint for the study or series</b><br>
3637   * Type: <b>reference</b><br>
3638   * Path: <b>ImagingStudy.endpoint, ImagingStudy.series.endpoint</b><br>
3639   * </p>
3640   */
3641  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
3642
3643/**
3644   * Constant for fluent queries to be used to add include statements. Specifies
3645   * the path value of "<b>ImagingStudy:endpoint</b>".
3646   */
3647  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("ImagingStudy:endpoint").toLocked();
3648
3649 /**
3650   * Search parameter: <b>patient</b>
3651   * <p>
3652   * Description: <b>Who the study is about</b><br>
3653   * Type: <b>reference</b><br>
3654   * Path: <b>ImagingStudy.subject</b><br>
3655   * </p>
3656   */
3657  @SearchParamDefinition(name="patient", path="ImagingStudy.subject.where(resolve() is Patient)", description="Who the study is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
3658  public static final String SP_PATIENT = "patient";
3659 /**
3660   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3661   * <p>
3662   * Description: <b>Who the study is about</b><br>
3663   * Type: <b>reference</b><br>
3664   * Path: <b>ImagingStudy.subject</b><br>
3665   * </p>
3666   */
3667  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3668
3669/**
3670   * Constant for fluent queries to be used to add include statements. Specifies
3671   * the path value of "<b>ImagingStudy:patient</b>".
3672   */
3673  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ImagingStudy:patient").toLocked();
3674
3675 /**
3676   * Search parameter: <b>series</b>
3677   * <p>
3678   * Description: <b>The identifier of the series of images</b><br>
3679   * Type: <b>token</b><br>
3680   * Path: <b>ImagingStudy.series.identifier</b><br>
3681   * </p>
3682   */
3683  @SearchParamDefinition(name="series", path="ImagingStudy.series.identifier", description="The identifier of the series of images", type="token" )
3684  public static final String SP_SERIES = "series";
3685 /**
3686   * <b>Fluent Client</b> search parameter constant for <b>series</b>
3687   * <p>
3688   * Description: <b>The identifier of the series of images</b><br>
3689   * Type: <b>token</b><br>
3690   * Path: <b>ImagingStudy.series.identifier</b><br>
3691   * </p>
3692   */
3693  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIES = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIES);
3694
3695 /**
3696   * Search parameter: <b>context</b>
3697   * <p>
3698   * Description: <b>The context of the study</b><br>
3699   * Type: <b>reference</b><br>
3700   * Path: <b>ImagingStudy.context</b><br>
3701   * </p>
3702   */
3703  @SearchParamDefinition(name="context", path="ImagingStudy.context", description="The context of the study", type="reference", target={Encounter.class, EpisodeOfCare.class } )
3704  public static final String SP_CONTEXT = "context";
3705 /**
3706   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3707   * <p>
3708   * Description: <b>The context of the study</b><br>
3709   * Type: <b>reference</b><br>
3710   * Path: <b>ImagingStudy.context</b><br>
3711   * </p>
3712   */
3713  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
3714
3715/**
3716   * Constant for fluent queries to be used to add include statements. Specifies
3717   * the path value of "<b>ImagingStudy:context</b>".
3718   */
3719  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("ImagingStudy:context").toLocked();
3720
3721 /**
3722   * Search parameter: <b>basedon</b>
3723   * <p>
3724   * Description: <b>The order for the image</b><br>
3725   * Type: <b>reference</b><br>
3726   * Path: <b>ImagingStudy.basedOn</b><br>
3727   * </p>
3728   */
3729  @SearchParamDefinition(name="basedon", path="ImagingStudy.basedOn", description="The order for the image", type="reference", target={Appointment.class, AppointmentResponse.class, CarePlan.class, ServiceRequest.class, Task.class } )
3730  public static final String SP_BASEDON = "basedon";
3731 /**
3732   * <b>Fluent Client</b> search parameter constant for <b>basedon</b>
3733   * <p>
3734   * Description: <b>The order for the image</b><br>
3735   * Type: <b>reference</b><br>
3736   * Path: <b>ImagingStudy.basedOn</b><br>
3737   * </p>
3738   */
3739  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASEDON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASEDON);
3740
3741/**
3742   * Constant for fluent queries to be used to add include statements. Specifies
3743   * the path value of "<b>ImagingStudy:basedon</b>".
3744   */
3745  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASEDON = new ca.uhn.fhir.model.api.Include("ImagingStudy:basedon").toLocked();
3746
3747 /**
3748   * Search parameter: <b>status</b>
3749   * <p>
3750   * Description: <b>The status of the study</b><br>
3751   * Type: <b>token</b><br>
3752   * Path: <b>ImagingStudy.status</b><br>
3753   * </p>
3754   */
3755  @SearchParamDefinition(name="status", path="ImagingStudy.status", description="The status of the study", type="token" )
3756  public static final String SP_STATUS = "status";
3757 /**
3758   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3759   * <p>
3760   * Description: <b>The status of the study</b><br>
3761   * Type: <b>token</b><br>
3762   * Path: <b>ImagingStudy.status</b><br>
3763   * </p>
3764   */
3765  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3766
3767
3768}
3769