001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.
052 */
053@ResourceDef(name="ResearchStudy", profile="http://hl7.org/fhir/StructureDefinition/ResearchStudy")
054public class ResearchStudy extends DomainResource {
055
056    @Block()
057    public static class ResearchStudyLabelComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Kind of name.
060         */
061        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
062        @Description(shortDefinition="short | public | scientific", formalDefinition="Kind of name." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-title-type")
064        protected CodeableConcept type;
065
066        /**
067         * The name.
068         */
069        @Child(name = "value", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="The name", formalDefinition="The name." )
071        protected StringType value;
072
073        private static final long serialVersionUID = 944223389L;
074
075    /**
076     * Constructor
077     */
078      public ResearchStudyLabelComponent() {
079        super();
080      }
081
082        /**
083         * @return {@link #type} (Kind of name.)
084         */
085        public CodeableConcept getType() { 
086          if (this.type == null)
087            if (Configuration.errorOnAutoCreate())
088              throw new Error("Attempt to auto-create ResearchStudyLabelComponent.type");
089            else if (Configuration.doAutoCreate())
090              this.type = new CodeableConcept(); // cc
091          return this.type;
092        }
093
094        public boolean hasType() { 
095          return this.type != null && !this.type.isEmpty();
096        }
097
098        /**
099         * @param value {@link #type} (Kind of name.)
100         */
101        public ResearchStudyLabelComponent setType(CodeableConcept value) { 
102          this.type = value;
103          return this;
104        }
105
106        /**
107         * @return {@link #value} (The name.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
108         */
109        public StringType getValueElement() { 
110          if (this.value == null)
111            if (Configuration.errorOnAutoCreate())
112              throw new Error("Attempt to auto-create ResearchStudyLabelComponent.value");
113            else if (Configuration.doAutoCreate())
114              this.value = new StringType(); // bb
115          return this.value;
116        }
117
118        public boolean hasValueElement() { 
119          return this.value != null && !this.value.isEmpty();
120        }
121
122        public boolean hasValue() { 
123          return this.value != null && !this.value.isEmpty();
124        }
125
126        /**
127         * @param value {@link #value} (The name.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
128         */
129        public ResearchStudyLabelComponent setValueElement(StringType value) { 
130          this.value = value;
131          return this;
132        }
133
134        /**
135         * @return The name.
136         */
137        public String getValue() { 
138          return this.value == null ? null : this.value.getValue();
139        }
140
141        /**
142         * @param value The name.
143         */
144        public ResearchStudyLabelComponent setValue(String value) { 
145          if (Utilities.noString(value))
146            this.value = null;
147          else {
148            if (this.value == null)
149              this.value = new StringType();
150            this.value.setValue(value);
151          }
152          return this;
153        }
154
155        protected void listChildren(List<Property> children) {
156          super.listChildren(children);
157          children.add(new Property("type", "CodeableConcept", "Kind of name.", 0, 1, type));
158          children.add(new Property("value", "string", "The name.", 0, 1, value));
159        }
160
161        @Override
162        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
163          switch (_hash) {
164          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Kind of name.", 0, 1, type);
165          case 111972721: /*value*/  return new Property("value", "string", "The name.", 0, 1, value);
166          default: return super.getNamedProperty(_hash, _name, _checkValid);
167          }
168
169        }
170
171      @Override
172      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
173        switch (hash) {
174        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
175        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
176        default: return super.getProperty(hash, name, checkValid);
177        }
178
179      }
180
181      @Override
182      public Base setProperty(int hash, String name, Base value) throws FHIRException {
183        switch (hash) {
184        case 3575610: // type
185          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
186          return value;
187        case 111972721: // value
188          this.value = TypeConvertor.castToString(value); // StringType
189          return value;
190        default: return super.setProperty(hash, name, value);
191        }
192
193      }
194
195      @Override
196      public Base setProperty(String name, Base value) throws FHIRException {
197        if (name.equals("type")) {
198          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
199        } else if (name.equals("value")) {
200          this.value = TypeConvertor.castToString(value); // StringType
201        } else
202          return super.setProperty(name, value);
203        return value;
204      }
205
206      @Override
207      public Base makeProperty(int hash, String name) throws FHIRException {
208        switch (hash) {
209        case 3575610:  return getType();
210        case 111972721:  return getValueElement();
211        default: return super.makeProperty(hash, name);
212        }
213
214      }
215
216      @Override
217      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
218        switch (hash) {
219        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
220        case 111972721: /*value*/ return new String[] {"string"};
221        default: return super.getTypesForProperty(hash, name);
222        }
223
224      }
225
226      @Override
227      public Base addChild(String name) throws FHIRException {
228        if (name.equals("type")) {
229          this.type = new CodeableConcept();
230          return this.type;
231        }
232        else if (name.equals("value")) {
233          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.label.value");
234        }
235        else
236          return super.addChild(name);
237      }
238
239      public ResearchStudyLabelComponent copy() {
240        ResearchStudyLabelComponent dst = new ResearchStudyLabelComponent();
241        copyValues(dst);
242        return dst;
243      }
244
245      public void copyValues(ResearchStudyLabelComponent dst) {
246        super.copyValues(dst);
247        dst.type = type == null ? null : type.copy();
248        dst.value = value == null ? null : value.copy();
249      }
250
251      @Override
252      public boolean equalsDeep(Base other_) {
253        if (!super.equalsDeep(other_))
254          return false;
255        if (!(other_ instanceof ResearchStudyLabelComponent))
256          return false;
257        ResearchStudyLabelComponent o = (ResearchStudyLabelComponent) other_;
258        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
259      }
260
261      @Override
262      public boolean equalsShallow(Base other_) {
263        if (!super.equalsShallow(other_))
264          return false;
265        if (!(other_ instanceof ResearchStudyLabelComponent))
266          return false;
267        ResearchStudyLabelComponent o = (ResearchStudyLabelComponent) other_;
268        return compareValues(value, o.value, true);
269      }
270
271      public boolean isEmpty() {
272        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
273      }
274
275  public String fhirType() {
276    return "ResearchStudy.label";
277
278  }
279
280  }
281
282    @Block()
283    public static class ResearchStudyFocusComponent extends BackboneElement implements IBaseBackboneElement {
284        /**
285         * Identification of product under study.  This may be any combination of code and/or name.
286         */
287        @Child(name = "productCode", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
288        @Description(shortDefinition="Identification of product under study", formalDefinition="Identification of product under study.  This may be any combination of code and/or name." )
289        protected CodeableConcept productCode;
290
291        /**
292         * Indicates whether the focus is a medication, a device, a procedure, a specific factor or some other intervention or characteristic.
293         */
294        @Child(name = "focusType", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
295        @Description(shortDefinition="medication | device | intervention | factor", formalDefinition="Indicates whether the focus is a medication, a device, a procedure, a specific factor or some other intervention or characteristic." )
296        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-focus-type")
297        protected List<CodeableConcept> focusType;
298
299        /**
300         * A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.
301         */
302        @Child(name = "factor", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
303        @Description(shortDefinition="An independent variable manipulated by the experimentalist", formalDefinition="A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay." )
304        protected MarkdownType factor;
305
306        private static final long serialVersionUID = 1526347182L;
307
308    /**
309     * Constructor
310     */
311      public ResearchStudyFocusComponent() {
312        super();
313      }
314
315        /**
316         * @return {@link #productCode} (Identification of product under study.  This may be any combination of code and/or name.)
317         */
318        public CodeableConcept getProductCode() { 
319          if (this.productCode == null)
320            if (Configuration.errorOnAutoCreate())
321              throw new Error("Attempt to auto-create ResearchStudyFocusComponent.productCode");
322            else if (Configuration.doAutoCreate())
323              this.productCode = new CodeableConcept(); // cc
324          return this.productCode;
325        }
326
327        public boolean hasProductCode() { 
328          return this.productCode != null && !this.productCode.isEmpty();
329        }
330
331        /**
332         * @param value {@link #productCode} (Identification of product under study.  This may be any combination of code and/or name.)
333         */
334        public ResearchStudyFocusComponent setProductCode(CodeableConcept value) { 
335          this.productCode = value;
336          return this;
337        }
338
339        /**
340         * @return {@link #focusType} (Indicates whether the focus is a medication, a device, a procedure, a specific factor or some other intervention or characteristic.)
341         */
342        public List<CodeableConcept> getFocusType() { 
343          if (this.focusType == null)
344            this.focusType = new ArrayList<CodeableConcept>();
345          return this.focusType;
346        }
347
348        /**
349         * @return Returns a reference to <code>this</code> for easy method chaining
350         */
351        public ResearchStudyFocusComponent setFocusType(List<CodeableConcept> theFocusType) { 
352          this.focusType = theFocusType;
353          return this;
354        }
355
356        public boolean hasFocusType() { 
357          if (this.focusType == null)
358            return false;
359          for (CodeableConcept item : this.focusType)
360            if (!item.isEmpty())
361              return true;
362          return false;
363        }
364
365        public CodeableConcept addFocusType() { //3
366          CodeableConcept t = new CodeableConcept();
367          if (this.focusType == null)
368            this.focusType = new ArrayList<CodeableConcept>();
369          this.focusType.add(t);
370          return t;
371        }
372
373        public ResearchStudyFocusComponent addFocusType(CodeableConcept t) { //3
374          if (t == null)
375            return this;
376          if (this.focusType == null)
377            this.focusType = new ArrayList<CodeableConcept>();
378          this.focusType.add(t);
379          return this;
380        }
381
382        /**
383         * @return The first repetition of repeating field {@link #focusType}, creating it if it does not already exist {3}
384         */
385        public CodeableConcept getFocusTypeFirstRep() { 
386          if (getFocusType().isEmpty()) {
387            addFocusType();
388          }
389          return getFocusType().get(0);
390        }
391
392        /**
393         * @return {@link #factor} (A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
394         */
395        public MarkdownType getFactorElement() { 
396          if (this.factor == null)
397            if (Configuration.errorOnAutoCreate())
398              throw new Error("Attempt to auto-create ResearchStudyFocusComponent.factor");
399            else if (Configuration.doAutoCreate())
400              this.factor = new MarkdownType(); // bb
401          return this.factor;
402        }
403
404        public boolean hasFactorElement() { 
405          return this.factor != null && !this.factor.isEmpty();
406        }
407
408        public boolean hasFactor() { 
409          return this.factor != null && !this.factor.isEmpty();
410        }
411
412        /**
413         * @param value {@link #factor} (A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
414         */
415        public ResearchStudyFocusComponent setFactorElement(MarkdownType value) { 
416          this.factor = value;
417          return this;
418        }
419
420        /**
421         * @return A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.
422         */
423        public String getFactor() { 
424          return this.factor == null ? null : this.factor.getValue();
425        }
426
427        /**
428         * @param value A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.
429         */
430        public ResearchStudyFocusComponent setFactor(String value) { 
431          if (value == null)
432            this.factor = null;
433          else {
434            if (this.factor == null)
435              this.factor = new MarkdownType();
436            this.factor.setValue(value);
437          }
438          return this;
439        }
440
441        protected void listChildren(List<Property> children) {
442          super.listChildren(children);
443          children.add(new Property("productCode", "CodeableConcept", "Identification of product under study.  This may be any combination of code and/or name.", 0, 1, productCode));
444          children.add(new Property("focusType", "CodeableConcept", "Indicates whether the focus is a medication, a device, a procedure, a specific factor or some other intervention or characteristic.", 0, java.lang.Integer.MAX_VALUE, focusType));
445          children.add(new Property("factor", "markdown", "A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.", 0, 1, factor));
446        }
447
448        @Override
449        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
450          switch (_hash) {
451          case -1492131972: /*productCode*/  return new Property("productCode", "CodeableConcept", "Identification of product under study.  This may be any combination of code and/or name.", 0, 1, productCode);
452          case 1628646450: /*focusType*/  return new Property("focusType", "CodeableConcept", "Indicates whether the focus is a medication, a device, a procedure, a specific factor or some other intervention or characteristic.", 0, java.lang.Integer.MAX_VALUE, focusType);
453          case -1282148017: /*factor*/  return new Property("factor", "markdown", "A factor corresponds to an independent variable manipulated by the experimentalist with the intention to affect biological systems in a way that can be measured by an assay.", 0, 1, factor);
454          default: return super.getNamedProperty(_hash, _name, _checkValid);
455          }
456
457        }
458
459      @Override
460      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
461        switch (hash) {
462        case -1492131972: /*productCode*/ return this.productCode == null ? new Base[0] : new Base[] {this.productCode}; // CodeableConcept
463        case 1628646450: /*focusType*/ return this.focusType == null ? new Base[0] : this.focusType.toArray(new Base[this.focusType.size()]); // CodeableConcept
464        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // MarkdownType
465        default: return super.getProperty(hash, name, checkValid);
466        }
467
468      }
469
470      @Override
471      public Base setProperty(int hash, String name, Base value) throws FHIRException {
472        switch (hash) {
473        case -1492131972: // productCode
474          this.productCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
475          return value;
476        case 1628646450: // focusType
477          this.getFocusType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
478          return value;
479        case -1282148017: // factor
480          this.factor = TypeConvertor.castToMarkdown(value); // MarkdownType
481          return value;
482        default: return super.setProperty(hash, name, value);
483        }
484
485      }
486
487      @Override
488      public Base setProperty(String name, Base value) throws FHIRException {
489        if (name.equals("productCode")) {
490          this.productCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
491        } else if (name.equals("focusType")) {
492          this.getFocusType().add(TypeConvertor.castToCodeableConcept(value));
493        } else if (name.equals("factor")) {
494          this.factor = TypeConvertor.castToMarkdown(value); // MarkdownType
495        } else
496          return super.setProperty(name, value);
497        return value;
498      }
499
500      @Override
501      public Base makeProperty(int hash, String name) throws FHIRException {
502        switch (hash) {
503        case -1492131972:  return getProductCode();
504        case 1628646450:  return addFocusType(); 
505        case -1282148017:  return getFactorElement();
506        default: return super.makeProperty(hash, name);
507        }
508
509      }
510
511      @Override
512      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
513        switch (hash) {
514        case -1492131972: /*productCode*/ return new String[] {"CodeableConcept"};
515        case 1628646450: /*focusType*/ return new String[] {"CodeableConcept"};
516        case -1282148017: /*factor*/ return new String[] {"markdown"};
517        default: return super.getTypesForProperty(hash, name);
518        }
519
520      }
521
522      @Override
523      public Base addChild(String name) throws FHIRException {
524        if (name.equals("productCode")) {
525          this.productCode = new CodeableConcept();
526          return this.productCode;
527        }
528        else if (name.equals("focusType")) {
529          return addFocusType();
530        }
531        else if (name.equals("factor")) {
532          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.focus.factor");
533        }
534        else
535          return super.addChild(name);
536      }
537
538      public ResearchStudyFocusComponent copy() {
539        ResearchStudyFocusComponent dst = new ResearchStudyFocusComponent();
540        copyValues(dst);
541        return dst;
542      }
543
544      public void copyValues(ResearchStudyFocusComponent dst) {
545        super.copyValues(dst);
546        dst.productCode = productCode == null ? null : productCode.copy();
547        if (focusType != null) {
548          dst.focusType = new ArrayList<CodeableConcept>();
549          for (CodeableConcept i : focusType)
550            dst.focusType.add(i.copy());
551        };
552        dst.factor = factor == null ? null : factor.copy();
553      }
554
555      @Override
556      public boolean equalsDeep(Base other_) {
557        if (!super.equalsDeep(other_))
558          return false;
559        if (!(other_ instanceof ResearchStudyFocusComponent))
560          return false;
561        ResearchStudyFocusComponent o = (ResearchStudyFocusComponent) other_;
562        return compareDeep(productCode, o.productCode, true) && compareDeep(focusType, o.focusType, true)
563           && compareDeep(factor, o.factor, true);
564      }
565
566      @Override
567      public boolean equalsShallow(Base other_) {
568        if (!super.equalsShallow(other_))
569          return false;
570        if (!(other_ instanceof ResearchStudyFocusComponent))
571          return false;
572        ResearchStudyFocusComponent o = (ResearchStudyFocusComponent) other_;
573        return compareValues(factor, o.factor, true);
574      }
575
576      public boolean isEmpty() {
577        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productCode, focusType, factor
578          );
579      }
580
581  public String fhirType() {
582    return "ResearchStudy.focus";
583
584  }
585
586  }
587
588    @Block()
589    public static class ResearchStudyClassificationComponent extends BackboneElement implements IBaseBackboneElement {
590        /**
591         * Type of classifier.
592         */
593        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
594        @Description(shortDefinition="phase | category | keyword ", formalDefinition="Type of classifier." )
595        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-classification-type")
596        protected CodeableConcept type;
597
598        /**
599         * Value of classifier.
600         */
601        @Child(name = "classifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
602        @Description(shortDefinition="n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4", formalDefinition="Value of classifier." )
603        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-classification-classifier")
604        protected List<CodeableConcept> classifier;
605
606        private static final long serialVersionUID = -283121869L;
607
608    /**
609     * Constructor
610     */
611      public ResearchStudyClassificationComponent() {
612        super();
613      }
614
615        /**
616         * @return {@link #type} (Type of classifier.)
617         */
618        public CodeableConcept getType() { 
619          if (this.type == null)
620            if (Configuration.errorOnAutoCreate())
621              throw new Error("Attempt to auto-create ResearchStudyClassificationComponent.type");
622            else if (Configuration.doAutoCreate())
623              this.type = new CodeableConcept(); // cc
624          return this.type;
625        }
626
627        public boolean hasType() { 
628          return this.type != null && !this.type.isEmpty();
629        }
630
631        /**
632         * @param value {@link #type} (Type of classifier.)
633         */
634        public ResearchStudyClassificationComponent setType(CodeableConcept value) { 
635          this.type = value;
636          return this;
637        }
638
639        /**
640         * @return {@link #classifier} (Value of classifier.)
641         */
642        public List<CodeableConcept> getClassifier() { 
643          if (this.classifier == null)
644            this.classifier = new ArrayList<CodeableConcept>();
645          return this.classifier;
646        }
647
648        /**
649         * @return Returns a reference to <code>this</code> for easy method chaining
650         */
651        public ResearchStudyClassificationComponent setClassifier(List<CodeableConcept> theClassifier) { 
652          this.classifier = theClassifier;
653          return this;
654        }
655
656        public boolean hasClassifier() { 
657          if (this.classifier == null)
658            return false;
659          for (CodeableConcept item : this.classifier)
660            if (!item.isEmpty())
661              return true;
662          return false;
663        }
664
665        public CodeableConcept addClassifier() { //3
666          CodeableConcept t = new CodeableConcept();
667          if (this.classifier == null)
668            this.classifier = new ArrayList<CodeableConcept>();
669          this.classifier.add(t);
670          return t;
671        }
672
673        public ResearchStudyClassificationComponent addClassifier(CodeableConcept t) { //3
674          if (t == null)
675            return this;
676          if (this.classifier == null)
677            this.classifier = new ArrayList<CodeableConcept>();
678          this.classifier.add(t);
679          return this;
680        }
681
682        /**
683         * @return The first repetition of repeating field {@link #classifier}, creating it if it does not already exist {3}
684         */
685        public CodeableConcept getClassifierFirstRep() { 
686          if (getClassifier().isEmpty()) {
687            addClassifier();
688          }
689          return getClassifier().get(0);
690        }
691
692        protected void listChildren(List<Property> children) {
693          super.listChildren(children);
694          children.add(new Property("type", "CodeableConcept", "Type of classifier.", 0, 1, type));
695          children.add(new Property("classifier", "CodeableConcept", "Value of classifier.", 0, java.lang.Integer.MAX_VALUE, classifier));
696        }
697
698        @Override
699        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
700          switch (_hash) {
701          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of classifier.", 0, 1, type);
702          case -281470431: /*classifier*/  return new Property("classifier", "CodeableConcept", "Value of classifier.", 0, java.lang.Integer.MAX_VALUE, classifier);
703          default: return super.getNamedProperty(_hash, _name, _checkValid);
704          }
705
706        }
707
708      @Override
709      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
710        switch (hash) {
711        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
712        case -281470431: /*classifier*/ return this.classifier == null ? new Base[0] : this.classifier.toArray(new Base[this.classifier.size()]); // CodeableConcept
713        default: return super.getProperty(hash, name, checkValid);
714        }
715
716      }
717
718      @Override
719      public Base setProperty(int hash, String name, Base value) throws FHIRException {
720        switch (hash) {
721        case 3575610: // type
722          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
723          return value;
724        case -281470431: // classifier
725          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
726          return value;
727        default: return super.setProperty(hash, name, value);
728        }
729
730      }
731
732      @Override
733      public Base setProperty(String name, Base value) throws FHIRException {
734        if (name.equals("type")) {
735          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
736        } else if (name.equals("classifier")) {
737          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value));
738        } else
739          return super.setProperty(name, value);
740        return value;
741      }
742
743      @Override
744      public Base makeProperty(int hash, String name) throws FHIRException {
745        switch (hash) {
746        case 3575610:  return getType();
747        case -281470431:  return addClassifier(); 
748        default: return super.makeProperty(hash, name);
749        }
750
751      }
752
753      @Override
754      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
755        switch (hash) {
756        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
757        case -281470431: /*classifier*/ return new String[] {"CodeableConcept"};
758        default: return super.getTypesForProperty(hash, name);
759        }
760
761      }
762
763      @Override
764      public Base addChild(String name) throws FHIRException {
765        if (name.equals("type")) {
766          this.type = new CodeableConcept();
767          return this.type;
768        }
769        else if (name.equals("classifier")) {
770          return addClassifier();
771        }
772        else
773          return super.addChild(name);
774      }
775
776      public ResearchStudyClassificationComponent copy() {
777        ResearchStudyClassificationComponent dst = new ResearchStudyClassificationComponent();
778        copyValues(dst);
779        return dst;
780      }
781
782      public void copyValues(ResearchStudyClassificationComponent dst) {
783        super.copyValues(dst);
784        dst.type = type == null ? null : type.copy();
785        if (classifier != null) {
786          dst.classifier = new ArrayList<CodeableConcept>();
787          for (CodeableConcept i : classifier)
788            dst.classifier.add(i.copy());
789        };
790      }
791
792      @Override
793      public boolean equalsDeep(Base other_) {
794        if (!super.equalsDeep(other_))
795          return false;
796        if (!(other_ instanceof ResearchStudyClassificationComponent))
797          return false;
798        ResearchStudyClassificationComponent o = (ResearchStudyClassificationComponent) other_;
799        return compareDeep(type, o.type, true) && compareDeep(classifier, o.classifier, true);
800      }
801
802      @Override
803      public boolean equalsShallow(Base other_) {
804        if (!super.equalsShallow(other_))
805          return false;
806        if (!(other_ instanceof ResearchStudyClassificationComponent))
807          return false;
808        ResearchStudyClassificationComponent o = (ResearchStudyClassificationComponent) other_;
809        return true;
810      }
811
812      public boolean isEmpty() {
813        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, classifier);
814      }
815
816  public String fhirType() {
817    return "ResearchStudy.classification";
818
819  }
820
821  }
822
823    @Block()
824    public static class ResearchStudyAssociatedPartyComponent extends BackboneElement implements IBaseBackboneElement {
825        /**
826         * Name of associated party.
827         */
828        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
829        @Description(shortDefinition="Name of associated party", formalDefinition="Name of associated party." )
830        protected StringType name;
831
832        /**
833         * Type of association.
834         */
835        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
836        @Description(shortDefinition="sponsor | sponsor-investigator | primary-investigator | collaborator | funding-source | recruitment-contact | sub-investigator | study-director | study-chair", formalDefinition="Type of association." )
837        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-party-type")
838        protected CodeableConcept role;
839
840        /**
841         * Organisational type of association.
842         */
843        @Child(name = "classifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
844        @Description(shortDefinition="nih | fda", formalDefinition="Organisational type of association." )
845        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-party-org-type")
846        protected List<CodeableConcept> classifier;
847
848        /**
849         * Individual or organization associated with study (use practitionerRole to specify their organisation).
850         */
851        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
852        @Description(shortDefinition="Individual or organization associated with study (use practitionerRole to specify their organisation)", formalDefinition="Individual or organization associated with study (use practitionerRole to specify their organisation)." )
853        protected Reference party;
854
855        private static final long serialVersionUID = 2116155954L;
856
857    /**
858     * Constructor
859     */
860      public ResearchStudyAssociatedPartyComponent() {
861        super();
862      }
863
864    /**
865     * Constructor
866     */
867      public ResearchStudyAssociatedPartyComponent(CodeableConcept role) {
868        super();
869        this.setRole(role);
870      }
871
872        /**
873         * @return {@link #name} (Name of associated party.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
874         */
875        public StringType getNameElement() { 
876          if (this.name == null)
877            if (Configuration.errorOnAutoCreate())
878              throw new Error("Attempt to auto-create ResearchStudyAssociatedPartyComponent.name");
879            else if (Configuration.doAutoCreate())
880              this.name = new StringType(); // bb
881          return this.name;
882        }
883
884        public boolean hasNameElement() { 
885          return this.name != null && !this.name.isEmpty();
886        }
887
888        public boolean hasName() { 
889          return this.name != null && !this.name.isEmpty();
890        }
891
892        /**
893         * @param value {@link #name} (Name of associated party.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
894         */
895        public ResearchStudyAssociatedPartyComponent setNameElement(StringType value) { 
896          this.name = value;
897          return this;
898        }
899
900        /**
901         * @return Name of associated party.
902         */
903        public String getName() { 
904          return this.name == null ? null : this.name.getValue();
905        }
906
907        /**
908         * @param value Name of associated party.
909         */
910        public ResearchStudyAssociatedPartyComponent setName(String value) { 
911          if (Utilities.noString(value))
912            this.name = null;
913          else {
914            if (this.name == null)
915              this.name = new StringType();
916            this.name.setValue(value);
917          }
918          return this;
919        }
920
921        /**
922         * @return {@link #role} (Type of association.)
923         */
924        public CodeableConcept getRole() { 
925          if (this.role == null)
926            if (Configuration.errorOnAutoCreate())
927              throw new Error("Attempt to auto-create ResearchStudyAssociatedPartyComponent.role");
928            else if (Configuration.doAutoCreate())
929              this.role = new CodeableConcept(); // cc
930          return this.role;
931        }
932
933        public boolean hasRole() { 
934          return this.role != null && !this.role.isEmpty();
935        }
936
937        /**
938         * @param value {@link #role} (Type of association.)
939         */
940        public ResearchStudyAssociatedPartyComponent setRole(CodeableConcept value) { 
941          this.role = value;
942          return this;
943        }
944
945        /**
946         * @return {@link #classifier} (Organisational type of association.)
947         */
948        public List<CodeableConcept> getClassifier() { 
949          if (this.classifier == null)
950            this.classifier = new ArrayList<CodeableConcept>();
951          return this.classifier;
952        }
953
954        /**
955         * @return Returns a reference to <code>this</code> for easy method chaining
956         */
957        public ResearchStudyAssociatedPartyComponent setClassifier(List<CodeableConcept> theClassifier) { 
958          this.classifier = theClassifier;
959          return this;
960        }
961
962        public boolean hasClassifier() { 
963          if (this.classifier == null)
964            return false;
965          for (CodeableConcept item : this.classifier)
966            if (!item.isEmpty())
967              return true;
968          return false;
969        }
970
971        public CodeableConcept addClassifier() { //3
972          CodeableConcept t = new CodeableConcept();
973          if (this.classifier == null)
974            this.classifier = new ArrayList<CodeableConcept>();
975          this.classifier.add(t);
976          return t;
977        }
978
979        public ResearchStudyAssociatedPartyComponent addClassifier(CodeableConcept t) { //3
980          if (t == null)
981            return this;
982          if (this.classifier == null)
983            this.classifier = new ArrayList<CodeableConcept>();
984          this.classifier.add(t);
985          return this;
986        }
987
988        /**
989         * @return The first repetition of repeating field {@link #classifier}, creating it if it does not already exist {3}
990         */
991        public CodeableConcept getClassifierFirstRep() { 
992          if (getClassifier().isEmpty()) {
993            addClassifier();
994          }
995          return getClassifier().get(0);
996        }
997
998        /**
999         * @return {@link #party} (Individual or organization associated with study (use practitionerRole to specify their organisation).)
1000         */
1001        public Reference getParty() { 
1002          if (this.party == null)
1003            if (Configuration.errorOnAutoCreate())
1004              throw new Error("Attempt to auto-create ResearchStudyAssociatedPartyComponent.party");
1005            else if (Configuration.doAutoCreate())
1006              this.party = new Reference(); // cc
1007          return this.party;
1008        }
1009
1010        public boolean hasParty() { 
1011          return this.party != null && !this.party.isEmpty();
1012        }
1013
1014        /**
1015         * @param value {@link #party} (Individual or organization associated with study (use practitionerRole to specify their organisation).)
1016         */
1017        public ResearchStudyAssociatedPartyComponent setParty(Reference value) { 
1018          this.party = value;
1019          return this;
1020        }
1021
1022        protected void listChildren(List<Property> children) {
1023          super.listChildren(children);
1024          children.add(new Property("name", "string", "Name of associated party.", 0, 1, name));
1025          children.add(new Property("role", "CodeableConcept", "Type of association.", 0, 1, role));
1026          children.add(new Property("classifier", "CodeableConcept", "Organisational type of association.", 0, java.lang.Integer.MAX_VALUE, classifier));
1027          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization)", "Individual or organization associated with study (use practitionerRole to specify their organisation).", 0, 1, party));
1028        }
1029
1030        @Override
1031        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1032          switch (_hash) {
1033          case 3373707: /*name*/  return new Property("name", "string", "Name of associated party.", 0, 1, name);
1034          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Type of association.", 0, 1, role);
1035          case -281470431: /*classifier*/  return new Property("classifier", "CodeableConcept", "Organisational type of association.", 0, java.lang.Integer.MAX_VALUE, classifier);
1036          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization)", "Individual or organization associated with study (use practitionerRole to specify their organisation).", 0, 1, party);
1037          default: return super.getNamedProperty(_hash, _name, _checkValid);
1038          }
1039
1040        }
1041
1042      @Override
1043      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1044        switch (hash) {
1045        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1046        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1047        case -281470431: /*classifier*/ return this.classifier == null ? new Base[0] : this.classifier.toArray(new Base[this.classifier.size()]); // CodeableConcept
1048        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
1049        default: return super.getProperty(hash, name, checkValid);
1050        }
1051
1052      }
1053
1054      @Override
1055      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1056        switch (hash) {
1057        case 3373707: // name
1058          this.name = TypeConvertor.castToString(value); // StringType
1059          return value;
1060        case 3506294: // role
1061          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1062          return value;
1063        case -281470431: // classifier
1064          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1065          return value;
1066        case 106437350: // party
1067          this.party = TypeConvertor.castToReference(value); // Reference
1068          return value;
1069        default: return super.setProperty(hash, name, value);
1070        }
1071
1072      }
1073
1074      @Override
1075      public Base setProperty(String name, Base value) throws FHIRException {
1076        if (name.equals("name")) {
1077          this.name = TypeConvertor.castToString(value); // StringType
1078        } else if (name.equals("role")) {
1079          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1080        } else if (name.equals("classifier")) {
1081          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value));
1082        } else if (name.equals("party")) {
1083          this.party = TypeConvertor.castToReference(value); // Reference
1084        } else
1085          return super.setProperty(name, value);
1086        return value;
1087      }
1088
1089      @Override
1090      public Base makeProperty(int hash, String name) throws FHIRException {
1091        switch (hash) {
1092        case 3373707:  return getNameElement();
1093        case 3506294:  return getRole();
1094        case -281470431:  return addClassifier(); 
1095        case 106437350:  return getParty();
1096        default: return super.makeProperty(hash, name);
1097        }
1098
1099      }
1100
1101      @Override
1102      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1103        switch (hash) {
1104        case 3373707: /*name*/ return new String[] {"string"};
1105        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1106        case -281470431: /*classifier*/ return new String[] {"CodeableConcept"};
1107        case 106437350: /*party*/ return new String[] {"Reference"};
1108        default: return super.getTypesForProperty(hash, name);
1109        }
1110
1111      }
1112
1113      @Override
1114      public Base addChild(String name) throws FHIRException {
1115        if (name.equals("name")) {
1116          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.associatedParty.name");
1117        }
1118        else if (name.equals("role")) {
1119          this.role = new CodeableConcept();
1120          return this.role;
1121        }
1122        else if (name.equals("classifier")) {
1123          return addClassifier();
1124        }
1125        else if (name.equals("party")) {
1126          this.party = new Reference();
1127          return this.party;
1128        }
1129        else
1130          return super.addChild(name);
1131      }
1132
1133      public ResearchStudyAssociatedPartyComponent copy() {
1134        ResearchStudyAssociatedPartyComponent dst = new ResearchStudyAssociatedPartyComponent();
1135        copyValues(dst);
1136        return dst;
1137      }
1138
1139      public void copyValues(ResearchStudyAssociatedPartyComponent dst) {
1140        super.copyValues(dst);
1141        dst.name = name == null ? null : name.copy();
1142        dst.role = role == null ? null : role.copy();
1143        if (classifier != null) {
1144          dst.classifier = new ArrayList<CodeableConcept>();
1145          for (CodeableConcept i : classifier)
1146            dst.classifier.add(i.copy());
1147        };
1148        dst.party = party == null ? null : party.copy();
1149      }
1150
1151      @Override
1152      public boolean equalsDeep(Base other_) {
1153        if (!super.equalsDeep(other_))
1154          return false;
1155        if (!(other_ instanceof ResearchStudyAssociatedPartyComponent))
1156          return false;
1157        ResearchStudyAssociatedPartyComponent o = (ResearchStudyAssociatedPartyComponent) other_;
1158        return compareDeep(name, o.name, true) && compareDeep(role, o.role, true) && compareDeep(classifier, o.classifier, true)
1159           && compareDeep(party, o.party, true);
1160      }
1161
1162      @Override
1163      public boolean equalsShallow(Base other_) {
1164        if (!super.equalsShallow(other_))
1165          return false;
1166        if (!(other_ instanceof ResearchStudyAssociatedPartyComponent))
1167          return false;
1168        ResearchStudyAssociatedPartyComponent o = (ResearchStudyAssociatedPartyComponent) other_;
1169        return compareValues(name, o.name, true);
1170      }
1171
1172      public boolean isEmpty() {
1173        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, role, classifier, party
1174          );
1175      }
1176
1177  public String fhirType() {
1178    return "ResearchStudy.associatedParty";
1179
1180  }
1181
1182  }
1183
1184    @Block()
1185    public static class ResearchStudyStatusDateComponent extends BackboneElement implements IBaseBackboneElement {
1186        /**
1187         * Label for status or state.
1188         */
1189        @Child(name = "activity", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1190        @Description(shortDefinition="Record-Verification | Overall-Study | Primary-Outcome-Data-Collection | Registration-Submission | Registration-Submission-QC | Registration-Posting | Results-Submission | Results-Submission-QC | Results-Posting | Disposition-Submission | Disposition-Submission-QC | Disposition-Posting | Update-Submission | Update-Posting", formalDefinition="Label for status or state." )
1191        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-statusDate-activity")
1192        protected CodeableConcept activity;
1193
1194        /**
1195         * Actual if true else anticipated.
1196         */
1197        @Child(name = "actual", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1198        @Description(shortDefinition="Actual if true else anticipated", formalDefinition="Actual if true else anticipated." )
1199        protected BooleanType actual;
1200
1201        /**
1202         * Date range.
1203         */
1204        @Child(name = "period", type = {Period.class}, order=3, min=1, max=1, modifier=false, summary=false)
1205        @Description(shortDefinition="Date range", formalDefinition="Date range." )
1206        protected Period period;
1207
1208        private static final long serialVersionUID = 1123586924L;
1209
1210    /**
1211     * Constructor
1212     */
1213      public ResearchStudyStatusDateComponent() {
1214        super();
1215      }
1216
1217    /**
1218     * Constructor
1219     */
1220      public ResearchStudyStatusDateComponent(CodeableConcept activity, Period period) {
1221        super();
1222        this.setActivity(activity);
1223        this.setPeriod(period);
1224      }
1225
1226        /**
1227         * @return {@link #activity} (Label for status or state.)
1228         */
1229        public CodeableConcept getActivity() { 
1230          if (this.activity == null)
1231            if (Configuration.errorOnAutoCreate())
1232              throw new Error("Attempt to auto-create ResearchStudyStatusDateComponent.activity");
1233            else if (Configuration.doAutoCreate())
1234              this.activity = new CodeableConcept(); // cc
1235          return this.activity;
1236        }
1237
1238        public boolean hasActivity() { 
1239          return this.activity != null && !this.activity.isEmpty();
1240        }
1241
1242        /**
1243         * @param value {@link #activity} (Label for status or state.)
1244         */
1245        public ResearchStudyStatusDateComponent setActivity(CodeableConcept value) { 
1246          this.activity = value;
1247          return this;
1248        }
1249
1250        /**
1251         * @return {@link #actual} (Actual if true else anticipated.). This is the underlying object with id, value and extensions. The accessor "getActual" gives direct access to the value
1252         */
1253        public BooleanType getActualElement() { 
1254          if (this.actual == null)
1255            if (Configuration.errorOnAutoCreate())
1256              throw new Error("Attempt to auto-create ResearchStudyStatusDateComponent.actual");
1257            else if (Configuration.doAutoCreate())
1258              this.actual = new BooleanType(); // bb
1259          return this.actual;
1260        }
1261
1262        public boolean hasActualElement() { 
1263          return this.actual != null && !this.actual.isEmpty();
1264        }
1265
1266        public boolean hasActual() { 
1267          return this.actual != null && !this.actual.isEmpty();
1268        }
1269
1270        /**
1271         * @param value {@link #actual} (Actual if true else anticipated.). This is the underlying object with id, value and extensions. The accessor "getActual" gives direct access to the value
1272         */
1273        public ResearchStudyStatusDateComponent setActualElement(BooleanType value) { 
1274          this.actual = value;
1275          return this;
1276        }
1277
1278        /**
1279         * @return Actual if true else anticipated.
1280         */
1281        public boolean getActual() { 
1282          return this.actual == null || this.actual.isEmpty() ? false : this.actual.getValue();
1283        }
1284
1285        /**
1286         * @param value Actual if true else anticipated.
1287         */
1288        public ResearchStudyStatusDateComponent setActual(boolean value) { 
1289            if (this.actual == null)
1290              this.actual = new BooleanType();
1291            this.actual.setValue(value);
1292          return this;
1293        }
1294
1295        /**
1296         * @return {@link #period} (Date range.)
1297         */
1298        public Period getPeriod() { 
1299          if (this.period == null)
1300            if (Configuration.errorOnAutoCreate())
1301              throw new Error("Attempt to auto-create ResearchStudyStatusDateComponent.period");
1302            else if (Configuration.doAutoCreate())
1303              this.period = new Period(); // cc
1304          return this.period;
1305        }
1306
1307        public boolean hasPeriod() { 
1308          return this.period != null && !this.period.isEmpty();
1309        }
1310
1311        /**
1312         * @param value {@link #period} (Date range.)
1313         */
1314        public ResearchStudyStatusDateComponent setPeriod(Period value) { 
1315          this.period = value;
1316          return this;
1317        }
1318
1319        protected void listChildren(List<Property> children) {
1320          super.listChildren(children);
1321          children.add(new Property("activity", "CodeableConcept", "Label for status or state.", 0, 1, activity));
1322          children.add(new Property("actual", "boolean", "Actual if true else anticipated.", 0, 1, actual));
1323          children.add(new Property("period", "Period", "Date range.", 0, 1, period));
1324        }
1325
1326        @Override
1327        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1328          switch (_hash) {
1329          case -1655966961: /*activity*/  return new Property("activity", "CodeableConcept", "Label for status or state.", 0, 1, activity);
1330          case -1422939762: /*actual*/  return new Property("actual", "boolean", "Actual if true else anticipated.", 0, 1, actual);
1331          case -991726143: /*period*/  return new Property("period", "Period", "Date range.", 0, 1, period);
1332          default: return super.getNamedProperty(_hash, _name, _checkValid);
1333          }
1334
1335        }
1336
1337      @Override
1338      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1339        switch (hash) {
1340        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : new Base[] {this.activity}; // CodeableConcept
1341        case -1422939762: /*actual*/ return this.actual == null ? new Base[0] : new Base[] {this.actual}; // BooleanType
1342        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1343        default: return super.getProperty(hash, name, checkValid);
1344        }
1345
1346      }
1347
1348      @Override
1349      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1350        switch (hash) {
1351        case -1655966961: // activity
1352          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1353          return value;
1354        case -1422939762: // actual
1355          this.actual = TypeConvertor.castToBoolean(value); // BooleanType
1356          return value;
1357        case -991726143: // period
1358          this.period = TypeConvertor.castToPeriod(value); // Period
1359          return value;
1360        default: return super.setProperty(hash, name, value);
1361        }
1362
1363      }
1364
1365      @Override
1366      public Base setProperty(String name, Base value) throws FHIRException {
1367        if (name.equals("activity")) {
1368          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1369        } else if (name.equals("actual")) {
1370          this.actual = TypeConvertor.castToBoolean(value); // BooleanType
1371        } else if (name.equals("period")) {
1372          this.period = TypeConvertor.castToPeriod(value); // Period
1373        } else
1374          return super.setProperty(name, value);
1375        return value;
1376      }
1377
1378      @Override
1379      public Base makeProperty(int hash, String name) throws FHIRException {
1380        switch (hash) {
1381        case -1655966961:  return getActivity();
1382        case -1422939762:  return getActualElement();
1383        case -991726143:  return getPeriod();
1384        default: return super.makeProperty(hash, name);
1385        }
1386
1387      }
1388
1389      @Override
1390      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1391        switch (hash) {
1392        case -1655966961: /*activity*/ return new String[] {"CodeableConcept"};
1393        case -1422939762: /*actual*/ return new String[] {"boolean"};
1394        case -991726143: /*period*/ return new String[] {"Period"};
1395        default: return super.getTypesForProperty(hash, name);
1396        }
1397
1398      }
1399
1400      @Override
1401      public Base addChild(String name) throws FHIRException {
1402        if (name.equals("activity")) {
1403          this.activity = new CodeableConcept();
1404          return this.activity;
1405        }
1406        else if (name.equals("actual")) {
1407          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.statusDate.actual");
1408        }
1409        else if (name.equals("period")) {
1410          this.period = new Period();
1411          return this.period;
1412        }
1413        else
1414          return super.addChild(name);
1415      }
1416
1417      public ResearchStudyStatusDateComponent copy() {
1418        ResearchStudyStatusDateComponent dst = new ResearchStudyStatusDateComponent();
1419        copyValues(dst);
1420        return dst;
1421      }
1422
1423      public void copyValues(ResearchStudyStatusDateComponent dst) {
1424        super.copyValues(dst);
1425        dst.activity = activity == null ? null : activity.copy();
1426        dst.actual = actual == null ? null : actual.copy();
1427        dst.period = period == null ? null : period.copy();
1428      }
1429
1430      @Override
1431      public boolean equalsDeep(Base other_) {
1432        if (!super.equalsDeep(other_))
1433          return false;
1434        if (!(other_ instanceof ResearchStudyStatusDateComponent))
1435          return false;
1436        ResearchStudyStatusDateComponent o = (ResearchStudyStatusDateComponent) other_;
1437        return compareDeep(activity, o.activity, true) && compareDeep(actual, o.actual, true) && compareDeep(period, o.period, true)
1438          ;
1439      }
1440
1441      @Override
1442      public boolean equalsShallow(Base other_) {
1443        if (!super.equalsShallow(other_))
1444          return false;
1445        if (!(other_ instanceof ResearchStudyStatusDateComponent))
1446          return false;
1447        ResearchStudyStatusDateComponent o = (ResearchStudyStatusDateComponent) other_;
1448        return compareValues(actual, o.actual, true);
1449      }
1450
1451      public boolean isEmpty() {
1452        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(activity, actual, period
1453          );
1454      }
1455
1456  public String fhirType() {
1457    return "ResearchStudy.statusDate";
1458
1459  }
1460
1461  }
1462
1463    @Block()
1464    public static class ResearchStudyRecruitmentComponent extends BackboneElement implements IBaseBackboneElement {
1465        /**
1466         * Estimated total number of participants to be enrolled.
1467         */
1468        @Child(name = "targetNumber", type = {UnsignedIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1469        @Description(shortDefinition="Estimated total number of participants to be enrolled", formalDefinition="Estimated total number of participants to be enrolled." )
1470        protected UnsignedIntType targetNumber;
1471
1472        /**
1473         * Actual total number of participants enrolled in study.
1474         */
1475        @Child(name = "actualNumber", type = {UnsignedIntType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1476        @Description(shortDefinition="Actual total number of participants enrolled in study", formalDefinition="Actual total number of participants enrolled in study." )
1477        protected UnsignedIntType actualNumber;
1478
1479        /**
1480         * Inclusion and exclusion criteria.
1481         */
1482        @Child(name = "eligibility", type = {Group.class}, order=3, min=0, max=1, modifier=false, summary=false)
1483        @Description(shortDefinition="Inclusion and exclusion criteria", formalDefinition="Inclusion and exclusion criteria." )
1484        protected Reference eligibility;
1485
1486        /**
1487         * Group of participants who were enrolled in study.
1488         */
1489        @Child(name = "actualGroup", type = {Group.class}, order=4, min=0, max=1, modifier=false, summary=true)
1490        @Description(shortDefinition="Group of participants who were enrolled in study", formalDefinition="Group of participants who were enrolled in study." )
1491        protected Reference actualGroup;
1492
1493        private static final long serialVersionUID = 1483229827L;
1494
1495    /**
1496     * Constructor
1497     */
1498      public ResearchStudyRecruitmentComponent() {
1499        super();
1500      }
1501
1502        /**
1503         * @return {@link #targetNumber} (Estimated total number of participants to be enrolled.). This is the underlying object with id, value and extensions. The accessor "getTargetNumber" gives direct access to the value
1504         */
1505        public UnsignedIntType getTargetNumberElement() { 
1506          if (this.targetNumber == null)
1507            if (Configuration.errorOnAutoCreate())
1508              throw new Error("Attempt to auto-create ResearchStudyRecruitmentComponent.targetNumber");
1509            else if (Configuration.doAutoCreate())
1510              this.targetNumber = new UnsignedIntType(); // bb
1511          return this.targetNumber;
1512        }
1513
1514        public boolean hasTargetNumberElement() { 
1515          return this.targetNumber != null && !this.targetNumber.isEmpty();
1516        }
1517
1518        public boolean hasTargetNumber() { 
1519          return this.targetNumber != null && !this.targetNumber.isEmpty();
1520        }
1521
1522        /**
1523         * @param value {@link #targetNumber} (Estimated total number of participants to be enrolled.). This is the underlying object with id, value and extensions. The accessor "getTargetNumber" gives direct access to the value
1524         */
1525        public ResearchStudyRecruitmentComponent setTargetNumberElement(UnsignedIntType value) { 
1526          this.targetNumber = value;
1527          return this;
1528        }
1529
1530        /**
1531         * @return Estimated total number of participants to be enrolled.
1532         */
1533        public int getTargetNumber() { 
1534          return this.targetNumber == null || this.targetNumber.isEmpty() ? 0 : this.targetNumber.getValue();
1535        }
1536
1537        /**
1538         * @param value Estimated total number of participants to be enrolled.
1539         */
1540        public ResearchStudyRecruitmentComponent setTargetNumber(int value) { 
1541            if (this.targetNumber == null)
1542              this.targetNumber = new UnsignedIntType();
1543            this.targetNumber.setValue(value);
1544          return this;
1545        }
1546
1547        /**
1548         * @return {@link #actualNumber} (Actual total number of participants enrolled in study.). This is the underlying object with id, value and extensions. The accessor "getActualNumber" gives direct access to the value
1549         */
1550        public UnsignedIntType getActualNumberElement() { 
1551          if (this.actualNumber == null)
1552            if (Configuration.errorOnAutoCreate())
1553              throw new Error("Attempt to auto-create ResearchStudyRecruitmentComponent.actualNumber");
1554            else if (Configuration.doAutoCreate())
1555              this.actualNumber = new UnsignedIntType(); // bb
1556          return this.actualNumber;
1557        }
1558
1559        public boolean hasActualNumberElement() { 
1560          return this.actualNumber != null && !this.actualNumber.isEmpty();
1561        }
1562
1563        public boolean hasActualNumber() { 
1564          return this.actualNumber != null && !this.actualNumber.isEmpty();
1565        }
1566
1567        /**
1568         * @param value {@link #actualNumber} (Actual total number of participants enrolled in study.). This is the underlying object with id, value and extensions. The accessor "getActualNumber" gives direct access to the value
1569         */
1570        public ResearchStudyRecruitmentComponent setActualNumberElement(UnsignedIntType value) { 
1571          this.actualNumber = value;
1572          return this;
1573        }
1574
1575        /**
1576         * @return Actual total number of participants enrolled in study.
1577         */
1578        public int getActualNumber() { 
1579          return this.actualNumber == null || this.actualNumber.isEmpty() ? 0 : this.actualNumber.getValue();
1580        }
1581
1582        /**
1583         * @param value Actual total number of participants enrolled in study.
1584         */
1585        public ResearchStudyRecruitmentComponent setActualNumber(int value) { 
1586            if (this.actualNumber == null)
1587              this.actualNumber = new UnsignedIntType();
1588            this.actualNumber.setValue(value);
1589          return this;
1590        }
1591
1592        /**
1593         * @return {@link #eligibility} (Inclusion and exclusion criteria.)
1594         */
1595        public Reference getEligibility() { 
1596          if (this.eligibility == null)
1597            if (Configuration.errorOnAutoCreate())
1598              throw new Error("Attempt to auto-create ResearchStudyRecruitmentComponent.eligibility");
1599            else if (Configuration.doAutoCreate())
1600              this.eligibility = new Reference(); // cc
1601          return this.eligibility;
1602        }
1603
1604        public boolean hasEligibility() { 
1605          return this.eligibility != null && !this.eligibility.isEmpty();
1606        }
1607
1608        /**
1609         * @param value {@link #eligibility} (Inclusion and exclusion criteria.)
1610         */
1611        public ResearchStudyRecruitmentComponent setEligibility(Reference value) { 
1612          this.eligibility = value;
1613          return this;
1614        }
1615
1616        /**
1617         * @return {@link #actualGroup} (Group of participants who were enrolled in study.)
1618         */
1619        public Reference getActualGroup() { 
1620          if (this.actualGroup == null)
1621            if (Configuration.errorOnAutoCreate())
1622              throw new Error("Attempt to auto-create ResearchStudyRecruitmentComponent.actualGroup");
1623            else if (Configuration.doAutoCreate())
1624              this.actualGroup = new Reference(); // cc
1625          return this.actualGroup;
1626        }
1627
1628        public boolean hasActualGroup() { 
1629          return this.actualGroup != null && !this.actualGroup.isEmpty();
1630        }
1631
1632        /**
1633         * @param value {@link #actualGroup} (Group of participants who were enrolled in study.)
1634         */
1635        public ResearchStudyRecruitmentComponent setActualGroup(Reference value) { 
1636          this.actualGroup = value;
1637          return this;
1638        }
1639
1640        protected void listChildren(List<Property> children) {
1641          super.listChildren(children);
1642          children.add(new Property("targetNumber", "unsignedInt", "Estimated total number of participants to be enrolled.", 0, 1, targetNumber));
1643          children.add(new Property("actualNumber", "unsignedInt", "Actual total number of participants enrolled in study.", 0, 1, actualNumber));
1644          children.add(new Property("eligibility", "Reference(Group)", "Inclusion and exclusion criteria.", 0, 1, eligibility));
1645          children.add(new Property("actualGroup", "Reference(Group)", "Group of participants who were enrolled in study.", 0, 1, actualGroup));
1646        }
1647
1648        @Override
1649        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1650          switch (_hash) {
1651          case -682948550: /*targetNumber*/  return new Property("targetNumber", "unsignedInt", "Estimated total number of participants to be enrolled.", 0, 1, targetNumber);
1652          case 746557047: /*actualNumber*/  return new Property("actualNumber", "unsignedInt", "Actual total number of participants enrolled in study.", 0, 1, actualNumber);
1653          case -930847859: /*eligibility*/  return new Property("eligibility", "Reference(Group)", "Inclusion and exclusion criteria.", 0, 1, eligibility);
1654          case 1403004305: /*actualGroup*/  return new Property("actualGroup", "Reference(Group)", "Group of participants who were enrolled in study.", 0, 1, actualGroup);
1655          default: return super.getNamedProperty(_hash, _name, _checkValid);
1656          }
1657
1658        }
1659
1660      @Override
1661      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1662        switch (hash) {
1663        case -682948550: /*targetNumber*/ return this.targetNumber == null ? new Base[0] : new Base[] {this.targetNumber}; // UnsignedIntType
1664        case 746557047: /*actualNumber*/ return this.actualNumber == null ? new Base[0] : new Base[] {this.actualNumber}; // UnsignedIntType
1665        case -930847859: /*eligibility*/ return this.eligibility == null ? new Base[0] : new Base[] {this.eligibility}; // Reference
1666        case 1403004305: /*actualGroup*/ return this.actualGroup == null ? new Base[0] : new Base[] {this.actualGroup}; // Reference
1667        default: return super.getProperty(hash, name, checkValid);
1668        }
1669
1670      }
1671
1672      @Override
1673      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1674        switch (hash) {
1675        case -682948550: // targetNumber
1676          this.targetNumber = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1677          return value;
1678        case 746557047: // actualNumber
1679          this.actualNumber = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1680          return value;
1681        case -930847859: // eligibility
1682          this.eligibility = TypeConvertor.castToReference(value); // Reference
1683          return value;
1684        case 1403004305: // actualGroup
1685          this.actualGroup = TypeConvertor.castToReference(value); // Reference
1686          return value;
1687        default: return super.setProperty(hash, name, value);
1688        }
1689
1690      }
1691
1692      @Override
1693      public Base setProperty(String name, Base value) throws FHIRException {
1694        if (name.equals("targetNumber")) {
1695          this.targetNumber = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1696        } else if (name.equals("actualNumber")) {
1697          this.actualNumber = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1698        } else if (name.equals("eligibility")) {
1699          this.eligibility = TypeConvertor.castToReference(value); // Reference
1700        } else if (name.equals("actualGroup")) {
1701          this.actualGroup = TypeConvertor.castToReference(value); // Reference
1702        } else
1703          return super.setProperty(name, value);
1704        return value;
1705      }
1706
1707      @Override
1708      public Base makeProperty(int hash, String name) throws FHIRException {
1709        switch (hash) {
1710        case -682948550:  return getTargetNumberElement();
1711        case 746557047:  return getActualNumberElement();
1712        case -930847859:  return getEligibility();
1713        case 1403004305:  return getActualGroup();
1714        default: return super.makeProperty(hash, name);
1715        }
1716
1717      }
1718
1719      @Override
1720      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1721        switch (hash) {
1722        case -682948550: /*targetNumber*/ return new String[] {"unsignedInt"};
1723        case 746557047: /*actualNumber*/ return new String[] {"unsignedInt"};
1724        case -930847859: /*eligibility*/ return new String[] {"Reference"};
1725        case 1403004305: /*actualGroup*/ return new String[] {"Reference"};
1726        default: return super.getTypesForProperty(hash, name);
1727        }
1728
1729      }
1730
1731      @Override
1732      public Base addChild(String name) throws FHIRException {
1733        if (name.equals("targetNumber")) {
1734          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.recruitment.targetNumber");
1735        }
1736        else if (name.equals("actualNumber")) {
1737          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.recruitment.actualNumber");
1738        }
1739        else if (name.equals("eligibility")) {
1740          this.eligibility = new Reference();
1741          return this.eligibility;
1742        }
1743        else if (name.equals("actualGroup")) {
1744          this.actualGroup = new Reference();
1745          return this.actualGroup;
1746        }
1747        else
1748          return super.addChild(name);
1749      }
1750
1751      public ResearchStudyRecruitmentComponent copy() {
1752        ResearchStudyRecruitmentComponent dst = new ResearchStudyRecruitmentComponent();
1753        copyValues(dst);
1754        return dst;
1755      }
1756
1757      public void copyValues(ResearchStudyRecruitmentComponent dst) {
1758        super.copyValues(dst);
1759        dst.targetNumber = targetNumber == null ? null : targetNumber.copy();
1760        dst.actualNumber = actualNumber == null ? null : actualNumber.copy();
1761        dst.eligibility = eligibility == null ? null : eligibility.copy();
1762        dst.actualGroup = actualGroup == null ? null : actualGroup.copy();
1763      }
1764
1765      @Override
1766      public boolean equalsDeep(Base other_) {
1767        if (!super.equalsDeep(other_))
1768          return false;
1769        if (!(other_ instanceof ResearchStudyRecruitmentComponent))
1770          return false;
1771        ResearchStudyRecruitmentComponent o = (ResearchStudyRecruitmentComponent) other_;
1772        return compareDeep(targetNumber, o.targetNumber, true) && compareDeep(actualNumber, o.actualNumber, true)
1773           && compareDeep(eligibility, o.eligibility, true) && compareDeep(actualGroup, o.actualGroup, true)
1774          ;
1775      }
1776
1777      @Override
1778      public boolean equalsShallow(Base other_) {
1779        if (!super.equalsShallow(other_))
1780          return false;
1781        if (!(other_ instanceof ResearchStudyRecruitmentComponent))
1782          return false;
1783        ResearchStudyRecruitmentComponent o = (ResearchStudyRecruitmentComponent) other_;
1784        return compareValues(targetNumber, o.targetNumber, true) && compareValues(actualNumber, o.actualNumber, true)
1785          ;
1786      }
1787
1788      public boolean isEmpty() {
1789        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(targetNumber, actualNumber
1790          , eligibility, actualGroup);
1791      }
1792
1793  public String fhirType() {
1794    return "ResearchStudy.recruitment";
1795
1796  }
1797
1798  }
1799
1800    @Block()
1801    public static class ResearchStudyComparisonGroupComponent extends BackboneElement implements IBaseBackboneElement {
1802        /**
1803         * Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.
1804         */
1805        @Child(name = "identifier", type = {UriType.class, Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
1806        @Description(shortDefinition="Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily", formalDefinition="Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily." )
1807        protected DataType identifier;
1808
1809        /**
1810         * Unique, human-readable label for this comparisonGroup of the study.
1811         */
1812        @Child(name = "name", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1813        @Description(shortDefinition="Label for study comparisonGroup", formalDefinition="Unique, human-readable label for this comparisonGroup of the study." )
1814        protected StringType name;
1815
1816        /**
1817         * Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater.
1818         */
1819        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1820        @Description(shortDefinition="Categorization of study comparisonGroup", formalDefinition="Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater." )
1821        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-arm-type")
1822        protected CodeableConcept type;
1823
1824        /**
1825         * A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.
1826         */
1827        @Child(name = "description", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1828        @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 comparisonGroup." )
1829        protected MarkdownType description;
1830
1831        /**
1832         * Interventions or exposures in this comparisonGroup or cohort.
1833         */
1834        @Child(name = "intendedExposure", type = {EvidenceVariable.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1835        @Description(shortDefinition="Interventions or exposures in this comparisonGroup or cohort", formalDefinition="Interventions or exposures in this comparisonGroup or cohort." )
1836        protected List<Reference> intendedExposure;
1837
1838        /**
1839         * Group of participants who were enrolled in study comparisonGroup.
1840         */
1841        @Child(name = "observedGroup", type = {Group.class}, order=6, min=0, max=1, modifier=false, summary=false)
1842        @Description(shortDefinition="Group of participants who were enrolled in study comparisonGroup", formalDefinition="Group of participants who were enrolled in study comparisonGroup." )
1843        protected Reference observedGroup;
1844
1845        private static final long serialVersionUID = -600196662L;
1846
1847    /**
1848     * Constructor
1849     */
1850      public ResearchStudyComparisonGroupComponent() {
1851        super();
1852      }
1853
1854    /**
1855     * Constructor
1856     */
1857      public ResearchStudyComparisonGroupComponent(String name) {
1858        super();
1859        this.setName(name);
1860      }
1861
1862        /**
1863         * @return {@link #identifier} (Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.)
1864         */
1865        public DataType getIdentifier() { 
1866          return this.identifier;
1867        }
1868
1869        /**
1870         * @return {@link #identifier} (Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.)
1871         */
1872        public UriType getIdentifierUriType() throws FHIRException { 
1873          if (this.identifier == null)
1874            this.identifier = new UriType();
1875          if (!(this.identifier instanceof UriType))
1876            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.identifier.getClass().getName()+" was encountered");
1877          return (UriType) this.identifier;
1878        }
1879
1880        public boolean hasIdentifierUriType() { 
1881          return this != null && this.identifier instanceof UriType;
1882        }
1883
1884        /**
1885         * @return {@link #identifier} (Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.)
1886         */
1887        public Identifier getIdentifierIdentifier() throws FHIRException { 
1888          if (this.identifier == null)
1889            this.identifier = new Identifier();
1890          if (!(this.identifier instanceof Identifier))
1891            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.identifier.getClass().getName()+" was encountered");
1892          return (Identifier) this.identifier;
1893        }
1894
1895        public boolean hasIdentifierIdentifier() { 
1896          return this != null && this.identifier instanceof Identifier;
1897        }
1898
1899        public boolean hasIdentifier() { 
1900          return this.identifier != null && !this.identifier.isEmpty();
1901        }
1902
1903        /**
1904         * @param value {@link #identifier} (Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.)
1905         */
1906        public ResearchStudyComparisonGroupComponent setIdentifier(DataType value) { 
1907          if (value != null && !(value instanceof UriType || value instanceof Identifier))
1908            throw new Error("Not the right type for ResearchStudy.comparisonGroup.identifier[x]: "+value.fhirType());
1909          this.identifier = value;
1910          return this;
1911        }
1912
1913        /**
1914         * @return {@link #name} (Unique, human-readable label for this comparisonGroup of the study.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1915         */
1916        public StringType getNameElement() { 
1917          if (this.name == null)
1918            if (Configuration.errorOnAutoCreate())
1919              throw new Error("Attempt to auto-create ResearchStudyComparisonGroupComponent.name");
1920            else if (Configuration.doAutoCreate())
1921              this.name = new StringType(); // bb
1922          return this.name;
1923        }
1924
1925        public boolean hasNameElement() { 
1926          return this.name != null && !this.name.isEmpty();
1927        }
1928
1929        public boolean hasName() { 
1930          return this.name != null && !this.name.isEmpty();
1931        }
1932
1933        /**
1934         * @param value {@link #name} (Unique, human-readable label for this comparisonGroup of the study.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1935         */
1936        public ResearchStudyComparisonGroupComponent setNameElement(StringType value) { 
1937          this.name = value;
1938          return this;
1939        }
1940
1941        /**
1942         * @return Unique, human-readable label for this comparisonGroup of the study.
1943         */
1944        public String getName() { 
1945          return this.name == null ? null : this.name.getValue();
1946        }
1947
1948        /**
1949         * @param value Unique, human-readable label for this comparisonGroup of the study.
1950         */
1951        public ResearchStudyComparisonGroupComponent setName(String value) { 
1952            if (this.name == null)
1953              this.name = new StringType();
1954            this.name.setValue(value);
1955          return this;
1956        }
1957
1958        /**
1959         * @return {@link #type} (Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater.)
1960         */
1961        public CodeableConcept getType() { 
1962          if (this.type == null)
1963            if (Configuration.errorOnAutoCreate())
1964              throw new Error("Attempt to auto-create ResearchStudyComparisonGroupComponent.type");
1965            else if (Configuration.doAutoCreate())
1966              this.type = new CodeableConcept(); // cc
1967          return this.type;
1968        }
1969
1970        public boolean hasType() { 
1971          return this.type != null && !this.type.isEmpty();
1972        }
1973
1974        /**
1975         * @param value {@link #type} (Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater.)
1976         */
1977        public ResearchStudyComparisonGroupComponent setType(CodeableConcept value) { 
1978          this.type = value;
1979          return this;
1980        }
1981
1982        /**
1983         * @return {@link #description} (A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1984         */
1985        public MarkdownType getDescriptionElement() { 
1986          if (this.description == null)
1987            if (Configuration.errorOnAutoCreate())
1988              throw new Error("Attempt to auto-create ResearchStudyComparisonGroupComponent.description");
1989            else if (Configuration.doAutoCreate())
1990              this.description = new MarkdownType(); // bb
1991          return this.description;
1992        }
1993
1994        public boolean hasDescriptionElement() { 
1995          return this.description != null && !this.description.isEmpty();
1996        }
1997
1998        public boolean hasDescription() { 
1999          return this.description != null && !this.description.isEmpty();
2000        }
2001
2002        /**
2003         * @param value {@link #description} (A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2004         */
2005        public ResearchStudyComparisonGroupComponent setDescriptionElement(MarkdownType value) { 
2006          this.description = value;
2007          return this;
2008        }
2009
2010        /**
2011         * @return A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.
2012         */
2013        public String getDescription() { 
2014          return this.description == null ? null : this.description.getValue();
2015        }
2016
2017        /**
2018         * @param value A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.
2019         */
2020        public ResearchStudyComparisonGroupComponent setDescription(String value) { 
2021          if (value == null)
2022            this.description = null;
2023          else {
2024            if (this.description == null)
2025              this.description = new MarkdownType();
2026            this.description.setValue(value);
2027          }
2028          return this;
2029        }
2030
2031        /**
2032         * @return {@link #intendedExposure} (Interventions or exposures in this comparisonGroup or cohort.)
2033         */
2034        public List<Reference> getIntendedExposure() { 
2035          if (this.intendedExposure == null)
2036            this.intendedExposure = new ArrayList<Reference>();
2037          return this.intendedExposure;
2038        }
2039
2040        /**
2041         * @return Returns a reference to <code>this</code> for easy method chaining
2042         */
2043        public ResearchStudyComparisonGroupComponent setIntendedExposure(List<Reference> theIntendedExposure) { 
2044          this.intendedExposure = theIntendedExposure;
2045          return this;
2046        }
2047
2048        public boolean hasIntendedExposure() { 
2049          if (this.intendedExposure == null)
2050            return false;
2051          for (Reference item : this.intendedExposure)
2052            if (!item.isEmpty())
2053              return true;
2054          return false;
2055        }
2056
2057        public Reference addIntendedExposure() { //3
2058          Reference t = new Reference();
2059          if (this.intendedExposure == null)
2060            this.intendedExposure = new ArrayList<Reference>();
2061          this.intendedExposure.add(t);
2062          return t;
2063        }
2064
2065        public ResearchStudyComparisonGroupComponent addIntendedExposure(Reference t) { //3
2066          if (t == null)
2067            return this;
2068          if (this.intendedExposure == null)
2069            this.intendedExposure = new ArrayList<Reference>();
2070          this.intendedExposure.add(t);
2071          return this;
2072        }
2073
2074        /**
2075         * @return The first repetition of repeating field {@link #intendedExposure}, creating it if it does not already exist {3}
2076         */
2077        public Reference getIntendedExposureFirstRep() { 
2078          if (getIntendedExposure().isEmpty()) {
2079            addIntendedExposure();
2080          }
2081          return getIntendedExposure().get(0);
2082        }
2083
2084        /**
2085         * @return {@link #observedGroup} (Group of participants who were enrolled in study comparisonGroup.)
2086         */
2087        public Reference getObservedGroup() { 
2088          if (this.observedGroup == null)
2089            if (Configuration.errorOnAutoCreate())
2090              throw new Error("Attempt to auto-create ResearchStudyComparisonGroupComponent.observedGroup");
2091            else if (Configuration.doAutoCreate())
2092              this.observedGroup = new Reference(); // cc
2093          return this.observedGroup;
2094        }
2095
2096        public boolean hasObservedGroup() { 
2097          return this.observedGroup != null && !this.observedGroup.isEmpty();
2098        }
2099
2100        /**
2101         * @param value {@link #observedGroup} (Group of participants who were enrolled in study comparisonGroup.)
2102         */
2103        public ResearchStudyComparisonGroupComponent setObservedGroup(Reference value) { 
2104          this.observedGroup = value;
2105          return this;
2106        }
2107
2108        protected void listChildren(List<Property> children) {
2109          super.listChildren(children);
2110          children.add(new Property("identifier[x]", "uri|Identifier", "Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.", 0, 1, identifier));
2111          children.add(new Property("name", "string", "Unique, human-readable label for this comparisonGroup of the study.", 0, 1, name));
2112          children.add(new Property("type", "CodeableConcept", "Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater.", 0, 1, type));
2113          children.add(new Property("description", "markdown", "A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.", 0, 1, description));
2114          children.add(new Property("intendedExposure", "Reference(EvidenceVariable)", "Interventions or exposures in this comparisonGroup or cohort.", 0, java.lang.Integer.MAX_VALUE, intendedExposure));
2115          children.add(new Property("observedGroup", "Reference(Group)", "Group of participants who were enrolled in study comparisonGroup.", 0, 1, observedGroup));
2116        }
2117
2118        @Override
2119        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2120          switch (_hash) {
2121          case 569772855: /*identifier[x]*/  return new Property("identifier[x]", "uri|Identifier", "Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.", 0, 1, identifier);
2122          case -1618432855: /*identifier*/  return new Property("identifier[x]", "uri|Identifier", "Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.", 0, 1, identifier);
2123          case 569766915: /*identifierUri*/  return new Property("identifier[x]", "uri", "Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.", 0, 1, identifier);
2124          case -554289614: /*identifierIdentifier*/  return new Property("identifier[x]", "Identifier", "Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.", 0, 1, identifier);
2125          case 3373707: /*name*/  return new Property("name", "string", "Unique, human-readable label for this comparisonGroup of the study.", 0, 1, name);
2126          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Categorization of study comparisonGroup, e.g. experimental, active comparator, placebo comparater.", 0, 1, type);
2127          case -1724546052: /*description*/  return new Property("description", "markdown", "A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.", 0, 1, description);
2128          case -407218606: /*intendedExposure*/  return new Property("intendedExposure", "Reference(EvidenceVariable)", "Interventions or exposures in this comparisonGroup or cohort.", 0, java.lang.Integer.MAX_VALUE, intendedExposure);
2129          case 375599255: /*observedGroup*/  return new Property("observedGroup", "Reference(Group)", "Group of participants who were enrolled in study comparisonGroup.", 0, 1, observedGroup);
2130          default: return super.getNamedProperty(_hash, _name, _checkValid);
2131          }
2132
2133        }
2134
2135      @Override
2136      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2137        switch (hash) {
2138        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // DataType
2139        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2140        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2141        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2142        case -407218606: /*intendedExposure*/ return this.intendedExposure == null ? new Base[0] : this.intendedExposure.toArray(new Base[this.intendedExposure.size()]); // Reference
2143        case 375599255: /*observedGroup*/ return this.observedGroup == null ? new Base[0] : new Base[] {this.observedGroup}; // Reference
2144        default: return super.getProperty(hash, name, checkValid);
2145        }
2146
2147      }
2148
2149      @Override
2150      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2151        switch (hash) {
2152        case -1618432855: // identifier
2153          this.identifier = TypeConvertor.castToType(value); // DataType
2154          return value;
2155        case 3373707: // name
2156          this.name = TypeConvertor.castToString(value); // StringType
2157          return value;
2158        case 3575610: // type
2159          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2160          return value;
2161        case -1724546052: // description
2162          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2163          return value;
2164        case -407218606: // intendedExposure
2165          this.getIntendedExposure().add(TypeConvertor.castToReference(value)); // Reference
2166          return value;
2167        case 375599255: // observedGroup
2168          this.observedGroup = TypeConvertor.castToReference(value); // Reference
2169          return value;
2170        default: return super.setProperty(hash, name, value);
2171        }
2172
2173      }
2174
2175      @Override
2176      public Base setProperty(String name, Base value) throws FHIRException {
2177        if (name.equals("identifier[x]")) {
2178          this.identifier = TypeConvertor.castToType(value); // DataType
2179        } else if (name.equals("name")) {
2180          this.name = TypeConvertor.castToString(value); // StringType
2181        } else if (name.equals("type")) {
2182          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2183        } else if (name.equals("description")) {
2184          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2185        } else if (name.equals("intendedExposure")) {
2186          this.getIntendedExposure().add(TypeConvertor.castToReference(value));
2187        } else if (name.equals("observedGroup")) {
2188          this.observedGroup = TypeConvertor.castToReference(value); // Reference
2189        } else
2190          return super.setProperty(name, value);
2191        return value;
2192      }
2193
2194      @Override
2195      public Base makeProperty(int hash, String name) throws FHIRException {
2196        switch (hash) {
2197        case 569772855:  return getIdentifier();
2198        case -1618432855:  return getIdentifier();
2199        case 3373707:  return getNameElement();
2200        case 3575610:  return getType();
2201        case -1724546052:  return getDescriptionElement();
2202        case -407218606:  return addIntendedExposure(); 
2203        case 375599255:  return getObservedGroup();
2204        default: return super.makeProperty(hash, name);
2205        }
2206
2207      }
2208
2209      @Override
2210      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2211        switch (hash) {
2212        case -1618432855: /*identifier*/ return new String[] {"uri", "Identifier"};
2213        case 3373707: /*name*/ return new String[] {"string"};
2214        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2215        case -1724546052: /*description*/ return new String[] {"markdown"};
2216        case -407218606: /*intendedExposure*/ return new String[] {"Reference"};
2217        case 375599255: /*observedGroup*/ return new String[] {"Reference"};
2218        default: return super.getTypesForProperty(hash, name);
2219        }
2220
2221      }
2222
2223      @Override
2224      public Base addChild(String name) throws FHIRException {
2225        if (name.equals("identifierUri")) {
2226          this.identifier = new UriType();
2227          return this.identifier;
2228        }
2229        else if (name.equals("identifierIdentifier")) {
2230          this.identifier = new Identifier();
2231          return this.identifier;
2232        }
2233        else if (name.equals("name")) {
2234          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.comparisonGroup.name");
2235        }
2236        else if (name.equals("type")) {
2237          this.type = new CodeableConcept();
2238          return this.type;
2239        }
2240        else if (name.equals("description")) {
2241          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.comparisonGroup.description");
2242        }
2243        else if (name.equals("intendedExposure")) {
2244          return addIntendedExposure();
2245        }
2246        else if (name.equals("observedGroup")) {
2247          this.observedGroup = new Reference();
2248          return this.observedGroup;
2249        }
2250        else
2251          return super.addChild(name);
2252      }
2253
2254      public ResearchStudyComparisonGroupComponent copy() {
2255        ResearchStudyComparisonGroupComponent dst = new ResearchStudyComparisonGroupComponent();
2256        copyValues(dst);
2257        return dst;
2258      }
2259
2260      public void copyValues(ResearchStudyComparisonGroupComponent dst) {
2261        super.copyValues(dst);
2262        dst.identifier = identifier == null ? null : identifier.copy();
2263        dst.name = name == null ? null : name.copy();
2264        dst.type = type == null ? null : type.copy();
2265        dst.description = description == null ? null : description.copy();
2266        if (intendedExposure != null) {
2267          dst.intendedExposure = new ArrayList<Reference>();
2268          for (Reference i : intendedExposure)
2269            dst.intendedExposure.add(i.copy());
2270        };
2271        dst.observedGroup = observedGroup == null ? null : observedGroup.copy();
2272      }
2273
2274      @Override
2275      public boolean equalsDeep(Base other_) {
2276        if (!super.equalsDeep(other_))
2277          return false;
2278        if (!(other_ instanceof ResearchStudyComparisonGroupComponent))
2279          return false;
2280        ResearchStudyComparisonGroupComponent o = (ResearchStudyComparisonGroupComponent) other_;
2281        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(type, o.type, true)
2282           && compareDeep(description, o.description, true) && compareDeep(intendedExposure, o.intendedExposure, true)
2283           && compareDeep(observedGroup, o.observedGroup, true);
2284      }
2285
2286      @Override
2287      public boolean equalsShallow(Base other_) {
2288        if (!super.equalsShallow(other_))
2289          return false;
2290        if (!(other_ instanceof ResearchStudyComparisonGroupComponent))
2291          return false;
2292        ResearchStudyComparisonGroupComponent o = (ResearchStudyComparisonGroupComponent) other_;
2293        return compareValues(name, o.name, true) && compareValues(description, o.description, true);
2294      }
2295
2296      public boolean isEmpty() {
2297        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, type, description
2298          , intendedExposure, observedGroup);
2299      }
2300
2301  public String fhirType() {
2302    return "ResearchStudy.comparisonGroup";
2303
2304  }
2305
2306  }
2307
2308    @Block()
2309    public static class ResearchStudyObjectiveComponent extends BackboneElement implements IBaseBackboneElement {
2310        /**
2311         * Unique, human-readable label for this objective of the study.
2312         */
2313        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2314        @Description(shortDefinition="Label for the objective", formalDefinition="Unique, human-readable label for this objective of the study." )
2315        protected StringType name;
2316
2317        /**
2318         * The kind of study objective.
2319         */
2320        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2321        @Description(shortDefinition="primary | secondary | exploratory", formalDefinition="The kind of study objective." )
2322        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-objective-type")
2323        protected CodeableConcept type;
2324
2325        /**
2326         * Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).
2327         */
2328        @Child(name = "description", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2329        @Description(shortDefinition="Description of the objective", formalDefinition="Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description)." )
2330        protected MarkdownType description;
2331
2332        private static final long serialVersionUID = -1976083810L;
2333
2334    /**
2335     * Constructor
2336     */
2337      public ResearchStudyObjectiveComponent() {
2338        super();
2339      }
2340
2341        /**
2342         * @return {@link #name} (Unique, human-readable label for this objective of the study.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2343         */
2344        public StringType getNameElement() { 
2345          if (this.name == null)
2346            if (Configuration.errorOnAutoCreate())
2347              throw new Error("Attempt to auto-create ResearchStudyObjectiveComponent.name");
2348            else if (Configuration.doAutoCreate())
2349              this.name = new StringType(); // bb
2350          return this.name;
2351        }
2352
2353        public boolean hasNameElement() { 
2354          return this.name != null && !this.name.isEmpty();
2355        }
2356
2357        public boolean hasName() { 
2358          return this.name != null && !this.name.isEmpty();
2359        }
2360
2361        /**
2362         * @param value {@link #name} (Unique, human-readable label for this objective of the study.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2363         */
2364        public ResearchStudyObjectiveComponent setNameElement(StringType value) { 
2365          this.name = value;
2366          return this;
2367        }
2368
2369        /**
2370         * @return Unique, human-readable label for this objective of the study.
2371         */
2372        public String getName() { 
2373          return this.name == null ? null : this.name.getValue();
2374        }
2375
2376        /**
2377         * @param value Unique, human-readable label for this objective of the study.
2378         */
2379        public ResearchStudyObjectiveComponent setName(String value) { 
2380          if (Utilities.noString(value))
2381            this.name = null;
2382          else {
2383            if (this.name == null)
2384              this.name = new StringType();
2385            this.name.setValue(value);
2386          }
2387          return this;
2388        }
2389
2390        /**
2391         * @return {@link #type} (The kind of study objective.)
2392         */
2393        public CodeableConcept getType() { 
2394          if (this.type == null)
2395            if (Configuration.errorOnAutoCreate())
2396              throw new Error("Attempt to auto-create ResearchStudyObjectiveComponent.type");
2397            else if (Configuration.doAutoCreate())
2398              this.type = new CodeableConcept(); // cc
2399          return this.type;
2400        }
2401
2402        public boolean hasType() { 
2403          return this.type != null && !this.type.isEmpty();
2404        }
2405
2406        /**
2407         * @param value {@link #type} (The kind of study objective.)
2408         */
2409        public ResearchStudyObjectiveComponent setType(CodeableConcept value) { 
2410          this.type = value;
2411          return this;
2412        }
2413
2414        /**
2415         * @return {@link #description} (Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2416         */
2417        public MarkdownType getDescriptionElement() { 
2418          if (this.description == null)
2419            if (Configuration.errorOnAutoCreate())
2420              throw new Error("Attempt to auto-create ResearchStudyObjectiveComponent.description");
2421            else if (Configuration.doAutoCreate())
2422              this.description = new MarkdownType(); // bb
2423          return this.description;
2424        }
2425
2426        public boolean hasDescriptionElement() { 
2427          return this.description != null && !this.description.isEmpty();
2428        }
2429
2430        public boolean hasDescription() { 
2431          return this.description != null && !this.description.isEmpty();
2432        }
2433
2434        /**
2435         * @param value {@link #description} (Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2436         */
2437        public ResearchStudyObjectiveComponent setDescriptionElement(MarkdownType value) { 
2438          this.description = value;
2439          return this;
2440        }
2441
2442        /**
2443         * @return Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).
2444         */
2445        public String getDescription() { 
2446          return this.description == null ? null : this.description.getValue();
2447        }
2448
2449        /**
2450         * @param value Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).
2451         */
2452        public ResearchStudyObjectiveComponent setDescription(String value) { 
2453          if (value == null)
2454            this.description = null;
2455          else {
2456            if (this.description == null)
2457              this.description = new MarkdownType();
2458            this.description.setValue(value);
2459          }
2460          return this;
2461        }
2462
2463        protected void listChildren(List<Property> children) {
2464          super.listChildren(children);
2465          children.add(new Property("name", "string", "Unique, human-readable label for this objective of the study.", 0, 1, name));
2466          children.add(new Property("type", "CodeableConcept", "The kind of study objective.", 0, 1, type));
2467          children.add(new Property("description", "markdown", "Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).", 0, 1, description));
2468        }
2469
2470        @Override
2471        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2472          switch (_hash) {
2473          case 3373707: /*name*/  return new Property("name", "string", "Unique, human-readable label for this objective of the study.", 0, 1, name);
2474          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of study objective.", 0, 1, type);
2475          case -1724546052: /*description*/  return new Property("description", "markdown", "Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.description).", 0, 1, description);
2476          default: return super.getNamedProperty(_hash, _name, _checkValid);
2477          }
2478
2479        }
2480
2481      @Override
2482      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2483        switch (hash) {
2484        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2485        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2486        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2487        default: return super.getProperty(hash, name, checkValid);
2488        }
2489
2490      }
2491
2492      @Override
2493      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2494        switch (hash) {
2495        case 3373707: // name
2496          this.name = TypeConvertor.castToString(value); // StringType
2497          return value;
2498        case 3575610: // type
2499          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2500          return value;
2501        case -1724546052: // description
2502          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2503          return value;
2504        default: return super.setProperty(hash, name, value);
2505        }
2506
2507      }
2508
2509      @Override
2510      public Base setProperty(String name, Base value) throws FHIRException {
2511        if (name.equals("name")) {
2512          this.name = TypeConvertor.castToString(value); // StringType
2513        } else if (name.equals("type")) {
2514          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2515        } else if (name.equals("description")) {
2516          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2517        } else
2518          return super.setProperty(name, value);
2519        return value;
2520      }
2521
2522      @Override
2523      public Base makeProperty(int hash, String name) throws FHIRException {
2524        switch (hash) {
2525        case 3373707:  return getNameElement();
2526        case 3575610:  return getType();
2527        case -1724546052:  return getDescriptionElement();
2528        default: return super.makeProperty(hash, name);
2529        }
2530
2531      }
2532
2533      @Override
2534      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2535        switch (hash) {
2536        case 3373707: /*name*/ return new String[] {"string"};
2537        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2538        case -1724546052: /*description*/ return new String[] {"markdown"};
2539        default: return super.getTypesForProperty(hash, name);
2540        }
2541
2542      }
2543
2544      @Override
2545      public Base addChild(String name) throws FHIRException {
2546        if (name.equals("name")) {
2547          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.objective.name");
2548        }
2549        else if (name.equals("type")) {
2550          this.type = new CodeableConcept();
2551          return this.type;
2552        }
2553        else if (name.equals("description")) {
2554          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.objective.description");
2555        }
2556        else
2557          return super.addChild(name);
2558      }
2559
2560      public ResearchStudyObjectiveComponent copy() {
2561        ResearchStudyObjectiveComponent dst = new ResearchStudyObjectiveComponent();
2562        copyValues(dst);
2563        return dst;
2564      }
2565
2566      public void copyValues(ResearchStudyObjectiveComponent dst) {
2567        super.copyValues(dst);
2568        dst.name = name == null ? null : name.copy();
2569        dst.type = type == null ? null : type.copy();
2570        dst.description = description == null ? null : description.copy();
2571      }
2572
2573      @Override
2574      public boolean equalsDeep(Base other_) {
2575        if (!super.equalsDeep(other_))
2576          return false;
2577        if (!(other_ instanceof ResearchStudyObjectiveComponent))
2578          return false;
2579        ResearchStudyObjectiveComponent o = (ResearchStudyObjectiveComponent) other_;
2580        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(description, o.description, true)
2581          ;
2582      }
2583
2584      @Override
2585      public boolean equalsShallow(Base other_) {
2586        if (!super.equalsShallow(other_))
2587          return false;
2588        if (!(other_ instanceof ResearchStudyObjectiveComponent))
2589          return false;
2590        ResearchStudyObjectiveComponent o = (ResearchStudyObjectiveComponent) other_;
2591        return compareValues(name, o.name, true) && compareValues(description, o.description, true);
2592      }
2593
2594      public boolean isEmpty() {
2595        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, description
2596          );
2597      }
2598
2599  public String fhirType() {
2600    return "ResearchStudy.objective";
2601
2602  }
2603
2604  }
2605
2606    @Block()
2607    public static class ResearchStudyOutcomeMeasureComponent extends BackboneElement implements IBaseBackboneElement {
2608        /**
2609         * Label for the outcome.
2610         */
2611        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2612        @Description(shortDefinition="Label for the outcome", formalDefinition="Label for the outcome." )
2613        protected StringType name;
2614
2615        /**
2616         * The parameter or characteristic being assessed as one of the values by which the study is assessed.
2617         */
2618        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2619        @Description(shortDefinition="primary | secondary | exploratory", formalDefinition="The parameter or characteristic being assessed as one of the values by which the study is assessed." )
2620        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-objective-type")
2621        protected List<CodeableConcept> type;
2622
2623        /**
2624         * Description of the outcome.
2625         */
2626        @Child(name = "description", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2627        @Description(shortDefinition="Description of the outcome", formalDefinition="Description of the outcome." )
2628        protected MarkdownType description;
2629
2630        /**
2631         * Structured outcome definition.
2632         */
2633        @Child(name = "reference", type = {EvidenceVariable.class}, order=4, min=0, max=1, modifier=false, summary=false)
2634        @Description(shortDefinition="Structured outcome definition", formalDefinition="Structured outcome definition." )
2635        protected Reference reference;
2636
2637        private static final long serialVersionUID = 1786559672L;
2638
2639    /**
2640     * Constructor
2641     */
2642      public ResearchStudyOutcomeMeasureComponent() {
2643        super();
2644      }
2645
2646        /**
2647         * @return {@link #name} (Label for the outcome.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2648         */
2649        public StringType getNameElement() { 
2650          if (this.name == null)
2651            if (Configuration.errorOnAutoCreate())
2652              throw new Error("Attempt to auto-create ResearchStudyOutcomeMeasureComponent.name");
2653            else if (Configuration.doAutoCreate())
2654              this.name = new StringType(); // bb
2655          return this.name;
2656        }
2657
2658        public boolean hasNameElement() { 
2659          return this.name != null && !this.name.isEmpty();
2660        }
2661
2662        public boolean hasName() { 
2663          return this.name != null && !this.name.isEmpty();
2664        }
2665
2666        /**
2667         * @param value {@link #name} (Label for the outcome.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2668         */
2669        public ResearchStudyOutcomeMeasureComponent setNameElement(StringType value) { 
2670          this.name = value;
2671          return this;
2672        }
2673
2674        /**
2675         * @return Label for the outcome.
2676         */
2677        public String getName() { 
2678          return this.name == null ? null : this.name.getValue();
2679        }
2680
2681        /**
2682         * @param value Label for the outcome.
2683         */
2684        public ResearchStudyOutcomeMeasureComponent setName(String value) { 
2685          if (Utilities.noString(value))
2686            this.name = null;
2687          else {
2688            if (this.name == null)
2689              this.name = new StringType();
2690            this.name.setValue(value);
2691          }
2692          return this;
2693        }
2694
2695        /**
2696         * @return {@link #type} (The parameter or characteristic being assessed as one of the values by which the study is assessed.)
2697         */
2698        public List<CodeableConcept> getType() { 
2699          if (this.type == null)
2700            this.type = new ArrayList<CodeableConcept>();
2701          return this.type;
2702        }
2703
2704        /**
2705         * @return Returns a reference to <code>this</code> for easy method chaining
2706         */
2707        public ResearchStudyOutcomeMeasureComponent setType(List<CodeableConcept> theType) { 
2708          this.type = theType;
2709          return this;
2710        }
2711
2712        public boolean hasType() { 
2713          if (this.type == null)
2714            return false;
2715          for (CodeableConcept item : this.type)
2716            if (!item.isEmpty())
2717              return true;
2718          return false;
2719        }
2720
2721        public CodeableConcept addType() { //3
2722          CodeableConcept t = new CodeableConcept();
2723          if (this.type == null)
2724            this.type = new ArrayList<CodeableConcept>();
2725          this.type.add(t);
2726          return t;
2727        }
2728
2729        public ResearchStudyOutcomeMeasureComponent addType(CodeableConcept t) { //3
2730          if (t == null)
2731            return this;
2732          if (this.type == null)
2733            this.type = new ArrayList<CodeableConcept>();
2734          this.type.add(t);
2735          return this;
2736        }
2737
2738        /**
2739         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2740         */
2741        public CodeableConcept getTypeFirstRep() { 
2742          if (getType().isEmpty()) {
2743            addType();
2744          }
2745          return getType().get(0);
2746        }
2747
2748        /**
2749         * @return {@link #description} (Description of the outcome.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2750         */
2751        public MarkdownType getDescriptionElement() { 
2752          if (this.description == null)
2753            if (Configuration.errorOnAutoCreate())
2754              throw new Error("Attempt to auto-create ResearchStudyOutcomeMeasureComponent.description");
2755            else if (Configuration.doAutoCreate())
2756              this.description = new MarkdownType(); // bb
2757          return this.description;
2758        }
2759
2760        public boolean hasDescriptionElement() { 
2761          return this.description != null && !this.description.isEmpty();
2762        }
2763
2764        public boolean hasDescription() { 
2765          return this.description != null && !this.description.isEmpty();
2766        }
2767
2768        /**
2769         * @param value {@link #description} (Description of the outcome.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2770         */
2771        public ResearchStudyOutcomeMeasureComponent setDescriptionElement(MarkdownType value) { 
2772          this.description = value;
2773          return this;
2774        }
2775
2776        /**
2777         * @return Description of the outcome.
2778         */
2779        public String getDescription() { 
2780          return this.description == null ? null : this.description.getValue();
2781        }
2782
2783        /**
2784         * @param value Description of the outcome.
2785         */
2786        public ResearchStudyOutcomeMeasureComponent setDescription(String value) { 
2787          if (value == null)
2788            this.description = null;
2789          else {
2790            if (this.description == null)
2791              this.description = new MarkdownType();
2792            this.description.setValue(value);
2793          }
2794          return this;
2795        }
2796
2797        /**
2798         * @return {@link #reference} (Structured outcome definition.)
2799         */
2800        public Reference getReference() { 
2801          if (this.reference == null)
2802            if (Configuration.errorOnAutoCreate())
2803              throw new Error("Attempt to auto-create ResearchStudyOutcomeMeasureComponent.reference");
2804            else if (Configuration.doAutoCreate())
2805              this.reference = new Reference(); // cc
2806          return this.reference;
2807        }
2808
2809        public boolean hasReference() { 
2810          return this.reference != null && !this.reference.isEmpty();
2811        }
2812
2813        /**
2814         * @param value {@link #reference} (Structured outcome definition.)
2815         */
2816        public ResearchStudyOutcomeMeasureComponent setReference(Reference value) { 
2817          this.reference = value;
2818          return this;
2819        }
2820
2821        protected void listChildren(List<Property> children) {
2822          super.listChildren(children);
2823          children.add(new Property("name", "string", "Label for the outcome.", 0, 1, name));
2824          children.add(new Property("type", "CodeableConcept", "The parameter or characteristic being assessed as one of the values by which the study is assessed.", 0, java.lang.Integer.MAX_VALUE, type));
2825          children.add(new Property("description", "markdown", "Description of the outcome.", 0, 1, description));
2826          children.add(new Property("reference", "Reference(EvidenceVariable)", "Structured outcome definition.", 0, 1, reference));
2827        }
2828
2829        @Override
2830        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2831          switch (_hash) {
2832          case 3373707: /*name*/  return new Property("name", "string", "Label for the outcome.", 0, 1, name);
2833          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The parameter or characteristic being assessed as one of the values by which the study is assessed.", 0, java.lang.Integer.MAX_VALUE, type);
2834          case -1724546052: /*description*/  return new Property("description", "markdown", "Description of the outcome.", 0, 1, description);
2835          case -925155509: /*reference*/  return new Property("reference", "Reference(EvidenceVariable)", "Structured outcome definition.", 0, 1, reference);
2836          default: return super.getNamedProperty(_hash, _name, _checkValid);
2837          }
2838
2839        }
2840
2841      @Override
2842      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2843        switch (hash) {
2844        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2845        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2846        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2847        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
2848        default: return super.getProperty(hash, name, checkValid);
2849        }
2850
2851      }
2852
2853      @Override
2854      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2855        switch (hash) {
2856        case 3373707: // name
2857          this.name = TypeConvertor.castToString(value); // StringType
2858          return value;
2859        case 3575610: // type
2860          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2861          return value;
2862        case -1724546052: // description
2863          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2864          return value;
2865        case -925155509: // reference
2866          this.reference = TypeConvertor.castToReference(value); // Reference
2867          return value;
2868        default: return super.setProperty(hash, name, value);
2869        }
2870
2871      }
2872
2873      @Override
2874      public Base setProperty(String name, Base value) throws FHIRException {
2875        if (name.equals("name")) {
2876          this.name = TypeConvertor.castToString(value); // StringType
2877        } else if (name.equals("type")) {
2878          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2879        } else if (name.equals("description")) {
2880          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2881        } else if (name.equals("reference")) {
2882          this.reference = TypeConvertor.castToReference(value); // Reference
2883        } else
2884          return super.setProperty(name, value);
2885        return value;
2886      }
2887
2888      @Override
2889      public Base makeProperty(int hash, String name) throws FHIRException {
2890        switch (hash) {
2891        case 3373707:  return getNameElement();
2892        case 3575610:  return addType(); 
2893        case -1724546052:  return getDescriptionElement();
2894        case -925155509:  return getReference();
2895        default: return super.makeProperty(hash, name);
2896        }
2897
2898      }
2899
2900      @Override
2901      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2902        switch (hash) {
2903        case 3373707: /*name*/ return new String[] {"string"};
2904        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2905        case -1724546052: /*description*/ return new String[] {"markdown"};
2906        case -925155509: /*reference*/ return new String[] {"Reference"};
2907        default: return super.getTypesForProperty(hash, name);
2908        }
2909
2910      }
2911
2912      @Override
2913      public Base addChild(String name) throws FHIRException {
2914        if (name.equals("name")) {
2915          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.outcomeMeasure.name");
2916        }
2917        else if (name.equals("type")) {
2918          return addType();
2919        }
2920        else if (name.equals("description")) {
2921          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.outcomeMeasure.description");
2922        }
2923        else if (name.equals("reference")) {
2924          this.reference = new Reference();
2925          return this.reference;
2926        }
2927        else
2928          return super.addChild(name);
2929      }
2930
2931      public ResearchStudyOutcomeMeasureComponent copy() {
2932        ResearchStudyOutcomeMeasureComponent dst = new ResearchStudyOutcomeMeasureComponent();
2933        copyValues(dst);
2934        return dst;
2935      }
2936
2937      public void copyValues(ResearchStudyOutcomeMeasureComponent dst) {
2938        super.copyValues(dst);
2939        dst.name = name == null ? null : name.copy();
2940        if (type != null) {
2941          dst.type = new ArrayList<CodeableConcept>();
2942          for (CodeableConcept i : type)
2943            dst.type.add(i.copy());
2944        };
2945        dst.description = description == null ? null : description.copy();
2946        dst.reference = reference == null ? null : reference.copy();
2947      }
2948
2949      @Override
2950      public boolean equalsDeep(Base other_) {
2951        if (!super.equalsDeep(other_))
2952          return false;
2953        if (!(other_ instanceof ResearchStudyOutcomeMeasureComponent))
2954          return false;
2955        ResearchStudyOutcomeMeasureComponent o = (ResearchStudyOutcomeMeasureComponent) other_;
2956        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(description, o.description, true)
2957           && compareDeep(reference, o.reference, true);
2958      }
2959
2960      @Override
2961      public boolean equalsShallow(Base other_) {
2962        if (!super.equalsShallow(other_))
2963          return false;
2964        if (!(other_ instanceof ResearchStudyOutcomeMeasureComponent))
2965          return false;
2966        ResearchStudyOutcomeMeasureComponent o = (ResearchStudyOutcomeMeasureComponent) other_;
2967        return compareValues(name, o.name, true) && compareValues(description, o.description, true);
2968      }
2969
2970      public boolean isEmpty() {
2971        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, description
2972          , reference);
2973      }
2974
2975  public String fhirType() {
2976    return "ResearchStudy.outcomeMeasure";
2977
2978  }
2979
2980  }
2981
2982    @Block()
2983    public static class ResearchStudyWebLocationComponent extends BackboneElement implements IBaseBackboneElement {
2984        /**
2985         * Describes the nature of the location being specified.
2986         */
2987        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
2988        @Description(shortDefinition="registry-page|recruitment-page|contact-page", formalDefinition="Describes the nature of the location being specified." )
2989        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-url-type")
2990        protected CodeableConcept type;
2991
2992        /**
2993         * The location address.
2994         */
2995        @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2996        @Description(shortDefinition="The location address", formalDefinition="The location address." )
2997        protected UriType url;
2998
2999        private static final long serialVersionUID = 397204034L;
3000
3001    /**
3002     * Constructor
3003     */
3004      public ResearchStudyWebLocationComponent() {
3005        super();
3006      }
3007
3008    /**
3009     * Constructor
3010     */
3011      public ResearchStudyWebLocationComponent(String url) {
3012        super();
3013        this.setUrl(url);
3014      }
3015
3016        /**
3017         * @return {@link #type} (Describes the nature of the location being specified.)
3018         */
3019        public CodeableConcept getType() { 
3020          if (this.type == null)
3021            if (Configuration.errorOnAutoCreate())
3022              throw new Error("Attempt to auto-create ResearchStudyWebLocationComponent.type");
3023            else if (Configuration.doAutoCreate())
3024              this.type = new CodeableConcept(); // cc
3025          return this.type;
3026        }
3027
3028        public boolean hasType() { 
3029          return this.type != null && !this.type.isEmpty();
3030        }
3031
3032        /**
3033         * @param value {@link #type} (Describes the nature of the location being specified.)
3034         */
3035        public ResearchStudyWebLocationComponent setType(CodeableConcept value) { 
3036          this.type = value;
3037          return this;
3038        }
3039
3040        /**
3041         * @return {@link #url} (The location address.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3042         */
3043        public UriType getUrlElement() { 
3044          if (this.url == null)
3045            if (Configuration.errorOnAutoCreate())
3046              throw new Error("Attempt to auto-create ResearchStudyWebLocationComponent.url");
3047            else if (Configuration.doAutoCreate())
3048              this.url = new UriType(); // bb
3049          return this.url;
3050        }
3051
3052        public boolean hasUrlElement() { 
3053          return this.url != null && !this.url.isEmpty();
3054        }
3055
3056        public boolean hasUrl() { 
3057          return this.url != null && !this.url.isEmpty();
3058        }
3059
3060        /**
3061         * @param value {@link #url} (The location address.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3062         */
3063        public ResearchStudyWebLocationComponent setUrlElement(UriType value) { 
3064          this.url = value;
3065          return this;
3066        }
3067
3068        /**
3069         * @return The location address.
3070         */
3071        public String getUrl() { 
3072          return this.url == null ? null : this.url.getValue();
3073        }
3074
3075        /**
3076         * @param value The location address.
3077         */
3078        public ResearchStudyWebLocationComponent setUrl(String value) { 
3079            if (this.url == null)
3080              this.url = new UriType();
3081            this.url.setValue(value);
3082          return this;
3083        }
3084
3085        protected void listChildren(List<Property> children) {
3086          super.listChildren(children);
3087          children.add(new Property("type", "CodeableConcept", "Describes the nature of the location being specified.", 0, 1, type));
3088          children.add(new Property("url", "uri", "The location address.", 0, 1, url));
3089        }
3090
3091        @Override
3092        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3093          switch (_hash) {
3094          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Describes the nature of the location being specified.", 0, 1, type);
3095          case 116079: /*url*/  return new Property("url", "uri", "The location address.", 0, 1, url);
3096          default: return super.getNamedProperty(_hash, _name, _checkValid);
3097          }
3098
3099        }
3100
3101      @Override
3102      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3103        switch (hash) {
3104        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3105        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3106        default: return super.getProperty(hash, name, checkValid);
3107        }
3108
3109      }
3110
3111      @Override
3112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3113        switch (hash) {
3114        case 3575610: // type
3115          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3116          return value;
3117        case 116079: // url
3118          this.url = TypeConvertor.castToUri(value); // UriType
3119          return value;
3120        default: return super.setProperty(hash, name, value);
3121        }
3122
3123      }
3124
3125      @Override
3126      public Base setProperty(String name, Base value) throws FHIRException {
3127        if (name.equals("type")) {
3128          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3129        } else if (name.equals("url")) {
3130          this.url = TypeConvertor.castToUri(value); // UriType
3131        } else
3132          return super.setProperty(name, value);
3133        return value;
3134      }
3135
3136      @Override
3137      public Base makeProperty(int hash, String name) throws FHIRException {
3138        switch (hash) {
3139        case 3575610:  return getType();
3140        case 116079:  return getUrlElement();
3141        default: return super.makeProperty(hash, name);
3142        }
3143
3144      }
3145
3146      @Override
3147      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3148        switch (hash) {
3149        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3150        case 116079: /*url*/ return new String[] {"uri"};
3151        default: return super.getTypesForProperty(hash, name);
3152        }
3153
3154      }
3155
3156      @Override
3157      public Base addChild(String name) throws FHIRException {
3158        if (name.equals("type")) {
3159          this.type = new CodeableConcept();
3160          return this.type;
3161        }
3162        else if (name.equals("url")) {
3163          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.webLocation.url");
3164        }
3165        else
3166          return super.addChild(name);
3167      }
3168
3169      public ResearchStudyWebLocationComponent copy() {
3170        ResearchStudyWebLocationComponent dst = new ResearchStudyWebLocationComponent();
3171        copyValues(dst);
3172        return dst;
3173      }
3174
3175      public void copyValues(ResearchStudyWebLocationComponent dst) {
3176        super.copyValues(dst);
3177        dst.type = type == null ? null : type.copy();
3178        dst.url = url == null ? null : url.copy();
3179      }
3180
3181      @Override
3182      public boolean equalsDeep(Base other_) {
3183        if (!super.equalsDeep(other_))
3184          return false;
3185        if (!(other_ instanceof ResearchStudyWebLocationComponent))
3186          return false;
3187        ResearchStudyWebLocationComponent o = (ResearchStudyWebLocationComponent) other_;
3188        return compareDeep(type, o.type, true) && compareDeep(url, o.url, true);
3189      }
3190
3191      @Override
3192      public boolean equalsShallow(Base other_) {
3193        if (!super.equalsShallow(other_))
3194          return false;
3195        if (!(other_ instanceof ResearchStudyWebLocationComponent))
3196          return false;
3197        ResearchStudyWebLocationComponent o = (ResearchStudyWebLocationComponent) other_;
3198        return compareValues(url, o.url, true);
3199      }
3200
3201      public boolean isEmpty() {
3202        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, url);
3203      }
3204
3205  public String fhirType() {
3206    return "ResearchStudy.webLocation";
3207
3208  }
3209
3210  }
3211
3212    /**
3213     * Canonical identifier for this study resource, represented as a globally unique URI.
3214     */
3215    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=false)
3216    @Description(shortDefinition="Canonical identifier for this study resource", formalDefinition="Canonical identifier for this study resource, represented as a globally unique URI." )
3217    protected UriType url;
3218
3219    /**
3220     * Identifiers assigned to this research study by the sponsor or other systems.
3221     */
3222    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3223    @Description(shortDefinition="Business Identifier for study", formalDefinition="Identifiers assigned to this research study by the sponsor or other systems." )
3224    protected List<Identifier> identifier;
3225
3226    /**
3227     * Business identifier for the study record.
3228     */
3229    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
3230    @Description(shortDefinition="Business identifier for the study record", formalDefinition="Business identifier for the study record." )
3231    protected StringType version;
3232
3233    /**
3234     * Name for this study (computer friendly).
3235     */
3236    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3237    @Description(shortDefinition="Name for this study (computer friendly)", formalDefinition="Name for this study (computer friendly)." )
3238    protected StringType name;
3239
3240    /**
3241     * A short, descriptive label for the study particularly for compouter use.
3242     */
3243    @Child(name = "title", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3244    @Description(shortDefinition="Name for this study (for computers)", formalDefinition="A short, descriptive label for the study particularly for compouter use." )
3245    protected StringType title;
3246
3247    /**
3248     * Additional names for the study.
3249     */
3250    @Child(name = "label", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3251    @Description(shortDefinition="Additional names for the study", formalDefinition="Additional names for the study." )
3252    protected List<ResearchStudyLabelComponent> label;
3253
3254    /**
3255     * The set of steps expected to be performed as part of the execution of the study.
3256     */
3257    @Child(name = "protocol", type = {PlanDefinition.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3258    @Description(shortDefinition="Steps followed in executing study", formalDefinition="The set of steps expected to be performed as part of the execution of the study." )
3259    protected List<Reference> protocol;
3260
3261    /**
3262     * A larger research study of which this particular study is a component or step.
3263     */
3264    @Child(name = "partOf", type = {ResearchStudy.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3265    @Description(shortDefinition="Part of larger study", formalDefinition="A larger research study of which this particular study is a component or step." )
3266    protected List<Reference> partOf;
3267
3268    /**
3269     * Citations, references and other related documents.
3270     */
3271    @Child(name = "relatedArtifact", type = {RelatedArtifact.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3272    @Description(shortDefinition="References and dependencies", formalDefinition="Citations, references and other related documents." )
3273    protected List<RelatedArtifact> relatedArtifact;
3274
3275    /**
3276     * Date the resource last changed.
3277     */
3278    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
3279    @Description(shortDefinition="Date the resource last changed", formalDefinition="Date the resource last changed." )
3280    protected DateTimeType date;
3281
3282    /**
3283     * The publication state of the resource (not of the study).
3284     */
3285    @Child(name = "status", type = {CodeType.class}, order=10, min=1, max=1, modifier=true, summary=true)
3286    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The publication state of the resource (not of the study)." )
3287    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
3288    protected Enumeration<PublicationStatus> status;
3289
3290    /**
3291     * The type of study based upon the intent of the study activities. A classification of the intent of the study.
3292     */
3293    @Child(name = "primaryPurposeType", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true)
3294    @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 activities. A classification of the intent of the study." )
3295    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-prim-purp-type")
3296    protected CodeableConcept primaryPurposeType;
3297
3298    /**
3299     * The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.
3300     */
3301    @Child(name = "phase", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=true)
3302    @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." )
3303    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-phase")
3304    protected CodeableConcept phase;
3305
3306    /**
3307     * Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.
3308     */
3309    @Child(name = "category", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3310    @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." )
3311    protected List<CodeableConcept> category;
3312
3313    /**
3314     * The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.
3315     */
3316    @Child(name = "focus", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3317    @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." )
3318    protected List<ResearchStudyFocusComponent> focus;
3319
3320    /**
3321     * 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.
3322     */
3323    @Child(name = "condition", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3324    @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." )
3325    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
3326    protected List<CodeableConcept> condition;
3327
3328    /**
3329     * Key terms to aid in searching for or filtering the study.
3330     */
3331    @Child(name = "keyword", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3332    @Description(shortDefinition="Used to search for the study", formalDefinition="Key terms to aid in searching for or filtering the study." )
3333    protected List<CodeableConcept> keyword;
3334
3335    /**
3336     * Indicates a country, state or other region where the study is taking place.
3337     */
3338    @Child(name = "location", type = {CodeableConcept.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3339    @Description(shortDefinition="Geographic region(s) for study", formalDefinition="Indicates a country, state or other region where the study is taking place." )
3340    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
3341    protected List<CodeableConcept> location;
3342
3343    /**
3344     * A brief summary of the study description.
3345     */
3346    @Child(name = "descriptionSummary", type = {MarkdownType.class}, order=18, min=0, max=1, modifier=false, summary=false)
3347    @Description(shortDefinition="A brief summary of the study description", formalDefinition="A brief summary of the study description." )
3348    protected MarkdownType descriptionSummary;
3349
3350    /**
3351     * A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.
3352     */
3353    @Child(name = "description", type = {MarkdownType.class}, order=19, min=0, max=1, modifier=false, summary=false)
3354    @Description(shortDefinition="What this is study doing", formalDefinition="A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description." )
3355    protected MarkdownType description;
3356
3357    /**
3358     * Identifies the start date and the expected (or actual, depending on status) end date for the study.
3359     */
3360    @Child(name = "period", type = {Period.class}, order=20, min=0, max=1, modifier=false, summary=true)
3361    @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." )
3362    protected Period period;
3363
3364    /**
3365     * Contact details to assist a user in learning more about or engaging with the study.
3366     */
3367    @Child(name = "contact", type = {ContactDetail.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3368    @Description(shortDefinition="Contact details for the study", formalDefinition="Contact details to assist a user in learning more about or engaging with the study." )
3369    protected List<ContactDetail> contact;
3370
3371    /**
3372     * An organization that initiates the investigation and is legally responsible for the study.
3373     */
3374    @Child(name = "sponsor", type = {Organization.class}, order=22, min=0, max=1, modifier=false, summary=true)
3375    @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." )
3376    protected Reference sponsor;
3377
3378    /**
3379     * 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.
3380     */
3381    @Child(name = "principalInvestigator", type = {Practitioner.class, PractitionerRole.class}, order=23, min=0, max=1, modifier=false, summary=true)
3382    @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." )
3383    protected Reference principalInvestigator;
3384
3385    /**
3386     * A facility in which study activities are conducted.
3387     */
3388    @Child(name = "site", type = {Location.class, ResearchStudy.class, Organization.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3389    @Description(shortDefinition="Facility where study activities are conducted", formalDefinition="A facility in which study activities are conducted." )
3390    protected List<Reference> site;
3391
3392    /**
3393     * Comments made about the study by the performer, subject or other participants.
3394     */
3395    @Child(name = "note", type = {Annotation.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3396    @Description(shortDefinition="Comments made about the study", formalDefinition="Comments made about the study by the performer, subject or other participants." )
3397    protected List<Annotation> note;
3398
3399    /**
3400     * Classification for the study.
3401     */
3402    @Child(name = "classification", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3403    @Description(shortDefinition="Classification for the study", formalDefinition="Classification for the study." )
3404    protected List<ResearchStudyClassificationComponent> classification;
3405
3406    /**
3407     * Sponsors, collaborators, and other parties.
3408     */
3409    @Child(name = "associatedParty", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3410    @Description(shortDefinition="Sponsors, collaborators, and other parties", formalDefinition="Sponsors, collaborators, and other parties." )
3411    protected List<ResearchStudyAssociatedPartyComponent> associatedParty;
3412
3413    /**
3414     * Current status of the study.
3415     */
3416    @Child(name = "currentState", type = {CodeableConcept.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3417    @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="Current status of the study." )
3418    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-status")
3419    protected List<CodeableConcept> currentState;
3420
3421    /**
3422     * Status of study with time for that status.
3423     */
3424    @Child(name = "statusDate", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3425    @Description(shortDefinition="Status of study with time for that status", formalDefinition="Status of study with time for that status." )
3426    protected List<ResearchStudyStatusDateComponent> statusDate;
3427
3428    /**
3429     * A description and/or code explaining the premature termination of the study.
3430     */
3431    @Child(name = "whyStopped", type = {CodeableConcept.class}, order=30, min=0, max=1, modifier=false, summary=true)
3432    @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." )
3433    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-study-reason-stopped")
3434    protected CodeableConcept whyStopped;
3435
3436    /**
3437     * Target or actual group of participants enrolled in study.
3438     */
3439    @Child(name = "recruitment", type = {}, order=31, min=0, max=1, modifier=false, summary=true)
3440    @Description(shortDefinition="Target or actual group of participants enrolled in study", formalDefinition="Target or actual group of participants enrolled in study." )
3441    protected ResearchStudyRecruitmentComponent recruitment;
3442
3443    /**
3444     * 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.
3445     */
3446    @Child(name = "comparisonGroup", type = {}, order=32, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3447    @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." )
3448    protected List<ResearchStudyComparisonGroupComponent> comparisonGroup;
3449
3450    /**
3451     * 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.
3452     */
3453    @Child(name = "objective", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3454    @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." )
3455    protected List<ResearchStudyObjectiveComponent> objective;
3456
3457    /**
3458     * An outcome or planned variable to measure during the study.
3459     */
3460    @Child(name = "outcomeMeasure", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3461    @Description(shortDefinition="An outcome or planned variable to measure during the study", formalDefinition="An outcome or planned variable to measure during the study." )
3462    protected List<ResearchStudyOutcomeMeasureComponent> outcomeMeasure;
3463
3464    /**
3465     * Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov.
3466     */
3467    @Child(name = "result", type = {EvidenceReport.class, Citation.class, DiagnosticReport.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3468    @Description(shortDefinition="Link to results generated during the study", formalDefinition="Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov." )
3469    protected List<Reference> result;
3470
3471    /**
3472     * A general storage or archive location for the study.  This may contain an assortment of content which is not specified in advance.
3473     */
3474    @Child(name = "webLocation", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3475    @Description(shortDefinition="Archive location for the study", formalDefinition="A general storage or archive location for the study.  This may contain an assortment of content which is not specified in advance." )
3476    protected List<ResearchStudyWebLocationComponent> webLocation;
3477
3478    private static final long serialVersionUID = 1378717503L;
3479
3480  /**
3481   * Constructor
3482   */
3483    public ResearchStudy() {
3484      super();
3485    }
3486
3487  /**
3488   * Constructor
3489   */
3490    public ResearchStudy(PublicationStatus status) {
3491      super();
3492      this.setStatus(status);
3493    }
3494
3495    /**
3496     * @return {@link #url} (Canonical identifier for this study resource, represented as a globally unique URI.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3497     */
3498    public UriType getUrlElement() { 
3499      if (this.url == null)
3500        if (Configuration.errorOnAutoCreate())
3501          throw new Error("Attempt to auto-create ResearchStudy.url");
3502        else if (Configuration.doAutoCreate())
3503          this.url = new UriType(); // bb
3504      return this.url;
3505    }
3506
3507    public boolean hasUrlElement() { 
3508      return this.url != null && !this.url.isEmpty();
3509    }
3510
3511    public boolean hasUrl() { 
3512      return this.url != null && !this.url.isEmpty();
3513    }
3514
3515    /**
3516     * @param value {@link #url} (Canonical identifier for this study resource, represented as a globally unique URI.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3517     */
3518    public ResearchStudy setUrlElement(UriType value) { 
3519      this.url = value;
3520      return this;
3521    }
3522
3523    /**
3524     * @return Canonical identifier for this study resource, represented as a globally unique URI.
3525     */
3526    public String getUrl() { 
3527      return this.url == null ? null : this.url.getValue();
3528    }
3529
3530    /**
3531     * @param value Canonical identifier for this study resource, represented as a globally unique URI.
3532     */
3533    public ResearchStudy setUrl(String value) { 
3534      if (Utilities.noString(value))
3535        this.url = null;
3536      else {
3537        if (this.url == null)
3538          this.url = new UriType();
3539        this.url.setValue(value);
3540      }
3541      return this;
3542    }
3543
3544    /**
3545     * @return {@link #identifier} (Identifiers assigned to this research study by the sponsor or other systems.)
3546     */
3547    public List<Identifier> getIdentifier() { 
3548      if (this.identifier == null)
3549        this.identifier = new ArrayList<Identifier>();
3550      return this.identifier;
3551    }
3552
3553    /**
3554     * @return Returns a reference to <code>this</code> for easy method chaining
3555     */
3556    public ResearchStudy setIdentifier(List<Identifier> theIdentifier) { 
3557      this.identifier = theIdentifier;
3558      return this;
3559    }
3560
3561    public boolean hasIdentifier() { 
3562      if (this.identifier == null)
3563        return false;
3564      for (Identifier item : this.identifier)
3565        if (!item.isEmpty())
3566          return true;
3567      return false;
3568    }
3569
3570    public Identifier addIdentifier() { //3
3571      Identifier t = new Identifier();
3572      if (this.identifier == null)
3573        this.identifier = new ArrayList<Identifier>();
3574      this.identifier.add(t);
3575      return t;
3576    }
3577
3578    public ResearchStudy addIdentifier(Identifier t) { //3
3579      if (t == null)
3580        return this;
3581      if (this.identifier == null)
3582        this.identifier = new ArrayList<Identifier>();
3583      this.identifier.add(t);
3584      return this;
3585    }
3586
3587    /**
3588     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
3589     */
3590    public Identifier getIdentifierFirstRep() { 
3591      if (getIdentifier().isEmpty()) {
3592        addIdentifier();
3593      }
3594      return getIdentifier().get(0);
3595    }
3596
3597    /**
3598     * @return {@link #version} (Business identifier for the study record.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3599     */
3600    public StringType getVersionElement() { 
3601      if (this.version == null)
3602        if (Configuration.errorOnAutoCreate())
3603          throw new Error("Attempt to auto-create ResearchStudy.version");
3604        else if (Configuration.doAutoCreate())
3605          this.version = new StringType(); // bb
3606      return this.version;
3607    }
3608
3609    public boolean hasVersionElement() { 
3610      return this.version != null && !this.version.isEmpty();
3611    }
3612
3613    public boolean hasVersion() { 
3614      return this.version != null && !this.version.isEmpty();
3615    }
3616
3617    /**
3618     * @param value {@link #version} (Business identifier for the study record.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3619     */
3620    public ResearchStudy setVersionElement(StringType value) { 
3621      this.version = value;
3622      return this;
3623    }
3624
3625    /**
3626     * @return Business identifier for the study record.
3627     */
3628    public String getVersion() { 
3629      return this.version == null ? null : this.version.getValue();
3630    }
3631
3632    /**
3633     * @param value Business identifier for the study record.
3634     */
3635    public ResearchStudy setVersion(String value) { 
3636      if (Utilities.noString(value))
3637        this.version = null;
3638      else {
3639        if (this.version == null)
3640          this.version = new StringType();
3641        this.version.setValue(value);
3642      }
3643      return this;
3644    }
3645
3646    /**
3647     * @return {@link #name} (Name for this study (computer friendly).). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3648     */
3649    public StringType getNameElement() { 
3650      if (this.name == null)
3651        if (Configuration.errorOnAutoCreate())
3652          throw new Error("Attempt to auto-create ResearchStudy.name");
3653        else if (Configuration.doAutoCreate())
3654          this.name = new StringType(); // bb
3655      return this.name;
3656    }
3657
3658    public boolean hasNameElement() { 
3659      return this.name != null && !this.name.isEmpty();
3660    }
3661
3662    public boolean hasName() { 
3663      return this.name != null && !this.name.isEmpty();
3664    }
3665
3666    /**
3667     * @param value {@link #name} (Name for this study (computer friendly).). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3668     */
3669    public ResearchStudy setNameElement(StringType value) { 
3670      this.name = value;
3671      return this;
3672    }
3673
3674    /**
3675     * @return Name for this study (computer friendly).
3676     */
3677    public String getName() { 
3678      return this.name == null ? null : this.name.getValue();
3679    }
3680
3681    /**
3682     * @param value Name for this study (computer friendly).
3683     */
3684    public ResearchStudy setName(String value) { 
3685      if (Utilities.noString(value))
3686        this.name = null;
3687      else {
3688        if (this.name == null)
3689          this.name = new StringType();
3690        this.name.setValue(value);
3691      }
3692      return this;
3693    }
3694
3695    /**
3696     * @return {@link #title} (A short, descriptive label for the study particularly for compouter use.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3697     */
3698    public StringType getTitleElement() { 
3699      if (this.title == null)
3700        if (Configuration.errorOnAutoCreate())
3701          throw new Error("Attempt to auto-create ResearchStudy.title");
3702        else if (Configuration.doAutoCreate())
3703          this.title = new StringType(); // bb
3704      return this.title;
3705    }
3706
3707    public boolean hasTitleElement() { 
3708      return this.title != null && !this.title.isEmpty();
3709    }
3710
3711    public boolean hasTitle() { 
3712      return this.title != null && !this.title.isEmpty();
3713    }
3714
3715    /**
3716     * @param value {@link #title} (A short, descriptive label for the study particularly for compouter use.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3717     */
3718    public ResearchStudy setTitleElement(StringType value) { 
3719      this.title = value;
3720      return this;
3721    }
3722
3723    /**
3724     * @return A short, descriptive label for the study particularly for compouter use.
3725     */
3726    public String getTitle() { 
3727      return this.title == null ? null : this.title.getValue();
3728    }
3729
3730    /**
3731     * @param value A short, descriptive label for the study particularly for compouter use.
3732     */
3733    public ResearchStudy setTitle(String value) { 
3734      if (Utilities.noString(value))
3735        this.title = null;
3736      else {
3737        if (this.title == null)
3738          this.title = new StringType();
3739        this.title.setValue(value);
3740      }
3741      return this;
3742    }
3743
3744    /**
3745     * @return {@link #label} (Additional names for the study.)
3746     */
3747    public List<ResearchStudyLabelComponent> getLabel() { 
3748      if (this.label == null)
3749        this.label = new ArrayList<ResearchStudyLabelComponent>();
3750      return this.label;
3751    }
3752
3753    /**
3754     * @return Returns a reference to <code>this</code> for easy method chaining
3755     */
3756    public ResearchStudy setLabel(List<ResearchStudyLabelComponent> theLabel) { 
3757      this.label = theLabel;
3758      return this;
3759    }
3760
3761    public boolean hasLabel() { 
3762      if (this.label == null)
3763        return false;
3764      for (ResearchStudyLabelComponent item : this.label)
3765        if (!item.isEmpty())
3766          return true;
3767      return false;
3768    }
3769
3770    public ResearchStudyLabelComponent addLabel() { //3
3771      ResearchStudyLabelComponent t = new ResearchStudyLabelComponent();
3772      if (this.label == null)
3773        this.label = new ArrayList<ResearchStudyLabelComponent>();
3774      this.label.add(t);
3775      return t;
3776    }
3777
3778    public ResearchStudy addLabel(ResearchStudyLabelComponent t) { //3
3779      if (t == null)
3780        return this;
3781      if (this.label == null)
3782        this.label = new ArrayList<ResearchStudyLabelComponent>();
3783      this.label.add(t);
3784      return this;
3785    }
3786
3787    /**
3788     * @return The first repetition of repeating field {@link #label}, creating it if it does not already exist {3}
3789     */
3790    public ResearchStudyLabelComponent getLabelFirstRep() { 
3791      if (getLabel().isEmpty()) {
3792        addLabel();
3793      }
3794      return getLabel().get(0);
3795    }
3796
3797    /**
3798     * @return {@link #protocol} (The set of steps expected to be performed as part of the execution of the study.)
3799     */
3800    public List<Reference> getProtocol() { 
3801      if (this.protocol == null)
3802        this.protocol = new ArrayList<Reference>();
3803      return this.protocol;
3804    }
3805
3806    /**
3807     * @return Returns a reference to <code>this</code> for easy method chaining
3808     */
3809    public ResearchStudy setProtocol(List<Reference> theProtocol) { 
3810      this.protocol = theProtocol;
3811      return this;
3812    }
3813
3814    public boolean hasProtocol() { 
3815      if (this.protocol == null)
3816        return false;
3817      for (Reference item : this.protocol)
3818        if (!item.isEmpty())
3819          return true;
3820      return false;
3821    }
3822
3823    public Reference addProtocol() { //3
3824      Reference t = new Reference();
3825      if (this.protocol == null)
3826        this.protocol = new ArrayList<Reference>();
3827      this.protocol.add(t);
3828      return t;
3829    }
3830
3831    public ResearchStudy addProtocol(Reference t) { //3
3832      if (t == null)
3833        return this;
3834      if (this.protocol == null)
3835        this.protocol = new ArrayList<Reference>();
3836      this.protocol.add(t);
3837      return this;
3838    }
3839
3840    /**
3841     * @return The first repetition of repeating field {@link #protocol}, creating it if it does not already exist {3}
3842     */
3843    public Reference getProtocolFirstRep() { 
3844      if (getProtocol().isEmpty()) {
3845        addProtocol();
3846      }
3847      return getProtocol().get(0);
3848    }
3849
3850    /**
3851     * @return {@link #partOf} (A larger research study of which this particular study is a component or step.)
3852     */
3853    public List<Reference> getPartOf() { 
3854      if (this.partOf == null)
3855        this.partOf = new ArrayList<Reference>();
3856      return this.partOf;
3857    }
3858
3859    /**
3860     * @return Returns a reference to <code>this</code> for easy method chaining
3861     */
3862    public ResearchStudy setPartOf(List<Reference> thePartOf) { 
3863      this.partOf = thePartOf;
3864      return this;
3865    }
3866
3867    public boolean hasPartOf() { 
3868      if (this.partOf == null)
3869        return false;
3870      for (Reference item : this.partOf)
3871        if (!item.isEmpty())
3872          return true;
3873      return false;
3874    }
3875
3876    public Reference addPartOf() { //3
3877      Reference t = new Reference();
3878      if (this.partOf == null)
3879        this.partOf = new ArrayList<Reference>();
3880      this.partOf.add(t);
3881      return t;
3882    }
3883
3884    public ResearchStudy addPartOf(Reference t) { //3
3885      if (t == null)
3886        return this;
3887      if (this.partOf == null)
3888        this.partOf = new ArrayList<Reference>();
3889      this.partOf.add(t);
3890      return this;
3891    }
3892
3893    /**
3894     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist {3}
3895     */
3896    public Reference getPartOfFirstRep() { 
3897      if (getPartOf().isEmpty()) {
3898        addPartOf();
3899      }
3900      return getPartOf().get(0);
3901    }
3902
3903    /**
3904     * @return {@link #relatedArtifact} (Citations, references and other related documents.)
3905     */
3906    public List<RelatedArtifact> getRelatedArtifact() { 
3907      if (this.relatedArtifact == null)
3908        this.relatedArtifact = new ArrayList<RelatedArtifact>();
3909      return this.relatedArtifact;
3910    }
3911
3912    /**
3913     * @return Returns a reference to <code>this</code> for easy method chaining
3914     */
3915    public ResearchStudy setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
3916      this.relatedArtifact = theRelatedArtifact;
3917      return this;
3918    }
3919
3920    public boolean hasRelatedArtifact() { 
3921      if (this.relatedArtifact == null)
3922        return false;
3923      for (RelatedArtifact item : this.relatedArtifact)
3924        if (!item.isEmpty())
3925          return true;
3926      return false;
3927    }
3928
3929    public RelatedArtifact addRelatedArtifact() { //3
3930      RelatedArtifact t = new RelatedArtifact();
3931      if (this.relatedArtifact == null)
3932        this.relatedArtifact = new ArrayList<RelatedArtifact>();
3933      this.relatedArtifact.add(t);
3934      return t;
3935    }
3936
3937    public ResearchStudy addRelatedArtifact(RelatedArtifact t) { //3
3938      if (t == null)
3939        return this;
3940      if (this.relatedArtifact == null)
3941        this.relatedArtifact = new ArrayList<RelatedArtifact>();
3942      this.relatedArtifact.add(t);
3943      return this;
3944    }
3945
3946    /**
3947     * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist {3}
3948     */
3949    public RelatedArtifact getRelatedArtifactFirstRep() { 
3950      if (getRelatedArtifact().isEmpty()) {
3951        addRelatedArtifact();
3952      }
3953      return getRelatedArtifact().get(0);
3954    }
3955
3956    /**
3957     * @return {@link #date} (Date the resource last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3958     */
3959    public DateTimeType getDateElement() { 
3960      if (this.date == null)
3961        if (Configuration.errorOnAutoCreate())
3962          throw new Error("Attempt to auto-create ResearchStudy.date");
3963        else if (Configuration.doAutoCreate())
3964          this.date = new DateTimeType(); // bb
3965      return this.date;
3966    }
3967
3968    public boolean hasDateElement() { 
3969      return this.date != null && !this.date.isEmpty();
3970    }
3971
3972    public boolean hasDate() { 
3973      return this.date != null && !this.date.isEmpty();
3974    }
3975
3976    /**
3977     * @param value {@link #date} (Date the resource last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3978     */
3979    public ResearchStudy setDateElement(DateTimeType value) { 
3980      this.date = value;
3981      return this;
3982    }
3983
3984    /**
3985     * @return Date the resource last changed.
3986     */
3987    public Date getDate() { 
3988      return this.date == null ? null : this.date.getValue();
3989    }
3990
3991    /**
3992     * @param value Date the resource last changed.
3993     */
3994    public ResearchStudy setDate(Date value) { 
3995      if (value == null)
3996        this.date = null;
3997      else {
3998        if (this.date == null)
3999          this.date = new DateTimeType();
4000        this.date.setValue(value);
4001      }
4002      return this;
4003    }
4004
4005    /**
4006     * @return {@link #status} (The publication state of the resource (not of the study).). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4007     */
4008    public Enumeration<PublicationStatus> getStatusElement() { 
4009      if (this.status == null)
4010        if (Configuration.errorOnAutoCreate())
4011          throw new Error("Attempt to auto-create ResearchStudy.status");
4012        else if (Configuration.doAutoCreate())
4013          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
4014      return this.status;
4015    }
4016
4017    public boolean hasStatusElement() { 
4018      return this.status != null && !this.status.isEmpty();
4019    }
4020
4021    public boolean hasStatus() { 
4022      return this.status != null && !this.status.isEmpty();
4023    }
4024
4025    /**
4026     * @param value {@link #status} (The publication state of the resource (not of the study).). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4027     */
4028    public ResearchStudy setStatusElement(Enumeration<PublicationStatus> value) { 
4029      this.status = value;
4030      return this;
4031    }
4032
4033    /**
4034     * @return The publication state of the resource (not of the study).
4035     */
4036    public PublicationStatus getStatus() { 
4037      return this.status == null ? null : this.status.getValue();
4038    }
4039
4040    /**
4041     * @param value The publication state of the resource (not of the study).
4042     */
4043    public ResearchStudy setStatus(PublicationStatus value) { 
4044        if (this.status == null)
4045          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
4046        this.status.setValue(value);
4047      return this;
4048    }
4049
4050    /**
4051     * @return {@link #primaryPurposeType} (The type of study based upon the intent of the study activities. A classification of the intent of the study.)
4052     */
4053    public CodeableConcept getPrimaryPurposeType() { 
4054      if (this.primaryPurposeType == null)
4055        if (Configuration.errorOnAutoCreate())
4056          throw new Error("Attempt to auto-create ResearchStudy.primaryPurposeType");
4057        else if (Configuration.doAutoCreate())
4058          this.primaryPurposeType = new CodeableConcept(); // cc
4059      return this.primaryPurposeType;
4060    }
4061
4062    public boolean hasPrimaryPurposeType() { 
4063      return this.primaryPurposeType != null && !this.primaryPurposeType.isEmpty();
4064    }
4065
4066    /**
4067     * @param value {@link #primaryPurposeType} (The type of study based upon the intent of the study activities. A classification of the intent of the study.)
4068     */
4069    public ResearchStudy setPrimaryPurposeType(CodeableConcept value) { 
4070      this.primaryPurposeType = value;
4071      return this;
4072    }
4073
4074    /**
4075     * @return {@link #phase} (The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.)
4076     */
4077    public CodeableConcept getPhase() { 
4078      if (this.phase == null)
4079        if (Configuration.errorOnAutoCreate())
4080          throw new Error("Attempt to auto-create ResearchStudy.phase");
4081        else if (Configuration.doAutoCreate())
4082          this.phase = new CodeableConcept(); // cc
4083      return this.phase;
4084    }
4085
4086    public boolean hasPhase() { 
4087      return this.phase != null && !this.phase.isEmpty();
4088    }
4089
4090    /**
4091     * @param value {@link #phase} (The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.)
4092     */
4093    public ResearchStudy setPhase(CodeableConcept value) { 
4094      this.phase = value;
4095      return this;
4096    }
4097
4098    /**
4099     * @return {@link #category} (Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.)
4100     */
4101    public List<CodeableConcept> getCategory() { 
4102      if (this.category == null)
4103        this.category = new ArrayList<CodeableConcept>();
4104      return this.category;
4105    }
4106
4107    /**
4108     * @return Returns a reference to <code>this</code> for easy method chaining
4109     */
4110    public ResearchStudy setCategory(List<CodeableConcept> theCategory) { 
4111      this.category = theCategory;
4112      return this;
4113    }
4114
4115    public boolean hasCategory() { 
4116      if (this.category == null)
4117        return false;
4118      for (CodeableConcept item : this.category)
4119        if (!item.isEmpty())
4120          return true;
4121      return false;
4122    }
4123
4124    public CodeableConcept addCategory() { //3
4125      CodeableConcept t = new CodeableConcept();
4126      if (this.category == null)
4127        this.category = new ArrayList<CodeableConcept>();
4128      this.category.add(t);
4129      return t;
4130    }
4131
4132    public ResearchStudy addCategory(CodeableConcept t) { //3
4133      if (t == null)
4134        return this;
4135      if (this.category == null)
4136        this.category = new ArrayList<CodeableConcept>();
4137      this.category.add(t);
4138      return this;
4139    }
4140
4141    /**
4142     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
4143     */
4144    public CodeableConcept getCategoryFirstRep() { 
4145      if (getCategory().isEmpty()) {
4146        addCategory();
4147      }
4148      return getCategory().get(0);
4149    }
4150
4151    /**
4152     * @return {@link #focus} (The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.)
4153     */
4154    public List<ResearchStudyFocusComponent> getFocus() { 
4155      if (this.focus == null)
4156        this.focus = new ArrayList<ResearchStudyFocusComponent>();
4157      return this.focus;
4158    }
4159
4160    /**
4161     * @return Returns a reference to <code>this</code> for easy method chaining
4162     */
4163    public ResearchStudy setFocus(List<ResearchStudyFocusComponent> theFocus) { 
4164      this.focus = theFocus;
4165      return this;
4166    }
4167
4168    public boolean hasFocus() { 
4169      if (this.focus == null)
4170        return false;
4171      for (ResearchStudyFocusComponent item : this.focus)
4172        if (!item.isEmpty())
4173          return true;
4174      return false;
4175    }
4176
4177    public ResearchStudyFocusComponent addFocus() { //3
4178      ResearchStudyFocusComponent t = new ResearchStudyFocusComponent();
4179      if (this.focus == null)
4180        this.focus = new ArrayList<ResearchStudyFocusComponent>();
4181      this.focus.add(t);
4182      return t;
4183    }
4184
4185    public ResearchStudy addFocus(ResearchStudyFocusComponent t) { //3
4186      if (t == null)
4187        return this;
4188      if (this.focus == null)
4189        this.focus = new ArrayList<ResearchStudyFocusComponent>();
4190      this.focus.add(t);
4191      return this;
4192    }
4193
4194    /**
4195     * @return The first repetition of repeating field {@link #focus}, creating it if it does not already exist {3}
4196     */
4197    public ResearchStudyFocusComponent getFocusFirstRep() { 
4198      if (getFocus().isEmpty()) {
4199        addFocus();
4200      }
4201      return getFocus().get(0);
4202    }
4203
4204    /**
4205     * @return {@link #condition} (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.)
4206     */
4207    public List<CodeableConcept> getCondition() { 
4208      if (this.condition == null)
4209        this.condition = new ArrayList<CodeableConcept>();
4210      return this.condition;
4211    }
4212
4213    /**
4214     * @return Returns a reference to <code>this</code> for easy method chaining
4215     */
4216    public ResearchStudy setCondition(List<CodeableConcept> theCondition) { 
4217      this.condition = theCondition;
4218      return this;
4219    }
4220
4221    public boolean hasCondition() { 
4222      if (this.condition == null)
4223        return false;
4224      for (CodeableConcept item : this.condition)
4225        if (!item.isEmpty())
4226          return true;
4227      return false;
4228    }
4229
4230    public CodeableConcept addCondition() { //3
4231      CodeableConcept t = new CodeableConcept();
4232      if (this.condition == null)
4233        this.condition = new ArrayList<CodeableConcept>();
4234      this.condition.add(t);
4235      return t;
4236    }
4237
4238    public ResearchStudy addCondition(CodeableConcept t) { //3
4239      if (t == null)
4240        return this;
4241      if (this.condition == null)
4242        this.condition = new ArrayList<CodeableConcept>();
4243      this.condition.add(t);
4244      return this;
4245    }
4246
4247    /**
4248     * @return The first repetition of repeating field {@link #condition}, creating it if it does not already exist {3}
4249     */
4250    public CodeableConcept getConditionFirstRep() { 
4251      if (getCondition().isEmpty()) {
4252        addCondition();
4253      }
4254      return getCondition().get(0);
4255    }
4256
4257    /**
4258     * @return {@link #keyword} (Key terms to aid in searching for or filtering the study.)
4259     */
4260    public List<CodeableConcept> getKeyword() { 
4261      if (this.keyword == null)
4262        this.keyword = new ArrayList<CodeableConcept>();
4263      return this.keyword;
4264    }
4265
4266    /**
4267     * @return Returns a reference to <code>this</code> for easy method chaining
4268     */
4269    public ResearchStudy setKeyword(List<CodeableConcept> theKeyword) { 
4270      this.keyword = theKeyword;
4271      return this;
4272    }
4273
4274    public boolean hasKeyword() { 
4275      if (this.keyword == null)
4276        return false;
4277      for (CodeableConcept item : this.keyword)
4278        if (!item.isEmpty())
4279          return true;
4280      return false;
4281    }
4282
4283    public CodeableConcept addKeyword() { //3
4284      CodeableConcept t = new CodeableConcept();
4285      if (this.keyword == null)
4286        this.keyword = new ArrayList<CodeableConcept>();
4287      this.keyword.add(t);
4288      return t;
4289    }
4290
4291    public ResearchStudy addKeyword(CodeableConcept t) { //3
4292      if (t == null)
4293        return this;
4294      if (this.keyword == null)
4295        this.keyword = new ArrayList<CodeableConcept>();
4296      this.keyword.add(t);
4297      return this;
4298    }
4299
4300    /**
4301     * @return The first repetition of repeating field {@link #keyword}, creating it if it does not already exist {3}
4302     */
4303    public CodeableConcept getKeywordFirstRep() { 
4304      if (getKeyword().isEmpty()) {
4305        addKeyword();
4306      }
4307      return getKeyword().get(0);
4308    }
4309
4310    /**
4311     * @return {@link #location} (Indicates a country, state or other region where the study is taking place.)
4312     */
4313    public List<CodeableConcept> getLocation() { 
4314      if (this.location == null)
4315        this.location = new ArrayList<CodeableConcept>();
4316      return this.location;
4317    }
4318
4319    /**
4320     * @return Returns a reference to <code>this</code> for easy method chaining
4321     */
4322    public ResearchStudy setLocation(List<CodeableConcept> theLocation) { 
4323      this.location = theLocation;
4324      return this;
4325    }
4326
4327    public boolean hasLocation() { 
4328      if (this.location == null)
4329        return false;
4330      for (CodeableConcept item : this.location)
4331        if (!item.isEmpty())
4332          return true;
4333      return false;
4334    }
4335
4336    public CodeableConcept addLocation() { //3
4337      CodeableConcept t = new CodeableConcept();
4338      if (this.location == null)
4339        this.location = new ArrayList<CodeableConcept>();
4340      this.location.add(t);
4341      return t;
4342    }
4343
4344    public ResearchStudy addLocation(CodeableConcept t) { //3
4345      if (t == null)
4346        return this;
4347      if (this.location == null)
4348        this.location = new ArrayList<CodeableConcept>();
4349      this.location.add(t);
4350      return this;
4351    }
4352
4353    /**
4354     * @return The first repetition of repeating field {@link #location}, creating it if it does not already exist {3}
4355     */
4356    public CodeableConcept getLocationFirstRep() { 
4357      if (getLocation().isEmpty()) {
4358        addLocation();
4359      }
4360      return getLocation().get(0);
4361    }
4362
4363    /**
4364     * @return {@link #descriptionSummary} (A brief summary of the study description.). This is the underlying object with id, value and extensions. The accessor "getDescriptionSummary" gives direct access to the value
4365     */
4366    public MarkdownType getDescriptionSummaryElement() { 
4367      if (this.descriptionSummary == null)
4368        if (Configuration.errorOnAutoCreate())
4369          throw new Error("Attempt to auto-create ResearchStudy.descriptionSummary");
4370        else if (Configuration.doAutoCreate())
4371          this.descriptionSummary = new MarkdownType(); // bb
4372      return this.descriptionSummary;
4373    }
4374
4375    public boolean hasDescriptionSummaryElement() { 
4376      return this.descriptionSummary != null && !this.descriptionSummary.isEmpty();
4377    }
4378
4379    public boolean hasDescriptionSummary() { 
4380      return this.descriptionSummary != null && !this.descriptionSummary.isEmpty();
4381    }
4382
4383    /**
4384     * @param value {@link #descriptionSummary} (A brief summary of the study description.). This is the underlying object with id, value and extensions. The accessor "getDescriptionSummary" gives direct access to the value
4385     */
4386    public ResearchStudy setDescriptionSummaryElement(MarkdownType value) { 
4387      this.descriptionSummary = value;
4388      return this;
4389    }
4390
4391    /**
4392     * @return A brief summary of the study description.
4393     */
4394    public String getDescriptionSummary() { 
4395      return this.descriptionSummary == null ? null : this.descriptionSummary.getValue();
4396    }
4397
4398    /**
4399     * @param value A brief summary of the study description.
4400     */
4401    public ResearchStudy setDescriptionSummary(String value) { 
4402      if (value == null)
4403        this.descriptionSummary = null;
4404      else {
4405        if (this.descriptionSummary == null)
4406          this.descriptionSummary = new MarkdownType();
4407        this.descriptionSummary.setValue(value);
4408      }
4409      return this;
4410    }
4411
4412    /**
4413     * @return {@link #description} (A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4414     */
4415    public MarkdownType getDescriptionElement() { 
4416      if (this.description == null)
4417        if (Configuration.errorOnAutoCreate())
4418          throw new Error("Attempt to auto-create ResearchStudy.description");
4419        else if (Configuration.doAutoCreate())
4420          this.description = new MarkdownType(); // bb
4421      return this.description;
4422    }
4423
4424    public boolean hasDescriptionElement() { 
4425      return this.description != null && !this.description.isEmpty();
4426    }
4427
4428    public boolean hasDescription() { 
4429      return this.description != null && !this.description.isEmpty();
4430    }
4431
4432    /**
4433     * @param value {@link #description} (A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4434     */
4435    public ResearchStudy setDescriptionElement(MarkdownType value) { 
4436      this.description = value;
4437      return this;
4438    }
4439
4440    /**
4441     * @return A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.
4442     */
4443    public String getDescription() { 
4444      return this.description == null ? null : this.description.getValue();
4445    }
4446
4447    /**
4448     * @param value A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.
4449     */
4450    public ResearchStudy setDescription(String value) { 
4451      if (value == null)
4452        this.description = null;
4453      else {
4454        if (this.description == null)
4455          this.description = new MarkdownType();
4456        this.description.setValue(value);
4457      }
4458      return this;
4459    }
4460
4461    /**
4462     * @return {@link #period} (Identifies the start date and the expected (or actual, depending on status) end date for the study.)
4463     */
4464    public Period getPeriod() { 
4465      if (this.period == null)
4466        if (Configuration.errorOnAutoCreate())
4467          throw new Error("Attempt to auto-create ResearchStudy.period");
4468        else if (Configuration.doAutoCreate())
4469          this.period = new Period(); // cc
4470      return this.period;
4471    }
4472
4473    public boolean hasPeriod() { 
4474      return this.period != null && !this.period.isEmpty();
4475    }
4476
4477    /**
4478     * @param value {@link #period} (Identifies the start date and the expected (or actual, depending on status) end date for the study.)
4479     */
4480    public ResearchStudy setPeriod(Period value) { 
4481      this.period = value;
4482      return this;
4483    }
4484
4485    /**
4486     * @return {@link #contact} (Contact details to assist a user in learning more about or engaging with the study.)
4487     */
4488    public List<ContactDetail> getContact() { 
4489      if (this.contact == null)
4490        this.contact = new ArrayList<ContactDetail>();
4491      return this.contact;
4492    }
4493
4494    /**
4495     * @return Returns a reference to <code>this</code> for easy method chaining
4496     */
4497    public ResearchStudy setContact(List<ContactDetail> theContact) { 
4498      this.contact = theContact;
4499      return this;
4500    }
4501
4502    public boolean hasContact() { 
4503      if (this.contact == null)
4504        return false;
4505      for (ContactDetail item : this.contact)
4506        if (!item.isEmpty())
4507          return true;
4508      return false;
4509    }
4510
4511    public ContactDetail addContact() { //3
4512      ContactDetail t = new ContactDetail();
4513      if (this.contact == null)
4514        this.contact = new ArrayList<ContactDetail>();
4515      this.contact.add(t);
4516      return t;
4517    }
4518
4519    public ResearchStudy addContact(ContactDetail t) { //3
4520      if (t == null)
4521        return this;
4522      if (this.contact == null)
4523        this.contact = new ArrayList<ContactDetail>();
4524      this.contact.add(t);
4525      return this;
4526    }
4527
4528    /**
4529     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
4530     */
4531    public ContactDetail getContactFirstRep() { 
4532      if (getContact().isEmpty()) {
4533        addContact();
4534      }
4535      return getContact().get(0);
4536    }
4537
4538    /**
4539     * @return {@link #sponsor} (An organization that initiates the investigation and is legally responsible for the study.)
4540     */
4541    public Reference getSponsor() { 
4542      if (this.sponsor == null)
4543        if (Configuration.errorOnAutoCreate())
4544          throw new Error("Attempt to auto-create ResearchStudy.sponsor");
4545        else if (Configuration.doAutoCreate())
4546          this.sponsor = new Reference(); // cc
4547      return this.sponsor;
4548    }
4549
4550    public boolean hasSponsor() { 
4551      return this.sponsor != null && !this.sponsor.isEmpty();
4552    }
4553
4554    /**
4555     * @param value {@link #sponsor} (An organization that initiates the investigation and is legally responsible for the study.)
4556     */
4557    public ResearchStudy setSponsor(Reference value) { 
4558      this.sponsor = value;
4559      return this;
4560    }
4561
4562    /**
4563     * @return {@link #principalInvestigator} (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.)
4564     */
4565    public Reference getPrincipalInvestigator() { 
4566      if (this.principalInvestigator == null)
4567        if (Configuration.errorOnAutoCreate())
4568          throw new Error("Attempt to auto-create ResearchStudy.principalInvestigator");
4569        else if (Configuration.doAutoCreate())
4570          this.principalInvestigator = new Reference(); // cc
4571      return this.principalInvestigator;
4572    }
4573
4574    public boolean hasPrincipalInvestigator() { 
4575      return this.principalInvestigator != null && !this.principalInvestigator.isEmpty();
4576    }
4577
4578    /**
4579     * @param value {@link #principalInvestigator} (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.)
4580     */
4581    public ResearchStudy setPrincipalInvestigator(Reference value) { 
4582      this.principalInvestigator = value;
4583      return this;
4584    }
4585
4586    /**
4587     * @return {@link #site} (A facility in which study activities are conducted.)
4588     */
4589    public List<Reference> getSite() { 
4590      if (this.site == null)
4591        this.site = new ArrayList<Reference>();
4592      return this.site;
4593    }
4594
4595    /**
4596     * @return Returns a reference to <code>this</code> for easy method chaining
4597     */
4598    public ResearchStudy setSite(List<Reference> theSite) { 
4599      this.site = theSite;
4600      return this;
4601    }
4602
4603    public boolean hasSite() { 
4604      if (this.site == null)
4605        return false;
4606      for (Reference item : this.site)
4607        if (!item.isEmpty())
4608          return true;
4609      return false;
4610    }
4611
4612    public Reference addSite() { //3
4613      Reference t = new Reference();
4614      if (this.site == null)
4615        this.site = new ArrayList<Reference>();
4616      this.site.add(t);
4617      return t;
4618    }
4619
4620    public ResearchStudy addSite(Reference t) { //3
4621      if (t == null)
4622        return this;
4623      if (this.site == null)
4624        this.site = new ArrayList<Reference>();
4625      this.site.add(t);
4626      return this;
4627    }
4628
4629    /**
4630     * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist {3}
4631     */
4632    public Reference getSiteFirstRep() { 
4633      if (getSite().isEmpty()) {
4634        addSite();
4635      }
4636      return getSite().get(0);
4637    }
4638
4639    /**
4640     * @return {@link #note} (Comments made about the study by the performer, subject or other participants.)
4641     */
4642    public List<Annotation> getNote() { 
4643      if (this.note == null)
4644        this.note = new ArrayList<Annotation>();
4645      return this.note;
4646    }
4647
4648    /**
4649     * @return Returns a reference to <code>this</code> for easy method chaining
4650     */
4651    public ResearchStudy setNote(List<Annotation> theNote) { 
4652      this.note = theNote;
4653      return this;
4654    }
4655
4656    public boolean hasNote() { 
4657      if (this.note == null)
4658        return false;
4659      for (Annotation item : this.note)
4660        if (!item.isEmpty())
4661          return true;
4662      return false;
4663    }
4664
4665    public Annotation addNote() { //3
4666      Annotation t = new Annotation();
4667      if (this.note == null)
4668        this.note = new ArrayList<Annotation>();
4669      this.note.add(t);
4670      return t;
4671    }
4672
4673    public ResearchStudy addNote(Annotation t) { //3
4674      if (t == null)
4675        return this;
4676      if (this.note == null)
4677        this.note = new ArrayList<Annotation>();
4678      this.note.add(t);
4679      return this;
4680    }
4681
4682    /**
4683     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
4684     */
4685    public Annotation getNoteFirstRep() { 
4686      if (getNote().isEmpty()) {
4687        addNote();
4688      }
4689      return getNote().get(0);
4690    }
4691
4692    /**
4693     * @return {@link #classification} (Classification for the study.)
4694     */
4695    public List<ResearchStudyClassificationComponent> getClassification() { 
4696      if (this.classification == null)
4697        this.classification = new ArrayList<ResearchStudyClassificationComponent>();
4698      return this.classification;
4699    }
4700
4701    /**
4702     * @return Returns a reference to <code>this</code> for easy method chaining
4703     */
4704    public ResearchStudy setClassification(List<ResearchStudyClassificationComponent> theClassification) { 
4705      this.classification = theClassification;
4706      return this;
4707    }
4708
4709    public boolean hasClassification() { 
4710      if (this.classification == null)
4711        return false;
4712      for (ResearchStudyClassificationComponent item : this.classification)
4713        if (!item.isEmpty())
4714          return true;
4715      return false;
4716    }
4717
4718    public ResearchStudyClassificationComponent addClassification() { //3
4719      ResearchStudyClassificationComponent t = new ResearchStudyClassificationComponent();
4720      if (this.classification == null)
4721        this.classification = new ArrayList<ResearchStudyClassificationComponent>();
4722      this.classification.add(t);
4723      return t;
4724    }
4725
4726    public ResearchStudy addClassification(ResearchStudyClassificationComponent t) { //3
4727      if (t == null)
4728        return this;
4729      if (this.classification == null)
4730        this.classification = new ArrayList<ResearchStudyClassificationComponent>();
4731      this.classification.add(t);
4732      return this;
4733    }
4734
4735    /**
4736     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist {3}
4737     */
4738    public ResearchStudyClassificationComponent getClassificationFirstRep() { 
4739      if (getClassification().isEmpty()) {
4740        addClassification();
4741      }
4742      return getClassification().get(0);
4743    }
4744
4745    /**
4746     * @return {@link #associatedParty} (Sponsors, collaborators, and other parties.)
4747     */
4748    public List<ResearchStudyAssociatedPartyComponent> getAssociatedParty() { 
4749      if (this.associatedParty == null)
4750        this.associatedParty = new ArrayList<ResearchStudyAssociatedPartyComponent>();
4751      return this.associatedParty;
4752    }
4753
4754    /**
4755     * @return Returns a reference to <code>this</code> for easy method chaining
4756     */
4757    public ResearchStudy setAssociatedParty(List<ResearchStudyAssociatedPartyComponent> theAssociatedParty) { 
4758      this.associatedParty = theAssociatedParty;
4759      return this;
4760    }
4761
4762    public boolean hasAssociatedParty() { 
4763      if (this.associatedParty == null)
4764        return false;
4765      for (ResearchStudyAssociatedPartyComponent item : this.associatedParty)
4766        if (!item.isEmpty())
4767          return true;
4768      return false;
4769    }
4770
4771    public ResearchStudyAssociatedPartyComponent addAssociatedParty() { //3
4772      ResearchStudyAssociatedPartyComponent t = new ResearchStudyAssociatedPartyComponent();
4773      if (this.associatedParty == null)
4774        this.associatedParty = new ArrayList<ResearchStudyAssociatedPartyComponent>();
4775      this.associatedParty.add(t);
4776      return t;
4777    }
4778
4779    public ResearchStudy addAssociatedParty(ResearchStudyAssociatedPartyComponent t) { //3
4780      if (t == null)
4781        return this;
4782      if (this.associatedParty == null)
4783        this.associatedParty = new ArrayList<ResearchStudyAssociatedPartyComponent>();
4784      this.associatedParty.add(t);
4785      return this;
4786    }
4787
4788    /**
4789     * @return The first repetition of repeating field {@link #associatedParty}, creating it if it does not already exist {3}
4790     */
4791    public ResearchStudyAssociatedPartyComponent getAssociatedPartyFirstRep() { 
4792      if (getAssociatedParty().isEmpty()) {
4793        addAssociatedParty();
4794      }
4795      return getAssociatedParty().get(0);
4796    }
4797
4798    /**
4799     * @return {@link #currentState} (Current status of the study.)
4800     */
4801    public List<CodeableConcept> getCurrentState() { 
4802      if (this.currentState == null)
4803        this.currentState = new ArrayList<CodeableConcept>();
4804      return this.currentState;
4805    }
4806
4807    /**
4808     * @return Returns a reference to <code>this</code> for easy method chaining
4809     */
4810    public ResearchStudy setCurrentState(List<CodeableConcept> theCurrentState) { 
4811      this.currentState = theCurrentState;
4812      return this;
4813    }
4814
4815    public boolean hasCurrentState() { 
4816      if (this.currentState == null)
4817        return false;
4818      for (CodeableConcept item : this.currentState)
4819        if (!item.isEmpty())
4820          return true;
4821      return false;
4822    }
4823
4824    public CodeableConcept addCurrentState() { //3
4825      CodeableConcept t = new CodeableConcept();
4826      if (this.currentState == null)
4827        this.currentState = new ArrayList<CodeableConcept>();
4828      this.currentState.add(t);
4829      return t;
4830    }
4831
4832    public ResearchStudy addCurrentState(CodeableConcept t) { //3
4833      if (t == null)
4834        return this;
4835      if (this.currentState == null)
4836        this.currentState = new ArrayList<CodeableConcept>();
4837      this.currentState.add(t);
4838      return this;
4839    }
4840
4841    /**
4842     * @return The first repetition of repeating field {@link #currentState}, creating it if it does not already exist {3}
4843     */
4844    public CodeableConcept getCurrentStateFirstRep() { 
4845      if (getCurrentState().isEmpty()) {
4846        addCurrentState();
4847      }
4848      return getCurrentState().get(0);
4849    }
4850
4851    /**
4852     * @return {@link #statusDate} (Status of study with time for that status.)
4853     */
4854    public List<ResearchStudyStatusDateComponent> getStatusDate() { 
4855      if (this.statusDate == null)
4856        this.statusDate = new ArrayList<ResearchStudyStatusDateComponent>();
4857      return this.statusDate;
4858    }
4859
4860    /**
4861     * @return Returns a reference to <code>this</code> for easy method chaining
4862     */
4863    public ResearchStudy setStatusDate(List<ResearchStudyStatusDateComponent> theStatusDate) { 
4864      this.statusDate = theStatusDate;
4865      return this;
4866    }
4867
4868    public boolean hasStatusDate() { 
4869      if (this.statusDate == null)
4870        return false;
4871      for (ResearchStudyStatusDateComponent item : this.statusDate)
4872        if (!item.isEmpty())
4873          return true;
4874      return false;
4875    }
4876
4877    public ResearchStudyStatusDateComponent addStatusDate() { //3
4878      ResearchStudyStatusDateComponent t = new ResearchStudyStatusDateComponent();
4879      if (this.statusDate == null)
4880        this.statusDate = new ArrayList<ResearchStudyStatusDateComponent>();
4881      this.statusDate.add(t);
4882      return t;
4883    }
4884
4885    public ResearchStudy addStatusDate(ResearchStudyStatusDateComponent t) { //3
4886      if (t == null)
4887        return this;
4888      if (this.statusDate == null)
4889        this.statusDate = new ArrayList<ResearchStudyStatusDateComponent>();
4890      this.statusDate.add(t);
4891      return this;
4892    }
4893
4894    /**
4895     * @return The first repetition of repeating field {@link #statusDate}, creating it if it does not already exist {3}
4896     */
4897    public ResearchStudyStatusDateComponent getStatusDateFirstRep() { 
4898      if (getStatusDate().isEmpty()) {
4899        addStatusDate();
4900      }
4901      return getStatusDate().get(0);
4902    }
4903
4904    /**
4905     * @return {@link #whyStopped} (A description and/or code explaining the premature termination of the study.)
4906     */
4907    public CodeableConcept getWhyStopped() { 
4908      if (this.whyStopped == null)
4909        if (Configuration.errorOnAutoCreate())
4910          throw new Error("Attempt to auto-create ResearchStudy.whyStopped");
4911        else if (Configuration.doAutoCreate())
4912          this.whyStopped = new CodeableConcept(); // cc
4913      return this.whyStopped;
4914    }
4915
4916    public boolean hasWhyStopped() { 
4917      return this.whyStopped != null && !this.whyStopped.isEmpty();
4918    }
4919
4920    /**
4921     * @param value {@link #whyStopped} (A description and/or code explaining the premature termination of the study.)
4922     */
4923    public ResearchStudy setWhyStopped(CodeableConcept value) { 
4924      this.whyStopped = value;
4925      return this;
4926    }
4927
4928    /**
4929     * @return {@link #recruitment} (Target or actual group of participants enrolled in study.)
4930     */
4931    public ResearchStudyRecruitmentComponent getRecruitment() { 
4932      if (this.recruitment == null)
4933        if (Configuration.errorOnAutoCreate())
4934          throw new Error("Attempt to auto-create ResearchStudy.recruitment");
4935        else if (Configuration.doAutoCreate())
4936          this.recruitment = new ResearchStudyRecruitmentComponent(); // cc
4937      return this.recruitment;
4938    }
4939
4940    public boolean hasRecruitment() { 
4941      return this.recruitment != null && !this.recruitment.isEmpty();
4942    }
4943
4944    /**
4945     * @param value {@link #recruitment} (Target or actual group of participants enrolled in study.)
4946     */
4947    public ResearchStudy setRecruitment(ResearchStudyRecruitmentComponent value) { 
4948      this.recruitment = value;
4949      return this;
4950    }
4951
4952    /**
4953     * @return {@link #comparisonGroup} (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.)
4954     */
4955    public List<ResearchStudyComparisonGroupComponent> getComparisonGroup() { 
4956      if (this.comparisonGroup == null)
4957        this.comparisonGroup = new ArrayList<ResearchStudyComparisonGroupComponent>();
4958      return this.comparisonGroup;
4959    }
4960
4961    /**
4962     * @return Returns a reference to <code>this</code> for easy method chaining
4963     */
4964    public ResearchStudy setComparisonGroup(List<ResearchStudyComparisonGroupComponent> theComparisonGroup) { 
4965      this.comparisonGroup = theComparisonGroup;
4966      return this;
4967    }
4968
4969    public boolean hasComparisonGroup() { 
4970      if (this.comparisonGroup == null)
4971        return false;
4972      for (ResearchStudyComparisonGroupComponent item : this.comparisonGroup)
4973        if (!item.isEmpty())
4974          return true;
4975      return false;
4976    }
4977
4978    public ResearchStudyComparisonGroupComponent addComparisonGroup() { //3
4979      ResearchStudyComparisonGroupComponent t = new ResearchStudyComparisonGroupComponent();
4980      if (this.comparisonGroup == null)
4981        this.comparisonGroup = new ArrayList<ResearchStudyComparisonGroupComponent>();
4982      this.comparisonGroup.add(t);
4983      return t;
4984    }
4985
4986    public ResearchStudy addComparisonGroup(ResearchStudyComparisonGroupComponent t) { //3
4987      if (t == null)
4988        return this;
4989      if (this.comparisonGroup == null)
4990        this.comparisonGroup = new ArrayList<ResearchStudyComparisonGroupComponent>();
4991      this.comparisonGroup.add(t);
4992      return this;
4993    }
4994
4995    /**
4996     * @return The first repetition of repeating field {@link #comparisonGroup}, creating it if it does not already exist {3}
4997     */
4998    public ResearchStudyComparisonGroupComponent getComparisonGroupFirstRep() { 
4999      if (getComparisonGroup().isEmpty()) {
5000        addComparisonGroup();
5001      }
5002      return getComparisonGroup().get(0);
5003    }
5004
5005    /**
5006     * @return {@link #objective} (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.)
5007     */
5008    public List<ResearchStudyObjectiveComponent> getObjective() { 
5009      if (this.objective == null)
5010        this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
5011      return this.objective;
5012    }
5013
5014    /**
5015     * @return Returns a reference to <code>this</code> for easy method chaining
5016     */
5017    public ResearchStudy setObjective(List<ResearchStudyObjectiveComponent> theObjective) { 
5018      this.objective = theObjective;
5019      return this;
5020    }
5021
5022    public boolean hasObjective() { 
5023      if (this.objective == null)
5024        return false;
5025      for (ResearchStudyObjectiveComponent item : this.objective)
5026        if (!item.isEmpty())
5027          return true;
5028      return false;
5029    }
5030
5031    public ResearchStudyObjectiveComponent addObjective() { //3
5032      ResearchStudyObjectiveComponent t = new ResearchStudyObjectiveComponent();
5033      if (this.objective == null)
5034        this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
5035      this.objective.add(t);
5036      return t;
5037    }
5038
5039    public ResearchStudy addObjective(ResearchStudyObjectiveComponent t) { //3
5040      if (t == null)
5041        return this;
5042      if (this.objective == null)
5043        this.objective = new ArrayList<ResearchStudyObjectiveComponent>();
5044      this.objective.add(t);
5045      return this;
5046    }
5047
5048    /**
5049     * @return The first repetition of repeating field {@link #objective}, creating it if it does not already exist {3}
5050     */
5051    public ResearchStudyObjectiveComponent getObjectiveFirstRep() { 
5052      if (getObjective().isEmpty()) {
5053        addObjective();
5054      }
5055      return getObjective().get(0);
5056    }
5057
5058    /**
5059     * @return {@link #outcomeMeasure} (An outcome or planned variable to measure during the study.)
5060     */
5061    public List<ResearchStudyOutcomeMeasureComponent> getOutcomeMeasure() { 
5062      if (this.outcomeMeasure == null)
5063        this.outcomeMeasure = new ArrayList<ResearchStudyOutcomeMeasureComponent>();
5064      return this.outcomeMeasure;
5065    }
5066
5067    /**
5068     * @return Returns a reference to <code>this</code> for easy method chaining
5069     */
5070    public ResearchStudy setOutcomeMeasure(List<ResearchStudyOutcomeMeasureComponent> theOutcomeMeasure) { 
5071      this.outcomeMeasure = theOutcomeMeasure;
5072      return this;
5073    }
5074
5075    public boolean hasOutcomeMeasure() { 
5076      if (this.outcomeMeasure == null)
5077        return false;
5078      for (ResearchStudyOutcomeMeasureComponent item : this.outcomeMeasure)
5079        if (!item.isEmpty())
5080          return true;
5081      return false;
5082    }
5083
5084    public ResearchStudyOutcomeMeasureComponent addOutcomeMeasure() { //3
5085      ResearchStudyOutcomeMeasureComponent t = new ResearchStudyOutcomeMeasureComponent();
5086      if (this.outcomeMeasure == null)
5087        this.outcomeMeasure = new ArrayList<ResearchStudyOutcomeMeasureComponent>();
5088      this.outcomeMeasure.add(t);
5089      return t;
5090    }
5091
5092    public ResearchStudy addOutcomeMeasure(ResearchStudyOutcomeMeasureComponent t) { //3
5093      if (t == null)
5094        return this;
5095      if (this.outcomeMeasure == null)
5096        this.outcomeMeasure = new ArrayList<ResearchStudyOutcomeMeasureComponent>();
5097      this.outcomeMeasure.add(t);
5098      return this;
5099    }
5100
5101    /**
5102     * @return The first repetition of repeating field {@link #outcomeMeasure}, creating it if it does not already exist {3}
5103     */
5104    public ResearchStudyOutcomeMeasureComponent getOutcomeMeasureFirstRep() { 
5105      if (getOutcomeMeasure().isEmpty()) {
5106        addOutcomeMeasure();
5107      }
5108      return getOutcomeMeasure().get(0);
5109    }
5110
5111    /**
5112     * @return {@link #result} (Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov.)
5113     */
5114    public List<Reference> getResult() { 
5115      if (this.result == null)
5116        this.result = new ArrayList<Reference>();
5117      return this.result;
5118    }
5119
5120    /**
5121     * @return Returns a reference to <code>this</code> for easy method chaining
5122     */
5123    public ResearchStudy setResult(List<Reference> theResult) { 
5124      this.result = theResult;
5125      return this;
5126    }
5127
5128    public boolean hasResult() { 
5129      if (this.result == null)
5130        return false;
5131      for (Reference item : this.result)
5132        if (!item.isEmpty())
5133          return true;
5134      return false;
5135    }
5136
5137    public Reference addResult() { //3
5138      Reference t = new Reference();
5139      if (this.result == null)
5140        this.result = new ArrayList<Reference>();
5141      this.result.add(t);
5142      return t;
5143    }
5144
5145    public ResearchStudy addResult(Reference t) { //3
5146      if (t == null)
5147        return this;
5148      if (this.result == null)
5149        this.result = new ArrayList<Reference>();
5150      this.result.add(t);
5151      return this;
5152    }
5153
5154    /**
5155     * @return The first repetition of repeating field {@link #result}, creating it if it does not already exist {3}
5156     */
5157    public Reference getResultFirstRep() { 
5158      if (getResult().isEmpty()) {
5159        addResult();
5160      }
5161      return getResult().get(0);
5162    }
5163
5164    /**
5165     * @return {@link #webLocation} (A general storage or archive location for the study.  This may contain an assortment of content which is not specified in advance.)
5166     */
5167    public List<ResearchStudyWebLocationComponent> getWebLocation() { 
5168      if (this.webLocation == null)
5169        this.webLocation = new ArrayList<ResearchStudyWebLocationComponent>();
5170      return this.webLocation;
5171    }
5172
5173    /**
5174     * @return Returns a reference to <code>this</code> for easy method chaining
5175     */
5176    public ResearchStudy setWebLocation(List<ResearchStudyWebLocationComponent> theWebLocation) { 
5177      this.webLocation = theWebLocation;
5178      return this;
5179    }
5180
5181    public boolean hasWebLocation() { 
5182      if (this.webLocation == null)
5183        return false;
5184      for (ResearchStudyWebLocationComponent item : this.webLocation)
5185        if (!item.isEmpty())
5186          return true;
5187      return false;
5188    }
5189
5190    public ResearchStudyWebLocationComponent addWebLocation() { //3
5191      ResearchStudyWebLocationComponent t = new ResearchStudyWebLocationComponent();
5192      if (this.webLocation == null)
5193        this.webLocation = new ArrayList<ResearchStudyWebLocationComponent>();
5194      this.webLocation.add(t);
5195      return t;
5196    }
5197
5198    public ResearchStudy addWebLocation(ResearchStudyWebLocationComponent t) { //3
5199      if (t == null)
5200        return this;
5201      if (this.webLocation == null)
5202        this.webLocation = new ArrayList<ResearchStudyWebLocationComponent>();
5203      this.webLocation.add(t);
5204      return this;
5205    }
5206
5207    /**
5208     * @return The first repetition of repeating field {@link #webLocation}, creating it if it does not already exist {3}
5209     */
5210    public ResearchStudyWebLocationComponent getWebLocationFirstRep() { 
5211      if (getWebLocation().isEmpty()) {
5212        addWebLocation();
5213      }
5214      return getWebLocation().get(0);
5215    }
5216
5217      protected void listChildren(List<Property> children) {
5218        super.listChildren(children);
5219        children.add(new Property("url", "uri", "Canonical identifier for this study resource, represented as a globally unique URI.", 0, 1, url));
5220        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this research study by the sponsor or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier));
5221        children.add(new Property("version", "string", "Business identifier for the study record.", 0, 1, version));
5222        children.add(new Property("name", "string", "Name for this study (computer friendly).", 0, 1, name));
5223        children.add(new Property("title", "string", "A short, descriptive label for the study particularly for compouter use.", 0, 1, title));
5224        children.add(new Property("label", "", "Additional names for the study.", 0, java.lang.Integer.MAX_VALUE, label));
5225        children.add(new Property("protocol", "Reference(PlanDefinition)", "The set of steps expected to be performed as part of the execution of the study.", 0, java.lang.Integer.MAX_VALUE, protocol));
5226        children.add(new Property("partOf", "Reference(ResearchStudy)", "A larger research study of which this particular study is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf));
5227        children.add(new Property("relatedArtifact", "RelatedArtifact", "Citations, references and other related documents.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
5228        children.add(new Property("date", "dateTime", "Date the resource last changed.", 0, 1, date));
5229        children.add(new Property("status", "code", "The publication state of the resource (not of the study).", 0, 1, status));
5230        children.add(new Property("primaryPurposeType", "CodeableConcept", "The type of study based upon the intent of the study activities. A classification of the intent of the study.", 0, 1, primaryPurposeType));
5231        children.add(new Property("phase", "CodeableConcept", "The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.", 0, 1, phase));
5232        children.add(new Property("category", "CodeableConcept", "Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.", 0, java.lang.Integer.MAX_VALUE, category));
5233        children.add(new Property("focus", "", "The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.", 0, java.lang.Integer.MAX_VALUE, focus));
5234        children.add(new Property("condition", "CodeableConcept", "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.", 0, java.lang.Integer.MAX_VALUE, condition));
5235        children.add(new Property("keyword", "CodeableConcept", "Key terms to aid in searching for or filtering the study.", 0, java.lang.Integer.MAX_VALUE, keyword));
5236        children.add(new Property("location", "CodeableConcept", "Indicates a country, state or other region where the study is taking place.", 0, java.lang.Integer.MAX_VALUE, location));
5237        children.add(new Property("descriptionSummary", "markdown", "A brief summary of the study description.", 0, 1, descriptionSummary));
5238        children.add(new Property("description", "markdown", "A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.", 0, 1, description));
5239        children.add(new Property("period", "Period", "Identifies the start date and the expected (or actual, depending on status) end date for the study.", 0, 1, period));
5240        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in learning more about or engaging with the study.", 0, java.lang.Integer.MAX_VALUE, contact));
5241        children.add(new Property("sponsor", "Reference(Organization)", "An organization that initiates the investigation and is legally responsible for the study.", 0, 1, sponsor));
5242        children.add(new Property("principalInvestigator", "Reference(Practitioner|PractitionerRole)", "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.", 0, 1, principalInvestigator));
5243        children.add(new Property("site", "Reference(Location|ResearchStudy|Organization)", "A facility in which study activities are conducted.", 0, java.lang.Integer.MAX_VALUE, site));
5244        children.add(new Property("note", "Annotation", "Comments made about the study by the performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
5245        children.add(new Property("classification", "", "Classification for the study.", 0, java.lang.Integer.MAX_VALUE, classification));
5246        children.add(new Property("associatedParty", "", "Sponsors, collaborators, and other parties.", 0, java.lang.Integer.MAX_VALUE, associatedParty));
5247        children.add(new Property("currentState", "CodeableConcept", "Current status of the study.", 0, java.lang.Integer.MAX_VALUE, currentState));
5248        children.add(new Property("statusDate", "", "Status of study with time for that status.", 0, java.lang.Integer.MAX_VALUE, statusDate));
5249        children.add(new Property("whyStopped", "CodeableConcept", "A description and/or code explaining the premature termination of the study.", 0, 1, whyStopped));
5250        children.add(new Property("recruitment", "", "Target or actual group of participants enrolled in study.", 0, 1, recruitment));
5251        children.add(new Property("comparisonGroup", "", "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.", 0, java.lang.Integer.MAX_VALUE, comparisonGroup));
5252        children.add(new Property("objective", "", "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.", 0, java.lang.Integer.MAX_VALUE, objective));
5253        children.add(new Property("outcomeMeasure", "", "An outcome or planned variable to measure during the study.", 0, java.lang.Integer.MAX_VALUE, outcomeMeasure));
5254        children.add(new Property("result", "Reference(EvidenceReport|Citation|DiagnosticReport)", "Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov.", 0, java.lang.Integer.MAX_VALUE, result));
5255        children.add(new Property("webLocation", "", "A general storage or archive location for the study.  This may contain an assortment of content which is not specified in advance.", 0, java.lang.Integer.MAX_VALUE, webLocation));
5256      }
5257
5258      @Override
5259      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5260        switch (_hash) {
5261        case 116079: /*url*/  return new Property("url", "uri", "Canonical identifier for this study resource, represented as a globally unique URI.", 0, 1, url);
5262        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this research study by the sponsor or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier);
5263        case 351608024: /*version*/  return new Property("version", "string", "Business identifier for the study record.", 0, 1, version);
5264        case 3373707: /*name*/  return new Property("name", "string", "Name for this study (computer friendly).", 0, 1, name);
5265        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive label for the study particularly for compouter use.", 0, 1, title);
5266        case 102727412: /*label*/  return new Property("label", "", "Additional names for the study.", 0, java.lang.Integer.MAX_VALUE, label);
5267        case -989163880: /*protocol*/  return new Property("protocol", "Reference(PlanDefinition)", "The set of steps expected to be performed as part of the execution of the study.", 0, java.lang.Integer.MAX_VALUE, protocol);
5268        case -995410646: /*partOf*/  return new Property("partOf", "Reference(ResearchStudy)", "A larger research study of which this particular study is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf);
5269        case 666807069: /*relatedArtifact*/  return new Property("relatedArtifact", "RelatedArtifact", "Citations, references and other related documents.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
5270        case 3076014: /*date*/  return new Property("date", "dateTime", "Date the resource last changed.", 0, 1, date);
5271        case -892481550: /*status*/  return new Property("status", "code", "The publication state of the resource (not of the study).", 0, 1, status);
5272        case -2132842986: /*primaryPurposeType*/  return new Property("primaryPurposeType", "CodeableConcept", "The type of study based upon the intent of the study activities. A classification of the intent of the study.", 0, 1, primaryPurposeType);
5273        case 106629499: /*phase*/  return new Property("phase", "CodeableConcept", "The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.", 0, 1, phase);
5274        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.", 0, java.lang.Integer.MAX_VALUE, category);
5275        case 97604824: /*focus*/  return new Property("focus", "", "The medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.", 0, java.lang.Integer.MAX_VALUE, focus);
5276        case -861311717: /*condition*/  return new Property("condition", "CodeableConcept", "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.", 0, java.lang.Integer.MAX_VALUE, condition);
5277        case -814408215: /*keyword*/  return new Property("keyword", "CodeableConcept", "Key terms to aid in searching for or filtering the study.", 0, java.lang.Integer.MAX_VALUE, keyword);
5278        case 1901043637: /*location*/  return new Property("location", "CodeableConcept", "Indicates a country, state or other region where the study is taking place.", 0, java.lang.Integer.MAX_VALUE, location);
5279        case 21530634: /*descriptionSummary*/  return new Property("descriptionSummary", "markdown", "A brief summary of the study description.", 0, 1, descriptionSummary);
5280        case -1724546052: /*description*/  return new Property("description", "markdown", "A full description of how the study is being conducted.  For a description of what the study objectives are see ResearchStudy.objective.description.", 0, 1, description);
5281        case -991726143: /*period*/  return new Property("period", "Period", "Identifies the start date and the expected (or actual, depending on status) end date for the study.", 0, 1, period);
5282        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in learning more about or engaging with the study.", 0, java.lang.Integer.MAX_VALUE, contact);
5283        case -1998892262: /*sponsor*/  return new Property("sponsor", "Reference(Organization)", "An organization that initiates the investigation and is legally responsible for the study.", 0, 1, sponsor);
5284        case 1437117175: /*principalInvestigator*/  return new Property("principalInvestigator", "Reference(Practitioner|PractitionerRole)", "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.", 0, 1, principalInvestigator);
5285        case 3530567: /*site*/  return new Property("site", "Reference(Location|ResearchStudy|Organization)", "A facility in which study activities are conducted.", 0, java.lang.Integer.MAX_VALUE, site);
5286        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the study by the performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
5287        case 382350310: /*classification*/  return new Property("classification", "", "Classification for the study.", 0, java.lang.Integer.MAX_VALUE, classification);
5288        case -1841460864: /*associatedParty*/  return new Property("associatedParty", "", "Sponsors, collaborators, and other parties.", 0, java.lang.Integer.MAX_VALUE, associatedParty);
5289        case 1457822360: /*currentState*/  return new Property("currentState", "CodeableConcept", "Current status of the study.", 0, java.lang.Integer.MAX_VALUE, currentState);
5290        case 247524032: /*statusDate*/  return new Property("statusDate", "", "Status of study with time for that status.", 0, java.lang.Integer.MAX_VALUE, statusDate);
5291        case -699986715: /*whyStopped*/  return new Property("whyStopped", "CodeableConcept", "A description and/or code explaining the premature termination of the study.", 0, 1, whyStopped);
5292        case 780783004: /*recruitment*/  return new Property("recruitment", "", "Target or actual group of participants enrolled in study.", 0, 1, recruitment);
5293        case -138266634: /*comparisonGroup*/  return new Property("comparisonGroup", "", "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.", 0, java.lang.Integer.MAX_VALUE, comparisonGroup);
5294        case -1489585863: /*objective*/  return new Property("objective", "", "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.", 0, java.lang.Integer.MAX_VALUE, objective);
5295        case -1510689364: /*outcomeMeasure*/  return new Property("outcomeMeasure", "", "An outcome or planned variable to measure during the study.", 0, java.lang.Integer.MAX_VALUE, outcomeMeasure);
5296        case -934426595: /*result*/  return new Property("result", "Reference(EvidenceReport|Citation|DiagnosticReport)", "Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov.", 0, java.lang.Integer.MAX_VALUE, result);
5297        case -828032215: /*webLocation*/  return new Property("webLocation", "", "A general storage or archive location for the study.  This may contain an assortment of content which is not specified in advance.", 0, java.lang.Integer.MAX_VALUE, webLocation);
5298        default: return super.getNamedProperty(_hash, _name, _checkValid);
5299        }
5300
5301      }
5302
5303      @Override
5304      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5305        switch (hash) {
5306        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
5307        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
5308        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
5309        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
5310        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
5311        case 102727412: /*label*/ return this.label == null ? new Base[0] : this.label.toArray(new Base[this.label.size()]); // ResearchStudyLabelComponent
5312        case -989163880: /*protocol*/ return this.protocol == null ? new Base[0] : this.protocol.toArray(new Base[this.protocol.size()]); // Reference
5313        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
5314        case 666807069: /*relatedArtifact*/ return this.relatedArtifact == null ? new Base[0] : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
5315        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
5316        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
5317        case -2132842986: /*primaryPurposeType*/ return this.primaryPurposeType == null ? new Base[0] : new Base[] {this.primaryPurposeType}; // CodeableConcept
5318        case 106629499: /*phase*/ return this.phase == null ? new Base[0] : new Base[] {this.phase}; // CodeableConcept
5319        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
5320        case 97604824: /*focus*/ return this.focus == null ? new Base[0] : this.focus.toArray(new Base[this.focus.size()]); // ResearchStudyFocusComponent
5321        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // CodeableConcept
5322        case -814408215: /*keyword*/ return this.keyword == null ? new Base[0] : this.keyword.toArray(new Base[this.keyword.size()]); // CodeableConcept
5323        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // CodeableConcept
5324        case 21530634: /*descriptionSummary*/ return this.descriptionSummary == null ? new Base[0] : new Base[] {this.descriptionSummary}; // MarkdownType
5325        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
5326        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
5327        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
5328        case -1998892262: /*sponsor*/ return this.sponsor == null ? new Base[0] : new Base[] {this.sponsor}; // Reference
5329        case 1437117175: /*principalInvestigator*/ return this.principalInvestigator == null ? new Base[0] : new Base[] {this.principalInvestigator}; // Reference
5330        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
5331        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
5332        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // ResearchStudyClassificationComponent
5333        case -1841460864: /*associatedParty*/ return this.associatedParty == null ? new Base[0] : this.associatedParty.toArray(new Base[this.associatedParty.size()]); // ResearchStudyAssociatedPartyComponent
5334        case 1457822360: /*currentState*/ return this.currentState == null ? new Base[0] : this.currentState.toArray(new Base[this.currentState.size()]); // CodeableConcept
5335        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : this.statusDate.toArray(new Base[this.statusDate.size()]); // ResearchStudyStatusDateComponent
5336        case -699986715: /*whyStopped*/ return this.whyStopped == null ? new Base[0] : new Base[] {this.whyStopped}; // CodeableConcept
5337        case 780783004: /*recruitment*/ return this.recruitment == null ? new Base[0] : new Base[] {this.recruitment}; // ResearchStudyRecruitmentComponent
5338        case -138266634: /*comparisonGroup*/ return this.comparisonGroup == null ? new Base[0] : this.comparisonGroup.toArray(new Base[this.comparisonGroup.size()]); // ResearchStudyComparisonGroupComponent
5339        case -1489585863: /*objective*/ return this.objective == null ? new Base[0] : this.objective.toArray(new Base[this.objective.size()]); // ResearchStudyObjectiveComponent
5340        case -1510689364: /*outcomeMeasure*/ return this.outcomeMeasure == null ? new Base[0] : this.outcomeMeasure.toArray(new Base[this.outcomeMeasure.size()]); // ResearchStudyOutcomeMeasureComponent
5341        case -934426595: /*result*/ return this.result == null ? new Base[0] : this.result.toArray(new Base[this.result.size()]); // Reference
5342        case -828032215: /*webLocation*/ return this.webLocation == null ? new Base[0] : this.webLocation.toArray(new Base[this.webLocation.size()]); // ResearchStudyWebLocationComponent
5343        default: return super.getProperty(hash, name, checkValid);
5344        }
5345
5346      }
5347
5348      @Override
5349      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5350        switch (hash) {
5351        case 116079: // url
5352          this.url = TypeConvertor.castToUri(value); // UriType
5353          return value;
5354        case -1618432855: // identifier
5355          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
5356          return value;
5357        case 351608024: // version
5358          this.version = TypeConvertor.castToString(value); // StringType
5359          return value;
5360        case 3373707: // name
5361          this.name = TypeConvertor.castToString(value); // StringType
5362          return value;
5363        case 110371416: // title
5364          this.title = TypeConvertor.castToString(value); // StringType
5365          return value;
5366        case 102727412: // label
5367          this.getLabel().add((ResearchStudyLabelComponent) value); // ResearchStudyLabelComponent
5368          return value;
5369        case -989163880: // protocol
5370          this.getProtocol().add(TypeConvertor.castToReference(value)); // Reference
5371          return value;
5372        case -995410646: // partOf
5373          this.getPartOf().add(TypeConvertor.castToReference(value)); // Reference
5374          return value;
5375        case 666807069: // relatedArtifact
5376          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
5377          return value;
5378        case 3076014: // date
5379          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
5380          return value;
5381        case -892481550: // status
5382          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
5383          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5384          return value;
5385        case -2132842986: // primaryPurposeType
5386          this.primaryPurposeType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5387          return value;
5388        case 106629499: // phase
5389          this.phase = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5390          return value;
5391        case 50511102: // category
5392          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5393          return value;
5394        case 97604824: // focus
5395          this.getFocus().add((ResearchStudyFocusComponent) value); // ResearchStudyFocusComponent
5396          return value;
5397        case -861311717: // condition
5398          this.getCondition().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5399          return value;
5400        case -814408215: // keyword
5401          this.getKeyword().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5402          return value;
5403        case 1901043637: // location
5404          this.getLocation().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5405          return value;
5406        case 21530634: // descriptionSummary
5407          this.descriptionSummary = TypeConvertor.castToMarkdown(value); // MarkdownType
5408          return value;
5409        case -1724546052: // description
5410          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5411          return value;
5412        case -991726143: // period
5413          this.period = TypeConvertor.castToPeriod(value); // Period
5414          return value;
5415        case 951526432: // contact
5416          this.getContact().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
5417          return value;
5418        case -1998892262: // sponsor
5419          this.sponsor = TypeConvertor.castToReference(value); // Reference
5420          return value;
5421        case 1437117175: // principalInvestigator
5422          this.principalInvestigator = TypeConvertor.castToReference(value); // Reference
5423          return value;
5424        case 3530567: // site
5425          this.getSite().add(TypeConvertor.castToReference(value)); // Reference
5426          return value;
5427        case 3387378: // note
5428          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
5429          return value;
5430        case 382350310: // classification
5431          this.getClassification().add((ResearchStudyClassificationComponent) value); // ResearchStudyClassificationComponent
5432          return value;
5433        case -1841460864: // associatedParty
5434          this.getAssociatedParty().add((ResearchStudyAssociatedPartyComponent) value); // ResearchStudyAssociatedPartyComponent
5435          return value;
5436        case 1457822360: // currentState
5437          this.getCurrentState().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5438          return value;
5439        case 247524032: // statusDate
5440          this.getStatusDate().add((ResearchStudyStatusDateComponent) value); // ResearchStudyStatusDateComponent
5441          return value;
5442        case -699986715: // whyStopped
5443          this.whyStopped = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5444          return value;
5445        case 780783004: // recruitment
5446          this.recruitment = (ResearchStudyRecruitmentComponent) value; // ResearchStudyRecruitmentComponent
5447          return value;
5448        case -138266634: // comparisonGroup
5449          this.getComparisonGroup().add((ResearchStudyComparisonGroupComponent) value); // ResearchStudyComparisonGroupComponent
5450          return value;
5451        case -1489585863: // objective
5452          this.getObjective().add((ResearchStudyObjectiveComponent) value); // ResearchStudyObjectiveComponent
5453          return value;
5454        case -1510689364: // outcomeMeasure
5455          this.getOutcomeMeasure().add((ResearchStudyOutcomeMeasureComponent) value); // ResearchStudyOutcomeMeasureComponent
5456          return value;
5457        case -934426595: // result
5458          this.getResult().add(TypeConvertor.castToReference(value)); // Reference
5459          return value;
5460        case -828032215: // webLocation
5461          this.getWebLocation().add((ResearchStudyWebLocationComponent) value); // ResearchStudyWebLocationComponent
5462          return value;
5463        default: return super.setProperty(hash, name, value);
5464        }
5465
5466      }
5467
5468      @Override
5469      public Base setProperty(String name, Base value) throws FHIRException {
5470        if (name.equals("url")) {
5471          this.url = TypeConvertor.castToUri(value); // UriType
5472        } else if (name.equals("identifier")) {
5473          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
5474        } else if (name.equals("version")) {
5475          this.version = TypeConvertor.castToString(value); // StringType
5476        } else if (name.equals("name")) {
5477          this.name = TypeConvertor.castToString(value); // StringType
5478        } else if (name.equals("title")) {
5479          this.title = TypeConvertor.castToString(value); // StringType
5480        } else if (name.equals("label")) {
5481          this.getLabel().add((ResearchStudyLabelComponent) value);
5482        } else if (name.equals("protocol")) {
5483          this.getProtocol().add(TypeConvertor.castToReference(value));
5484        } else if (name.equals("partOf")) {
5485          this.getPartOf().add(TypeConvertor.castToReference(value));
5486        } else if (name.equals("relatedArtifact")) {
5487          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value));
5488        } else if (name.equals("date")) {
5489          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
5490        } else if (name.equals("status")) {
5491          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
5492          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5493        } else if (name.equals("primaryPurposeType")) {
5494          this.primaryPurposeType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5495        } else if (name.equals("phase")) {
5496          this.phase = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5497        } else if (name.equals("category")) {
5498          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
5499        } else if (name.equals("focus")) {
5500          this.getFocus().add((ResearchStudyFocusComponent) value);
5501        } else if (name.equals("condition")) {
5502          this.getCondition().add(TypeConvertor.castToCodeableConcept(value));
5503        } else if (name.equals("keyword")) {
5504          this.getKeyword().add(TypeConvertor.castToCodeableConcept(value));
5505        } else if (name.equals("location")) {
5506          this.getLocation().add(TypeConvertor.castToCodeableConcept(value));
5507        } else if (name.equals("descriptionSummary")) {
5508          this.descriptionSummary = TypeConvertor.castToMarkdown(value); // MarkdownType
5509        } else if (name.equals("description")) {
5510          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5511        } else if (name.equals("period")) {
5512          this.period = TypeConvertor.castToPeriod(value); // Period
5513        } else if (name.equals("contact")) {
5514          this.getContact().add(TypeConvertor.castToContactDetail(value));
5515        } else if (name.equals("sponsor")) {
5516          this.sponsor = TypeConvertor.castToReference(value); // Reference
5517        } else if (name.equals("principalInvestigator")) {
5518          this.principalInvestigator = TypeConvertor.castToReference(value); // Reference
5519        } else if (name.equals("site")) {
5520          this.getSite().add(TypeConvertor.castToReference(value));
5521        } else if (name.equals("note")) {
5522          this.getNote().add(TypeConvertor.castToAnnotation(value));
5523        } else if (name.equals("classification")) {
5524          this.getClassification().add((ResearchStudyClassificationComponent) value);
5525        } else if (name.equals("associatedParty")) {
5526          this.getAssociatedParty().add((ResearchStudyAssociatedPartyComponent) value);
5527        } else if (name.equals("currentState")) {
5528          this.getCurrentState().add(TypeConvertor.castToCodeableConcept(value));
5529        } else if (name.equals("statusDate")) {
5530          this.getStatusDate().add((ResearchStudyStatusDateComponent) value);
5531        } else if (name.equals("whyStopped")) {
5532          this.whyStopped = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5533        } else if (name.equals("recruitment")) {
5534          this.recruitment = (ResearchStudyRecruitmentComponent) value; // ResearchStudyRecruitmentComponent
5535        } else if (name.equals("comparisonGroup")) {
5536          this.getComparisonGroup().add((ResearchStudyComparisonGroupComponent) value);
5537        } else if (name.equals("objective")) {
5538          this.getObjective().add((ResearchStudyObjectiveComponent) value);
5539        } else if (name.equals("outcomeMeasure")) {
5540          this.getOutcomeMeasure().add((ResearchStudyOutcomeMeasureComponent) value);
5541        } else if (name.equals("result")) {
5542          this.getResult().add(TypeConvertor.castToReference(value));
5543        } else if (name.equals("webLocation")) {
5544          this.getWebLocation().add((ResearchStudyWebLocationComponent) value);
5545        } else
5546          return super.setProperty(name, value);
5547        return value;
5548      }
5549
5550      @Override
5551      public Base makeProperty(int hash, String name) throws FHIRException {
5552        switch (hash) {
5553        case 116079:  return getUrlElement();
5554        case -1618432855:  return addIdentifier(); 
5555        case 351608024:  return getVersionElement();
5556        case 3373707:  return getNameElement();
5557        case 110371416:  return getTitleElement();
5558        case 102727412:  return addLabel(); 
5559        case -989163880:  return addProtocol(); 
5560        case -995410646:  return addPartOf(); 
5561        case 666807069:  return addRelatedArtifact(); 
5562        case 3076014:  return getDateElement();
5563        case -892481550:  return getStatusElement();
5564        case -2132842986:  return getPrimaryPurposeType();
5565        case 106629499:  return getPhase();
5566        case 50511102:  return addCategory(); 
5567        case 97604824:  return addFocus(); 
5568        case -861311717:  return addCondition(); 
5569        case -814408215:  return addKeyword(); 
5570        case 1901043637:  return addLocation(); 
5571        case 21530634:  return getDescriptionSummaryElement();
5572        case -1724546052:  return getDescriptionElement();
5573        case -991726143:  return getPeriod();
5574        case 951526432:  return addContact(); 
5575        case -1998892262:  return getSponsor();
5576        case 1437117175:  return getPrincipalInvestigator();
5577        case 3530567:  return addSite(); 
5578        case 3387378:  return addNote(); 
5579        case 382350310:  return addClassification(); 
5580        case -1841460864:  return addAssociatedParty(); 
5581        case 1457822360:  return addCurrentState(); 
5582        case 247524032:  return addStatusDate(); 
5583        case -699986715:  return getWhyStopped();
5584        case 780783004:  return getRecruitment();
5585        case -138266634:  return addComparisonGroup(); 
5586        case -1489585863:  return addObjective(); 
5587        case -1510689364:  return addOutcomeMeasure(); 
5588        case -934426595:  return addResult(); 
5589        case -828032215:  return addWebLocation(); 
5590        default: return super.makeProperty(hash, name);
5591        }
5592
5593      }
5594
5595      @Override
5596      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5597        switch (hash) {
5598        case 116079: /*url*/ return new String[] {"uri"};
5599        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5600        case 351608024: /*version*/ return new String[] {"string"};
5601        case 3373707: /*name*/ return new String[] {"string"};
5602        case 110371416: /*title*/ return new String[] {"string"};
5603        case 102727412: /*label*/ return new String[] {};
5604        case -989163880: /*protocol*/ return new String[] {"Reference"};
5605        case -995410646: /*partOf*/ return new String[] {"Reference"};
5606        case 666807069: /*relatedArtifact*/ return new String[] {"RelatedArtifact"};
5607        case 3076014: /*date*/ return new String[] {"dateTime"};
5608        case -892481550: /*status*/ return new String[] {"code"};
5609        case -2132842986: /*primaryPurposeType*/ return new String[] {"CodeableConcept"};
5610        case 106629499: /*phase*/ return new String[] {"CodeableConcept"};
5611        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5612        case 97604824: /*focus*/ return new String[] {};
5613        case -861311717: /*condition*/ return new String[] {"CodeableConcept"};
5614        case -814408215: /*keyword*/ return new String[] {"CodeableConcept"};
5615        case 1901043637: /*location*/ return new String[] {"CodeableConcept"};
5616        case 21530634: /*descriptionSummary*/ return new String[] {"markdown"};
5617        case -1724546052: /*description*/ return new String[] {"markdown"};
5618        case -991726143: /*period*/ return new String[] {"Period"};
5619        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
5620        case -1998892262: /*sponsor*/ return new String[] {"Reference"};
5621        case 1437117175: /*principalInvestigator*/ return new String[] {"Reference"};
5622        case 3530567: /*site*/ return new String[] {"Reference"};
5623        case 3387378: /*note*/ return new String[] {"Annotation"};
5624        case 382350310: /*classification*/ return new String[] {};
5625        case -1841460864: /*associatedParty*/ return new String[] {};
5626        case 1457822360: /*currentState*/ return new String[] {"CodeableConcept"};
5627        case 247524032: /*statusDate*/ return new String[] {};
5628        case -699986715: /*whyStopped*/ return new String[] {"CodeableConcept"};
5629        case 780783004: /*recruitment*/ return new String[] {};
5630        case -138266634: /*comparisonGroup*/ return new String[] {};
5631        case -1489585863: /*objective*/ return new String[] {};
5632        case -1510689364: /*outcomeMeasure*/ return new String[] {};
5633        case -934426595: /*result*/ return new String[] {"Reference"};
5634        case -828032215: /*webLocation*/ return new String[] {};
5635        default: return super.getTypesForProperty(hash, name);
5636        }
5637
5638      }
5639
5640      @Override
5641      public Base addChild(String name) throws FHIRException {
5642        if (name.equals("url")) {
5643          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.url");
5644        }
5645        else if (name.equals("identifier")) {
5646          return addIdentifier();
5647        }
5648        else if (name.equals("version")) {
5649          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.version");
5650        }
5651        else if (name.equals("name")) {
5652          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.name");
5653        }
5654        else if (name.equals("title")) {
5655          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.title");
5656        }
5657        else if (name.equals("label")) {
5658          return addLabel();
5659        }
5660        else if (name.equals("protocol")) {
5661          return addProtocol();
5662        }
5663        else if (name.equals("partOf")) {
5664          return addPartOf();
5665        }
5666        else if (name.equals("relatedArtifact")) {
5667          return addRelatedArtifact();
5668        }
5669        else if (name.equals("date")) {
5670          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.date");
5671        }
5672        else if (name.equals("status")) {
5673          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.status");
5674        }
5675        else if (name.equals("primaryPurposeType")) {
5676          this.primaryPurposeType = new CodeableConcept();
5677          return this.primaryPurposeType;
5678        }
5679        else if (name.equals("phase")) {
5680          this.phase = new CodeableConcept();
5681          return this.phase;
5682        }
5683        else if (name.equals("category")) {
5684          return addCategory();
5685        }
5686        else if (name.equals("focus")) {
5687          return addFocus();
5688        }
5689        else if (name.equals("condition")) {
5690          return addCondition();
5691        }
5692        else if (name.equals("keyword")) {
5693          return addKeyword();
5694        }
5695        else if (name.equals("location")) {
5696          return addLocation();
5697        }
5698        else if (name.equals("descriptionSummary")) {
5699          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.descriptionSummary");
5700        }
5701        else if (name.equals("description")) {
5702          throw new FHIRException("Cannot call addChild on a primitive type ResearchStudy.description");
5703        }
5704        else if (name.equals("period")) {
5705          this.period = new Period();
5706          return this.period;
5707        }
5708        else if (name.equals("contact")) {
5709          return addContact();
5710        }
5711        else if (name.equals("sponsor")) {
5712          this.sponsor = new Reference();
5713          return this.sponsor;
5714        }
5715        else if (name.equals("principalInvestigator")) {
5716          this.principalInvestigator = new Reference();
5717          return this.principalInvestigator;
5718        }
5719        else if (name.equals("site")) {
5720          return addSite();
5721        }
5722        else if (name.equals("note")) {
5723          return addNote();
5724        }
5725        else if (name.equals("classification")) {
5726          return addClassification();
5727        }
5728        else if (name.equals("associatedParty")) {
5729          return addAssociatedParty();
5730        }
5731        else if (name.equals("currentState")) {
5732          return addCurrentState();
5733        }
5734        else if (name.equals("statusDate")) {
5735          return addStatusDate();
5736        }
5737        else if (name.equals("whyStopped")) {
5738          this.whyStopped = new CodeableConcept();
5739          return this.whyStopped;
5740        }
5741        else if (name.equals("recruitment")) {
5742          this.recruitment = new ResearchStudyRecruitmentComponent();
5743          return this.recruitment;
5744        }
5745        else if (name.equals("comparisonGroup")) {
5746          return addComparisonGroup();
5747        }
5748        else if (name.equals("objective")) {
5749          return addObjective();
5750        }
5751        else if (name.equals("outcomeMeasure")) {
5752          return addOutcomeMeasure();
5753        }
5754        else if (name.equals("result")) {
5755          return addResult();
5756        }
5757        else if (name.equals("webLocation")) {
5758          return addWebLocation();
5759        }
5760        else
5761          return super.addChild(name);
5762      }
5763
5764  public String fhirType() {
5765    return "ResearchStudy";
5766
5767  }
5768
5769      public ResearchStudy copy() {
5770        ResearchStudy dst = new ResearchStudy();
5771        copyValues(dst);
5772        return dst;
5773      }
5774
5775      public void copyValues(ResearchStudy dst) {
5776        super.copyValues(dst);
5777        dst.url = url == null ? null : url.copy();
5778        if (identifier != null) {
5779          dst.identifier = new ArrayList<Identifier>();
5780          for (Identifier i : identifier)
5781            dst.identifier.add(i.copy());
5782        };
5783        dst.version = version == null ? null : version.copy();
5784        dst.name = name == null ? null : name.copy();
5785        dst.title = title == null ? null : title.copy();
5786        if (label != null) {
5787          dst.label = new ArrayList<ResearchStudyLabelComponent>();
5788          for (ResearchStudyLabelComponent i : label)
5789            dst.label.add(i.copy());
5790        };
5791        if (protocol != null) {
5792          dst.protocol = new ArrayList<Reference>();
5793          for (Reference i : protocol)
5794            dst.protocol.add(i.copy());
5795        };
5796        if (partOf != null) {
5797          dst.partOf = new ArrayList<Reference>();
5798          for (Reference i : partOf)
5799            dst.partOf.add(i.copy());
5800        };
5801        if (relatedArtifact != null) {
5802          dst.relatedArtifact = new ArrayList<RelatedArtifact>();
5803          for (RelatedArtifact i : relatedArtifact)
5804            dst.relatedArtifact.add(i.copy());
5805        };
5806        dst.date = date == null ? null : date.copy();
5807        dst.status = status == null ? null : status.copy();
5808        dst.primaryPurposeType = primaryPurposeType == null ? null : primaryPurposeType.copy();
5809        dst.phase = phase == null ? null : phase.copy();
5810        if (category != null) {
5811          dst.category = new ArrayList<CodeableConcept>();
5812          for (CodeableConcept i : category)
5813            dst.category.add(i.copy());
5814        };
5815        if (focus != null) {
5816          dst.focus = new ArrayList<ResearchStudyFocusComponent>();
5817          for (ResearchStudyFocusComponent i : focus)
5818            dst.focus.add(i.copy());
5819        };
5820        if (condition != null) {
5821          dst.condition = new ArrayList<CodeableConcept>();
5822          for (CodeableConcept i : condition)
5823            dst.condition.add(i.copy());
5824        };
5825        if (keyword != null) {
5826          dst.keyword = new ArrayList<CodeableConcept>();
5827          for (CodeableConcept i : keyword)
5828            dst.keyword.add(i.copy());
5829        };
5830        if (location != null) {
5831          dst.location = new ArrayList<CodeableConcept>();
5832          for (CodeableConcept i : location)
5833            dst.location.add(i.copy());
5834        };
5835        dst.descriptionSummary = descriptionSummary == null ? null : descriptionSummary.copy();
5836        dst.description = description == null ? null : description.copy();
5837        dst.period = period == null ? null : period.copy();
5838        if (contact != null) {
5839          dst.contact = new ArrayList<ContactDetail>();
5840          for (ContactDetail i : contact)
5841            dst.contact.add(i.copy());
5842        };
5843        dst.sponsor = sponsor == null ? null : sponsor.copy();
5844        dst.principalInvestigator = principalInvestigator == null ? null : principalInvestigator.copy();
5845        if (site != null) {
5846          dst.site = new ArrayList<Reference>();
5847          for (Reference i : site)
5848            dst.site.add(i.copy());
5849        };
5850        if (note != null) {
5851          dst.note = new ArrayList<Annotation>();
5852          for (Annotation i : note)
5853            dst.note.add(i.copy());
5854        };
5855        if (classification != null) {
5856          dst.classification = new ArrayList<ResearchStudyClassificationComponent>();
5857          for (ResearchStudyClassificationComponent i : classification)
5858            dst.classification.add(i.copy());
5859        };
5860        if (associatedParty != null) {
5861          dst.associatedParty = new ArrayList<ResearchStudyAssociatedPartyComponent>();
5862          for (ResearchStudyAssociatedPartyComponent i : associatedParty)
5863            dst.associatedParty.add(i.copy());
5864        };
5865        if (currentState != null) {
5866          dst.currentState = new ArrayList<CodeableConcept>();
5867          for (CodeableConcept i : currentState)
5868            dst.currentState.add(i.copy());
5869        };
5870        if (statusDate != null) {
5871          dst.statusDate = new ArrayList<ResearchStudyStatusDateComponent>();
5872          for (ResearchStudyStatusDateComponent i : statusDate)
5873            dst.statusDate.add(i.copy());
5874        };
5875        dst.whyStopped = whyStopped == null ? null : whyStopped.copy();
5876        dst.recruitment = recruitment == null ? null : recruitment.copy();
5877        if (comparisonGroup != null) {
5878          dst.comparisonGroup = new ArrayList<ResearchStudyComparisonGroupComponent>();
5879          for (ResearchStudyComparisonGroupComponent i : comparisonGroup)
5880            dst.comparisonGroup.add(i.copy());
5881        };
5882        if (objective != null) {
5883          dst.objective = new ArrayList<ResearchStudyObjectiveComponent>();
5884          for (ResearchStudyObjectiveComponent i : objective)
5885            dst.objective.add(i.copy());
5886        };
5887        if (outcomeMeasure != null) {
5888          dst.outcomeMeasure = new ArrayList<ResearchStudyOutcomeMeasureComponent>();
5889          for (ResearchStudyOutcomeMeasureComponent i : outcomeMeasure)
5890            dst.outcomeMeasure.add(i.copy());
5891        };
5892        if (result != null) {
5893          dst.result = new ArrayList<Reference>();
5894          for (Reference i : result)
5895            dst.result.add(i.copy());
5896        };
5897        if (webLocation != null) {
5898          dst.webLocation = new ArrayList<ResearchStudyWebLocationComponent>();
5899          for (ResearchStudyWebLocationComponent i : webLocation)
5900            dst.webLocation.add(i.copy());
5901        };
5902      }
5903
5904      protected ResearchStudy typedCopy() {
5905        return copy();
5906      }
5907
5908      @Override
5909      public boolean equalsDeep(Base other_) {
5910        if (!super.equalsDeep(other_))
5911          return false;
5912        if (!(other_ instanceof ResearchStudy))
5913          return false;
5914        ResearchStudy o = (ResearchStudy) other_;
5915        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
5916           && compareDeep(name, o.name, true) && compareDeep(title, o.title, true) && compareDeep(label, o.label, true)
5917           && compareDeep(protocol, o.protocol, true) && compareDeep(partOf, o.partOf, true) && compareDeep(relatedArtifact, o.relatedArtifact, true)
5918           && compareDeep(date, o.date, true) && compareDeep(status, o.status, true) && compareDeep(primaryPurposeType, o.primaryPurposeType, true)
5919           && compareDeep(phase, o.phase, true) && compareDeep(category, o.category, true) && compareDeep(focus, o.focus, true)
5920           && compareDeep(condition, o.condition, true) && compareDeep(keyword, o.keyword, true) && compareDeep(location, o.location, true)
5921           && compareDeep(descriptionSummary, o.descriptionSummary, true) && compareDeep(description, o.description, true)
5922           && compareDeep(period, o.period, true) && compareDeep(contact, o.contact, true) && compareDeep(sponsor, o.sponsor, true)
5923           && compareDeep(principalInvestigator, o.principalInvestigator, true) && compareDeep(site, o.site, true)
5924           && compareDeep(note, o.note, true) && compareDeep(classification, o.classification, true) && compareDeep(associatedParty, o.associatedParty, true)
5925           && compareDeep(currentState, o.currentState, true) && compareDeep(statusDate, o.statusDate, true)
5926           && compareDeep(whyStopped, o.whyStopped, true) && compareDeep(recruitment, o.recruitment, true)
5927           && compareDeep(comparisonGroup, o.comparisonGroup, true) && compareDeep(objective, o.objective, true)
5928           && compareDeep(outcomeMeasure, o.outcomeMeasure, true) && compareDeep(result, o.result, true) && compareDeep(webLocation, o.webLocation, true)
5929          ;
5930      }
5931
5932      @Override
5933      public boolean equalsShallow(Base other_) {
5934        if (!super.equalsShallow(other_))
5935          return false;
5936        if (!(other_ instanceof ResearchStudy))
5937          return false;
5938        ResearchStudy o = (ResearchStudy) other_;
5939        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
5940           && compareValues(title, o.title, true) && compareValues(date, o.date, true) && compareValues(status, o.status, true)
5941           && compareValues(descriptionSummary, o.descriptionSummary, true) && compareValues(description, o.description, true)
5942          ;
5943      }
5944
5945      public boolean isEmpty() {
5946        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, identifier, version
5947          , name, title, label, protocol, partOf, relatedArtifact, date, status, primaryPurposeType
5948          , phase, category, focus, condition, keyword, location, descriptionSummary, description
5949          , period, contact, sponsor, principalInvestigator, site, note, classification
5950          , associatedParty, currentState, statusDate, whyStopped, recruitment, comparisonGroup
5951          , objective, outcomeMeasure, result, webLocation);
5952      }
5953
5954  @Override
5955  public ResourceType getResourceType() {
5956    return ResourceType.ResearchStudy;
5957   }
5958
5959 /**
5960   * Search parameter: <b>category</b>
5961   * <p>
5962   * Description: <b>Classifications for the study</b><br>
5963   * Type: <b>token</b><br>
5964   * Path: <b>ResearchStudy.category</b><br>
5965   * </p>
5966   */
5967  @SearchParamDefinition(name="category", path="ResearchStudy.category", description="Classifications for the study", type="token" )
5968  public static final String SP_CATEGORY = "category";
5969 /**
5970   * <b>Fluent Client</b> search parameter constant for <b>category</b>
5971   * <p>
5972   * Description: <b>Classifications for the study</b><br>
5973   * Type: <b>token</b><br>
5974   * Path: <b>ResearchStudy.category</b><br>
5975   * </p>
5976   */
5977  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
5978
5979 /**
5980   * Search parameter: <b>condition</b>
5981   * <p>
5982   * Description: <b>Condition being studied</b><br>
5983   * Type: <b>token</b><br>
5984   * Path: <b>ResearchStudy.condition</b><br>
5985   * </p>
5986   */
5987  @SearchParamDefinition(name="condition", path="ResearchStudy.condition", description="Condition being studied", type="token" )
5988  public static final String SP_CONDITION = "condition";
5989 /**
5990   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
5991   * <p>
5992   * Description: <b>Condition being studied</b><br>
5993   * Type: <b>token</b><br>
5994   * Path: <b>ResearchStudy.condition</b><br>
5995   * </p>
5996   */
5997  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONDITION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONDITION);
5998
5999 /**
6000   * Search parameter: <b>date</b>
6001   * <p>
6002   * Description: <b>When the study began and ended</b><br>
6003   * Type: <b>date</b><br>
6004   * Path: <b>ResearchStudy.period</b><br>
6005   * </p>
6006   */
6007  @SearchParamDefinition(name="date", path="ResearchStudy.period", description="When the study began and ended", type="date" )
6008  public static final String SP_DATE = "date";
6009 /**
6010   * <b>Fluent Client</b> search parameter constant for <b>date</b>
6011   * <p>
6012   * Description: <b>When the study began and ended</b><br>
6013   * Type: <b>date</b><br>
6014   * Path: <b>ResearchStudy.period</b><br>
6015   * </p>
6016   */
6017  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
6018
6019 /**
6020   * Search parameter: <b>focus</b>
6021   * <p>
6022   * Description: <b>Drugs, devices, etc. under study</b><br>
6023   * Type: <b>token</b><br>
6024   * Path: <b>ResearchStudy.focus</b><br>
6025   * </p>
6026   */
6027  @SearchParamDefinition(name="focus", path="ResearchStudy.focus", description="Drugs, devices, etc. under study", type="token" )
6028  public static final String SP_FOCUS = "focus";
6029 /**
6030   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
6031   * <p>
6032   * Description: <b>Drugs, devices, etc. under study</b><br>
6033   * Type: <b>token</b><br>
6034   * Path: <b>ResearchStudy.focus</b><br>
6035   * </p>
6036   */
6037  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FOCUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FOCUS);
6038
6039 /**
6040   * Search parameter: <b>identifier</b>
6041   * <p>
6042   * Description: <b>Business Identifier for study</b><br>
6043   * Type: <b>token</b><br>
6044   * Path: <b>ResearchStudy.identifier</b><br>
6045   * </p>
6046   */
6047  @SearchParamDefinition(name="identifier", path="ResearchStudy.identifier", description="Business Identifier for study", type="token" )
6048  public static final String SP_IDENTIFIER = "identifier";
6049 /**
6050   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6051   * <p>
6052   * Description: <b>Business Identifier for study</b><br>
6053   * Type: <b>token</b><br>
6054   * Path: <b>ResearchStudy.identifier</b><br>
6055   * </p>
6056   */
6057  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6058
6059 /**
6060   * Search parameter: <b>keyword</b>
6061   * <p>
6062   * Description: <b>Used to search for the study</b><br>
6063   * Type: <b>token</b><br>
6064   * Path: <b>ResearchStudy.keyword</b><br>
6065   * </p>
6066   */
6067  @SearchParamDefinition(name="keyword", path="ResearchStudy.keyword", description="Used to search for the study", type="token" )
6068  public static final String SP_KEYWORD = "keyword";
6069 /**
6070   * <b>Fluent Client</b> search parameter constant for <b>keyword</b>
6071   * <p>
6072   * Description: <b>Used to search for the study</b><br>
6073   * Type: <b>token</b><br>
6074   * Path: <b>ResearchStudy.keyword</b><br>
6075   * </p>
6076   */
6077  public static final ca.uhn.fhir.rest.gclient.TokenClientParam KEYWORD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_KEYWORD);
6078
6079 /**
6080   * Search parameter: <b>location</b>
6081   * <p>
6082   * Description: <b>Geographic region(s) for study</b><br>
6083   * Type: <b>token</b><br>
6084   * Path: <b>ResearchStudy.location</b><br>
6085   * </p>
6086   */
6087  @SearchParamDefinition(name="location", path="ResearchStudy.location", description="Geographic region(s) for study", type="token" )
6088  public static final String SP_LOCATION = "location";
6089 /**
6090   * <b>Fluent Client</b> search parameter constant for <b>location</b>
6091   * <p>
6092   * Description: <b>Geographic region(s) for study</b><br>
6093   * Type: <b>token</b><br>
6094   * Path: <b>ResearchStudy.location</b><br>
6095   * </p>
6096   */
6097  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOCATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOCATION);
6098
6099 /**
6100   * Search parameter: <b>partof</b>
6101   * <p>
6102   * Description: <b>Part of larger study</b><br>
6103   * Type: <b>reference</b><br>
6104   * Path: <b>ResearchStudy.partOf</b><br>
6105   * </p>
6106   */
6107  @SearchParamDefinition(name="partof", path="ResearchStudy.partOf", description="Part of larger study", type="reference", target={ResearchStudy.class } )
6108  public static final String SP_PARTOF = "partof";
6109 /**
6110   * <b>Fluent Client</b> search parameter constant for <b>partof</b>
6111   * <p>
6112   * Description: <b>Part of larger study</b><br>
6113   * Type: <b>reference</b><br>
6114   * Path: <b>ResearchStudy.partOf</b><br>
6115   * </p>
6116   */
6117  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTOF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTOF);
6118
6119/**
6120   * Constant for fluent queries to be used to add include statements. Specifies
6121   * the path value of "<b>ResearchStudy:partof</b>".
6122   */
6123  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTOF = new ca.uhn.fhir.model.api.Include("ResearchStudy:partof").toLocked();
6124
6125 /**
6126   * Search parameter: <b>principalinvestigator</b>
6127   * <p>
6128   * Description: <b>Researcher who oversees multiple aspects of the study</b><br>
6129   * Type: <b>reference</b><br>
6130   * Path: <b>ResearchStudy.principalInvestigator</b><br>
6131   * </p>
6132   */
6133  @SearchParamDefinition(name="principalinvestigator", path="ResearchStudy.principalInvestigator", description="Researcher who oversees multiple aspects of the study", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
6134  public static final String SP_PRINCIPALINVESTIGATOR = "principalinvestigator";
6135 /**
6136   * <b>Fluent Client</b> search parameter constant for <b>principalinvestigator</b>
6137   * <p>
6138   * Description: <b>Researcher who oversees multiple aspects of the study</b><br>
6139   * Type: <b>reference</b><br>
6140   * Path: <b>ResearchStudy.principalInvestigator</b><br>
6141   * </p>
6142   */
6143  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRINCIPALINVESTIGATOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRINCIPALINVESTIGATOR);
6144
6145/**
6146   * Constant for fluent queries to be used to add include statements. Specifies
6147   * the path value of "<b>ResearchStudy:principalinvestigator</b>".
6148   */
6149  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRINCIPALINVESTIGATOR = new ca.uhn.fhir.model.api.Include("ResearchStudy:principalinvestigator").toLocked();
6150
6151 /**
6152   * Search parameter: <b>protocol</b>
6153   * <p>
6154   * Description: <b>Steps followed in executing study</b><br>
6155   * Type: <b>reference</b><br>
6156   * Path: <b>ResearchStudy.protocol</b><br>
6157   * </p>
6158   */
6159  @SearchParamDefinition(name="protocol", path="ResearchStudy.protocol", description="Steps followed in executing study", type="reference", target={PlanDefinition.class } )
6160  public static final String SP_PROTOCOL = "protocol";
6161 /**
6162   * <b>Fluent Client</b> search parameter constant for <b>protocol</b>
6163   * <p>
6164   * Description: <b>Steps followed in executing study</b><br>
6165   * Type: <b>reference</b><br>
6166   * Path: <b>ResearchStudy.protocol</b><br>
6167   * </p>
6168   */
6169  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROTOCOL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROTOCOL);
6170
6171/**
6172   * Constant for fluent queries to be used to add include statements. Specifies
6173   * the path value of "<b>ResearchStudy:protocol</b>".
6174   */
6175  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROTOCOL = new ca.uhn.fhir.model.api.Include("ResearchStudy:protocol").toLocked();
6176
6177 /**
6178   * Search parameter: <b>recruitment_actual</b>
6179   * <p>
6180   * Description: <b>Actual number of participants enrolled in study across all groups</b><br>
6181   * Type: <b>number</b><br>
6182   * Path: <b>ResearchStudy.recruitment.actualNumber</b><br>
6183   * </p>
6184   */
6185  @SearchParamDefinition(name="recruitment_actual", path="ResearchStudy.recruitment.actualNumber", description="Actual number of participants enrolled in study across all groups", type="number" )
6186  public static final String SP_RECRUITMENTACTUAL = "recruitment_actual";
6187 /**
6188   * <b>Fluent Client</b> search parameter constant for <b>recruitment_actual</b>
6189   * <p>
6190   * Description: <b>Actual number of participants enrolled in study across all groups</b><br>
6191   * Type: <b>number</b><br>
6192   * Path: <b>ResearchStudy.recruitment.actualNumber</b><br>
6193   * </p>
6194   */
6195  public static final ca.uhn.fhir.rest.gclient.NumberClientParam RECRUITMENTACTUAL = new ca.uhn.fhir.rest.gclient.NumberClientParam(SP_RECRUITMENTACTUAL);
6196
6197 /**
6198   * Search parameter: <b>recruitment_target</b>
6199   * <p>
6200   * Description: <b>Target number of participants enrolled in study across all groups</b><br>
6201   * Type: <b>number</b><br>
6202   * Path: <b>ResearchStudy.recruitment.targetNumber</b><br>
6203   * </p>
6204   */
6205  @SearchParamDefinition(name="recruitment_target", path="ResearchStudy.recruitment.targetNumber", description="Target number of participants enrolled in study across all groups", type="number" )
6206  public static final String SP_RECRUITMENTTARGET = "recruitment_target";
6207 /**
6208   * <b>Fluent Client</b> search parameter constant for <b>recruitment_target</b>
6209   * <p>
6210   * Description: <b>Target number of participants enrolled in study across all groups</b><br>
6211   * Type: <b>number</b><br>
6212   * Path: <b>ResearchStudy.recruitment.targetNumber</b><br>
6213   * </p>
6214   */
6215  public static final ca.uhn.fhir.rest.gclient.NumberClientParam RECRUITMENTTARGET = new ca.uhn.fhir.rest.gclient.NumberClientParam(SP_RECRUITMENTTARGET);
6216
6217 /**
6218   * Search parameter: <b>site</b>
6219   * <p>
6220   * Description: <b>Facility where study activities are conducted</b><br>
6221   * Type: <b>reference</b><br>
6222   * Path: <b>ResearchStudy.site</b><br>
6223   * </p>
6224   */
6225  @SearchParamDefinition(name="site", path="ResearchStudy.site", description="Facility where study activities are conducted", type="reference", target={Location.class, Organization.class, ResearchStudy.class } )
6226  public static final String SP_SITE = "site";
6227 /**
6228   * <b>Fluent Client</b> search parameter constant for <b>site</b>
6229   * <p>
6230   * Description: <b>Facility where study activities are conducted</b><br>
6231   * Type: <b>reference</b><br>
6232   * Path: <b>ResearchStudy.site</b><br>
6233   * </p>
6234   */
6235  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SITE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SITE);
6236
6237/**
6238   * Constant for fluent queries to be used to add include statements. Specifies
6239   * the path value of "<b>ResearchStudy:site</b>".
6240   */
6241  public static final ca.uhn.fhir.model.api.Include INCLUDE_SITE = new ca.uhn.fhir.model.api.Include("ResearchStudy:site").toLocked();
6242
6243 /**
6244   * Search parameter: <b>sponsor</b>
6245   * <p>
6246   * Description: <b>Organization that initiates and is legally responsible for the study</b><br>
6247   * Type: <b>reference</b><br>
6248   * Path: <b>ResearchStudy.sponsor</b><br>
6249   * </p>
6250   */
6251  @SearchParamDefinition(name="sponsor", path="ResearchStudy.sponsor", description="Organization that initiates and is legally responsible for the study", type="reference", target={Organization.class } )
6252  public static final String SP_SPONSOR = "sponsor";
6253 /**
6254   * <b>Fluent Client</b> search parameter constant for <b>sponsor</b>
6255   * <p>
6256   * Description: <b>Organization that initiates and is legally responsible for the study</b><br>
6257   * Type: <b>reference</b><br>
6258   * Path: <b>ResearchStudy.sponsor</b><br>
6259   * </p>
6260   */
6261  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPONSOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SPONSOR);
6262
6263/**
6264   * Constant for fluent queries to be used to add include statements. Specifies
6265   * the path value of "<b>ResearchStudy:sponsor</b>".
6266   */
6267  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPONSOR = new ca.uhn.fhir.model.api.Include("ResearchStudy:sponsor").toLocked();
6268
6269 /**
6270   * Search parameter: <b>status</b>
6271   * <p>
6272   * Description: <b>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</b><br>
6273   * Type: <b>token</b><br>
6274   * Path: <b>ResearchStudy.status</b><br>
6275   * </p>
6276   */
6277  @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" )
6278  public static final String SP_STATUS = "status";
6279 /**
6280   * <b>Fluent Client</b> search parameter constant for <b>status</b>
6281   * <p>
6282   * Description: <b>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</b><br>
6283   * Type: <b>token</b><br>
6284   * Path: <b>ResearchStudy.status</b><br>
6285   * </p>
6286   */
6287  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
6288
6289 /**
6290   * Search parameter: <b>title</b>
6291   * <p>
6292   * Description: <b>Name for this study</b><br>
6293   * Type: <b>string</b><br>
6294   * Path: <b>ResearchStudy.title</b><br>
6295   * </p>
6296   */
6297  @SearchParamDefinition(name="title", path="ResearchStudy.title", description="Name for this study", type="string" )
6298  public static final String SP_TITLE = "title";
6299 /**
6300   * <b>Fluent Client</b> search parameter constant for <b>title</b>
6301   * <p>
6302   * Description: <b>Name for this study</b><br>
6303   * Type: <b>string</b><br>
6304   * Path: <b>ResearchStudy.title</b><br>
6305   * </p>
6306   */
6307  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
6308
6309
6310}
6311