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