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.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045
046/**
047 * A process where a researcher or organization plans and then executes a series
048 * of steps intended to increase the field of healthcare-related knowledge. This
049 * includes studies of safety, efficacy, comparative effectiveness and other
050 * information about medications, devices, therapies and other interventional
051 * and investigative techniques. A ResearchStudy involves the gathering of
052 * information about human or animal subjects.
053 */
054@ResourceDef(name = "ResearchStudy", profile = "http://hl7.org/fhir/StructureDefinition/ResearchStudy")
055public class ResearchStudy extends DomainResource {
056
057  public enum ResearchStudyStatus {
058    /**
059     * Study is opened for accrual.
060     */
061    ACTIVE,
062    /**
063     * Study is completed prematurely and will not resume; patients are no longer
064     * examined nor treated.
065     */
066    ADMINISTRATIVELYCOMPLETED,
067    /**
068     * Protocol is approved by the review board.
069     */
070    APPROVED,
071    /**
072     * Study is closed for accrual; patients can be examined and treated.
073     */
074    CLOSEDTOACCRUAL,
075    /**
076     * Study is closed to accrual and intervention, i.e. the study is closed to
077     * enrollment, all study subjects have completed treatment or intervention but
078     * are still being followed according to the primary objective of the study.
079     */
080    CLOSEDTOACCRUALANDINTERVENTION,
081    /**
082     * Study is closed to accrual and intervention, i.e. the study is closed to
083     * enrollment, all study subjects have completed treatment or intervention but
084     * are still being followed according to the primary objective of the study.
085     */
086    COMPLETED,
087    /**
088     * Protocol was disapproved by the review board.
089     */
090    DISAPPROVED,
091    /**
092     * Protocol is submitted to the review board for approval.
093     */
094    INREVIEW,
095    /**
096     * Study is temporarily closed for accrual; can be potentially resumed in the
097     * future; patients can be examined and treated.
098     */
099    TEMPORARILYCLOSEDTOACCRUAL,
100    /**
101     * Study is temporarily closed for accrual and intervention and potentially can
102     * be resumed in the future.
103     */
104    TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION,
105    /**
106     * Protocol was withdrawn by the lead organization.
107     */
108    WITHDRAWN,
109    /**
110     * added to help the parsers with the generic types
111     */
112    NULL;
113
114    public static ResearchStudyStatus fromCode(String codeString) throws FHIRException {
115      if (codeString == null || "".equals(codeString))
116        return null;
117      if ("active".equals(codeString))
118        return ACTIVE;
119      if ("administratively-completed".equals(codeString))
120        return ADMINISTRATIVELYCOMPLETED;
121      if ("approved".equals(codeString))
122        return APPROVED;
123      if ("closed-to-accrual".equals(codeString))
124        return CLOSEDTOACCRUAL;
125      if ("closed-to-accrual-and-intervention".equals(codeString))
126        return CLOSEDTOACCRUALANDINTERVENTION;
127      if ("completed".equals(codeString))
128        return COMPLETED;
129      if ("disapproved".equals(codeString))
130        return DISAPPROVED;
131      if ("in-review".equals(codeString))
132        return INREVIEW;
133      if ("temporarily-closed-to-accrual".equals(codeString))
134        return TEMPORARILYCLOSEDTOACCRUAL;
135      if ("temporarily-closed-to-accrual-and-intervention".equals(codeString))
136        return TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION;
137      if ("withdrawn".equals(codeString))
138        return WITHDRAWN;
139      if (Configuration.isAcceptInvalidEnums())
140        return null;
141      else
142        throw new FHIRException("Unknown ResearchStudyStatus code '" + codeString + "'");
143    }
144
145    public String toCode() {
146      switch (this) {
147      case ACTIVE:
148        return "active";
149      case ADMINISTRATIVELYCOMPLETED:
150        return "administratively-completed";
151      case APPROVED:
152        return "approved";
153      case CLOSEDTOACCRUAL:
154        return "closed-to-accrual";
155      case CLOSEDTOACCRUALANDINTERVENTION:
156        return "closed-to-accrual-and-intervention";
157      case COMPLETED:
158        return "completed";
159      case DISAPPROVED:
160        return "disapproved";
161      case INREVIEW:
162        return "in-review";
163      case TEMPORARILYCLOSEDTOACCRUAL:
164        return "temporarily-closed-to-accrual";
165      case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION:
166        return "temporarily-closed-to-accrual-and-intervention";
167      case WITHDRAWN:
168        return "withdrawn";
169      case NULL:
170        return null;
171      default:
172        return "?";
173      }
174    }
175
176    public String getSystem() {
177      switch (this) {
178      case ACTIVE:
179        return "http://hl7.org/fhir/research-study-status";
180      case ADMINISTRATIVELYCOMPLETED:
181        return "http://hl7.org/fhir/research-study-status";
182      case APPROVED:
183        return "http://hl7.org/fhir/research-study-status";
184      case CLOSEDTOACCRUAL:
185        return "http://hl7.org/fhir/research-study-status";
186      case CLOSEDTOACCRUALANDINTERVENTION:
187        return "http://hl7.org/fhir/research-study-status";
188      case COMPLETED:
189        return "http://hl7.org/fhir/research-study-status";
190      case DISAPPROVED:
191        return "http://hl7.org/fhir/research-study-status";
192      case INREVIEW:
193        return "http://hl7.org/fhir/research-study-status";
194      case TEMPORARILYCLOSEDTOACCRUAL:
195        return "http://hl7.org/fhir/research-study-status";
196      case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION:
197        return "http://hl7.org/fhir/research-study-status";
198      case WITHDRAWN:
199        return "http://hl7.org/fhir/research-study-status";
200      case NULL:
201        return null;
202      default:
203        return "?";
204      }
205    }
206
207    public String getDefinition() {
208      switch (this) {
209      case ACTIVE:
210        return "Study is opened for accrual.";
211      case ADMINISTRATIVELYCOMPLETED:
212        return "Study is completed prematurely and will not resume; patients are no longer examined nor treated.";
213      case APPROVED:
214        return "Protocol is approved by the review board.";
215      case CLOSEDTOACCRUAL:
216        return "Study is closed for accrual; patients can be examined and treated.";
217      case CLOSEDTOACCRUALANDINTERVENTION:
218        return "Study is closed to accrual and intervention, i.e. the study is closed to enrollment, all study subjects have completed treatment or intervention but are still being followed according to the primary objective of the study.";
219      case COMPLETED:
220        return "Study is closed to accrual and intervention, i.e. the study is closed to enrollment, all study subjects have completed treatment\nor intervention but are still being followed according to the primary objective of the study.";
221      case DISAPPROVED:
222        return "Protocol was disapproved by the review board.";
223      case INREVIEW:
224        return "Protocol is submitted to the review board for approval.";
225      case TEMPORARILYCLOSEDTOACCRUAL:
226        return "Study is temporarily closed for accrual; can be potentially resumed in the future; patients can be examined and treated.";
227      case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION:
228        return "Study is temporarily closed for accrual and intervention and potentially can be resumed in the future.";
229      case WITHDRAWN:
230        return "Protocol was withdrawn by the lead organization.";
231      case NULL:
232        return null;
233      default:
234        return "?";
235      }
236    }
237
238    public String getDisplay() {
239      switch (this) {
240      case ACTIVE:
241        return "Active";
242      case ADMINISTRATIVELYCOMPLETED:
243        return "Administratively Completed";
244      case APPROVED:
245        return "Approved";
246      case CLOSEDTOACCRUAL:
247        return "Closed to Accrual";
248      case CLOSEDTOACCRUALANDINTERVENTION:
249        return "Closed to Accrual and Intervention";
250      case COMPLETED:
251        return "Completed";
252      case DISAPPROVED:
253        return "Disapproved";
254      case INREVIEW:
255        return "In Review";
256      case TEMPORARILYCLOSEDTOACCRUAL:
257        return "Temporarily Closed to Accrual";
258      case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION:
259        return "Temporarily Closed to Accrual and Intervention";
260      case WITHDRAWN:
261        return "Withdrawn";
262      case NULL:
263        return null;
264      default:
265        return "?";
266      }
267    }
268  }
269
270  public static class ResearchStudyStatusEnumFactory implements EnumFactory<ResearchStudyStatus> {
271    public ResearchStudyStatus fromCode(String codeString) throws IllegalArgumentException {
272      if (codeString == null || "".equals(codeString))
273        if (codeString == null || "".equals(codeString))
274          return null;
275      if ("active".equals(codeString))
276        return ResearchStudyStatus.ACTIVE;
277      if ("administratively-completed".equals(codeString))
278        return ResearchStudyStatus.ADMINISTRATIVELYCOMPLETED;
279      if ("approved".equals(codeString))
280        return ResearchStudyStatus.APPROVED;
281      if ("closed-to-accrual".equals(codeString))
282        return ResearchStudyStatus.CLOSEDTOACCRUAL;
283      if ("closed-to-accrual-and-intervention".equals(codeString))
284        return ResearchStudyStatus.CLOSEDTOACCRUALANDINTERVENTION;
285      if ("completed".equals(codeString))
286        return ResearchStudyStatus.COMPLETED;
287      if ("disapproved".equals(codeString))
288        return ResearchStudyStatus.DISAPPROVED;
289      if ("in-review".equals(codeString))
290        return ResearchStudyStatus.INREVIEW;
291      if ("temporarily-closed-to-accrual".equals(codeString))
292        return ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUAL;
293      if ("temporarily-closed-to-accrual-and-intervention".equals(codeString))
294        return ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION;
295      if ("withdrawn".equals(codeString))
296        return ResearchStudyStatus.WITHDRAWN;
297      throw new IllegalArgumentException("Unknown ResearchStudyStatus code '" + codeString + "'");
298    }
299
300    public Enumeration<ResearchStudyStatus> fromType(PrimitiveType<?> code) throws FHIRException {
301      if (code == null)
302        return null;
303      if (code.isEmpty())
304        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.NULL, code);
305      String codeString = code.asStringValue();
306      if (codeString == null || "".equals(codeString))
307        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.NULL, code);
308      if ("active".equals(codeString))
309        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.ACTIVE, code);
310      if ("administratively-completed".equals(codeString))
311        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.ADMINISTRATIVELYCOMPLETED, code);
312      if ("approved".equals(codeString))
313        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.APPROVED, code);
314      if ("closed-to-accrual".equals(codeString))
315        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.CLOSEDTOACCRUAL, code);
316      if ("closed-to-accrual-and-intervention".equals(codeString))
317        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.CLOSEDTOACCRUALANDINTERVENTION, code);
318      if ("completed".equals(codeString))
319        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.COMPLETED, code);
320      if ("disapproved".equals(codeString))
321        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.DISAPPROVED, code);
322      if ("in-review".equals(codeString))
323        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.INREVIEW, code);
324      if ("temporarily-closed-to-accrual".equals(codeString))
325        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUAL, code);
326      if ("temporarily-closed-to-accrual-and-intervention".equals(codeString))
327        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION,
328            code);
329      if ("withdrawn".equals(codeString))
330        return new Enumeration<ResearchStudyStatus>(this, ResearchStudyStatus.WITHDRAWN, code);
331      throw new FHIRException("Unknown ResearchStudyStatus code '" + codeString + "'");
332    }
333
334    public String toCode(ResearchStudyStatus code) {
335      if (code == ResearchStudyStatus.ACTIVE)
336        return "active";
337      if (code == ResearchStudyStatus.ADMINISTRATIVELYCOMPLETED)
338        return "administratively-completed";
339      if (code == ResearchStudyStatus.APPROVED)
340        return "approved";
341      if (code == ResearchStudyStatus.CLOSEDTOACCRUAL)
342        return "closed-to-accrual";
343      if (code == ResearchStudyStatus.CLOSEDTOACCRUALANDINTERVENTION)
344        return "closed-to-accrual-and-intervention";
345      if (code == ResearchStudyStatus.COMPLETED)
346        return "completed";
347      if (code == ResearchStudyStatus.DISAPPROVED)
348        return "disapproved";
349      if (code == ResearchStudyStatus.INREVIEW)
350        return "in-review";
351      if (code == ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUAL)
352        return "temporarily-closed-to-accrual";
353      if (code == ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION)
354        return "temporarily-closed-to-accrual-and-intervention";
355      if (code == ResearchStudyStatus.WITHDRAWN)
356        return "withdrawn";
357      return "?";
358    }
359
360    public String toSystem(ResearchStudyStatus code) {
361      return code.getSystem();
362    }
363  }
364
365  @Block()
366  public static class ResearchStudyArmComponent extends BackboneElement implements IBaseBackboneElement {
367    /**
368     * Unique, human-readable label for this arm of the study.
369     */
370    @Child(name = "name", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
371    @Description(shortDefinition = "Label for study arm", formalDefinition = "Unique, human-readable label for this arm of the study.")
372    protected StringType name;
373
374    /**
375     * Categorization of study arm, e.g. experimental, active comparator, placebo
376     * comparater.
377     */
378    @Child(name = "type", type = {
379        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
380    @Description(shortDefinition = "Categorization of study arm", formalDefinition = "Categorization of study arm, e.g. experimental, active comparator, placebo comparater.")
381    protected CodeableConcept type;
382
383    /**
384     * A succinct description of the path through the study that would be followed
385     * by a subject adhering to this arm.
386     */
387    @Child(name = "description", type = {
388        StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
389    @Description(shortDefinition = "Short explanation of study path", formalDefinition = "A succinct description of the path through the study that would be followed by a subject adhering to this arm.")
390    protected StringType description;
391
392    private static final long serialVersionUID = 311445244L;
393
394    /**
395     * Constructor
396     */
397    public ResearchStudyArmComponent() {
398      super();
399    }
400
401    /**
402     * Constructor
403     */
404    public ResearchStudyArmComponent(StringType name) {
405      super();
406      this.name = name;
407    }
408
409    /**
410     * @return {@link #name} (Unique, human-readable label for this arm of the
411     *         study.). This is the underlying object with id, value and extensions.
412     *         The accessor "getName" gives direct access to the value
413     */
414    public StringType getNameElement() {
415      if (this.name == null)
416        if (Configuration.errorOnAutoCreate())
417          throw new Error("Attempt to auto-create ResearchStudyArmComponent.name");
418        else if (Configuration.doAutoCreate())
419          this.name = new StringType(); // bb
420      return this.name;
421    }
422
423    public boolean hasNameElement() {
424      return this.name != null && !this.name.isEmpty();
425    }
426
427    public boolean hasName() {
428      return this.name != null && !this.name.isEmpty();
429    }
430
431    /**
432     * @param value {@link #name} (Unique, human-readable label for this arm of the
433     *              study.). This is the underlying object with id, value and
434     *              extensions. The accessor "getName" gives direct access to the
435     *              value
436     */
437    public ResearchStudyArmComponent setNameElement(StringType value) {
438      this.name = value;
439      return this;
440    }
441
442    /**
443     * @return Unique, human-readable label for this arm of the study.
444     */
445    public String getName() {
446      return this.name == null ? null : this.name.getValue();
447    }
448
449    /**
450     * @param value Unique, human-readable label for this arm of the study.
451     */
452    public ResearchStudyArmComponent setName(String value) {
453      if (this.name == null)
454        this.name = new StringType();
455      this.name.setValue(value);
456      return this;
457    }
458
459    /**
460     * @return {@link #type} (Categorization of study arm, e.g. experimental, active
461     *         comparator, placebo comparater.)
462     */
463    public CodeableConcept getType() {
464      if (this.type == null)
465        if (Configuration.errorOnAutoCreate())
466          throw new Error("Attempt to auto-create ResearchStudyArmComponent.type");
467        else if (Configuration.doAutoCreate())
468          this.type = new CodeableConcept(); // cc
469      return this.type;
470    }
471
472    public boolean hasType() {
473      return this.type != null && !this.type.isEmpty();
474    }
475
476    /**
477     * @param value {@link #type} (Categorization of study arm, e.g. experimental,
478     *              active comparator, placebo comparater.)
479     */
480    public ResearchStudyArmComponent setType(CodeableConcept value) {
481      this.type = value;
482      return this;
483    }
484
485    /**
486     * @return {@link #description} (A succinct description of the path through the
487     *         study that would be followed by a subject adhering to this arm.).
488     *         This is the underlying object with id, value and extensions. The
489     *         accessor "getDescription" gives direct access to the value
490     */
491    public StringType getDescriptionElement() {
492      if (this.description == null)
493        if (Configuration.errorOnAutoCreate())
494          throw new Error("Attempt to auto-create ResearchStudyArmComponent.description");
495        else if (Configuration.doAutoCreate())
496          this.description = new StringType(); // bb
497      return this.description;
498    }
499
500    public boolean hasDescriptionElement() {
501      return this.description != null && !this.description.isEmpty();
502    }
503
504    public boolean hasDescription() {
505      return this.description != null && !this.description.isEmpty();
506    }
507
508    /**
509     * @param value {@link #description} (A succinct description of the path through
510     *              the study that would be followed by a subject adhering to this
511     *              arm.). This is the underlying object with id, value and
512     *              extensions. The accessor "getDescription" gives direct access to
513     *              the value
514     */
515    public ResearchStudyArmComponent setDescriptionElement(StringType value) {
516      this.description = value;
517      return this;
518    }
519
520    /**
521     * @return A succinct description of the path through the study that would be
522     *         followed by a subject adhering to this arm.
523     */
524    public String getDescription() {
525      return this.description == null ? null : this.description.getValue();
526    }
527
528    /**
529     * @param value A succinct description of the path through the study that would
530     *              be followed by a subject adhering to this arm.
531     */
532    public ResearchStudyArmComponent setDescription(String value) {
533      if (Utilities.noString(value))
534        this.description = null;
535      else {
536        if (this.description == null)
537          this.description = new StringType();
538        this.description.setValue(value);
539      }
540      return this;
541    }
542
543    protected void listChildren(List<Property> children) {
544      super.listChildren(children);
545      children
546          .add(new Property("name", "string", "Unique, human-readable label for this arm of the study.", 0, 1, name));
547      children.add(new Property("type", "CodeableConcept",
548          "Categorization of study arm, e.g. experimental, active comparator, placebo comparater.", 0, 1, type));
549      children.add(new Property("description", "string",
550          "A succinct description of the path through the study that would be followed by a subject adhering to this arm.",
551          0, 1, description));
552    }
553
554    @Override
555    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
556      switch (_hash) {
557      case 3373707:
558        /* name */ return new Property("name", "string", "Unique, human-readable label for this arm of the study.", 0,
559            1, name);
560      case 3575610:
561        /* type */ return new Property("type", "CodeableConcept",
562            "Categorization of study arm, e.g. experimental, active comparator, placebo comparater.", 0, 1, type);
563      case -1724546052:
564        /* description */ return new Property("description", "string",
565            "A succinct description of the path through the study that would be followed by a subject adhering to this arm.",
566            0, 1, description);
567      default:
568        return super.getNamedProperty(_hash, _name, _checkValid);
569      }
570
571    }
572
573    @Override
574    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
575      switch (hash) {
576      case 3373707:
577        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
578      case 3575610:
579        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
580      case -1724546052:
581        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
582      default:
583        return super.getProperty(hash, name, checkValid);
584      }
585
586    }
587
588    @Override
589    public Base setProperty(int hash, String name, Base value) throws FHIRException {
590      switch (hash) {
591      case 3373707: // name
592        this.name = castToString(value); // StringType
593        return value;
594      case 3575610: // type
595        this.type = castToCodeableConcept(value); // CodeableConcept
596        return value;
597      case -1724546052: // description
598        this.description = castToString(value); // StringType
599        return value;
600      default:
601        return super.setProperty(hash, name, value);
602      }
603
604    }
605
606    @Override
607    public Base setProperty(String name, Base value) throws FHIRException {
608      if (name.equals("name")) {
609        this.name = castToString(value); // StringType
610      } else if (name.equals("type")) {
611        this.type = castToCodeableConcept(value); // CodeableConcept
612      } else if (name.equals("description")) {
613        this.description = castToString(value); // StringType
614      } else
615        return super.setProperty(name, value);
616      return value;
617    }
618
619    @Override
620    public Base makeProperty(int hash, String name) throws FHIRException {
621      switch (hash) {
622      case 3373707:
623        return getNameElement();
624      case 3575610:
625        return getType();
626      case -1724546052:
627        return getDescriptionElement();
628      default:
629        return super.makeProperty(hash, name);
630      }
631
632    }
633
634    @Override
635    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
636      switch (hash) {
637      case 3373707:
638        /* name */ return new String[] { "string" };
639      case 3575610:
640        /* type */ return new String[] { "CodeableConcept" };
641      case -1724546052:
642        /* description */ return new String[] { "string" };
643      default:
644        return super.getTypesForProperty(hash, name);
645      }
646
647    }
648
649    @Override
650    public Base addChild(String name) throws FHIRException {
651      if (name.equals("name")) {
652        throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.name");
653      } else if (name.equals("type")) {
654        this.type = new CodeableConcept();
655        return this.type;
656      } else if (name.equals("description")) {
657        throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.description");
658      } else
659        return super.addChild(name);
660    }
661
662    public ResearchStudyArmComponent copy() {
663      ResearchStudyArmComponent dst = new ResearchStudyArmComponent();
664      copyValues(dst);
665      return dst;
666    }
667
668    public void copyValues(ResearchStudyArmComponent dst) {
669      super.copyValues(dst);
670      dst.name = name == null ? null : name.copy();
671      dst.type = type == null ? null : type.copy();
672      dst.description = description == null ? null : description.copy();
673    }
674
675    @Override
676    public boolean equalsDeep(Base other_) {
677      if (!super.equalsDeep(other_))
678        return false;
679      if (!(other_ instanceof ResearchStudyArmComponent))
680        return false;
681      ResearchStudyArmComponent o = (ResearchStudyArmComponent) other_;
682      return compareDeep(name, o.name, true) && compareDeep(type, o.type, true)
683          && compareDeep(description, o.description, true);
684    }
685
686    @Override
687    public boolean equalsShallow(Base other_) {
688      if (!super.equalsShallow(other_))
689        return false;
690      if (!(other_ instanceof ResearchStudyArmComponent))
691        return false;
692      ResearchStudyArmComponent o = (ResearchStudyArmComponent) other_;
693      return compareValues(name, o.name, true) && compareValues(description, o.description, true);
694    }
695
696    public boolean isEmpty() {
697      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, description);
698    }
699
700    public String fhirType() {
701      return "ResearchStudy.arm";
702
703    }
704
705  }
706
707  @Block()
708  public static class ResearchStudyObjectiveComponent extends BackboneElement implements IBaseBackboneElement {
709    /**
710     * Unique, human-readable label for this objective of the study.
711     */
712    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
713    @Description(shortDefinition = "Label for the objective", formalDefinition = "Unique, human-readable label for this objective of the study.")
714    protected StringType name;
715
716    /**
717     * The kind of study objective.
718     */
719    @Child(name = "type", type = {
720        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
721    @Description(shortDefinition = "primary | secondary | exploratory", formalDefinition = "The kind of study objective.")
722    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/research-study-objective-type")
723    protected CodeableConcept type;
724
725    private static final long serialVersionUID = -1935215997L;
726
727    /**
728     * Constructor
729     */
730    public ResearchStudyObjectiveComponent() {
731      super();
732    }
733
734    /**
735     * @return {@link #name} (Unique, human-readable label for this objective of the
736     *         study.). This is the underlying object with id, value and extensions.
737     *         The accessor "getName" gives direct access to the value
738     */
739    public StringType getNameElement() {
740      if (this.name == null)
741        if (Configuration.errorOnAutoCreate())
742          throw new Error("Attempt to auto-create ResearchStudyObjectiveComponent.name");
743        else if (Configuration.doAutoCreate())
744          this.name = new StringType(); // bb
745      return this.name;
746    }
747
748    public boolean hasNameElement() {
749      return this.name != null && !this.name.isEmpty();
750    }
751
752    public boolean hasName() {
753      return this.name != null && !this.name.isEmpty();
754    }
755
756    /**
757     * @param value {@link #name} (Unique, human-readable label for this objective
758     *              of the study.). This is the underlying object with id, value and
759     *              extensions. The accessor "getName" gives direct access to the
760     *              value
761     */
762    public ResearchStudyObjectiveComponent setNameElement(StringType value) {
763      this.name = value;
764      return this;
765    }
766
767    /**
768     * @return Unique, human-readable label for this objective of the study.
769     */
770    public String getName() {
771      return this.name == null ? null : this.name.getValue();
772    }
773
774    /**
775     * @param value Unique, human-readable label for this objective of the study.
776     */
777    public ResearchStudyObjectiveComponent setName(String value) {
778      if (Utilities.noString(value))
779        this.name = null;
780      else {
781        if (this.name == null)
782          this.name = new StringType();
783        this.name.setValue(value);
784      }
785      return this;
786    }
787
788    /**
789     * @return {@link #type} (The kind of study objective.)
790     */
791    public CodeableConcept getType() {
792      if (this.type == null)
793        if (Configuration.errorOnAutoCreate())
794          throw new Error("Attempt to auto-create ResearchStudyObjectiveComponent.type");
795        else if (Configuration.doAutoCreate())
796          this.type = new CodeableConcept(); // cc
797      return this.type;
798    }
799
800    public boolean hasType() {
801      return this.type != null && !this.type.isEmpty();
802    }
803
804    /**
805     * @param value {@link #type} (The kind of study objective.)
806     */
807    public ResearchStudyObjectiveComponent setType(CodeableConcept value) {
808      this.type = value;
809      return this;
810    }
811
812    protected void listChildren(List<Property> children) {
813      super.listChildren(children);
814      children.add(
815          new Property("name", "string", "Unique, human-readable label for this objective of the study.", 0, 1, name));
816      children.add(new Property("type", "CodeableConcept", "The kind of study objective.", 0, 1, type));
817    }
818
819    @Override
820    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
821      switch (_hash) {
822      case 3373707:
823        /* name */ return new Property("name", "string",
824            "Unique, human-readable label for this objective of the study.", 0, 1, name);
825      case 3575610:
826        /* type */ return new Property("type", "CodeableConcept", "The kind of study objective.", 0, 1, type);
827      default:
828        return super.getNamedProperty(_hash, _name, _checkValid);
829      }
830
831    }
832
833    @Override
834    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
835      switch (hash) {
836      case 3373707:
837        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
838      case 3575610:
839        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
840      default:
841        return super.getProperty(hash, name, checkValid);
842      }
843
844    }
845
846    @Override
847    public Base setProperty(int hash, String name, Base value) throws FHIRException {
848      switch (hash) {
849      case 3373707: // name
850        this.name = castToString(value); // StringType
851        return value;
852      case 3575610: // type
853        this.type = castToCodeableConcept(value); // CodeableConcept
854        return value;
855      default:
856        return super.setProperty(hash, name, value);
857      }
858
859    }
860
861    @Override
862    public Base setProperty(String name, Base value) throws FHIRException {
863      if (name.equals("name")) {
864        this.name = castToString(value); // StringType
865      } else if (name.equals("type")) {
866        this.type = castToCodeableConcept(value); // CodeableConcept
867      } else
868        return super.setProperty(name, value);
869      return value;
870    }
871
872    @Override
873    public Base makeProperty(int hash, String name) throws FHIRException {
874      switch (hash) {
875      case 3373707:
876        return getNameElement();
877      case 3575610:
878        return getType();
879      default:
880        return super.makeProperty(hash, name);
881      }
882
883    }
884
885    @Override
886    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
887      switch (hash) {
888      case 3373707:
889        /* name */ return new String[] { "string" };
890      case 3575610:
891        /* type */ return new String[] { "CodeableConcept" };
892      default:
893        return super.getTypesForProperty(hash, name);
894      }
895
896    }
897
898    @Override
899    public Base addChild(String name) throws FHIRException {
900      if (name.equals("name")) {
901        throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.name");
902      } else if (name.equals("type")) {
903        this.type = new CodeableConcept();
904        return this.type;
905      } else
906        return super.addChild(name);
907    }
908
909    public ResearchStudyObjectiveComponent copy() {
910      ResearchStudyObjectiveComponent dst = new ResearchStudyObjectiveComponent();
911      copyValues(dst);
912      return dst;
913    }
914
915    public void copyValues(ResearchStudyObjectiveComponent dst) {
916      super.copyValues(dst);
917      dst.name = name == null ? null : name.copy();
918      dst.type = type == null ? null : type.copy();
919    }
920
921    @Override
922    public boolean equalsDeep(Base other_) {
923      if (!super.equalsDeep(other_))
924        return false;
925      if (!(other_ instanceof ResearchStudyObjectiveComponent))
926        return false;
927      ResearchStudyObjectiveComponent o = (ResearchStudyObjectiveComponent) other_;
928      return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
929    }
930
931    @Override
932    public boolean equalsShallow(Base other_) {
933      if (!super.equalsShallow(other_))
934        return false;
935      if (!(other_ instanceof ResearchStudyObjectiveComponent))
936        return false;
937      ResearchStudyObjectiveComponent o = (ResearchStudyObjectiveComponent) other_;
938      return compareValues(name, o.name, true);
939    }
940
941    public boolean isEmpty() {
942      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
943    }
944
945    public String fhirType() {
946      return "ResearchStudy.objective";
947
948    }
949
950  }
951
952  /**
953   * Identifiers assigned to this research study by the sponsor or other systems.
954   */
955  @Child(name = "identifier", type = {
956      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
957  @Description(shortDefinition = "Business Identifier for study", formalDefinition = "Identifiers assigned to this research study by the sponsor or other systems.")
958  protected List<Identifier> identifier;
959
960  /**
961   * A short, descriptive user-friendly label for the study.
962   */
963  @Child(name = "title", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
964  @Description(shortDefinition = "Name for this study", formalDefinition = "A short, descriptive user-friendly label for the study.")
965  protected StringType title;
966
967  /**
968   * The set of steps expected to be performed as part of the execution of the
969   * study.
970   */
971  @Child(name = "protocol", type = {
972      PlanDefinition.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
973  @Description(shortDefinition = "Steps followed in executing study", formalDefinition = "The set of steps expected to be performed as part of the execution of the study.")
974  protected List<Reference> protocol;
975  /**
976   * The actual objects that are the target of the reference (The set of steps
977   * expected to be performed as part of the execution of the study.)
978   */
979  protected List<PlanDefinition> protocolTarget;
980
981  /**
982   * A larger research study of which this particular study is a component or
983   * step.
984   */
985  @Child(name = "partOf", type = {
986      ResearchStudy.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
987  @Description(shortDefinition = "Part of larger study", formalDefinition = "A larger research study of which this particular study is a component or step.")
988  protected List<Reference> partOf;
989  /**
990   * The actual objects that are the target of the reference (A larger research
991   * study of which this particular study is a component or step.)
992   */
993  protected List<ResearchStudy> partOfTarget;
994
995  /**
996   * The current state of the study.
997   */
998  @Child(name = "status", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = true, summary = true)
999  @Description(shortDefinition = "active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn", formalDefinition = "The current state of the study.")
1000  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/research-study-status")
1001  protected Enumeration<ResearchStudyStatus> status;
1002
1003  /**
1004   * The type of study based upon the intent of the study's activities. A
1005   * classification of the intent of the study.
1006   */
1007  @Child(name = "primaryPurposeType", type = {
1008      CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1009  @Description(shortDefinition = "treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility", formalDefinition = "The type of study based upon the intent of the study's activities. A classification of the intent of the study.")
1010  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/research-study-prim-purp-type")
1011  protected CodeableConcept primaryPurposeType;
1012
1013  /**
1014   * The stage in the progression of a therapy from initial experimental use in
1015   * humans in clinical trials to post-market evaluation.
1016   */
1017  @Child(name = "phase", type = {
1018      CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1019  @Description(shortDefinition = "n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4", formalDefinition = "The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.")
1020  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/research-study-phase")
1021  protected CodeableConcept phase;
1022
1023  /**
1024   * Codes categorizing the type of study such as investigational vs.
1025   * observational, type of blinding, type of randomization, safety vs. efficacy,
1026   * etc.
1027   */
1028  @Child(name = "category", type = {
1029      CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1030  @Description(shortDefinition = "Classifications for the study", formalDefinition = "Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.")
1031  protected List<CodeableConcept> category;
1032
1033  /**
1034   * The medication(s), food(s), therapy(ies), device(s) or other concerns or
1035   * interventions that the study is seeking to gain more information about.
1036   */
1037  @Child(name = "focus", type = {
1038      CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1039  @Description(shortDefinition = "Drugs, devices, etc. under study", formalDefinition = "The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.")
1040  protected List<CodeableConcept> focus;
1041
1042  /**
1043   * The condition that is the focus of the study. For example, In a study to
1044   * examine risk factors for Lupus, might have as an inclusion criterion "healthy
1045   * volunteer", but the target condition code would be a Lupus SNOMED code.
1046   */
1047  @Child(name = "condition", type = {
1048      CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1049  @Description(shortDefinition = "Condition being studied", formalDefinition = "The condition that is the focus of the study.  For example, In a study to examine risk factors for Lupus, might have as an inclusion criterion \"healthy volunteer\", but the target condition code would be a Lupus SNOMED code.")
1050  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code")
1051  protected List<CodeableConcept> condition;
1052
1053  /**
1054   * Contact details to assist a user in learning more about or engaging with the
1055   * study.
1056   */
1057  @Child(name = "contact", type = {
1058      ContactDetail.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1059  @Description(shortDefinition = "Contact details for the study", formalDefinition = "Contact details to assist a user in learning more about or engaging with the study.")
1060  protected List<ContactDetail> contact;
1061
1062  /**
1063   * Citations, references and other related documents.
1064   */
1065  @Child(name = "relatedArtifact", type = {
1066      RelatedArtifact.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1067  @Description(shortDefinition = "References and dependencies", formalDefinition = "Citations, references and other related documents.")
1068  protected List<RelatedArtifact> relatedArtifact;
1069
1070  /**
1071   * Key terms to aid in searching for or filtering the study.
1072   */
1073  @Child(name = "keyword", type = {
1074      CodeableConcept.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1075  @Description(shortDefinition = "Used to search for the study", formalDefinition = "Key terms to aid in searching for or filtering the study.")
1076  protected List<CodeableConcept> keyword;
1077
1078  /**
1079   * Indicates a country, state or other region where the study is taking place.
1080   */
1081  @Child(name = "location", type = {
1082      CodeableConcept.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1083  @Description(shortDefinition = "Geographic region(s) for study", formalDefinition = "Indicates a country, state or other region where the study is taking place.")
1084  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/jurisdiction")
1085  protected List<CodeableConcept> location;
1086
1087  /**
1088   * A full description of how the study is being conducted.
1089   */
1090  @Child(name = "description", type = {
1091      MarkdownType.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
1092  @Description(shortDefinition = "What this is study doing", formalDefinition = "A full description of how the study is being conducted.")
1093  protected MarkdownType description;
1094
1095  /**
1096   * Reference to a Group that defines the criteria for and quantity of subjects
1097   * participating in the study. E.g. " 200 female Europeans between the ages of
1098   * 20 and 45 with early onset diabetes".
1099   */
1100  @Child(name = "enrollment", type = {
1101      Group.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1102  @Description(shortDefinition = "Inclusion & exclusion criteria", formalDefinition = "Reference to a Group that defines the criteria for and quantity of subjects participating in the study.  E.g. \" 200 female Europeans between the ages of 20 and 45 with early onset diabetes\".")
1103  protected List<Reference> enrollment;
1104  /**
1105   * The actual objects that are the target of the reference (Reference to a Group
1106   * that defines the criteria for and quantity of subjects participating in the
1107   * study. E.g. " 200 female Europeans between the ages of 20 and 45 with early
1108   * onset diabetes".)
1109   */
1110  protected List<Group> enrollmentTarget;
1111
1112  /**
1113   * Identifies the start date and the expected (or actual, depending on status)
1114   * end date for the study.
1115   */
1116  @Child(name = "period", type = { Period.class }, order = 16, min = 0, max = 1, modifier = false, summary = true)
1117  @Description(shortDefinition = "When the study began and ended", formalDefinition = "Identifies the start date and the expected (or actual, depending on status) end date for the study.")
1118  protected Period period;
1119
1120  /**
1121   * An organization that initiates the investigation and is legally responsible
1122   * for the study.
1123   */
1124  @Child(name = "sponsor", type = {
1125      Organization.class }, order = 17, min = 0, max = 1, modifier = false, summary = true)
1126  @Description(shortDefinition = "Organization that initiates and is legally responsible for the study", formalDefinition = "An organization that initiates the investigation and is legally responsible for the study.")
1127  protected Reference sponsor;
1128
1129  /**
1130   * The actual object that is the target of the reference (An organization that
1131   * initiates the investigation and is legally responsible for the study.)
1132   */
1133  protected Organization sponsorTarget;
1134
1135  /**
1136   * A researcher in a study who oversees multiple aspects of the study, such as
1137   * concept development, protocol writing, protocol submission for IRB approval,
1138   * participant recruitment, informed consent, data collection, analysis,
1139   * interpretation and presentation.
1140   */
1141  @Child(name = "principalInvestigator", type = { Practitioner.class,
1142      PractitionerRole.class }, order = 18, min = 0, max = 1, modifier = false, summary = true)
1143  @Description(shortDefinition = "Researcher who oversees multiple aspects of the study", formalDefinition = "A researcher in a study who oversees multiple aspects of the study, such as concept development, protocol writing, protocol submission for IRB approval, participant recruitment, informed consent, data collection, analysis, interpretation and presentation.")
1144  protected Reference principalInvestigator;
1145
1146  /**
1147   * The actual object that is the target of the reference (A researcher in a
1148   * study who oversees multiple aspects of the study, such as concept
1149   * development, protocol writing, protocol submission for IRB approval,
1150   * participant recruitment, informed consent, data collection, analysis,
1151   * interpretation and presentation.)
1152   */
1153  protected Resource principalInvestigatorTarget;
1154
1155  /**
1156   * A facility in which study activities are conducted.
1157   */
1158  @Child(name = "site", type = {
1159      Location.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1160  @Description(shortDefinition = "Facility where study activities are conducted", formalDefinition = "A facility in which study activities are conducted.")
1161  protected List<Reference> site;
1162  /**
1163   * The actual objects that are the target of the reference (A facility in which
1164   * study activities are conducted.)
1165   */
1166  protected List<Location> siteTarget;
1167
1168  /**
1169   * A description and/or code explaining the premature termination of the study.
1170   */
1171  @Child(name = "reasonStopped", type = {
1172      CodeableConcept.class }, order = 20, min = 0, max = 1, modifier = false, summary = true)
1173  @Description(shortDefinition = "accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of-study-progress | temporarily-closed-per-study-design", formalDefinition = "A description and/or code explaining the premature termination of the study.")
1174  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/research-study-reason-stopped")
1175  protected CodeableConcept reasonStopped;
1176
1177  /**
1178   * Comments made about the study by the performer, subject or other
1179   * participants.
1180   */
1181  @Child(name = "note", type = {
1182      Annotation.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1183  @Description(shortDefinition = "Comments made about the study", formalDefinition = "Comments made about the study by the performer, subject or other participants.")
1184  protected List<Annotation> note;
1185
1186  /**
1187   * Describes an expected sequence of events for one of the participants of a
1188   * study. E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out,
1189   * follow-up.
1190   */
1191  @Child(name = "arm", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1192  @Description(shortDefinition = "Defined path through the study for a subject", formalDefinition = "Describes an expected sequence of events for one of the participants of a study.  E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, follow-up.")
1193  protected List<ResearchStudyArmComponent> arm;
1194
1195  /**
1196   * A goal that the study is aiming to achieve in terms of a scientific question
1197   * to be answered by the analysis of data collected during the study.
1198   */
1199  @Child(name = "objective", type = {}, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1200  @Description(shortDefinition = "A goal for the study", formalDefinition = "A goal that the study is aiming to achieve in terms of a scientific question to be answered by the analysis of data collected during the study.")
1201  protected List<ResearchStudyObjectiveComponent> objective;
1202
1203  private static final long serialVersionUID = -911538323L;
1204
1205  /**
1206   * Constructor
1207   */
1208  public ResearchStudy() {
1209    super();
1210  }
1211
1212  /**
1213   * Constructor
1214   */
1215  public ResearchStudy(Enumeration<ResearchStudyStatus> status) {
1216    super();
1217    this.status = status;
1218  }
1219
1220  /**
1221   * @return {@link #identifier} (Identifiers assigned to this research study by
1222   *         the sponsor or other systems.)
1223   */
1224  public List<Identifier> getIdentifier() {
1225    if (this.identifier == null)
1226      this.identifier = new ArrayList<Identifier>();
1227    return this.identifier;
1228  }
1229
1230  /**
1231   * @return Returns a reference to <code>this</code> for easy method chaining
1232   */
1233  public ResearchStudy setIdentifier(List<Identifier> theIdentifier) {
1234    this.identifier = theIdentifier;
1235    return this;
1236  }
1237
1238  public boolean hasIdentifier() {
1239    if (this.identifier == null)
1240      return false;
1241    for (Identifier item : this.identifier)
1242      if (!item.isEmpty())
1243        return true;
1244    return false;
1245  }
1246
1247  public Identifier addIdentifier() { // 3
1248    Identifier t = new Identifier();
1249    if (this.identifier == null)
1250      this.identifier = new ArrayList<Identifier>();
1251    this.identifier.add(t);
1252    return t;
1253  }
1254
1255  public ResearchStudy addIdentifier(Identifier t) { // 3
1256    if (t == null)
1257      return this;
1258    if (this.identifier == null)
1259      this.identifier = new ArrayList<Identifier>();
1260    this.identifier.add(t);
1261    return this;
1262  }
1263
1264  /**
1265   * @return The first repetition of repeating field {@link #identifier}, creating
1266   *         it if it does not already exist
1267   */
1268  public Identifier getIdentifierFirstRep() {
1269    if (getIdentifier().isEmpty()) {
1270      addIdentifier();
1271    }
1272    return getIdentifier().get(0);
1273  }
1274
1275  /**
1276   * @return {@link #title} (A short, descriptive user-friendly label for the
1277   *         study.). This is the underlying object with id, value and extensions.
1278   *         The accessor "getTitle" gives direct access to the value
1279   */
1280  public StringType getTitleElement() {
1281    if (this.title == null)
1282      if (Configuration.errorOnAutoCreate())
1283        throw new Error("Attempt to auto-create ResearchStudy.title");
1284      else if (Configuration.doAutoCreate())
1285        this.title = new StringType(); // bb
1286    return this.title;
1287  }
1288
1289  public boolean hasTitleElement() {
1290    return this.title != null && !this.title.isEmpty();
1291  }
1292
1293  public boolean hasTitle() {
1294    return this.title != null && !this.title.isEmpty();
1295  }
1296
1297  /**
1298   * @param value {@link #title} (A short, descriptive user-friendly label for the
1299   *              study.). This is the underlying object with id, value and
1300   *              extensions. The accessor "getTitle" gives direct access to the
1301   *              value
1302   */
1303  public ResearchStudy setTitleElement(StringType value) {
1304    this.title = value;
1305    return this;
1306  }
1307
1308  /**
1309   * @return A short, descriptive user-friendly label for the study.
1310   */
1311  public String getTitle() {
1312    return this.title == null ? null : this.title.getValue();
1313  }
1314
1315  /**
1316   * @param value A short, descriptive user-friendly label for the study.
1317   */
1318  public ResearchStudy setTitle(String value) {
1319    if (Utilities.noString(value))
1320      this.title = null;
1321    else {
1322      if (this.title == null)
1323        this.title = new StringType();
1324      this.title.setValue(value);
1325    }
1326    return this;
1327  }
1328
1329  /**
1330   * @return {@link #protocol} (The set of steps expected to be performed as part
1331   *         of the execution of the study.)
1332   */
1333  public List<Reference> getProtocol() {
1334    if (this.protocol == null)
1335      this.protocol = new ArrayList<Reference>();
1336    return this.protocol;
1337  }
1338
1339  /**
1340   * @return Returns a reference to <code>this</code> for easy method chaining
1341   */
1342  public ResearchStudy setProtocol(List<Reference> theProtocol) {
1343    this.protocol = theProtocol;
1344    return this;
1345  }
1346
1347  public boolean hasProtocol() {
1348    if (this.protocol == null)
1349      return false;
1350    for (Reference item : this.protocol)
1351      if (!item.isEmpty())
1352        return true;
1353    return false;
1354  }
1355
1356  public Reference addProtocol() { // 3
1357    Reference t = new Reference();
1358    if (this.protocol == null)
1359      this.protocol = new ArrayList<Reference>();
1360    this.protocol.add(t);
1361    return t;
1362  }
1363
1364  public ResearchStudy addProtocol(Reference t) { // 3
1365    if (t == null)
1366      return this;
1367    if (this.protocol == null)
1368      this.protocol = new ArrayList<Reference>();
1369    this.protocol.add(t);
1370    return this;
1371  }
1372
1373  /**
1374   * @return The first repetition of repeating field {@link #protocol}, creating
1375   *         it if it does not already exist
1376   */
1377  public Reference getProtocolFirstRep() {
1378    if (getProtocol().isEmpty()) {
1379      addProtocol();
1380    }
1381    return getProtocol().get(0);
1382  }
1383
1384  /**
1385   * @deprecated Use Reference#setResource(IBaseResource) instead
1386   */
1387  @Deprecated
1388  public List<PlanDefinition> getProtocolTarget() {
1389    if (this.protocolTarget == null)
1390      this.protocolTarget = new ArrayList<PlanDefinition>();
1391    return this.protocolTarget;
1392  }
1393
1394  /**
1395   * @deprecated Use Reference#setResource(IBaseResource) instead
1396   */
1397  @Deprecated
1398  public PlanDefinition addProtocolTarget() {
1399    PlanDefinition r = new PlanDefinition();
1400    if (this.protocolTarget == null)
1401      this.protocolTarget = new ArrayList<PlanDefinition>();
1402    this.protocolTarget.add(r);
1403    return r;
1404  }
1405
1406  /**
1407   * @return {@link #partOf} (A larger research study of which this particular
1408   *         study is a component or step.)
1409   */
1410  public List<Reference> getPartOf() {
1411    if (this.partOf == null)
1412      this.partOf = new ArrayList<Reference>();
1413    return this.partOf;
1414  }
1415
1416  /**
1417   * @return Returns a reference to <code>this</code> for easy method chaining
1418   */
1419  public ResearchStudy setPartOf(List<Reference> thePartOf) {
1420    this.partOf = thePartOf;
1421    return this;
1422  }
1423
1424  public boolean hasPartOf() {
1425    if (this.partOf == null)
1426      return false;
1427    for (Reference item : this.partOf)
1428      if (!item.isEmpty())
1429        return true;
1430    return false;
1431  }
1432
1433  public Reference addPartOf() { // 3
1434    Reference t = new Reference();
1435    if (this.partOf == null)
1436      this.partOf = new ArrayList<Reference>();
1437    this.partOf.add(t);
1438    return t;
1439  }
1440
1441  public ResearchStudy addPartOf(Reference t) { // 3
1442    if (t == null)
1443      return this;
1444    if (this.partOf == null)
1445      this.partOf = new ArrayList<Reference>();
1446    this.partOf.add(t);
1447    return this;
1448  }
1449
1450  /**
1451   * @return The first repetition of repeating field {@link #partOf}, creating it
1452   *         if it does not already exist
1453   */
1454  public Reference getPartOfFirstRep() {
1455    if (getPartOf().isEmpty()) {
1456      addPartOf();
1457    }
1458    return getPartOf().get(0);
1459  }
1460
1461  /**
1462   * @deprecated Use Reference#setResource(IBaseResource) instead
1463   */
1464  @Deprecated
1465  public List<ResearchStudy> getPartOfTarget() {
1466    if (this.partOfTarget == null)
1467      this.partOfTarget = new ArrayList<ResearchStudy>();
1468    return this.partOfTarget;
1469  }
1470
1471  /**
1472   * @deprecated Use Reference#setResource(IBaseResource) instead
1473   */
1474  @Deprecated
1475  public ResearchStudy addPartOfTarget() {
1476    ResearchStudy r = new ResearchStudy();
1477    if (this.partOfTarget == null)
1478      this.partOfTarget = new ArrayList<ResearchStudy>();
1479    this.partOfTarget.add(r);
1480    return r;
1481  }
1482
1483  /**
1484   * @return {@link #status} (The current state of the study.). This is the
1485   *         underlying object with id, value and extensions. The accessor
1486   *         "getStatus" gives direct access to the value
1487   */
1488  public Enumeration<ResearchStudyStatus> getStatusElement() {
1489    if (this.status == null)
1490      if (Configuration.errorOnAutoCreate())
1491        throw new Error("Attempt to auto-create ResearchStudy.status");
1492      else if (Configuration.doAutoCreate())
1493        this.status = new Enumeration<ResearchStudyStatus>(new ResearchStudyStatusEnumFactory()); // bb
1494    return this.status;
1495  }
1496
1497  public boolean hasStatusElement() {
1498    return this.status != null && !this.status.isEmpty();
1499  }
1500
1501  public boolean hasStatus() {
1502    return this.status != null && !this.status.isEmpty();
1503  }
1504
1505  /**
1506   * @param value {@link #status} (The current state of the study.). This is the
1507   *              underlying object with id, value and extensions. The accessor
1508   *              "getStatus" gives direct access to the value
1509   */
1510  public ResearchStudy setStatusElement(Enumeration<ResearchStudyStatus> value) {
1511    this.status = value;
1512    return this;
1513  }
1514
1515  /**
1516   * @return The current state of the study.
1517   */
1518  public ResearchStudyStatus getStatus() {
1519    return this.status == null ? null : this.status.getValue();
1520  }
1521
1522  /**
1523   * @param value The current state of the study.
1524   */
1525  public ResearchStudy setStatus(ResearchStudyStatus value) {
1526    if (this.status == null)
1527      this.status = new Enumeration<ResearchStudyStatus>(new ResearchStudyStatusEnumFactory());
1528    this.status.setValue(value);
1529    return this;
1530  }
1531
1532  /**
1533   * @return {@link #primaryPurposeType} (The type of study based upon the intent
1534   *         of the study's activities. A classification of the intent of the
1535   *         study.)
1536   */
1537  public CodeableConcept getPrimaryPurposeType() {
1538    if (this.primaryPurposeType == null)
1539      if (Configuration.errorOnAutoCreate())
1540        throw new Error("Attempt to auto-create ResearchStudy.primaryPurposeType");
1541      else if (Configuration.doAutoCreate())
1542        this.primaryPurposeType = new CodeableConcept(); // cc
1543    return this.primaryPurposeType;
1544  }
1545
1546  public boolean hasPrimaryPurposeType() {
1547    return this.primaryPurposeType != null && !this.primaryPurposeType.isEmpty();
1548  }
1549
1550  /**
1551   * @param value {@link #primaryPurposeType} (The type of study based upon the
1552   *              intent of the study's activities. A classification of the intent
1553   *              of the study.)
1554   */
1555  public ResearchStudy setPrimaryPurposeType(CodeableConcept value) {
1556    this.primaryPurposeType = value;
1557    return this;
1558  }
1559
1560  /**
1561   * @return {@link #phase} (The stage in the progression of a therapy from
1562   *         initial experimental use in humans in clinical trials to post-market
1563   *         evaluation.)
1564   */
1565  public CodeableConcept getPhase() {
1566    if (this.phase == null)
1567      if (Configuration.errorOnAutoCreate())
1568        throw new Error("Attempt to auto-create ResearchStudy.phase");
1569      else if (Configuration.doAutoCreate())
1570        this.phase = new CodeableConcept(); // cc
1571    return this.phase;
1572  }
1573
1574  public boolean hasPhase() {
1575    return this.phase != null && !this.phase.isEmpty();
1576  }
1577
1578  /**
1579   * @param value {@link #phase} (The stage in the progression of a therapy from
1580   *              initial experimental use in humans in clinical trials to
1581   *              post-market evaluation.)
1582   */
1583  public ResearchStudy setPhase(CodeableConcept value) {
1584    this.phase = value;
1585    return this;
1586  }
1587
1588  /**
1589   * @return {@link #category} (Codes categorizing the type of study such as
1590   *         investigational vs. observational, type of blinding, type of
1591   *         randomization, safety vs. efficacy, etc.)
1592   */
1593  public List<CodeableConcept> getCategory() {
1594    if (this.category == null)
1595      this.category = new ArrayList<CodeableConcept>();
1596    return this.category;
1597  }
1598
1599  /**
1600   * @return Returns a reference to <code>this</code> for easy method chaining
1601   */
1602  public ResearchStudy setCategory(List<CodeableConcept> theCategory) {
1603    this.category = theCategory;
1604    return this;
1605  }
1606
1607  public boolean hasCategory() {
1608    if (this.category == null)
1609      return false;
1610    for (CodeableConcept item : this.category)
1611      if (!item.isEmpty())
1612        return true;
1613    return false;
1614  }
1615
1616  public CodeableConcept addCategory() { // 3
1617    CodeableConcept t = new CodeableConcept();
1618    if (this.category == null)
1619      this.category = new ArrayList<CodeableConcept>();
1620    this.category.add(t);
1621    return t;
1622  }
1623
1624  public ResearchStudy addCategory(CodeableConcept t) { // 3
1625    if (t == null)
1626      return this;
1627    if (this.category == null)
1628      this.category = new ArrayList<CodeableConcept>();
1629    this.category.add(t);
1630    return this;
1631  }
1632
1633  /**
1634   * @return The first repetition of repeating field {@link #category}, creating
1635   *         it if it does not already exist
1636   */
1637  public CodeableConcept getCategoryFirstRep() {
1638    if (getCategory().isEmpty()) {
1639      addCategory();
1640    }
1641    return getCategory().get(0);
1642  }
1643
1644  /**
1645   * @return {@link #focus} (The medication(s), food(s), therapy(ies), device(s)
1646   *         or other concerns or interventions that the study is seeking to gain
1647   *         more information about.)
1648   */
1649  public List<CodeableConcept> getFocus() {
1650    if (this.focus == null)
1651      this.focus = new ArrayList<CodeableConcept>();
1652    return this.focus;
1653  }
1654
1655  /**
1656   * @return Returns a reference to <code>this</code> for easy method chaining
1657   */
1658  public ResearchStudy setFocus(List<CodeableConcept> theFocus) {
1659    this.focus = theFocus;
1660    return this;
1661  }
1662
1663  public boolean hasFocus() {
1664    if (this.focus == null)
1665      return false;
1666    for (CodeableConcept item : this.focus)
1667      if (!item.isEmpty())
1668        return true;
1669    return false;
1670  }
1671
1672  public CodeableConcept addFocus() { // 3
1673    CodeableConcept t = new CodeableConcept();
1674    if (this.focus == null)
1675      this.focus = new ArrayList<CodeableConcept>();
1676    this.focus.add(t);
1677    return t;
1678  }
1679
1680  public ResearchStudy addFocus(CodeableConcept t) { // 3
1681    if (t == null)
1682      return this;
1683    if (this.focus == null)
1684      this.focus = new ArrayList<CodeableConcept>();
1685    this.focus.add(t);
1686    return this;
1687  }
1688
1689  /**
1690   * @return The first repetition of repeating field {@link #focus}, creating it
1691   *         if it does not already exist
1692   */
1693  public CodeableConcept getFocusFirstRep() {
1694    if (getFocus().isEmpty()) {
1695      addFocus();
1696    }
1697    return getFocus().get(0);
1698  }
1699
1700  /**
1701   * @return {@link #condition} (The condition that is the focus of the study. For
1702   *         example, In a study to examine risk factors for Lupus, might have as
1703   *         an inclusion criterion "healthy volunteer", but the target condition
1704   *         code would be a Lupus SNOMED code.)
1705   */
1706  public List<CodeableConcept> getCondition() {
1707    if (this.condition == null)
1708      this.condition = new ArrayList<CodeableConcept>();
1709    return this.condition;
1710  }
1711
1712  /**
1713   * @return Returns a reference to <code>this</code> for easy method chaining
1714   */
1715  public ResearchStudy setCondition(List<CodeableConcept> theCondition) {
1716    this.condition = theCondition;
1717    return this;
1718  }
1719
1720  public boolean hasCondition() {
1721    if (this.condition == null)
1722      return false;
1723    for (CodeableConcept item : this.condition)
1724      if (!item.isEmpty())
1725        return true;
1726    return false;
1727  }
1728
1729  public CodeableConcept addCondition() { // 3
1730    CodeableConcept t = new CodeableConcept();
1731    if (this.condition == null)
1732      this.condition = new ArrayList<CodeableConcept>();
1733    this.condition.add(t);
1734    return t;
1735  }
1736
1737  public ResearchStudy addCondition(CodeableConcept t) { // 3
1738    if (t == null)
1739      return this;
1740    if (this.condition == null)
1741      this.condition = new ArrayList<CodeableConcept>();
1742    this.condition.add(t);
1743    return this;
1744  }
1745
1746  /**
1747   * @return The first repetition of repeating field {@link #condition}, creating
1748   *         it if it does not already exist
1749   */
1750  public CodeableConcept getConditionFirstRep() {
1751    if (getCondition().isEmpty()) {
1752      addCondition();
1753    }
1754    return getCondition().get(0);
1755  }
1756
1757  /**
1758   * @return {@link #contact} (Contact details to assist a user in learning more
1759   *         about or engaging with the study.)
1760   */
1761  public List<ContactDetail> getContact() {
1762    if (this.contact == null)
1763      this.contact = new ArrayList<ContactDetail>();
1764    return this.contact;
1765  }
1766
1767  /**
1768   * @return Returns a reference to <code>this</code> for easy method chaining
1769   */
1770  public ResearchStudy setContact(List<ContactDetail> theContact) {
1771    this.contact = theContact;
1772    return this;
1773  }
1774
1775  public boolean hasContact() {
1776    if (this.contact == null)
1777      return false;
1778    for (ContactDetail item : this.contact)
1779      if (!item.isEmpty())
1780        return true;
1781    return false;
1782  }
1783
1784  public ContactDetail addContact() { // 3
1785    ContactDetail t = new ContactDetail();
1786    if (this.contact == null)
1787      this.contact = new ArrayList<ContactDetail>();
1788    this.contact.add(t);
1789    return t;
1790  }
1791
1792  public ResearchStudy addContact(ContactDetail t) { // 3
1793    if (t == null)
1794      return this;
1795    if (this.contact == null)
1796      this.contact = new ArrayList<ContactDetail>();
1797    this.contact.add(t);
1798    return this;
1799  }
1800
1801  /**
1802   * @return The first repetition of repeating field {@link #contact}, creating it
1803   *         if it does not already exist
1804   */
1805  public ContactDetail getContactFirstRep() {
1806    if (getContact().isEmpty()) {
1807      addContact();
1808    }
1809    return getContact().get(0);
1810  }
1811
1812  /**
1813   * @return {@link #relatedArtifact} (Citations, references and other related
1814   *         documents.)
1815   */
1816  public List<RelatedArtifact> getRelatedArtifact() {
1817    if (this.relatedArtifact == null)
1818      this.relatedArtifact = new ArrayList<RelatedArtifact>();
1819    return this.relatedArtifact;
1820  }
1821
1822  /**
1823   * @return Returns a reference to <code>this</code> for easy method chaining
1824   */
1825  public ResearchStudy setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) {
1826    this.relatedArtifact = theRelatedArtifact;
1827    return this;
1828  }
1829
1830  public boolean hasRelatedArtifact() {
1831    if (this.relatedArtifact == null)
1832      return false;
1833    for (RelatedArtifact item : this.relatedArtifact)
1834      if (!item.isEmpty())
1835        return true;
1836    return false;
1837  }
1838
1839  public RelatedArtifact addRelatedArtifact() { // 3
1840    RelatedArtifact t = new RelatedArtifact();
1841    if (this.relatedArtifact == null)
1842      this.relatedArtifact = new ArrayList<RelatedArtifact>();
1843    this.relatedArtifact.add(t);
1844    return t;
1845  }
1846
1847  public ResearchStudy addRelatedArtifact(RelatedArtifact t) { // 3
1848    if (t == null)
1849      return this;
1850    if (this.relatedArtifact == null)
1851      this.relatedArtifact = new ArrayList<RelatedArtifact>();
1852    this.relatedArtifact.add(t);
1853    return this;
1854  }
1855
1856  /**
1857   * @return The first repetition of repeating field {@link #relatedArtifact},
1858   *         creating it if it does not already exist
1859   */
1860  public RelatedArtifact getRelatedArtifactFirstRep() {
1861    if (getRelatedArtifact().isEmpty()) {
1862      addRelatedArtifact();
1863    }
1864    return getRelatedArtifact().get(0);
1865  }
1866
1867  /**
1868   * @return {@link #keyword} (Key terms to aid in searching for or filtering the
1869   *         study.)
1870   */
1871  public List<CodeableConcept> getKeyword() {
1872    if (this.keyword == null)
1873      this.keyword = new ArrayList<CodeableConcept>();
1874    return this.keyword;
1875  }
1876
1877  /**
1878   * @return Returns a reference to <code>this</code> for easy method chaining
1879   */
1880  public ResearchStudy setKeyword(List<CodeableConcept> theKeyword) {
1881    this.keyword = theKeyword;
1882    return this;
1883  }
1884
1885  public boolean hasKeyword() {
1886    if (this.keyword == null)
1887      return false;
1888    for (CodeableConcept item : this.keyword)
1889      if (!item.isEmpty())
1890        return true;
1891    return false;
1892  }
1893
1894  public CodeableConcept addKeyword() { // 3
1895    CodeableConcept t = new CodeableConcept();
1896    if (this.keyword == null)
1897      this.keyword = new ArrayList<CodeableConcept>();
1898    this.keyword.add(t);
1899    return t;
1900  }
1901
1902  public ResearchStudy addKeyword(CodeableConcept t) { // 3
1903    if (t == null)
1904      return this;
1905    if (this.keyword == null)
1906      this.keyword = new ArrayList<CodeableConcept>();
1907    this.keyword.add(t);
1908    return this;
1909  }
1910
1911  /**
1912   * @return The first repetition of repeating field {@link #keyword}, creating it
1913   *         if it does not already exist
1914   */
1915  public CodeableConcept getKeywordFirstRep() {
1916    if (getKeyword().isEmpty()) {
1917      addKeyword();
1918    }
1919    return getKeyword().get(0);
1920  }
1921
1922  /**
1923   * @return {@link #location} (Indicates a country, state or other region where
1924   *         the study is taking place.)
1925   */
1926  public List<CodeableConcept> getLocation() {
1927    if (this.location == null)
1928      this.location = new ArrayList<CodeableConcept>();
1929    return this.location;
1930  }
1931
1932  /**
1933   * @return Returns a reference to <code>this</code> for easy method chaining
1934   */
1935  public ResearchStudy setLocation(List<CodeableConcept> theLocation) {
1936    this.location = theLocation;
1937    return this;
1938  }
1939
1940  public boolean hasLocation() {
1941    if (this.location == null)
1942      return false;
1943    for (CodeableConcept item : this.location)
1944      if (!item.isEmpty())
1945        return true;
1946    return false;
1947  }
1948
1949  public CodeableConcept addLocation() { // 3
1950    CodeableConcept t = new CodeableConcept();
1951    if (this.location == null)
1952      this.location = new ArrayList<CodeableConcept>();
1953    this.location.add(t);
1954    return t;
1955  }
1956
1957  public ResearchStudy addLocation(CodeableConcept t) { // 3
1958    if (t == null)
1959      return this;
1960    if (this.location == null)
1961      this.location = new ArrayList<CodeableConcept>();
1962    this.location.add(t);
1963    return this;
1964  }
1965
1966  /**
1967   * @return The first repetition of repeating field {@link #location}, creating
1968   *         it if it does not already exist
1969   */
1970  public CodeableConcept getLocationFirstRep() {
1971    if (getLocation().isEmpty()) {
1972      addLocation();
1973    }
1974    return getLocation().get(0);
1975  }
1976
1977  /**
1978   * @return {@link #description} (A full description of how the study is being
1979   *         conducted.). This is the underlying object with id, value and
1980   *         extensions. The accessor "getDescription" gives direct access to the
1981   *         value
1982   */
1983  public MarkdownType getDescriptionElement() {
1984    if (this.description == null)
1985      if (Configuration.errorOnAutoCreate())
1986        throw new Error("Attempt to auto-create ResearchStudy.description");
1987      else if (Configuration.doAutoCreate())
1988        this.description = new MarkdownType(); // bb
1989    return this.description;
1990  }
1991
1992  public boolean hasDescriptionElement() {
1993    return this.description != null && !this.description.isEmpty();
1994  }
1995
1996  public boolean hasDescription() {
1997    return this.description != null && !this.description.isEmpty();
1998  }
1999
2000  /**
2001   * @param value {@link #description} (A full description of how the study is
2002   *              being conducted.). This is the underlying object with id, value
2003   *              and extensions. The accessor "getDescription" gives direct
2004   *              access to the value
2005   */
2006  public ResearchStudy setDescriptionElement(MarkdownType value) {
2007    this.description = value;
2008    return this;
2009  }
2010
2011  /**
2012   * @return A full description of how the study is being conducted.
2013   */
2014  public String getDescription() {
2015    return this.description == null ? null : this.description.getValue();
2016  }
2017
2018  /**
2019   * @param value A full description of how the study is being conducted.
2020   */
2021  public ResearchStudy setDescription(String value) {
2022    if (value == null)
2023      this.description = null;
2024    else {
2025      if (this.description == null)
2026        this.description = new MarkdownType();
2027      this.description.setValue(value);
2028    }
2029    return this;
2030  }
2031
2032  /**
2033   * @return {@link #enrollment} (Reference to a Group that defines the criteria
2034   *         for and quantity of subjects participating in the study. E.g. " 200
2035   *         female Europeans between the ages of 20 and 45 with early onset
2036   *         diabetes".)
2037   */
2038  public List<Reference> getEnrollment() {
2039    if (this.enrollment == null)
2040      this.enrollment = new ArrayList<Reference>();
2041    return this.enrollment;
2042  }
2043
2044  /**
2045   * @return Returns a reference to <code>this</code> for easy method chaining
2046   */
2047  public ResearchStudy setEnrollment(List<Reference> theEnrollment) {
2048    this.enrollment = theEnrollment;
2049    return this;
2050  }
2051
2052  public boolean hasEnrollment() {
2053    if (this.enrollment == null)
2054      return false;
2055    for (Reference item : this.enrollment)
2056      if (!item.isEmpty())
2057        return true;
2058    return false;
2059  }
2060
2061  public Reference addEnrollment() { // 3
2062    Reference t = new Reference();
2063    if (this.enrollment == null)
2064      this.enrollment = new ArrayList<Reference>();
2065    this.enrollment.add(t);
2066    return t;
2067  }
2068
2069  public ResearchStudy addEnrollment(Reference t) { // 3
2070    if (t == null)
2071      return this;
2072    if (this.enrollment == null)
2073      this.enrollment = new ArrayList<Reference>();
2074    this.enrollment.add(t);
2075    return this;
2076  }
2077
2078  /**
2079   * @return The first repetition of repeating field {@link #enrollment}, creating
2080   *         it if it does not already exist
2081   */
2082  public Reference getEnrollmentFirstRep() {
2083    if (getEnrollment().isEmpty()) {
2084      addEnrollment();
2085    }
2086    return getEnrollment().get(0);
2087  }
2088
2089  /**
2090   * @deprecated Use Reference#setResource(IBaseResource) instead
2091   */
2092  @Deprecated
2093  public List<Group> getEnrollmentTarget() {
2094    if (this.enrollmentTarget == null)
2095      this.enrollmentTarget = new ArrayList<Group>();
2096    return this.enrollmentTarget;
2097  }
2098
2099  /**
2100   * @deprecated Use Reference#setResource(IBaseResource) instead
2101   */
2102  @Deprecated
2103  public Group addEnrollmentTarget() {
2104    Group r = new Group();
2105    if (this.enrollmentTarget == null)
2106      this.enrollmentTarget = new ArrayList<Group>();
2107    this.enrollmentTarget.add(r);
2108    return r;
2109  }
2110
2111  /**
2112   * @return {@link #period} (Identifies the start date and the expected (or
2113   *         actual, depending on status) end date for the study.)
2114   */
2115  public Period getPeriod() {
2116    if (this.period == null)
2117      if (Configuration.errorOnAutoCreate())
2118        throw new Error("Attempt to auto-create ResearchStudy.period");
2119      else if (Configuration.doAutoCreate())
2120        this.period = new Period(); // cc
2121    return this.period;
2122  }
2123
2124  public boolean hasPeriod() {
2125    return this.period != null && !this.period.isEmpty();
2126  }
2127
2128  /**
2129   * @param value {@link #period} (Identifies the start date and the expected (or
2130   *              actual, depending on status) end date for the study.)
2131   */
2132  public ResearchStudy setPeriod(Period value) {
2133    this.period = value;
2134    return this;
2135  }
2136
2137  /**
2138   * @return {@link #sponsor} (An organization that initiates the investigation
2139   *         and is legally responsible for the study.)
2140   */
2141  public Reference getSponsor() {
2142    if (this.sponsor == null)
2143      if (Configuration.errorOnAutoCreate())
2144        throw new Error("Attempt to auto-create ResearchStudy.sponsor");
2145      else if (Configuration.doAutoCreate())
2146        this.sponsor = new Reference(); // cc
2147    return this.sponsor;
2148  }
2149
2150  public boolean hasSponsor() {
2151    return this.sponsor != null && !this.sponsor.isEmpty();
2152  }
2153
2154  /**
2155   * @param value {@link #sponsor} (An organization that initiates the
2156   *              investigation and is legally responsible for the study.)
2157   */
2158  public ResearchStudy setSponsor(Reference value) {
2159    this.sponsor = value;
2160    return this;
2161  }
2162
2163  /**
2164   * @return {@link #sponsor} The actual object that is the target of the
2165   *         reference. The reference library doesn't populate this, but you can
2166   *         use it to hold the resource if you resolve it. (An organization that
2167   *         initiates the investigation and is legally responsible for the
2168   *         study.)
2169   */
2170  public Organization getSponsorTarget() {
2171    if (this.sponsorTarget == null)
2172      if (Configuration.errorOnAutoCreate())
2173        throw new Error("Attempt to auto-create ResearchStudy.sponsor");
2174      else if (Configuration.doAutoCreate())
2175        this.sponsorTarget = new Organization(); // aa
2176    return this.sponsorTarget;
2177  }
2178
2179  /**
2180   * @param value {@link #sponsor} The actual object that is the target of the
2181   *              reference. The reference library doesn't use these, but you can
2182   *              use it to hold the resource if you resolve it. (An organization
2183   *              that initiates the investigation and is legally responsible for
2184   *              the study.)
2185   */
2186  public ResearchStudy setSponsorTarget(Organization value) {
2187    this.sponsorTarget = value;
2188    return this;
2189  }
2190
2191  /**
2192   * @return {@link #principalInvestigator} (A researcher in a study who oversees
2193   *         multiple aspects of the study, such as concept development, protocol
2194   *         writing, protocol submission for IRB approval, participant
2195   *         recruitment, informed consent, data collection, analysis,
2196   *         interpretation and presentation.)
2197   */
2198  public Reference getPrincipalInvestigator() {
2199    if (this.principalInvestigator == null)
2200      if (Configuration.errorOnAutoCreate())
2201        throw new Error("Attempt to auto-create ResearchStudy.principalInvestigator");
2202      else if (Configuration.doAutoCreate())
2203        this.principalInvestigator = new Reference(); // cc
2204    return this.principalInvestigator;
2205  }
2206
2207  public boolean hasPrincipalInvestigator() {
2208    return this.principalInvestigator != null && !this.principalInvestigator.isEmpty();
2209  }
2210
2211  /**
2212   * @param value {@link #principalInvestigator} (A researcher in a study who
2213   *              oversees multiple aspects of the study, such as concept
2214   *              development, protocol writing, protocol submission for IRB
2215   *              approval, participant recruitment, informed consent, data
2216   *              collection, analysis, interpretation and presentation.)
2217   */
2218  public ResearchStudy setPrincipalInvestigator(Reference value) {
2219    this.principalInvestigator = value;
2220    return this;
2221  }
2222
2223  /**
2224   * @return {@link #principalInvestigator} The actual object that is the target
2225   *         of the reference. The reference library doesn't populate this, but
2226   *         you can use it to hold the resource if you resolve it. (A researcher
2227   *         in a study who oversees multiple aspects of the study, such as
2228   *         concept development, protocol writing, protocol submission for IRB
2229   *         approval, participant recruitment, informed consent, data collection,
2230   *         analysis, interpretation and presentation.)
2231   */
2232  public Resource getPrincipalInvestigatorTarget() {
2233    return this.principalInvestigatorTarget;
2234  }
2235
2236  /**
2237   * @param value {@link #principalInvestigator} The actual object that is the
2238   *              target of the reference. The reference library doesn't use
2239   *              these, but you can use it to hold the resource if you resolve
2240   *              it. (A researcher in a study who oversees multiple aspects of
2241   *              the study, such as concept development, protocol writing,
2242   *              protocol submission for IRB approval, participant recruitment,
2243   *              informed consent, data collection, analysis, interpretation and
2244   *              presentation.)
2245   */
2246  public ResearchStudy setPrincipalInvestigatorTarget(Resource value) {
2247    this.principalInvestigatorTarget = value;
2248    return this;
2249  }
2250
2251  /**
2252   * @return {@link #site} (A facility in which study activities are conducted.)
2253   */
2254  public List<Reference> getSite() {
2255    if (this.site == null)
2256      this.site = new ArrayList<Reference>();
2257    return this.site;
2258  }
2259
2260  /**
2261   * @return Returns a reference to <code>this</code> for easy method chaining
2262   */
2263  public ResearchStudy setSite(List<Reference> theSite) {
2264    this.site = theSite;
2265    return this;
2266  }
2267
2268  public boolean hasSite() {
2269    if (this.site == null)
2270      return false;
2271    for (Reference item : this.site)
2272      if (!item.isEmpty())
2273        return true;
2274    return false;
2275  }
2276
2277  public Reference addSite() { // 3
2278    Reference t = new Reference();
2279    if (this.site == null)
2280      this.site = new ArrayList<Reference>();
2281    this.site.add(t);
2282    return t;
2283  }
2284
2285  public ResearchStudy addSite(Reference t) { // 3
2286    if (t == null)
2287      return this;
2288    if (this.site == null)
2289      this.site = new ArrayList<Reference>();
2290    this.site.add(t);
2291    return this;
2292  }
2293
2294  /**
2295   * @return The first repetition of repeating field {@link #site}, creating it if
2296   *         it does not already exist
2297   */
2298  public Reference getSiteFirstRep() {
2299    if (getSite().isEmpty()) {
2300      addSite();
2301    }
2302    return getSite().get(0);
2303  }
2304
2305  /**
2306   * @deprecated Use Reference#setResource(IBaseResource) instead
2307   */
2308  @Deprecated
2309  public List<Location> getSiteTarget() {
2310    if (this.siteTarget == null)
2311      this.siteTarget = new ArrayList<Location>();
2312    return this.siteTarget;
2313  }
2314
2315  /**
2316   * @deprecated Use Reference#setResource(IBaseResource) instead
2317   */
2318  @Deprecated
2319  public Location addSiteTarget() {
2320    Location r = new Location();
2321    if (this.siteTarget == null)
2322      this.siteTarget = new ArrayList<Location>();
2323    this.siteTarget.add(r);
2324    return r;
2325  }
2326
2327  /**
2328   * @return {@link #reasonStopped} (A description and/or code explaining the
2329   *         premature termination of the study.)
2330   */
2331  public CodeableConcept getReasonStopped() {
2332    if (this.reasonStopped == null)
2333      if (Configuration.errorOnAutoCreate())
2334        throw new Error("Attempt to auto-create ResearchStudy.reasonStopped");
2335      else if (Configuration.doAutoCreate())
2336        this.reasonStopped = new CodeableConcept(); // cc
2337    return this.reasonStopped;
2338  }
2339
2340  public boolean hasReasonStopped() {
2341    return this.reasonStopped != null && !this.reasonStopped.isEmpty();
2342  }
2343
2344  /**
2345   * @param value {@link #reasonStopped} (A description and/or code explaining the
2346   *              premature termination of the study.)
2347   */
2348  public ResearchStudy setReasonStopped(CodeableConcept value) {
2349    this.reasonStopped = value;
2350    return this;
2351  }
2352
2353  /**
2354   * @return {@link #note} (Comments made about the study by the performer,
2355   *         subject or other participants.)
2356   */
2357  public List<Annotation> getNote() {
2358    if (this.note == null)
2359      this.note = new ArrayList<Annotation>();
2360    return this.note;
2361  }
2362
2363  /**
2364   * @return Returns a reference to <code>this</code> for easy method chaining
2365   */
2366  public ResearchStudy setNote(List<Annotation> theNote) {
2367    this.note = theNote;
2368    return this;
2369  }
2370
2371  public boolean hasNote() {
2372    if (this.note == null)
2373      return false;
2374    for (Annotation item : this.note)
2375      if (!item.isEmpty())
2376        return true;
2377    return false;
2378  }
2379
2380  public Annotation addNote() { // 3
2381    Annotation t = new Annotation();
2382    if (this.note == null)
2383      this.note = new ArrayList<Annotation>();
2384    this.note.add(t);
2385    return t;
2386  }
2387
2388  public ResearchStudy addNote(Annotation t) { // 3
2389    if (t == null)
2390      return this;
2391    if (this.note == null)
2392      this.note = new ArrayList<Annotation>();
2393    this.note.add(t);
2394    return this;
2395  }
2396
2397  /**
2398   * @return The first repetition of repeating field {@link #note}, creating it if
2399   *         it does not already exist
2400   */
2401  public Annotation getNoteFirstRep() {
2402    if (getNote().isEmpty()) {
2403      addNote();
2404    }
2405    return getNote().get(0);
2406  }
2407
2408  /**
2409   * @return {@link #arm} (Describes an expected sequence of events for one of the
2410   *         participants of a study. E.g. Exposure to drug A, wash-out, exposure
2411   *         to drug B, wash-out, follow-up.)
2412   */
2413  public List<ResearchStudyArmComponent> getArm() {
2414    if (this.arm == null)
2415      this.arm = new ArrayList<ResearchStudyArmComponent>();
2416    return this.arm;
2417  }
2418
2419  /**
2420   * @return Returns a reference to <code>this</code> for easy method chaining
2421   */
2422  public ResearchStudy setArm(List<ResearchStudyArmComponent> theArm) {
2423    this.arm = theArm;
2424    return this;
2425  }
2426
2427  public boolean hasArm() {
2428    if (this.arm == null)
2429      return false;
2430    for (ResearchStudyArmComponent item : this.arm)
2431      if (!item.isEmpty())
2432        return true;
2433    return false;
2434  }
2435
2436  public ResearchStudyArmComponent addArm() { // 3
2437    ResearchStudyArmComponent t = new ResearchStudyArmComponent();
2438    if (this.arm == null)
2439      this.arm = new ArrayList<ResearchStudyArmComponent>();
2440    this.arm.add(t);
2441    return t;
2442  }
2443
2444  public ResearchStudy addArm(ResearchStudyArmComponent t) { // 3
2445    if (t == null)
2446      return this;
2447    if (this.arm == null)
2448      this.arm = new ArrayList<ResearchStudyArmComponent>();
2449    this.arm.add(t);
2450    return this;
2451  }
2452
2453  /**
2454   * @return The first repetition of repeating field {@link #arm}, creating it if
2455   *         it does not already exist
2456   */
2457  public ResearchStudyArmComponent getArmFirstRep() {
2458    if (getArm().isEmpty()) {
2459      addArm();
2460    }
2461    return getArm().get(0);
2462  }
2463
2464  /**
2465   * @return {@link #objective} (A goal that the study is aiming to achieve in
2466   *         terms of a scientific question to be answered by the analysis of data
2467   *         collected during the study.)
2468   */
2469  public List<ResearchStudyObjectiveComponent> getObjective() {
2470    if (this.objective == null)
2471      this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
2472    return this.objective;
2473  }
2474
2475  /**
2476   * @return Returns a reference to <code>this</code> for easy method chaining
2477   */
2478  public ResearchStudy setObjective(List<ResearchStudyObjectiveComponent> theObjective) {
2479    this.objective = theObjective;
2480    return this;
2481  }
2482
2483  public boolean hasObjective() {
2484    if (this.objective == null)
2485      return false;
2486    for (ResearchStudyObjectiveComponent item : this.objective)
2487      if (!item.isEmpty())
2488        return true;
2489    return false;
2490  }
2491
2492  public ResearchStudyObjectiveComponent addObjective() { // 3
2493    ResearchStudyObjectiveComponent t = new ResearchStudyObjectiveComponent();
2494    if (this.objective == null)
2495      this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
2496    this.objective.add(t);
2497    return t;
2498  }
2499
2500  public ResearchStudy addObjective(ResearchStudyObjectiveComponent t) { // 3
2501    if (t == null)
2502      return this;
2503    if (this.objective == null)
2504      this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
2505    this.objective.add(t);
2506    return this;
2507  }
2508
2509  /**
2510   * @return The first repetition of repeating field {@link #objective}, creating
2511   *         it if it does not already exist
2512   */
2513  public ResearchStudyObjectiveComponent getObjectiveFirstRep() {
2514    if (getObjective().isEmpty()) {
2515      addObjective();
2516    }
2517    return getObjective().get(0);
2518  }
2519
2520  protected void listChildren(List<Property> children) {
2521    super.listChildren(children);
2522    children.add(new Property("identifier", "Identifier",
2523        "Identifiers assigned to this research study by the sponsor or other systems.", 0, java.lang.Integer.MAX_VALUE,
2524        identifier));
2525    children
2526        .add(new Property("title", "string", "A short, descriptive user-friendly label for the study.", 0, 1, title));
2527    children.add(new Property("protocol", "Reference(PlanDefinition)",
2528        "The set of steps expected to be performed as part of the execution of the study.", 0,
2529        java.lang.Integer.MAX_VALUE, protocol));
2530    children.add(new Property("partOf", "Reference(ResearchStudy)",
2531        "A larger research study of which this particular study is a component or step.", 0,
2532        java.lang.Integer.MAX_VALUE, partOf));
2533    children.add(new Property("status", "code", "The current state of the study.", 0, 1, status));
2534    children.add(new Property("primaryPurposeType", "CodeableConcept",
2535        "The type of study based upon the intent of the study's activities. A classification of the intent of the study.",
2536        0, 1, primaryPurposeType));
2537    children.add(new Property("phase", "CodeableConcept",
2538        "The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.",
2539        0, 1, phase));
2540    children.add(new Property("category", "CodeableConcept",
2541        "Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.",
2542        0, java.lang.Integer.MAX_VALUE, category));
2543    children.add(new Property("focus", "CodeableConcept",
2544        "The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.",
2545        0, java.lang.Integer.MAX_VALUE, focus));
2546    children.add(new Property("condition", "CodeableConcept",
2547        "The condition that is the focus of the study.  For example, In a study to examine risk factors for Lupus, might have as an inclusion criterion \"healthy volunteer\", but the target condition code would be a Lupus SNOMED code.",
2548        0, java.lang.Integer.MAX_VALUE, condition));
2549    children.add(new Property("contact", "ContactDetail",
2550        "Contact details to assist a user in learning more about or engaging with the study.", 0,
2551        java.lang.Integer.MAX_VALUE, contact));
2552    children.add(new Property("relatedArtifact", "RelatedArtifact",
2553        "Citations, references and other related documents.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
2554    children.add(new Property("keyword", "CodeableConcept", "Key terms to aid in searching for or filtering the study.",
2555        0, java.lang.Integer.MAX_VALUE, keyword));
2556    children.add(new Property("location", "CodeableConcept",
2557        "Indicates a country, state or other region where the study is taking place.", 0, java.lang.Integer.MAX_VALUE,
2558        location));
2559    children.add(new Property("description", "markdown", "A full description of how the study is being conducted.", 0,
2560        1, description));
2561    children.add(new Property("enrollment", "Reference(Group)",
2562        "Reference to a Group that defines the criteria for and quantity of subjects participating in the study.  E.g. \" 200 female Europeans between the ages of 20 and 45 with early onset diabetes\".",
2563        0, java.lang.Integer.MAX_VALUE, enrollment));
2564    children.add(new Property("period", "Period",
2565        "Identifies the start date and the expected (or actual, depending on status) end date for the study.", 0, 1,
2566        period));
2567    children.add(new Property("sponsor", "Reference(Organization)",
2568        "An organization that initiates the investigation and is legally responsible for the study.", 0, 1, sponsor));
2569    children.add(new Property("principalInvestigator", "Reference(Practitioner|PractitionerRole)",
2570        "A researcher in a study who oversees multiple aspects of the study, such as concept development, protocol writing, protocol submission for IRB approval, participant recruitment, informed consent, data collection, analysis, interpretation and presentation.",
2571        0, 1, principalInvestigator));
2572    children.add(new Property("site", "Reference(Location)", "A facility in which study activities are conducted.", 0,
2573        java.lang.Integer.MAX_VALUE, site));
2574    children.add(new Property("reasonStopped", "CodeableConcept",
2575        "A description and/or code explaining the premature termination of the study.", 0, 1, reasonStopped));
2576    children.add(new Property("note", "Annotation",
2577        "Comments made about the study by the performer, subject or other participants.", 0,
2578        java.lang.Integer.MAX_VALUE, note));
2579    children.add(new Property("arm", "",
2580        "Describes an expected sequence of events for one of the participants of a study.  E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, follow-up.",
2581        0, java.lang.Integer.MAX_VALUE, arm));
2582    children.add(new Property("objective", "",
2583        "A goal that the study is aiming to achieve in terms of a scientific question to be answered by the analysis of data collected during the study.",
2584        0, java.lang.Integer.MAX_VALUE, objective));
2585  }
2586
2587  @Override
2588  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2589    switch (_hash) {
2590    case -1618432855:
2591      /* identifier */ return new Property("identifier", "Identifier",
2592          "Identifiers assigned to this research study by the sponsor or other systems.", 0,
2593          java.lang.Integer.MAX_VALUE, identifier);
2594    case 110371416:
2595      /* title */ return new Property("title", "string", "A short, descriptive user-friendly label for the study.", 0,
2596          1, title);
2597    case -989163880:
2598      /* protocol */ return new Property("protocol", "Reference(PlanDefinition)",
2599          "The set of steps expected to be performed as part of the execution of the study.", 0,
2600          java.lang.Integer.MAX_VALUE, protocol);
2601    case -995410646:
2602      /* partOf */ return new Property("partOf", "Reference(ResearchStudy)",
2603          "A larger research study of which this particular study is a component or step.", 0,
2604          java.lang.Integer.MAX_VALUE, partOf);
2605    case -892481550:
2606      /* status */ return new Property("status", "code", "The current state of the study.", 0, 1, status);
2607    case -2132842986:
2608      /* primaryPurposeType */ return new Property("primaryPurposeType", "CodeableConcept",
2609          "The type of study based upon the intent of the study's activities. A classification of the intent of the study.",
2610          0, 1, primaryPurposeType);
2611    case 106629499:
2612      /* phase */ return new Property("phase", "CodeableConcept",
2613          "The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.",
2614          0, 1, phase);
2615    case 50511102:
2616      /* category */ return new Property("category", "CodeableConcept",
2617          "Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.",
2618          0, java.lang.Integer.MAX_VALUE, category);
2619    case 97604824:
2620      /* focus */ return new Property("focus", "CodeableConcept",
2621          "The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.",
2622          0, java.lang.Integer.MAX_VALUE, focus);
2623    case -861311717:
2624      /* condition */ return new Property("condition", "CodeableConcept",
2625          "The condition that is the focus of the study.  For example, In a study to examine risk factors for Lupus, might have as an inclusion criterion \"healthy volunteer\", but the target condition code would be a Lupus SNOMED code.",
2626          0, java.lang.Integer.MAX_VALUE, condition);
2627    case 951526432:
2628      /* contact */ return new Property("contact", "ContactDetail",
2629          "Contact details to assist a user in learning more about or engaging with the study.", 0,
2630          java.lang.Integer.MAX_VALUE, contact);
2631    case 666807069:
2632      /* relatedArtifact */ return new Property("relatedArtifact", "RelatedArtifact",
2633          "Citations, references and other related documents.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
2634    case -814408215:
2635      /* keyword */ return new Property("keyword", "CodeableConcept",
2636          "Key terms to aid in searching for or filtering the study.", 0, java.lang.Integer.MAX_VALUE, keyword);
2637    case 1901043637:
2638      /* location */ return new Property("location", "CodeableConcept",
2639          "Indicates a country, state or other region where the study is taking place.", 0, java.lang.Integer.MAX_VALUE,
2640          location);
2641    case -1724546052:
2642      /* description */ return new Property("description", "markdown",
2643          "A full description of how the study is being conducted.", 0, 1, description);
2644    case 116089604:
2645      /* enrollment */ return new Property("enrollment", "Reference(Group)",
2646          "Reference to a Group that defines the criteria for and quantity of subjects participating in the study.  E.g. \" 200 female Europeans between the ages of 20 and 45 with early onset diabetes\".",
2647          0, java.lang.Integer.MAX_VALUE, enrollment);
2648    case -991726143:
2649      /* period */ return new Property("period", "Period",
2650          "Identifies the start date and the expected (or actual, depending on status) end date for the study.", 0, 1,
2651          period);
2652    case -1998892262:
2653      /* sponsor */ return new Property("sponsor", "Reference(Organization)",
2654          "An organization that initiates the investigation and is legally responsible for the study.", 0, 1, sponsor);
2655    case 1437117175:
2656      /* principalInvestigator */ return new Property("principalInvestigator",
2657          "Reference(Practitioner|PractitionerRole)",
2658          "A researcher in a study who oversees multiple aspects of the study, such as concept development, protocol writing, protocol submission for IRB approval, participant recruitment, informed consent, data collection, analysis, interpretation and presentation.",
2659          0, 1, principalInvestigator);
2660    case 3530567:
2661      /* site */ return new Property("site", "Reference(Location)",
2662          "A facility in which study activities are conducted.", 0, java.lang.Integer.MAX_VALUE, site);
2663    case 1181369065:
2664      /* reasonStopped */ return new Property("reasonStopped", "CodeableConcept",
2665          "A description and/or code explaining the premature termination of the study.", 0, 1, reasonStopped);
2666    case 3387378:
2667      /* note */ return new Property("note", "Annotation",
2668          "Comments made about the study by the performer, subject or other participants.", 0,
2669          java.lang.Integer.MAX_VALUE, note);
2670    case 96860:
2671      /* arm */ return new Property("arm", "",
2672          "Describes an expected sequence of events for one of the participants of a study.  E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, follow-up.",
2673          0, java.lang.Integer.MAX_VALUE, arm);
2674    case -1489585863:
2675      /* objective */ return new Property("objective", "",
2676          "A goal that the study is aiming to achieve in terms of a scientific question to be answered by the analysis of data collected during the study.",
2677          0, java.lang.Integer.MAX_VALUE, objective);
2678    default:
2679      return super.getNamedProperty(_hash, _name, _checkValid);
2680    }
2681
2682  }
2683
2684  @Override
2685  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2686    switch (hash) {
2687    case -1618432855:
2688      /* identifier */ return this.identifier == null ? new Base[0]
2689          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2690    case 110371416:
2691      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
2692    case -989163880:
2693      /* protocol */ return this.protocol == null ? new Base[0] : this.protocol.toArray(new Base[this.protocol.size()]); // Reference
2694    case -995410646:
2695      /* partOf */ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2696    case -892481550:
2697      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ResearchStudyStatus>
2698    case -2132842986:
2699      /* primaryPurposeType */ return this.primaryPurposeType == null ? new Base[0]
2700          : new Base[] { this.primaryPurposeType }; // CodeableConcept
2701    case 106629499:
2702      /* phase */ return this.phase == null ? new Base[0] : new Base[] { this.phase }; // CodeableConcept
2703    case 50511102:
2704      /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2705    case 97604824:
2706      /* focus */ return this.focus == null ? new Base[0] : this.focus.toArray(new Base[this.focus.size()]); // CodeableConcept
2707    case -861311717:
2708      /* condition */ return this.condition == null ? new Base[0]
2709          : this.condition.toArray(new Base[this.condition.size()]); // CodeableConcept
2710    case 951526432:
2711      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
2712    case 666807069:
2713      /* relatedArtifact */ return this.relatedArtifact == null ? new Base[0]
2714          : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
2715    case -814408215:
2716      /* keyword */ return this.keyword == null ? new Base[0] : this.keyword.toArray(new Base[this.keyword.size()]); // CodeableConcept
2717    case 1901043637:
2718      /* location */ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // CodeableConcept
2719    case -1724546052:
2720      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // MarkdownType
2721    case 116089604:
2722      /* enrollment */ return this.enrollment == null ? new Base[0]
2723          : this.enrollment.toArray(new Base[this.enrollment.size()]); // Reference
2724    case -991726143:
2725      /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
2726    case -1998892262:
2727      /* sponsor */ return this.sponsor == null ? new Base[0] : new Base[] { this.sponsor }; // Reference
2728    case 1437117175:
2729      /* principalInvestigator */ return this.principalInvestigator == null ? new Base[0]
2730          : new Base[] { this.principalInvestigator }; // Reference
2731    case 3530567:
2732      /* site */ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
2733    case 1181369065:
2734      /* reasonStopped */ return this.reasonStopped == null ? new Base[0] : new Base[] { this.reasonStopped }; // CodeableConcept
2735    case 3387378:
2736      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2737    case 96860:
2738      /* arm */ return this.arm == null ? new Base[0] : this.arm.toArray(new Base[this.arm.size()]); // ResearchStudyArmComponent
2739    case -1489585863:
2740      /* objective */ return this.objective == null ? new Base[0]
2741          : this.objective.toArray(new Base[this.objective.size()]); // ResearchStudyObjectiveComponent
2742    default:
2743      return super.getProperty(hash, name, checkValid);
2744    }
2745
2746  }
2747
2748  @Override
2749  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2750    switch (hash) {
2751    case -1618432855: // identifier
2752      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2753      return value;
2754    case 110371416: // title
2755      this.title = castToString(value); // StringType
2756      return value;
2757    case -989163880: // protocol
2758      this.getProtocol().add(castToReference(value)); // Reference
2759      return value;
2760    case -995410646: // partOf
2761      this.getPartOf().add(castToReference(value)); // Reference
2762      return value;
2763    case -892481550: // status
2764      value = new ResearchStudyStatusEnumFactory().fromType(castToCode(value));
2765      this.status = (Enumeration) value; // Enumeration<ResearchStudyStatus>
2766      return value;
2767    case -2132842986: // primaryPurposeType
2768      this.primaryPurposeType = castToCodeableConcept(value); // CodeableConcept
2769      return value;
2770    case 106629499: // phase
2771      this.phase = castToCodeableConcept(value); // CodeableConcept
2772      return value;
2773    case 50511102: // category
2774      this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2775      return value;
2776    case 97604824: // focus
2777      this.getFocus().add(castToCodeableConcept(value)); // CodeableConcept
2778      return value;
2779    case -861311717: // condition
2780      this.getCondition().add(castToCodeableConcept(value)); // CodeableConcept
2781      return value;
2782    case 951526432: // contact
2783      this.getContact().add(castToContactDetail(value)); // ContactDetail
2784      return value;
2785    case 666807069: // relatedArtifact
2786      this.getRelatedArtifact().add(castToRelatedArtifact(value)); // RelatedArtifact
2787      return value;
2788    case -814408215: // keyword
2789      this.getKeyword().add(castToCodeableConcept(value)); // CodeableConcept
2790      return value;
2791    case 1901043637: // location
2792      this.getLocation().add(castToCodeableConcept(value)); // CodeableConcept
2793      return value;
2794    case -1724546052: // description
2795      this.description = castToMarkdown(value); // MarkdownType
2796      return value;
2797    case 116089604: // enrollment
2798      this.getEnrollment().add(castToReference(value)); // Reference
2799      return value;
2800    case -991726143: // period
2801      this.period = castToPeriod(value); // Period
2802      return value;
2803    case -1998892262: // sponsor
2804      this.sponsor = castToReference(value); // Reference
2805      return value;
2806    case 1437117175: // principalInvestigator
2807      this.principalInvestigator = castToReference(value); // Reference
2808      return value;
2809    case 3530567: // site
2810      this.getSite().add(castToReference(value)); // Reference
2811      return value;
2812    case 1181369065: // reasonStopped
2813      this.reasonStopped = castToCodeableConcept(value); // CodeableConcept
2814      return value;
2815    case 3387378: // note
2816      this.getNote().add(castToAnnotation(value)); // Annotation
2817      return value;
2818    case 96860: // arm
2819      this.getArm().add((ResearchStudyArmComponent) value); // ResearchStudyArmComponent
2820      return value;
2821    case -1489585863: // objective
2822      this.getObjective().add((ResearchStudyObjectiveComponent) value); // ResearchStudyObjectiveComponent
2823      return value;
2824    default:
2825      return super.setProperty(hash, name, value);
2826    }
2827
2828  }
2829
2830  @Override
2831  public Base setProperty(String name, Base value) throws FHIRException {
2832    if (name.equals("identifier")) {
2833      this.getIdentifier().add(castToIdentifier(value));
2834    } else if (name.equals("title")) {
2835      this.title = castToString(value); // StringType
2836    } else if (name.equals("protocol")) {
2837      this.getProtocol().add(castToReference(value));
2838    } else if (name.equals("partOf")) {
2839      this.getPartOf().add(castToReference(value));
2840    } else if (name.equals("status")) {
2841      value = new ResearchStudyStatusEnumFactory().fromType(castToCode(value));
2842      this.status = (Enumeration) value; // Enumeration<ResearchStudyStatus>
2843    } else if (name.equals("primaryPurposeType")) {
2844      this.primaryPurposeType = castToCodeableConcept(value); // CodeableConcept
2845    } else if (name.equals("phase")) {
2846      this.phase = castToCodeableConcept(value); // CodeableConcept
2847    } else if (name.equals("category")) {
2848      this.getCategory().add(castToCodeableConcept(value));
2849    } else if (name.equals("focus")) {
2850      this.getFocus().add(castToCodeableConcept(value));
2851    } else if (name.equals("condition")) {
2852      this.getCondition().add(castToCodeableConcept(value));
2853    } else if (name.equals("contact")) {
2854      this.getContact().add(castToContactDetail(value));
2855    } else if (name.equals("relatedArtifact")) {
2856      this.getRelatedArtifact().add(castToRelatedArtifact(value));
2857    } else if (name.equals("keyword")) {
2858      this.getKeyword().add(castToCodeableConcept(value));
2859    } else if (name.equals("location")) {
2860      this.getLocation().add(castToCodeableConcept(value));
2861    } else if (name.equals("description")) {
2862      this.description = castToMarkdown(value); // MarkdownType
2863    } else if (name.equals("enrollment")) {
2864      this.getEnrollment().add(castToReference(value));
2865    } else if (name.equals("period")) {
2866      this.period = castToPeriod(value); // Period
2867    } else if (name.equals("sponsor")) {
2868      this.sponsor = castToReference(value); // Reference
2869    } else if (name.equals("principalInvestigator")) {
2870      this.principalInvestigator = castToReference(value); // Reference
2871    } else if (name.equals("site")) {
2872      this.getSite().add(castToReference(value));
2873    } else if (name.equals("reasonStopped")) {
2874      this.reasonStopped = castToCodeableConcept(value); // CodeableConcept
2875    } else if (name.equals("note")) {
2876      this.getNote().add(castToAnnotation(value));
2877    } else if (name.equals("arm")) {
2878      this.getArm().add((ResearchStudyArmComponent) value);
2879    } else if (name.equals("objective")) {
2880      this.getObjective().add((ResearchStudyObjectiveComponent) value);
2881    } else
2882      return super.setProperty(name, value);
2883    return value;
2884  }
2885
2886  @Override
2887  public Base makeProperty(int hash, String name) throws FHIRException {
2888    switch (hash) {
2889    case -1618432855:
2890      return addIdentifier();
2891    case 110371416:
2892      return getTitleElement();
2893    case -989163880:
2894      return addProtocol();
2895    case -995410646:
2896      return addPartOf();
2897    case -892481550:
2898      return getStatusElement();
2899    case -2132842986:
2900      return getPrimaryPurposeType();
2901    case 106629499:
2902      return getPhase();
2903    case 50511102:
2904      return addCategory();
2905    case 97604824:
2906      return addFocus();
2907    case -861311717:
2908      return addCondition();
2909    case 951526432:
2910      return addContact();
2911    case 666807069:
2912      return addRelatedArtifact();
2913    case -814408215:
2914      return addKeyword();
2915    case 1901043637:
2916      return addLocation();
2917    case -1724546052:
2918      return getDescriptionElement();
2919    case 116089604:
2920      return addEnrollment();
2921    case -991726143:
2922      return getPeriod();
2923    case -1998892262:
2924      return getSponsor();
2925    case 1437117175:
2926      return getPrincipalInvestigator();
2927    case 3530567:
2928      return addSite();
2929    case 1181369065:
2930      return getReasonStopped();
2931    case 3387378:
2932      return addNote();
2933    case 96860:
2934      return addArm();
2935    case -1489585863:
2936      return addObjective();
2937    default:
2938      return super.makeProperty(hash, name);
2939    }
2940
2941  }
2942
2943  @Override
2944  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2945    switch (hash) {
2946    case -1618432855:
2947      /* identifier */ return new String[] { "Identifier" };
2948    case 110371416:
2949      /* title */ return new String[] { "string" };
2950    case -989163880:
2951      /* protocol */ return new String[] { "Reference" };
2952    case -995410646:
2953      /* partOf */ return new String[] { "Reference" };
2954    case -892481550:
2955      /* status */ return new String[] { "code" };
2956    case -2132842986:
2957      /* primaryPurposeType */ return new String[] { "CodeableConcept" };
2958    case 106629499:
2959      /* phase */ return new String[] { "CodeableConcept" };
2960    case 50511102:
2961      /* category */ return new String[] { "CodeableConcept" };
2962    case 97604824:
2963      /* focus */ return new String[] { "CodeableConcept" };
2964    case -861311717:
2965      /* condition */ return new String[] { "CodeableConcept" };
2966    case 951526432:
2967      /* contact */ return new String[] { "ContactDetail" };
2968    case 666807069:
2969      /* relatedArtifact */ return new String[] { "RelatedArtifact" };
2970    case -814408215:
2971      /* keyword */ return new String[] { "CodeableConcept" };
2972    case 1901043637:
2973      /* location */ return new String[] { "CodeableConcept" };
2974    case -1724546052:
2975      /* description */ return new String[] { "markdown" };
2976    case 116089604:
2977      /* enrollment */ return new String[] { "Reference" };
2978    case -991726143:
2979      /* period */ return new String[] { "Period" };
2980    case -1998892262:
2981      /* sponsor */ return new String[] { "Reference" };
2982    case 1437117175:
2983      /* principalInvestigator */ return new String[] { "Reference" };
2984    case 3530567:
2985      /* site */ return new String[] { "Reference" };
2986    case 1181369065:
2987      /* reasonStopped */ return new String[] { "CodeableConcept" };
2988    case 3387378:
2989      /* note */ return new String[] { "Annotation" };
2990    case 96860:
2991      /* arm */ return new String[] {};
2992    case -1489585863:
2993      /* objective */ return new String[] {};
2994    default:
2995      return super.getTypesForProperty(hash, name);
2996    }
2997
2998  }
2999
3000  @Override
3001  public Base addChild(String name) throws FHIRException {
3002    if (name.equals("identifier")) {
3003      return addIdentifier();
3004    } else if (name.equals("title")) {
3005      throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.title");
3006    } else if (name.equals("protocol")) {
3007      return addProtocol();
3008    } else if (name.equals("partOf")) {
3009      return addPartOf();
3010    } else if (name.equals("status")) {
3011      throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.status");
3012    } else if (name.equals("primaryPurposeType")) {
3013      this.primaryPurposeType = new CodeableConcept();
3014      return this.primaryPurposeType;
3015    } else if (name.equals("phase")) {
3016      this.phase = new CodeableConcept();
3017      return this.phase;
3018    } else if (name.equals("category")) {
3019      return addCategory();
3020    } else if (name.equals("focus")) {
3021      return addFocus();
3022    } else if (name.equals("condition")) {
3023      return addCondition();
3024    } else if (name.equals("contact")) {
3025      return addContact();
3026    } else if (name.equals("relatedArtifact")) {
3027      return addRelatedArtifact();
3028    } else if (name.equals("keyword")) {
3029      return addKeyword();
3030    } else if (name.equals("location")) {
3031      return addLocation();
3032    } else if (name.equals("description")) {
3033      throw new FHIRException("Cannot call addChild on a singleton property ResearchStudy.description");
3034    } else if (name.equals("enrollment")) {
3035      return addEnrollment();
3036    } else if (name.equals("period")) {
3037      this.period = new Period();
3038      return this.period;
3039    } else if (name.equals("sponsor")) {
3040      this.sponsor = new Reference();
3041      return this.sponsor;
3042    } else if (name.equals("principalInvestigator")) {
3043      this.principalInvestigator = new Reference();
3044      return this.principalInvestigator;
3045    } else if (name.equals("site")) {
3046      return addSite();
3047    } else if (name.equals("reasonStopped")) {
3048      this.reasonStopped = new CodeableConcept();
3049      return this.reasonStopped;
3050    } else if (name.equals("note")) {
3051      return addNote();
3052    } else if (name.equals("arm")) {
3053      return addArm();
3054    } else if (name.equals("objective")) {
3055      return addObjective();
3056    } else
3057      return super.addChild(name);
3058  }
3059
3060  public String fhirType() {
3061    return "ResearchStudy";
3062
3063  }
3064
3065  public ResearchStudy copy() {
3066    ResearchStudy dst = new ResearchStudy();
3067    copyValues(dst);
3068    return dst;
3069  }
3070
3071  public void copyValues(ResearchStudy dst) {
3072    super.copyValues(dst);
3073    if (identifier != null) {
3074      dst.identifier = new ArrayList<Identifier>();
3075      for (Identifier i : identifier)
3076        dst.identifier.add(i.copy());
3077    }
3078    ;
3079    dst.title = title == null ? null : title.copy();
3080    if (protocol != null) {
3081      dst.protocol = new ArrayList<Reference>();
3082      for (Reference i : protocol)
3083        dst.protocol.add(i.copy());
3084    }
3085    ;
3086    if (partOf != null) {
3087      dst.partOf = new ArrayList<Reference>();
3088      for (Reference i : partOf)
3089        dst.partOf.add(i.copy());
3090    }
3091    ;
3092    dst.status = status == null ? null : status.copy();
3093    dst.primaryPurposeType = primaryPurposeType == null ? null : primaryPurposeType.copy();
3094    dst.phase = phase == null ? null : phase.copy();
3095    if (category != null) {
3096      dst.category = new ArrayList<CodeableConcept>();
3097      for (CodeableConcept i : category)
3098        dst.category.add(i.copy());
3099    }
3100    ;
3101    if (focus != null) {
3102      dst.focus = new ArrayList<CodeableConcept>();
3103      for (CodeableConcept i : focus)
3104        dst.focus.add(i.copy());
3105    }
3106    ;
3107    if (condition != null) {
3108      dst.condition = new ArrayList<CodeableConcept>();
3109      for (CodeableConcept i : condition)
3110        dst.condition.add(i.copy());
3111    }
3112    ;
3113    if (contact != null) {
3114      dst.contact = new ArrayList<ContactDetail>();
3115      for (ContactDetail i : contact)
3116        dst.contact.add(i.copy());
3117    }
3118    ;
3119    if (relatedArtifact != null) {
3120      dst.relatedArtifact = new ArrayList<RelatedArtifact>();
3121      for (RelatedArtifact i : relatedArtifact)
3122        dst.relatedArtifact.add(i.copy());
3123    }
3124    ;
3125    if (keyword != null) {
3126      dst.keyword = new ArrayList<CodeableConcept>();
3127      for (CodeableConcept i : keyword)
3128        dst.keyword.add(i.copy());
3129    }
3130    ;
3131    if (location != null) {
3132      dst.location = new ArrayList<CodeableConcept>();
3133      for (CodeableConcept i : location)
3134        dst.location.add(i.copy());
3135    }
3136    ;
3137    dst.description = description == null ? null : description.copy();
3138    if (enrollment != null) {
3139      dst.enrollment = new ArrayList<Reference>();
3140      for (Reference i : enrollment)
3141        dst.enrollment.add(i.copy());
3142    }
3143    ;
3144    dst.period = period == null ? null : period.copy();
3145    dst.sponsor = sponsor == null ? null : sponsor.copy();
3146    dst.principalInvestigator = principalInvestigator == null ? null : principalInvestigator.copy();
3147    if (site != null) {
3148      dst.site = new ArrayList<Reference>();
3149      for (Reference i : site)
3150        dst.site.add(i.copy());
3151    }
3152    ;
3153    dst.reasonStopped = reasonStopped == null ? null : reasonStopped.copy();
3154    if (note != null) {
3155      dst.note = new ArrayList<Annotation>();
3156      for (Annotation i : note)
3157        dst.note.add(i.copy());
3158    }
3159    ;
3160    if (arm != null) {
3161      dst.arm = new ArrayList<ResearchStudyArmComponent>();
3162      for (ResearchStudyArmComponent i : arm)
3163        dst.arm.add(i.copy());
3164    }
3165    ;
3166    if (objective != null) {
3167      dst.objective = new ArrayList<ResearchStudyObjectiveComponent>();
3168      for (ResearchStudyObjectiveComponent i : objective)
3169        dst.objective.add(i.copy());
3170    }
3171    ;
3172  }
3173
3174  protected ResearchStudy typedCopy() {
3175    return copy();
3176  }
3177
3178  @Override
3179  public boolean equalsDeep(Base other_) {
3180    if (!super.equalsDeep(other_))
3181      return false;
3182    if (!(other_ instanceof ResearchStudy))
3183      return false;
3184    ResearchStudy o = (ResearchStudy) other_;
3185    return compareDeep(identifier, o.identifier, true) && compareDeep(title, o.title, true)
3186        && compareDeep(protocol, o.protocol, true) && compareDeep(partOf, o.partOf, true)
3187        && compareDeep(status, o.status, true) && compareDeep(primaryPurposeType, o.primaryPurposeType, true)
3188        && compareDeep(phase, o.phase, true) && compareDeep(category, o.category, true)
3189        && compareDeep(focus, o.focus, true) && compareDeep(condition, o.condition, true)
3190        && compareDeep(contact, o.contact, true) && compareDeep(relatedArtifact, o.relatedArtifact, true)
3191        && compareDeep(keyword, o.keyword, true) && compareDeep(location, o.location, true)
3192        && compareDeep(description, o.description, true) && compareDeep(enrollment, o.enrollment, true)
3193        && compareDeep(period, o.period, true) && compareDeep(sponsor, o.sponsor, true)
3194        && compareDeep(principalInvestigator, o.principalInvestigator, true) && compareDeep(site, o.site, true)
3195        && compareDeep(reasonStopped, o.reasonStopped, true) && compareDeep(note, o.note, true)
3196        && compareDeep(arm, o.arm, true) && compareDeep(objective, o.objective, true);
3197  }
3198
3199  @Override
3200  public boolean equalsShallow(Base other_) {
3201    if (!super.equalsShallow(other_))
3202      return false;
3203    if (!(other_ instanceof ResearchStudy))
3204      return false;
3205    ResearchStudy o = (ResearchStudy) other_;
3206    return compareValues(title, o.title, true) && compareValues(status, o.status, true)
3207        && compareValues(description, o.description, true);
3208  }
3209
3210  public boolean isEmpty() {
3211    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, title, protocol, partOf, status,
3212        primaryPurposeType, phase, category, focus, condition, contact, relatedArtifact, keyword, location, description,
3213        enrollment, period, sponsor, principalInvestigator, site, reasonStopped, note, arm, objective);
3214  }
3215
3216  @Override
3217  public ResourceType getResourceType() {
3218    return ResourceType.ResearchStudy;
3219  }
3220
3221  /**
3222   * Search parameter: <b>date</b>
3223   * <p>
3224   * Description: <b>When the study began and ended</b><br>
3225   * Type: <b>date</b><br>
3226   * Path: <b>ResearchStudy.period</b><br>
3227   * </p>
3228   */
3229  @SearchParamDefinition(name = "date", path = "ResearchStudy.period", description = "When the study began and ended", type = "date")
3230  public static final String SP_DATE = "date";
3231  /**
3232   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3233   * <p>
3234   * Description: <b>When the study began and ended</b><br>
3235   * Type: <b>date</b><br>
3236   * Path: <b>ResearchStudy.period</b><br>
3237   * </p>
3238   */
3239  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3240      SP_DATE);
3241
3242  /**
3243   * Search parameter: <b>identifier</b>
3244   * <p>
3245   * Description: <b>Business Identifier for study</b><br>
3246   * Type: <b>token</b><br>
3247   * Path: <b>ResearchStudy.identifier</b><br>
3248   * </p>
3249   */
3250  @SearchParamDefinition(name = "identifier", path = "ResearchStudy.identifier", description = "Business Identifier for study", type = "token")
3251  public static final String SP_IDENTIFIER = "identifier";
3252  /**
3253   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3254   * <p>
3255   * Description: <b>Business Identifier for study</b><br>
3256   * Type: <b>token</b><br>
3257   * Path: <b>ResearchStudy.identifier</b><br>
3258   * </p>
3259   */
3260  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3261      SP_IDENTIFIER);
3262
3263  /**
3264   * Search parameter: <b>partof</b>
3265   * <p>
3266   * Description: <b>Part of larger study</b><br>
3267   * Type: <b>reference</b><br>
3268   * Path: <b>ResearchStudy.partOf</b><br>
3269   * </p>
3270   */
3271  @SearchParamDefinition(name = "partof", path = "ResearchStudy.partOf", description = "Part of larger study", type = "reference", target = {
3272      ResearchStudy.class })
3273  public static final String SP_PARTOF = "partof";
3274  /**
3275   * <b>Fluent Client</b> search parameter constant for <b>partof</b>
3276   * <p>
3277   * Description: <b>Part of larger study</b><br>
3278   * Type: <b>reference</b><br>
3279   * Path: <b>ResearchStudy.partOf</b><br>
3280   * </p>
3281   */
3282  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTOF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3283      SP_PARTOF);
3284
3285  /**
3286   * Constant for fluent queries to be used to add include statements. Specifies
3287   * the path value of "<b>ResearchStudy:partof</b>".
3288   */
3289  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTOF = new ca.uhn.fhir.model.api.Include(
3290      "ResearchStudy:partof").toLocked();
3291
3292  /**
3293   * Search parameter: <b>sponsor</b>
3294   * <p>
3295   * Description: <b>Organization that initiates and is legally responsible for
3296   * the study</b><br>
3297   * Type: <b>reference</b><br>
3298   * Path: <b>ResearchStudy.sponsor</b><br>
3299   * </p>
3300   */
3301  @SearchParamDefinition(name = "sponsor", path = "ResearchStudy.sponsor", description = "Organization that initiates and is legally responsible for the study", type = "reference", target = {
3302      Organization.class })
3303  public static final String SP_SPONSOR = "sponsor";
3304  /**
3305   * <b>Fluent Client</b> search parameter constant for <b>sponsor</b>
3306   * <p>
3307   * Description: <b>Organization that initiates and is legally responsible for
3308   * the study</b><br>
3309   * Type: <b>reference</b><br>
3310   * Path: <b>ResearchStudy.sponsor</b><br>
3311   * </p>
3312   */
3313  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPONSOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3314      SP_SPONSOR);
3315
3316  /**
3317   * Constant for fluent queries to be used to add include statements. Specifies
3318   * the path value of "<b>ResearchStudy:sponsor</b>".
3319   */
3320  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPONSOR = new ca.uhn.fhir.model.api.Include(
3321      "ResearchStudy:sponsor").toLocked();
3322
3323  /**
3324   * Search parameter: <b>focus</b>
3325   * <p>
3326   * Description: <b>Drugs, devices, etc. under study</b><br>
3327   * Type: <b>token</b><br>
3328   * Path: <b>ResearchStudy.focus</b><br>
3329   * </p>
3330   */
3331  @SearchParamDefinition(name = "focus", path = "ResearchStudy.focus", description = "Drugs, devices, etc. under study", type = "token")
3332  public static final String SP_FOCUS = "focus";
3333  /**
3334   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
3335   * <p>
3336   * Description: <b>Drugs, devices, etc. under study</b><br>
3337   * Type: <b>token</b><br>
3338   * Path: <b>ResearchStudy.focus</b><br>
3339   * </p>
3340   */
3341  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FOCUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3342      SP_FOCUS);
3343
3344  /**
3345   * Search parameter: <b>principalinvestigator</b>
3346   * <p>
3347   * Description: <b>Researcher who oversees multiple aspects of the study</b><br>
3348   * Type: <b>reference</b><br>
3349   * Path: <b>ResearchStudy.principalInvestigator</b><br>
3350   * </p>
3351   */
3352  @SearchParamDefinition(name = "principalinvestigator", path = "ResearchStudy.principalInvestigator", description = "Researcher who oversees multiple aspects of the study", type = "reference", providesMembershipIn = {
3353      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
3354          PractitionerRole.class })
3355  public static final String SP_PRINCIPALINVESTIGATOR = "principalinvestigator";
3356  /**
3357   * <b>Fluent Client</b> search parameter constant for
3358   * <b>principalinvestigator</b>
3359   * <p>
3360   * Description: <b>Researcher who oversees multiple aspects of the study</b><br>
3361   * Type: <b>reference</b><br>
3362   * Path: <b>ResearchStudy.principalInvestigator</b><br>
3363   * </p>
3364   */
3365  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRINCIPALINVESTIGATOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3366      SP_PRINCIPALINVESTIGATOR);
3367
3368  /**
3369   * Constant for fluent queries to be used to add include statements. Specifies
3370   * the path value of "<b>ResearchStudy:principalinvestigator</b>".
3371   */
3372  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRINCIPALINVESTIGATOR = new ca.uhn.fhir.model.api.Include(
3373      "ResearchStudy:principalinvestigator").toLocked();
3374
3375  /**
3376   * Search parameter: <b>title</b>
3377   * <p>
3378   * Description: <b>Name for this study</b><br>
3379   * Type: <b>string</b><br>
3380   * Path: <b>ResearchStudy.title</b><br>
3381   * </p>
3382   */
3383  @SearchParamDefinition(name = "title", path = "ResearchStudy.title", description = "Name for this study", type = "string")
3384  public static final String SP_TITLE = "title";
3385  /**
3386   * <b>Fluent Client</b> search parameter constant for <b>title</b>
3387   * <p>
3388   * Description: <b>Name for this study</b><br>
3389   * Type: <b>string</b><br>
3390   * Path: <b>ResearchStudy.title</b><br>
3391   * </p>
3392   */
3393  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(
3394      SP_TITLE);
3395
3396  /**
3397   * Search parameter: <b>protocol</b>
3398   * <p>
3399   * Description: <b>Steps followed in executing study</b><br>
3400   * Type: <b>reference</b><br>
3401   * Path: <b>ResearchStudy.protocol</b><br>
3402   * </p>
3403   */
3404  @SearchParamDefinition(name = "protocol", path = "ResearchStudy.protocol", description = "Steps followed in executing study", type = "reference", target = {
3405      PlanDefinition.class })
3406  public static final String SP_PROTOCOL = "protocol";
3407  /**
3408   * <b>Fluent Client</b> search parameter constant for <b>protocol</b>
3409   * <p>
3410   * Description: <b>Steps followed in executing study</b><br>
3411   * Type: <b>reference</b><br>
3412   * Path: <b>ResearchStudy.protocol</b><br>
3413   * </p>
3414   */
3415  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROTOCOL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3416      SP_PROTOCOL);
3417
3418  /**
3419   * Constant for fluent queries to be used to add include statements. Specifies
3420   * the path value of "<b>ResearchStudy:protocol</b>".
3421   */
3422  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROTOCOL = new ca.uhn.fhir.model.api.Include(
3423      "ResearchStudy:protocol").toLocked();
3424
3425  /**
3426   * Search parameter: <b>site</b>
3427   * <p>
3428   * Description: <b>Facility where study activities are conducted</b><br>
3429   * Type: <b>reference</b><br>
3430   * Path: <b>ResearchStudy.site</b><br>
3431   * </p>
3432   */
3433  @SearchParamDefinition(name = "site", path = "ResearchStudy.site", description = "Facility where study activities are conducted", type = "reference", target = {
3434      Location.class })
3435  public static final String SP_SITE = "site";
3436  /**
3437   * <b>Fluent Client</b> search parameter constant for <b>site</b>
3438   * <p>
3439   * Description: <b>Facility where study activities are conducted</b><br>
3440   * Type: <b>reference</b><br>
3441   * Path: <b>ResearchStudy.site</b><br>
3442   * </p>
3443   */
3444  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SITE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3445      SP_SITE);
3446
3447  /**
3448   * Constant for fluent queries to be used to add include statements. Specifies
3449   * the path value of "<b>ResearchStudy:site</b>".
3450   */
3451  public static final ca.uhn.fhir.model.api.Include INCLUDE_SITE = new ca.uhn.fhir.model.api.Include(
3452      "ResearchStudy:site").toLocked();
3453
3454  /**
3455   * Search parameter: <b>location</b>
3456   * <p>
3457   * Description: <b>Geographic region(s) for study</b><br>
3458   * Type: <b>token</b><br>
3459   * Path: <b>ResearchStudy.location</b><br>
3460   * </p>
3461   */
3462  @SearchParamDefinition(name = "location", path = "ResearchStudy.location", description = "Geographic region(s) for study", type = "token")
3463  public static final String SP_LOCATION = "location";
3464  /**
3465   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3466   * <p>
3467   * Description: <b>Geographic region(s) for study</b><br>
3468   * Type: <b>token</b><br>
3469   * Path: <b>ResearchStudy.location</b><br>
3470   * </p>
3471   */
3472  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOCATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3473      SP_LOCATION);
3474
3475  /**
3476   * Search parameter: <b>category</b>
3477   * <p>
3478   * Description: <b>Classifications for the study</b><br>
3479   * Type: <b>token</b><br>
3480   * Path: <b>ResearchStudy.category</b><br>
3481   * </p>
3482   */
3483  @SearchParamDefinition(name = "category", path = "ResearchStudy.category", description = "Classifications for the study", type = "token")
3484  public static final String SP_CATEGORY = "category";
3485  /**
3486   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3487   * <p>
3488   * Description: <b>Classifications for the study</b><br>
3489   * Type: <b>token</b><br>
3490   * Path: <b>ResearchStudy.category</b><br>
3491   * </p>
3492   */
3493  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3494      SP_CATEGORY);
3495
3496  /**
3497   * Search parameter: <b>keyword</b>
3498   * <p>
3499   * Description: <b>Used to search for the study</b><br>
3500   * Type: <b>token</b><br>
3501   * Path: <b>ResearchStudy.keyword</b><br>
3502   * </p>
3503   */
3504  @SearchParamDefinition(name = "keyword", path = "ResearchStudy.keyword", description = "Used to search for the study", type = "token")
3505  public static final String SP_KEYWORD = "keyword";
3506  /**
3507   * <b>Fluent Client</b> search parameter constant for <b>keyword</b>
3508   * <p>
3509   * Description: <b>Used to search for the study</b><br>
3510   * Type: <b>token</b><br>
3511   * Path: <b>ResearchStudy.keyword</b><br>
3512   * </p>
3513   */
3514  public static final ca.uhn.fhir.rest.gclient.TokenClientParam KEYWORD = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3515      SP_KEYWORD);
3516
3517  /**
3518   * Search parameter: <b>status</b>
3519   * <p>
3520   * Description: <b>active | administratively-completed | approved |
3521   * closed-to-accrual | closed-to-accrual-and-intervention | completed |
3522   * disapproved | in-review | temporarily-closed-to-accrual |
3523   * temporarily-closed-to-accrual-and-intervention | withdrawn</b><br>
3524   * Type: <b>token</b><br>
3525   * Path: <b>ResearchStudy.status</b><br>
3526   * </p>
3527   */
3528  @SearchParamDefinition(name = "status", path = "ResearchStudy.status", description = "active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn", type = "token")
3529  public static final String SP_STATUS = "status";
3530  /**
3531   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3532   * <p>
3533   * Description: <b>active | administratively-completed | approved |
3534   * closed-to-accrual | closed-to-accrual-and-intervention | completed |
3535   * disapproved | in-review | temporarily-closed-to-accrual |
3536   * temporarily-closed-to-accrual-and-intervention | withdrawn</b><br>
3537   * Type: <b>token</b><br>
3538   * Path: <b>ResearchStudy.status</b><br>
3539   * </p>
3540   */
3541  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3542      SP_STATUS);
3543
3544}