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