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