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