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