001package org.hl7.fhir.instance.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.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * A manifest of a set of DICOM Service-Object Pair Instances (SOP Instances).  The referenced SOP Instances (images or other content) are for a single patient, and may be from one or more studies. The referenced SOP Instances have been selected for a purpose, such as quality assurance, conference, or consult. Reflecting that range of purposes, typical ImagingObjectSelection resources may include all SOP Instances in a study (perhaps for sharing through a Health Information Exchange); key images from multiple studies (for reference by a referring or treating physician); a multi-frame ultrasound instance ("cine" video clip) and a set of measurements taken from that instance (for inclusion in a teaching file); and so on.
042 */
043@ResourceDef(name="ImagingObjectSelection", profile="http://hl7.org/fhir/Profile/ImagingObjectSelection")
044public class ImagingObjectSelection extends DomainResource {
045
046    @Block()
047    public static class StudyComponent extends BackboneElement implements IBaseBackboneElement {
048        /**
049         * Study instance UID of the SOP instances in the selection.
050         */
051        @Child(name = "uid", type = {OidType.class}, order=1, min=1, max=1, modifier=false, summary=true)
052        @Description(shortDefinition="Study instance UID", formalDefinition="Study instance UID of the SOP instances in the selection." )
053        protected OidType uid;
054
055        /**
056         * WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.
057         */
058        @Child(name = "url", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
059        @Description(shortDefinition="Retrieve study URL", formalDefinition="WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection." )
060        protected UriType url;
061
062        /**
063         * Reference to the Imaging Study in FHIR form.
064         */
065        @Child(name = "imagingStudy", type = {ImagingStudy.class}, order=3, min=0, max=1, modifier=false, summary=true)
066        @Description(shortDefinition="Reference to ImagingStudy", formalDefinition="Reference to the Imaging Study in FHIR form." )
067        protected Reference imagingStudy;
068
069        /**
070         * The actual object that is the target of the reference (Reference to the Imaging Study in FHIR form.)
071         */
072        protected ImagingStudy imagingStudyTarget;
073
074        /**
075         * Series identity and locating information of the DICOM SOP instances in the selection.
076         */
077        @Child(name = "series", type = {}, order=4, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
078        @Description(shortDefinition="Series identity of the selected instances", formalDefinition="Series identity and locating information of the DICOM SOP instances in the selection." )
079        protected List<SeriesComponent> series;
080
081        private static final long serialVersionUID = 341246743L;
082
083    /*
084     * Constructor
085     */
086      public StudyComponent() {
087        super();
088      }
089
090    /*
091     * Constructor
092     */
093      public StudyComponent(OidType uid) {
094        super();
095        this.uid = uid;
096      }
097
098        /**
099         * @return {@link #uid} (Study instance UID of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
100         */
101        public OidType getUidElement() { 
102          if (this.uid == null)
103            if (Configuration.errorOnAutoCreate())
104              throw new Error("Attempt to auto-create StudyComponent.uid");
105            else if (Configuration.doAutoCreate())
106              this.uid = new OidType(); // bb
107          return this.uid;
108        }
109
110        public boolean hasUidElement() { 
111          return this.uid != null && !this.uid.isEmpty();
112        }
113
114        public boolean hasUid() { 
115          return this.uid != null && !this.uid.isEmpty();
116        }
117
118        /**
119         * @param value {@link #uid} (Study instance UID of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
120         */
121        public StudyComponent setUidElement(OidType value) { 
122          this.uid = value;
123          return this;
124        }
125
126        /**
127         * @return Study instance UID of the SOP instances in the selection.
128         */
129        public String getUid() { 
130          return this.uid == null ? null : this.uid.getValue();
131        }
132
133        /**
134         * @param value Study instance UID of the SOP instances in the selection.
135         */
136        public StudyComponent setUid(String value) { 
137            if (this.uid == null)
138              this.uid = new OidType();
139            this.uid.setValue(value);
140          return this;
141        }
142
143        /**
144         * @return {@link #url} (WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
145         */
146        public UriType getUrlElement() { 
147          if (this.url == null)
148            if (Configuration.errorOnAutoCreate())
149              throw new Error("Attempt to auto-create StudyComponent.url");
150            else if (Configuration.doAutoCreate())
151              this.url = new UriType(); // bb
152          return this.url;
153        }
154
155        public boolean hasUrlElement() { 
156          return this.url != null && !this.url.isEmpty();
157        }
158
159        public boolean hasUrl() { 
160          return this.url != null && !this.url.isEmpty();
161        }
162
163        /**
164         * @param value {@link #url} (WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
165         */
166        public StudyComponent setUrlElement(UriType value) { 
167          this.url = value;
168          return this;
169        }
170
171        /**
172         * @return WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.
173         */
174        public String getUrl() { 
175          return this.url == null ? null : this.url.getValue();
176        }
177
178        /**
179         * @param value WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.
180         */
181        public StudyComponent setUrl(String value) { 
182          if (Utilities.noString(value))
183            this.url = null;
184          else {
185            if (this.url == null)
186              this.url = new UriType();
187            this.url.setValue(value);
188          }
189          return this;
190        }
191
192        /**
193         * @return {@link #imagingStudy} (Reference to the Imaging Study in FHIR form.)
194         */
195        public Reference getImagingStudy() { 
196          if (this.imagingStudy == null)
197            if (Configuration.errorOnAutoCreate())
198              throw new Error("Attempt to auto-create StudyComponent.imagingStudy");
199            else if (Configuration.doAutoCreate())
200              this.imagingStudy = new Reference(); // cc
201          return this.imagingStudy;
202        }
203
204        public boolean hasImagingStudy() { 
205          return this.imagingStudy != null && !this.imagingStudy.isEmpty();
206        }
207
208        /**
209         * @param value {@link #imagingStudy} (Reference to the Imaging Study in FHIR form.)
210         */
211        public StudyComponent setImagingStudy(Reference value) { 
212          this.imagingStudy = value;
213          return this;
214        }
215
216        /**
217         * @return {@link #imagingStudy} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the Imaging Study in FHIR form.)
218         */
219        public ImagingStudy getImagingStudyTarget() { 
220          if (this.imagingStudyTarget == null)
221            if (Configuration.errorOnAutoCreate())
222              throw new Error("Attempt to auto-create StudyComponent.imagingStudy");
223            else if (Configuration.doAutoCreate())
224              this.imagingStudyTarget = new ImagingStudy(); // aa
225          return this.imagingStudyTarget;
226        }
227
228        /**
229         * @param value {@link #imagingStudy} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the Imaging Study in FHIR form.)
230         */
231        public StudyComponent setImagingStudyTarget(ImagingStudy value) { 
232          this.imagingStudyTarget = value;
233          return this;
234        }
235
236        /**
237         * @return {@link #series} (Series identity and locating information of the DICOM SOP instances in the selection.)
238         */
239        public List<SeriesComponent> getSeries() { 
240          if (this.series == null)
241            this.series = new ArrayList<SeriesComponent>();
242          return this.series;
243        }
244
245        public boolean hasSeries() { 
246          if (this.series == null)
247            return false;
248          for (SeriesComponent item : this.series)
249            if (!item.isEmpty())
250              return true;
251          return false;
252        }
253
254        /**
255         * @return {@link #series} (Series identity and locating information of the DICOM SOP instances in the selection.)
256         */
257    // syntactic sugar
258        public SeriesComponent addSeries() { //3
259          SeriesComponent t = new SeriesComponent();
260          if (this.series == null)
261            this.series = new ArrayList<SeriesComponent>();
262          this.series.add(t);
263          return t;
264        }
265
266    // syntactic sugar
267        public StudyComponent addSeries(SeriesComponent t) { //3
268          if (t == null)
269            return this;
270          if (this.series == null)
271            this.series = new ArrayList<SeriesComponent>();
272          this.series.add(t);
273          return this;
274        }
275
276        protected void listChildren(List<Property> childrenList) {
277          super.listChildren(childrenList);
278          childrenList.add(new Property("uid", "oid", "Study instance UID of the SOP instances in the selection.", 0, java.lang.Integer.MAX_VALUE, uid));
279          childrenList.add(new Property("url", "uri", "WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection.", 0, java.lang.Integer.MAX_VALUE, url));
280          childrenList.add(new Property("imagingStudy", "Reference(ImagingStudy)", "Reference to the Imaging Study in FHIR form.", 0, java.lang.Integer.MAX_VALUE, imagingStudy));
281          childrenList.add(new Property("series", "", "Series identity and locating information of the DICOM SOP instances in the selection.", 0, java.lang.Integer.MAX_VALUE, series));
282        }
283
284      @Override
285      public void setProperty(String name, Base value) throws FHIRException {
286        if (name.equals("uid"))
287          this.uid = castToOid(value); // OidType
288        else if (name.equals("url"))
289          this.url = castToUri(value); // UriType
290        else if (name.equals("imagingStudy"))
291          this.imagingStudy = castToReference(value); // Reference
292        else if (name.equals("series"))
293          this.getSeries().add((SeriesComponent) value);
294        else
295          super.setProperty(name, value);
296      }
297
298      @Override
299      public Base addChild(String name) throws FHIRException {
300        if (name.equals("uid")) {
301          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.uid");
302        }
303        else if (name.equals("url")) {
304          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.url");
305        }
306        else if (name.equals("imagingStudy")) {
307          this.imagingStudy = new Reference();
308          return this.imagingStudy;
309        }
310        else if (name.equals("series")) {
311          return addSeries();
312        }
313        else
314          return super.addChild(name);
315      }
316
317      public StudyComponent copy() {
318        StudyComponent dst = new StudyComponent();
319        copyValues(dst);
320        dst.uid = uid == null ? null : uid.copy();
321        dst.url = url == null ? null : url.copy();
322        dst.imagingStudy = imagingStudy == null ? null : imagingStudy.copy();
323        if (series != null) {
324          dst.series = new ArrayList<SeriesComponent>();
325          for (SeriesComponent i : series)
326            dst.series.add(i.copy());
327        };
328        return dst;
329      }
330
331      @Override
332      public boolean equalsDeep(Base other) {
333        if (!super.equalsDeep(other))
334          return false;
335        if (!(other instanceof StudyComponent))
336          return false;
337        StudyComponent o = (StudyComponent) other;
338        return compareDeep(uid, o.uid, true) && compareDeep(url, o.url, true) && compareDeep(imagingStudy, o.imagingStudy, true)
339           && compareDeep(series, o.series, true);
340      }
341
342      @Override
343      public boolean equalsShallow(Base other) {
344        if (!super.equalsShallow(other))
345          return false;
346        if (!(other instanceof StudyComponent))
347          return false;
348        StudyComponent o = (StudyComponent) other;
349        return compareValues(uid, o.uid, true) && compareValues(url, o.url, true);
350      }
351
352      public boolean isEmpty() {
353        return super.isEmpty() && (uid == null || uid.isEmpty()) && (url == null || url.isEmpty()) && (imagingStudy == null || imagingStudy.isEmpty())
354           && (series == null || series.isEmpty());
355      }
356
357  public String fhirType() {
358    return "ImagingObjectSelection.study";
359
360  }
361
362  }
363
364    @Block()
365    public static class SeriesComponent extends BackboneElement implements IBaseBackboneElement {
366        /**
367         * Series instance UID of the SOP instances in the selection.
368         */
369        @Child(name = "uid", type = {OidType.class}, order=1, min=0, max=1, modifier=false, summary=true)
370        @Description(shortDefinition="Series instance UID", formalDefinition="Series instance UID of the SOP instances in the selection." )
371        protected OidType uid;
372
373        /**
374         * WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.
375         */
376        @Child(name = "url", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
377        @Description(shortDefinition="Retrieve series URL", formalDefinition="WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection." )
378        protected UriType url;
379
380        /**
381         * Identity and locating information of the selected DICOM SOP instances.
382         */
383        @Child(name = "instance", type = {}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
384        @Description(shortDefinition="The selected instance", formalDefinition="Identity and locating information of the selected DICOM SOP instances." )
385        protected List<InstanceComponent> instance;
386
387        private static final long serialVersionUID = 229247770L;
388
389    /*
390     * Constructor
391     */
392      public SeriesComponent() {
393        super();
394      }
395
396        /**
397         * @return {@link #uid} (Series instance UID of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
398         */
399        public OidType getUidElement() { 
400          if (this.uid == null)
401            if (Configuration.errorOnAutoCreate())
402              throw new Error("Attempt to auto-create SeriesComponent.uid");
403            else if (Configuration.doAutoCreate())
404              this.uid = new OidType(); // bb
405          return this.uid;
406        }
407
408        public boolean hasUidElement() { 
409          return this.uid != null && !this.uid.isEmpty();
410        }
411
412        public boolean hasUid() { 
413          return this.uid != null && !this.uid.isEmpty();
414        }
415
416        /**
417         * @param value {@link #uid} (Series instance UID of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
418         */
419        public SeriesComponent setUidElement(OidType value) { 
420          this.uid = value;
421          return this;
422        }
423
424        /**
425         * @return Series instance UID of the SOP instances in the selection.
426         */
427        public String getUid() { 
428          return this.uid == null ? null : this.uid.getValue();
429        }
430
431        /**
432         * @param value Series instance UID of the SOP instances in the selection.
433         */
434        public SeriesComponent setUid(String value) { 
435          if (Utilities.noString(value))
436            this.uid = null;
437          else {
438            if (this.uid == null)
439              this.uid = new OidType();
440            this.uid.setValue(value);
441          }
442          return this;
443        }
444
445        /**
446         * @return {@link #url} (WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
447         */
448        public UriType getUrlElement() { 
449          if (this.url == null)
450            if (Configuration.errorOnAutoCreate())
451              throw new Error("Attempt to auto-create SeriesComponent.url");
452            else if (Configuration.doAutoCreate())
453              this.url = new UriType(); // bb
454          return this.url;
455        }
456
457        public boolean hasUrlElement() { 
458          return this.url != null && !this.url.isEmpty();
459        }
460
461        public boolean hasUrl() { 
462          return this.url != null && !this.url.isEmpty();
463        }
464
465        /**
466         * @param value {@link #url} (WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
467         */
468        public SeriesComponent setUrlElement(UriType value) { 
469          this.url = value;
470          return this;
471        }
472
473        /**
474         * @return WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.
475         */
476        public String getUrl() { 
477          return this.url == null ? null : this.url.getValue();
478        }
479
480        /**
481         * @param value WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.
482         */
483        public SeriesComponent setUrl(String value) { 
484          if (Utilities.noString(value))
485            this.url = null;
486          else {
487            if (this.url == null)
488              this.url = new UriType();
489            this.url.setValue(value);
490          }
491          return this;
492        }
493
494        /**
495         * @return {@link #instance} (Identity and locating information of the selected DICOM SOP instances.)
496         */
497        public List<InstanceComponent> getInstance() { 
498          if (this.instance == null)
499            this.instance = new ArrayList<InstanceComponent>();
500          return this.instance;
501        }
502
503        public boolean hasInstance() { 
504          if (this.instance == null)
505            return false;
506          for (InstanceComponent item : this.instance)
507            if (!item.isEmpty())
508              return true;
509          return false;
510        }
511
512        /**
513         * @return {@link #instance} (Identity and locating information of the selected DICOM SOP instances.)
514         */
515    // syntactic sugar
516        public InstanceComponent addInstance() { //3
517          InstanceComponent t = new InstanceComponent();
518          if (this.instance == null)
519            this.instance = new ArrayList<InstanceComponent>();
520          this.instance.add(t);
521          return t;
522        }
523
524    // syntactic sugar
525        public SeriesComponent addInstance(InstanceComponent t) { //3
526          if (t == null)
527            return this;
528          if (this.instance == null)
529            this.instance = new ArrayList<InstanceComponent>();
530          this.instance.add(t);
531          return this;
532        }
533
534        protected void listChildren(List<Property> childrenList) {
535          super.listChildren(childrenList);
536          childrenList.add(new Property("uid", "oid", "Series instance UID of the SOP instances in the selection.", 0, java.lang.Integer.MAX_VALUE, uid));
537          childrenList.add(new Property("url", "uri", "WADO-RS URL to retrieve the series. Note that this URL retrieves all SOP instances of the series not only those in the selection.", 0, java.lang.Integer.MAX_VALUE, url));
538          childrenList.add(new Property("instance", "", "Identity and locating information of the selected DICOM SOP instances.", 0, java.lang.Integer.MAX_VALUE, instance));
539        }
540
541      @Override
542      public void setProperty(String name, Base value) throws FHIRException {
543        if (name.equals("uid"))
544          this.uid = castToOid(value); // OidType
545        else if (name.equals("url"))
546          this.url = castToUri(value); // UriType
547        else if (name.equals("instance"))
548          this.getInstance().add((InstanceComponent) value);
549        else
550          super.setProperty(name, value);
551      }
552
553      @Override
554      public Base addChild(String name) throws FHIRException {
555        if (name.equals("uid")) {
556          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.uid");
557        }
558        else if (name.equals("url")) {
559          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.url");
560        }
561        else if (name.equals("instance")) {
562          return addInstance();
563        }
564        else
565          return super.addChild(name);
566      }
567
568      public SeriesComponent copy() {
569        SeriesComponent dst = new SeriesComponent();
570        copyValues(dst);
571        dst.uid = uid == null ? null : uid.copy();
572        dst.url = url == null ? null : url.copy();
573        if (instance != null) {
574          dst.instance = new ArrayList<InstanceComponent>();
575          for (InstanceComponent i : instance)
576            dst.instance.add(i.copy());
577        };
578        return dst;
579      }
580
581      @Override
582      public boolean equalsDeep(Base other) {
583        if (!super.equalsDeep(other))
584          return false;
585        if (!(other instanceof SeriesComponent))
586          return false;
587        SeriesComponent o = (SeriesComponent) other;
588        return compareDeep(uid, o.uid, true) && compareDeep(url, o.url, true) && compareDeep(instance, o.instance, true)
589          ;
590      }
591
592      @Override
593      public boolean equalsShallow(Base other) {
594        if (!super.equalsShallow(other))
595          return false;
596        if (!(other instanceof SeriesComponent))
597          return false;
598        SeriesComponent o = (SeriesComponent) other;
599        return compareValues(uid, o.uid, true) && compareValues(url, o.url, true);
600      }
601
602      public boolean isEmpty() {
603        return super.isEmpty() && (uid == null || uid.isEmpty()) && (url == null || url.isEmpty()) && (instance == null || instance.isEmpty())
604          ;
605      }
606
607  public String fhirType() {
608    return "ImagingObjectSelection.study.series";
609
610  }
611
612  }
613
614    @Block()
615    public static class InstanceComponent extends BackboneElement implements IBaseBackboneElement {
616        /**
617         * SOP class UID of the selected instance.
618         */
619        @Child(name = "sopClass", type = {OidType.class}, order=1, min=1, max=1, modifier=false, summary=true)
620        @Description(shortDefinition="SOP class UID of instance", formalDefinition="SOP class UID of the selected instance." )
621        protected OidType sopClass;
622
623        /**
624         * SOP Instance UID of the selected instance.
625         */
626        @Child(name = "uid", type = {OidType.class}, order=2, min=1, max=1, modifier=false, summary=true)
627        @Description(shortDefinition="Selected instance UID", formalDefinition="SOP Instance UID of the selected instance." )
628        protected OidType uid;
629
630        /**
631         * WADO-RS URL to retrieve the DICOM SOP Instance.
632         */
633        @Child(name = "url", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=true)
634        @Description(shortDefinition="Retrieve instance URL", formalDefinition="WADO-RS URL to retrieve the DICOM SOP Instance." )
635        protected UriType url;
636
637        /**
638         * Identity and location information of the frames in the selected instance.
639         */
640        @Child(name = "frames", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
641        @Description(shortDefinition="The frame set", formalDefinition="Identity and location information of the frames in the selected instance." )
642        protected List<FramesComponent> frames;
643
644        private static final long serialVersionUID = 1641180916L;
645
646    /*
647     * Constructor
648     */
649      public InstanceComponent() {
650        super();
651      }
652
653    /*
654     * Constructor
655     */
656      public InstanceComponent(OidType sopClass, OidType uid, UriType url) {
657        super();
658        this.sopClass = sopClass;
659        this.uid = uid;
660        this.url = url;
661      }
662
663        /**
664         * @return {@link #sopClass} (SOP class UID of the selected instance.). This is the underlying object with id, value and extensions. The accessor "getSopClass" gives direct access to the value
665         */
666        public OidType getSopClassElement() { 
667          if (this.sopClass == null)
668            if (Configuration.errorOnAutoCreate())
669              throw new Error("Attempt to auto-create InstanceComponent.sopClass");
670            else if (Configuration.doAutoCreate())
671              this.sopClass = new OidType(); // bb
672          return this.sopClass;
673        }
674
675        public boolean hasSopClassElement() { 
676          return this.sopClass != null && !this.sopClass.isEmpty();
677        }
678
679        public boolean hasSopClass() { 
680          return this.sopClass != null && !this.sopClass.isEmpty();
681        }
682
683        /**
684         * @param value {@link #sopClass} (SOP class UID of the selected instance.). This is the underlying object with id, value and extensions. The accessor "getSopClass" gives direct access to the value
685         */
686        public InstanceComponent setSopClassElement(OidType value) { 
687          this.sopClass = value;
688          return this;
689        }
690
691        /**
692         * @return SOP class UID of the selected instance.
693         */
694        public String getSopClass() { 
695          return this.sopClass == null ? null : this.sopClass.getValue();
696        }
697
698        /**
699         * @param value SOP class UID of the selected instance.
700         */
701        public InstanceComponent setSopClass(String value) { 
702            if (this.sopClass == null)
703              this.sopClass = new OidType();
704            this.sopClass.setValue(value);
705          return this;
706        }
707
708        /**
709         * @return {@link #uid} (SOP Instance UID of the selected instance.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
710         */
711        public OidType getUidElement() { 
712          if (this.uid == null)
713            if (Configuration.errorOnAutoCreate())
714              throw new Error("Attempt to auto-create InstanceComponent.uid");
715            else if (Configuration.doAutoCreate())
716              this.uid = new OidType(); // bb
717          return this.uid;
718        }
719
720        public boolean hasUidElement() { 
721          return this.uid != null && !this.uid.isEmpty();
722        }
723
724        public boolean hasUid() { 
725          return this.uid != null && !this.uid.isEmpty();
726        }
727
728        /**
729         * @param value {@link #uid} (SOP Instance UID of the selected instance.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
730         */
731        public InstanceComponent setUidElement(OidType value) { 
732          this.uid = value;
733          return this;
734        }
735
736        /**
737         * @return SOP Instance UID of the selected instance.
738         */
739        public String getUid() { 
740          return this.uid == null ? null : this.uid.getValue();
741        }
742
743        /**
744         * @param value SOP Instance UID of the selected instance.
745         */
746        public InstanceComponent setUid(String value) { 
747            if (this.uid == null)
748              this.uid = new OidType();
749            this.uid.setValue(value);
750          return this;
751        }
752
753        /**
754         * @return {@link #url} (WADO-RS URL to retrieve the DICOM SOP Instance.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
755         */
756        public UriType getUrlElement() { 
757          if (this.url == null)
758            if (Configuration.errorOnAutoCreate())
759              throw new Error("Attempt to auto-create InstanceComponent.url");
760            else if (Configuration.doAutoCreate())
761              this.url = new UriType(); // bb
762          return this.url;
763        }
764
765        public boolean hasUrlElement() { 
766          return this.url != null && !this.url.isEmpty();
767        }
768
769        public boolean hasUrl() { 
770          return this.url != null && !this.url.isEmpty();
771        }
772
773        /**
774         * @param value {@link #url} (WADO-RS URL to retrieve the DICOM SOP Instance.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
775         */
776        public InstanceComponent setUrlElement(UriType value) { 
777          this.url = value;
778          return this;
779        }
780
781        /**
782         * @return WADO-RS URL to retrieve the DICOM SOP Instance.
783         */
784        public String getUrl() { 
785          return this.url == null ? null : this.url.getValue();
786        }
787
788        /**
789         * @param value WADO-RS URL to retrieve the DICOM SOP Instance.
790         */
791        public InstanceComponent setUrl(String value) { 
792            if (this.url == null)
793              this.url = new UriType();
794            this.url.setValue(value);
795          return this;
796        }
797
798        /**
799         * @return {@link #frames} (Identity and location information of the frames in the selected instance.)
800         */
801        public List<FramesComponent> getFrames() { 
802          if (this.frames == null)
803            this.frames = new ArrayList<FramesComponent>();
804          return this.frames;
805        }
806
807        public boolean hasFrames() { 
808          if (this.frames == null)
809            return false;
810          for (FramesComponent item : this.frames)
811            if (!item.isEmpty())
812              return true;
813          return false;
814        }
815
816        /**
817         * @return {@link #frames} (Identity and location information of the frames in the selected instance.)
818         */
819    // syntactic sugar
820        public FramesComponent addFrames() { //3
821          FramesComponent t = new FramesComponent();
822          if (this.frames == null)
823            this.frames = new ArrayList<FramesComponent>();
824          this.frames.add(t);
825          return t;
826        }
827
828    // syntactic sugar
829        public InstanceComponent addFrames(FramesComponent t) { //3
830          if (t == null)
831            return this;
832          if (this.frames == null)
833            this.frames = new ArrayList<FramesComponent>();
834          this.frames.add(t);
835          return this;
836        }
837
838        protected void listChildren(List<Property> childrenList) {
839          super.listChildren(childrenList);
840          childrenList.add(new Property("sopClass", "oid", "SOP class UID of the selected instance.", 0, java.lang.Integer.MAX_VALUE, sopClass));
841          childrenList.add(new Property("uid", "oid", "SOP Instance UID of the selected instance.", 0, java.lang.Integer.MAX_VALUE, uid));
842          childrenList.add(new Property("url", "uri", "WADO-RS URL to retrieve the DICOM SOP Instance.", 0, java.lang.Integer.MAX_VALUE, url));
843          childrenList.add(new Property("frames", "", "Identity and location information of the frames in the selected instance.", 0, java.lang.Integer.MAX_VALUE, frames));
844        }
845
846      @Override
847      public void setProperty(String name, Base value) throws FHIRException {
848        if (name.equals("sopClass"))
849          this.sopClass = castToOid(value); // OidType
850        else if (name.equals("uid"))
851          this.uid = castToOid(value); // OidType
852        else if (name.equals("url"))
853          this.url = castToUri(value); // UriType
854        else if (name.equals("frames"))
855          this.getFrames().add((FramesComponent) value);
856        else
857          super.setProperty(name, value);
858      }
859
860      @Override
861      public Base addChild(String name) throws FHIRException {
862        if (name.equals("sopClass")) {
863          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.sopClass");
864        }
865        else if (name.equals("uid")) {
866          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.uid");
867        }
868        else if (name.equals("url")) {
869          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.url");
870        }
871        else if (name.equals("frames")) {
872          return addFrames();
873        }
874        else
875          return super.addChild(name);
876      }
877
878      public InstanceComponent copy() {
879        InstanceComponent dst = new InstanceComponent();
880        copyValues(dst);
881        dst.sopClass = sopClass == null ? null : sopClass.copy();
882        dst.uid = uid == null ? null : uid.copy();
883        dst.url = url == null ? null : url.copy();
884        if (frames != null) {
885          dst.frames = new ArrayList<FramesComponent>();
886          for (FramesComponent i : frames)
887            dst.frames.add(i.copy());
888        };
889        return dst;
890      }
891
892      @Override
893      public boolean equalsDeep(Base other) {
894        if (!super.equalsDeep(other))
895          return false;
896        if (!(other instanceof InstanceComponent))
897          return false;
898        InstanceComponent o = (InstanceComponent) other;
899        return compareDeep(sopClass, o.sopClass, true) && compareDeep(uid, o.uid, true) && compareDeep(url, o.url, true)
900           && compareDeep(frames, o.frames, true);
901      }
902
903      @Override
904      public boolean equalsShallow(Base other) {
905        if (!super.equalsShallow(other))
906          return false;
907        if (!(other instanceof InstanceComponent))
908          return false;
909        InstanceComponent o = (InstanceComponent) other;
910        return compareValues(sopClass, o.sopClass, true) && compareValues(uid, o.uid, true) && compareValues(url, o.url, true)
911          ;
912      }
913
914      public boolean isEmpty() {
915        return super.isEmpty() && (sopClass == null || sopClass.isEmpty()) && (uid == null || uid.isEmpty())
916           && (url == null || url.isEmpty()) && (frames == null || frames.isEmpty());
917      }
918
919  public String fhirType() {
920    return "ImagingObjectSelection.study.series.instance";
921
922  }
923
924  }
925
926    @Block()
927    public static class FramesComponent extends BackboneElement implements IBaseBackboneElement {
928        /**
929         * The frame numbers in the frame set.
930         */
931        @Child(name = "frameNumbers", type = {UnsignedIntType.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
932        @Description(shortDefinition="Frame numbers", formalDefinition="The frame numbers in the frame set." )
933        protected List<UnsignedIntType> frameNumbers;
934
935        /**
936         * WADO-RS URL to retrieve the DICOM frames.
937         */
938        @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true)
939        @Description(shortDefinition="Retrieve frame URL", formalDefinition="WADO-RS URL to retrieve the DICOM frames." )
940        protected UriType url;
941
942        private static final long serialVersionUID = -2068206970L;
943
944    /*
945     * Constructor
946     */
947      public FramesComponent() {
948        super();
949      }
950
951    /*
952     * Constructor
953     */
954      public FramesComponent(UriType url) {
955        super();
956        this.url = url;
957      }
958
959        /**
960         * @return {@link #frameNumbers} (The frame numbers in the frame set.)
961         */
962        public List<UnsignedIntType> getFrameNumbers() { 
963          if (this.frameNumbers == null)
964            this.frameNumbers = new ArrayList<UnsignedIntType>();
965          return this.frameNumbers;
966        }
967
968        public boolean hasFrameNumbers() { 
969          if (this.frameNumbers == null)
970            return false;
971          for (UnsignedIntType item : this.frameNumbers)
972            if (!item.isEmpty())
973              return true;
974          return false;
975        }
976
977        /**
978         * @return {@link #frameNumbers} (The frame numbers in the frame set.)
979         */
980    // syntactic sugar
981        public UnsignedIntType addFrameNumbersElement() {//2 
982          UnsignedIntType t = new UnsignedIntType();
983          if (this.frameNumbers == null)
984            this.frameNumbers = new ArrayList<UnsignedIntType>();
985          this.frameNumbers.add(t);
986          return t;
987        }
988
989        /**
990         * @param value {@link #frameNumbers} (The frame numbers in the frame set.)
991         */
992        public FramesComponent addFrameNumbers(int value) { //1
993          UnsignedIntType t = new UnsignedIntType();
994          t.setValue(value);
995          if (this.frameNumbers == null)
996            this.frameNumbers = new ArrayList<UnsignedIntType>();
997          this.frameNumbers.add(t);
998          return this;
999        }
1000
1001        /**
1002         * @param value {@link #frameNumbers} (The frame numbers in the frame set.)
1003         */
1004        public boolean hasFrameNumbers(int value) { 
1005          if (this.frameNumbers == null)
1006            return false;
1007          for (UnsignedIntType v : this.frameNumbers)
1008            if (v.equals(value)) // unsignedInt
1009              return true;
1010          return false;
1011        }
1012
1013        /**
1014         * @return {@link #url} (WADO-RS URL to retrieve the DICOM frames.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1015         */
1016        public UriType getUrlElement() { 
1017          if (this.url == null)
1018            if (Configuration.errorOnAutoCreate())
1019              throw new Error("Attempt to auto-create FramesComponent.url");
1020            else if (Configuration.doAutoCreate())
1021              this.url = new UriType(); // bb
1022          return this.url;
1023        }
1024
1025        public boolean hasUrlElement() { 
1026          return this.url != null && !this.url.isEmpty();
1027        }
1028
1029        public boolean hasUrl() { 
1030          return this.url != null && !this.url.isEmpty();
1031        }
1032
1033        /**
1034         * @param value {@link #url} (WADO-RS URL to retrieve the DICOM frames.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1035         */
1036        public FramesComponent setUrlElement(UriType value) { 
1037          this.url = value;
1038          return this;
1039        }
1040
1041        /**
1042         * @return WADO-RS URL to retrieve the DICOM frames.
1043         */
1044        public String getUrl() { 
1045          return this.url == null ? null : this.url.getValue();
1046        }
1047
1048        /**
1049         * @param value WADO-RS URL to retrieve the DICOM frames.
1050         */
1051        public FramesComponent setUrl(String value) { 
1052            if (this.url == null)
1053              this.url = new UriType();
1054            this.url.setValue(value);
1055          return this;
1056        }
1057
1058        protected void listChildren(List<Property> childrenList) {
1059          super.listChildren(childrenList);
1060          childrenList.add(new Property("frameNumbers", "unsignedInt", "The frame numbers in the frame set.", 0, java.lang.Integer.MAX_VALUE, frameNumbers));
1061          childrenList.add(new Property("url", "uri", "WADO-RS URL to retrieve the DICOM frames.", 0, java.lang.Integer.MAX_VALUE, url));
1062        }
1063
1064      @Override
1065      public void setProperty(String name, Base value) throws FHIRException {
1066        if (name.equals("frameNumbers"))
1067          this.getFrameNumbers().add(castToUnsignedInt(value));
1068        else if (name.equals("url"))
1069          this.url = castToUri(value); // UriType
1070        else
1071          super.setProperty(name, value);
1072      }
1073
1074      @Override
1075      public Base addChild(String name) throws FHIRException {
1076        if (name.equals("frameNumbers")) {
1077          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.frameNumbers");
1078        }
1079        else if (name.equals("url")) {
1080          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.url");
1081        }
1082        else
1083          return super.addChild(name);
1084      }
1085
1086      public FramesComponent copy() {
1087        FramesComponent dst = new FramesComponent();
1088        copyValues(dst);
1089        if (frameNumbers != null) {
1090          dst.frameNumbers = new ArrayList<UnsignedIntType>();
1091          for (UnsignedIntType i : frameNumbers)
1092            dst.frameNumbers.add(i.copy());
1093        };
1094        dst.url = url == null ? null : url.copy();
1095        return dst;
1096      }
1097
1098      @Override
1099      public boolean equalsDeep(Base other) {
1100        if (!super.equalsDeep(other))
1101          return false;
1102        if (!(other instanceof FramesComponent))
1103          return false;
1104        FramesComponent o = (FramesComponent) other;
1105        return compareDeep(frameNumbers, o.frameNumbers, true) && compareDeep(url, o.url, true);
1106      }
1107
1108      @Override
1109      public boolean equalsShallow(Base other) {
1110        if (!super.equalsShallow(other))
1111          return false;
1112        if (!(other instanceof FramesComponent))
1113          return false;
1114        FramesComponent o = (FramesComponent) other;
1115        return compareValues(frameNumbers, o.frameNumbers, true) && compareValues(url, o.url, true);
1116      }
1117
1118      public boolean isEmpty() {
1119        return super.isEmpty() && (frameNumbers == null || frameNumbers.isEmpty()) && (url == null || url.isEmpty())
1120          ;
1121      }
1122
1123  public String fhirType() {
1124    return "ImagingObjectSelection.study.series.instance.frames";
1125
1126  }
1127
1128  }
1129
1130    /**
1131     * Instance UID of the DICOM KOS SOP Instances represented in this resource.
1132     */
1133    @Child(name = "uid", type = {OidType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1134    @Description(shortDefinition="Instance UID", formalDefinition="Instance UID of the DICOM KOS SOP Instances represented in this resource." )
1135    protected OidType uid;
1136
1137    /**
1138     * A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.
1139     */
1140    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
1141    @Description(shortDefinition="Patient of the selected objects", formalDefinition="A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection." )
1142    protected Reference patient;
1143
1144    /**
1145     * The actual object that is the target of the reference (A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.)
1146     */
1147    protected Patient patientTarget;
1148
1149    /**
1150     * The reason for, or significance of, the selection of objects referenced in the resource.
1151     */
1152    @Child(name = "title", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
1153    @Description(shortDefinition="Reason for selection", formalDefinition="The reason for, or significance of, the selection of objects referenced in the resource." )
1154    protected CodeableConcept title;
1155
1156    /**
1157     * Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.
1158     */
1159    @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1160    @Description(shortDefinition="Description text", formalDefinition="Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection." )
1161    protected StringType description;
1162
1163    /**
1164     * Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.
1165     */
1166    @Child(name = "author", type = {Practitioner.class, Device.class, Organization.class, Patient.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=true)
1167    @Description(shortDefinition="Author (human or machine)", formalDefinition="Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion." )
1168    protected Reference author;
1169
1170    /**
1171     * The actual object that is the target of the reference (Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.)
1172     */
1173    protected Resource authorTarget;
1174
1175    /**
1176     * Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).
1177     */
1178    @Child(name = "authoringTime", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1179    @Description(shortDefinition="Authoring time of the selection", formalDefinition="Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image)." )
1180    protected DateTimeType authoringTime;
1181
1182    /**
1183     * Study identity and locating information of the DICOM SOP instances in the selection.
1184     */
1185    @Child(name = "study", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1186    @Description(shortDefinition="Study identity of the selected instances", formalDefinition="Study identity and locating information of the DICOM SOP instances in the selection." )
1187    protected List<StudyComponent> study;
1188
1189    private static final long serialVersionUID = -1961832713L;
1190
1191  /*
1192   * Constructor
1193   */
1194    public ImagingObjectSelection() {
1195      super();
1196    }
1197
1198  /*
1199   * Constructor
1200   */
1201    public ImagingObjectSelection(OidType uid, Reference patient, CodeableConcept title) {
1202      super();
1203      this.uid = uid;
1204      this.patient = patient;
1205      this.title = title;
1206    }
1207
1208    /**
1209     * @return {@link #uid} (Instance UID of the DICOM KOS SOP Instances represented in this resource.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1210     */
1211    public OidType getUidElement() { 
1212      if (this.uid == null)
1213        if (Configuration.errorOnAutoCreate())
1214          throw new Error("Attempt to auto-create ImagingObjectSelection.uid");
1215        else if (Configuration.doAutoCreate())
1216          this.uid = new OidType(); // bb
1217      return this.uid;
1218    }
1219
1220    public boolean hasUidElement() { 
1221      return this.uid != null && !this.uid.isEmpty();
1222    }
1223
1224    public boolean hasUid() { 
1225      return this.uid != null && !this.uid.isEmpty();
1226    }
1227
1228    /**
1229     * @param value {@link #uid} (Instance UID of the DICOM KOS SOP Instances represented in this resource.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
1230     */
1231    public ImagingObjectSelection setUidElement(OidType value) { 
1232      this.uid = value;
1233      return this;
1234    }
1235
1236    /**
1237     * @return Instance UID of the DICOM KOS SOP Instances represented in this resource.
1238     */
1239    public String getUid() { 
1240      return this.uid == null ? null : this.uid.getValue();
1241    }
1242
1243    /**
1244     * @param value Instance UID of the DICOM KOS SOP Instances represented in this resource.
1245     */
1246    public ImagingObjectSelection setUid(String value) { 
1247        if (this.uid == null)
1248          this.uid = new OidType();
1249        this.uid.setValue(value);
1250      return this;
1251    }
1252
1253    /**
1254     * @return {@link #patient} (A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.)
1255     */
1256    public Reference getPatient() { 
1257      if (this.patient == null)
1258        if (Configuration.errorOnAutoCreate())
1259          throw new Error("Attempt to auto-create ImagingObjectSelection.patient");
1260        else if (Configuration.doAutoCreate())
1261          this.patient = new Reference(); // cc
1262      return this.patient;
1263    }
1264
1265    public boolean hasPatient() { 
1266      return this.patient != null && !this.patient.isEmpty();
1267    }
1268
1269    /**
1270     * @param value {@link #patient} (A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.)
1271     */
1272    public ImagingObjectSelection setPatient(Reference value) { 
1273      this.patient = value;
1274      return this;
1275    }
1276
1277    /**
1278     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.)
1279     */
1280    public Patient getPatientTarget() { 
1281      if (this.patientTarget == null)
1282        if (Configuration.errorOnAutoCreate())
1283          throw new Error("Attempt to auto-create ImagingObjectSelection.patient");
1284        else if (Configuration.doAutoCreate())
1285          this.patientTarget = new Patient(); // aa
1286      return this.patientTarget;
1287    }
1288
1289    /**
1290     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.)
1291     */
1292    public ImagingObjectSelection setPatientTarget(Patient value) { 
1293      this.patientTarget = value;
1294      return this;
1295    }
1296
1297    /**
1298     * @return {@link #title} (The reason for, or significance of, the selection of objects referenced in the resource.)
1299     */
1300    public CodeableConcept getTitle() { 
1301      if (this.title == null)
1302        if (Configuration.errorOnAutoCreate())
1303          throw new Error("Attempt to auto-create ImagingObjectSelection.title");
1304        else if (Configuration.doAutoCreate())
1305          this.title = new CodeableConcept(); // cc
1306      return this.title;
1307    }
1308
1309    public boolean hasTitle() { 
1310      return this.title != null && !this.title.isEmpty();
1311    }
1312
1313    /**
1314     * @param value {@link #title} (The reason for, or significance of, the selection of objects referenced in the resource.)
1315     */
1316    public ImagingObjectSelection setTitle(CodeableConcept value) { 
1317      this.title = value;
1318      return this;
1319    }
1320
1321    /**
1322     * @return {@link #description} (Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1323     */
1324    public StringType getDescriptionElement() { 
1325      if (this.description == null)
1326        if (Configuration.errorOnAutoCreate())
1327          throw new Error("Attempt to auto-create ImagingObjectSelection.description");
1328        else if (Configuration.doAutoCreate())
1329          this.description = new StringType(); // bb
1330      return this.description;
1331    }
1332
1333    public boolean hasDescriptionElement() { 
1334      return this.description != null && !this.description.isEmpty();
1335    }
1336
1337    public boolean hasDescription() { 
1338      return this.description != null && !this.description.isEmpty();
1339    }
1340
1341    /**
1342     * @param value {@link #description} (Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1343     */
1344    public ImagingObjectSelection setDescriptionElement(StringType value) { 
1345      this.description = value;
1346      return this;
1347    }
1348
1349    /**
1350     * @return Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.
1351     */
1352    public String getDescription() { 
1353      return this.description == null ? null : this.description.getValue();
1354    }
1355
1356    /**
1357     * @param value Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.
1358     */
1359    public ImagingObjectSelection setDescription(String value) { 
1360      if (Utilities.noString(value))
1361        this.description = null;
1362      else {
1363        if (this.description == null)
1364          this.description = new StringType();
1365        this.description.setValue(value);
1366      }
1367      return this;
1368    }
1369
1370    /**
1371     * @return {@link #author} (Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.)
1372     */
1373    public Reference getAuthor() { 
1374      if (this.author == null)
1375        if (Configuration.errorOnAutoCreate())
1376          throw new Error("Attempt to auto-create ImagingObjectSelection.author");
1377        else if (Configuration.doAutoCreate())
1378          this.author = new Reference(); // cc
1379      return this.author;
1380    }
1381
1382    public boolean hasAuthor() { 
1383      return this.author != null && !this.author.isEmpty();
1384    }
1385
1386    /**
1387     * @param value {@link #author} (Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.)
1388     */
1389    public ImagingObjectSelection setAuthor(Reference value) { 
1390      this.author = value;
1391      return this;
1392    }
1393
1394    /**
1395     * @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.)
1396     */
1397    public Resource getAuthorTarget() { 
1398      return this.authorTarget;
1399    }
1400
1401    /**
1402     * @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.)
1403     */
1404    public ImagingObjectSelection setAuthorTarget(Resource value) { 
1405      this.authorTarget = value;
1406      return this;
1407    }
1408
1409    /**
1410     * @return {@link #authoringTime} (Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).). This is the underlying object with id, value and extensions. The accessor "getAuthoringTime" gives direct access to the value
1411     */
1412    public DateTimeType getAuthoringTimeElement() { 
1413      if (this.authoringTime == null)
1414        if (Configuration.errorOnAutoCreate())
1415          throw new Error("Attempt to auto-create ImagingObjectSelection.authoringTime");
1416        else if (Configuration.doAutoCreate())
1417          this.authoringTime = new DateTimeType(); // bb
1418      return this.authoringTime;
1419    }
1420
1421    public boolean hasAuthoringTimeElement() { 
1422      return this.authoringTime != null && !this.authoringTime.isEmpty();
1423    }
1424
1425    public boolean hasAuthoringTime() { 
1426      return this.authoringTime != null && !this.authoringTime.isEmpty();
1427    }
1428
1429    /**
1430     * @param value {@link #authoringTime} (Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).). This is the underlying object with id, value and extensions. The accessor "getAuthoringTime" gives direct access to the value
1431     */
1432    public ImagingObjectSelection setAuthoringTimeElement(DateTimeType value) { 
1433      this.authoringTime = value;
1434      return this;
1435    }
1436
1437    /**
1438     * @return Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).
1439     */
1440    public Date getAuthoringTime() { 
1441      return this.authoringTime == null ? null : this.authoringTime.getValue();
1442    }
1443
1444    /**
1445     * @param value Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).
1446     */
1447    public ImagingObjectSelection setAuthoringTime(Date value) { 
1448      if (value == null)
1449        this.authoringTime = null;
1450      else {
1451        if (this.authoringTime == null)
1452          this.authoringTime = new DateTimeType();
1453        this.authoringTime.setValue(value);
1454      }
1455      return this;
1456    }
1457
1458    /**
1459     * @return {@link #study} (Study identity and locating information of the DICOM SOP instances in the selection.)
1460     */
1461    public List<StudyComponent> getStudy() { 
1462      if (this.study == null)
1463        this.study = new ArrayList<StudyComponent>();
1464      return this.study;
1465    }
1466
1467    public boolean hasStudy() { 
1468      if (this.study == null)
1469        return false;
1470      for (StudyComponent item : this.study)
1471        if (!item.isEmpty())
1472          return true;
1473      return false;
1474    }
1475
1476    /**
1477     * @return {@link #study} (Study identity and locating information of the DICOM SOP instances in the selection.)
1478     */
1479    // syntactic sugar
1480    public StudyComponent addStudy() { //3
1481      StudyComponent t = new StudyComponent();
1482      if (this.study == null)
1483        this.study = new ArrayList<StudyComponent>();
1484      this.study.add(t);
1485      return t;
1486    }
1487
1488    // syntactic sugar
1489    public ImagingObjectSelection addStudy(StudyComponent t) { //3
1490      if (t == null)
1491        return this;
1492      if (this.study == null)
1493        this.study = new ArrayList<StudyComponent>();
1494      this.study.add(t);
1495      return this;
1496    }
1497
1498      protected void listChildren(List<Property> childrenList) {
1499        super.listChildren(childrenList);
1500        childrenList.add(new Property("uid", "oid", "Instance UID of the DICOM KOS SOP Instances represented in this resource.", 0, java.lang.Integer.MAX_VALUE, uid));
1501        childrenList.add(new Property("patient", "Reference(Patient)", "A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingObjectSelection.", 0, java.lang.Integer.MAX_VALUE, patient));
1502        childrenList.add(new Property("title", "CodeableConcept", "The reason for, or significance of, the selection of objects referenced in the resource.", 0, java.lang.Integer.MAX_VALUE, title));
1503        childrenList.add(new Property("description", "string", "Text description of the DICOM SOP instances selected in the ImagingObjectSelection. This should be aligned with the content of the title element, and can provide further explanation of the SOP instances in the selection.", 0, java.lang.Integer.MAX_VALUE, description));
1504        childrenList.add(new Property("author", "Reference(Practitioner|Device|Organization|Patient|RelatedPerson)", "Author of ImagingObjectSelection. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.", 0, java.lang.Integer.MAX_VALUE, author));
1505        childrenList.add(new Property("authoringTime", "dateTime", "Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).", 0, java.lang.Integer.MAX_VALUE, authoringTime));
1506        childrenList.add(new Property("study", "", "Study identity and locating information of the DICOM SOP instances in the selection.", 0, java.lang.Integer.MAX_VALUE, study));
1507      }
1508
1509      @Override
1510      public void setProperty(String name, Base value) throws FHIRException {
1511        if (name.equals("uid"))
1512          this.uid = castToOid(value); // OidType
1513        else if (name.equals("patient"))
1514          this.patient = castToReference(value); // Reference
1515        else if (name.equals("title"))
1516          this.title = castToCodeableConcept(value); // CodeableConcept
1517        else if (name.equals("description"))
1518          this.description = castToString(value); // StringType
1519        else if (name.equals("author"))
1520          this.author = castToReference(value); // Reference
1521        else if (name.equals("authoringTime"))
1522          this.authoringTime = castToDateTime(value); // DateTimeType
1523        else if (name.equals("study"))
1524          this.getStudy().add((StudyComponent) value);
1525        else
1526          super.setProperty(name, value);
1527      }
1528
1529      @Override
1530      public Base addChild(String name) throws FHIRException {
1531        if (name.equals("uid")) {
1532          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.uid");
1533        }
1534        else if (name.equals("patient")) {
1535          this.patient = new Reference();
1536          return this.patient;
1537        }
1538        else if (name.equals("title")) {
1539          this.title = new CodeableConcept();
1540          return this.title;
1541        }
1542        else if (name.equals("description")) {
1543          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.description");
1544        }
1545        else if (name.equals("author")) {
1546          this.author = new Reference();
1547          return this.author;
1548        }
1549        else if (name.equals("authoringTime")) {
1550          throw new FHIRException("Cannot call addChild on a primitive type ImagingObjectSelection.authoringTime");
1551        }
1552        else if (name.equals("study")) {
1553          return addStudy();
1554        }
1555        else
1556          return super.addChild(name);
1557      }
1558
1559  public String fhirType() {
1560    return "ImagingObjectSelection";
1561
1562  }
1563
1564      public ImagingObjectSelection copy() {
1565        ImagingObjectSelection dst = new ImagingObjectSelection();
1566        copyValues(dst);
1567        dst.uid = uid == null ? null : uid.copy();
1568        dst.patient = patient == null ? null : patient.copy();
1569        dst.title = title == null ? null : title.copy();
1570        dst.description = description == null ? null : description.copy();
1571        dst.author = author == null ? null : author.copy();
1572        dst.authoringTime = authoringTime == null ? null : authoringTime.copy();
1573        if (study != null) {
1574          dst.study = new ArrayList<StudyComponent>();
1575          for (StudyComponent i : study)
1576            dst.study.add(i.copy());
1577        };
1578        return dst;
1579      }
1580
1581      protected ImagingObjectSelection typedCopy() {
1582        return copy();
1583      }
1584
1585      @Override
1586      public boolean equalsDeep(Base other) {
1587        if (!super.equalsDeep(other))
1588          return false;
1589        if (!(other instanceof ImagingObjectSelection))
1590          return false;
1591        ImagingObjectSelection o = (ImagingObjectSelection) other;
1592        return compareDeep(uid, o.uid, true) && compareDeep(patient, o.patient, true) && compareDeep(title, o.title, true)
1593           && compareDeep(description, o.description, true) && compareDeep(author, o.author, true) && compareDeep(authoringTime, o.authoringTime, true)
1594           && compareDeep(study, o.study, true);
1595      }
1596
1597      @Override
1598      public boolean equalsShallow(Base other) {
1599        if (!super.equalsShallow(other))
1600          return false;
1601        if (!(other instanceof ImagingObjectSelection))
1602          return false;
1603        ImagingObjectSelection o = (ImagingObjectSelection) other;
1604        return compareValues(uid, o.uid, true) && compareValues(description, o.description, true) && compareValues(authoringTime, o.authoringTime, true)
1605          ;
1606      }
1607
1608      public boolean isEmpty() {
1609        return super.isEmpty() && (uid == null || uid.isEmpty()) && (patient == null || patient.isEmpty())
1610           && (title == null || title.isEmpty()) && (description == null || description.isEmpty()) && (author == null || author.isEmpty())
1611           && (authoringTime == null || authoringTime.isEmpty()) && (study == null || study.isEmpty())
1612          ;
1613      }
1614
1615  @Override
1616  public ResourceType getResourceType() {
1617    return ResourceType.ImagingObjectSelection;
1618   }
1619
1620  @SearchParamDefinition(name="identifier", path="ImagingObjectSelection.uid", description="UID of key DICOM object selection", type="uri" )
1621  public static final String SP_IDENTIFIER = "identifier";
1622  @SearchParamDefinition(name="authoring-time", path="ImagingObjectSelection.authoringTime", description="Time of key DICOM object selection authoring", type="date" )
1623  public static final String SP_AUTHORINGTIME = "authoring-time";
1624  @SearchParamDefinition(name="selected-study", path="ImagingObjectSelection.study.uid", description="Study selected in key DICOM object selection", type="uri" )
1625  public static final String SP_SELECTEDSTUDY = "selected-study";
1626  @SearchParamDefinition(name="author", path="ImagingObjectSelection.author", description="Author of key DICOM object selection", type="reference" )
1627  public static final String SP_AUTHOR = "author";
1628  @SearchParamDefinition(name="patient", path="ImagingObjectSelection.patient", description="Subject of key DICOM object selection", type="reference" )
1629  public static final String SP_PATIENT = "patient";
1630  @SearchParamDefinition(name="title", path="ImagingObjectSelection.title", description="Title of key DICOM object selection", type="token" )
1631  public static final String SP_TITLE = "title";
1632
1633}
1634