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