001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.ChildOrder;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.DatatypeDef;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045import org.hl7.fhir.exceptions.FHIRFormatError;
046/**
047 * Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data.
048 */
049@DatatypeDef(name="DataRequirement")
050public class DataRequirement extends Type implements ICompositeType {
051
052    @Block()
053    public static class DataRequirementCodeFilterComponent extends Element implements IBaseDatatypeElement {
054        /**
055         * The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
056         */
057        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
058        @Description(shortDefinition="The code-valued attribute of the filter", formalDefinition="The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." )
059        protected StringType path;
060
061        /**
062         * The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.
063         */
064        @Child(name = "valueSet", type = {StringType.class, ValueSet.class}, order=2, min=0, max=1, modifier=false, summary=true)
065        @Description(shortDefinition="Valueset for the filter", formalDefinition="The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset." )
066        protected Type valueSet;
067
068        /**
069         * The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.
070         */
071        @Child(name = "valueCode", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
072        @Description(shortDefinition="What code is expected", formalDefinition="The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes." )
073        protected List<CodeType> valueCode;
074
075        /**
076         * The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified Codings.
077         */
078        @Child(name = "valueCoding", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
079        @Description(shortDefinition="What Coding is expected", formalDefinition="The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified Codings." )
080        protected List<Coding> valueCoding;
081
082        /**
083         * The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified CodeableConcepts.
084         */
085        @Child(name = "valueCodeableConcept", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
086        @Description(shortDefinition="What CodeableConcept is expected", formalDefinition="The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified CodeableConcepts." )
087        protected List<CodeableConcept> valueCodeableConcept;
088
089        private static final long serialVersionUID = -888422840L;
090
091    /**
092     * Constructor
093     */
094      public DataRequirementCodeFilterComponent() {
095        super();
096      }
097
098    /**
099     * Constructor
100     */
101      public DataRequirementCodeFilterComponent(StringType path) {
102        super();
103        this.path = path;
104      }
105
106        /**
107         * @return {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
108         */
109        public StringType getPathElement() { 
110          if (this.path == null)
111            if (Configuration.errorOnAutoCreate())
112              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.path");
113            else if (Configuration.doAutoCreate())
114              this.path = new StringType(); // bb
115          return this.path;
116        }
117
118        public boolean hasPathElement() { 
119          return this.path != null && !this.path.isEmpty();
120        }
121
122        public boolean hasPath() { 
123          return this.path != null && !this.path.isEmpty();
124        }
125
126        /**
127         * @param value {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
128         */
129        public DataRequirementCodeFilterComponent setPathElement(StringType value) { 
130          this.path = value;
131          return this;
132        }
133
134        /**
135         * @return The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
136         */
137        public String getPath() { 
138          return this.path == null ? null : this.path.getValue();
139        }
140
141        /**
142         * @param value The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
143         */
144        public DataRequirementCodeFilterComponent setPath(String value) { 
145            if (this.path == null)
146              this.path = new StringType();
147            this.path.setValue(value);
148          return this;
149        }
150
151        /**
152         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
153         */
154        public Type getValueSet() { 
155          return this.valueSet;
156        }
157
158        /**
159         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
160         */
161        public StringType getValueSetStringType() throws FHIRException { 
162          if (this.valueSet == null)
163            return null;
164          if (!(this.valueSet instanceof StringType))
165            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
166          return (StringType) this.valueSet;
167        }
168
169        public boolean hasValueSetStringType() { 
170          return this != null && this.valueSet instanceof StringType;
171        }
172
173        /**
174         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
175         */
176        public Reference getValueSetReference() throws FHIRException { 
177          if (this.valueSet == null)
178            return null;
179          if (!(this.valueSet instanceof Reference))
180            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
181          return (Reference) this.valueSet;
182        }
183
184        public boolean hasValueSetReference() { 
185          return this != null && this.valueSet instanceof Reference;
186        }
187
188        public boolean hasValueSet() { 
189          return this.valueSet != null && !this.valueSet.isEmpty();
190        }
191
192        /**
193         * @param value {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
194         */
195        public DataRequirementCodeFilterComponent setValueSet(Type value) throws FHIRFormatError { 
196          if (value != null && !(value instanceof StringType || value instanceof Reference))
197            throw new FHIRFormatError("Not the right type for DataRequirement.codeFilter.valueSet[x]: "+value.fhirType());
198          this.valueSet = value;
199          return this;
200        }
201
202        /**
203         * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.)
204         */
205        public List<CodeType> getValueCode() { 
206          if (this.valueCode == null)
207            this.valueCode = new ArrayList<CodeType>();
208          return this.valueCode;
209        }
210
211        /**
212         * @return Returns a reference to <code>this</code> for easy method chaining
213         */
214        public DataRequirementCodeFilterComponent setValueCode(List<CodeType> theValueCode) { 
215          this.valueCode = theValueCode;
216          return this;
217        }
218
219        public boolean hasValueCode() { 
220          if (this.valueCode == null)
221            return false;
222          for (CodeType item : this.valueCode)
223            if (!item.isEmpty())
224              return true;
225          return false;
226        }
227
228        /**
229         * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.)
230         */
231        public CodeType addValueCodeElement() {//2 
232          CodeType t = new CodeType();
233          if (this.valueCode == null)
234            this.valueCode = new ArrayList<CodeType>();
235          this.valueCode.add(t);
236          return t;
237        }
238
239        /**
240         * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.)
241         */
242        public DataRequirementCodeFilterComponent addValueCode(String value) { //1
243          CodeType t = new CodeType();
244          t.setValue(value);
245          if (this.valueCode == null)
246            this.valueCode = new ArrayList<CodeType>();
247          this.valueCode.add(t);
248          return this;
249        }
250
251        /**
252         * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.)
253         */
254        public boolean hasValueCode(String value) { 
255          if (this.valueCode == null)
256            return false;
257          for (CodeType v : this.valueCode)
258            if (v.getValue().equals(value)) // code
259              return true;
260          return false;
261        }
262
263        /**
264         * @return {@link #valueCoding} (The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified Codings.)
265         */
266        public List<Coding> getValueCoding() { 
267          if (this.valueCoding == null)
268            this.valueCoding = new ArrayList<Coding>();
269          return this.valueCoding;
270        }
271
272        /**
273         * @return Returns a reference to <code>this</code> for easy method chaining
274         */
275        public DataRequirementCodeFilterComponent setValueCoding(List<Coding> theValueCoding) { 
276          this.valueCoding = theValueCoding;
277          return this;
278        }
279
280        public boolean hasValueCoding() { 
281          if (this.valueCoding == null)
282            return false;
283          for (Coding item : this.valueCoding)
284            if (!item.isEmpty())
285              return true;
286          return false;
287        }
288
289        public Coding addValueCoding() { //3
290          Coding t = new Coding();
291          if (this.valueCoding == null)
292            this.valueCoding = new ArrayList<Coding>();
293          this.valueCoding.add(t);
294          return t;
295        }
296
297        public DataRequirementCodeFilterComponent addValueCoding(Coding t) { //3
298          if (t == null)
299            return this;
300          if (this.valueCoding == null)
301            this.valueCoding = new ArrayList<Coding>();
302          this.valueCoding.add(t);
303          return this;
304        }
305
306        /**
307         * @return The first repetition of repeating field {@link #valueCoding}, creating it if it does not already exist
308         */
309        public Coding getValueCodingFirstRep() { 
310          if (getValueCoding().isEmpty()) {
311            addValueCoding();
312          }
313          return getValueCoding().get(0);
314        }
315
316        /**
317         * @return {@link #valueCodeableConcept} (The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified CodeableConcepts.)
318         */
319        public List<CodeableConcept> getValueCodeableConcept() { 
320          if (this.valueCodeableConcept == null)
321            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
322          return this.valueCodeableConcept;
323        }
324
325        /**
326         * @return Returns a reference to <code>this</code> for easy method chaining
327         */
328        public DataRequirementCodeFilterComponent setValueCodeableConcept(List<CodeableConcept> theValueCodeableConcept) { 
329          this.valueCodeableConcept = theValueCodeableConcept;
330          return this;
331        }
332
333        public boolean hasValueCodeableConcept() { 
334          if (this.valueCodeableConcept == null)
335            return false;
336          for (CodeableConcept item : this.valueCodeableConcept)
337            if (!item.isEmpty())
338              return true;
339          return false;
340        }
341
342        public CodeableConcept addValueCodeableConcept() { //3
343          CodeableConcept t = new CodeableConcept();
344          if (this.valueCodeableConcept == null)
345            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
346          this.valueCodeableConcept.add(t);
347          return t;
348        }
349
350        public DataRequirementCodeFilterComponent addValueCodeableConcept(CodeableConcept t) { //3
351          if (t == null)
352            return this;
353          if (this.valueCodeableConcept == null)
354            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
355          this.valueCodeableConcept.add(t);
356          return this;
357        }
358
359        /**
360         * @return The first repetition of repeating field {@link #valueCodeableConcept}, creating it if it does not already exist
361         */
362        public CodeableConcept getValueCodeableConceptFirstRep() { 
363          if (getValueCodeableConcept().isEmpty()) {
364            addValueCodeableConcept();
365          }
366          return getValueCodeableConcept().get(0);
367        }
368
369        protected void listChildren(List<Property> children) {
370          super.listChildren(children);
371          children.add(new Property("path", "string", "The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, 1, path));
372          children.add(new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, 1, valueSet));
373          children.add(new Property("valueCode", "code", "The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, valueCode));
374          children.add(new Property("valueCoding", "Coding", "The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified Codings.", 0, java.lang.Integer.MAX_VALUE, valueCoding));
375          children.add(new Property("valueCodeableConcept", "CodeableConcept", "The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified CodeableConcepts.", 0, java.lang.Integer.MAX_VALUE, valueCodeableConcept));
376        }
377
378        @Override
379        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
380          switch (_hash) {
381          case 3433509: /*path*/  return new Property("path", "string", "The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, 1, path);
382          case -1438410321: /*valueSet[x]*/  return new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, 1, valueSet);
383          case -1410174671: /*valueSet*/  return new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, 1, valueSet);
384          case -1025157982: /*valueSetString*/  return new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, 1, valueSet);
385          case 295220506: /*valueSetReference*/  return new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, 1, valueSet);
386          case -766209282: /*valueCode*/  return new Property("valueCode", "code", "The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, valueCode);
387          case -1887705029: /*valueCoding*/  return new Property("valueCoding", "Coding", "The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified Codings.", 0, java.lang.Integer.MAX_VALUE, valueCoding);
388          case 924902896: /*valueCodeableConcept*/  return new Property("valueCodeableConcept", "CodeableConcept", "The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified CodeableConcepts.", 0, java.lang.Integer.MAX_VALUE, valueCodeableConcept);
389          default: return super.getNamedProperty(_hash, _name, _checkValid);
390          }
391
392        }
393
394      @Override
395      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
396        switch (hash) {
397        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
398        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type
399        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // CodeType
400        case -1887705029: /*valueCoding*/ return this.valueCoding == null ? new Base[0] : this.valueCoding.toArray(new Base[this.valueCoding.size()]); // Coding
401        case 924902896: /*valueCodeableConcept*/ return this.valueCodeableConcept == null ? new Base[0] : this.valueCodeableConcept.toArray(new Base[this.valueCodeableConcept.size()]); // CodeableConcept
402        default: return super.getProperty(hash, name, checkValid);
403        }
404
405      }
406
407      @Override
408      public Base setProperty(int hash, String name, Base value) throws FHIRException {
409        switch (hash) {
410        case 3433509: // path
411          this.path = castToString(value); // StringType
412          return value;
413        case -1410174671: // valueSet
414          this.valueSet = castToType(value); // Type
415          return value;
416        case -766209282: // valueCode
417          this.getValueCode().add(castToCode(value)); // CodeType
418          return value;
419        case -1887705029: // valueCoding
420          this.getValueCoding().add(castToCoding(value)); // Coding
421          return value;
422        case 924902896: // valueCodeableConcept
423          this.getValueCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept
424          return value;
425        default: return super.setProperty(hash, name, value);
426        }
427
428      }
429
430      @Override
431      public Base setProperty(String name, Base value) throws FHIRException {
432        if (name.equals("path")) {
433          this.path = castToString(value); // StringType
434        } else if (name.equals("valueSet[x]")) {
435          this.valueSet = castToType(value); // Type
436        } else if (name.equals("valueCode")) {
437          this.getValueCode().add(castToCode(value));
438        } else if (name.equals("valueCoding")) {
439          this.getValueCoding().add(castToCoding(value));
440        } else if (name.equals("valueCodeableConcept")) {
441          this.getValueCodeableConcept().add(castToCodeableConcept(value));
442        } else
443          return super.setProperty(name, value);
444        return value;
445      }
446
447      @Override
448      public Base makeProperty(int hash, String name) throws FHIRException {
449        switch (hash) {
450        case 3433509:  return getPathElement();
451        case -1438410321:  return getValueSet(); 
452        case -1410174671:  return getValueSet(); 
453        case -766209282:  return addValueCodeElement();
454        case -1887705029:  return addValueCoding(); 
455        case 924902896:  return addValueCodeableConcept(); 
456        default: return super.makeProperty(hash, name);
457        }
458
459      }
460
461      @Override
462      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
463        switch (hash) {
464        case 3433509: /*path*/ return new String[] {"string"};
465        case -1410174671: /*valueSet*/ return new String[] {"string", "Reference"};
466        case -766209282: /*valueCode*/ return new String[] {"code"};
467        case -1887705029: /*valueCoding*/ return new String[] {"Coding"};
468        case 924902896: /*valueCodeableConcept*/ return new String[] {"CodeableConcept"};
469        default: return super.getTypesForProperty(hash, name);
470        }
471
472      }
473
474      @Override
475      public Base addChild(String name) throws FHIRException {
476        if (name.equals("path")) {
477          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
478        }
479        else if (name.equals("valueSetString")) {
480          this.valueSet = new StringType();
481          return this.valueSet;
482        }
483        else if (name.equals("valueSetReference")) {
484          this.valueSet = new Reference();
485          return this.valueSet;
486        }
487        else if (name.equals("valueCode")) {
488          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.valueCode");
489        }
490        else if (name.equals("valueCoding")) {
491          return addValueCoding();
492        }
493        else if (name.equals("valueCodeableConcept")) {
494          return addValueCodeableConcept();
495        }
496        else
497          return super.addChild(name);
498      }
499
500      public DataRequirementCodeFilterComponent copy() {
501        DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent();
502        copyValues(dst);
503        dst.path = path == null ? null : path.copy();
504        dst.valueSet = valueSet == null ? null : valueSet.copy();
505        if (valueCode != null) {
506          dst.valueCode = new ArrayList<CodeType>();
507          for (CodeType i : valueCode)
508            dst.valueCode.add(i.copy());
509        };
510        if (valueCoding != null) {
511          dst.valueCoding = new ArrayList<Coding>();
512          for (Coding i : valueCoding)
513            dst.valueCoding.add(i.copy());
514        };
515        if (valueCodeableConcept != null) {
516          dst.valueCodeableConcept = new ArrayList<CodeableConcept>();
517          for (CodeableConcept i : valueCodeableConcept)
518            dst.valueCodeableConcept.add(i.copy());
519        };
520        return dst;
521      }
522
523      @Override
524      public boolean equalsDeep(Base other_) {
525        if (!super.equalsDeep(other_))
526          return false;
527        if (!(other_ instanceof DataRequirementCodeFilterComponent))
528          return false;
529        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
530        return compareDeep(path, o.path, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(valueCode, o.valueCode, true)
531           && compareDeep(valueCoding, o.valueCoding, true) && compareDeep(valueCodeableConcept, o.valueCodeableConcept, true)
532          ;
533      }
534
535      @Override
536      public boolean equalsShallow(Base other_) {
537        if (!super.equalsShallow(other_))
538          return false;
539        if (!(other_ instanceof DataRequirementCodeFilterComponent))
540          return false;
541        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
542        return compareValues(path, o.path, true) && compareValues(valueCode, o.valueCode, true);
543      }
544
545      public boolean isEmpty() {
546        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, valueSet, valueCode
547          , valueCoding, valueCodeableConcept);
548      }
549
550  public String fhirType() {
551    return "DataRequirement.codeFilter";
552
553  }
554
555  }
556
557    @Block()
558    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
559        /**
560         * The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
561         */
562        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
563        @Description(shortDefinition="The date-valued attribute of the filter", formalDefinition="The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing." )
564        protected StringType path;
565
566        /**
567         * The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.
568         */
569        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=2, min=0, max=1, modifier=false, summary=true)
570        @Description(shortDefinition="The value of the filter, as a Period, DateTime, or Duration value", formalDefinition="The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now." )
571        protected Type value;
572
573        private static final long serialVersionUID = 1791957163L;
574
575    /**
576     * Constructor
577     */
578      public DataRequirementDateFilterComponent() {
579        super();
580      }
581
582    /**
583     * Constructor
584     */
585      public DataRequirementDateFilterComponent(StringType path) {
586        super();
587        this.path = path;
588      }
589
590        /**
591         * @return {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
592         */
593        public StringType getPathElement() { 
594          if (this.path == null)
595            if (Configuration.errorOnAutoCreate())
596              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
597            else if (Configuration.doAutoCreate())
598              this.path = new StringType(); // bb
599          return this.path;
600        }
601
602        public boolean hasPathElement() { 
603          return this.path != null && !this.path.isEmpty();
604        }
605
606        public boolean hasPath() { 
607          return this.path != null && !this.path.isEmpty();
608        }
609
610        /**
611         * @param value {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
612         */
613        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
614          this.path = value;
615          return this;
616        }
617
618        /**
619         * @return The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
620         */
621        public String getPath() { 
622          return this.path == null ? null : this.path.getValue();
623        }
624
625        /**
626         * @param value The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
627         */
628        public DataRequirementDateFilterComponent setPath(String value) { 
629            if (this.path == null)
630              this.path = new StringType();
631            this.path.setValue(value);
632          return this;
633        }
634
635        /**
636         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.)
637         */
638        public Type getValue() { 
639          return this.value;
640        }
641
642        /**
643         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.)
644         */
645        public DateTimeType getValueDateTimeType() throws FHIRException { 
646          if (this.value == null)
647            return null;
648          if (!(this.value instanceof DateTimeType))
649            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
650          return (DateTimeType) this.value;
651        }
652
653        public boolean hasValueDateTimeType() { 
654          return this != null && this.value instanceof DateTimeType;
655        }
656
657        /**
658         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.)
659         */
660        public Period getValuePeriod() throws FHIRException { 
661          if (this.value == null)
662            return null;
663          if (!(this.value instanceof Period))
664            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
665          return (Period) this.value;
666        }
667
668        public boolean hasValuePeriod() { 
669          return this != null && this.value instanceof Period;
670        }
671
672        /**
673         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.)
674         */
675        public Duration getValueDuration() throws FHIRException { 
676          if (this.value == null)
677            return null;
678          if (!(this.value instanceof Duration))
679            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
680          return (Duration) this.value;
681        }
682
683        public boolean hasValueDuration() { 
684          return this != null && this.value instanceof Duration;
685        }
686
687        public boolean hasValue() { 
688          return this.value != null && !this.value.isEmpty();
689        }
690
691        /**
692         * @param value {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.)
693         */
694        public DataRequirementDateFilterComponent setValue(Type value) throws FHIRFormatError { 
695          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
696            throw new FHIRFormatError("Not the right type for DataRequirement.dateFilter.value[x]: "+value.fhirType());
697          this.value = value;
698          return this;
699        }
700
701        protected void listChildren(List<Property> children) {
702          super.listChildren(children);
703          children.add(new Property("path", "string", "The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.", 0, 1, path));
704          children.add(new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value));
705        }
706
707        @Override
708        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
709          switch (_hash) {
710          case 3433509: /*path*/  return new Property("path", "string", "The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.", 0, 1, path);
711          case -1410166417: /*value[x]*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value);
712          case 111972721: /*value*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value);
713          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value);
714          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value);
715          case 1558135333: /*valueDuration*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration from now.", 0, 1, value);
716          default: return super.getNamedProperty(_hash, _name, _checkValid);
717          }
718
719        }
720
721      @Override
722      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
723        switch (hash) {
724        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
725        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
726        default: return super.getProperty(hash, name, checkValid);
727        }
728
729      }
730
731      @Override
732      public Base setProperty(int hash, String name, Base value) throws FHIRException {
733        switch (hash) {
734        case 3433509: // path
735          this.path = castToString(value); // StringType
736          return value;
737        case 111972721: // value
738          this.value = castToType(value); // Type
739          return value;
740        default: return super.setProperty(hash, name, value);
741        }
742
743      }
744
745      @Override
746      public Base setProperty(String name, Base value) throws FHIRException {
747        if (name.equals("path")) {
748          this.path = castToString(value); // StringType
749        } else if (name.equals("value[x]")) {
750          this.value = castToType(value); // Type
751        } else
752          return super.setProperty(name, value);
753        return value;
754      }
755
756      @Override
757      public Base makeProperty(int hash, String name) throws FHIRException {
758        switch (hash) {
759        case 3433509:  return getPathElement();
760        case -1410166417:  return getValue(); 
761        case 111972721:  return getValue(); 
762        default: return super.makeProperty(hash, name);
763        }
764
765      }
766
767      @Override
768      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
769        switch (hash) {
770        case 3433509: /*path*/ return new String[] {"string"};
771        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
772        default: return super.getTypesForProperty(hash, name);
773        }
774
775      }
776
777      @Override
778      public Base addChild(String name) throws FHIRException {
779        if (name.equals("path")) {
780          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
781        }
782        else if (name.equals("valueDateTime")) {
783          this.value = new DateTimeType();
784          return this.value;
785        }
786        else if (name.equals("valuePeriod")) {
787          this.value = new Period();
788          return this.value;
789        }
790        else if (name.equals("valueDuration")) {
791          this.value = new Duration();
792          return this.value;
793        }
794        else
795          return super.addChild(name);
796      }
797
798      public DataRequirementDateFilterComponent copy() {
799        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
800        copyValues(dst);
801        dst.path = path == null ? null : path.copy();
802        dst.value = value == null ? null : value.copy();
803        return dst;
804      }
805
806      @Override
807      public boolean equalsDeep(Base other_) {
808        if (!super.equalsDeep(other_))
809          return false;
810        if (!(other_ instanceof DataRequirementDateFilterComponent))
811          return false;
812        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
813        return compareDeep(path, o.path, true) && compareDeep(value, o.value, true);
814      }
815
816      @Override
817      public boolean equalsShallow(Base other_) {
818        if (!super.equalsShallow(other_))
819          return false;
820        if (!(other_ instanceof DataRequirementDateFilterComponent))
821          return false;
822        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
823        return compareValues(path, o.path, true);
824      }
825
826      public boolean isEmpty() {
827        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, value);
828      }
829
830  public String fhirType() {
831    return "DataRequirement.dateFilter";
832
833  }
834
835  }
836
837    /**
838     * The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
839     */
840    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
841    @Description(shortDefinition="The type of the required data", formalDefinition="The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile." )
842    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types")
843    protected CodeType type;
844
845    /**
846     * The profile of the required data, specified as the uri of the profile definition.
847     */
848    @Child(name = "profile", type = {UriType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
849    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
850    protected List<UriType> profile;
851
852    /**
853     * Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.
854     */
855    @Child(name = "mustSupport", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
856    @Description(shortDefinition="Indicates that specific structure elements are referenced by the knowledge module", formalDefinition="Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported." )
857    protected List<StringType> mustSupport;
858
859    /**
860     * Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.
861     */
862    @Child(name = "codeFilter", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
863    @Description(shortDefinition="What codes are expected", formalDefinition="Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data." )
864    protected List<DataRequirementCodeFilterComponent> codeFilter;
865
866    /**
867     * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.
868     */
869    @Child(name = "dateFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
870    @Description(shortDefinition="What dates/date ranges are expected", formalDefinition="Date filters specify additional constraints on the data in terms of the applicable date range for specific elements." )
871    protected List<DataRequirementDateFilterComponent> dateFilter;
872
873    private static final long serialVersionUID = 274786645L;
874
875  /**
876   * Constructor
877   */
878    public DataRequirement() {
879      super();
880    }
881
882  /**
883   * Constructor
884   */
885    public DataRequirement(CodeType type) {
886      super();
887      this.type = type;
888    }
889
890    /**
891     * @return {@link #type} (The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
892     */
893    public CodeType getTypeElement() { 
894      if (this.type == null)
895        if (Configuration.errorOnAutoCreate())
896          throw new Error("Attempt to auto-create DataRequirement.type");
897        else if (Configuration.doAutoCreate())
898          this.type = new CodeType(); // bb
899      return this.type;
900    }
901
902    public boolean hasTypeElement() { 
903      return this.type != null && !this.type.isEmpty();
904    }
905
906    public boolean hasType() { 
907      return this.type != null && !this.type.isEmpty();
908    }
909
910    /**
911     * @param value {@link #type} (The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
912     */
913    public DataRequirement setTypeElement(CodeType value) { 
914      this.type = value;
915      return this;
916    }
917
918    /**
919     * @return The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
920     */
921    public String getType() { 
922      return this.type == null ? null : this.type.getValue();
923    }
924
925    /**
926     * @param value The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
927     */
928    public DataRequirement setType(String value) { 
929        if (this.type == null)
930          this.type = new CodeType();
931        this.type.setValue(value);
932      return this;
933    }
934
935    /**
936     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
937     */
938    public List<UriType> getProfile() { 
939      if (this.profile == null)
940        this.profile = new ArrayList<UriType>();
941      return this.profile;
942    }
943
944    /**
945     * @return Returns a reference to <code>this</code> for easy method chaining
946     */
947    public DataRequirement setProfile(List<UriType> theProfile) { 
948      this.profile = theProfile;
949      return this;
950    }
951
952    public boolean hasProfile() { 
953      if (this.profile == null)
954        return false;
955      for (UriType item : this.profile)
956        if (!item.isEmpty())
957          return true;
958      return false;
959    }
960
961    /**
962     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
963     */
964    public UriType addProfileElement() {//2 
965      UriType t = new UriType();
966      if (this.profile == null)
967        this.profile = new ArrayList<UriType>();
968      this.profile.add(t);
969      return t;
970    }
971
972    /**
973     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
974     */
975    public DataRequirement addProfile(String value) { //1
976      UriType t = new UriType();
977      t.setValue(value);
978      if (this.profile == null)
979        this.profile = new ArrayList<UriType>();
980      this.profile.add(t);
981      return this;
982    }
983
984    /**
985     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
986     */
987    public boolean hasProfile(String value) { 
988      if (this.profile == null)
989        return false;
990      for (UriType v : this.profile)
991        if (v.getValue().equals(value)) // uri
992          return true;
993      return false;
994    }
995
996    /**
997     * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.)
998     */
999    public List<StringType> getMustSupport() { 
1000      if (this.mustSupport == null)
1001        this.mustSupport = new ArrayList<StringType>();
1002      return this.mustSupport;
1003    }
1004
1005    /**
1006     * @return Returns a reference to <code>this</code> for easy method chaining
1007     */
1008    public DataRequirement setMustSupport(List<StringType> theMustSupport) { 
1009      this.mustSupport = theMustSupport;
1010      return this;
1011    }
1012
1013    public boolean hasMustSupport() { 
1014      if (this.mustSupport == null)
1015        return false;
1016      for (StringType item : this.mustSupport)
1017        if (!item.isEmpty())
1018          return true;
1019      return false;
1020    }
1021
1022    /**
1023     * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.)
1024     */
1025    public StringType addMustSupportElement() {//2 
1026      StringType t = new StringType();
1027      if (this.mustSupport == null)
1028        this.mustSupport = new ArrayList<StringType>();
1029      this.mustSupport.add(t);
1030      return t;
1031    }
1032
1033    /**
1034     * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.)
1035     */
1036    public DataRequirement addMustSupport(String value) { //1
1037      StringType t = new StringType();
1038      t.setValue(value);
1039      if (this.mustSupport == null)
1040        this.mustSupport = new ArrayList<StringType>();
1041      this.mustSupport.add(t);
1042      return this;
1043    }
1044
1045    /**
1046     * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.)
1047     */
1048    public boolean hasMustSupport(String value) { 
1049      if (this.mustSupport == null)
1050        return false;
1051      for (StringType v : this.mustSupport)
1052        if (v.getValue().equals(value)) // string
1053          return true;
1054      return false;
1055    }
1056
1057    /**
1058     * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.)
1059     */
1060    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
1061      if (this.codeFilter == null)
1062        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1063      return this.codeFilter;
1064    }
1065
1066    /**
1067     * @return Returns a reference to <code>this</code> for easy method chaining
1068     */
1069    public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 
1070      this.codeFilter = theCodeFilter;
1071      return this;
1072    }
1073
1074    public boolean hasCodeFilter() { 
1075      if (this.codeFilter == null)
1076        return false;
1077      for (DataRequirementCodeFilterComponent item : this.codeFilter)
1078        if (!item.isEmpty())
1079          return true;
1080      return false;
1081    }
1082
1083    public DataRequirementCodeFilterComponent addCodeFilter() { //3
1084      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
1085      if (this.codeFilter == null)
1086        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1087      this.codeFilter.add(t);
1088      return t;
1089    }
1090
1091    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
1092      if (t == null)
1093        return this;
1094      if (this.codeFilter == null)
1095        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1096      this.codeFilter.add(t);
1097      return this;
1098    }
1099
1100    /**
1101     * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist
1102     */
1103    public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 
1104      if (getCodeFilter().isEmpty()) {
1105        addCodeFilter();
1106      }
1107      return getCodeFilter().get(0);
1108    }
1109
1110    /**
1111     * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.)
1112     */
1113    public List<DataRequirementDateFilterComponent> getDateFilter() { 
1114      if (this.dateFilter == null)
1115        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1116      return this.dateFilter;
1117    }
1118
1119    /**
1120     * @return Returns a reference to <code>this</code> for easy method chaining
1121     */
1122    public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 
1123      this.dateFilter = theDateFilter;
1124      return this;
1125    }
1126
1127    public boolean hasDateFilter() { 
1128      if (this.dateFilter == null)
1129        return false;
1130      for (DataRequirementDateFilterComponent item : this.dateFilter)
1131        if (!item.isEmpty())
1132          return true;
1133      return false;
1134    }
1135
1136    public DataRequirementDateFilterComponent addDateFilter() { //3
1137      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
1138      if (this.dateFilter == null)
1139        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1140      this.dateFilter.add(t);
1141      return t;
1142    }
1143
1144    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
1145      if (t == null)
1146        return this;
1147      if (this.dateFilter == null)
1148        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1149      this.dateFilter.add(t);
1150      return this;
1151    }
1152
1153    /**
1154     * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist
1155     */
1156    public DataRequirementDateFilterComponent getDateFilterFirstRep() { 
1157      if (getDateFilter().isEmpty()) {
1158        addDateFilter();
1159      }
1160      return getDateFilter().get(0);
1161    }
1162
1163      protected void listChildren(List<Property> children) {
1164        super.listChildren(children);
1165        children.add(new Property("type", "code", "The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.", 0, 1, type));
1166        children.add(new Property("profile", "uri", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
1167        children.add(new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
1168        children.add(new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
1169        children.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
1170      }
1171
1172      @Override
1173      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1174        switch (_hash) {
1175        case 3575610: /*type*/  return new Property("type", "code", "The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.", 0, 1, type);
1176        case -309425751: /*profile*/  return new Property("profile", "uri", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile);
1177        case -1402857082: /*mustSupport*/  return new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport);
1178        case -1303674939: /*codeFilter*/  return new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.", 0, java.lang.Integer.MAX_VALUE, codeFilter);
1179        case 149531846: /*dateFilter*/  return new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.", 0, java.lang.Integer.MAX_VALUE, dateFilter);
1180        default: return super.getNamedProperty(_hash, _name, _checkValid);
1181        }
1182
1183      }
1184
1185      @Override
1186      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1187        switch (hash) {
1188        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1189        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // UriType
1190        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
1191        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
1192        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
1193        default: return super.getProperty(hash, name, checkValid);
1194        }
1195
1196      }
1197
1198      @Override
1199      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1200        switch (hash) {
1201        case 3575610: // type
1202          this.type = castToCode(value); // CodeType
1203          return value;
1204        case -309425751: // profile
1205          this.getProfile().add(castToUri(value)); // UriType
1206          return value;
1207        case -1402857082: // mustSupport
1208          this.getMustSupport().add(castToString(value)); // StringType
1209          return value;
1210        case -1303674939: // codeFilter
1211          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
1212          return value;
1213        case 149531846: // dateFilter
1214          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
1215          return value;
1216        default: return super.setProperty(hash, name, value);
1217        }
1218
1219      }
1220
1221      @Override
1222      public Base setProperty(String name, Base value) throws FHIRException {
1223        if (name.equals("type")) {
1224          this.type = castToCode(value); // CodeType
1225        } else if (name.equals("profile")) {
1226          this.getProfile().add(castToUri(value));
1227        } else if (name.equals("mustSupport")) {
1228          this.getMustSupport().add(castToString(value));
1229        } else if (name.equals("codeFilter")) {
1230          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
1231        } else if (name.equals("dateFilter")) {
1232          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
1233        } else
1234          return super.setProperty(name, value);
1235        return value;
1236      }
1237
1238      @Override
1239      public Base makeProperty(int hash, String name) throws FHIRException {
1240        switch (hash) {
1241        case 3575610:  return getTypeElement();
1242        case -309425751:  return addProfileElement();
1243        case -1402857082:  return addMustSupportElement();
1244        case -1303674939:  return addCodeFilter(); 
1245        case 149531846:  return addDateFilter(); 
1246        default: return super.makeProperty(hash, name);
1247        }
1248
1249      }
1250
1251      @Override
1252      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1253        switch (hash) {
1254        case 3575610: /*type*/ return new String[] {"code"};
1255        case -309425751: /*profile*/ return new String[] {"uri"};
1256        case -1402857082: /*mustSupport*/ return new String[] {"string"};
1257        case -1303674939: /*codeFilter*/ return new String[] {};
1258        case 149531846: /*dateFilter*/ return new String[] {};
1259        default: return super.getTypesForProperty(hash, name);
1260        }
1261
1262      }
1263
1264      @Override
1265      public Base addChild(String name) throws FHIRException {
1266        if (name.equals("type")) {
1267          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.type");
1268        }
1269        else if (name.equals("profile")) {
1270          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.profile");
1271        }
1272        else if (name.equals("mustSupport")) {
1273          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.mustSupport");
1274        }
1275        else if (name.equals("codeFilter")) {
1276          return addCodeFilter();
1277        }
1278        else if (name.equals("dateFilter")) {
1279          return addDateFilter();
1280        }
1281        else
1282          return super.addChild(name);
1283      }
1284
1285  public String fhirType() {
1286    return "DataRequirement";
1287
1288  }
1289
1290      public DataRequirement copy() {
1291        DataRequirement dst = new DataRequirement();
1292        copyValues(dst);
1293        dst.type = type == null ? null : type.copy();
1294        if (profile != null) {
1295          dst.profile = new ArrayList<UriType>();
1296          for (UriType i : profile)
1297            dst.profile.add(i.copy());
1298        };
1299        if (mustSupport != null) {
1300          dst.mustSupport = new ArrayList<StringType>();
1301          for (StringType i : mustSupport)
1302            dst.mustSupport.add(i.copy());
1303        };
1304        if (codeFilter != null) {
1305          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1306          for (DataRequirementCodeFilterComponent i : codeFilter)
1307            dst.codeFilter.add(i.copy());
1308        };
1309        if (dateFilter != null) {
1310          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1311          for (DataRequirementDateFilterComponent i : dateFilter)
1312            dst.dateFilter.add(i.copy());
1313        };
1314        return dst;
1315      }
1316
1317      protected DataRequirement typedCopy() {
1318        return copy();
1319      }
1320
1321      @Override
1322      public boolean equalsDeep(Base other_) {
1323        if (!super.equalsDeep(other_))
1324          return false;
1325        if (!(other_ instanceof DataRequirement))
1326          return false;
1327        DataRequirement o = (DataRequirement) other_;
1328        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(mustSupport, o.mustSupport, true)
1329           && compareDeep(codeFilter, o.codeFilter, true) && compareDeep(dateFilter, o.dateFilter, true);
1330      }
1331
1332      @Override
1333      public boolean equalsShallow(Base other_) {
1334        if (!super.equalsShallow(other_))
1335          return false;
1336        if (!(other_ instanceof DataRequirement))
1337          return false;
1338        DataRequirement o = (DataRequirement) other_;
1339        return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true)
1340          ;
1341      }
1342
1343      public boolean isEmpty() {
1344        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, mustSupport
1345          , codeFilter, dateFilter);
1346      }
1347
1348
1349}
1350