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