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