001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * 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.
051 */
052@ResourceDef(name="ImagingStudy", profile="http://hl7.org/fhir/Profile/ImagingStudy")
053public class ImagingStudy extends DomainResource {
054
055    public enum InstanceAvailability {
056        /**
057         * null
058         */
059        ONLINE, 
060        /**
061         * null
062         */
063        OFFLINE, 
064        /**
065         * null
066         */
067        NEARLINE, 
068        /**
069         * null
070         */
071        UNAVAILABLE, 
072        /**
073         * added to help the parsers
074         */
075        NULL;
076        public static InstanceAvailability fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("ONLINE".equals(codeString))
080          return ONLINE;
081        if ("OFFLINE".equals(codeString))
082          return OFFLINE;
083        if ("NEARLINE".equals(codeString))
084          return NEARLINE;
085        if ("UNAVAILABLE".equals(codeString))
086          return UNAVAILABLE;
087        throw new FHIRException("Unknown InstanceAvailability code '"+codeString+"'");
088        }
089        public String toCode() {
090          switch (this) {
091            case ONLINE: return "ONLINE";
092            case OFFLINE: return "OFFLINE";
093            case NEARLINE: return "NEARLINE";
094            case UNAVAILABLE: return "UNAVAILABLE";
095            case NULL: return null;
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ONLINE: return "http://nema.org/dicom/dicm";
102            case OFFLINE: return "http://nema.org/dicom/dicm";
103            case NEARLINE: return "http://nema.org/dicom/dicm";
104            case UNAVAILABLE: return "http://nema.org/dicom/dicm";
105            case NULL: return null;
106            default: return "?";
107          }
108        }
109        public String getDefinition() {
110          switch (this) {
111            case ONLINE: return "";
112            case OFFLINE: return "";
113            case NEARLINE: return "";
114            case UNAVAILABLE: return "";
115            case NULL: return null;
116            default: return "?";
117          }
118        }
119        public String getDisplay() {
120          switch (this) {
121            case ONLINE: return "ONLINE";
122            case OFFLINE: return "OFFLINE";
123            case NEARLINE: return "NEARLINE";
124            case UNAVAILABLE: return "UNAVAILABLE";
125            case NULL: return null;
126            default: return "?";
127          }
128        }
129    }
130
131  public static class InstanceAvailabilityEnumFactory implements EnumFactory<InstanceAvailability> {
132    public InstanceAvailability fromCode(String codeString) throws IllegalArgumentException {
133      if (codeString == null || "".equals(codeString))
134            if (codeString == null || "".equals(codeString))
135                return null;
136        if ("ONLINE".equals(codeString))
137          return InstanceAvailability.ONLINE;
138        if ("OFFLINE".equals(codeString))
139          return InstanceAvailability.OFFLINE;
140        if ("NEARLINE".equals(codeString))
141          return InstanceAvailability.NEARLINE;
142        if ("UNAVAILABLE".equals(codeString))
143          return InstanceAvailability.UNAVAILABLE;
144        throw new IllegalArgumentException("Unknown InstanceAvailability code '"+codeString+"'");
145        }
146        public Enumeration<InstanceAvailability> fromType(Base code) throws FHIRException {
147          if (code == null || code.isEmpty())
148            return null;
149          String codeString = ((PrimitiveType) code).asStringValue();
150          if (codeString == null || "".equals(codeString))
151            return null;
152        if ("ONLINE".equals(codeString))
153          return new Enumeration<InstanceAvailability>(this, InstanceAvailability.ONLINE);
154        if ("OFFLINE".equals(codeString))
155          return new Enumeration<InstanceAvailability>(this, InstanceAvailability.OFFLINE);
156        if ("NEARLINE".equals(codeString))
157          return new Enumeration<InstanceAvailability>(this, InstanceAvailability.NEARLINE);
158        if ("UNAVAILABLE".equals(codeString))
159          return new Enumeration<InstanceAvailability>(this, InstanceAvailability.UNAVAILABLE);
160        throw new FHIRException("Unknown InstanceAvailability code '"+codeString+"'");
161        }
162    public String toCode(InstanceAvailability code) {
163      if (code == InstanceAvailability.ONLINE)
164        return "ONLINE";
165      if (code == InstanceAvailability.OFFLINE)
166        return "OFFLINE";
167      if (code == InstanceAvailability.NEARLINE)
168        return "NEARLINE";
169      if (code == InstanceAvailability.UNAVAILABLE)
170        return "UNAVAILABLE";
171      return "?";
172      }
173    public String toSystem(InstanceAvailability code) {
174      return code.getSystem();
175      }
176    }
177
178    @Block()
179    public static class ImagingStudySeriesComponent extends BackboneElement implements IBaseBackboneElement {
180        /**
181         * Formal identifier for this series.
182         */
183        @Child(name = "uid", type = {OidType.class}, order=1, min=1, max=1, modifier=false, summary=true)
184        @Description(shortDefinition="Formal identifier for this series", formalDefinition="Formal identifier for this series." )
185        protected OidType uid;
186
187        /**
188         * The Numeric identifier of this series in the study.
189         */
190        @Child(name = "number", type = {UnsignedIntType.class}, order=2, min=0, max=1, modifier=false, summary=true)
191        @Description(shortDefinition="Numeric identifier of this series", formalDefinition="The Numeric identifier of this series in the study." )
192        protected UnsignedIntType number;
193
194        /**
195         * The modality of this series sequence.
196         */
197        @Child(name = "modality", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
198        @Description(shortDefinition="The modality of the instances in the series", formalDefinition="The modality of this series sequence." )
199        protected Coding modality;
200
201        /**
202         * A description of the series.
203         */
204        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
205        @Description(shortDefinition="A short human readable summary of the series", formalDefinition="A description of the series." )
206        protected StringType description;
207
208        /**
209         * Number of SOP Instances in Series.
210         */
211        @Child(name = "numberOfInstances", type = {UnsignedIntType.class}, order=5, min=1, max=1, modifier=false, summary=true)
212        @Description(shortDefinition="Number of Series Related Instances", formalDefinition="Number of SOP Instances in Series." )
213        protected UnsignedIntType numberOfInstances;
214
215        /**
216         * Availability of series (online, offline or nearline).
217         */
218        @Child(name = "availability", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
219        @Description(shortDefinition="ONLINE | OFFLINE | NEARLINE | UNAVAILABLE", formalDefinition="Availability of series (online, offline or nearline)." )
220        protected Enumeration<InstanceAvailability> availability;
221
222        /**
223         * URI/URL specifying the location of the referenced series using WADO-RS.
224         */
225        @Child(name = "url", type = {UriType.class}, order=7, min=0, max=1, modifier=false, summary=true)
226        @Description(shortDefinition="Location of the referenced instance(s)", formalDefinition="URI/URL specifying the location of the referenced series using WADO-RS." )
227        protected UriType url;
228
229        /**
230         * Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed CT.
231         */
232        @Child(name = "bodySite", type = {Coding.class}, order=8, min=0, max=1, modifier=false, summary=true)
233        @Description(shortDefinition="Body part examined", formalDefinition="Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed CT." )
234        protected Coding bodySite;
235
236        /**
237         * Laterality if body site is paired anatomic structure and laterality is not pre-coordinated in body site code.
238         */
239        @Child(name = "laterality", type = {Coding.class}, order=9, min=0, max=1, modifier=false, summary=true)
240        @Description(shortDefinition="Body part laterality", formalDefinition="Laterality if body site is paired anatomic structure and laterality is not pre-coordinated in body site code." )
241        protected Coding laterality;
242
243        /**
244         * The date and time the series was started.
245         */
246        @Child(name = "started", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
247        @Description(shortDefinition="When the series started", formalDefinition="The date and time the series was started." )
248        protected DateTimeType started;
249
250        /**
251         * A single SOP Instance within the series, e.g. an image, or presentation state.
252         */
253        @Child(name = "instance", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
254        @Description(shortDefinition="A single SOP instance from the series", formalDefinition="A single SOP Instance within the series, e.g. an image, or presentation state." )
255        protected List<ImagingStudySeriesInstanceComponent> instance;
256
257        private static final long serialVersionUID = 42813749L;
258
259    /**
260     * Constructor
261     */
262      public ImagingStudySeriesComponent() {
263        super();
264      }
265
266    /**
267     * Constructor
268     */
269      public ImagingStudySeriesComponent(OidType uid, Coding modality, UnsignedIntType numberOfInstances) {
270        super();
271        this.uid = uid;
272        this.modality = modality;
273        this.numberOfInstances = numberOfInstances;
274      }
275
276        /**
277         * @return {@link #uid} (Formal identifier for this series.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
278         */
279        public OidType getUidElement() { 
280          if (this.uid == null)
281            if (Configuration.errorOnAutoCreate())
282              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.uid");
283            else if (Configuration.doAutoCreate())
284              this.uid = new OidType(); // bb
285          return this.uid;
286        }
287
288        public boolean hasUidElement() { 
289          return this.uid != null && !this.uid.isEmpty();
290        }
291
292        public boolean hasUid() { 
293          return this.uid != null && !this.uid.isEmpty();
294        }
295
296        /**
297         * @param value {@link #uid} (Formal identifier for this series.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
298         */
299        public ImagingStudySeriesComponent setUidElement(OidType value) { 
300          this.uid = value;
301          return this;
302        }
303
304        /**
305         * @return Formal identifier for this series.
306         */
307        public String getUid() { 
308          return this.uid == null ? null : this.uid.getValue();
309        }
310
311        /**
312         * @param value Formal identifier for this series.
313         */
314        public ImagingStudySeriesComponent setUid(String value) { 
315            if (this.uid == null)
316              this.uid = new OidType();
317            this.uid.setValue(value);
318          return this;
319        }
320
321        /**
322         * @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
323         */
324        public UnsignedIntType getNumberElement() { 
325          if (this.number == null)
326            if (Configuration.errorOnAutoCreate())
327              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.number");
328            else if (Configuration.doAutoCreate())
329              this.number = new UnsignedIntType(); // bb
330          return this.number;
331        }
332
333        public boolean hasNumberElement() { 
334          return this.number != null && !this.number.isEmpty();
335        }
336
337        public boolean hasNumber() { 
338          return this.number != null && !this.number.isEmpty();
339        }
340
341        /**
342         * @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
343         */
344        public ImagingStudySeriesComponent setNumberElement(UnsignedIntType value) { 
345          this.number = value;
346          return this;
347        }
348
349        /**
350         * @return The Numeric identifier of this series in the study.
351         */
352        public int getNumber() { 
353          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
354        }
355
356        /**
357         * @param value The Numeric identifier of this series in the study.
358         */
359        public ImagingStudySeriesComponent setNumber(int value) { 
360            if (this.number == null)
361              this.number = new UnsignedIntType();
362            this.number.setValue(value);
363          return this;
364        }
365
366        /**
367         * @return {@link #modality} (The modality of this series sequence.)
368         */
369        public Coding getModality() { 
370          if (this.modality == null)
371            if (Configuration.errorOnAutoCreate())
372              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.modality");
373            else if (Configuration.doAutoCreate())
374              this.modality = new Coding(); // cc
375          return this.modality;
376        }
377
378        public boolean hasModality() { 
379          return this.modality != null && !this.modality.isEmpty();
380        }
381
382        /**
383         * @param value {@link #modality} (The modality of this series sequence.)
384         */
385        public ImagingStudySeriesComponent setModality(Coding value) { 
386          this.modality = value;
387          return this;
388        }
389
390        /**
391         * @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
392         */
393        public StringType getDescriptionElement() { 
394          if (this.description == null)
395            if (Configuration.errorOnAutoCreate())
396              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.description");
397            else if (Configuration.doAutoCreate())
398              this.description = new StringType(); // bb
399          return this.description;
400        }
401
402        public boolean hasDescriptionElement() { 
403          return this.description != null && !this.description.isEmpty();
404        }
405
406        public boolean hasDescription() { 
407          return this.description != null && !this.description.isEmpty();
408        }
409
410        /**
411         * @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
412         */
413        public ImagingStudySeriesComponent setDescriptionElement(StringType value) { 
414          this.description = value;
415          return this;
416        }
417
418        /**
419         * @return A description of the series.
420         */
421        public String getDescription() { 
422          return this.description == null ? null : this.description.getValue();
423        }
424
425        /**
426         * @param value A description of the series.
427         */
428        public ImagingStudySeriesComponent setDescription(String value) { 
429          if (Utilities.noString(value))
430            this.description = null;
431          else {
432            if (this.description == null)
433              this.description = new StringType();
434            this.description.setValue(value);
435          }
436          return this;
437        }
438
439        /**
440         * @return {@link #numberOfInstances} (Number of SOP Instances in Series.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
441         */
442        public UnsignedIntType getNumberOfInstancesElement() { 
443          if (this.numberOfInstances == null)
444            if (Configuration.errorOnAutoCreate())
445              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.numberOfInstances");
446            else if (Configuration.doAutoCreate())
447              this.numberOfInstances = new UnsignedIntType(); // bb
448          return this.numberOfInstances;
449        }
450
451        public boolean hasNumberOfInstancesElement() { 
452          return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
453        }
454
455        public boolean hasNumberOfInstances() { 
456          return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
457        }
458
459        /**
460         * @param value {@link #numberOfInstances} (Number of SOP Instances in Series.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
461         */
462        public ImagingStudySeriesComponent setNumberOfInstancesElement(UnsignedIntType value) { 
463          this.numberOfInstances = value;
464          return this;
465        }
466
467        /**
468         * @return Number of SOP Instances in Series.
469         */
470        public int getNumberOfInstances() { 
471          return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
472        }
473
474        /**
475         * @param value Number of SOP Instances in Series.
476         */
477        public ImagingStudySeriesComponent setNumberOfInstances(int value) { 
478            if (this.numberOfInstances == null)
479              this.numberOfInstances = new UnsignedIntType();
480            this.numberOfInstances.setValue(value);
481          return this;
482        }
483
484        /**
485         * @return {@link #availability} (Availability of series (online, offline or nearline).). This is the underlying object with id, value and extensions. The accessor "getAvailability" gives direct access to the value
486         */
487        public Enumeration<InstanceAvailability> getAvailabilityElement() { 
488          if (this.availability == null)
489            if (Configuration.errorOnAutoCreate())
490              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.availability");
491            else if (Configuration.doAutoCreate())
492              this.availability = new Enumeration<InstanceAvailability>(new InstanceAvailabilityEnumFactory()); // bb
493          return this.availability;
494        }
495
496        public boolean hasAvailabilityElement() { 
497          return this.availability != null && !this.availability.isEmpty();
498        }
499
500        public boolean hasAvailability() { 
501          return this.availability != null && !this.availability.isEmpty();
502        }
503
504        /**
505         * @param value {@link #availability} (Availability of series (online, offline or nearline).). This is the underlying object with id, value and extensions. The accessor "getAvailability" gives direct access to the value
506         */
507        public ImagingStudySeriesComponent setAvailabilityElement(Enumeration<InstanceAvailability> value) { 
508          this.availability = value;
509          return this;
510        }
511
512        /**
513         * @return Availability of series (online, offline or nearline).
514         */
515        public InstanceAvailability getAvailability() { 
516          return this.availability == null ? null : this.availability.getValue();
517        }
518
519        /**
520         * @param value Availability of series (online, offline or nearline).
521         */
522        public ImagingStudySeriesComponent setAvailability(InstanceAvailability value) { 
523          if (value == null)
524            this.availability = null;
525          else {
526            if (this.availability == null)
527              this.availability = new Enumeration<InstanceAvailability>(new InstanceAvailabilityEnumFactory());
528            this.availability.setValue(value);
529          }
530          return this;
531        }
532
533        /**
534         * @return {@link #url} (URI/URL specifying the location of the referenced series using WADO-RS.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
535         */
536        public UriType getUrlElement() { 
537          if (this.url == null)
538            if (Configuration.errorOnAutoCreate())
539              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.url");
540            else if (Configuration.doAutoCreate())
541              this.url = new UriType(); // bb
542          return this.url;
543        }
544
545        public boolean hasUrlElement() { 
546          return this.url != null && !this.url.isEmpty();
547        }
548
549        public boolean hasUrl() { 
550          return this.url != null && !this.url.isEmpty();
551        }
552
553        /**
554         * @param value {@link #url} (URI/URL specifying the location of the referenced series using WADO-RS.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
555         */
556        public ImagingStudySeriesComponent setUrlElement(UriType value) { 
557          this.url = value;
558          return this;
559        }
560
561        /**
562         * @return URI/URL specifying the location of the referenced series using WADO-RS.
563         */
564        public String getUrl() { 
565          return this.url == null ? null : this.url.getValue();
566        }
567
568        /**
569         * @param value URI/URL specifying the location of the referenced series using WADO-RS.
570         */
571        public ImagingStudySeriesComponent setUrl(String value) { 
572          if (Utilities.noString(value))
573            this.url = null;
574          else {
575            if (this.url == null)
576              this.url = new UriType();
577            this.url.setValue(value);
578          }
579          return this;
580        }
581
582        /**
583         * @return {@link #bodySite} (Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed CT.)
584         */
585        public Coding getBodySite() { 
586          if (this.bodySite == null)
587            if (Configuration.errorOnAutoCreate())
588              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.bodySite");
589            else if (Configuration.doAutoCreate())
590              this.bodySite = new Coding(); // cc
591          return this.bodySite;
592        }
593
594        public boolean hasBodySite() { 
595          return this.bodySite != null && !this.bodySite.isEmpty();
596        }
597
598        /**
599         * @param value {@link #bodySite} (Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed CT.)
600         */
601        public ImagingStudySeriesComponent setBodySite(Coding value) { 
602          this.bodySite = value;
603          return this;
604        }
605
606        /**
607         * @return {@link #laterality} (Laterality if body site is paired anatomic structure and laterality is not pre-coordinated in body site code.)
608         */
609        public Coding getLaterality() { 
610          if (this.laterality == null)
611            if (Configuration.errorOnAutoCreate())
612              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.laterality");
613            else if (Configuration.doAutoCreate())
614              this.laterality = new Coding(); // cc
615          return this.laterality;
616        }
617
618        public boolean hasLaterality() { 
619          return this.laterality != null && !this.laterality.isEmpty();
620        }
621
622        /**
623         * @param value {@link #laterality} (Laterality if body site is paired anatomic structure and laterality is not pre-coordinated in body site code.)
624         */
625        public ImagingStudySeriesComponent setLaterality(Coding value) { 
626          this.laterality = value;
627          return this;
628        }
629
630        /**
631         * @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
632         */
633        public DateTimeType getStartedElement() { 
634          if (this.started == null)
635            if (Configuration.errorOnAutoCreate())
636              throw new Error("Attempt to auto-create ImagingStudySeriesComponent.started");
637            else if (Configuration.doAutoCreate())
638              this.started = new DateTimeType(); // bb
639          return this.started;
640        }
641
642        public boolean hasStartedElement() { 
643          return this.started != null && !this.started.isEmpty();
644        }
645
646        public boolean hasStarted() { 
647          return this.started != null && !this.started.isEmpty();
648        }
649
650        /**
651         * @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
652         */
653        public ImagingStudySeriesComponent setStartedElement(DateTimeType value) { 
654          this.started = value;
655          return this;
656        }
657
658        /**
659         * @return The date and time the series was started.
660         */
661        public Date getStarted() { 
662          return this.started == null ? null : this.started.getValue();
663        }
664
665        /**
666         * @param value The date and time the series was started.
667         */
668        public ImagingStudySeriesComponent setStarted(Date value) { 
669          if (value == null)
670            this.started = null;
671          else {
672            if (this.started == null)
673              this.started = new DateTimeType();
674            this.started.setValue(value);
675          }
676          return this;
677        }
678
679        /**
680         * @return {@link #instance} (A single SOP Instance within the series, e.g. an image, or presentation state.)
681         */
682        public List<ImagingStudySeriesInstanceComponent> getInstance() { 
683          if (this.instance == null)
684            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
685          return this.instance;
686        }
687
688        public boolean hasInstance() { 
689          if (this.instance == null)
690            return false;
691          for (ImagingStudySeriesInstanceComponent item : this.instance)
692            if (!item.isEmpty())
693              return true;
694          return false;
695        }
696
697        /**
698         * @return {@link #instance} (A single SOP Instance within the series, e.g. an image, or presentation state.)
699         */
700    // syntactic sugar
701        public ImagingStudySeriesInstanceComponent addInstance() { //3
702          ImagingStudySeriesInstanceComponent t = new ImagingStudySeriesInstanceComponent();
703          if (this.instance == null)
704            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
705          this.instance.add(t);
706          return t;
707        }
708
709    // syntactic sugar
710        public ImagingStudySeriesComponent addInstance(ImagingStudySeriesInstanceComponent t) { //3
711          if (t == null)
712            return this;
713          if (this.instance == null)
714            this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
715          this.instance.add(t);
716          return this;
717        }
718
719        protected void listChildren(List<Property> childrenList) {
720          super.listChildren(childrenList);
721          childrenList.add(new Property("uid", "oid", "Formal identifier for this series.", 0, java.lang.Integer.MAX_VALUE, uid));
722          childrenList.add(new Property("number", "unsignedInt", "The Numeric identifier of this series in the study.", 0, java.lang.Integer.MAX_VALUE, number));
723          childrenList.add(new Property("modality", "Coding", "The modality of this series sequence.", 0, java.lang.Integer.MAX_VALUE, modality));
724          childrenList.add(new Property("description", "string", "A description of the series.", 0, java.lang.Integer.MAX_VALUE, description));
725          childrenList.add(new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in Series.", 0, java.lang.Integer.MAX_VALUE, numberOfInstances));
726          childrenList.add(new Property("availability", "code", "Availability of series (online, offline or nearline).", 0, java.lang.Integer.MAX_VALUE, availability));
727          childrenList.add(new Property("url", "uri", "URI/URL specifying the location of the referenced series using WADO-RS.", 0, java.lang.Integer.MAX_VALUE, url));
728          childrenList.add(new Property("bodySite", "Coding", "Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed CT.", 0, java.lang.Integer.MAX_VALUE, bodySite));
729          childrenList.add(new Property("laterality", "Coding", "Laterality if body site is paired anatomic structure and laterality is not pre-coordinated in body site code.", 0, java.lang.Integer.MAX_VALUE, laterality));
730          childrenList.add(new Property("started", "dateTime", "The date and time the series was started.", 0, java.lang.Integer.MAX_VALUE, started));
731          childrenList.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));
732        }
733
734      @Override
735      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
736        switch (hash) {
737        case 115792: /*uid*/ return this.uid == null ? new Base[0] : new Base[] {this.uid}; // OidType
738        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // UnsignedIntType
739        case -622722335: /*modality*/ return this.modality == null ? new Base[0] : new Base[] {this.modality}; // Coding
740        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
741        case -1043544226: /*numberOfInstances*/ return this.numberOfInstances == null ? new Base[0] : new Base[] {this.numberOfInstances}; // UnsignedIntType
742        case 1997542747: /*availability*/ return this.availability == null ? new Base[0] : new Base[] {this.availability}; // Enumeration<InstanceAvailability>
743        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
744        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Coding
745        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // Coding
746        case -1897185151: /*started*/ return this.started == null ? new Base[0] : new Base[] {this.started}; // DateTimeType
747        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : this.instance.toArray(new Base[this.instance.size()]); // ImagingStudySeriesInstanceComponent
748        default: return super.getProperty(hash, name, checkValid);
749        }
750
751      }
752
753      @Override
754      public void setProperty(int hash, String name, Base value) throws FHIRException {
755        switch (hash) {
756        case 115792: // uid
757          this.uid = castToOid(value); // OidType
758          break;
759        case -1034364087: // number
760          this.number = castToUnsignedInt(value); // UnsignedIntType
761          break;
762        case -622722335: // modality
763          this.modality = castToCoding(value); // Coding
764          break;
765        case -1724546052: // description
766          this.description = castToString(value); // StringType
767          break;
768        case -1043544226: // numberOfInstances
769          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
770          break;
771        case 1997542747: // availability
772          this.availability = new InstanceAvailabilityEnumFactory().fromType(value); // Enumeration<InstanceAvailability>
773          break;
774        case 116079: // url
775          this.url = castToUri(value); // UriType
776          break;
777        case 1702620169: // bodySite
778          this.bodySite = castToCoding(value); // Coding
779          break;
780        case -170291817: // laterality
781          this.laterality = castToCoding(value); // Coding
782          break;
783        case -1897185151: // started
784          this.started = castToDateTime(value); // DateTimeType
785          break;
786        case 555127957: // instance
787          this.getInstance().add((ImagingStudySeriesInstanceComponent) value); // ImagingStudySeriesInstanceComponent
788          break;
789        default: super.setProperty(hash, name, value);
790        }
791
792      }
793
794      @Override
795      public void setProperty(String name, Base value) throws FHIRException {
796        if (name.equals("uid"))
797          this.uid = castToOid(value); // OidType
798        else if (name.equals("number"))
799          this.number = castToUnsignedInt(value); // UnsignedIntType
800        else if (name.equals("modality"))
801          this.modality = castToCoding(value); // Coding
802        else if (name.equals("description"))
803          this.description = castToString(value); // StringType
804        else if (name.equals("numberOfInstances"))
805          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
806        else if (name.equals("availability"))
807          this.availability = new InstanceAvailabilityEnumFactory().fromType(value); // Enumeration<InstanceAvailability>
808        else if (name.equals("url"))
809          this.url = castToUri(value); // UriType
810        else if (name.equals("bodySite"))
811          this.bodySite = castToCoding(value); // Coding
812        else if (name.equals("laterality"))
813          this.laterality = castToCoding(value); // Coding
814        else if (name.equals("started"))
815          this.started = castToDateTime(value); // DateTimeType
816        else if (name.equals("instance"))
817          this.getInstance().add((ImagingStudySeriesInstanceComponent) value);
818        else
819          super.setProperty(name, value);
820      }
821
822      @Override
823      public Base makeProperty(int hash, String name) throws FHIRException {
824        switch (hash) {
825        case 115792: throw new FHIRException("Cannot make property uid as it is not a complex type"); // OidType
826        case -1034364087: throw new FHIRException("Cannot make property number as it is not a complex type"); // UnsignedIntType
827        case -622722335:  return getModality(); // Coding
828        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
829        case -1043544226: throw new FHIRException("Cannot make property numberOfInstances as it is not a complex type"); // UnsignedIntType
830        case 1997542747: throw new FHIRException("Cannot make property availability as it is not a complex type"); // Enumeration<InstanceAvailability>
831        case 116079: throw new FHIRException("Cannot make property url as it is not a complex type"); // UriType
832        case 1702620169:  return getBodySite(); // Coding
833        case -170291817:  return getLaterality(); // Coding
834        case -1897185151: throw new FHIRException("Cannot make property started as it is not a complex type"); // DateTimeType
835        case 555127957:  return addInstance(); // ImagingStudySeriesInstanceComponent
836        default: return super.makeProperty(hash, name);
837        }
838
839      }
840
841      @Override
842      public Base addChild(String name) throws FHIRException {
843        if (name.equals("uid")) {
844          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.uid");
845        }
846        else if (name.equals("number")) {
847          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.number");
848        }
849        else if (name.equals("modality")) {
850          this.modality = new Coding();
851          return this.modality;
852        }
853        else if (name.equals("description")) {
854          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.description");
855        }
856        else if (name.equals("numberOfInstances")) {
857          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfInstances");
858        }
859        else if (name.equals("availability")) {
860          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.availability");
861        }
862        else if (name.equals("url")) {
863          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.url");
864        }
865        else if (name.equals("bodySite")) {
866          this.bodySite = new Coding();
867          return this.bodySite;
868        }
869        else if (name.equals("laterality")) {
870          this.laterality = new Coding();
871          return this.laterality;
872        }
873        else if (name.equals("started")) {
874          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.started");
875        }
876        else if (name.equals("instance")) {
877          return addInstance();
878        }
879        else
880          return super.addChild(name);
881      }
882
883      public ImagingStudySeriesComponent copy() {
884        ImagingStudySeriesComponent dst = new ImagingStudySeriesComponent();
885        copyValues(dst);
886        dst.uid = uid == null ? null : uid.copy();
887        dst.number = number == null ? null : number.copy();
888        dst.modality = modality == null ? null : modality.copy();
889        dst.description = description == null ? null : description.copy();
890        dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
891        dst.availability = availability == null ? null : availability.copy();
892        dst.url = url == null ? null : url.copy();
893        dst.bodySite = bodySite == null ? null : bodySite.copy();
894        dst.laterality = laterality == null ? null : laterality.copy();
895        dst.started = started == null ? null : started.copy();
896        if (instance != null) {
897          dst.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
898          for (ImagingStudySeriesInstanceComponent i : instance)
899            dst.instance.add(i.copy());
900        };
901        return dst;
902      }
903
904      @Override
905      public boolean equalsDeep(Base other) {
906        if (!super.equalsDeep(other))
907          return false;
908        if (!(other instanceof ImagingStudySeriesComponent))
909          return false;
910        ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other;
911        return compareDeep(uid, o.uid, true) && compareDeep(number, o.number, true) && compareDeep(modality, o.modality, true)
912           && compareDeep(description, o.description, true) && compareDeep(numberOfInstances, o.numberOfInstances, true)
913           && compareDeep(availability, o.availability, true) && compareDeep(url, o.url, true) && compareDeep(bodySite, o.bodySite, true)
914           && compareDeep(laterality, o.laterality, true) && compareDeep(started, o.started, true) && compareDeep(instance, o.instance, true)
915          ;
916      }
917
918      @Override
919      public boolean equalsShallow(Base other) {
920        if (!super.equalsShallow(other))
921          return false;
922        if (!(other instanceof ImagingStudySeriesComponent))
923          return false;
924        ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other;
925        return compareValues(uid, o.uid, true) && compareValues(number, o.number, true) && compareValues(description, o.description, true)
926           && compareValues(numberOfInstances, o.numberOfInstances, true) && compareValues(availability, o.availability, true)
927           && compareValues(url, o.url, true) && compareValues(started, o.started, true);
928      }
929
930      public boolean isEmpty() {
931        return super.isEmpty() && (uid == null || uid.isEmpty()) && (number == null || number.isEmpty())
932           && (modality == null || modality.isEmpty()) && (description == null || description.isEmpty())
933           && (numberOfInstances == null || numberOfInstances.isEmpty()) && (availability == null || availability.isEmpty())
934           && (url == null || url.isEmpty()) && (bodySite == null || bodySite.isEmpty()) && (laterality == null || laterality.isEmpty())
935           && (started == null || started.isEmpty()) && (instance == null || instance.isEmpty());
936      }
937
938  public String fhirType() {
939    return "ImagingStudy.series";
940
941  }
942
943  }
944
945    @Block()
946    public static class ImagingStudySeriesInstanceComponent extends BackboneElement implements IBaseBackboneElement {
947        /**
948         * Formal identifier for this image or other content.
949         */
950        @Child(name = "uid", type = {OidType.class}, order=1, min=1, max=1, modifier=false, summary=true)
951        @Description(shortDefinition="Formal identifier for this instance", formalDefinition="Formal identifier for this image or other content." )
952        protected OidType uid;
953
954        /**
955         * The number of instance in the series.
956         */
957        @Child(name = "number", type = {UnsignedIntType.class}, order=2, min=0, max=1, modifier=false, summary=true)
958        @Description(shortDefinition="The number of this instance in the series", formalDefinition="The number of instance in the series." )
959        protected UnsignedIntType number;
960
961        /**
962         * DICOM instance  type.
963         */
964        @Child(name = "sopClass", type = {OidType.class}, order=3, min=1, max=1, modifier=false, summary=true)
965        @Description(shortDefinition="DICOM class type", formalDefinition="DICOM instance  type." )
966        protected OidType sopClass;
967
968        /**
969         * A human-friendly SOP Class name.
970         */
971        @Child(name = "type", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
972        @Description(shortDefinition="Type of instance (image etc.)", formalDefinition="A human-friendly SOP Class name." )
973        protected StringType type;
974
975        /**
976         * The description of the instance.
977         */
978        @Child(name = "title", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
979        @Description(shortDefinition="Description of instance", formalDefinition="The description of the instance." )
980        protected StringType title;
981
982        /**
983         * Content of the instance or a rendering thereof (e.g. a JPEG of an image, or an XML of a structured report). May be represented for example by inline encoding; by a URL reference to a WADO-RS service that makes the instance available; or to a FHIR Resource (e.g. Media, Document, etc.). Multiple content attachments may be used for alternate representations of the instance.
984         */
985        @Child(name = "content", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
986        @Description(shortDefinition="The instance payload, such as the image binary data or URL to it", formalDefinition="Content of the instance or a rendering thereof (e.g. a JPEG of an image, or an XML of a structured report). May be represented for example by inline encoding; by a URL reference to a WADO-RS service that makes the instance available; or to a FHIR Resource (e.g. Media, Document, etc.). Multiple content attachments may be used for alternate representations of the instance." )
987        protected List<Attachment> content;
988
989        private static final long serialVersionUID = -693669901L;
990
991    /**
992     * Constructor
993     */
994      public ImagingStudySeriesInstanceComponent() {
995        super();
996      }
997
998    /**
999     * Constructor
1000     */
1001      public ImagingStudySeriesInstanceComponent(OidType uid, OidType sopClass) {
1002        super();
1003        this.uid = uid;
1004        this.sopClass = sopClass;
1005      }
1006
1007        /**
1008         * @return {@link #uid} (Formal identifier for this image or other content.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1009         */
1010        public OidType getUidElement() { 
1011          if (this.uid == null)
1012            if (Configuration.errorOnAutoCreate())
1013              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.uid");
1014            else if (Configuration.doAutoCreate())
1015              this.uid = new OidType(); // bb
1016          return this.uid;
1017        }
1018
1019        public boolean hasUidElement() { 
1020          return this.uid != null && !this.uid.isEmpty();
1021        }
1022
1023        public boolean hasUid() { 
1024          return this.uid != null && !this.uid.isEmpty();
1025        }
1026
1027        /**
1028         * @param value {@link #uid} (Formal identifier for this image or other content.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1029         */
1030        public ImagingStudySeriesInstanceComponent setUidElement(OidType value) { 
1031          this.uid = value;
1032          return this;
1033        }
1034
1035        /**
1036         * @return Formal identifier for this image or other content.
1037         */
1038        public String getUid() { 
1039          return this.uid == null ? null : this.uid.getValue();
1040        }
1041
1042        /**
1043         * @param value Formal identifier for this image or other content.
1044         */
1045        public ImagingStudySeriesInstanceComponent setUid(String value) { 
1046            if (this.uid == null)
1047              this.uid = new OidType();
1048            this.uid.setValue(value);
1049          return this;
1050        }
1051
1052        /**
1053         * @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
1054         */
1055        public UnsignedIntType getNumberElement() { 
1056          if (this.number == null)
1057            if (Configuration.errorOnAutoCreate())
1058              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.number");
1059            else if (Configuration.doAutoCreate())
1060              this.number = new UnsignedIntType(); // bb
1061          return this.number;
1062        }
1063
1064        public boolean hasNumberElement() { 
1065          return this.number != null && !this.number.isEmpty();
1066        }
1067
1068        public boolean hasNumber() { 
1069          return this.number != null && !this.number.isEmpty();
1070        }
1071
1072        /**
1073         * @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
1074         */
1075        public ImagingStudySeriesInstanceComponent setNumberElement(UnsignedIntType value) { 
1076          this.number = value;
1077          return this;
1078        }
1079
1080        /**
1081         * @return The number of instance in the series.
1082         */
1083        public int getNumber() { 
1084          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
1085        }
1086
1087        /**
1088         * @param value The number of instance in the series.
1089         */
1090        public ImagingStudySeriesInstanceComponent setNumber(int value) { 
1091            if (this.number == null)
1092              this.number = new UnsignedIntType();
1093            this.number.setValue(value);
1094          return this;
1095        }
1096
1097        /**
1098         * @return {@link #sopClass} (DICOM instance  type.). This is the underlying object with id, value and extensions. The accessor "getSopClass" gives direct access to the value
1099         */
1100        public OidType getSopClassElement() { 
1101          if (this.sopClass == null)
1102            if (Configuration.errorOnAutoCreate())
1103              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.sopClass");
1104            else if (Configuration.doAutoCreate())
1105              this.sopClass = new OidType(); // bb
1106          return this.sopClass;
1107        }
1108
1109        public boolean hasSopClassElement() { 
1110          return this.sopClass != null && !this.sopClass.isEmpty();
1111        }
1112
1113        public boolean hasSopClass() { 
1114          return this.sopClass != null && !this.sopClass.isEmpty();
1115        }
1116
1117        /**
1118         * @param value {@link #sopClass} (DICOM instance  type.). This is the underlying object with id, value and extensions. The accessor "getSopClass" gives direct access to the value
1119         */
1120        public ImagingStudySeriesInstanceComponent setSopClassElement(OidType value) { 
1121          this.sopClass = value;
1122          return this;
1123        }
1124
1125        /**
1126         * @return DICOM instance  type.
1127         */
1128        public String getSopClass() { 
1129          return this.sopClass == null ? null : this.sopClass.getValue();
1130        }
1131
1132        /**
1133         * @param value DICOM instance  type.
1134         */
1135        public ImagingStudySeriesInstanceComponent setSopClass(String value) { 
1136            if (this.sopClass == null)
1137              this.sopClass = new OidType();
1138            this.sopClass.setValue(value);
1139          return this;
1140        }
1141
1142        /**
1143         * @return {@link #type} (A human-friendly SOP Class name.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1144         */
1145        public StringType getTypeElement() { 
1146          if (this.type == null)
1147            if (Configuration.errorOnAutoCreate())
1148              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.type");
1149            else if (Configuration.doAutoCreate())
1150              this.type = new StringType(); // bb
1151          return this.type;
1152        }
1153
1154        public boolean hasTypeElement() { 
1155          return this.type != null && !this.type.isEmpty();
1156        }
1157
1158        public boolean hasType() { 
1159          return this.type != null && !this.type.isEmpty();
1160        }
1161
1162        /**
1163         * @param value {@link #type} (A human-friendly SOP Class name.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1164         */
1165        public ImagingStudySeriesInstanceComponent setTypeElement(StringType value) { 
1166          this.type = value;
1167          return this;
1168        }
1169
1170        /**
1171         * @return A human-friendly SOP Class name.
1172         */
1173        public String getType() { 
1174          return this.type == null ? null : this.type.getValue();
1175        }
1176
1177        /**
1178         * @param value A human-friendly SOP Class name.
1179         */
1180        public ImagingStudySeriesInstanceComponent setType(String value) { 
1181          if (Utilities.noString(value))
1182            this.type = null;
1183          else {
1184            if (this.type == null)
1185              this.type = new StringType();
1186            this.type.setValue(value);
1187          }
1188          return this;
1189        }
1190
1191        /**
1192         * @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
1193         */
1194        public StringType getTitleElement() { 
1195          if (this.title == null)
1196            if (Configuration.errorOnAutoCreate())
1197              throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.title");
1198            else if (Configuration.doAutoCreate())
1199              this.title = new StringType(); // bb
1200          return this.title;
1201        }
1202
1203        public boolean hasTitleElement() { 
1204          return this.title != null && !this.title.isEmpty();
1205        }
1206
1207        public boolean hasTitle() { 
1208          return this.title != null && !this.title.isEmpty();
1209        }
1210
1211        /**
1212         * @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
1213         */
1214        public ImagingStudySeriesInstanceComponent setTitleElement(StringType value) { 
1215          this.title = value;
1216          return this;
1217        }
1218
1219        /**
1220         * @return The description of the instance.
1221         */
1222        public String getTitle() { 
1223          return this.title == null ? null : this.title.getValue();
1224        }
1225
1226        /**
1227         * @param value The description of the instance.
1228         */
1229        public ImagingStudySeriesInstanceComponent setTitle(String value) { 
1230          if (Utilities.noString(value))
1231            this.title = null;
1232          else {
1233            if (this.title == null)
1234              this.title = new StringType();
1235            this.title.setValue(value);
1236          }
1237          return this;
1238        }
1239
1240        /**
1241         * @return {@link #content} (Content of the instance or a rendering thereof (e.g. a JPEG of an image, or an XML of a structured report). May be represented for example by inline encoding; by a URL reference to a WADO-RS service that makes the instance available; or to a FHIR Resource (e.g. Media, Document, etc.). Multiple content attachments may be used for alternate representations of the instance.)
1242         */
1243        public List<Attachment> getContent() { 
1244          if (this.content == null)
1245            this.content = new ArrayList<Attachment>();
1246          return this.content;
1247        }
1248
1249        public boolean hasContent() { 
1250          if (this.content == null)
1251            return false;
1252          for (Attachment item : this.content)
1253            if (!item.isEmpty())
1254              return true;
1255          return false;
1256        }
1257
1258        /**
1259         * @return {@link #content} (Content of the instance or a rendering thereof (e.g. a JPEG of an image, or an XML of a structured report). May be represented for example by inline encoding; by a URL reference to a WADO-RS service that makes the instance available; or to a FHIR Resource (e.g. Media, Document, etc.). Multiple content attachments may be used for alternate representations of the instance.)
1260         */
1261    // syntactic sugar
1262        public Attachment addContent() { //3
1263          Attachment t = new Attachment();
1264          if (this.content == null)
1265            this.content = new ArrayList<Attachment>();
1266          this.content.add(t);
1267          return t;
1268        }
1269
1270    // syntactic sugar
1271        public ImagingStudySeriesInstanceComponent addContent(Attachment t) { //3
1272          if (t == null)
1273            return this;
1274          if (this.content == null)
1275            this.content = new ArrayList<Attachment>();
1276          this.content.add(t);
1277          return this;
1278        }
1279
1280        protected void listChildren(List<Property> childrenList) {
1281          super.listChildren(childrenList);
1282          childrenList.add(new Property("uid", "oid", "Formal identifier for this image or other content.", 0, java.lang.Integer.MAX_VALUE, uid));
1283          childrenList.add(new Property("number", "unsignedInt", "The number of instance in the series.", 0, java.lang.Integer.MAX_VALUE, number));
1284          childrenList.add(new Property("sopClass", "oid", "DICOM instance  type.", 0, java.lang.Integer.MAX_VALUE, sopClass));
1285          childrenList.add(new Property("type", "string", "A human-friendly SOP Class name.", 0, java.lang.Integer.MAX_VALUE, type));
1286          childrenList.add(new Property("title", "string", "The description of the instance.", 0, java.lang.Integer.MAX_VALUE, title));
1287          childrenList.add(new Property("content", "Attachment", "Content of the instance or a rendering thereof (e.g. a JPEG of an image, or an XML of a structured report). May be represented for example by inline encoding; by a URL reference to a WADO-RS service that makes the instance available; or to a FHIR Resource (e.g. Media, Document, etc.). Multiple content attachments may be used for alternate representations of the instance.", 0, java.lang.Integer.MAX_VALUE, content));
1288        }
1289
1290      @Override
1291      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1292        switch (hash) {
1293        case 115792: /*uid*/ return this.uid == null ? new Base[0] : new Base[] {this.uid}; // OidType
1294        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // UnsignedIntType
1295        case 1560041540: /*sopClass*/ return this.sopClass == null ? new Base[0] : new Base[] {this.sopClass}; // OidType
1296        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
1297        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1298        case 951530617: /*content*/ return this.content == null ? new Base[0] : this.content.toArray(new Base[this.content.size()]); // Attachment
1299        default: return super.getProperty(hash, name, checkValid);
1300        }
1301
1302      }
1303
1304      @Override
1305      public void setProperty(int hash, String name, Base value) throws FHIRException {
1306        switch (hash) {
1307        case 115792: // uid
1308          this.uid = castToOid(value); // OidType
1309          break;
1310        case -1034364087: // number
1311          this.number = castToUnsignedInt(value); // UnsignedIntType
1312          break;
1313        case 1560041540: // sopClass
1314          this.sopClass = castToOid(value); // OidType
1315          break;
1316        case 3575610: // type
1317          this.type = castToString(value); // StringType
1318          break;
1319        case 110371416: // title
1320          this.title = castToString(value); // StringType
1321          break;
1322        case 951530617: // content
1323          this.getContent().add(castToAttachment(value)); // Attachment
1324          break;
1325        default: super.setProperty(hash, name, value);
1326        }
1327
1328      }
1329
1330      @Override
1331      public void setProperty(String name, Base value) throws FHIRException {
1332        if (name.equals("uid"))
1333          this.uid = castToOid(value); // OidType
1334        else if (name.equals("number"))
1335          this.number = castToUnsignedInt(value); // UnsignedIntType
1336        else if (name.equals("sopClass"))
1337          this.sopClass = castToOid(value); // OidType
1338        else if (name.equals("type"))
1339          this.type = castToString(value); // StringType
1340        else if (name.equals("title"))
1341          this.title = castToString(value); // StringType
1342        else if (name.equals("content"))
1343          this.getContent().add(castToAttachment(value));
1344        else
1345          super.setProperty(name, value);
1346      }
1347
1348      @Override
1349      public Base makeProperty(int hash, String name) throws FHIRException {
1350        switch (hash) {
1351        case 115792: throw new FHIRException("Cannot make property uid as it is not a complex type"); // OidType
1352        case -1034364087: throw new FHIRException("Cannot make property number as it is not a complex type"); // UnsignedIntType
1353        case 1560041540: throw new FHIRException("Cannot make property sopClass as it is not a complex type"); // OidType
1354        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // StringType
1355        case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
1356        case 951530617:  return addContent(); // Attachment
1357        default: return super.makeProperty(hash, name);
1358        }
1359
1360      }
1361
1362      @Override
1363      public Base addChild(String name) throws FHIRException {
1364        if (name.equals("uid")) {
1365          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.uid");
1366        }
1367        else if (name.equals("number")) {
1368          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.number");
1369        }
1370        else if (name.equals("sopClass")) {
1371          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.sopClass");
1372        }
1373        else if (name.equals("type")) {
1374          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.type");
1375        }
1376        else if (name.equals("title")) {
1377          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.title");
1378        }
1379        else if (name.equals("content")) {
1380          return addContent();
1381        }
1382        else
1383          return super.addChild(name);
1384      }
1385
1386      public ImagingStudySeriesInstanceComponent copy() {
1387        ImagingStudySeriesInstanceComponent dst = new ImagingStudySeriesInstanceComponent();
1388        copyValues(dst);
1389        dst.uid = uid == null ? null : uid.copy();
1390        dst.number = number == null ? null : number.copy();
1391        dst.sopClass = sopClass == null ? null : sopClass.copy();
1392        dst.type = type == null ? null : type.copy();
1393        dst.title = title == null ? null : title.copy();
1394        if (content != null) {
1395          dst.content = new ArrayList<Attachment>();
1396          for (Attachment i : content)
1397            dst.content.add(i.copy());
1398        };
1399        return dst;
1400      }
1401
1402      @Override
1403      public boolean equalsDeep(Base other) {
1404        if (!super.equalsDeep(other))
1405          return false;
1406        if (!(other instanceof ImagingStudySeriesInstanceComponent))
1407          return false;
1408        ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other;
1409        return compareDeep(uid, o.uid, true) && compareDeep(number, o.number, true) && compareDeep(sopClass, o.sopClass, true)
1410           && compareDeep(type, o.type, true) && compareDeep(title, o.title, true) && compareDeep(content, o.content, true)
1411          ;
1412      }
1413
1414      @Override
1415      public boolean equalsShallow(Base other) {
1416        if (!super.equalsShallow(other))
1417          return false;
1418        if (!(other instanceof ImagingStudySeriesInstanceComponent))
1419          return false;
1420        ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other;
1421        return compareValues(uid, o.uid, true) && compareValues(number, o.number, true) && compareValues(sopClass, o.sopClass, true)
1422           && compareValues(type, o.type, true) && compareValues(title, o.title, true);
1423      }
1424
1425      public boolean isEmpty() {
1426        return super.isEmpty() && (uid == null || uid.isEmpty()) && (number == null || number.isEmpty())
1427           && (sopClass == null || sopClass.isEmpty()) && (type == null || type.isEmpty()) && (title == null || title.isEmpty())
1428           && (content == null || content.isEmpty());
1429      }
1430
1431  public String fhirType() {
1432    return "ImagingStudy.series.instance";
1433
1434  }
1435
1436  }
1437
1438    /**
1439     * Formal identifier for the study.
1440     */
1441    @Child(name = "uid", type = {OidType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1442    @Description(shortDefinition="Formal identifier for the study", formalDefinition="Formal identifier for the study." )
1443    protected OidType uid;
1444
1445    /**
1446     * Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf).
1447     */
1448    @Child(name = "accession", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1449    @Description(shortDefinition="Related workflow identifier (\"Accession Number\")", formalDefinition="Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf)." )
1450    protected Identifier accession;
1451
1452    /**
1453     * Other identifiers for the study.
1454     */
1455    @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1456    @Description(shortDefinition="Other identifiers for the study", formalDefinition="Other identifiers for the study." )
1457    protected List<Identifier> identifier;
1458
1459    /**
1460     * Availability of study (online, offline or nearline).
1461     */
1462    @Child(name = "availability", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1463    @Description(shortDefinition="ONLINE | OFFLINE | NEARLINE | UNAVAILABLE (0008,0056)", formalDefinition="Availability of study (online, offline or nearline)." )
1464    protected Enumeration<InstanceAvailability> availability;
1465
1466    /**
1467     * A list of all the Series.ImageModality 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).
1468     */
1469    @Child(name = "modalityList", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1470    @Description(shortDefinition="All series modality if actual acquisition modalities", formalDefinition="A list of all the Series.ImageModality 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)." )
1471    protected List<Coding> modalityList;
1472
1473    /**
1474     * The patient imaged in the study.
1475     */
1476    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
1477    @Description(shortDefinition="Who the images are of", formalDefinition="The patient imaged in the study." )
1478    protected Reference patient;
1479
1480    /**
1481     * The actual object that is the target of the reference (The patient imaged in the study.)
1482     */
1483    protected Patient patientTarget;
1484
1485    /**
1486     * Date and Time the study started.
1487     */
1488    @Child(name = "started", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1489    @Description(shortDefinition="When the study was started", formalDefinition="Date and Time the study started." )
1490    protected DateTimeType started;
1491
1492    /**
1493     * A list of the diagnostic orders that resulted in this imaging study being performed.
1494     */
1495    @Child(name = "order", type = {DiagnosticOrder.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1496    @Description(shortDefinition="Order(s) that caused this study to be performed", formalDefinition="A list of the diagnostic orders that resulted in this imaging study being performed." )
1497    protected List<Reference> order;
1498    /**
1499     * The actual objects that are the target of the reference (A list of the diagnostic orders that resulted in this imaging study being performed.)
1500     */
1501    protected List<DiagnosticOrder> orderTarget;
1502
1503
1504    /**
1505     * The requesting/referring physician.
1506     */
1507    @Child(name = "referrer", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=true)
1508    @Description(shortDefinition="Referring physician (0008,0090)", formalDefinition="The requesting/referring physician." )
1509    protected Reference referrer;
1510
1511    /**
1512     * The actual object that is the target of the reference (The requesting/referring physician.)
1513     */
1514    protected Practitioner referrerTarget;
1515
1516    /**
1517     * Who read the study and interpreted the images or other content.
1518     */
1519    @Child(name = "interpreter", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=true)
1520    @Description(shortDefinition="Who interpreted images", formalDefinition="Who read the study and interpreted the images or other content." )
1521    protected Reference interpreter;
1522
1523    /**
1524     * The actual object that is the target of the reference (Who read the study and interpreted the images or other content.)
1525     */
1526    protected Practitioner interpreterTarget;
1527
1528    /**
1529     * WADO-RS resource where Study is available.
1530     */
1531    @Child(name = "url", type = {UriType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1532    @Description(shortDefinition="Retrieve URI", formalDefinition="WADO-RS resource where Study is available." )
1533    protected UriType url;
1534
1535    /**
1536     * Number of Series in Study.
1537     */
1538    @Child(name = "numberOfSeries", type = {UnsignedIntType.class}, order=11, min=1, max=1, modifier=false, summary=true)
1539    @Description(shortDefinition="Number of Study Related Series", formalDefinition="Number of Series in Study." )
1540    protected UnsignedIntType numberOfSeries;
1541
1542    /**
1543     * Number of SOP Instances in Study.
1544     */
1545    @Child(name = "numberOfInstances", type = {UnsignedIntType.class}, order=12, min=1, max=1, modifier=false, summary=true)
1546    @Description(shortDefinition="Number of Study Related Instances", formalDefinition="Number of SOP Instances in Study." )
1547    protected UnsignedIntType numberOfInstances;
1548
1549    /**
1550     * Type of procedure performed.
1551     */
1552    @Child(name = "procedure", type = {Procedure.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1553    @Description(shortDefinition="Type of procedure performed", formalDefinition="Type of procedure performed." )
1554    protected List<Reference> procedure;
1555    /**
1556     * The actual objects that are the target of the reference (Type of procedure performed.)
1557     */
1558    protected List<Procedure> procedureTarget;
1559
1560
1561    /**
1562     * Institution-generated description or classification of the Study performed.
1563     */
1564    @Child(name = "description", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=true)
1565    @Description(shortDefinition="Institution-generated description", formalDefinition="Institution-generated description or classification of the Study performed." )
1566    protected StringType description;
1567
1568    /**
1569     * Each study has one or more series of images or other content.
1570     */
1571    @Child(name = "series", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1572    @Description(shortDefinition="Each study has one or more series of instances", formalDefinition="Each study has one or more series of images or other content." )
1573    protected List<ImagingStudySeriesComponent> series;
1574
1575    private static final long serialVersionUID = 1998463596L;
1576
1577  /**
1578   * Constructor
1579   */
1580    public ImagingStudy() {
1581      super();
1582    }
1583
1584  /**
1585   * Constructor
1586   */
1587    public ImagingStudy(OidType uid, Reference patient, UnsignedIntType numberOfSeries, UnsignedIntType numberOfInstances) {
1588      super();
1589      this.uid = uid;
1590      this.patient = patient;
1591      this.numberOfSeries = numberOfSeries;
1592      this.numberOfInstances = numberOfInstances;
1593    }
1594
1595    /**
1596     * @return {@link #uid} (Formal identifier for the study.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1597     */
1598    public OidType getUidElement() { 
1599      if (this.uid == null)
1600        if (Configuration.errorOnAutoCreate())
1601          throw new Error("Attempt to auto-create ImagingStudy.uid");
1602        else if (Configuration.doAutoCreate())
1603          this.uid = new OidType(); // bb
1604      return this.uid;
1605    }
1606
1607    public boolean hasUidElement() { 
1608      return this.uid != null && !this.uid.isEmpty();
1609    }
1610
1611    public boolean hasUid() { 
1612      return this.uid != null && !this.uid.isEmpty();
1613    }
1614
1615    /**
1616     * @param value {@link #uid} (Formal identifier for the study.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1617     */
1618    public ImagingStudy setUidElement(OidType value) { 
1619      this.uid = value;
1620      return this;
1621    }
1622
1623    /**
1624     * @return Formal identifier for the study.
1625     */
1626    public String getUid() { 
1627      return this.uid == null ? null : this.uid.getValue();
1628    }
1629
1630    /**
1631     * @param value Formal identifier for the study.
1632     */
1633    public ImagingStudy setUid(String value) { 
1634        if (this.uid == null)
1635          this.uid = new OidType();
1636        this.uid.setValue(value);
1637      return this;
1638    }
1639
1640    /**
1641     * @return {@link #accession} (Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf).)
1642     */
1643    public Identifier getAccession() { 
1644      if (this.accession == null)
1645        if (Configuration.errorOnAutoCreate())
1646          throw new Error("Attempt to auto-create ImagingStudy.accession");
1647        else if (Configuration.doAutoCreate())
1648          this.accession = new Identifier(); // cc
1649      return this.accession;
1650    }
1651
1652    public boolean hasAccession() { 
1653      return this.accession != null && !this.accession.isEmpty();
1654    }
1655
1656    /**
1657     * @param value {@link #accession} (Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf).)
1658     */
1659    public ImagingStudy setAccession(Identifier value) { 
1660      this.accession = value;
1661      return this;
1662    }
1663
1664    /**
1665     * @return {@link #identifier} (Other identifiers for the study.)
1666     */
1667    public List<Identifier> getIdentifier() { 
1668      if (this.identifier == null)
1669        this.identifier = new ArrayList<Identifier>();
1670      return this.identifier;
1671    }
1672
1673    public boolean hasIdentifier() { 
1674      if (this.identifier == null)
1675        return false;
1676      for (Identifier item : this.identifier)
1677        if (!item.isEmpty())
1678          return true;
1679      return false;
1680    }
1681
1682    /**
1683     * @return {@link #identifier} (Other identifiers for the study.)
1684     */
1685    // syntactic sugar
1686    public Identifier addIdentifier() { //3
1687      Identifier t = new Identifier();
1688      if (this.identifier == null)
1689        this.identifier = new ArrayList<Identifier>();
1690      this.identifier.add(t);
1691      return t;
1692    }
1693
1694    // syntactic sugar
1695    public ImagingStudy addIdentifier(Identifier t) { //3
1696      if (t == null)
1697        return this;
1698      if (this.identifier == null)
1699        this.identifier = new ArrayList<Identifier>();
1700      this.identifier.add(t);
1701      return this;
1702    }
1703
1704    /**
1705     * @return {@link #availability} (Availability of study (online, offline or nearline).). This is the underlying object with id, value and extensions. The accessor "getAvailability" gives direct access to the value
1706     */
1707    public Enumeration<InstanceAvailability> getAvailabilityElement() { 
1708      if (this.availability == null)
1709        if (Configuration.errorOnAutoCreate())
1710          throw new Error("Attempt to auto-create ImagingStudy.availability");
1711        else if (Configuration.doAutoCreate())
1712          this.availability = new Enumeration<InstanceAvailability>(new InstanceAvailabilityEnumFactory()); // bb
1713      return this.availability;
1714    }
1715
1716    public boolean hasAvailabilityElement() { 
1717      return this.availability != null && !this.availability.isEmpty();
1718    }
1719
1720    public boolean hasAvailability() { 
1721      return this.availability != null && !this.availability.isEmpty();
1722    }
1723
1724    /**
1725     * @param value {@link #availability} (Availability of study (online, offline or nearline).). This is the underlying object with id, value and extensions. The accessor "getAvailability" gives direct access to the value
1726     */
1727    public ImagingStudy setAvailabilityElement(Enumeration<InstanceAvailability> value) { 
1728      this.availability = value;
1729      return this;
1730    }
1731
1732    /**
1733     * @return Availability of study (online, offline or nearline).
1734     */
1735    public InstanceAvailability getAvailability() { 
1736      return this.availability == null ? null : this.availability.getValue();
1737    }
1738
1739    /**
1740     * @param value Availability of study (online, offline or nearline).
1741     */
1742    public ImagingStudy setAvailability(InstanceAvailability value) { 
1743      if (value == null)
1744        this.availability = null;
1745      else {
1746        if (this.availability == null)
1747          this.availability = new Enumeration<InstanceAvailability>(new InstanceAvailabilityEnumFactory());
1748        this.availability.setValue(value);
1749      }
1750      return this;
1751    }
1752
1753    /**
1754     * @return {@link #modalityList} (A list of all the Series.ImageModality 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).)
1755     */
1756    public List<Coding> getModalityList() { 
1757      if (this.modalityList == null)
1758        this.modalityList = new ArrayList<Coding>();
1759      return this.modalityList;
1760    }
1761
1762    public boolean hasModalityList() { 
1763      if (this.modalityList == null)
1764        return false;
1765      for (Coding item : this.modalityList)
1766        if (!item.isEmpty())
1767          return true;
1768      return false;
1769    }
1770
1771    /**
1772     * @return {@link #modalityList} (A list of all the Series.ImageModality 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).)
1773     */
1774    // syntactic sugar
1775    public Coding addModalityList() { //3
1776      Coding t = new Coding();
1777      if (this.modalityList == null)
1778        this.modalityList = new ArrayList<Coding>();
1779      this.modalityList.add(t);
1780      return t;
1781    }
1782
1783    // syntactic sugar
1784    public ImagingStudy addModalityList(Coding t) { //3
1785      if (t == null)
1786        return this;
1787      if (this.modalityList == null)
1788        this.modalityList = new ArrayList<Coding>();
1789      this.modalityList.add(t);
1790      return this;
1791    }
1792
1793    /**
1794     * @return {@link #patient} (The patient imaged in the study.)
1795     */
1796    public Reference getPatient() { 
1797      if (this.patient == null)
1798        if (Configuration.errorOnAutoCreate())
1799          throw new Error("Attempt to auto-create ImagingStudy.patient");
1800        else if (Configuration.doAutoCreate())
1801          this.patient = new Reference(); // cc
1802      return this.patient;
1803    }
1804
1805    public boolean hasPatient() { 
1806      return this.patient != null && !this.patient.isEmpty();
1807    }
1808
1809    /**
1810     * @param value {@link #patient} (The patient imaged in the study.)
1811     */
1812    public ImagingStudy setPatient(Reference value) { 
1813      this.patient = value;
1814      return this;
1815    }
1816
1817    /**
1818     * @return {@link #patient} 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 patient imaged in the study.)
1819     */
1820    public Patient getPatientTarget() { 
1821      if (this.patientTarget == null)
1822        if (Configuration.errorOnAutoCreate())
1823          throw new Error("Attempt to auto-create ImagingStudy.patient");
1824        else if (Configuration.doAutoCreate())
1825          this.patientTarget = new Patient(); // aa
1826      return this.patientTarget;
1827    }
1828
1829    /**
1830     * @param value {@link #patient} 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 patient imaged in the study.)
1831     */
1832    public ImagingStudy setPatientTarget(Patient value) { 
1833      this.patientTarget = value;
1834      return this;
1835    }
1836
1837    /**
1838     * @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
1839     */
1840    public DateTimeType getStartedElement() { 
1841      if (this.started == null)
1842        if (Configuration.errorOnAutoCreate())
1843          throw new Error("Attempt to auto-create ImagingStudy.started");
1844        else if (Configuration.doAutoCreate())
1845          this.started = new DateTimeType(); // bb
1846      return this.started;
1847    }
1848
1849    public boolean hasStartedElement() { 
1850      return this.started != null && !this.started.isEmpty();
1851    }
1852
1853    public boolean hasStarted() { 
1854      return this.started != null && !this.started.isEmpty();
1855    }
1856
1857    /**
1858     * @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
1859     */
1860    public ImagingStudy setStartedElement(DateTimeType value) { 
1861      this.started = value;
1862      return this;
1863    }
1864
1865    /**
1866     * @return Date and Time the study started.
1867     */
1868    public Date getStarted() { 
1869      return this.started == null ? null : this.started.getValue();
1870    }
1871
1872    /**
1873     * @param value Date and Time the study started.
1874     */
1875    public ImagingStudy setStarted(Date value) { 
1876      if (value == null)
1877        this.started = null;
1878      else {
1879        if (this.started == null)
1880          this.started = new DateTimeType();
1881        this.started.setValue(value);
1882      }
1883      return this;
1884    }
1885
1886    /**
1887     * @return {@link #order} (A list of the diagnostic orders that resulted in this imaging study being performed.)
1888     */
1889    public List<Reference> getOrder() { 
1890      if (this.order == null)
1891        this.order = new ArrayList<Reference>();
1892      return this.order;
1893    }
1894
1895    public boolean hasOrder() { 
1896      if (this.order == null)
1897        return false;
1898      for (Reference item : this.order)
1899        if (!item.isEmpty())
1900          return true;
1901      return false;
1902    }
1903
1904    /**
1905     * @return {@link #order} (A list of the diagnostic orders that resulted in this imaging study being performed.)
1906     */
1907    // syntactic sugar
1908    public Reference addOrder() { //3
1909      Reference t = new Reference();
1910      if (this.order == null)
1911        this.order = new ArrayList<Reference>();
1912      this.order.add(t);
1913      return t;
1914    }
1915
1916    // syntactic sugar
1917    public ImagingStudy addOrder(Reference t) { //3
1918      if (t == null)
1919        return this;
1920      if (this.order == null)
1921        this.order = new ArrayList<Reference>();
1922      this.order.add(t);
1923      return this;
1924    }
1925
1926    /**
1927     * @return {@link #order} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A list of the diagnostic orders that resulted in this imaging study being performed.)
1928     */
1929    public List<DiagnosticOrder> getOrderTarget() { 
1930      if (this.orderTarget == null)
1931        this.orderTarget = new ArrayList<DiagnosticOrder>();
1932      return this.orderTarget;
1933    }
1934
1935    // syntactic sugar
1936    /**
1937     * @return {@link #order} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. A list of the diagnostic orders that resulted in this imaging study being performed.)
1938     */
1939    public DiagnosticOrder addOrderTarget() { 
1940      DiagnosticOrder r = new DiagnosticOrder();
1941      if (this.orderTarget == null)
1942        this.orderTarget = new ArrayList<DiagnosticOrder>();
1943      this.orderTarget.add(r);
1944      return r;
1945    }
1946
1947    /**
1948     * @return {@link #referrer} (The requesting/referring physician.)
1949     */
1950    public Reference getReferrer() { 
1951      if (this.referrer == null)
1952        if (Configuration.errorOnAutoCreate())
1953          throw new Error("Attempt to auto-create ImagingStudy.referrer");
1954        else if (Configuration.doAutoCreate())
1955          this.referrer = new Reference(); // cc
1956      return this.referrer;
1957    }
1958
1959    public boolean hasReferrer() { 
1960      return this.referrer != null && !this.referrer.isEmpty();
1961    }
1962
1963    /**
1964     * @param value {@link #referrer} (The requesting/referring physician.)
1965     */
1966    public ImagingStudy setReferrer(Reference value) { 
1967      this.referrer = value;
1968      return this;
1969    }
1970
1971    /**
1972     * @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.)
1973     */
1974    public Practitioner getReferrerTarget() { 
1975      if (this.referrerTarget == null)
1976        if (Configuration.errorOnAutoCreate())
1977          throw new Error("Attempt to auto-create ImagingStudy.referrer");
1978        else if (Configuration.doAutoCreate())
1979          this.referrerTarget = new Practitioner(); // aa
1980      return this.referrerTarget;
1981    }
1982
1983    /**
1984     * @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.)
1985     */
1986    public ImagingStudy setReferrerTarget(Practitioner value) { 
1987      this.referrerTarget = value;
1988      return this;
1989    }
1990
1991    /**
1992     * @return {@link #interpreter} (Who read the study and interpreted the images or other content.)
1993     */
1994    public Reference getInterpreter() { 
1995      if (this.interpreter == null)
1996        if (Configuration.errorOnAutoCreate())
1997          throw new Error("Attempt to auto-create ImagingStudy.interpreter");
1998        else if (Configuration.doAutoCreate())
1999          this.interpreter = new Reference(); // cc
2000      return this.interpreter;
2001    }
2002
2003    public boolean hasInterpreter() { 
2004      return this.interpreter != null && !this.interpreter.isEmpty();
2005    }
2006
2007    /**
2008     * @param value {@link #interpreter} (Who read the study and interpreted the images or other content.)
2009     */
2010    public ImagingStudy setInterpreter(Reference value) { 
2011      this.interpreter = value;
2012      return this;
2013    }
2014
2015    /**
2016     * @return {@link #interpreter} 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. (Who read the study and interpreted the images or other content.)
2017     */
2018    public Practitioner getInterpreterTarget() { 
2019      if (this.interpreterTarget == null)
2020        if (Configuration.errorOnAutoCreate())
2021          throw new Error("Attempt to auto-create ImagingStudy.interpreter");
2022        else if (Configuration.doAutoCreate())
2023          this.interpreterTarget = new Practitioner(); // aa
2024      return this.interpreterTarget;
2025    }
2026
2027    /**
2028     * @param value {@link #interpreter} 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. (Who read the study and interpreted the images or other content.)
2029     */
2030    public ImagingStudy setInterpreterTarget(Practitioner value) { 
2031      this.interpreterTarget = value;
2032      return this;
2033    }
2034
2035    /**
2036     * @return {@link #url} (WADO-RS resource where Study is available.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2037     */
2038    public UriType getUrlElement() { 
2039      if (this.url == null)
2040        if (Configuration.errorOnAutoCreate())
2041          throw new Error("Attempt to auto-create ImagingStudy.url");
2042        else if (Configuration.doAutoCreate())
2043          this.url = new UriType(); // bb
2044      return this.url;
2045    }
2046
2047    public boolean hasUrlElement() { 
2048      return this.url != null && !this.url.isEmpty();
2049    }
2050
2051    public boolean hasUrl() { 
2052      return this.url != null && !this.url.isEmpty();
2053    }
2054
2055    /**
2056     * @param value {@link #url} (WADO-RS resource where Study is available.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2057     */
2058    public ImagingStudy setUrlElement(UriType value) { 
2059      this.url = value;
2060      return this;
2061    }
2062
2063    /**
2064     * @return WADO-RS resource where Study is available.
2065     */
2066    public String getUrl() { 
2067      return this.url == null ? null : this.url.getValue();
2068    }
2069
2070    /**
2071     * @param value WADO-RS resource where Study is available.
2072     */
2073    public ImagingStudy setUrl(String value) { 
2074      if (Utilities.noString(value))
2075        this.url = null;
2076      else {
2077        if (this.url == null)
2078          this.url = new UriType();
2079        this.url.setValue(value);
2080      }
2081      return this;
2082    }
2083
2084    /**
2085     * @return {@link #numberOfSeries} (Number of Series in Study.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSeries" gives direct access to the value
2086     */
2087    public UnsignedIntType getNumberOfSeriesElement() { 
2088      if (this.numberOfSeries == null)
2089        if (Configuration.errorOnAutoCreate())
2090          throw new Error("Attempt to auto-create ImagingStudy.numberOfSeries");
2091        else if (Configuration.doAutoCreate())
2092          this.numberOfSeries = new UnsignedIntType(); // bb
2093      return this.numberOfSeries;
2094    }
2095
2096    public boolean hasNumberOfSeriesElement() { 
2097      return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2098    }
2099
2100    public boolean hasNumberOfSeries() { 
2101      return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2102    }
2103
2104    /**
2105     * @param value {@link #numberOfSeries} (Number of Series in Study.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSeries" gives direct access to the value
2106     */
2107    public ImagingStudy setNumberOfSeriesElement(UnsignedIntType value) { 
2108      this.numberOfSeries = value;
2109      return this;
2110    }
2111
2112    /**
2113     * @return Number of Series in Study.
2114     */
2115    public int getNumberOfSeries() { 
2116      return this.numberOfSeries == null || this.numberOfSeries.isEmpty() ? 0 : this.numberOfSeries.getValue();
2117    }
2118
2119    /**
2120     * @param value Number of Series in Study.
2121     */
2122    public ImagingStudy setNumberOfSeries(int value) { 
2123        if (this.numberOfSeries == null)
2124          this.numberOfSeries = new UnsignedIntType();
2125        this.numberOfSeries.setValue(value);
2126      return this;
2127    }
2128
2129    /**
2130     * @return {@link #numberOfInstances} (Number of SOP Instances in Study.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
2131     */
2132    public UnsignedIntType getNumberOfInstancesElement() { 
2133      if (this.numberOfInstances == null)
2134        if (Configuration.errorOnAutoCreate())
2135          throw new Error("Attempt to auto-create ImagingStudy.numberOfInstances");
2136        else if (Configuration.doAutoCreate())
2137          this.numberOfInstances = new UnsignedIntType(); // bb
2138      return this.numberOfInstances;
2139    }
2140
2141    public boolean hasNumberOfInstancesElement() { 
2142      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
2143    }
2144
2145    public boolean hasNumberOfInstances() { 
2146      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
2147    }
2148
2149    /**
2150     * @param value {@link #numberOfInstances} (Number of SOP Instances in Study.). This is the underlying object with id, value and extensions. The accessor "getNumberOfInstances" gives direct access to the value
2151     */
2152    public ImagingStudy setNumberOfInstancesElement(UnsignedIntType value) { 
2153      this.numberOfInstances = value;
2154      return this;
2155    }
2156
2157    /**
2158     * @return Number of SOP Instances in Study.
2159     */
2160    public int getNumberOfInstances() { 
2161      return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
2162    }
2163
2164    /**
2165     * @param value Number of SOP Instances in Study.
2166     */
2167    public ImagingStudy setNumberOfInstances(int value) { 
2168        if (this.numberOfInstances == null)
2169          this.numberOfInstances = new UnsignedIntType();
2170        this.numberOfInstances.setValue(value);
2171      return this;
2172    }
2173
2174    /**
2175     * @return {@link #procedure} (Type of procedure performed.)
2176     */
2177    public List<Reference> getProcedure() { 
2178      if (this.procedure == null)
2179        this.procedure = new ArrayList<Reference>();
2180      return this.procedure;
2181    }
2182
2183    public boolean hasProcedure() { 
2184      if (this.procedure == null)
2185        return false;
2186      for (Reference item : this.procedure)
2187        if (!item.isEmpty())
2188          return true;
2189      return false;
2190    }
2191
2192    /**
2193     * @return {@link #procedure} (Type of procedure performed.)
2194     */
2195    // syntactic sugar
2196    public Reference addProcedure() { //3
2197      Reference t = new Reference();
2198      if (this.procedure == null)
2199        this.procedure = new ArrayList<Reference>();
2200      this.procedure.add(t);
2201      return t;
2202    }
2203
2204    // syntactic sugar
2205    public ImagingStudy addProcedure(Reference t) { //3
2206      if (t == null)
2207        return this;
2208      if (this.procedure == null)
2209        this.procedure = new ArrayList<Reference>();
2210      this.procedure.add(t);
2211      return this;
2212    }
2213
2214    /**
2215     * @return {@link #procedure} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Type of procedure performed.)
2216     */
2217    public List<Procedure> getProcedureTarget() { 
2218      if (this.procedureTarget == null)
2219        this.procedureTarget = new ArrayList<Procedure>();
2220      return this.procedureTarget;
2221    }
2222
2223    // syntactic sugar
2224    /**
2225     * @return {@link #procedure} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Type of procedure performed.)
2226     */
2227    public Procedure addProcedureTarget() { 
2228      Procedure r = new Procedure();
2229      if (this.procedureTarget == null)
2230        this.procedureTarget = new ArrayList<Procedure>();
2231      this.procedureTarget.add(r);
2232      return r;
2233    }
2234
2235    /**
2236     * @return {@link #description} (Institution-generated description or classification of the Study performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2237     */
2238    public StringType getDescriptionElement() { 
2239      if (this.description == null)
2240        if (Configuration.errorOnAutoCreate())
2241          throw new Error("Attempt to auto-create ImagingStudy.description");
2242        else if (Configuration.doAutoCreate())
2243          this.description = new StringType(); // bb
2244      return this.description;
2245    }
2246
2247    public boolean hasDescriptionElement() { 
2248      return this.description != null && !this.description.isEmpty();
2249    }
2250
2251    public boolean hasDescription() { 
2252      return this.description != null && !this.description.isEmpty();
2253    }
2254
2255    /**
2256     * @param value {@link #description} (Institution-generated description or classification of the Study performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2257     */
2258    public ImagingStudy setDescriptionElement(StringType value) { 
2259      this.description = value;
2260      return this;
2261    }
2262
2263    /**
2264     * @return Institution-generated description or classification of the Study performed.
2265     */
2266    public String getDescription() { 
2267      return this.description == null ? null : this.description.getValue();
2268    }
2269
2270    /**
2271     * @param value Institution-generated description or classification of the Study performed.
2272     */
2273    public ImagingStudy setDescription(String value) { 
2274      if (Utilities.noString(value))
2275        this.description = null;
2276      else {
2277        if (this.description == null)
2278          this.description = new StringType();
2279        this.description.setValue(value);
2280      }
2281      return this;
2282    }
2283
2284    /**
2285     * @return {@link #series} (Each study has one or more series of images or other content.)
2286     */
2287    public List<ImagingStudySeriesComponent> getSeries() { 
2288      if (this.series == null)
2289        this.series = new ArrayList<ImagingStudySeriesComponent>();
2290      return this.series;
2291    }
2292
2293    public boolean hasSeries() { 
2294      if (this.series == null)
2295        return false;
2296      for (ImagingStudySeriesComponent item : this.series)
2297        if (!item.isEmpty())
2298          return true;
2299      return false;
2300    }
2301
2302    /**
2303     * @return {@link #series} (Each study has one or more series of images or other content.)
2304     */
2305    // syntactic sugar
2306    public ImagingStudySeriesComponent addSeries() { //3
2307      ImagingStudySeriesComponent t = new ImagingStudySeriesComponent();
2308      if (this.series == null)
2309        this.series = new ArrayList<ImagingStudySeriesComponent>();
2310      this.series.add(t);
2311      return t;
2312    }
2313
2314    // syntactic sugar
2315    public ImagingStudy addSeries(ImagingStudySeriesComponent t) { //3
2316      if (t == null)
2317        return this;
2318      if (this.series == null)
2319        this.series = new ArrayList<ImagingStudySeriesComponent>();
2320      this.series.add(t);
2321      return this;
2322    }
2323
2324      protected void listChildren(List<Property> childrenList) {
2325        super.listChildren(childrenList);
2326        childrenList.add(new Property("uid", "oid", "Formal identifier for the study.", 0, java.lang.Integer.MAX_VALUE, uid));
2327        childrenList.add(new Property("accession", "Identifier", "Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf).", 0, java.lang.Integer.MAX_VALUE, accession));
2328        childrenList.add(new Property("identifier", "Identifier", "Other identifiers for the study.", 0, java.lang.Integer.MAX_VALUE, identifier));
2329        childrenList.add(new Property("availability", "code", "Availability of study (online, offline or nearline).", 0, java.lang.Integer.MAX_VALUE, availability));
2330        childrenList.add(new Property("modalityList", "Coding", "A list of all the Series.ImageModality 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, modalityList));
2331        childrenList.add(new Property("patient", "Reference(Patient)", "The patient imaged in the study.", 0, java.lang.Integer.MAX_VALUE, patient));
2332        childrenList.add(new Property("started", "dateTime", "Date and Time the study started.", 0, java.lang.Integer.MAX_VALUE, started));
2333        childrenList.add(new Property("order", "Reference(DiagnosticOrder)", "A list of the diagnostic orders that resulted in this imaging study being performed.", 0, java.lang.Integer.MAX_VALUE, order));
2334        childrenList.add(new Property("referrer", "Reference(Practitioner)", "The requesting/referring physician.", 0, java.lang.Integer.MAX_VALUE, referrer));
2335        childrenList.add(new Property("interpreter", "Reference(Practitioner)", "Who read the study and interpreted the images or other content.", 0, java.lang.Integer.MAX_VALUE, interpreter));
2336        childrenList.add(new Property("url", "uri", "WADO-RS resource where Study is available.", 0, java.lang.Integer.MAX_VALUE, url));
2337        childrenList.add(new Property("numberOfSeries", "unsignedInt", "Number of Series in Study.", 0, java.lang.Integer.MAX_VALUE, numberOfSeries));
2338        childrenList.add(new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in Study.", 0, java.lang.Integer.MAX_VALUE, numberOfInstances));
2339        childrenList.add(new Property("procedure", "Reference(Procedure)", "Type of procedure performed.", 0, java.lang.Integer.MAX_VALUE, procedure));
2340        childrenList.add(new Property("description", "string", "Institution-generated description or classification of the Study performed.", 0, java.lang.Integer.MAX_VALUE, description));
2341        childrenList.add(new Property("series", "", "Each study has one or more series of images or other content.", 0, java.lang.Integer.MAX_VALUE, series));
2342      }
2343
2344      @Override
2345      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2346        switch (hash) {
2347        case 115792: /*uid*/ return this.uid == null ? new Base[0] : new Base[] {this.uid}; // OidType
2348        case -2115028956: /*accession*/ return this.accession == null ? new Base[0] : new Base[] {this.accession}; // Identifier
2349        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2350        case 1997542747: /*availability*/ return this.availability == null ? new Base[0] : new Base[] {this.availability}; // Enumeration<InstanceAvailability>
2351        case -1030238433: /*modalityList*/ return this.modalityList == null ? new Base[0] : this.modalityList.toArray(new Base[this.modalityList.size()]); // Coding
2352        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2353        case -1897185151: /*started*/ return this.started == null ? new Base[0] : new Base[] {this.started}; // DateTimeType
2354        case 106006350: /*order*/ return this.order == null ? new Base[0] : this.order.toArray(new Base[this.order.size()]); // Reference
2355        case -722568161: /*referrer*/ return this.referrer == null ? new Base[0] : new Base[] {this.referrer}; // Reference
2356        case -2008009094: /*interpreter*/ return this.interpreter == null ? new Base[0] : new Base[] {this.interpreter}; // Reference
2357        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
2358        case 1920000407: /*numberOfSeries*/ return this.numberOfSeries == null ? new Base[0] : new Base[] {this.numberOfSeries}; // UnsignedIntType
2359        case -1043544226: /*numberOfInstances*/ return this.numberOfInstances == null ? new Base[0] : new Base[] {this.numberOfInstances}; // UnsignedIntType
2360        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // Reference
2361        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2362        case -905838985: /*series*/ return this.series == null ? new Base[0] : this.series.toArray(new Base[this.series.size()]); // ImagingStudySeriesComponent
2363        default: return super.getProperty(hash, name, checkValid);
2364        }
2365
2366      }
2367
2368      @Override
2369      public void setProperty(int hash, String name, Base value) throws FHIRException {
2370        switch (hash) {
2371        case 115792: // uid
2372          this.uid = castToOid(value); // OidType
2373          break;
2374        case -2115028956: // accession
2375          this.accession = castToIdentifier(value); // Identifier
2376          break;
2377        case -1618432855: // identifier
2378          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2379          break;
2380        case 1997542747: // availability
2381          this.availability = new InstanceAvailabilityEnumFactory().fromType(value); // Enumeration<InstanceAvailability>
2382          break;
2383        case -1030238433: // modalityList
2384          this.getModalityList().add(castToCoding(value)); // Coding
2385          break;
2386        case -791418107: // patient
2387          this.patient = castToReference(value); // Reference
2388          break;
2389        case -1897185151: // started
2390          this.started = castToDateTime(value); // DateTimeType
2391          break;
2392        case 106006350: // order
2393          this.getOrder().add(castToReference(value)); // Reference
2394          break;
2395        case -722568161: // referrer
2396          this.referrer = castToReference(value); // Reference
2397          break;
2398        case -2008009094: // interpreter
2399          this.interpreter = castToReference(value); // Reference
2400          break;
2401        case 116079: // url
2402          this.url = castToUri(value); // UriType
2403          break;
2404        case 1920000407: // numberOfSeries
2405          this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
2406          break;
2407        case -1043544226: // numberOfInstances
2408          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
2409          break;
2410        case -1095204141: // procedure
2411          this.getProcedure().add(castToReference(value)); // Reference
2412          break;
2413        case -1724546052: // description
2414          this.description = castToString(value); // StringType
2415          break;
2416        case -905838985: // series
2417          this.getSeries().add((ImagingStudySeriesComponent) value); // ImagingStudySeriesComponent
2418          break;
2419        default: super.setProperty(hash, name, value);
2420        }
2421
2422      }
2423
2424      @Override
2425      public void setProperty(String name, Base value) throws FHIRException {
2426        if (name.equals("uid"))
2427          this.uid = castToOid(value); // OidType
2428        else if (name.equals("accession"))
2429          this.accession = castToIdentifier(value); // Identifier
2430        else if (name.equals("identifier"))
2431          this.getIdentifier().add(castToIdentifier(value));
2432        else if (name.equals("availability"))
2433          this.availability = new InstanceAvailabilityEnumFactory().fromType(value); // Enumeration<InstanceAvailability>
2434        else if (name.equals("modalityList"))
2435          this.getModalityList().add(castToCoding(value));
2436        else if (name.equals("patient"))
2437          this.patient = castToReference(value); // Reference
2438        else if (name.equals("started"))
2439          this.started = castToDateTime(value); // DateTimeType
2440        else if (name.equals("order"))
2441          this.getOrder().add(castToReference(value));
2442        else if (name.equals("referrer"))
2443          this.referrer = castToReference(value); // Reference
2444        else if (name.equals("interpreter"))
2445          this.interpreter = castToReference(value); // Reference
2446        else if (name.equals("url"))
2447          this.url = castToUri(value); // UriType
2448        else if (name.equals("numberOfSeries"))
2449          this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
2450        else if (name.equals("numberOfInstances"))
2451          this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
2452        else if (name.equals("procedure"))
2453          this.getProcedure().add(castToReference(value));
2454        else if (name.equals("description"))
2455          this.description = castToString(value); // StringType
2456        else if (name.equals("series"))
2457          this.getSeries().add((ImagingStudySeriesComponent) value);
2458        else
2459          super.setProperty(name, value);
2460      }
2461
2462      @Override
2463      public Base makeProperty(int hash, String name) throws FHIRException {
2464        switch (hash) {
2465        case 115792: throw new FHIRException("Cannot make property uid as it is not a complex type"); // OidType
2466        case -2115028956:  return getAccession(); // Identifier
2467        case -1618432855:  return addIdentifier(); // Identifier
2468        case 1997542747: throw new FHIRException("Cannot make property availability as it is not a complex type"); // Enumeration<InstanceAvailability>
2469        case -1030238433:  return addModalityList(); // Coding
2470        case -791418107:  return getPatient(); // Reference
2471        case -1897185151: throw new FHIRException("Cannot make property started as it is not a complex type"); // DateTimeType
2472        case 106006350:  return addOrder(); // Reference
2473        case -722568161:  return getReferrer(); // Reference
2474        case -2008009094:  return getInterpreter(); // Reference
2475        case 116079: throw new FHIRException("Cannot make property url as it is not a complex type"); // UriType
2476        case 1920000407: throw new FHIRException("Cannot make property numberOfSeries as it is not a complex type"); // UnsignedIntType
2477        case -1043544226: throw new FHIRException("Cannot make property numberOfInstances as it is not a complex type"); // UnsignedIntType
2478        case -1095204141:  return addProcedure(); // Reference
2479        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
2480        case -905838985:  return addSeries(); // ImagingStudySeriesComponent
2481        default: return super.makeProperty(hash, name);
2482        }
2483
2484      }
2485
2486      @Override
2487      public Base addChild(String name) throws FHIRException {
2488        if (name.equals("uid")) {
2489          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.uid");
2490        }
2491        else if (name.equals("accession")) {
2492          this.accession = new Identifier();
2493          return this.accession;
2494        }
2495        else if (name.equals("identifier")) {
2496          return addIdentifier();
2497        }
2498        else if (name.equals("availability")) {
2499          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.availability");
2500        }
2501        else if (name.equals("modalityList")) {
2502          return addModalityList();
2503        }
2504        else if (name.equals("patient")) {
2505          this.patient = new Reference();
2506          return this.patient;
2507        }
2508        else if (name.equals("started")) {
2509          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.started");
2510        }
2511        else if (name.equals("order")) {
2512          return addOrder();
2513        }
2514        else if (name.equals("referrer")) {
2515          this.referrer = new Reference();
2516          return this.referrer;
2517        }
2518        else if (name.equals("interpreter")) {
2519          this.interpreter = new Reference();
2520          return this.interpreter;
2521        }
2522        else if (name.equals("url")) {
2523          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.url");
2524        }
2525        else if (name.equals("numberOfSeries")) {
2526          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfSeries");
2527        }
2528        else if (name.equals("numberOfInstances")) {
2529          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.numberOfInstances");
2530        }
2531        else if (name.equals("procedure")) {
2532          return addProcedure();
2533        }
2534        else if (name.equals("description")) {
2535          throw new FHIRException("Cannot call addChild on a primitive type ImagingStudy.description");
2536        }
2537        else if (name.equals("series")) {
2538          return addSeries();
2539        }
2540        else
2541          return super.addChild(name);
2542      }
2543
2544  public String fhirType() {
2545    return "ImagingStudy";
2546
2547  }
2548
2549      public ImagingStudy copy() {
2550        ImagingStudy dst = new ImagingStudy();
2551        copyValues(dst);
2552        dst.uid = uid == null ? null : uid.copy();
2553        dst.accession = accession == null ? null : accession.copy();
2554        if (identifier != null) {
2555          dst.identifier = new ArrayList<Identifier>();
2556          for (Identifier i : identifier)
2557            dst.identifier.add(i.copy());
2558        };
2559        dst.availability = availability == null ? null : availability.copy();
2560        if (modalityList != null) {
2561          dst.modalityList = new ArrayList<Coding>();
2562          for (Coding i : modalityList)
2563            dst.modalityList.add(i.copy());
2564        };
2565        dst.patient = patient == null ? null : patient.copy();
2566        dst.started = started == null ? null : started.copy();
2567        if (order != null) {
2568          dst.order = new ArrayList<Reference>();
2569          for (Reference i : order)
2570            dst.order.add(i.copy());
2571        };
2572        dst.referrer = referrer == null ? null : referrer.copy();
2573        dst.interpreter = interpreter == null ? null : interpreter.copy();
2574        dst.url = url == null ? null : url.copy();
2575        dst.numberOfSeries = numberOfSeries == null ? null : numberOfSeries.copy();
2576        dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
2577        if (procedure != null) {
2578          dst.procedure = new ArrayList<Reference>();
2579          for (Reference i : procedure)
2580            dst.procedure.add(i.copy());
2581        };
2582        dst.description = description == null ? null : description.copy();
2583        if (series != null) {
2584          dst.series = new ArrayList<ImagingStudySeriesComponent>();
2585          for (ImagingStudySeriesComponent i : series)
2586            dst.series.add(i.copy());
2587        };
2588        return dst;
2589      }
2590
2591      protected ImagingStudy typedCopy() {
2592        return copy();
2593      }
2594
2595      @Override
2596      public boolean equalsDeep(Base other) {
2597        if (!super.equalsDeep(other))
2598          return false;
2599        if (!(other instanceof ImagingStudy))
2600          return false;
2601        ImagingStudy o = (ImagingStudy) other;
2602        return compareDeep(uid, o.uid, true) && compareDeep(accession, o.accession, true) && compareDeep(identifier, o.identifier, true)
2603           && compareDeep(availability, o.availability, true) && compareDeep(modalityList, o.modalityList, true)
2604           && compareDeep(patient, o.patient, true) && compareDeep(started, o.started, true) && compareDeep(order, o.order, true)
2605           && compareDeep(referrer, o.referrer, true) && compareDeep(interpreter, o.interpreter, true) && compareDeep(url, o.url, true)
2606           && compareDeep(numberOfSeries, o.numberOfSeries, true) && compareDeep(numberOfInstances, o.numberOfInstances, true)
2607           && compareDeep(procedure, o.procedure, true) && compareDeep(description, o.description, true) && compareDeep(series, o.series, true)
2608          ;
2609      }
2610
2611      @Override
2612      public boolean equalsShallow(Base other) {
2613        if (!super.equalsShallow(other))
2614          return false;
2615        if (!(other instanceof ImagingStudy))
2616          return false;
2617        ImagingStudy o = (ImagingStudy) other;
2618        return compareValues(uid, o.uid, true) && compareValues(availability, o.availability, true) && compareValues(started, o.started, true)
2619           && compareValues(url, o.url, true) && compareValues(numberOfSeries, o.numberOfSeries, true) && compareValues(numberOfInstances, o.numberOfInstances, true)
2620           && compareValues(description, o.description, true);
2621      }
2622
2623      public boolean isEmpty() {
2624        return super.isEmpty() && (uid == null || uid.isEmpty()) && (accession == null || accession.isEmpty())
2625           && (identifier == null || identifier.isEmpty()) && (availability == null || availability.isEmpty())
2626           && (modalityList == null || modalityList.isEmpty()) && (patient == null || patient.isEmpty())
2627           && (started == null || started.isEmpty()) && (order == null || order.isEmpty()) && (referrer == null || referrer.isEmpty())
2628           && (interpreter == null || interpreter.isEmpty()) && (url == null || url.isEmpty()) && (numberOfSeries == null || numberOfSeries.isEmpty())
2629           && (numberOfInstances == null || numberOfInstances.isEmpty()) && (procedure == null || procedure.isEmpty())
2630           && (description == null || description.isEmpty()) && (series == null || series.isEmpty())
2631          ;
2632      }
2633
2634  @Override
2635  public ResourceType getResourceType() {
2636    return ResourceType.ImagingStudy;
2637   }
2638
2639 /**
2640   * Search parameter: <b>uid</b>
2641   * <p>
2642   * Description: <b>The instance unique identifier</b><br>
2643   * Type: <b>uri</b><br>
2644   * Path: <b>ImagingStudy.series.instance.uid</b><br>
2645   * </p>
2646   */
2647  @SearchParamDefinition(name="uid", path="ImagingStudy.series.instance.uid", description="The instance unique identifier", type="uri" )
2648  public static final String SP_UID = "uid";
2649 /**
2650   * <b>Fluent Client</b> search parameter constant for <b>uid</b>
2651   * <p>
2652   * Description: <b>The instance unique identifier</b><br>
2653   * Type: <b>uri</b><br>
2654   * Path: <b>ImagingStudy.series.instance.uid</b><br>
2655   * </p>
2656   */
2657  public static final ca.uhn.fhir.rest.gclient.UriClientParam UID = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_UID);
2658
2659 /**
2660   * Search parameter: <b>series</b>
2661   * <p>
2662   * Description: <b>The identifier of the series of images</b><br>
2663   * Type: <b>uri</b><br>
2664   * Path: <b>ImagingStudy.series.uid</b><br>
2665   * </p>
2666   */
2667  @SearchParamDefinition(name="series", path="ImagingStudy.series.uid", description="The identifier of the series of images", type="uri" )
2668  public static final String SP_SERIES = "series";
2669 /**
2670   * <b>Fluent Client</b> search parameter constant for <b>series</b>
2671   * <p>
2672   * Description: <b>The identifier of the series of images</b><br>
2673   * Type: <b>uri</b><br>
2674   * Path: <b>ImagingStudy.series.uid</b><br>
2675   * </p>
2676   */
2677  public static final ca.uhn.fhir.rest.gclient.UriClientParam SERIES = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_SERIES);
2678
2679 /**
2680   * Search parameter: <b>patient</b>
2681   * <p>
2682   * Description: <b>Who the study is about</b><br>
2683   * Type: <b>reference</b><br>
2684   * Path: <b>ImagingStudy.patient</b><br>
2685   * </p>
2686   */
2687  @SearchParamDefinition(name="patient", path="ImagingStudy.patient", description="Who the study is about", type="reference" )
2688  public static final String SP_PATIENT = "patient";
2689 /**
2690   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2691   * <p>
2692   * Description: <b>Who the study is about</b><br>
2693   * Type: <b>reference</b><br>
2694   * Path: <b>ImagingStudy.patient</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2698
2699/**
2700   * Constant for fluent queries to be used to add include statements. Specifies
2701   * the path value of "<b>ImagingStudy:patient</b>".
2702   */
2703  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ImagingStudy:patient").toLocked();
2704
2705 /**
2706   * Search parameter: <b>order</b>
2707   * <p>
2708   * Description: <b>The order for the image</b><br>
2709   * Type: <b>reference</b><br>
2710   * Path: <b>ImagingStudy.order</b><br>
2711   * </p>
2712   */
2713  @SearchParamDefinition(name="order", path="ImagingStudy.order", description="The order for the image", type="reference" )
2714  public static final String SP_ORDER = "order";
2715 /**
2716   * <b>Fluent Client</b> search parameter constant for <b>order</b>
2717   * <p>
2718   * Description: <b>The order for the image</b><br>
2719   * Type: <b>reference</b><br>
2720   * Path: <b>ImagingStudy.order</b><br>
2721   * </p>
2722   */
2723  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORDER);
2724
2725/**
2726   * Constant for fluent queries to be used to add include statements. Specifies
2727   * the path value of "<b>ImagingStudy:order</b>".
2728   */
2729  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORDER = new ca.uhn.fhir.model.api.Include("ImagingStudy:order").toLocked();
2730
2731 /**
2732   * Search parameter: <b>bodysite</b>
2733   * <p>
2734   * Description: <b>The body site studied</b><br>
2735   * Type: <b>token</b><br>
2736   * Path: <b>ImagingStudy.series.bodySite</b><br>
2737   * </p>
2738   */
2739  @SearchParamDefinition(name="bodysite", path="ImagingStudy.series.bodySite", description="The body site studied", type="token" )
2740  public static final String SP_BODYSITE = "bodysite";
2741 /**
2742   * <b>Fluent Client</b> search parameter constant for <b>bodysite</b>
2743   * <p>
2744   * Description: <b>The body site studied</b><br>
2745   * Type: <b>token</b><br>
2746   * Path: <b>ImagingStudy.series.bodySite</b><br>
2747   * </p>
2748   */
2749  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODYSITE);
2750
2751 /**
2752   * Search parameter: <b>accession</b>
2753   * <p>
2754   * Description: <b>The accession identifier for the study</b><br>
2755   * Type: <b>token</b><br>
2756   * Path: <b>ImagingStudy.accession</b><br>
2757   * </p>
2758   */
2759  @SearchParamDefinition(name="accession", path="ImagingStudy.accession", description="The accession identifier for the study", type="token" )
2760  public static final String SP_ACCESSION = "accession";
2761 /**
2762   * <b>Fluent Client</b> search parameter constant for <b>accession</b>
2763   * <p>
2764   * Description: <b>The accession identifier for the study</b><br>
2765   * Type: <b>token</b><br>
2766   * Path: <b>ImagingStudy.accession</b><br>
2767   * </p>
2768   */
2769  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACCESSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACCESSION);
2770
2771 /**
2772   * Search parameter: <b>study</b>
2773   * <p>
2774   * Description: <b>The study identifier for the image</b><br>
2775   * Type: <b>uri</b><br>
2776   * Path: <b>ImagingStudy.uid</b><br>
2777   * </p>
2778   */
2779  @SearchParamDefinition(name="study", path="ImagingStudy.uid", description="The study identifier for the image", type="uri" )
2780  public static final String SP_STUDY = "study";
2781 /**
2782   * <b>Fluent Client</b> search parameter constant for <b>study</b>
2783   * <p>
2784   * Description: <b>The study identifier for the image</b><br>
2785   * Type: <b>uri</b><br>
2786   * Path: <b>ImagingStudy.uid</b><br>
2787   * </p>
2788   */
2789  public static final ca.uhn.fhir.rest.gclient.UriClientParam STUDY = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_STUDY);
2790
2791 /**
2792   * Search parameter: <b>modality</b>
2793   * <p>
2794   * Description: <b>The modality of the series</b><br>
2795   * Type: <b>token</b><br>
2796   * Path: <b>ImagingStudy.series.modality</b><br>
2797   * </p>
2798   */
2799  @SearchParamDefinition(name="modality", path="ImagingStudy.series.modality", description="The modality of the series", type="token" )
2800  public static final String SP_MODALITY = "modality";
2801 /**
2802   * <b>Fluent Client</b> search parameter constant for <b>modality</b>
2803   * <p>
2804   * Description: <b>The modality of the series</b><br>
2805   * Type: <b>token</b><br>
2806   * Path: <b>ImagingStudy.series.modality</b><br>
2807   * </p>
2808   */
2809  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MODALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MODALITY);
2810
2811 /**
2812   * Search parameter: <b>started</b>
2813   * <p>
2814   * Description: <b>When the study was started</b><br>
2815   * Type: <b>date</b><br>
2816   * Path: <b>ImagingStudy.started</b><br>
2817   * </p>
2818   */
2819  @SearchParamDefinition(name="started", path="ImagingStudy.started", description="When the study was started", type="date" )
2820  public static final String SP_STARTED = "started";
2821 /**
2822   * <b>Fluent Client</b> search parameter constant for <b>started</b>
2823   * <p>
2824   * Description: <b>When the study was started</b><br>
2825   * Type: <b>date</b><br>
2826   * Path: <b>ImagingStudy.started</b><br>
2827   * </p>
2828   */
2829  public static final ca.uhn.fhir.rest.gclient.DateClientParam STARTED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_STARTED);
2830
2831 /**
2832   * Search parameter: <b>identifier</b>
2833   * <p>
2834   * Description: <b>Other identifiers for the Study</b><br>
2835   * Type: <b>token</b><br>
2836   * Path: <b>ImagingStudy.identifier</b><br>
2837   * </p>
2838   */
2839  @SearchParamDefinition(name="identifier", path="ImagingStudy.identifier", description="Other identifiers for the Study", type="token" )
2840  public static final String SP_IDENTIFIER = "identifier";
2841 /**
2842   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2843   * <p>
2844   * Description: <b>Other identifiers for the Study</b><br>
2845   * Type: <b>token</b><br>
2846   * Path: <b>ImagingStudy.identifier</b><br>
2847   * </p>
2848   */
2849  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2850
2851 /**
2852   * Search parameter: <b>dicom-class</b>
2853   * <p>
2854   * Description: <b>The type of the instance</b><br>
2855   * Type: <b>uri</b><br>
2856   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
2857   * </p>
2858   */
2859  @SearchParamDefinition(name="dicom-class", path="ImagingStudy.series.instance.sopClass", description="The type of the instance", type="uri" )
2860  public static final String SP_DICOM_CLASS = "dicom-class";
2861 /**
2862   * <b>Fluent Client</b> search parameter constant for <b>dicom-class</b>
2863   * <p>
2864   * Description: <b>The type of the instance</b><br>
2865   * Type: <b>uri</b><br>
2866   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
2867   * </p>
2868   */
2869  public static final ca.uhn.fhir.rest.gclient.UriClientParam DICOM_CLASS = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DICOM_CLASS);
2870
2871
2872}