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