001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * Representation of the content produced in a DICOM imaging study. A study
049 * comprises a set of series, each of which includes a set of Service-Object
050 * Pair Instances (SOP Instances - images or other data) acquired or produced in
051 * a common context. A series is of only one modality (e.g. X-ray, CT, MR,
052 * ultrasound), but a study may have multiple series of different modalities.
053 */
054@ResourceDef(name = "ImagingStudy", profile = "http://hl7.org/fhir/StructureDefinition/ImagingStudy")
055public class ImagingStudy extends DomainResource {
056
057  public enum ImagingStudyStatus {
058    /**
059     * The existence of the imaging study is registered, but there is nothing yet
060     * available.
061     */
062    REGISTERED,
063    /**
064     * At least one instance has been associated with this imaging study.
065     */
066    AVAILABLE,
067    /**
068     * The imaging study is unavailable because the imaging study was not started or
069     * not completed (also sometimes called "aborted").
070     */
071    CANCELLED,
072    /**
073     * The imaging study has been withdrawn following a previous final release. This
074     * electronic record should never have existed, though it is possible that
075     * real-world decisions were based on it. (If real-world activity has occurred,
076     * the status should be "cancelled" rather than "entered-in-error".).
077     */
078    ENTEREDINERROR,
079    /**
080     * The system does not know which of the status values currently applies for
081     * this request. Note: This concept is not to be used for "other" - one of the
082     * listed statuses is presumed to apply, it's just not known which one.
083     */
084    UNKNOWN,
085    /**
086     * added to help the parsers with the generic types
087     */
088    NULL;
089
090    public static ImagingStudyStatus fromCode(String codeString) throws FHIRException {
091      if (codeString == null || "".equals(codeString))
092        return null;
093      if ("registered".equals(codeString))
094        return REGISTERED;
095      if ("available".equals(codeString))
096        return AVAILABLE;
097      if ("cancelled".equals(codeString))
098        return CANCELLED;
099      if ("entered-in-error".equals(codeString))
100        return ENTEREDINERROR;
101      if ("unknown".equals(codeString))
102        return UNKNOWN;
103      if (Configuration.isAcceptInvalidEnums())
104        return null;
105      else
106        throw new FHIRException("Unknown ImagingStudyStatus code '" + codeString + "'");
107    }
108
109    public String toCode() {
110      switch (this) {
111      case REGISTERED:
112        return "registered";
113      case AVAILABLE:
114        return "available";
115      case CANCELLED:
116        return "cancelled";
117      case ENTEREDINERROR:
118        return "entered-in-error";
119      case UNKNOWN:
120        return "unknown";
121      case NULL:
122        return null;
123      default:
124        return "?";
125      }
126    }
127
128    public String getSystem() {
129      switch (this) {
130      case REGISTERED:
131        return "http://hl7.org/fhir/imagingstudy-status";
132      case AVAILABLE:
133        return "http://hl7.org/fhir/imagingstudy-status";
134      case CANCELLED:
135        return "http://hl7.org/fhir/imagingstudy-status";
136      case ENTEREDINERROR:
137        return "http://hl7.org/fhir/imagingstudy-status";
138      case UNKNOWN:
139        return "http://hl7.org/fhir/imagingstudy-status";
140      case NULL:
141        return null;
142      default:
143        return "?";
144      }
145    }
146
147    public String getDefinition() {
148      switch (this) {
149      case REGISTERED:
150        return "The existence of the imaging study is registered, but there is nothing yet available.";
151      case AVAILABLE:
152        return "At least one instance has been associated with this imaging study.";
153      case CANCELLED:
154        return "The imaging study is unavailable because the imaging study was not started or not completed (also sometimes called \"aborted\").";
155      case ENTEREDINERROR:
156        return "The imaging study has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
157      case UNKNOWN:
158        return "The system does not know which of the status values currently applies for this request. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
159      case NULL:
160        return null;
161      default:
162        return "?";
163      }
164    }
165
166    public String getDisplay() {
167      switch (this) {
168      case REGISTERED:
169        return "Registered";
170      case AVAILABLE:
171        return "Available";
172      case CANCELLED:
173        return "Cancelled";
174      case ENTEREDINERROR:
175        return "Entered in Error";
176      case UNKNOWN:
177        return "Unknown";
178      case NULL:
179        return null;
180      default:
181        return "?";
182      }
183    }
184  }
185
186  public static class ImagingStudyStatusEnumFactory implements EnumFactory<ImagingStudyStatus> {
187    public ImagingStudyStatus fromCode(String codeString) throws IllegalArgumentException {
188      if (codeString == null || "".equals(codeString))
189        if (codeString == null || "".equals(codeString))
190          return null;
191      if ("registered".equals(codeString))
192        return ImagingStudyStatus.REGISTERED;
193      if ("available".equals(codeString))
194        return ImagingStudyStatus.AVAILABLE;
195      if ("cancelled".equals(codeString))
196        return ImagingStudyStatus.CANCELLED;
197      if ("entered-in-error".equals(codeString))
198        return ImagingStudyStatus.ENTEREDINERROR;
199      if ("unknown".equals(codeString))
200        return ImagingStudyStatus.UNKNOWN;
201      throw new IllegalArgumentException("Unknown ImagingStudyStatus code '" + codeString + "'");
202    }
203
204    public Enumeration<ImagingStudyStatus> fromType(PrimitiveType<?> code) throws FHIRException {
205      if (code == null)
206        return null;
207      if (code.isEmpty())
208        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.NULL, code);
209      String codeString = code.asStringValue();
210      if (codeString == null || "".equals(codeString))
211        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.NULL, code);
212      if ("registered".equals(codeString))
213        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.REGISTERED, code);
214      if ("available".equals(codeString))
215        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.AVAILABLE, code);
216      if ("cancelled".equals(codeString))
217        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.CANCELLED, code);
218      if ("entered-in-error".equals(codeString))
219        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.ENTEREDINERROR, code);
220      if ("unknown".equals(codeString))
221        return new Enumeration<ImagingStudyStatus>(this, ImagingStudyStatus.UNKNOWN, code);
222      throw new FHIRException("Unknown ImagingStudyStatus code '" + codeString + "'");
223    }
224
225    public String toCode(ImagingStudyStatus code) {
226      if (code == ImagingStudyStatus.REGISTERED)
227        return "registered";
228      if (code == ImagingStudyStatus.AVAILABLE)
229        return "available";
230      if (code == ImagingStudyStatus.CANCELLED)
231        return "cancelled";
232      if (code == ImagingStudyStatus.ENTEREDINERROR)
233        return "entered-in-error";
234      if (code == ImagingStudyStatus.UNKNOWN)
235        return "unknown";
236      return "?";
237    }
238
239    public String toSystem(ImagingStudyStatus code) {
240      return code.getSystem();
241    }
242  }
243
244  @Block()
245  public static class ImagingStudySeriesComponent extends BackboneElement implements IBaseBackboneElement {
246    /**
247     * The DICOM Series Instance UID for the series.
248     */
249    @Child(name = "uid", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
250    @Description(shortDefinition = "DICOM Series Instance UID for the series", formalDefinition = "The DICOM Series Instance UID for the series.")
251    protected IdType uid;
252
253    /**
254     * The numeric identifier of this series in the study.
255     */
256    @Child(name = "number", type = {
257        UnsignedIntType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
258    @Description(shortDefinition = "Numeric identifier of this series", formalDefinition = "The numeric identifier of this series in the study.")
259    protected UnsignedIntType number;
260
261    /**
262     * The modality of this series sequence.
263     */
264    @Child(name = "modality", type = { Coding.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
265    @Description(shortDefinition = "The modality of the instances in the series", formalDefinition = "The modality of this series sequence.")
266    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html")
267    protected Coding modality;
268
269    /**
270     * A description of the series.
271     */
272    @Child(name = "description", type = {
273        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
274    @Description(shortDefinition = "A short human readable summary of the series", formalDefinition = "A description of the series.")
275    protected StringType description;
276
277    /**
278     * Number of SOP Instances in the Study. The value given may be larger than the
279     * number of instance elements this resource contains due to resource
280     * availability, security, or other factors. This element should be present if
281     * any instance elements are present.
282     */
283    @Child(name = "numberOfInstances", type = {
284        UnsignedIntType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
285    @Description(shortDefinition = "Number of Series Related Instances", formalDefinition = "Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.")
286    protected UnsignedIntType numberOfInstances;
287
288    /**
289     * The network service providing access (e.g., query, view, or retrieval) for
290     * this series. See implementation notes for information about using DICOM
291     * endpoints. A series-level endpoint, if present, has precedence over a
292     * study-level endpoint with the same Endpoint.connectionType.
293     */
294    @Child(name = "endpoint", type = {
295        Endpoint.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
296    @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.connectionType.")
297    protected List<Reference> endpoint;
298    /**
299     * The actual objects that are the target of the reference (The network service
300     * providing access (e.g., query, view, or retrieval) for this series. See
301     * implementation notes for information about using DICOM endpoints. A
302     * series-level endpoint, if present, has precedence over a study-level endpoint
303     * with the same Endpoint.connectionType.)
304     */
305    protected List<Endpoint> endpointTarget;
306
307    /**
308     * The anatomic structures examined. See DICOM Part 16 Annex L
309     * (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html)
310     * for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of
311     * body part imaged; if so, it shall be consistent with any content of
312     * ImagingStudy.series.laterality.
313     */
314    @Child(name = "bodySite", type = { Coding.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
315    @Description(shortDefinition = "Body part examined", formalDefinition = "The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.")
316    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/body-site")
317    protected Coding bodySite;
318
319    /**
320     * The laterality of the (possibly paired) anatomic structures examined. E.g.,
321     * the left knee, both lungs, or unpaired abdomen. If present, shall be
322     * consistent with any laterality information indicated in
323     * ImagingStudy.series.bodySite.
324     */
325    @Child(name = "laterality", type = { Coding.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
326    @Description(shortDefinition = "Body part laterality", formalDefinition = "The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.")
327    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/bodysite-laterality")
328    protected Coding laterality;
329
330    /**
331     * The specimen imaged, e.g., for whole slide imaging of a biopsy.
332     */
333    @Child(name = "specimen", type = {
334        Specimen.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
335    @Description(shortDefinition = "Specimen imaged", formalDefinition = "The specimen imaged, e.g., for whole slide imaging of a biopsy.")
336    protected List<Reference> specimen;
337    /**
338     * The actual objects that are the target of the reference (The specimen imaged,
339     * e.g., for whole slide imaging of a biopsy.)
340     */
341    protected List<Specimen> specimenTarget;
342
343    /**
344     * The date and time the series was started.
345     */
346    @Child(name = "started", type = {
347        DateTimeType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true)
348    @Description(shortDefinition = "When the series started", formalDefinition = "The date and time the series was started.")
349    protected DateTimeType started;
350
351    /**
352     * Indicates who or what performed the series and how they were involved.
353     */
354    @Child(name = "performer", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
355    @Description(shortDefinition = "Who performed the series", formalDefinition = "Indicates who or what performed the series and how they were involved.")
356    protected List<ImagingStudySeriesPerformerComponent> performer;
357
358    /**
359     * A single SOP instance within the series, e.g. an image, or presentation
360     * state.
361     */
362    @Child(name = "instance", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
363    @Description(shortDefinition = "A single SOP instance from the series", formalDefinition = "A single SOP instance within the series, e.g. an image, or presentation state.")
364    protected List<ImagingStudySeriesInstanceComponent> instance;
365
366    private static final long serialVersionUID = -11423429L;
367
368    /**
369     * Constructor
370     */
371    public ImagingStudySeriesComponent() {
372      super();
373    }
374
375    /**
376     * Constructor
377     */
378    public ImagingStudySeriesComponent(IdType uid, Coding modality) {
379      super();
380      this.uid = uid;
381      this.modality = modality;
382    }
383
384    /**
385     * @return {@link #uid} (The DICOM Series Instance UID for the series.). This is
386     *         the underlying object with id, value and extensions. The accessor
387     *         "getUid" gives direct access to the value
388     */
389    public IdType getUidElement() {
390      if (this.uid == null)
391        if (Configuration.errorOnAutoCreate())
392          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.uid");
393        else if (Configuration.doAutoCreate())
394          this.uid = new IdType(); // bb
395      return this.uid;
396    }
397
398    public boolean hasUidElement() {
399      return this.uid != null && !this.uid.isEmpty();
400    }
401
402    public boolean hasUid() {
403      return this.uid != null && !this.uid.isEmpty();
404    }
405
406    /**
407     * @param value {@link #uid} (The DICOM Series Instance UID for the series.).
408     *              This is the underlying object with id, value and extensions. The
409     *              accessor "getUid" gives direct access to the value
410     */
411    public ImagingStudySeriesComponent setUidElement(IdType value) {
412      this.uid = value;
413      return this;
414    }
415
416    /**
417     * @return The DICOM Series Instance UID for the series.
418     */
419    public String getUid() {
420      return this.uid == null ? null : this.uid.getValue();
421    }
422
423    /**
424     * @param value The DICOM Series Instance UID for the series.
425     */
426    public ImagingStudySeriesComponent setUid(String value) {
427      if (this.uid == null)
428        this.uid = new IdType();
429      this.uid.setValue(value);
430      return this;
431    }
432
433    /**
434     * @return {@link #number} (The numeric identifier of this series in the
435     *         study.). This is the underlying object with id, value and extensions.
436     *         The accessor "getNumber" gives direct access to the value
437     */
438    public UnsignedIntType getNumberElement() {
439      if (this.number == null)
440        if (Configuration.errorOnAutoCreate())
441          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.number");
442        else if (Configuration.doAutoCreate())
443          this.number = new UnsignedIntType(); // bb
444      return this.number;
445    }
446
447    public boolean hasNumberElement() {
448      return this.number != null && !this.number.isEmpty();
449    }
450
451    public boolean hasNumber() {
452      return this.number != null && !this.number.isEmpty();
453    }
454
455    /**
456     * @param value {@link #number} (The numeric identifier of this series in the
457     *              study.). This is the underlying object with id, value and
458     *              extensions. The accessor "getNumber" gives direct access to the
459     *              value
460     */
461    public ImagingStudySeriesComponent setNumberElement(UnsignedIntType value) {
462      this.number = value;
463      return this;
464    }
465
466    /**
467     * @return The numeric identifier of this series in the study.
468     */
469    public int getNumber() {
470      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
471    }
472
473    /**
474     * @param value The numeric identifier of this series in the study.
475     */
476    public ImagingStudySeriesComponent setNumber(int value) {
477      if (this.number == null)
478        this.number = new UnsignedIntType();
479      this.number.setValue(value);
480      return this;
481    }
482
483    /**
484     * @return {@link #modality} (The modality of this series sequence.)
485     */
486    public Coding getModality() {
487      if (this.modality == null)
488        if (Configuration.errorOnAutoCreate())
489          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.modality");
490        else if (Configuration.doAutoCreate())
491          this.modality = new Coding(); // cc
492      return this.modality;
493    }
494
495    public boolean hasModality() {
496      return this.modality != null && !this.modality.isEmpty();
497    }
498
499    /**
500     * @param value {@link #modality} (The modality of this series sequence.)
501     */
502    public ImagingStudySeriesComponent setModality(Coding value) {
503      this.modality = value;
504      return this;
505    }
506
507    /**
508     * @return {@link #description} (A description of the series.). This is the
509     *         underlying object with id, value and extensions. The accessor
510     *         "getDescription" gives direct access to the value
511     */
512    public StringType getDescriptionElement() {
513      if (this.description == null)
514        if (Configuration.errorOnAutoCreate())
515          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.description");
516        else if (Configuration.doAutoCreate())
517          this.description = new StringType(); // bb
518      return this.description;
519    }
520
521    public boolean hasDescriptionElement() {
522      return this.description != null && !this.description.isEmpty();
523    }
524
525    public boolean hasDescription() {
526      return this.description != null && !this.description.isEmpty();
527    }
528
529    /**
530     * @param value {@link #description} (A description of the series.). This is the
531     *              underlying object with id, value and extensions. The accessor
532     *              "getDescription" gives direct access to the value
533     */
534    public ImagingStudySeriesComponent setDescriptionElement(StringType value) {
535      this.description = value;
536      return this;
537    }
538
539    /**
540     * @return A description of the series.
541     */
542    public String getDescription() {
543      return this.description == null ? null : this.description.getValue();
544    }
545
546    /**
547     * @param value A description of the series.
548     */
549    public ImagingStudySeriesComponent setDescription(String value) {
550      if (Utilities.noString(value))
551        this.description = null;
552      else {
553        if (this.description == null)
554          this.description = new StringType();
555        this.description.setValue(value);
556      }
557      return this;
558    }
559
560    /**
561     * @return {@link #numberOfInstances} (Number of SOP Instances in the Study. The
562     *         value given may be larger than the number of instance elements this
563     *         resource contains due to resource availability, security, or other
564     *         factors. This element should be present if any instance elements are
565     *         present.). This is the underlying object with id, value and
566     *         extensions. The accessor "getNumberOfInstances" gives direct access
567     *         to the value
568     */
569    public UnsignedIntType getNumberOfInstancesElement() {
570      if (this.numberOfInstances == null)
571        if (Configuration.errorOnAutoCreate())
572          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.numberOfInstances");
573        else if (Configuration.doAutoCreate())
574          this.numberOfInstances = new UnsignedIntType(); // bb
575      return this.numberOfInstances;
576    }
577
578    public boolean hasNumberOfInstancesElement() {
579      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
580    }
581
582    public boolean hasNumberOfInstances() {
583      return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
584    }
585
586    /**
587     * @param value {@link #numberOfInstances} (Number of SOP Instances in the
588     *              Study. The value given may be larger than the number of instance
589     *              elements this resource contains due to resource availability,
590     *              security, or other factors. This element should be present if
591     *              any instance elements are present.). This is the underlying
592     *              object with id, value and extensions. The accessor
593     *              "getNumberOfInstances" gives direct access to the value
594     */
595    public ImagingStudySeriesComponent setNumberOfInstancesElement(UnsignedIntType value) {
596      this.numberOfInstances = value;
597      return this;
598    }
599
600    /**
601     * @return Number of SOP Instances in the Study. The value given may be larger
602     *         than the number of instance elements this resource contains due to
603     *         resource availability, security, or other factors. This element
604     *         should be present if any instance elements are present.
605     */
606    public int getNumberOfInstances() {
607      return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
608    }
609
610    /**
611     * @param value Number of SOP Instances in the Study. The value given may be
612     *              larger than the number of instance elements this resource
613     *              contains due to resource availability, security, or other
614     *              factors. This element should be present if any instance elements
615     *              are present.
616     */
617    public ImagingStudySeriesComponent setNumberOfInstances(int value) {
618      if (this.numberOfInstances == null)
619        this.numberOfInstances = new UnsignedIntType();
620      this.numberOfInstances.setValue(value);
621      return this;
622    }
623
624    /**
625     * @return {@link #endpoint} (The network service providing access (e.g., query,
626     *         view, or retrieval) for this series. See implementation notes for
627     *         information about using DICOM endpoints. A series-level endpoint, if
628     *         present, has precedence over a study-level endpoint with the same
629     *         Endpoint.connectionType.)
630     */
631    public List<Reference> getEndpoint() {
632      if (this.endpoint == null)
633        this.endpoint = new ArrayList<Reference>();
634      return this.endpoint;
635    }
636
637    /**
638     * @return Returns a reference to <code>this</code> for easy method chaining
639     */
640    public ImagingStudySeriesComponent setEndpoint(List<Reference> theEndpoint) {
641      this.endpoint = theEndpoint;
642      return this;
643    }
644
645    public boolean hasEndpoint() {
646      if (this.endpoint == null)
647        return false;
648      for (Reference item : this.endpoint)
649        if (!item.isEmpty())
650          return true;
651      return false;
652    }
653
654    public Reference addEndpoint() { // 3
655      Reference t = new Reference();
656      if (this.endpoint == null)
657        this.endpoint = new ArrayList<Reference>();
658      this.endpoint.add(t);
659      return t;
660    }
661
662    public ImagingStudySeriesComponent addEndpoint(Reference t) { // 3
663      if (t == null)
664        return this;
665      if (this.endpoint == null)
666        this.endpoint = new ArrayList<Reference>();
667      this.endpoint.add(t);
668      return this;
669    }
670
671    /**
672     * @return The first repetition of repeating field {@link #endpoint}, creating
673     *         it if it does not already exist
674     */
675    public Reference getEndpointFirstRep() {
676      if (getEndpoint().isEmpty()) {
677        addEndpoint();
678      }
679      return getEndpoint().get(0);
680    }
681
682    /**
683     * @deprecated Use Reference#setResource(IBaseResource) instead
684     */
685    @Deprecated
686    public List<Endpoint> getEndpointTarget() {
687      if (this.endpointTarget == null)
688        this.endpointTarget = new ArrayList<Endpoint>();
689      return this.endpointTarget;
690    }
691
692    /**
693     * @deprecated Use Reference#setResource(IBaseResource) instead
694     */
695    @Deprecated
696    public Endpoint addEndpointTarget() {
697      Endpoint r = new Endpoint();
698      if (this.endpointTarget == null)
699        this.endpointTarget = new ArrayList<Endpoint>();
700      this.endpointTarget.add(r);
701      return r;
702    }
703
704    /**
705     * @return {@link #bodySite} (The anatomic structures examined. See DICOM Part
706     *         16 Annex L
707     *         (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html)
708     *         for DICOM to SNOMED-CT mappings. The bodySite may indicate the
709     *         laterality of body part imaged; if so, it shall be consistent with
710     *         any content of ImagingStudy.series.laterality.)
711     */
712    public Coding getBodySite() {
713      if (this.bodySite == null)
714        if (Configuration.errorOnAutoCreate())
715          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.bodySite");
716        else if (Configuration.doAutoCreate())
717          this.bodySite = new Coding(); // cc
718      return this.bodySite;
719    }
720
721    public boolean hasBodySite() {
722      return this.bodySite != null && !this.bodySite.isEmpty();
723    }
724
725    /**
726     * @param value {@link #bodySite} (The anatomic structures examined. See DICOM
727     *              Part 16 Annex L
728     *              (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html)
729     *              for DICOM to SNOMED-CT mappings. The bodySite may indicate the
730     *              laterality of body part imaged; if so, it shall be consistent
731     *              with any content of ImagingStudy.series.laterality.)
732     */
733    public ImagingStudySeriesComponent setBodySite(Coding value) {
734      this.bodySite = value;
735      return this;
736    }
737
738    /**
739     * @return {@link #laterality} (The laterality of the (possibly paired) anatomic
740     *         structures examined. E.g., the left knee, both lungs, or unpaired
741     *         abdomen. If present, shall be consistent with any laterality
742     *         information indicated in ImagingStudy.series.bodySite.)
743     */
744    public Coding getLaterality() {
745      if (this.laterality == null)
746        if (Configuration.errorOnAutoCreate())
747          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.laterality");
748        else if (Configuration.doAutoCreate())
749          this.laterality = new Coding(); // cc
750      return this.laterality;
751    }
752
753    public boolean hasLaterality() {
754      return this.laterality != null && !this.laterality.isEmpty();
755    }
756
757    /**
758     * @param value {@link #laterality} (The laterality of the (possibly paired)
759     *              anatomic structures examined. E.g., the left knee, both lungs,
760     *              or unpaired abdomen. If present, shall be consistent with any
761     *              laterality information indicated in
762     *              ImagingStudy.series.bodySite.)
763     */
764    public ImagingStudySeriesComponent setLaterality(Coding value) {
765      this.laterality = value;
766      return this;
767    }
768
769    /**
770     * @return {@link #specimen} (The specimen imaged, e.g., for whole slide imaging
771     *         of a biopsy.)
772     */
773    public List<Reference> getSpecimen() {
774      if (this.specimen == null)
775        this.specimen = new ArrayList<Reference>();
776      return this.specimen;
777    }
778
779    /**
780     * @return Returns a reference to <code>this</code> for easy method chaining
781     */
782    public ImagingStudySeriesComponent setSpecimen(List<Reference> theSpecimen) {
783      this.specimen = theSpecimen;
784      return this;
785    }
786
787    public boolean hasSpecimen() {
788      if (this.specimen == null)
789        return false;
790      for (Reference item : this.specimen)
791        if (!item.isEmpty())
792          return true;
793      return false;
794    }
795
796    public Reference addSpecimen() { // 3
797      Reference t = new Reference();
798      if (this.specimen == null)
799        this.specimen = new ArrayList<Reference>();
800      this.specimen.add(t);
801      return t;
802    }
803
804    public ImagingStudySeriesComponent addSpecimen(Reference t) { // 3
805      if (t == null)
806        return this;
807      if (this.specimen == null)
808        this.specimen = new ArrayList<Reference>();
809      this.specimen.add(t);
810      return this;
811    }
812
813    /**
814     * @return The first repetition of repeating field {@link #specimen}, creating
815     *         it if it does not already exist
816     */
817    public Reference getSpecimenFirstRep() {
818      if (getSpecimen().isEmpty()) {
819        addSpecimen();
820      }
821      return getSpecimen().get(0);
822    }
823
824    /**
825     * @deprecated Use Reference#setResource(IBaseResource) instead
826     */
827    @Deprecated
828    public List<Specimen> getSpecimenTarget() {
829      if (this.specimenTarget == null)
830        this.specimenTarget = new ArrayList<Specimen>();
831      return this.specimenTarget;
832    }
833
834    /**
835     * @deprecated Use Reference#setResource(IBaseResource) instead
836     */
837    @Deprecated
838    public Specimen addSpecimenTarget() {
839      Specimen r = new Specimen();
840      if (this.specimenTarget == null)
841        this.specimenTarget = new ArrayList<Specimen>();
842      this.specimenTarget.add(r);
843      return r;
844    }
845
846    /**
847     * @return {@link #started} (The date and time the series was started.). This is
848     *         the underlying object with id, value and extensions. The accessor
849     *         "getStarted" gives direct access to the value
850     */
851    public DateTimeType getStartedElement() {
852      if (this.started == null)
853        if (Configuration.errorOnAutoCreate())
854          throw new Error("Attempt to auto-create ImagingStudySeriesComponent.started");
855        else if (Configuration.doAutoCreate())
856          this.started = new DateTimeType(); // bb
857      return this.started;
858    }
859
860    public boolean hasStartedElement() {
861      return this.started != null && !this.started.isEmpty();
862    }
863
864    public boolean hasStarted() {
865      return this.started != null && !this.started.isEmpty();
866    }
867
868    /**
869     * @param value {@link #started} (The date and time the series was started.).
870     *              This is the underlying object with id, value and extensions. The
871     *              accessor "getStarted" gives direct access to the value
872     */
873    public ImagingStudySeriesComponent setStartedElement(DateTimeType value) {
874      this.started = value;
875      return this;
876    }
877
878    /**
879     * @return The date and time the series was started.
880     */
881    public Date getStarted() {
882      return this.started == null ? null : this.started.getValue();
883    }
884
885    /**
886     * @param value The date and time the series was started.
887     */
888    public ImagingStudySeriesComponent setStarted(Date value) {
889      if (value == null)
890        this.started = null;
891      else {
892        if (this.started == null)
893          this.started = new DateTimeType();
894        this.started.setValue(value);
895      }
896      return this;
897    }
898
899    /**
900     * @return {@link #performer} (Indicates who or what performed the series and
901     *         how they were involved.)
902     */
903    public List<ImagingStudySeriesPerformerComponent> getPerformer() {
904      if (this.performer == null)
905        this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
906      return this.performer;
907    }
908
909    /**
910     * @return Returns a reference to <code>this</code> for easy method chaining
911     */
912    public ImagingStudySeriesComponent setPerformer(List<ImagingStudySeriesPerformerComponent> thePerformer) {
913      this.performer = thePerformer;
914      return this;
915    }
916
917    public boolean hasPerformer() {
918      if (this.performer == null)
919        return false;
920      for (ImagingStudySeriesPerformerComponent item : this.performer)
921        if (!item.isEmpty())
922          return true;
923      return false;
924    }
925
926    public ImagingStudySeriesPerformerComponent addPerformer() { // 3
927      ImagingStudySeriesPerformerComponent t = new ImagingStudySeriesPerformerComponent();
928      if (this.performer == null)
929        this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
930      this.performer.add(t);
931      return t;
932    }
933
934    public ImagingStudySeriesComponent addPerformer(ImagingStudySeriesPerformerComponent t) { // 3
935      if (t == null)
936        return this;
937      if (this.performer == null)
938        this.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
939      this.performer.add(t);
940      return this;
941    }
942
943    /**
944     * @return The first repetition of repeating field {@link #performer}, creating
945     *         it if it does not already exist
946     */
947    public ImagingStudySeriesPerformerComponent getPerformerFirstRep() {
948      if (getPerformer().isEmpty()) {
949        addPerformer();
950      }
951      return getPerformer().get(0);
952    }
953
954    /**
955     * @return {@link #instance} (A single SOP instance within the series, e.g. an
956     *         image, or presentation state.)
957     */
958    public List<ImagingStudySeriesInstanceComponent> getInstance() {
959      if (this.instance == null)
960        this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
961      return this.instance;
962    }
963
964    /**
965     * @return Returns a reference to <code>this</code> for easy method chaining
966     */
967    public ImagingStudySeriesComponent setInstance(List<ImagingStudySeriesInstanceComponent> theInstance) {
968      this.instance = theInstance;
969      return this;
970    }
971
972    public boolean hasInstance() {
973      if (this.instance == null)
974        return false;
975      for (ImagingStudySeriesInstanceComponent item : this.instance)
976        if (!item.isEmpty())
977          return true;
978      return false;
979    }
980
981    public ImagingStudySeriesInstanceComponent addInstance() { // 3
982      ImagingStudySeriesInstanceComponent t = new ImagingStudySeriesInstanceComponent();
983      if (this.instance == null)
984        this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
985      this.instance.add(t);
986      return t;
987    }
988
989    public ImagingStudySeriesComponent addInstance(ImagingStudySeriesInstanceComponent t) { // 3
990      if (t == null)
991        return this;
992      if (this.instance == null)
993        this.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
994      this.instance.add(t);
995      return this;
996    }
997
998    /**
999     * @return The first repetition of repeating field {@link #instance}, creating
1000     *         it if it does not already exist
1001     */
1002    public ImagingStudySeriesInstanceComponent getInstanceFirstRep() {
1003      if (getInstance().isEmpty()) {
1004        addInstance();
1005      }
1006      return getInstance().get(0);
1007    }
1008
1009    protected void listChildren(List<Property> children) {
1010      super.listChildren(children);
1011      children.add(new Property("uid", "id", "The DICOM Series Instance UID for the series.", 0, 1, uid));
1012      children.add(
1013          new Property("number", "unsignedInt", "The numeric identifier of this series in the study.", 0, 1, number));
1014      children.add(new Property("modality", "Coding", "The modality of this series sequence.", 0, 1, modality));
1015      children.add(new Property("description", "string", "A description of the series.", 0, 1, description));
1016      children.add(new Property("numberOfInstances", "unsignedInt",
1017          "Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.",
1018          0, 1, numberOfInstances));
1019      children.add(new Property("endpoint", "Reference(Endpoint)",
1020          "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.connectionType.",
1021          0, java.lang.Integer.MAX_VALUE, endpoint));
1022      children.add(new Property("bodySite", "Coding",
1023          "The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.",
1024          0, 1, bodySite));
1025      children.add(new Property("laterality", "Coding",
1026          "The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.",
1027          0, 1, laterality));
1028      children.add(new Property("specimen", "Reference(Specimen)",
1029          "The specimen imaged, e.g., for whole slide imaging of a biopsy.", 0, java.lang.Integer.MAX_VALUE, specimen));
1030      children.add(new Property("started", "dateTime", "The date and time the series was started.", 0, 1, started));
1031      children
1032          .add(new Property("performer", "", "Indicates who or what performed the series and how they were involved.",
1033              0, java.lang.Integer.MAX_VALUE, performer));
1034      children.add(
1035          new Property("instance", "", "A single SOP instance within the series, e.g. an image, or presentation state.",
1036              0, java.lang.Integer.MAX_VALUE, instance));
1037    }
1038
1039    @Override
1040    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1041      switch (_hash) {
1042      case 115792:
1043        /* uid */ return new Property("uid", "id", "The DICOM Series Instance UID for the series.", 0, 1, uid);
1044      case -1034364087:
1045        /* number */ return new Property("number", "unsignedInt", "The numeric identifier of this series in the study.",
1046            0, 1, number);
1047      case -622722335:
1048        /* modality */ return new Property("modality", "Coding", "The modality of this series sequence.", 0, 1,
1049            modality);
1050      case -1724546052:
1051        /* description */ return new Property("description", "string", "A description of the series.", 0, 1,
1052            description);
1053      case -1043544226:
1054        /* numberOfInstances */ return new Property("numberOfInstances", "unsignedInt",
1055            "Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.",
1056            0, 1, numberOfInstances);
1057      case 1741102485:
1058        /* endpoint */ return new Property("endpoint", "Reference(Endpoint)",
1059            "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.connectionType.",
1060            0, java.lang.Integer.MAX_VALUE, endpoint);
1061      case 1702620169:
1062        /* bodySite */ return new Property("bodySite", "Coding",
1063            "The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.",
1064            0, 1, bodySite);
1065      case -170291817:
1066        /* laterality */ return new Property("laterality", "Coding",
1067            "The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.",
1068            0, 1, laterality);
1069      case -2132868344:
1070        /* specimen */ return new Property("specimen", "Reference(Specimen)",
1071            "The specimen imaged, e.g., for whole slide imaging of a biopsy.", 0, java.lang.Integer.MAX_VALUE,
1072            specimen);
1073      case -1897185151:
1074        /* started */ return new Property("started", "dateTime", "The date and time the series was started.", 0, 1,
1075            started);
1076      case 481140686:
1077        /* performer */ return new Property("performer", "",
1078            "Indicates who or what performed the series and how they were involved.", 0, java.lang.Integer.MAX_VALUE,
1079            performer);
1080      case 555127957:
1081        /* instance */ return new Property("instance", "",
1082            "A single SOP instance within the series, e.g. an image, or presentation state.", 0,
1083            java.lang.Integer.MAX_VALUE, instance);
1084      default:
1085        return super.getNamedProperty(_hash, _name, _checkValid);
1086      }
1087
1088    }
1089
1090    @Override
1091    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1092      switch (hash) {
1093      case 115792:
1094        /* uid */ return this.uid == null ? new Base[0] : new Base[] { this.uid }; // IdType
1095      case -1034364087:
1096        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // UnsignedIntType
1097      case -622722335:
1098        /* modality */ return this.modality == null ? new Base[0] : new Base[] { this.modality }; // Coding
1099      case -1724546052:
1100        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
1101      case -1043544226:
1102        /* numberOfInstances */ return this.numberOfInstances == null ? new Base[0]
1103            : new Base[] { this.numberOfInstances }; // UnsignedIntType
1104      case 1741102485:
1105        /* endpoint */ return this.endpoint == null ? new Base[0]
1106            : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
1107      case 1702620169:
1108        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // Coding
1109      case -170291817:
1110        /* laterality */ return this.laterality == null ? new Base[0] : new Base[] { this.laterality }; // Coding
1111      case -2132868344:
1112        /* specimen */ return this.specimen == null ? new Base[0]
1113            : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
1114      case -1897185151:
1115        /* started */ return this.started == null ? new Base[0] : new Base[] { this.started }; // DateTimeType
1116      case 481140686:
1117        /* performer */ return this.performer == null ? new Base[0]
1118            : this.performer.toArray(new Base[this.performer.size()]); // ImagingStudySeriesPerformerComponent
1119      case 555127957:
1120        /* instance */ return this.instance == null ? new Base[0]
1121            : this.instance.toArray(new Base[this.instance.size()]); // ImagingStudySeriesInstanceComponent
1122      default:
1123        return super.getProperty(hash, name, checkValid);
1124      }
1125
1126    }
1127
1128    @Override
1129    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1130      switch (hash) {
1131      case 115792: // uid
1132        this.uid = castToId(value); // IdType
1133        return value;
1134      case -1034364087: // number
1135        this.number = castToUnsignedInt(value); // UnsignedIntType
1136        return value;
1137      case -622722335: // modality
1138        this.modality = castToCoding(value); // Coding
1139        return value;
1140      case -1724546052: // description
1141        this.description = castToString(value); // StringType
1142        return value;
1143      case -1043544226: // numberOfInstances
1144        this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
1145        return value;
1146      case 1741102485: // endpoint
1147        this.getEndpoint().add(castToReference(value)); // Reference
1148        return value;
1149      case 1702620169: // bodySite
1150        this.bodySite = castToCoding(value); // Coding
1151        return value;
1152      case -170291817: // laterality
1153        this.laterality = castToCoding(value); // Coding
1154        return value;
1155      case -2132868344: // specimen
1156        this.getSpecimen().add(castToReference(value)); // Reference
1157        return value;
1158      case -1897185151: // started
1159        this.started = castToDateTime(value); // DateTimeType
1160        return value;
1161      case 481140686: // performer
1162        this.getPerformer().add((ImagingStudySeriesPerformerComponent) value); // ImagingStudySeriesPerformerComponent
1163        return value;
1164      case 555127957: // instance
1165        this.getInstance().add((ImagingStudySeriesInstanceComponent) value); // ImagingStudySeriesInstanceComponent
1166        return value;
1167      default:
1168        return super.setProperty(hash, name, value);
1169      }
1170
1171    }
1172
1173    @Override
1174    public Base setProperty(String name, Base value) throws FHIRException {
1175      if (name.equals("uid")) {
1176        this.uid = castToId(value); // IdType
1177      } else if (name.equals("number")) {
1178        this.number = castToUnsignedInt(value); // UnsignedIntType
1179      } else if (name.equals("modality")) {
1180        this.modality = castToCoding(value); // Coding
1181      } else if (name.equals("description")) {
1182        this.description = castToString(value); // StringType
1183      } else if (name.equals("numberOfInstances")) {
1184        this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
1185      } else if (name.equals("endpoint")) {
1186        this.getEndpoint().add(castToReference(value));
1187      } else if (name.equals("bodySite")) {
1188        this.bodySite = castToCoding(value); // Coding
1189      } else if (name.equals("laterality")) {
1190        this.laterality = castToCoding(value); // Coding
1191      } else if (name.equals("specimen")) {
1192        this.getSpecimen().add(castToReference(value));
1193      } else if (name.equals("started")) {
1194        this.started = castToDateTime(value); // DateTimeType
1195      } else if (name.equals("performer")) {
1196        this.getPerformer().add((ImagingStudySeriesPerformerComponent) value);
1197      } else if (name.equals("instance")) {
1198        this.getInstance().add((ImagingStudySeriesInstanceComponent) value);
1199      } else
1200        return super.setProperty(name, value);
1201      return value;
1202    }
1203
1204  @Override
1205  public void removeChild(String name, Base value) throws FHIRException {
1206      if (name.equals("uid")) {
1207        this.uid = null;
1208      } else if (name.equals("number")) {
1209        this.number = null;
1210      } else if (name.equals("modality")) {
1211        this.modality = null;
1212      } else if (name.equals("description")) {
1213        this.description = null;
1214      } else if (name.equals("numberOfInstances")) {
1215        this.numberOfInstances = null;
1216      } else if (name.equals("endpoint")) {
1217        this.getEndpoint().remove(castToReference(value));
1218      } else if (name.equals("bodySite")) {
1219        this.bodySite = null;
1220      } else if (name.equals("laterality")) {
1221        this.laterality = null;
1222      } else if (name.equals("specimen")) {
1223        this.getSpecimen().remove(castToReference(value));
1224      } else if (name.equals("started")) {
1225        this.started = null;
1226      } else if (name.equals("performer")) {
1227        this.getPerformer().remove((ImagingStudySeriesPerformerComponent) value);
1228      } else if (name.equals("instance")) {
1229        this.getInstance().remove((ImagingStudySeriesInstanceComponent) value);
1230      } else
1231        super.removeChild(name, value);
1232      
1233    }
1234
1235    @Override
1236    public Base makeProperty(int hash, String name) throws FHIRException {
1237      switch (hash) {
1238      case 115792:
1239        return getUidElement();
1240      case -1034364087:
1241        return getNumberElement();
1242      case -622722335:
1243        return getModality();
1244      case -1724546052:
1245        return getDescriptionElement();
1246      case -1043544226:
1247        return getNumberOfInstancesElement();
1248      case 1741102485:
1249        return addEndpoint();
1250      case 1702620169:
1251        return getBodySite();
1252      case -170291817:
1253        return getLaterality();
1254      case -2132868344:
1255        return addSpecimen();
1256      case -1897185151:
1257        return getStartedElement();
1258      case 481140686:
1259        return addPerformer();
1260      case 555127957:
1261        return addInstance();
1262      default:
1263        return super.makeProperty(hash, name);
1264      }
1265
1266    }
1267
1268    @Override
1269    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1270      switch (hash) {
1271      case 115792:
1272        /* uid */ return new String[] { "id" };
1273      case -1034364087:
1274        /* number */ return new String[] { "unsignedInt" };
1275      case -622722335:
1276        /* modality */ return new String[] { "Coding" };
1277      case -1724546052:
1278        /* description */ return new String[] { "string" };
1279      case -1043544226:
1280        /* numberOfInstances */ return new String[] { "unsignedInt" };
1281      case 1741102485:
1282        /* endpoint */ return new String[] { "Reference" };
1283      case 1702620169:
1284        /* bodySite */ return new String[] { "Coding" };
1285      case -170291817:
1286        /* laterality */ return new String[] { "Coding" };
1287      case -2132868344:
1288        /* specimen */ return new String[] { "Reference" };
1289      case -1897185151:
1290        /* started */ return new String[] { "dateTime" };
1291      case 481140686:
1292        /* performer */ return new String[] {};
1293      case 555127957:
1294        /* instance */ return new String[] {};
1295      default:
1296        return super.getTypesForProperty(hash, name);
1297      }
1298
1299    }
1300
1301    @Override
1302    public Base addChild(String name) throws FHIRException {
1303      if (name.equals("uid")) {
1304        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.uid");
1305      } else if (name.equals("number")) {
1306        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.number");
1307      } else if (name.equals("modality")) {
1308        this.modality = new Coding();
1309        return this.modality;
1310      } else if (name.equals("description")) {
1311        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.description");
1312      } else if (name.equals("numberOfInstances")) {
1313        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.numberOfInstances");
1314      } else if (name.equals("endpoint")) {
1315        return addEndpoint();
1316      } else if (name.equals("bodySite")) {
1317        this.bodySite = new Coding();
1318        return this.bodySite;
1319      } else if (name.equals("laterality")) {
1320        this.laterality = new Coding();
1321        return this.laterality;
1322      } else if (name.equals("specimen")) {
1323        return addSpecimen();
1324      } else if (name.equals("started")) {
1325        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.started");
1326      } else if (name.equals("performer")) {
1327        return addPerformer();
1328      } else if (name.equals("instance")) {
1329        return addInstance();
1330      } else
1331        return super.addChild(name);
1332    }
1333
1334    public ImagingStudySeriesComponent copy() {
1335      ImagingStudySeriesComponent dst = new ImagingStudySeriesComponent();
1336      copyValues(dst);
1337      return dst;
1338    }
1339
1340    public void copyValues(ImagingStudySeriesComponent dst) {
1341      super.copyValues(dst);
1342      dst.uid = uid == null ? null : uid.copy();
1343      dst.number = number == null ? null : number.copy();
1344      dst.modality = modality == null ? null : modality.copy();
1345      dst.description = description == null ? null : description.copy();
1346      dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
1347      if (endpoint != null) {
1348        dst.endpoint = new ArrayList<Reference>();
1349        for (Reference i : endpoint)
1350          dst.endpoint.add(i.copy());
1351      }
1352      ;
1353      dst.bodySite = bodySite == null ? null : bodySite.copy();
1354      dst.laterality = laterality == null ? null : laterality.copy();
1355      if (specimen != null) {
1356        dst.specimen = new ArrayList<Reference>();
1357        for (Reference i : specimen)
1358          dst.specimen.add(i.copy());
1359      }
1360      ;
1361      dst.started = started == null ? null : started.copy();
1362      if (performer != null) {
1363        dst.performer = new ArrayList<ImagingStudySeriesPerformerComponent>();
1364        for (ImagingStudySeriesPerformerComponent i : performer)
1365          dst.performer.add(i.copy());
1366      }
1367      ;
1368      if (instance != null) {
1369        dst.instance = new ArrayList<ImagingStudySeriesInstanceComponent>();
1370        for (ImagingStudySeriesInstanceComponent i : instance)
1371          dst.instance.add(i.copy());
1372      }
1373      ;
1374    }
1375
1376    @Override
1377    public boolean equalsDeep(Base other_) {
1378      if (!super.equalsDeep(other_))
1379        return false;
1380      if (!(other_ instanceof ImagingStudySeriesComponent))
1381        return false;
1382      ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other_;
1383      return compareDeep(uid, o.uid, true) && compareDeep(number, o.number, true)
1384          && compareDeep(modality, o.modality, true) && compareDeep(description, o.description, true)
1385          && compareDeep(numberOfInstances, o.numberOfInstances, true) && compareDeep(endpoint, o.endpoint, true)
1386          && compareDeep(bodySite, o.bodySite, true) && compareDeep(laterality, o.laterality, true)
1387          && compareDeep(specimen, o.specimen, true) && compareDeep(started, o.started, true)
1388          && compareDeep(performer, o.performer, true) && compareDeep(instance, o.instance, true);
1389    }
1390
1391    @Override
1392    public boolean equalsShallow(Base other_) {
1393      if (!super.equalsShallow(other_))
1394        return false;
1395      if (!(other_ instanceof ImagingStudySeriesComponent))
1396        return false;
1397      ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other_;
1398      return compareValues(uid, o.uid, true) && compareValues(number, o.number, true)
1399          && compareValues(description, o.description, true)
1400          && compareValues(numberOfInstances, o.numberOfInstances, true) && compareValues(started, o.started, true);
1401    }
1402
1403    public boolean isEmpty() {
1404      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(uid, number, modality, description,
1405          numberOfInstances, endpoint, bodySite, laterality, specimen, started, performer, instance);
1406    }
1407
1408    public String fhirType() {
1409      return "ImagingStudy.series";
1410
1411    }
1412
1413  }
1414
1415  @Block()
1416  public static class ImagingStudySeriesPerformerComponent extends BackboneElement implements IBaseBackboneElement {
1417    /**
1418     * Distinguishes the type of involvement of the performer in the series.
1419     */
1420    @Child(name = "function", type = {
1421        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1422    @Description(shortDefinition = "Type of performance", formalDefinition = "Distinguishes the type of involvement of the performer in the series.")
1423    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/series-performer-function")
1424    protected CodeableConcept function;
1425
1426    /**
1427     * Indicates who or what performed the series.
1428     */
1429    @Child(name = "actor", type = { Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class,
1430        Patient.class, Device.class,
1431        RelatedPerson.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1432    @Description(shortDefinition = "Who performed the series", formalDefinition = "Indicates who or what performed the series.")
1433    protected Reference actor;
1434
1435    /**
1436     * The actual object that is the target of the reference (Indicates who or what
1437     * performed the series.)
1438     */
1439    protected Resource actorTarget;
1440
1441    private static final long serialVersionUID = 1424001049L;
1442
1443    /**
1444     * Constructor
1445     */
1446    public ImagingStudySeriesPerformerComponent() {
1447      super();
1448    }
1449
1450    /**
1451     * Constructor
1452     */
1453    public ImagingStudySeriesPerformerComponent(Reference actor) {
1454      super();
1455      this.actor = actor;
1456    }
1457
1458    /**
1459     * @return {@link #function} (Distinguishes the type of involvement of the
1460     *         performer in the series.)
1461     */
1462    public CodeableConcept getFunction() {
1463      if (this.function == null)
1464        if (Configuration.errorOnAutoCreate())
1465          throw new Error("Attempt to auto-create ImagingStudySeriesPerformerComponent.function");
1466        else if (Configuration.doAutoCreate())
1467          this.function = new CodeableConcept(); // cc
1468      return this.function;
1469    }
1470
1471    public boolean hasFunction() {
1472      return this.function != null && !this.function.isEmpty();
1473    }
1474
1475    /**
1476     * @param value {@link #function} (Distinguishes the type of involvement of the
1477     *              performer in the series.)
1478     */
1479    public ImagingStudySeriesPerformerComponent setFunction(CodeableConcept value) {
1480      this.function = value;
1481      return this;
1482    }
1483
1484    /**
1485     * @return {@link #actor} (Indicates who or what performed the series.)
1486     */
1487    public Reference getActor() {
1488      if (this.actor == null)
1489        if (Configuration.errorOnAutoCreate())
1490          throw new Error("Attempt to auto-create ImagingStudySeriesPerformerComponent.actor");
1491        else if (Configuration.doAutoCreate())
1492          this.actor = new Reference(); // cc
1493      return this.actor;
1494    }
1495
1496    public boolean hasActor() {
1497      return this.actor != null && !this.actor.isEmpty();
1498    }
1499
1500    /**
1501     * @param value {@link #actor} (Indicates who or what performed the series.)
1502     */
1503    public ImagingStudySeriesPerformerComponent setActor(Reference value) {
1504      this.actor = value;
1505      return this;
1506    }
1507
1508    /**
1509     * @return {@link #actor} The actual object that is the target of the reference.
1510     *         The reference library doesn't populate this, but you can use it to
1511     *         hold the resource if you resolve it. (Indicates who or what performed
1512     *         the series.)
1513     */
1514    public Resource getActorTarget() {
1515      return this.actorTarget;
1516    }
1517
1518    /**
1519     * @param value {@link #actor} The actual object that is the target of the
1520     *              reference. The reference library doesn't use these, but you can
1521     *              use it to hold the resource if you resolve it. (Indicates who or
1522     *              what performed the series.)
1523     */
1524    public ImagingStudySeriesPerformerComponent setActorTarget(Resource value) {
1525      this.actorTarget = value;
1526      return this;
1527    }
1528
1529    protected void listChildren(List<Property> children) {
1530      super.listChildren(children);
1531      children.add(new Property("function", "CodeableConcept",
1532          "Distinguishes the type of involvement of the performer in the series.", 0, 1, function));
1533      children.add(new Property("actor",
1534          "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)",
1535          "Indicates who or what performed the series.", 0, 1, actor));
1536    }
1537
1538    @Override
1539    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1540      switch (_hash) {
1541      case 1380938712:
1542        /* function */ return new Property("function", "CodeableConcept",
1543            "Distinguishes the type of involvement of the performer in the series.", 0, 1, function);
1544      case 92645877:
1545        /* actor */ return new Property("actor",
1546            "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)",
1547            "Indicates who or what performed the series.", 0, 1, actor);
1548      default:
1549        return super.getNamedProperty(_hash, _name, _checkValid);
1550      }
1551
1552    }
1553
1554    @Override
1555    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1556      switch (hash) {
1557      case 1380938712:
1558        /* function */ return this.function == null ? new Base[0] : new Base[] { this.function }; // CodeableConcept
1559      case 92645877:
1560        /* actor */ return this.actor == null ? new Base[0] : new Base[] { this.actor }; // Reference
1561      default:
1562        return super.getProperty(hash, name, checkValid);
1563      }
1564
1565    }
1566
1567    @Override
1568    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1569      switch (hash) {
1570      case 1380938712: // function
1571        this.function = castToCodeableConcept(value); // CodeableConcept
1572        return value;
1573      case 92645877: // actor
1574        this.actor = castToReference(value); // Reference
1575        return value;
1576      default:
1577        return super.setProperty(hash, name, value);
1578      }
1579
1580    }
1581
1582    @Override
1583    public Base setProperty(String name, Base value) throws FHIRException {
1584      if (name.equals("function")) {
1585        this.function = castToCodeableConcept(value); // CodeableConcept
1586      } else if (name.equals("actor")) {
1587        this.actor = castToReference(value); // Reference
1588      } else
1589        return super.setProperty(name, value);
1590      return value;
1591    }
1592
1593  @Override
1594  public void removeChild(String name, Base value) throws FHIRException {
1595      if (name.equals("function")) {
1596        this.function = null;
1597      } else if (name.equals("actor")) {
1598        this.actor = null;
1599      } else
1600        super.removeChild(name, value);
1601      
1602    }
1603
1604    @Override
1605    public Base makeProperty(int hash, String name) throws FHIRException {
1606      switch (hash) {
1607      case 1380938712:
1608        return getFunction();
1609      case 92645877:
1610        return getActor();
1611      default:
1612        return super.makeProperty(hash, name);
1613      }
1614
1615    }
1616
1617    @Override
1618    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1619      switch (hash) {
1620      case 1380938712:
1621        /* function */ return new String[] { "CodeableConcept" };
1622      case 92645877:
1623        /* actor */ return new String[] { "Reference" };
1624      default:
1625        return super.getTypesForProperty(hash, name);
1626      }
1627
1628    }
1629
1630    @Override
1631    public Base addChild(String name) throws FHIRException {
1632      if (name.equals("function")) {
1633        this.function = new CodeableConcept();
1634        return this.function;
1635      } else if (name.equals("actor")) {
1636        this.actor = new Reference();
1637        return this.actor;
1638      } else
1639        return super.addChild(name);
1640    }
1641
1642    public ImagingStudySeriesPerformerComponent copy() {
1643      ImagingStudySeriesPerformerComponent dst = new ImagingStudySeriesPerformerComponent();
1644      copyValues(dst);
1645      return dst;
1646    }
1647
1648    public void copyValues(ImagingStudySeriesPerformerComponent dst) {
1649      super.copyValues(dst);
1650      dst.function = function == null ? null : function.copy();
1651      dst.actor = actor == null ? null : actor.copy();
1652    }
1653
1654    @Override
1655    public boolean equalsDeep(Base other_) {
1656      if (!super.equalsDeep(other_))
1657        return false;
1658      if (!(other_ instanceof ImagingStudySeriesPerformerComponent))
1659        return false;
1660      ImagingStudySeriesPerformerComponent o = (ImagingStudySeriesPerformerComponent) other_;
1661      return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
1662    }
1663
1664    @Override
1665    public boolean equalsShallow(Base other_) {
1666      if (!super.equalsShallow(other_))
1667        return false;
1668      if (!(other_ instanceof ImagingStudySeriesPerformerComponent))
1669        return false;
1670      ImagingStudySeriesPerformerComponent o = (ImagingStudySeriesPerformerComponent) other_;
1671      return true;
1672    }
1673
1674    public boolean isEmpty() {
1675      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
1676    }
1677
1678    public String fhirType() {
1679      return "ImagingStudy.series.performer";
1680
1681    }
1682
1683  }
1684
1685  @Block()
1686  public static class ImagingStudySeriesInstanceComponent extends BackboneElement implements IBaseBackboneElement {
1687    /**
1688     * The DICOM SOP Instance UID for this image or other DICOM content.
1689     */
1690    @Child(name = "uid", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1691    @Description(shortDefinition = "DICOM SOP Instance UID", formalDefinition = "The DICOM SOP Instance UID for this image or other DICOM content.")
1692    protected IdType uid;
1693
1694    /**
1695     * DICOM instance type.
1696     */
1697    @Child(name = "sopClass", type = { Coding.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1698    @Description(shortDefinition = "DICOM class type", formalDefinition = "DICOM instance  type.")
1699    protected Coding sopClass;
1700
1701    /**
1702     * The number of instance in the series.
1703     */
1704    @Child(name = "number", type = {
1705        UnsignedIntType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1706    @Description(shortDefinition = "The number of this instance in the series", formalDefinition = "The number of instance in the series.")
1707    protected UnsignedIntType number;
1708
1709    /**
1710     * The description of the instance.
1711     */
1712    @Child(name = "title", type = { StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1713    @Description(shortDefinition = "Description of instance", formalDefinition = "The description of the instance.")
1714    protected StringType title;
1715
1716    private static final long serialVersionUID = -888152445L;
1717
1718    /**
1719     * Constructor
1720     */
1721    public ImagingStudySeriesInstanceComponent() {
1722      super();
1723    }
1724
1725    /**
1726     * Constructor
1727     */
1728    public ImagingStudySeriesInstanceComponent(IdType uid, Coding sopClass) {
1729      super();
1730      this.uid = uid;
1731      this.sopClass = sopClass;
1732    }
1733
1734    /**
1735     * @return {@link #uid} (The DICOM SOP Instance UID for this image or other
1736     *         DICOM content.). This is the underlying object with id, value and
1737     *         extensions. The accessor "getUid" gives direct access to the value
1738     */
1739    public IdType getUidElement() {
1740      if (this.uid == null)
1741        if (Configuration.errorOnAutoCreate())
1742          throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.uid");
1743        else if (Configuration.doAutoCreate())
1744          this.uid = new IdType(); // bb
1745      return this.uid;
1746    }
1747
1748    public boolean hasUidElement() {
1749      return this.uid != null && !this.uid.isEmpty();
1750    }
1751
1752    public boolean hasUid() {
1753      return this.uid != null && !this.uid.isEmpty();
1754    }
1755
1756    /**
1757     * @param value {@link #uid} (The DICOM SOP Instance UID for this image or other
1758     *              DICOM content.). This is the underlying object with id, value
1759     *              and extensions. The accessor "getUid" gives direct access to the
1760     *              value
1761     */
1762    public ImagingStudySeriesInstanceComponent setUidElement(IdType value) {
1763      this.uid = value;
1764      return this;
1765    }
1766
1767    /**
1768     * @return The DICOM SOP Instance UID for this image or other DICOM content.
1769     */
1770    public String getUid() {
1771      return this.uid == null ? null : this.uid.getValue();
1772    }
1773
1774    /**
1775     * @param value The DICOM SOP Instance UID for this image or other DICOM
1776     *              content.
1777     */
1778    public ImagingStudySeriesInstanceComponent setUid(String value) {
1779      if (this.uid == null)
1780        this.uid = new IdType();
1781      this.uid.setValue(value);
1782      return this;
1783    }
1784
1785    /**
1786     * @return {@link #sopClass} (DICOM instance type.)
1787     */
1788    public Coding getSopClass() {
1789      if (this.sopClass == null)
1790        if (Configuration.errorOnAutoCreate())
1791          throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.sopClass");
1792        else if (Configuration.doAutoCreate())
1793          this.sopClass = new Coding(); // cc
1794      return this.sopClass;
1795    }
1796
1797    public boolean hasSopClass() {
1798      return this.sopClass != null && !this.sopClass.isEmpty();
1799    }
1800
1801    /**
1802     * @param value {@link #sopClass} (DICOM instance type.)
1803     */
1804    public ImagingStudySeriesInstanceComponent setSopClass(Coding value) {
1805      this.sopClass = value;
1806      return this;
1807    }
1808
1809    /**
1810     * @return {@link #number} (The number of instance in the series.). This is the
1811     *         underlying object with id, value and extensions. The accessor
1812     *         "getNumber" gives direct access to the value
1813     */
1814    public UnsignedIntType getNumberElement() {
1815      if (this.number == null)
1816        if (Configuration.errorOnAutoCreate())
1817          throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.number");
1818        else if (Configuration.doAutoCreate())
1819          this.number = new UnsignedIntType(); // bb
1820      return this.number;
1821    }
1822
1823    public boolean hasNumberElement() {
1824      return this.number != null && !this.number.isEmpty();
1825    }
1826
1827    public boolean hasNumber() {
1828      return this.number != null && !this.number.isEmpty();
1829    }
1830
1831    /**
1832     * @param value {@link #number} (The number of instance in the series.). This is
1833     *              the underlying object with id, value and extensions. The
1834     *              accessor "getNumber" gives direct access to the value
1835     */
1836    public ImagingStudySeriesInstanceComponent setNumberElement(UnsignedIntType value) {
1837      this.number = value;
1838      return this;
1839    }
1840
1841    /**
1842     * @return The number of instance in the series.
1843     */
1844    public int getNumber() {
1845      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
1846    }
1847
1848    /**
1849     * @param value The number of instance in the series.
1850     */
1851    public ImagingStudySeriesInstanceComponent setNumber(int value) {
1852      if (this.number == null)
1853        this.number = new UnsignedIntType();
1854      this.number.setValue(value);
1855      return this;
1856    }
1857
1858    /**
1859     * @return {@link #title} (The description of the instance.). This is the
1860     *         underlying object with id, value and extensions. The accessor
1861     *         "getTitle" gives direct access to the value
1862     */
1863    public StringType getTitleElement() {
1864      if (this.title == null)
1865        if (Configuration.errorOnAutoCreate())
1866          throw new Error("Attempt to auto-create ImagingStudySeriesInstanceComponent.title");
1867        else if (Configuration.doAutoCreate())
1868          this.title = new StringType(); // bb
1869      return this.title;
1870    }
1871
1872    public boolean hasTitleElement() {
1873      return this.title != null && !this.title.isEmpty();
1874    }
1875
1876    public boolean hasTitle() {
1877      return this.title != null && !this.title.isEmpty();
1878    }
1879
1880    /**
1881     * @param value {@link #title} (The description of the instance.). This is the
1882     *              underlying object with id, value and extensions. The accessor
1883     *              "getTitle" gives direct access to the value
1884     */
1885    public ImagingStudySeriesInstanceComponent setTitleElement(StringType value) {
1886      this.title = value;
1887      return this;
1888    }
1889
1890    /**
1891     * @return The description of the instance.
1892     */
1893    public String getTitle() {
1894      return this.title == null ? null : this.title.getValue();
1895    }
1896
1897    /**
1898     * @param value The description of the instance.
1899     */
1900    public ImagingStudySeriesInstanceComponent setTitle(String value) {
1901      if (Utilities.noString(value))
1902        this.title = null;
1903      else {
1904        if (this.title == null)
1905          this.title = new StringType();
1906        this.title.setValue(value);
1907      }
1908      return this;
1909    }
1910
1911    protected void listChildren(List<Property> children) {
1912      super.listChildren(children);
1913      children.add(
1914          new Property("uid", "id", "The DICOM SOP Instance UID for this image or other DICOM content.", 0, 1, uid));
1915      children.add(new Property("sopClass", "Coding", "DICOM instance  type.", 0, 1, sopClass));
1916      children.add(new Property("number", "unsignedInt", "The number of instance in the series.", 0, 1, number));
1917      children.add(new Property("title", "string", "The description of the instance.", 0, 1, title));
1918    }
1919
1920    @Override
1921    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1922      switch (_hash) {
1923      case 115792:
1924        /* uid */ return new Property("uid", "id", "The DICOM SOP Instance UID for this image or other DICOM content.",
1925            0, 1, uid);
1926      case 1560041540:
1927        /* sopClass */ return new Property("sopClass", "Coding", "DICOM instance  type.", 0, 1, sopClass);
1928      case -1034364087:
1929        /* number */ return new Property("number", "unsignedInt", "The number of instance in the series.", 0, 1,
1930            number);
1931      case 110371416:
1932        /* title */ return new Property("title", "string", "The description of the instance.", 0, 1, title);
1933      default:
1934        return super.getNamedProperty(_hash, _name, _checkValid);
1935      }
1936
1937    }
1938
1939    @Override
1940    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1941      switch (hash) {
1942      case 115792:
1943        /* uid */ return this.uid == null ? new Base[0] : new Base[] { this.uid }; // IdType
1944      case 1560041540:
1945        /* sopClass */ return this.sopClass == null ? new Base[0] : new Base[] { this.sopClass }; // Coding
1946      case -1034364087:
1947        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // UnsignedIntType
1948      case 110371416:
1949        /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
1950      default:
1951        return super.getProperty(hash, name, checkValid);
1952      }
1953
1954    }
1955
1956    @Override
1957    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1958      switch (hash) {
1959      case 115792: // uid
1960        this.uid = castToId(value); // IdType
1961        return value;
1962      case 1560041540: // sopClass
1963        this.sopClass = castToCoding(value); // Coding
1964        return value;
1965      case -1034364087: // number
1966        this.number = castToUnsignedInt(value); // UnsignedIntType
1967        return value;
1968      case 110371416: // title
1969        this.title = castToString(value); // StringType
1970        return value;
1971      default:
1972        return super.setProperty(hash, name, value);
1973      }
1974
1975    }
1976
1977    @Override
1978    public Base setProperty(String name, Base value) throws FHIRException {
1979      if (name.equals("uid")) {
1980        this.uid = castToId(value); // IdType
1981      } else if (name.equals("sopClass")) {
1982        this.sopClass = castToCoding(value); // Coding
1983      } else if (name.equals("number")) {
1984        this.number = castToUnsignedInt(value); // UnsignedIntType
1985      } else if (name.equals("title")) {
1986        this.title = castToString(value); // StringType
1987      } else
1988        return super.setProperty(name, value);
1989      return value;
1990    }
1991
1992  @Override
1993  public void removeChild(String name, Base value) throws FHIRException {
1994      if (name.equals("uid")) {
1995        this.uid = null;
1996      } else if (name.equals("sopClass")) {
1997        this.sopClass = null;
1998      } else if (name.equals("number")) {
1999        this.number = null;
2000      } else if (name.equals("title")) {
2001        this.title = null;
2002      } else
2003        super.removeChild(name, value);
2004      
2005    }
2006
2007    @Override
2008    public Base makeProperty(int hash, String name) throws FHIRException {
2009      switch (hash) {
2010      case 115792:
2011        return getUidElement();
2012      case 1560041540:
2013        return getSopClass();
2014      case -1034364087:
2015        return getNumberElement();
2016      case 110371416:
2017        return getTitleElement();
2018      default:
2019        return super.makeProperty(hash, name);
2020      }
2021
2022    }
2023
2024    @Override
2025    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2026      switch (hash) {
2027      case 115792:
2028        /* uid */ return new String[] { "id" };
2029      case 1560041540:
2030        /* sopClass */ return new String[] { "Coding" };
2031      case -1034364087:
2032        /* number */ return new String[] { "unsignedInt" };
2033      case 110371416:
2034        /* title */ return new String[] { "string" };
2035      default:
2036        return super.getTypesForProperty(hash, name);
2037      }
2038
2039    }
2040
2041    @Override
2042    public Base addChild(String name) throws FHIRException {
2043      if (name.equals("uid")) {
2044        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.uid");
2045      } else if (name.equals("sopClass")) {
2046        this.sopClass = new Coding();
2047        return this.sopClass;
2048      } else if (name.equals("number")) {
2049        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.number");
2050      } else if (name.equals("title")) {
2051        throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.title");
2052      } else
2053        return super.addChild(name);
2054    }
2055
2056    public ImagingStudySeriesInstanceComponent copy() {
2057      ImagingStudySeriesInstanceComponent dst = new ImagingStudySeriesInstanceComponent();
2058      copyValues(dst);
2059      return dst;
2060    }
2061
2062    public void copyValues(ImagingStudySeriesInstanceComponent dst) {
2063      super.copyValues(dst);
2064      dst.uid = uid == null ? null : uid.copy();
2065      dst.sopClass = sopClass == null ? null : sopClass.copy();
2066      dst.number = number == null ? null : number.copy();
2067      dst.title = title == null ? null : title.copy();
2068    }
2069
2070    @Override
2071    public boolean equalsDeep(Base other_) {
2072      if (!super.equalsDeep(other_))
2073        return false;
2074      if (!(other_ instanceof ImagingStudySeriesInstanceComponent))
2075        return false;
2076      ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other_;
2077      return compareDeep(uid, o.uid, true) && compareDeep(sopClass, o.sopClass, true)
2078          && compareDeep(number, o.number, true) && compareDeep(title, o.title, true);
2079    }
2080
2081    @Override
2082    public boolean equalsShallow(Base other_) {
2083      if (!super.equalsShallow(other_))
2084        return false;
2085      if (!(other_ instanceof ImagingStudySeriesInstanceComponent))
2086        return false;
2087      ImagingStudySeriesInstanceComponent o = (ImagingStudySeriesInstanceComponent) other_;
2088      return compareValues(uid, o.uid, true) && compareValues(number, o.number, true)
2089          && compareValues(title, o.title, true);
2090    }
2091
2092    public boolean isEmpty() {
2093      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(uid, sopClass, number, title);
2094    }
2095
2096    public String fhirType() {
2097      return "ImagingStudy.series.instance";
2098
2099    }
2100
2101  }
2102
2103  /**
2104   * Identifiers for the ImagingStudy such as DICOM Study Instance UID, and
2105   * Accession Number.
2106   */
2107  @Child(name = "identifier", type = {
2108      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2109  @Description(shortDefinition = "Identifiers for the whole study", formalDefinition = "Identifiers for the ImagingStudy such as DICOM Study Instance UID, and Accession Number.")
2110  protected List<Identifier> identifier;
2111
2112  /**
2113   * The current state of the ImagingStudy.
2114   */
2115  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
2116  @Description(shortDefinition = "registered | available | cancelled | entered-in-error | unknown", formalDefinition = "The current state of the ImagingStudy.")
2117  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/imagingstudy-status")
2118  protected Enumeration<ImagingStudyStatus> status;
2119
2120  /**
2121   * A list of all the series.modality values that are actual acquisition
2122   * modalities, i.e. those in the DICOM Context Group 29 (value set OID
2123   * 1.2.840.10008.6.1.19).
2124   */
2125  @Child(name = "modality", type = {
2126      Coding.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2127  @Description(shortDefinition = "All series modality if actual acquisition modalities", formalDefinition = "A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).")
2128  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html")
2129  protected List<Coding> modality;
2130
2131  /**
2132   * The subject, typically a patient, of the imaging study.
2133   */
2134  @Child(name = "subject", type = { Patient.class, Device.class,
2135      Group.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
2136  @Description(shortDefinition = "Who or what is the subject of the study", formalDefinition = "The subject, typically a patient, of the imaging study.")
2137  protected Reference subject;
2138
2139  /**
2140   * The actual object that is the target of the reference (The subject, typically
2141   * a patient, of the imaging study.)
2142   */
2143  protected Resource subjectTarget;
2144
2145  /**
2146   * The healthcare event (e.g. a patient and healthcare provider interaction)
2147   * during which this ImagingStudy is made.
2148   */
2149  @Child(name = "encounter", type = { Encounter.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2150  @Description(shortDefinition = "Encounter with which this imaging study is associated", formalDefinition = "The healthcare event (e.g. a patient and healthcare provider interaction) during which this ImagingStudy is made.")
2151  protected Reference encounter;
2152
2153  /**
2154   * The actual object that is the target of the reference (The healthcare event
2155   * (e.g. a patient and healthcare provider interaction) during which this
2156   * ImagingStudy is made.)
2157   */
2158  protected Encounter encounterTarget;
2159
2160  /**
2161   * Date and time the study started.
2162   */
2163  @Child(name = "started", type = { DateTimeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
2164  @Description(shortDefinition = "When the study was started", formalDefinition = "Date and time the study started.")
2165  protected DateTimeType started;
2166
2167  /**
2168   * A list of the diagnostic requests that resulted in this imaging study being
2169   * performed.
2170   */
2171  @Child(name = "basedOn", type = { CarePlan.class, ServiceRequest.class, Appointment.class, AppointmentResponse.class,
2172      Task.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2173  @Description(shortDefinition = "Request fulfilled", formalDefinition = "A list of the diagnostic requests that resulted in this imaging study being performed.")
2174  protected List<Reference> basedOn;
2175  /**
2176   * The actual objects that are the target of the reference (A list of the
2177   * diagnostic requests that resulted in this imaging study being performed.)
2178   */
2179  protected List<Resource> basedOnTarget;
2180
2181  /**
2182   * The requesting/referring physician.
2183   */
2184  @Child(name = "referrer", type = { Practitioner.class,
2185      PractitionerRole.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
2186  @Description(shortDefinition = "Referring physician", formalDefinition = "The requesting/referring physician.")
2187  protected Reference referrer;
2188
2189  /**
2190   * The actual object that is the target of the reference (The
2191   * requesting/referring physician.)
2192   */
2193  protected Resource referrerTarget;
2194
2195  /**
2196   * Who read the study and interpreted the images or other content.
2197   */
2198  @Child(name = "interpreter", type = { Practitioner.class,
2199      PractitionerRole.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2200  @Description(shortDefinition = "Who interpreted images", formalDefinition = "Who read the study and interpreted the images or other content.")
2201  protected List<Reference> interpreter;
2202  /**
2203   * The actual objects that are the target of the reference (Who read the study
2204   * and interpreted the images or other content.)
2205   */
2206  protected List<Resource> interpreterTarget;
2207
2208  /**
2209   * The network service providing access (e.g., query, view, or retrieval) for
2210   * the study. See implementation notes for information about using DICOM
2211   * endpoints. A study-level endpoint applies to each series in the study, unless
2212   * overridden by a series-level endpoint with the same Endpoint.connectionType.
2213   */
2214  @Child(name = "endpoint", type = {
2215      Endpoint.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2216  @Description(shortDefinition = "Study access 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.connectionType.")
2217  protected List<Reference> endpoint;
2218  /**
2219   * The actual objects that are the target of the reference (The network service
2220   * providing access (e.g., query, view, or retrieval) for the study. See
2221   * implementation notes for information about using DICOM endpoints. A
2222   * study-level endpoint applies to each series in the study, unless overridden
2223   * by a series-level endpoint with the same Endpoint.connectionType.)
2224   */
2225  protected List<Endpoint> endpointTarget;
2226
2227  /**
2228   * Number of Series in the Study. This value given may be larger than the number
2229   * of series elements this Resource contains due to resource availability,
2230   * security, or other factors. This element should be present if any series
2231   * elements are present.
2232   */
2233  @Child(name = "numberOfSeries", type = {
2234      UnsignedIntType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true)
2235  @Description(shortDefinition = "Number of Study Related Series", formalDefinition = "Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.")
2236  protected UnsignedIntType numberOfSeries;
2237
2238  /**
2239   * Number of SOP Instances in Study. This value given may be larger than the
2240   * number of instance elements this resource contains due to resource
2241   * availability, security, or other factors. This element should be present if
2242   * any instance elements are present.
2243   */
2244  @Child(name = "numberOfInstances", type = {
2245      UnsignedIntType.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
2246  @Description(shortDefinition = "Number of Study Related Instances", formalDefinition = "Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.")
2247  protected UnsignedIntType numberOfInstances;
2248
2249  /**
2250   * The procedure which this ImagingStudy was part of.
2251   */
2252  @Child(name = "procedureReference", type = {
2253      Procedure.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
2254  @Description(shortDefinition = "The performed Procedure reference", formalDefinition = "The procedure which this ImagingStudy was part of.")
2255  protected Reference procedureReference;
2256
2257  /**
2258   * The actual object that is the target of the reference (The procedure which
2259   * this ImagingStudy was part of.)
2260   */
2261  protected Procedure procedureReferenceTarget;
2262
2263  /**
2264   * The code for the performed procedure type.
2265   */
2266  @Child(name = "procedureCode", type = {
2267      CodeableConcept.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2268  @Description(shortDefinition = "The performed procedure code", formalDefinition = "The code for the performed procedure type.")
2269  protected List<CodeableConcept> procedureCode;
2270
2271  /**
2272   * The principal physical location where the ImagingStudy was performed.
2273   */
2274  @Child(name = "location", type = { Location.class }, order = 14, min = 0, max = 1, modifier = false, summary = true)
2275  @Description(shortDefinition = "Where ImagingStudy occurred", formalDefinition = "The principal physical location where the ImagingStudy was performed.")
2276  protected Reference location;
2277
2278  /**
2279   * The actual object that is the target of the reference (The principal physical
2280   * location where the ImagingStudy was performed.)
2281   */
2282  protected Location locationTarget;
2283
2284  /**
2285   * Description of clinical condition indicating why the ImagingStudy was
2286   * requested.
2287   */
2288  @Child(name = "reasonCode", type = {
2289      CodeableConcept.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2290  @Description(shortDefinition = "Why the study was requested", formalDefinition = "Description of clinical condition indicating why the ImagingStudy was requested.")
2291  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/procedure-reason")
2292  protected List<CodeableConcept> reasonCode;
2293
2294  /**
2295   * Indicates another resource whose existence justifies this Study.
2296   */
2297  @Child(name = "reasonReference", type = { Condition.class, Observation.class, Media.class, DiagnosticReport.class,
2298      DocumentReference.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2299  @Description(shortDefinition = "Why was study performed", formalDefinition = "Indicates another resource whose existence justifies this Study.")
2300  protected List<Reference> reasonReference;
2301  /**
2302   * The actual objects that are the target of the reference (Indicates another
2303   * resource whose existence justifies this Study.)
2304   */
2305  protected List<Resource> reasonReferenceTarget;
2306
2307  /**
2308   * Per the recommended DICOM mapping, this element is derived from the Study
2309   * Description attribute (0008,1030). Observations or findings about the imaging
2310   * study should be recorded in another resource, e.g. Observation, and not in
2311   * this element.
2312   */
2313  @Child(name = "note", type = {
2314      Annotation.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2315  @Description(shortDefinition = "User-defined comments", formalDefinition = "Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.")
2316  protected List<Annotation> note;
2317
2318  /**
2319   * The Imaging Manager description of the study. Institution-generated
2320   * description or classification of the Study (component) performed.
2321   */
2322  @Child(name = "description", type = {
2323      StringType.class }, order = 18, min = 0, max = 1, modifier = false, summary = true)
2324  @Description(shortDefinition = "Institution-generated description", formalDefinition = "The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.")
2325  protected StringType description;
2326
2327  /**
2328   * Each study has one or more series of images or other content.
2329   */
2330  @Child(name = "series", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2331  @Description(shortDefinition = "Each study has one or more series of instances", formalDefinition = "Each study has one or more series of images or other content.")
2332  protected List<ImagingStudySeriesComponent> series;
2333
2334  private static final long serialVersionUID = -647973361L;
2335
2336  /**
2337   * Constructor
2338   */
2339  public ImagingStudy() {
2340    super();
2341  }
2342
2343  /**
2344   * Constructor
2345   */
2346  public ImagingStudy(Enumeration<ImagingStudyStatus> status, Reference subject) {
2347    super();
2348    this.status = status;
2349    this.subject = subject;
2350  }
2351
2352  /**
2353   * @return {@link #identifier} (Identifiers for the ImagingStudy such as DICOM
2354   *         Study Instance UID, and Accession Number.)
2355   */
2356  public List<Identifier> getIdentifier() {
2357    if (this.identifier == null)
2358      this.identifier = new ArrayList<Identifier>();
2359    return this.identifier;
2360  }
2361
2362  /**
2363   * @return Returns a reference to <code>this</code> for easy method chaining
2364   */
2365  public ImagingStudy setIdentifier(List<Identifier> theIdentifier) {
2366    this.identifier = theIdentifier;
2367    return this;
2368  }
2369
2370  public boolean hasIdentifier() {
2371    if (this.identifier == null)
2372      return false;
2373    for (Identifier item : this.identifier)
2374      if (!item.isEmpty())
2375        return true;
2376    return false;
2377  }
2378
2379  public Identifier addIdentifier() { // 3
2380    Identifier t = new Identifier();
2381    if (this.identifier == null)
2382      this.identifier = new ArrayList<Identifier>();
2383    this.identifier.add(t);
2384    return t;
2385  }
2386
2387  public ImagingStudy addIdentifier(Identifier t) { // 3
2388    if (t == null)
2389      return this;
2390    if (this.identifier == null)
2391      this.identifier = new ArrayList<Identifier>();
2392    this.identifier.add(t);
2393    return this;
2394  }
2395
2396  /**
2397   * @return The first repetition of repeating field {@link #identifier}, creating
2398   *         it if it does not already exist
2399   */
2400  public Identifier getIdentifierFirstRep() {
2401    if (getIdentifier().isEmpty()) {
2402      addIdentifier();
2403    }
2404    return getIdentifier().get(0);
2405  }
2406
2407  /**
2408   * @return {@link #status} (The current state of the ImagingStudy.). This is the
2409   *         underlying object with id, value and extensions. The accessor
2410   *         "getStatus" gives direct access to the value
2411   */
2412  public Enumeration<ImagingStudyStatus> getStatusElement() {
2413    if (this.status == null)
2414      if (Configuration.errorOnAutoCreate())
2415        throw new Error("Attempt to auto-create ImagingStudy.status");
2416      else if (Configuration.doAutoCreate())
2417        this.status = new Enumeration<ImagingStudyStatus>(new ImagingStudyStatusEnumFactory()); // bb
2418    return this.status;
2419  }
2420
2421  public boolean hasStatusElement() {
2422    return this.status != null && !this.status.isEmpty();
2423  }
2424
2425  public boolean hasStatus() {
2426    return this.status != null && !this.status.isEmpty();
2427  }
2428
2429  /**
2430   * @param value {@link #status} (The current state of the ImagingStudy.). This
2431   *              is the underlying object with id, value and extensions. The
2432   *              accessor "getStatus" gives direct access to the value
2433   */
2434  public ImagingStudy setStatusElement(Enumeration<ImagingStudyStatus> value) {
2435    this.status = value;
2436    return this;
2437  }
2438
2439  /**
2440   * @return The current state of the ImagingStudy.
2441   */
2442  public ImagingStudyStatus getStatus() {
2443    return this.status == null ? null : this.status.getValue();
2444  }
2445
2446  /**
2447   * @param value The current state of the ImagingStudy.
2448   */
2449  public ImagingStudy setStatus(ImagingStudyStatus value) {
2450    if (this.status == null)
2451      this.status = new Enumeration<ImagingStudyStatus>(new ImagingStudyStatusEnumFactory());
2452    this.status.setValue(value);
2453    return this;
2454  }
2455
2456  /**
2457   * @return {@link #modality} (A list of all the series.modality values that are
2458   *         actual acquisition modalities, i.e. those in the DICOM Context Group
2459   *         29 (value set OID 1.2.840.10008.6.1.19).)
2460   */
2461  public List<Coding> getModality() {
2462    if (this.modality == null)
2463      this.modality = new ArrayList<Coding>();
2464    return this.modality;
2465  }
2466
2467  /**
2468   * @return Returns a reference to <code>this</code> for easy method chaining
2469   */
2470  public ImagingStudy setModality(List<Coding> theModality) {
2471    this.modality = theModality;
2472    return this;
2473  }
2474
2475  public boolean hasModality() {
2476    if (this.modality == null)
2477      return false;
2478    for (Coding item : this.modality)
2479      if (!item.isEmpty())
2480        return true;
2481    return false;
2482  }
2483
2484  public Coding addModality() { // 3
2485    Coding t = new Coding();
2486    if (this.modality == null)
2487      this.modality = new ArrayList<Coding>();
2488    this.modality.add(t);
2489    return t;
2490  }
2491
2492  public ImagingStudy addModality(Coding t) { // 3
2493    if (t == null)
2494      return this;
2495    if (this.modality == null)
2496      this.modality = new ArrayList<Coding>();
2497    this.modality.add(t);
2498    return this;
2499  }
2500
2501  /**
2502   * @return The first repetition of repeating field {@link #modality}, creating
2503   *         it if it does not already exist
2504   */
2505  public Coding getModalityFirstRep() {
2506    if (getModality().isEmpty()) {
2507      addModality();
2508    }
2509    return getModality().get(0);
2510  }
2511
2512  /**
2513   * @return {@link #subject} (The subject, typically a patient, of the imaging
2514   *         study.)
2515   */
2516  public Reference getSubject() {
2517    if (this.subject == null)
2518      if (Configuration.errorOnAutoCreate())
2519        throw new Error("Attempt to auto-create ImagingStudy.subject");
2520      else if (Configuration.doAutoCreate())
2521        this.subject = new Reference(); // cc
2522    return this.subject;
2523  }
2524
2525  public boolean hasSubject() {
2526    return this.subject != null && !this.subject.isEmpty();
2527  }
2528
2529  /**
2530   * @param value {@link #subject} (The subject, typically a patient, of the
2531   *              imaging study.)
2532   */
2533  public ImagingStudy setSubject(Reference value) {
2534    this.subject = value;
2535    return this;
2536  }
2537
2538  /**
2539   * @return {@link #subject} The actual object that is the target of the
2540   *         reference. The reference library doesn't populate this, but you can
2541   *         use it to hold the resource if you resolve it. (The subject,
2542   *         typically a patient, of the imaging study.)
2543   */
2544  public Resource getSubjectTarget() {
2545    return this.subjectTarget;
2546  }
2547
2548  /**
2549   * @param value {@link #subject} The actual object that is the target of the
2550   *              reference. The reference library doesn't use these, but you can
2551   *              use it to hold the resource if you resolve it. (The subject,
2552   *              typically a patient, of the imaging study.)
2553   */
2554  public ImagingStudy setSubjectTarget(Resource value) {
2555    this.subjectTarget = value;
2556    return this;
2557  }
2558
2559  /**
2560   * @return {@link #encounter} (The healthcare event (e.g. a patient and
2561   *         healthcare provider interaction) during which this ImagingStudy is
2562   *         made.)
2563   */
2564  public Reference getEncounter() {
2565    if (this.encounter == null)
2566      if (Configuration.errorOnAutoCreate())
2567        throw new Error("Attempt to auto-create ImagingStudy.encounter");
2568      else if (Configuration.doAutoCreate())
2569        this.encounter = new Reference(); // cc
2570    return this.encounter;
2571  }
2572
2573  public boolean hasEncounter() {
2574    return this.encounter != null && !this.encounter.isEmpty();
2575  }
2576
2577  /**
2578   * @param value {@link #encounter} (The healthcare event (e.g. a patient and
2579   *              healthcare provider interaction) during which this ImagingStudy
2580   *              is made.)
2581   */
2582  public ImagingStudy setEncounter(Reference value) {
2583    this.encounter = value;
2584    return this;
2585  }
2586
2587  /**
2588   * @return {@link #encounter} The actual object that is the target of the
2589   *         reference. The reference library doesn't populate this, but you can
2590   *         use it to hold the resource if you resolve it. (The healthcare event
2591   *         (e.g. a patient and healthcare provider interaction) during which
2592   *         this ImagingStudy is made.)
2593   */
2594  public Encounter getEncounterTarget() {
2595    if (this.encounterTarget == null)
2596      if (Configuration.errorOnAutoCreate())
2597        throw new Error("Attempt to auto-create ImagingStudy.encounter");
2598      else if (Configuration.doAutoCreate())
2599        this.encounterTarget = new Encounter(); // aa
2600    return this.encounterTarget;
2601  }
2602
2603  /**
2604   * @param value {@link #encounter} The actual object that is the target of the
2605   *              reference. The reference library doesn't use these, but you can
2606   *              use it to hold the resource if you resolve it. (The healthcare
2607   *              event (e.g. a patient and healthcare provider interaction)
2608   *              during which this ImagingStudy is made.)
2609   */
2610  public ImagingStudy setEncounterTarget(Encounter value) {
2611    this.encounterTarget = value;
2612    return this;
2613  }
2614
2615  /**
2616   * @return {@link #started} (Date and time the study started.). This is the
2617   *         underlying object with id, value and extensions. The accessor
2618   *         "getStarted" gives direct access to the value
2619   */
2620  public DateTimeType getStartedElement() {
2621    if (this.started == null)
2622      if (Configuration.errorOnAutoCreate())
2623        throw new Error("Attempt to auto-create ImagingStudy.started");
2624      else if (Configuration.doAutoCreate())
2625        this.started = new DateTimeType(); // bb
2626    return this.started;
2627  }
2628
2629  public boolean hasStartedElement() {
2630    return this.started != null && !this.started.isEmpty();
2631  }
2632
2633  public boolean hasStarted() {
2634    return this.started != null && !this.started.isEmpty();
2635  }
2636
2637  /**
2638   * @param value {@link #started} (Date and time the study started.). This is the
2639   *              underlying object with id, value and extensions. The accessor
2640   *              "getStarted" gives direct access to the value
2641   */
2642  public ImagingStudy setStartedElement(DateTimeType value) {
2643    this.started = value;
2644    return this;
2645  }
2646
2647  /**
2648   * @return Date and time the study started.
2649   */
2650  public Date getStarted() {
2651    return this.started == null ? null : this.started.getValue();
2652  }
2653
2654  /**
2655   * @param value Date and time the study started.
2656   */
2657  public ImagingStudy setStarted(Date value) {
2658    if (value == null)
2659      this.started = null;
2660    else {
2661      if (this.started == null)
2662        this.started = new DateTimeType();
2663      this.started.setValue(value);
2664    }
2665    return this;
2666  }
2667
2668  /**
2669   * @return {@link #basedOn} (A list of the diagnostic requests that resulted in
2670   *         this imaging study being performed.)
2671   */
2672  public List<Reference> getBasedOn() {
2673    if (this.basedOn == null)
2674      this.basedOn = new ArrayList<Reference>();
2675    return this.basedOn;
2676  }
2677
2678  /**
2679   * @return Returns a reference to <code>this</code> for easy method chaining
2680   */
2681  public ImagingStudy setBasedOn(List<Reference> theBasedOn) {
2682    this.basedOn = theBasedOn;
2683    return this;
2684  }
2685
2686  public boolean hasBasedOn() {
2687    if (this.basedOn == null)
2688      return false;
2689    for (Reference item : this.basedOn)
2690      if (!item.isEmpty())
2691        return true;
2692    return false;
2693  }
2694
2695  public Reference addBasedOn() { // 3
2696    Reference t = new Reference();
2697    if (this.basedOn == null)
2698      this.basedOn = new ArrayList<Reference>();
2699    this.basedOn.add(t);
2700    return t;
2701  }
2702
2703  public ImagingStudy addBasedOn(Reference t) { // 3
2704    if (t == null)
2705      return this;
2706    if (this.basedOn == null)
2707      this.basedOn = new ArrayList<Reference>();
2708    this.basedOn.add(t);
2709    return this;
2710  }
2711
2712  /**
2713   * @return The first repetition of repeating field {@link #basedOn}, creating it
2714   *         if it does not already exist
2715   */
2716  public Reference getBasedOnFirstRep() {
2717    if (getBasedOn().isEmpty()) {
2718      addBasedOn();
2719    }
2720    return getBasedOn().get(0);
2721  }
2722
2723  /**
2724   * @deprecated Use Reference#setResource(IBaseResource) instead
2725   */
2726  @Deprecated
2727  public List<Resource> getBasedOnTarget() {
2728    if (this.basedOnTarget == null)
2729      this.basedOnTarget = new ArrayList<Resource>();
2730    return this.basedOnTarget;
2731  }
2732
2733  /**
2734   * @return {@link #referrer} (The requesting/referring physician.)
2735   */
2736  public Reference getReferrer() {
2737    if (this.referrer == null)
2738      if (Configuration.errorOnAutoCreate())
2739        throw new Error("Attempt to auto-create ImagingStudy.referrer");
2740      else if (Configuration.doAutoCreate())
2741        this.referrer = new Reference(); // cc
2742    return this.referrer;
2743  }
2744
2745  public boolean hasReferrer() {
2746    return this.referrer != null && !this.referrer.isEmpty();
2747  }
2748
2749  /**
2750   * @param value {@link #referrer} (The requesting/referring physician.)
2751   */
2752  public ImagingStudy setReferrer(Reference value) {
2753    this.referrer = value;
2754    return this;
2755  }
2756
2757  /**
2758   * @return {@link #referrer} The actual object that is the target of the
2759   *         reference. The reference library doesn't populate this, but you can
2760   *         use it to hold the resource if you resolve it. (The
2761   *         requesting/referring physician.)
2762   */
2763  public Resource getReferrerTarget() {
2764    return this.referrerTarget;
2765  }
2766
2767  /**
2768   * @param value {@link #referrer} The actual object that is the target of the
2769   *              reference. The reference library doesn't use these, but you can
2770   *              use it to hold the resource if you resolve it. (The
2771   *              requesting/referring physician.)
2772   */
2773  public ImagingStudy setReferrerTarget(Resource value) {
2774    this.referrerTarget = value;
2775    return this;
2776  }
2777
2778  /**
2779   * @return {@link #interpreter} (Who read the study and interpreted the images
2780   *         or other content.)
2781   */
2782  public List<Reference> getInterpreter() {
2783    if (this.interpreter == null)
2784      this.interpreter = new ArrayList<Reference>();
2785    return this.interpreter;
2786  }
2787
2788  /**
2789   * @return Returns a reference to <code>this</code> for easy method chaining
2790   */
2791  public ImagingStudy setInterpreter(List<Reference> theInterpreter) {
2792    this.interpreter = theInterpreter;
2793    return this;
2794  }
2795
2796  public boolean hasInterpreter() {
2797    if (this.interpreter == null)
2798      return false;
2799    for (Reference item : this.interpreter)
2800      if (!item.isEmpty())
2801        return true;
2802    return false;
2803  }
2804
2805  public Reference addInterpreter() { // 3
2806    Reference t = new Reference();
2807    if (this.interpreter == null)
2808      this.interpreter = new ArrayList<Reference>();
2809    this.interpreter.add(t);
2810    return t;
2811  }
2812
2813  public ImagingStudy addInterpreter(Reference t) { // 3
2814    if (t == null)
2815      return this;
2816    if (this.interpreter == null)
2817      this.interpreter = new ArrayList<Reference>();
2818    this.interpreter.add(t);
2819    return this;
2820  }
2821
2822  /**
2823   * @return The first repetition of repeating field {@link #interpreter},
2824   *         creating it if it does not already exist
2825   */
2826  public Reference getInterpreterFirstRep() {
2827    if (getInterpreter().isEmpty()) {
2828      addInterpreter();
2829    }
2830    return getInterpreter().get(0);
2831  }
2832
2833  /**
2834   * @deprecated Use Reference#setResource(IBaseResource) instead
2835   */
2836  @Deprecated
2837  public List<Resource> getInterpreterTarget() {
2838    if (this.interpreterTarget == null)
2839      this.interpreterTarget = new ArrayList<Resource>();
2840    return this.interpreterTarget;
2841  }
2842
2843  /**
2844   * @return {@link #endpoint} (The network service providing access (e.g., query,
2845   *         view, or retrieval) for the study. See implementation notes for
2846   *         information about using DICOM endpoints. A study-level endpoint
2847   *         applies to each series in the study, unless overridden by a
2848   *         series-level endpoint with the same Endpoint.connectionType.)
2849   */
2850  public List<Reference> getEndpoint() {
2851    if (this.endpoint == null)
2852      this.endpoint = new ArrayList<Reference>();
2853    return this.endpoint;
2854  }
2855
2856  /**
2857   * @return Returns a reference to <code>this</code> for easy method chaining
2858   */
2859  public ImagingStudy setEndpoint(List<Reference> theEndpoint) {
2860    this.endpoint = theEndpoint;
2861    return this;
2862  }
2863
2864  public boolean hasEndpoint() {
2865    if (this.endpoint == null)
2866      return false;
2867    for (Reference item : this.endpoint)
2868      if (!item.isEmpty())
2869        return true;
2870    return false;
2871  }
2872
2873  public Reference addEndpoint() { // 3
2874    Reference t = new Reference();
2875    if (this.endpoint == null)
2876      this.endpoint = new ArrayList<Reference>();
2877    this.endpoint.add(t);
2878    return t;
2879  }
2880
2881  public ImagingStudy addEndpoint(Reference t) { // 3
2882    if (t == null)
2883      return this;
2884    if (this.endpoint == null)
2885      this.endpoint = new ArrayList<Reference>();
2886    this.endpoint.add(t);
2887    return this;
2888  }
2889
2890  /**
2891   * @return The first repetition of repeating field {@link #endpoint}, creating
2892   *         it if it does not already exist
2893   */
2894  public Reference getEndpointFirstRep() {
2895    if (getEndpoint().isEmpty()) {
2896      addEndpoint();
2897    }
2898    return getEndpoint().get(0);
2899  }
2900
2901  /**
2902   * @deprecated Use Reference#setResource(IBaseResource) instead
2903   */
2904  @Deprecated
2905  public List<Endpoint> getEndpointTarget() {
2906    if (this.endpointTarget == null)
2907      this.endpointTarget = new ArrayList<Endpoint>();
2908    return this.endpointTarget;
2909  }
2910
2911  /**
2912   * @deprecated Use Reference#setResource(IBaseResource) instead
2913   */
2914  @Deprecated
2915  public Endpoint addEndpointTarget() {
2916    Endpoint r = new Endpoint();
2917    if (this.endpointTarget == null)
2918      this.endpointTarget = new ArrayList<Endpoint>();
2919    this.endpointTarget.add(r);
2920    return r;
2921  }
2922
2923  /**
2924   * @return {@link #numberOfSeries} (Number of Series in the Study. This value
2925   *         given may be larger than the number of series elements this Resource
2926   *         contains due to resource availability, security, or other factors.
2927   *         This element should be present if any series elements are present.).
2928   *         This is the underlying object with id, value and extensions. The
2929   *         accessor "getNumberOfSeries" gives direct access to the value
2930   */
2931  public UnsignedIntType getNumberOfSeriesElement() {
2932    if (this.numberOfSeries == null)
2933      if (Configuration.errorOnAutoCreate())
2934        throw new Error("Attempt to auto-create ImagingStudy.numberOfSeries");
2935      else if (Configuration.doAutoCreate())
2936        this.numberOfSeries = new UnsignedIntType(); // bb
2937    return this.numberOfSeries;
2938  }
2939
2940  public boolean hasNumberOfSeriesElement() {
2941    return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2942  }
2943
2944  public boolean hasNumberOfSeries() {
2945    return this.numberOfSeries != null && !this.numberOfSeries.isEmpty();
2946  }
2947
2948  /**
2949   * @param value {@link #numberOfSeries} (Number of Series in the Study. This
2950   *              value given may be larger than the number of series elements
2951   *              this Resource contains due to resource availability, security,
2952   *              or other factors. This element should be present if any series
2953   *              elements are present.). This is the underlying object with id,
2954   *              value and extensions. The accessor "getNumberOfSeries" gives
2955   *              direct access to the value
2956   */
2957  public ImagingStudy setNumberOfSeriesElement(UnsignedIntType value) {
2958    this.numberOfSeries = value;
2959    return this;
2960  }
2961
2962  /**
2963   * @return Number of Series in the Study. This value given may be larger than
2964   *         the number of series elements this Resource contains due to resource
2965   *         availability, security, or other factors. This element should be
2966   *         present if any series elements are present.
2967   */
2968  public int getNumberOfSeries() {
2969    return this.numberOfSeries == null || this.numberOfSeries.isEmpty() ? 0 : this.numberOfSeries.getValue();
2970  }
2971
2972  /**
2973   * @param value Number of Series in the Study. This value given may be larger
2974   *              than the number of series elements this Resource contains due to
2975   *              resource availability, security, or other factors. This element
2976   *              should be present if any series elements are present.
2977   */
2978  public ImagingStudy setNumberOfSeries(int value) {
2979    if (this.numberOfSeries == null)
2980      this.numberOfSeries = new UnsignedIntType();
2981    this.numberOfSeries.setValue(value);
2982    return this;
2983  }
2984
2985  /**
2986   * @return {@link #numberOfInstances} (Number of SOP Instances in Study. This
2987   *         value given may be larger than the number of instance elements this
2988   *         resource contains due to resource availability, security, or other
2989   *         factors. This element should be present if any instance elements are
2990   *         present.). This is the underlying object with id, value and
2991   *         extensions. The accessor "getNumberOfInstances" gives direct access
2992   *         to the value
2993   */
2994  public UnsignedIntType getNumberOfInstancesElement() {
2995    if (this.numberOfInstances == null)
2996      if (Configuration.errorOnAutoCreate())
2997        throw new Error("Attempt to auto-create ImagingStudy.numberOfInstances");
2998      else if (Configuration.doAutoCreate())
2999        this.numberOfInstances = new UnsignedIntType(); // bb
3000    return this.numberOfInstances;
3001  }
3002
3003  public boolean hasNumberOfInstancesElement() {
3004    return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
3005  }
3006
3007  public boolean hasNumberOfInstances() {
3008    return this.numberOfInstances != null && !this.numberOfInstances.isEmpty();
3009  }
3010
3011  /**
3012   * @param value {@link #numberOfInstances} (Number of SOP Instances in Study.
3013   *              This value given may be larger than the number of instance
3014   *              elements this resource contains due to resource availability,
3015   *              security, or other factors. This element should be present if
3016   *              any instance elements are present.). This is the underlying
3017   *              object with id, value and extensions. The accessor
3018   *              "getNumberOfInstances" gives direct access to the value
3019   */
3020  public ImagingStudy setNumberOfInstancesElement(UnsignedIntType value) {
3021    this.numberOfInstances = value;
3022    return this;
3023  }
3024
3025  /**
3026   * @return Number of SOP Instances in Study. This value given may be larger than
3027   *         the number of instance elements this resource contains due to
3028   *         resource availability, security, or other factors. This element
3029   *         should be present if any instance elements are present.
3030   */
3031  public int getNumberOfInstances() {
3032    return this.numberOfInstances == null || this.numberOfInstances.isEmpty() ? 0 : this.numberOfInstances.getValue();
3033  }
3034
3035  /**
3036   * @param value Number of SOP Instances in Study. This value given may be larger
3037   *              than the number of instance elements this resource contains due
3038   *              to resource availability, security, or other factors. This
3039   *              element should be present if any instance elements are present.
3040   */
3041  public ImagingStudy setNumberOfInstances(int value) {
3042    if (this.numberOfInstances == null)
3043      this.numberOfInstances = new UnsignedIntType();
3044    this.numberOfInstances.setValue(value);
3045    return this;
3046  }
3047
3048  /**
3049   * @return {@link #procedureReference} (The procedure which this ImagingStudy
3050   *         was part of.)
3051   */
3052  public Reference getProcedureReference() {
3053    if (this.procedureReference == null)
3054      if (Configuration.errorOnAutoCreate())
3055        throw new Error("Attempt to auto-create ImagingStudy.procedureReference");
3056      else if (Configuration.doAutoCreate())
3057        this.procedureReference = new Reference(); // cc
3058    return this.procedureReference;
3059  }
3060
3061  public boolean hasProcedureReference() {
3062    return this.procedureReference != null && !this.procedureReference.isEmpty();
3063  }
3064
3065  /**
3066   * @param value {@link #procedureReference} (The procedure which this
3067   *              ImagingStudy was part of.)
3068   */
3069  public ImagingStudy setProcedureReference(Reference value) {
3070    this.procedureReference = value;
3071    return this;
3072  }
3073
3074  /**
3075   * @return {@link #procedureReference} The actual object that is the target of
3076   *         the reference. The reference library doesn't populate this, but you
3077   *         can use it to hold the resource if you resolve it. (The procedure
3078   *         which this ImagingStudy was part of.)
3079   */
3080  public Procedure getProcedureReferenceTarget() {
3081    if (this.procedureReferenceTarget == null)
3082      if (Configuration.errorOnAutoCreate())
3083        throw new Error("Attempt to auto-create ImagingStudy.procedureReference");
3084      else if (Configuration.doAutoCreate())
3085        this.procedureReferenceTarget = new Procedure(); // aa
3086    return this.procedureReferenceTarget;
3087  }
3088
3089  /**
3090   * @param value {@link #procedureReference} The actual object that is the target
3091   *              of the reference. The reference library doesn't use these, but
3092   *              you can use it to hold the resource if you resolve it. (The
3093   *              procedure which this ImagingStudy was part of.)
3094   */
3095  public ImagingStudy setProcedureReferenceTarget(Procedure value) {
3096    this.procedureReferenceTarget = value;
3097    return this;
3098  }
3099
3100  /**
3101   * @return {@link #procedureCode} (The code for the performed procedure type.)
3102   */
3103  public List<CodeableConcept> getProcedureCode() {
3104    if (this.procedureCode == null)
3105      this.procedureCode = new ArrayList<CodeableConcept>();
3106    return this.procedureCode;
3107  }
3108
3109  /**
3110   * @return Returns a reference to <code>this</code> for easy method chaining
3111   */
3112  public ImagingStudy setProcedureCode(List<CodeableConcept> theProcedureCode) {
3113    this.procedureCode = theProcedureCode;
3114    return this;
3115  }
3116
3117  public boolean hasProcedureCode() {
3118    if (this.procedureCode == null)
3119      return false;
3120    for (CodeableConcept item : this.procedureCode)
3121      if (!item.isEmpty())
3122        return true;
3123    return false;
3124  }
3125
3126  public CodeableConcept addProcedureCode() { // 3
3127    CodeableConcept t = new CodeableConcept();
3128    if (this.procedureCode == null)
3129      this.procedureCode = new ArrayList<CodeableConcept>();
3130    this.procedureCode.add(t);
3131    return t;
3132  }
3133
3134  public ImagingStudy addProcedureCode(CodeableConcept t) { // 3
3135    if (t == null)
3136      return this;
3137    if (this.procedureCode == null)
3138      this.procedureCode = new ArrayList<CodeableConcept>();
3139    this.procedureCode.add(t);
3140    return this;
3141  }
3142
3143  /**
3144   * @return The first repetition of repeating field {@link #procedureCode},
3145   *         creating it if it does not already exist
3146   */
3147  public CodeableConcept getProcedureCodeFirstRep() {
3148    if (getProcedureCode().isEmpty()) {
3149      addProcedureCode();
3150    }
3151    return getProcedureCode().get(0);
3152  }
3153
3154  /**
3155   * @return {@link #location} (The principal physical location where the
3156   *         ImagingStudy was performed.)
3157   */
3158  public Reference getLocation() {
3159    if (this.location == null)
3160      if (Configuration.errorOnAutoCreate())
3161        throw new Error("Attempt to auto-create ImagingStudy.location");
3162      else if (Configuration.doAutoCreate())
3163        this.location = new Reference(); // cc
3164    return this.location;
3165  }
3166
3167  public boolean hasLocation() {
3168    return this.location != null && !this.location.isEmpty();
3169  }
3170
3171  /**
3172   * @param value {@link #location} (The principal physical location where the
3173   *              ImagingStudy was performed.)
3174   */
3175  public ImagingStudy setLocation(Reference value) {
3176    this.location = value;
3177    return this;
3178  }
3179
3180  /**
3181   * @return {@link #location} The actual object that is the target of the
3182   *         reference. The reference library doesn't populate this, but you can
3183   *         use it to hold the resource if you resolve it. (The principal
3184   *         physical location where the ImagingStudy was performed.)
3185   */
3186  public Location getLocationTarget() {
3187    if (this.locationTarget == null)
3188      if (Configuration.errorOnAutoCreate())
3189        throw new Error("Attempt to auto-create ImagingStudy.location");
3190      else if (Configuration.doAutoCreate())
3191        this.locationTarget = new Location(); // aa
3192    return this.locationTarget;
3193  }
3194
3195  /**
3196   * @param value {@link #location} The actual object that is the target of the
3197   *              reference. The reference library doesn't use these, but you can
3198   *              use it to hold the resource if you resolve it. (The principal
3199   *              physical location where the ImagingStudy was performed.)
3200   */
3201  public ImagingStudy setLocationTarget(Location value) {
3202    this.locationTarget = value;
3203    return this;
3204  }
3205
3206  /**
3207   * @return {@link #reasonCode} (Description of clinical condition indicating why
3208   *         the ImagingStudy was requested.)
3209   */
3210  public List<CodeableConcept> getReasonCode() {
3211    if (this.reasonCode == null)
3212      this.reasonCode = new ArrayList<CodeableConcept>();
3213    return this.reasonCode;
3214  }
3215
3216  /**
3217   * @return Returns a reference to <code>this</code> for easy method chaining
3218   */
3219  public ImagingStudy setReasonCode(List<CodeableConcept> theReasonCode) {
3220    this.reasonCode = theReasonCode;
3221    return this;
3222  }
3223
3224  public boolean hasReasonCode() {
3225    if (this.reasonCode == null)
3226      return false;
3227    for (CodeableConcept item : this.reasonCode)
3228      if (!item.isEmpty())
3229        return true;
3230    return false;
3231  }
3232
3233  public CodeableConcept addReasonCode() { // 3
3234    CodeableConcept t = new CodeableConcept();
3235    if (this.reasonCode == null)
3236      this.reasonCode = new ArrayList<CodeableConcept>();
3237    this.reasonCode.add(t);
3238    return t;
3239  }
3240
3241  public ImagingStudy addReasonCode(CodeableConcept t) { // 3
3242    if (t == null)
3243      return this;
3244    if (this.reasonCode == null)
3245      this.reasonCode = new ArrayList<CodeableConcept>();
3246    this.reasonCode.add(t);
3247    return this;
3248  }
3249
3250  /**
3251   * @return The first repetition of repeating field {@link #reasonCode}, creating
3252   *         it if it does not already exist
3253   */
3254  public CodeableConcept getReasonCodeFirstRep() {
3255    if (getReasonCode().isEmpty()) {
3256      addReasonCode();
3257    }
3258    return getReasonCode().get(0);
3259  }
3260
3261  /**
3262   * @return {@link #reasonReference} (Indicates another resource whose existence
3263   *         justifies this Study.)
3264   */
3265  public List<Reference> getReasonReference() {
3266    if (this.reasonReference == null)
3267      this.reasonReference = new ArrayList<Reference>();
3268    return this.reasonReference;
3269  }
3270
3271  /**
3272   * @return Returns a reference to <code>this</code> for easy method chaining
3273   */
3274  public ImagingStudy setReasonReference(List<Reference> theReasonReference) {
3275    this.reasonReference = theReasonReference;
3276    return this;
3277  }
3278
3279  public boolean hasReasonReference() {
3280    if (this.reasonReference == null)
3281      return false;
3282    for (Reference item : this.reasonReference)
3283      if (!item.isEmpty())
3284        return true;
3285    return false;
3286  }
3287
3288  public Reference addReasonReference() { // 3
3289    Reference t = new Reference();
3290    if (this.reasonReference == null)
3291      this.reasonReference = new ArrayList<Reference>();
3292    this.reasonReference.add(t);
3293    return t;
3294  }
3295
3296  public ImagingStudy addReasonReference(Reference t) { // 3
3297    if (t == null)
3298      return this;
3299    if (this.reasonReference == null)
3300      this.reasonReference = new ArrayList<Reference>();
3301    this.reasonReference.add(t);
3302    return this;
3303  }
3304
3305  /**
3306   * @return The first repetition of repeating field {@link #reasonReference},
3307   *         creating it if it does not already exist
3308   */
3309  public Reference getReasonReferenceFirstRep() {
3310    if (getReasonReference().isEmpty()) {
3311      addReasonReference();
3312    }
3313    return getReasonReference().get(0);
3314  }
3315
3316  /**
3317   * @deprecated Use Reference#setResource(IBaseResource) instead
3318   */
3319  @Deprecated
3320  public List<Resource> getReasonReferenceTarget() {
3321    if (this.reasonReferenceTarget == null)
3322      this.reasonReferenceTarget = new ArrayList<Resource>();
3323    return this.reasonReferenceTarget;
3324  }
3325
3326  /**
3327   * @return {@link #note} (Per the recommended DICOM mapping, this element is
3328   *         derived from the Study Description attribute (0008,1030).
3329   *         Observations or findings about the imaging study should be recorded
3330   *         in another resource, e.g. Observation, and not in this element.)
3331   */
3332  public List<Annotation> getNote() {
3333    if (this.note == null)
3334      this.note = new ArrayList<Annotation>();
3335    return this.note;
3336  }
3337
3338  /**
3339   * @return Returns a reference to <code>this</code> for easy method chaining
3340   */
3341  public ImagingStudy setNote(List<Annotation> theNote) {
3342    this.note = theNote;
3343    return this;
3344  }
3345
3346  public boolean hasNote() {
3347    if (this.note == null)
3348      return false;
3349    for (Annotation item : this.note)
3350      if (!item.isEmpty())
3351        return true;
3352    return false;
3353  }
3354
3355  public Annotation addNote() { // 3
3356    Annotation t = new Annotation();
3357    if (this.note == null)
3358      this.note = new ArrayList<Annotation>();
3359    this.note.add(t);
3360    return t;
3361  }
3362
3363  public ImagingStudy addNote(Annotation t) { // 3
3364    if (t == null)
3365      return this;
3366    if (this.note == null)
3367      this.note = new ArrayList<Annotation>();
3368    this.note.add(t);
3369    return this;
3370  }
3371
3372  /**
3373   * @return The first repetition of repeating field {@link #note}, creating it if
3374   *         it does not already exist
3375   */
3376  public Annotation getNoteFirstRep() {
3377    if (getNote().isEmpty()) {
3378      addNote();
3379    }
3380    return getNote().get(0);
3381  }
3382
3383  /**
3384   * @return {@link #description} (The Imaging Manager description of the study.
3385   *         Institution-generated description or classification of the Study
3386   *         (component) performed.). This is the underlying object with id, value
3387   *         and extensions. The accessor "getDescription" gives direct access to
3388   *         the value
3389   */
3390  public StringType getDescriptionElement() {
3391    if (this.description == null)
3392      if (Configuration.errorOnAutoCreate())
3393        throw new Error("Attempt to auto-create ImagingStudy.description");
3394      else if (Configuration.doAutoCreate())
3395        this.description = new StringType(); // bb
3396    return this.description;
3397  }
3398
3399  public boolean hasDescriptionElement() {
3400    return this.description != null && !this.description.isEmpty();
3401  }
3402
3403  public boolean hasDescription() {
3404    return this.description != null && !this.description.isEmpty();
3405  }
3406
3407  /**
3408   * @param value {@link #description} (The Imaging Manager description of the
3409   *              study. Institution-generated description or classification of
3410   *              the Study (component) performed.). This is the underlying object
3411   *              with id, value and extensions. The accessor "getDescription"
3412   *              gives direct access to the value
3413   */
3414  public ImagingStudy setDescriptionElement(StringType value) {
3415    this.description = value;
3416    return this;
3417  }
3418
3419  /**
3420   * @return The Imaging Manager description of the study. Institution-generated
3421   *         description or classification of the Study (component) performed.
3422   */
3423  public String getDescription() {
3424    return this.description == null ? null : this.description.getValue();
3425  }
3426
3427  /**
3428   * @param value The Imaging Manager description of the study.
3429   *              Institution-generated description or classification of the Study
3430   *              (component) performed.
3431   */
3432  public ImagingStudy setDescription(String value) {
3433    if (Utilities.noString(value))
3434      this.description = null;
3435    else {
3436      if (this.description == null)
3437        this.description = new StringType();
3438      this.description.setValue(value);
3439    }
3440    return this;
3441  }
3442
3443  /**
3444   * @return {@link #series} (Each study has one or more series of images or other
3445   *         content.)
3446   */
3447  public List<ImagingStudySeriesComponent> getSeries() {
3448    if (this.series == null)
3449      this.series = new ArrayList<ImagingStudySeriesComponent>();
3450    return this.series;
3451  }
3452
3453  /**
3454   * @return Returns a reference to <code>this</code> for easy method chaining
3455   */
3456  public ImagingStudy setSeries(List<ImagingStudySeriesComponent> theSeries) {
3457    this.series = theSeries;
3458    return this;
3459  }
3460
3461  public boolean hasSeries() {
3462    if (this.series == null)
3463      return false;
3464    for (ImagingStudySeriesComponent item : this.series)
3465      if (!item.isEmpty())
3466        return true;
3467    return false;
3468  }
3469
3470  public ImagingStudySeriesComponent addSeries() { // 3
3471    ImagingStudySeriesComponent t = new ImagingStudySeriesComponent();
3472    if (this.series == null)
3473      this.series = new ArrayList<ImagingStudySeriesComponent>();
3474    this.series.add(t);
3475    return t;
3476  }
3477
3478  public ImagingStudy addSeries(ImagingStudySeriesComponent t) { // 3
3479    if (t == null)
3480      return this;
3481    if (this.series == null)
3482      this.series = new ArrayList<ImagingStudySeriesComponent>();
3483    this.series.add(t);
3484    return this;
3485  }
3486
3487  /**
3488   * @return The first repetition of repeating field {@link #series}, creating it
3489   *         if it does not already exist
3490   */
3491  public ImagingStudySeriesComponent getSeriesFirstRep() {
3492    if (getSeries().isEmpty()) {
3493      addSeries();
3494    }
3495    return getSeries().get(0);
3496  }
3497
3498  protected void listChildren(List<Property> children) {
3499    super.listChildren(children);
3500    children.add(new Property("identifier", "Identifier",
3501        "Identifiers for the ImagingStudy such as DICOM Study Instance UID, and Accession Number.", 0,
3502        java.lang.Integer.MAX_VALUE, identifier));
3503    children.add(new Property("status", "code", "The current state of the ImagingStudy.", 0, 1, status));
3504    children.add(new Property("modality", "Coding",
3505        "A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).",
3506        0, java.lang.Integer.MAX_VALUE, modality));
3507    children.add(new Property("subject", "Reference(Patient|Device|Group)",
3508        "The subject, typically a patient, of the imaging study.", 0, 1, subject));
3509    children.add(new Property("encounter", "Reference(Encounter)",
3510        "The healthcare event (e.g. a patient and healthcare provider interaction) during which this ImagingStudy is made.",
3511        0, 1, encounter));
3512    children.add(new Property("started", "dateTime", "Date and time the study started.", 0, 1, started));
3513    children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest|Appointment|AppointmentResponse|Task)",
3514        "A list of the diagnostic requests that resulted in this imaging study being performed.", 0,
3515        java.lang.Integer.MAX_VALUE, basedOn));
3516    children.add(new Property("referrer", "Reference(Practitioner|PractitionerRole)",
3517        "The requesting/referring physician.", 0, 1, referrer));
3518    children.add(new Property("interpreter", "Reference(Practitioner|PractitionerRole)",
3519        "Who read the study and interpreted the images or other content.", 0, java.lang.Integer.MAX_VALUE,
3520        interpreter));
3521    children.add(new Property("endpoint", "Reference(Endpoint)",
3522        "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.connectionType.",
3523        0, java.lang.Integer.MAX_VALUE, endpoint));
3524    children.add(new Property("numberOfSeries", "unsignedInt",
3525        "Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.",
3526        0, 1, numberOfSeries));
3527    children.add(new Property("numberOfInstances", "unsignedInt",
3528        "Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.",
3529        0, 1, numberOfInstances));
3530    children.add(new Property("procedureReference", "Reference(Procedure)",
3531        "The procedure which this ImagingStudy was part of.", 0, 1, procedureReference));
3532    children.add(new Property("procedureCode", "CodeableConcept", "The code for the performed procedure type.", 0,
3533        java.lang.Integer.MAX_VALUE, procedureCode));
3534    children.add(new Property("location", "Reference(Location)",
3535        "The principal physical location where the ImagingStudy was performed.", 0, 1, location));
3536    children.add(new Property("reasonCode", "CodeableConcept",
3537        "Description of clinical condition indicating why the ImagingStudy was requested.", 0,
3538        java.lang.Integer.MAX_VALUE, reasonCode));
3539    children.add(
3540        new Property("reasonReference", "Reference(Condition|Observation|Media|DiagnosticReport|DocumentReference)",
3541            "Indicates another resource whose existence justifies this Study.", 0, java.lang.Integer.MAX_VALUE,
3542            reasonReference));
3543    children.add(new Property("note", "Annotation",
3544        "Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.",
3545        0, java.lang.Integer.MAX_VALUE, note));
3546    children.add(new Property("description", "string",
3547        "The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.",
3548        0, 1, description));
3549    children.add(new Property("series", "", "Each study has one or more series of images or other content.", 0,
3550        java.lang.Integer.MAX_VALUE, series));
3551  }
3552
3553  @Override
3554  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3555    switch (_hash) {
3556    case -1618432855:
3557      /* identifier */ return new Property("identifier", "Identifier",
3558          "Identifiers for the ImagingStudy such as DICOM Study Instance UID, and Accession Number.", 0,
3559          java.lang.Integer.MAX_VALUE, identifier);
3560    case -892481550:
3561      /* status */ return new Property("status", "code", "The current state of the ImagingStudy.", 0, 1, status);
3562    case -622722335:
3563      /* modality */ return new Property("modality", "Coding",
3564          "A list of all the series.modality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).",
3565          0, java.lang.Integer.MAX_VALUE, modality);
3566    case -1867885268:
3567      /* subject */ return new Property("subject", "Reference(Patient|Device|Group)",
3568          "The subject, typically a patient, of the imaging study.", 0, 1, subject);
3569    case 1524132147:
3570      /* encounter */ return new Property("encounter", "Reference(Encounter)",
3571          "The healthcare event (e.g. a patient and healthcare provider interaction) during which this ImagingStudy is made.",
3572          0, 1, encounter);
3573    case -1897185151:
3574      /* started */ return new Property("started", "dateTime", "Date and time the study started.", 0, 1, started);
3575    case -332612366:
3576      /* basedOn */ return new Property("basedOn",
3577          "Reference(CarePlan|ServiceRequest|Appointment|AppointmentResponse|Task)",
3578          "A list of the diagnostic requests that resulted in this imaging study being performed.", 0,
3579          java.lang.Integer.MAX_VALUE, basedOn);
3580    case -722568161:
3581      /* referrer */ return new Property("referrer", "Reference(Practitioner|PractitionerRole)",
3582          "The requesting/referring physician.", 0, 1, referrer);
3583    case -2008009094:
3584      /* interpreter */ return new Property("interpreter", "Reference(Practitioner|PractitionerRole)",
3585          "Who read the study and interpreted the images or other content.", 0, java.lang.Integer.MAX_VALUE,
3586          interpreter);
3587    case 1741102485:
3588      /* endpoint */ return new Property("endpoint", "Reference(Endpoint)",
3589          "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.connectionType.",
3590          0, java.lang.Integer.MAX_VALUE, endpoint);
3591    case 1920000407:
3592      /* numberOfSeries */ return new Property("numberOfSeries", "unsignedInt",
3593          "Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.",
3594          0, 1, numberOfSeries);
3595    case -1043544226:
3596      /* numberOfInstances */ return new Property("numberOfInstances", "unsignedInt",
3597          "Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.",
3598          0, 1, numberOfInstances);
3599    case 881809848:
3600      /* procedureReference */ return new Property("procedureReference", "Reference(Procedure)",
3601          "The procedure which this ImagingStudy was part of.", 0, 1, procedureReference);
3602    case -698023072:
3603      /* procedureCode */ return new Property("procedureCode", "CodeableConcept",
3604          "The code for the performed procedure type.", 0, java.lang.Integer.MAX_VALUE, procedureCode);
3605    case 1901043637:
3606      /* location */ return new Property("location", "Reference(Location)",
3607          "The principal physical location where the ImagingStudy was performed.", 0, 1, location);
3608    case 722137681:
3609      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
3610          "Description of clinical condition indicating why the ImagingStudy was requested.", 0,
3611          java.lang.Integer.MAX_VALUE, reasonCode);
3612    case -1146218137:
3613      /* reasonReference */ return new Property("reasonReference",
3614          "Reference(Condition|Observation|Media|DiagnosticReport|DocumentReference)",
3615          "Indicates another resource whose existence justifies this Study.", 0, java.lang.Integer.MAX_VALUE,
3616          reasonReference);
3617    case 3387378:
3618      /* note */ return new Property("note", "Annotation",
3619          "Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this element.",
3620          0, java.lang.Integer.MAX_VALUE, note);
3621    case -1724546052:
3622      /* description */ return new Property("description", "string",
3623          "The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) performed.",
3624          0, 1, description);
3625    case -905838985:
3626      /* series */ return new Property("series", "", "Each study has one or more series of images or other content.", 0,
3627          java.lang.Integer.MAX_VALUE, series);
3628    default:
3629      return super.getNamedProperty(_hash, _name, _checkValid);
3630    }
3631
3632  }
3633
3634  @Override
3635  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3636    switch (hash) {
3637    case -1618432855:
3638      /* identifier */ return this.identifier == null ? new Base[0]
3639          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3640    case -892481550:
3641      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ImagingStudyStatus>
3642    case -622722335:
3643      /* modality */ return this.modality == null ? new Base[0] : this.modality.toArray(new Base[this.modality.size()]); // Coding
3644    case -1867885268:
3645      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
3646    case 1524132147:
3647      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
3648    case -1897185151:
3649      /* started */ return this.started == null ? new Base[0] : new Base[] { this.started }; // DateTimeType
3650    case -332612366:
3651      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3652    case -722568161:
3653      /* referrer */ return this.referrer == null ? new Base[0] : new Base[] { this.referrer }; // Reference
3654    case -2008009094:
3655      /* interpreter */ return this.interpreter == null ? new Base[0]
3656          : this.interpreter.toArray(new Base[this.interpreter.size()]); // Reference
3657    case 1741102485:
3658      /* endpoint */ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
3659    case 1920000407:
3660      /* numberOfSeries */ return this.numberOfSeries == null ? new Base[0] : new Base[] { this.numberOfSeries }; // UnsignedIntType
3661    case -1043544226:
3662      /* numberOfInstances */ return this.numberOfInstances == null ? new Base[0]
3663          : new Base[] { this.numberOfInstances }; // UnsignedIntType
3664    case 881809848:
3665      /* procedureReference */ return this.procedureReference == null ? new Base[0]
3666          : new Base[] { this.procedureReference }; // Reference
3667    case -698023072:
3668      /* procedureCode */ return this.procedureCode == null ? new Base[0]
3669          : this.procedureCode.toArray(new Base[this.procedureCode.size()]); // CodeableConcept
3670    case 1901043637:
3671      /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Reference
3672    case 722137681:
3673      /* reasonCode */ return this.reasonCode == null ? new Base[0]
3674          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
3675    case -1146218137:
3676      /* reasonReference */ return this.reasonReference == null ? new Base[0]
3677          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
3678    case 3387378:
3679      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3680    case -1724546052:
3681      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
3682    case -905838985:
3683      /* series */ return this.series == null ? new Base[0] : this.series.toArray(new Base[this.series.size()]); // ImagingStudySeriesComponent
3684    default:
3685      return super.getProperty(hash, name, checkValid);
3686    }
3687
3688  }
3689
3690  @Override
3691  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3692    switch (hash) {
3693    case -1618432855: // identifier
3694      this.getIdentifier().add(castToIdentifier(value)); // Identifier
3695      return value;
3696    case -892481550: // status
3697      value = new ImagingStudyStatusEnumFactory().fromType(castToCode(value));
3698      this.status = (Enumeration) value; // Enumeration<ImagingStudyStatus>
3699      return value;
3700    case -622722335: // modality
3701      this.getModality().add(castToCoding(value)); // Coding
3702      return value;
3703    case -1867885268: // subject
3704      this.subject = castToReference(value); // Reference
3705      return value;
3706    case 1524132147: // encounter
3707      this.encounter = castToReference(value); // Reference
3708      return value;
3709    case -1897185151: // started
3710      this.started = castToDateTime(value); // DateTimeType
3711      return value;
3712    case -332612366: // basedOn
3713      this.getBasedOn().add(castToReference(value)); // Reference
3714      return value;
3715    case -722568161: // referrer
3716      this.referrer = castToReference(value); // Reference
3717      return value;
3718    case -2008009094: // interpreter
3719      this.getInterpreter().add(castToReference(value)); // Reference
3720      return value;
3721    case 1741102485: // endpoint
3722      this.getEndpoint().add(castToReference(value)); // Reference
3723      return value;
3724    case 1920000407: // numberOfSeries
3725      this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
3726      return value;
3727    case -1043544226: // numberOfInstances
3728      this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
3729      return value;
3730    case 881809848: // procedureReference
3731      this.procedureReference = castToReference(value); // Reference
3732      return value;
3733    case -698023072: // procedureCode
3734      this.getProcedureCode().add(castToCodeableConcept(value)); // CodeableConcept
3735      return value;
3736    case 1901043637: // location
3737      this.location = castToReference(value); // Reference
3738      return value;
3739    case 722137681: // reasonCode
3740      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
3741      return value;
3742    case -1146218137: // reasonReference
3743      this.getReasonReference().add(castToReference(value)); // Reference
3744      return value;
3745    case 3387378: // note
3746      this.getNote().add(castToAnnotation(value)); // Annotation
3747      return value;
3748    case -1724546052: // description
3749      this.description = castToString(value); // StringType
3750      return value;
3751    case -905838985: // series
3752      this.getSeries().add((ImagingStudySeriesComponent) value); // ImagingStudySeriesComponent
3753      return value;
3754    default:
3755      return super.setProperty(hash, name, value);
3756    }
3757
3758  }
3759
3760  @Override
3761  public Base setProperty(String name, Base value) throws FHIRException {
3762    if (name.equals("identifier")) {
3763      this.getIdentifier().add(castToIdentifier(value));
3764    } else if (name.equals("status")) {
3765      value = new ImagingStudyStatusEnumFactory().fromType(castToCode(value));
3766      this.status = (Enumeration) value; // Enumeration<ImagingStudyStatus>
3767    } else if (name.equals("modality")) {
3768      this.getModality().add(castToCoding(value));
3769    } else if (name.equals("subject")) {
3770      this.subject = castToReference(value); // Reference
3771    } else if (name.equals("encounter")) {
3772      this.encounter = castToReference(value); // Reference
3773    } else if (name.equals("started")) {
3774      this.started = castToDateTime(value); // DateTimeType
3775    } else if (name.equals("basedOn")) {
3776      this.getBasedOn().add(castToReference(value));
3777    } else if (name.equals("referrer")) {
3778      this.referrer = castToReference(value); // Reference
3779    } else if (name.equals("interpreter")) {
3780      this.getInterpreter().add(castToReference(value));
3781    } else if (name.equals("endpoint")) {
3782      this.getEndpoint().add(castToReference(value));
3783    } else if (name.equals("numberOfSeries")) {
3784      this.numberOfSeries = castToUnsignedInt(value); // UnsignedIntType
3785    } else if (name.equals("numberOfInstances")) {
3786      this.numberOfInstances = castToUnsignedInt(value); // UnsignedIntType
3787    } else if (name.equals("procedureReference")) {
3788      this.procedureReference = castToReference(value); // Reference
3789    } else if (name.equals("procedureCode")) {
3790      this.getProcedureCode().add(castToCodeableConcept(value));
3791    } else if (name.equals("location")) {
3792      this.location = castToReference(value); // Reference
3793    } else if (name.equals("reasonCode")) {
3794      this.getReasonCode().add(castToCodeableConcept(value));
3795    } else if (name.equals("reasonReference")) {
3796      this.getReasonReference().add(castToReference(value));
3797    } else if (name.equals("note")) {
3798      this.getNote().add(castToAnnotation(value));
3799    } else if (name.equals("description")) {
3800      this.description = castToString(value); // StringType
3801    } else if (name.equals("series")) {
3802      this.getSeries().add((ImagingStudySeriesComponent) value);
3803    } else
3804      return super.setProperty(name, value);
3805    return value;
3806  }
3807
3808  @Override
3809  public void removeChild(String name, Base value) throws FHIRException {
3810    if (name.equals("identifier")) {
3811      this.getIdentifier().remove(castToIdentifier(value));
3812    } else if (name.equals("status")) {
3813      this.status = null;
3814    } else if (name.equals("modality")) {
3815      this.getModality().remove(castToCoding(value));
3816    } else if (name.equals("subject")) {
3817      this.subject = null;
3818    } else if (name.equals("encounter")) {
3819      this.encounter = null;
3820    } else if (name.equals("started")) {
3821      this.started = null;
3822    } else if (name.equals("basedOn")) {
3823      this.getBasedOn().remove(castToReference(value));
3824    } else if (name.equals("referrer")) {
3825      this.referrer = null;
3826    } else if (name.equals("interpreter")) {
3827      this.getInterpreter().remove(castToReference(value));
3828    } else if (name.equals("endpoint")) {
3829      this.getEndpoint().remove(castToReference(value));
3830    } else if (name.equals("numberOfSeries")) {
3831      this.numberOfSeries = null;
3832    } else if (name.equals("numberOfInstances")) {
3833      this.numberOfInstances = null;
3834    } else if (name.equals("procedureReference")) {
3835      this.procedureReference = null;
3836    } else if (name.equals("procedureCode")) {
3837      this.getProcedureCode().remove(castToCodeableConcept(value));
3838    } else if (name.equals("location")) {
3839      this.location = null;
3840    } else if (name.equals("reasonCode")) {
3841      this.getReasonCode().remove(castToCodeableConcept(value));
3842    } else if (name.equals("reasonReference")) {
3843      this.getReasonReference().remove(castToReference(value));
3844    } else if (name.equals("note")) {
3845      this.getNote().remove(castToAnnotation(value));
3846    } else if (name.equals("description")) {
3847      this.description = null;
3848    } else if (name.equals("series")) {
3849      this.getSeries().remove((ImagingStudySeriesComponent) value);
3850    } else
3851      super.removeChild(name, value);
3852    
3853  }
3854
3855  @Override
3856  public Base makeProperty(int hash, String name) throws FHIRException {
3857    switch (hash) {
3858    case -1618432855:
3859      return addIdentifier();
3860    case -892481550:
3861      return getStatusElement();
3862    case -622722335:
3863      return addModality();
3864    case -1867885268:
3865      return getSubject();
3866    case 1524132147:
3867      return getEncounter();
3868    case -1897185151:
3869      return getStartedElement();
3870    case -332612366:
3871      return addBasedOn();
3872    case -722568161:
3873      return getReferrer();
3874    case -2008009094:
3875      return addInterpreter();
3876    case 1741102485:
3877      return addEndpoint();
3878    case 1920000407:
3879      return getNumberOfSeriesElement();
3880    case -1043544226:
3881      return getNumberOfInstancesElement();
3882    case 881809848:
3883      return getProcedureReference();
3884    case -698023072:
3885      return addProcedureCode();
3886    case 1901043637:
3887      return getLocation();
3888    case 722137681:
3889      return addReasonCode();
3890    case -1146218137:
3891      return addReasonReference();
3892    case 3387378:
3893      return addNote();
3894    case -1724546052:
3895      return getDescriptionElement();
3896    case -905838985:
3897      return addSeries();
3898    default:
3899      return super.makeProperty(hash, name);
3900    }
3901
3902  }
3903
3904  @Override
3905  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3906    switch (hash) {
3907    case -1618432855:
3908      /* identifier */ return new String[] { "Identifier" };
3909    case -892481550:
3910      /* status */ return new String[] { "code" };
3911    case -622722335:
3912      /* modality */ return new String[] { "Coding" };
3913    case -1867885268:
3914      /* subject */ return new String[] { "Reference" };
3915    case 1524132147:
3916      /* encounter */ return new String[] { "Reference" };
3917    case -1897185151:
3918      /* started */ return new String[] { "dateTime" };
3919    case -332612366:
3920      /* basedOn */ return new String[] { "Reference" };
3921    case -722568161:
3922      /* referrer */ return new String[] { "Reference" };
3923    case -2008009094:
3924      /* interpreter */ return new String[] { "Reference" };
3925    case 1741102485:
3926      /* endpoint */ return new String[] { "Reference" };
3927    case 1920000407:
3928      /* numberOfSeries */ return new String[] { "unsignedInt" };
3929    case -1043544226:
3930      /* numberOfInstances */ return new String[] { "unsignedInt" };
3931    case 881809848:
3932      /* procedureReference */ return new String[] { "Reference" };
3933    case -698023072:
3934      /* procedureCode */ return new String[] { "CodeableConcept" };
3935    case 1901043637:
3936      /* location */ return new String[] { "Reference" };
3937    case 722137681:
3938      /* reasonCode */ return new String[] { "CodeableConcept" };
3939    case -1146218137:
3940      /* reasonReference */ return new String[] { "Reference" };
3941    case 3387378:
3942      /* note */ return new String[] { "Annotation" };
3943    case -1724546052:
3944      /* description */ return new String[] { "string" };
3945    case -905838985:
3946      /* series */ return new String[] {};
3947    default:
3948      return super.getTypesForProperty(hash, name);
3949    }
3950
3951  }
3952
3953  @Override
3954  public Base addChild(String name) throws FHIRException {
3955    if (name.equals("identifier")) {
3956      return addIdentifier();
3957    } else if (name.equals("status")) {
3958      throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.status");
3959    } else if (name.equals("modality")) {
3960      return addModality();
3961    } else if (name.equals("subject")) {
3962      this.subject = new Reference();
3963      return this.subject;
3964    } else if (name.equals("encounter")) {
3965      this.encounter = new Reference();
3966      return this.encounter;
3967    } else if (name.equals("started")) {
3968      throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.started");
3969    } else if (name.equals("basedOn")) {
3970      return addBasedOn();
3971    } else if (name.equals("referrer")) {
3972      this.referrer = new Reference();
3973      return this.referrer;
3974    } else if (name.equals("interpreter")) {
3975      return addInterpreter();
3976    } else if (name.equals("endpoint")) {
3977      return addEndpoint();
3978    } else if (name.equals("numberOfSeries")) {
3979      throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.numberOfSeries");
3980    } else if (name.equals("numberOfInstances")) {
3981      throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.numberOfInstances");
3982    } else if (name.equals("procedureReference")) {
3983      this.procedureReference = new Reference();
3984      return this.procedureReference;
3985    } else if (name.equals("procedureCode")) {
3986      return addProcedureCode();
3987    } else if (name.equals("location")) {
3988      this.location = new Reference();
3989      return this.location;
3990    } else if (name.equals("reasonCode")) {
3991      return addReasonCode();
3992    } else if (name.equals("reasonReference")) {
3993      return addReasonReference();
3994    } else if (name.equals("note")) {
3995      return addNote();
3996    } else if (name.equals("description")) {
3997      throw new FHIRException("Cannot call addChild on a singleton property ImagingStudy.description");
3998    } else if (name.equals("series")) {
3999      return addSeries();
4000    } else
4001      return super.addChild(name);
4002  }
4003
4004  public String fhirType() {
4005    return "ImagingStudy";
4006
4007  }
4008
4009  public ImagingStudy copy() {
4010    ImagingStudy dst = new ImagingStudy();
4011    copyValues(dst);
4012    return dst;
4013  }
4014
4015  public void copyValues(ImagingStudy dst) {
4016    super.copyValues(dst);
4017    if (identifier != null) {
4018      dst.identifier = new ArrayList<Identifier>();
4019      for (Identifier i : identifier)
4020        dst.identifier.add(i.copy());
4021    }
4022    ;
4023    dst.status = status == null ? null : status.copy();
4024    if (modality != null) {
4025      dst.modality = new ArrayList<Coding>();
4026      for (Coding i : modality)
4027        dst.modality.add(i.copy());
4028    }
4029    ;
4030    dst.subject = subject == null ? null : subject.copy();
4031    dst.encounter = encounter == null ? null : encounter.copy();
4032    dst.started = started == null ? null : started.copy();
4033    if (basedOn != null) {
4034      dst.basedOn = new ArrayList<Reference>();
4035      for (Reference i : basedOn)
4036        dst.basedOn.add(i.copy());
4037    }
4038    ;
4039    dst.referrer = referrer == null ? null : referrer.copy();
4040    if (interpreter != null) {
4041      dst.interpreter = new ArrayList<Reference>();
4042      for (Reference i : interpreter)
4043        dst.interpreter.add(i.copy());
4044    }
4045    ;
4046    if (endpoint != null) {
4047      dst.endpoint = new ArrayList<Reference>();
4048      for (Reference i : endpoint)
4049        dst.endpoint.add(i.copy());
4050    }
4051    ;
4052    dst.numberOfSeries = numberOfSeries == null ? null : numberOfSeries.copy();
4053    dst.numberOfInstances = numberOfInstances == null ? null : numberOfInstances.copy();
4054    dst.procedureReference = procedureReference == null ? null : procedureReference.copy();
4055    if (procedureCode != null) {
4056      dst.procedureCode = new ArrayList<CodeableConcept>();
4057      for (CodeableConcept i : procedureCode)
4058        dst.procedureCode.add(i.copy());
4059    }
4060    ;
4061    dst.location = location == null ? null : location.copy();
4062    if (reasonCode != null) {
4063      dst.reasonCode = new ArrayList<CodeableConcept>();
4064      for (CodeableConcept i : reasonCode)
4065        dst.reasonCode.add(i.copy());
4066    }
4067    ;
4068    if (reasonReference != null) {
4069      dst.reasonReference = new ArrayList<Reference>();
4070      for (Reference i : reasonReference)
4071        dst.reasonReference.add(i.copy());
4072    }
4073    ;
4074    if (note != null) {
4075      dst.note = new ArrayList<Annotation>();
4076      for (Annotation i : note)
4077        dst.note.add(i.copy());
4078    }
4079    ;
4080    dst.description = description == null ? null : description.copy();
4081    if (series != null) {
4082      dst.series = new ArrayList<ImagingStudySeriesComponent>();
4083      for (ImagingStudySeriesComponent i : series)
4084        dst.series.add(i.copy());
4085    }
4086    ;
4087  }
4088
4089  protected ImagingStudy typedCopy() {
4090    return copy();
4091  }
4092
4093  @Override
4094  public boolean equalsDeep(Base other_) {
4095    if (!super.equalsDeep(other_))
4096      return false;
4097    if (!(other_ instanceof ImagingStudy))
4098      return false;
4099    ImagingStudy o = (ImagingStudy) other_;
4100    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
4101        && compareDeep(modality, o.modality, true) && compareDeep(subject, o.subject, true)
4102        && compareDeep(encounter, o.encounter, true) && compareDeep(started, o.started, true)
4103        && compareDeep(basedOn, o.basedOn, true) && compareDeep(referrer, o.referrer, true)
4104        && compareDeep(interpreter, o.interpreter, true) && compareDeep(endpoint, o.endpoint, true)
4105        && compareDeep(numberOfSeries, o.numberOfSeries, true)
4106        && compareDeep(numberOfInstances, o.numberOfInstances, true)
4107        && compareDeep(procedureReference, o.procedureReference, true)
4108        && compareDeep(procedureCode, o.procedureCode, true) && compareDeep(location, o.location, true)
4109        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
4110        && compareDeep(note, o.note, true) && compareDeep(description, o.description, true)
4111        && compareDeep(series, o.series, true);
4112  }
4113
4114  @Override
4115  public boolean equalsShallow(Base other_) {
4116    if (!super.equalsShallow(other_))
4117      return false;
4118    if (!(other_ instanceof ImagingStudy))
4119      return false;
4120    ImagingStudy o = (ImagingStudy) other_;
4121    return compareValues(status, o.status, true) && compareValues(started, o.started, true)
4122        && compareValues(numberOfSeries, o.numberOfSeries, true)
4123        && compareValues(numberOfInstances, o.numberOfInstances, true)
4124        && compareValues(description, o.description, true);
4125  }
4126
4127  public boolean isEmpty() {
4128    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, modality, subject, encounter,
4129        started, basedOn, referrer, interpreter, endpoint, numberOfSeries, numberOfInstances, procedureReference,
4130        procedureCode, location, reasonCode, reasonReference, note, description, series);
4131  }
4132
4133  @Override
4134  public ResourceType getResourceType() {
4135    return ResourceType.ImagingStudy;
4136  }
4137
4138  /**
4139   * Search parameter: <b>identifier</b>
4140   * <p>
4141   * Description: <b>Identifiers for the Study, such as DICOM Study Instance UID
4142   * and Accession number</b><br>
4143   * Type: <b>token</b><br>
4144   * Path: <b>ImagingStudy.identifier</b><br>
4145   * </p>
4146   */
4147  @SearchParamDefinition(name = "identifier", path = "ImagingStudy.identifier", description = "Identifiers for the Study, such as DICOM Study Instance UID and Accession number", type = "token")
4148  public static final String SP_IDENTIFIER = "identifier";
4149  /**
4150   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4151   * <p>
4152   * Description: <b>Identifiers for the Study, such as DICOM Study Instance UID
4153   * and Accession number</b><br>
4154   * Type: <b>token</b><br>
4155   * Path: <b>ImagingStudy.identifier</b><br>
4156   * </p>
4157   */
4158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4159      SP_IDENTIFIER);
4160
4161  /**
4162   * Search parameter: <b>reason</b>
4163   * <p>
4164   * Description: <b>The reason for the study</b><br>
4165   * Type: <b>token</b><br>
4166   * Path: <b>ImagingStudy.reasonCode</b><br>
4167   * </p>
4168   */
4169  @SearchParamDefinition(name = "reason", path = "ImagingStudy.reasonCode", description = "The reason for the study", type = "token")
4170  public static final String SP_REASON = "reason";
4171  /**
4172   * <b>Fluent Client</b> search parameter constant for <b>reason</b>
4173   * <p>
4174   * Description: <b>The reason for the study</b><br>
4175   * Type: <b>token</b><br>
4176   * Path: <b>ImagingStudy.reasonCode</b><br>
4177   * </p>
4178   */
4179  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4180      SP_REASON);
4181
4182  /**
4183   * Search parameter: <b>dicom-class</b>
4184   * <p>
4185   * Description: <b>The type of the instance</b><br>
4186   * Type: <b>token</b><br>
4187   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
4188   * </p>
4189   */
4190  @SearchParamDefinition(name = "dicom-class", path = "ImagingStudy.series.instance.sopClass", description = "The type of the instance", type = "token")
4191  public static final String SP_DICOM_CLASS = "dicom-class";
4192  /**
4193   * <b>Fluent Client</b> search parameter constant for <b>dicom-class</b>
4194   * <p>
4195   * Description: <b>The type of the instance</b><br>
4196   * Type: <b>token</b><br>
4197   * Path: <b>ImagingStudy.series.instance.sopClass</b><br>
4198   * </p>
4199   */
4200  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DICOM_CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4201      SP_DICOM_CLASS);
4202
4203  /**
4204   * Search parameter: <b>modality</b>
4205   * <p>
4206   * Description: <b>The modality of the series</b><br>
4207   * Type: <b>token</b><br>
4208   * Path: <b>ImagingStudy.series.modality</b><br>
4209   * </p>
4210   */
4211  @SearchParamDefinition(name = "modality", path = "ImagingStudy.series.modality", description = "The modality of the series", type = "token")
4212  public static final String SP_MODALITY = "modality";
4213  /**
4214   * <b>Fluent Client</b> search parameter constant for <b>modality</b>
4215   * <p>
4216   * Description: <b>The modality of the series</b><br>
4217   * Type: <b>token</b><br>
4218   * Path: <b>ImagingStudy.series.modality</b><br>
4219   * </p>
4220   */
4221  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MODALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4222      SP_MODALITY);
4223
4224  /**
4225   * Search parameter: <b>bodysite</b>
4226   * <p>
4227   * Description: <b>The body site studied</b><br>
4228   * Type: <b>token</b><br>
4229   * Path: <b>ImagingStudy.series.bodySite</b><br>
4230   * </p>
4231   */
4232  @SearchParamDefinition(name = "bodysite", path = "ImagingStudy.series.bodySite", description = "The body site studied", type = "token")
4233  public static final String SP_BODYSITE = "bodysite";
4234  /**
4235   * <b>Fluent Client</b> search parameter constant for <b>bodysite</b>
4236   * <p>
4237   * Description: <b>The body site studied</b><br>
4238   * Type: <b>token</b><br>
4239   * Path: <b>ImagingStudy.series.bodySite</b><br>
4240   * </p>
4241   */
4242  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4243      SP_BODYSITE);
4244
4245  /**
4246   * Search parameter: <b>instance</b>
4247   * <p>
4248   * Description: <b>SOP Instance UID for an instance</b><br>
4249   * Type: <b>token</b><br>
4250   * Path: <b>ImagingStudy.series.instance.uid</b><br>
4251   * </p>
4252   */
4253  @SearchParamDefinition(name = "instance", path = "ImagingStudy.series.instance.uid", description = "SOP Instance UID for an instance", type = "token")
4254  public static final String SP_INSTANCE = "instance";
4255  /**
4256   * <b>Fluent Client</b> search parameter constant for <b>instance</b>
4257   * <p>
4258   * Description: <b>SOP Instance UID for an instance</b><br>
4259   * Type: <b>token</b><br>
4260   * Path: <b>ImagingStudy.series.instance.uid</b><br>
4261   * </p>
4262   */
4263  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INSTANCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4264      SP_INSTANCE);
4265
4266  /**
4267   * Search parameter: <b>performer</b>
4268   * <p>
4269   * Description: <b>The person who performed the study</b><br>
4270   * Type: <b>reference</b><br>
4271   * Path: <b>ImagingStudy.series.performer.actor</b><br>
4272   * </p>
4273   */
4274  @SearchParamDefinition(name = "performer", path = "ImagingStudy.series.performer.actor", description = "The person who performed the study", type = "reference", target = {
4275      CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
4276      RelatedPerson.class })
4277  public static final String SP_PERFORMER = "performer";
4278  /**
4279   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
4280   * <p>
4281   * Description: <b>The person who performed the study</b><br>
4282   * Type: <b>reference</b><br>
4283   * Path: <b>ImagingStudy.series.performer.actor</b><br>
4284   * </p>
4285   */
4286  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4287      SP_PERFORMER);
4288
4289  /**
4290   * Constant for fluent queries to be used to add include statements. Specifies
4291   * the path value of "<b>ImagingStudy:performer</b>".
4292   */
4293  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include(
4294      "ImagingStudy:performer").toLocked();
4295
4296  /**
4297   * Search parameter: <b>subject</b>
4298   * <p>
4299   * Description: <b>Who the study is about</b><br>
4300   * Type: <b>reference</b><br>
4301   * Path: <b>ImagingStudy.subject</b><br>
4302   * </p>
4303   */
4304  @SearchParamDefinition(name = "subject", path = "ImagingStudy.subject", description = "Who the study is about", type = "reference", target = {
4305      Device.class, Group.class, Patient.class })
4306  public static final String SP_SUBJECT = "subject";
4307  /**
4308   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4309   * <p>
4310   * Description: <b>Who the study is about</b><br>
4311   * Type: <b>reference</b><br>
4312   * Path: <b>ImagingStudy.subject</b><br>
4313   * </p>
4314   */
4315  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4316      SP_SUBJECT);
4317
4318  /**
4319   * Constant for fluent queries to be used to add include statements. Specifies
4320   * the path value of "<b>ImagingStudy:subject</b>".
4321   */
4322  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
4323      "ImagingStudy:subject").toLocked();
4324
4325  /**
4326   * Search parameter: <b>started</b>
4327   * <p>
4328   * Description: <b>When the study was started</b><br>
4329   * Type: <b>date</b><br>
4330   * Path: <b>ImagingStudy.started</b><br>
4331   * </p>
4332   */
4333  @SearchParamDefinition(name = "started", path = "ImagingStudy.started", description = "When the study was started", type = "date")
4334  public static final String SP_STARTED = "started";
4335  /**
4336   * <b>Fluent Client</b> search parameter constant for <b>started</b>
4337   * <p>
4338   * Description: <b>When the study was started</b><br>
4339   * Type: <b>date</b><br>
4340   * Path: <b>ImagingStudy.started</b><br>
4341   * </p>
4342   */
4343  public static final ca.uhn.fhir.rest.gclient.DateClientParam STARTED = new ca.uhn.fhir.rest.gclient.DateClientParam(
4344      SP_STARTED);
4345
4346  /**
4347   * Search parameter: <b>interpreter</b>
4348   * <p>
4349   * Description: <b>Who interpreted the images</b><br>
4350   * Type: <b>reference</b><br>
4351   * Path: <b>ImagingStudy.interpreter</b><br>
4352   * </p>
4353   */
4354  @SearchParamDefinition(name = "interpreter", path = "ImagingStudy.interpreter", description = "Who interpreted the images", type = "reference", target = {
4355      Practitioner.class, PractitionerRole.class })
4356  public static final String SP_INTERPRETER = "interpreter";
4357  /**
4358   * <b>Fluent Client</b> search parameter constant for <b>interpreter</b>
4359   * <p>
4360   * Description: <b>Who interpreted the images</b><br>
4361   * Type: <b>reference</b><br>
4362   * Path: <b>ImagingStudy.interpreter</b><br>
4363   * </p>
4364   */
4365  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTERPRETER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4366      SP_INTERPRETER);
4367
4368  /**
4369   * Constant for fluent queries to be used to add include statements. Specifies
4370   * the path value of "<b>ImagingStudy:interpreter</b>".
4371   */
4372  public static final ca.uhn.fhir.model.api.Include INCLUDE_INTERPRETER = new ca.uhn.fhir.model.api.Include(
4373      "ImagingStudy:interpreter").toLocked();
4374
4375  /**
4376   * Search parameter: <b>encounter</b>
4377   * <p>
4378   * Description: <b>The context of the study</b><br>
4379   * Type: <b>reference</b><br>
4380   * Path: <b>ImagingStudy.encounter</b><br>
4381   * </p>
4382   */
4383  @SearchParamDefinition(name = "encounter", path = "ImagingStudy.encounter", description = "The context of the study", type = "reference", target = {
4384      Encounter.class })
4385  public static final String SP_ENCOUNTER = "encounter";
4386  /**
4387   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4388   * <p>
4389   * Description: <b>The context of the study</b><br>
4390   * Type: <b>reference</b><br>
4391   * Path: <b>ImagingStudy.encounter</b><br>
4392   * </p>
4393   */
4394  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4395      SP_ENCOUNTER);
4396
4397  /**
4398   * Constant for fluent queries to be used to add include statements. Specifies
4399   * the path value of "<b>ImagingStudy:encounter</b>".
4400   */
4401  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
4402      "ImagingStudy:encounter").toLocked();
4403
4404  /**
4405   * Search parameter: <b>referrer</b>
4406   * <p>
4407   * Description: <b>The referring physician</b><br>
4408   * Type: <b>reference</b><br>
4409   * Path: <b>ImagingStudy.referrer</b><br>
4410   * </p>
4411   */
4412  @SearchParamDefinition(name = "referrer", path = "ImagingStudy.referrer", description = "The referring physician", type = "reference", target = {
4413      Practitioner.class, PractitionerRole.class })
4414  public static final String SP_REFERRER = "referrer";
4415  /**
4416   * <b>Fluent Client</b> search parameter constant for <b>referrer</b>
4417   * <p>
4418   * Description: <b>The referring physician</b><br>
4419   * Type: <b>reference</b><br>
4420   * Path: <b>ImagingStudy.referrer</b><br>
4421   * </p>
4422   */
4423  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REFERRER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4424      SP_REFERRER);
4425
4426  /**
4427   * Constant for fluent queries to be used to add include statements. Specifies
4428   * the path value of "<b>ImagingStudy:referrer</b>".
4429   */
4430  public static final ca.uhn.fhir.model.api.Include INCLUDE_REFERRER = new ca.uhn.fhir.model.api.Include(
4431      "ImagingStudy:referrer").toLocked();
4432
4433  /**
4434   * Search parameter: <b>endpoint</b>
4435   * <p>
4436   * Description: <b>The endpoint for the study or series</b><br>
4437   * Type: <b>reference</b><br>
4438   * Path: <b>ImagingStudy.endpoint, ImagingStudy.series.endpoint</b><br>
4439   * </p>
4440   */
4441  @SearchParamDefinition(name = "endpoint", path = "ImagingStudy.endpoint | ImagingStudy.series.endpoint", description = "The endpoint for the study or series", type = "reference", target = {
4442      Endpoint.class })
4443  public static final String SP_ENDPOINT = "endpoint";
4444  /**
4445   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
4446   * <p>
4447   * Description: <b>The endpoint for the study or series</b><br>
4448   * Type: <b>reference</b><br>
4449   * Path: <b>ImagingStudy.endpoint, ImagingStudy.series.endpoint</b><br>
4450   * </p>
4451   */
4452  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4453      SP_ENDPOINT);
4454
4455  /**
4456   * Constant for fluent queries to be used to add include statements. Specifies
4457   * the path value of "<b>ImagingStudy:endpoint</b>".
4458   */
4459  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include(
4460      "ImagingStudy:endpoint").toLocked();
4461
4462  /**
4463   * Search parameter: <b>patient</b>
4464   * <p>
4465   * Description: <b>Who the study is about</b><br>
4466   * Type: <b>reference</b><br>
4467   * Path: <b>ImagingStudy.subject</b><br>
4468   * </p>
4469   */
4470  @SearchParamDefinition(name = "patient", path = "ImagingStudy.subject.where(resolve() is Patient)", description = "Who the study is about", type = "reference", providesMembershipIn = {
4471      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
4472  public static final String SP_PATIENT = "patient";
4473  /**
4474   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4475   * <p>
4476   * Description: <b>Who the study is about</b><br>
4477   * Type: <b>reference</b><br>
4478   * Path: <b>ImagingStudy.subject</b><br>
4479   * </p>
4480   */
4481  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4482      SP_PATIENT);
4483
4484  /**
4485   * Constant for fluent queries to be used to add include statements. Specifies
4486   * the path value of "<b>ImagingStudy:patient</b>".
4487   */
4488  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
4489      "ImagingStudy:patient").toLocked();
4490
4491  /**
4492   * Search parameter: <b>series</b>
4493   * <p>
4494   * Description: <b>DICOM Series Instance UID for a series</b><br>
4495   * Type: <b>token</b><br>
4496   * Path: <b>ImagingStudy.series.uid</b><br>
4497   * </p>
4498   */
4499  @SearchParamDefinition(name = "series", path = "ImagingStudy.series.uid", description = "DICOM Series Instance UID for a series", type = "token")
4500  public static final String SP_SERIES = "series";
4501  /**
4502   * <b>Fluent Client</b> search parameter constant for <b>series</b>
4503   * <p>
4504   * Description: <b>DICOM Series Instance UID for a series</b><br>
4505   * Type: <b>token</b><br>
4506   * Path: <b>ImagingStudy.series.uid</b><br>
4507   * </p>
4508   */
4509  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIES = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4510      SP_SERIES);
4511
4512  /**
4513   * Search parameter: <b>basedon</b>
4514   * <p>
4515   * Description: <b>The order for the image</b><br>
4516   * Type: <b>reference</b><br>
4517   * Path: <b>ImagingStudy.basedOn</b><br>
4518   * </p>
4519   */
4520  @SearchParamDefinition(name = "basedon", path = "ImagingStudy.basedOn", description = "The order for the image", type = "reference", target = {
4521      Appointment.class, AppointmentResponse.class, CarePlan.class, ServiceRequest.class, Task.class })
4522  public static final String SP_BASEDON = "basedon";
4523  /**
4524   * <b>Fluent Client</b> search parameter constant for <b>basedon</b>
4525   * <p>
4526   * Description: <b>The order for the image</b><br>
4527   * Type: <b>reference</b><br>
4528   * Path: <b>ImagingStudy.basedOn</b><br>
4529   * </p>
4530   */
4531  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASEDON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4532      SP_BASEDON);
4533
4534  /**
4535   * Constant for fluent queries to be used to add include statements. Specifies
4536   * the path value of "<b>ImagingStudy:basedon</b>".
4537   */
4538  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASEDON = new ca.uhn.fhir.model.api.Include(
4539      "ImagingStudy:basedon").toLocked();
4540
4541  /**
4542   * Search parameter: <b>status</b>
4543   * <p>
4544   * Description: <b>The status of the study</b><br>
4545   * Type: <b>token</b><br>
4546   * Path: <b>ImagingStudy.status</b><br>
4547   * </p>
4548   */
4549  @SearchParamDefinition(name = "status", path = "ImagingStudy.status", description = "The status of the study", type = "token")
4550  public static final String SP_STATUS = "status";
4551  /**
4552   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4553   * <p>
4554   * Description: <b>The status of the study</b><br>
4555   * Type: <b>token</b><br>
4556   * Path: <b>ImagingStudy.status</b><br>
4557   * </p>
4558   */
4559  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4560      SP_STATUS);
4561
4562}