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