001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * Base StructureDefinition for DataRequirement Type: Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data.
050 */
051@DatatypeDef(name="DataRequirement")
052public class DataRequirement extends DataType implements ICompositeType {
053
054    public enum SortDirection {
055        /**
056         * Sort by the value ascending, so that lower values appear first.
057         */
058        ASCENDING, 
059        /**
060         * Sort by the value descending, so that lower values appear last.
061         */
062        DESCENDING, 
063        /**
064         * added to help the parsers with the generic types
065         */
066        NULL;
067        public static SortDirection fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("ascending".equals(codeString))
071          return ASCENDING;
072        if ("descending".equals(codeString))
073          return DESCENDING;
074        if (Configuration.isAcceptInvalidEnums())
075          return null;
076        else
077          throw new FHIRException("Unknown SortDirection code '"+codeString+"'");
078        }
079        public String toCode() {
080          switch (this) {
081            case ASCENDING: return "ascending";
082            case DESCENDING: return "descending";
083            case NULL: return null;
084            default: return "?";
085          }
086        }
087        public String getSystem() {
088          switch (this) {
089            case ASCENDING: return "http://hl7.org/fhir/sort-direction";
090            case DESCENDING: return "http://hl7.org/fhir/sort-direction";
091            case NULL: return null;
092            default: return "?";
093          }
094        }
095        public String getDefinition() {
096          switch (this) {
097            case ASCENDING: return "Sort by the value ascending, so that lower values appear first.";
098            case DESCENDING: return "Sort by the value descending, so that lower values appear last.";
099            case NULL: return null;
100            default: return "?";
101          }
102        }
103        public String getDisplay() {
104          switch (this) {
105            case ASCENDING: return "Ascending";
106            case DESCENDING: return "Descending";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111    }
112
113  public static class SortDirectionEnumFactory implements EnumFactory<SortDirection> {
114    public SortDirection fromCode(String codeString) throws IllegalArgumentException {
115      if (codeString == null || "".equals(codeString))
116            if (codeString == null || "".equals(codeString))
117                return null;
118        if ("ascending".equals(codeString))
119          return SortDirection.ASCENDING;
120        if ("descending".equals(codeString))
121          return SortDirection.DESCENDING;
122        throw new IllegalArgumentException("Unknown SortDirection code '"+codeString+"'");
123        }
124        public Enumeration<SortDirection> fromType(Base code) throws FHIRException {
125          if (code == null)
126            return null;
127          if (code.isEmpty())
128            return new Enumeration<SortDirection>(this);
129          String codeString = ((PrimitiveType) code).asStringValue();
130          if (codeString == null || "".equals(codeString))
131            return null;
132        if ("ascending".equals(codeString))
133          return new Enumeration<SortDirection>(this, SortDirection.ASCENDING);
134        if ("descending".equals(codeString))
135          return new Enumeration<SortDirection>(this, SortDirection.DESCENDING);
136        throw new FHIRException("Unknown SortDirection code '"+codeString+"'");
137        }
138    public String toCode(SortDirection code) {
139      if (code == SortDirection.ASCENDING)
140        return "ascending";
141      if (code == SortDirection.DESCENDING)
142        return "descending";
143      return "?";
144      }
145    public String toSystem(SortDirection code) {
146      return code.getSystem();
147      }
148    }
149
150    @Block()
151    public static class DataRequirementCodeFilterComponent extends Element implements IBaseDatatypeElement {
152        /**
153         * The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
154         */
155        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
156        @Description(shortDefinition="A code-valued attribute to filter on", formalDefinition="The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." )
157        protected StringType path;
158
159        /**
160         * A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
161         */
162        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
163        @Description(shortDefinition="A coded (token) parameter to search on", formalDefinition="A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept." )
164        protected StringType searchParam;
165
166        /**
167         * The valueset for the code filter. The valueSet and code elements are additive. 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.
168         */
169        @Child(name = "valueSet", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
170        @Description(shortDefinition="Valueset for the filter", formalDefinition="The valueset for the code filter. The valueSet and code elements are additive. 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." )
171        protected CanonicalType valueSet;
172
173        /**
174         * The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.
175         */
176        @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
177        @Description(shortDefinition="What code is expected", formalDefinition="The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes." )
178        protected List<Coding> code;
179
180        private static final long serialVersionUID = -1286212752L;
181
182    /**
183     * Constructor
184     */
185      public DataRequirementCodeFilterComponent() {
186        super();
187      }
188
189        /**
190         * @return {@link #path} (The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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
191         */
192        public StringType getPathElement() { 
193          if (this.path == null)
194            if (Configuration.errorOnAutoCreate())
195              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.path");
196            else if (Configuration.doAutoCreate())
197              this.path = new StringType(); // bb
198          return this.path;
199        }
200
201        public boolean hasPathElement() { 
202          return this.path != null && !this.path.isEmpty();
203        }
204
205        public boolean hasPath() { 
206          return this.path != null && !this.path.isEmpty();
207        }
208
209        /**
210         * @param value {@link #path} (The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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
211         */
212        public DataRequirementCodeFilterComponent setPathElement(StringType value) { 
213          this.path = value;
214          return this;
215        }
216
217        /**
218         * @return The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
219         */
220        public String getPath() { 
221          return this.path == null ? null : this.path.getValue();
222        }
223
224        /**
225         * @param value The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
226         */
227        public DataRequirementCodeFilterComponent setPath(String value) { 
228          if (Utilities.noString(value))
229            this.path = null;
230          else {
231            if (this.path == null)
232              this.path = new StringType();
233            this.path.setValue(value);
234          }
235          return this;
236        }
237
238        /**
239         * @return {@link #searchParam} (A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
240         */
241        public StringType getSearchParamElement() { 
242          if (this.searchParam == null)
243            if (Configuration.errorOnAutoCreate())
244              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.searchParam");
245            else if (Configuration.doAutoCreate())
246              this.searchParam = new StringType(); // bb
247          return this.searchParam;
248        }
249
250        public boolean hasSearchParamElement() { 
251          return this.searchParam != null && !this.searchParam.isEmpty();
252        }
253
254        public boolean hasSearchParam() { 
255          return this.searchParam != null && !this.searchParam.isEmpty();
256        }
257
258        /**
259         * @param value {@link #searchParam} (A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
260         */
261        public DataRequirementCodeFilterComponent setSearchParamElement(StringType value) { 
262          this.searchParam = value;
263          return this;
264        }
265
266        /**
267         * @return A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
268         */
269        public String getSearchParam() { 
270          return this.searchParam == null ? null : this.searchParam.getValue();
271        }
272
273        /**
274         * @param value A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
275         */
276        public DataRequirementCodeFilterComponent setSearchParam(String value) { 
277          if (Utilities.noString(value))
278            this.searchParam = null;
279          else {
280            if (this.searchParam == null)
281              this.searchParam = new StringType();
282            this.searchParam.setValue(value);
283          }
284          return this;
285        }
286
287        /**
288         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and code elements are additive. 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.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
289         */
290        public CanonicalType getValueSetElement() { 
291          if (this.valueSet == null)
292            if (Configuration.errorOnAutoCreate())
293              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.valueSet");
294            else if (Configuration.doAutoCreate())
295              this.valueSet = new CanonicalType(); // bb
296          return this.valueSet;
297        }
298
299        public boolean hasValueSetElement() { 
300          return this.valueSet != null && !this.valueSet.isEmpty();
301        }
302
303        public boolean hasValueSet() { 
304          return this.valueSet != null && !this.valueSet.isEmpty();
305        }
306
307        /**
308         * @param value {@link #valueSet} (The valueset for the code filter. The valueSet and code elements are additive. 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.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
309         */
310        public DataRequirementCodeFilterComponent setValueSetElement(CanonicalType value) { 
311          this.valueSet = value;
312          return this;
313        }
314
315        /**
316         * @return The valueset for the code filter. The valueSet and code elements are additive. 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.
317         */
318        public String getValueSet() { 
319          return this.valueSet == null ? null : this.valueSet.getValue();
320        }
321
322        /**
323         * @param value The valueset for the code filter. The valueSet and code elements are additive. 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.
324         */
325        public DataRequirementCodeFilterComponent setValueSet(String value) { 
326          if (Utilities.noString(value))
327            this.valueSet = null;
328          else {
329            if (this.valueSet == null)
330              this.valueSet = new CanonicalType();
331            this.valueSet.setValue(value);
332          }
333          return this;
334        }
335
336        /**
337         * @return {@link #code} (The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.)
338         */
339        public List<Coding> getCode() { 
340          if (this.code == null)
341            this.code = new ArrayList<Coding>();
342          return this.code;
343        }
344
345        /**
346         * @return Returns a reference to <code>this</code> for easy method chaining
347         */
348        public DataRequirementCodeFilterComponent setCode(List<Coding> theCode) { 
349          this.code = theCode;
350          return this;
351        }
352
353        public boolean hasCode() { 
354          if (this.code == null)
355            return false;
356          for (Coding item : this.code)
357            if (!item.isEmpty())
358              return true;
359          return false;
360        }
361
362        public Coding addCode() { //3
363          Coding t = new Coding();
364          if (this.code == null)
365            this.code = new ArrayList<Coding>();
366          this.code.add(t);
367          return t;
368        }
369
370        public DataRequirementCodeFilterComponent addCode(Coding t) { //3
371          if (t == null)
372            return this;
373          if (this.code == null)
374            this.code = new ArrayList<Coding>();
375          this.code.add(t);
376          return this;
377        }
378
379        /**
380         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
381         */
382        public Coding getCodeFirstRep() { 
383          if (getCode().isEmpty()) {
384            addCode();
385          }
386          return getCode().get(0);
387        }
388
389        protected void listChildren(List<Property> children) {
390          super.listChildren(children);
391          children.add(new Property("path", "string", "The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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));
392          children.add(new Property("searchParam", "string", "A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.", 0, 1, searchParam));
393          children.add(new Property("valueSet", "canonical(ValueSet)", "The valueset for the code filter. The valueSet and code elements are additive. 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));
394          children.add(new Property("code", "Coding", "The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, code));
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 SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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 -553645115: /*searchParam*/  return new Property("searchParam", "string", "A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.", 0, 1, searchParam);
402          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "The valueset for the code filter. The valueSet and code elements are additive. 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 3059181: /*code*/  return new Property("code", "Coding", "The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, code);
404          default: return super.getNamedProperty(_hash, _name, _checkValid);
405          }
406
407        }
408
409      @Override
410      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
411        switch (hash) {
412        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
413        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
414        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
415        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
416        default: return super.getProperty(hash, name, checkValid);
417        }
418
419      }
420
421      @Override
422      public Base setProperty(int hash, String name, Base value) throws FHIRException {
423        switch (hash) {
424        case 3433509: // path
425          this.path = TypeConvertor.castToString(value); // StringType
426          return value;
427        case -553645115: // searchParam
428          this.searchParam = TypeConvertor.castToString(value); // StringType
429          return value;
430        case -1410174671: // valueSet
431          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
432          return value;
433        case 3059181: // code
434          this.getCode().add(TypeConvertor.castToCoding(value)); // Coding
435          return value;
436        default: return super.setProperty(hash, name, value);
437        }
438
439      }
440
441      @Override
442      public Base setProperty(String name, Base value) throws FHIRException {
443        if (name.equals("path")) {
444          this.path = TypeConvertor.castToString(value); // StringType
445        } else if (name.equals("searchParam")) {
446          this.searchParam = TypeConvertor.castToString(value); // StringType
447        } else if (name.equals("valueSet")) {
448          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
449        } else if (name.equals("code")) {
450          this.getCode().add(TypeConvertor.castToCoding(value));
451        } else
452          return super.setProperty(name, value);
453        return value;
454      }
455
456      @Override
457      public Base makeProperty(int hash, String name) throws FHIRException {
458        switch (hash) {
459        case 3433509:  return getPathElement();
460        case -553645115:  return getSearchParamElement();
461        case -1410174671:  return getValueSetElement();
462        case 3059181:  return addCode(); 
463        default: return super.makeProperty(hash, name);
464        }
465
466      }
467
468      @Override
469      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
470        switch (hash) {
471        case 3433509: /*path*/ return new String[] {"string"};
472        case -553645115: /*searchParam*/ return new String[] {"string"};
473        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
474        case 3059181: /*code*/ return new String[] {"Coding"};
475        default: return super.getTypesForProperty(hash, name);
476        }
477
478      }
479
480      @Override
481      public Base addChild(String name) throws FHIRException {
482        if (name.equals("path")) {
483          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.codeFilter.path");
484        }
485        else if (name.equals("searchParam")) {
486          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.codeFilter.searchParam");
487        }
488        else if (name.equals("valueSet")) {
489          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.codeFilter.valueSet");
490        }
491        else if (name.equals("code")) {
492          return addCode();
493        }
494        else
495          return super.addChild(name);
496      }
497
498      public DataRequirementCodeFilterComponent copy() {
499        DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent();
500        copyValues(dst);
501        return dst;
502      }
503
504      public void copyValues(DataRequirementCodeFilterComponent dst) {
505        super.copyValues(dst);
506        dst.path = path == null ? null : path.copy();
507        dst.searchParam = searchParam == null ? null : searchParam.copy();
508        dst.valueSet = valueSet == null ? null : valueSet.copy();
509        if (code != null) {
510          dst.code = new ArrayList<Coding>();
511          for (Coding i : code)
512            dst.code.add(i.copy());
513        };
514      }
515
516      @Override
517      public boolean equalsDeep(Base other_) {
518        if (!super.equalsDeep(other_))
519          return false;
520        if (!(other_ instanceof DataRequirementCodeFilterComponent))
521          return false;
522        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
523        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(valueSet, o.valueSet, true)
524           && compareDeep(code, o.code, true);
525      }
526
527      @Override
528      public boolean equalsShallow(Base other_) {
529        if (!super.equalsShallow(other_))
530          return false;
531        if (!(other_ instanceof DataRequirementCodeFilterComponent))
532          return false;
533        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
534        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true) && compareValues(valueSet, o.valueSet, true)
535          ;
536      }
537
538      public boolean isEmpty() {
539        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, valueSet
540          , code);
541      }
542
543  public String fhirType() {
544    return "DataRequirement.codeFilter";
545
546  }
547
548  }
549
550    @Block()
551    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
552        /**
553         * The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
554         */
555        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
556        @Description(shortDefinition="A date-valued attribute to filter on", formalDefinition="The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing." )
557        protected StringType path;
558
559        /**
560         * A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
561         */
562        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
563        @Description(shortDefinition="A date valued parameter to search on", formalDefinition="A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing." )
564        protected StringType searchParam;
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 before now.
568         */
569        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=3, 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 before now." )
571        protected DataType value;
572
573        private static final long serialVersionUID = 1649787979L;
574
575    /**
576     * Constructor
577     */
578      public DataRequirementDateFilterComponent() {
579        super();
580      }
581
582        /**
583         * @return {@link #path} (The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
584         */
585        public StringType getPathElement() { 
586          if (this.path == null)
587            if (Configuration.errorOnAutoCreate())
588              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
589            else if (Configuration.doAutoCreate())
590              this.path = new StringType(); // bb
591          return this.path;
592        }
593
594        public boolean hasPathElement() { 
595          return this.path != null && !this.path.isEmpty();
596        }
597
598        public boolean hasPath() { 
599          return this.path != null && !this.path.isEmpty();
600        }
601
602        /**
603         * @param value {@link #path} (The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
604         */
605        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
606          this.path = value;
607          return this;
608        }
609
610        /**
611         * @return The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
612         */
613        public String getPath() { 
614          return this.path == null ? null : this.path.getValue();
615        }
616
617        /**
618         * @param value The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
619         */
620        public DataRequirementDateFilterComponent setPath(String value) { 
621          if (Utilities.noString(value))
622            this.path = null;
623          else {
624            if (this.path == null)
625              this.path = new StringType();
626            this.path.setValue(value);
627          }
628          return this;
629        }
630
631        /**
632         * @return {@link #searchParam} (A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
633         */
634        public StringType getSearchParamElement() { 
635          if (this.searchParam == null)
636            if (Configuration.errorOnAutoCreate())
637              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.searchParam");
638            else if (Configuration.doAutoCreate())
639              this.searchParam = new StringType(); // bb
640          return this.searchParam;
641        }
642
643        public boolean hasSearchParamElement() { 
644          return this.searchParam != null && !this.searchParam.isEmpty();
645        }
646
647        public boolean hasSearchParam() { 
648          return this.searchParam != null && !this.searchParam.isEmpty();
649        }
650
651        /**
652         * @param value {@link #searchParam} (A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
653         */
654        public DataRequirementDateFilterComponent setSearchParamElement(StringType value) { 
655          this.searchParam = value;
656          return this;
657        }
658
659        /**
660         * @return A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
661         */
662        public String getSearchParam() { 
663          return this.searchParam == null ? null : this.searchParam.getValue();
664        }
665
666        /**
667         * @param value A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
668         */
669        public DataRequirementDateFilterComponent setSearchParam(String value) { 
670          if (Utilities.noString(value))
671            this.searchParam = null;
672          else {
673            if (this.searchParam == null)
674              this.searchParam = new StringType();
675            this.searchParam.setValue(value);
676          }
677          return this;
678        }
679
680        /**
681         * @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 before now.)
682         */
683        public DataType getValue() { 
684          return this.value;
685        }
686
687        /**
688         * @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 before now.)
689         */
690        public DateTimeType getValueDateTimeType() throws FHIRException { 
691          if (this.value == null)
692            this.value = new DateTimeType();
693          if (!(this.value instanceof DateTimeType))
694            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
695          return (DateTimeType) this.value;
696        }
697
698        public boolean hasValueDateTimeType() { 
699          return this != null && this.value instanceof DateTimeType;
700        }
701
702        /**
703         * @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 before now.)
704         */
705        public Period getValuePeriod() throws FHIRException { 
706          if (this.value == null)
707            this.value = new Period();
708          if (!(this.value instanceof Period))
709            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
710          return (Period) this.value;
711        }
712
713        public boolean hasValuePeriod() { 
714          return this != null && this.value instanceof Period;
715        }
716
717        /**
718         * @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 before now.)
719         */
720        public Duration getValueDuration() throws FHIRException { 
721          if (this.value == null)
722            this.value = new Duration();
723          if (!(this.value instanceof Duration))
724            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
725          return (Duration) this.value;
726        }
727
728        public boolean hasValueDuration() { 
729          return this != null && this.value instanceof Duration;
730        }
731
732        public boolean hasValue() { 
733          return this.value != null && !this.value.isEmpty();
734        }
735
736        /**
737         * @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 before now.)
738         */
739        public DataRequirementDateFilterComponent setValue(DataType value) { 
740          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
741            throw new Error("Not the right type for DataRequirement.dateFilter.value[x]: "+value.fhirType());
742          this.value = value;
743          return this;
744        }
745
746        protected void listChildren(List<Property> children) {
747          super.listChildren(children);
748          children.add(new Property("path", "string", "The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.", 0, 1, path));
749          children.add(new Property("searchParam", "string", "A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.", 0, 1, searchParam));
750          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 before now.", 0, 1, value));
751        }
752
753        @Override
754        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
755          switch (_hash) {
756          case 3433509: /*path*/  return new Property("path", "string", "The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.", 0, 1, path);
757          case -553645115: /*searchParam*/  return new Property("searchParam", "string", "A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.", 0, 1, searchParam);
758          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 before now.", 0, 1, value);
759          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 before now.", 0, 1, value);
760          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "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 before now.", 0, 1, value);
761          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "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 before now.", 0, 1, value);
762          case 1558135333: /*valueDuration*/  return new Property("value[x]", "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 before now.", 0, 1, value);
763          default: return super.getNamedProperty(_hash, _name, _checkValid);
764          }
765
766        }
767
768      @Override
769      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
770        switch (hash) {
771        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
772        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
773        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
774        default: return super.getProperty(hash, name, checkValid);
775        }
776
777      }
778
779      @Override
780      public Base setProperty(int hash, String name, Base value) throws FHIRException {
781        switch (hash) {
782        case 3433509: // path
783          this.path = TypeConvertor.castToString(value); // StringType
784          return value;
785        case -553645115: // searchParam
786          this.searchParam = TypeConvertor.castToString(value); // StringType
787          return value;
788        case 111972721: // value
789          this.value = TypeConvertor.castToType(value); // DataType
790          return value;
791        default: return super.setProperty(hash, name, value);
792        }
793
794      }
795
796      @Override
797      public Base setProperty(String name, Base value) throws FHIRException {
798        if (name.equals("path")) {
799          this.path = TypeConvertor.castToString(value); // StringType
800        } else if (name.equals("searchParam")) {
801          this.searchParam = TypeConvertor.castToString(value); // StringType
802        } else if (name.equals("value[x]")) {
803          this.value = TypeConvertor.castToType(value); // DataType
804        } else
805          return super.setProperty(name, value);
806        return value;
807      }
808
809      @Override
810      public Base makeProperty(int hash, String name) throws FHIRException {
811        switch (hash) {
812        case 3433509:  return getPathElement();
813        case -553645115:  return getSearchParamElement();
814        case -1410166417:  return getValue();
815        case 111972721:  return getValue();
816        default: return super.makeProperty(hash, name);
817        }
818
819      }
820
821      @Override
822      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
823        switch (hash) {
824        case 3433509: /*path*/ return new String[] {"string"};
825        case -553645115: /*searchParam*/ return new String[] {"string"};
826        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
827        default: return super.getTypesForProperty(hash, name);
828        }
829
830      }
831
832      @Override
833      public Base addChild(String name) throws FHIRException {
834        if (name.equals("path")) {
835          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.dateFilter.path");
836        }
837        else if (name.equals("searchParam")) {
838          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.dateFilter.searchParam");
839        }
840        else if (name.equals("valueDateTime")) {
841          this.value = new DateTimeType();
842          return this.value;
843        }
844        else if (name.equals("valuePeriod")) {
845          this.value = new Period();
846          return this.value;
847        }
848        else if (name.equals("valueDuration")) {
849          this.value = new Duration();
850          return this.value;
851        }
852        else
853          return super.addChild(name);
854      }
855
856      public DataRequirementDateFilterComponent copy() {
857        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
858        copyValues(dst);
859        return dst;
860      }
861
862      public void copyValues(DataRequirementDateFilterComponent dst) {
863        super.copyValues(dst);
864        dst.path = path == null ? null : path.copy();
865        dst.searchParam = searchParam == null ? null : searchParam.copy();
866        dst.value = value == null ? null : value.copy();
867      }
868
869      @Override
870      public boolean equalsDeep(Base other_) {
871        if (!super.equalsDeep(other_))
872          return false;
873        if (!(other_ instanceof DataRequirementDateFilterComponent))
874          return false;
875        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
876        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(value, o.value, true)
877          ;
878      }
879
880      @Override
881      public boolean equalsShallow(Base other_) {
882        if (!super.equalsShallow(other_))
883          return false;
884        if (!(other_ instanceof DataRequirementDateFilterComponent))
885          return false;
886        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
887        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true);
888      }
889
890      public boolean isEmpty() {
891        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, value
892          );
893      }
894
895  public String fhirType() {
896    return "DataRequirement.dateFilter";
897
898  }
899
900  }
901
902    @Block()
903    public static class DataRequirementSortComponent extends Element implements IBaseDatatypeElement {
904        /**
905         * The attribute of the sort. 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.
906         */
907        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
908        @Description(shortDefinition="The name of the attribute to perform the sort", formalDefinition="The attribute of the sort. 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." )
909        protected StringType path;
910
911        /**
912         * The direction of the sort, ascending or descending.
913         */
914        @Child(name = "direction", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
915        @Description(shortDefinition="ascending | descending", formalDefinition="The direction of the sort, ascending or descending." )
916        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/sort-direction")
917        protected Enumeration<SortDirection> direction;
918
919        private static final long serialVersionUID = -694498683L;
920
921    /**
922     * Constructor
923     */
924      public DataRequirementSortComponent() {
925        super();
926      }
927
928    /**
929     * Constructor
930     */
931      public DataRequirementSortComponent(String path, SortDirection direction) {
932        super();
933        this.setPath(path);
934        this.setDirection(direction);
935      }
936
937        /**
938         * @return {@link #path} (The attribute of the sort. 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.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
939         */
940        public StringType getPathElement() { 
941          if (this.path == null)
942            if (Configuration.errorOnAutoCreate())
943              throw new Error("Attempt to auto-create DataRequirementSortComponent.path");
944            else if (Configuration.doAutoCreate())
945              this.path = new StringType(); // bb
946          return this.path;
947        }
948
949        public boolean hasPathElement() { 
950          return this.path != null && !this.path.isEmpty();
951        }
952
953        public boolean hasPath() { 
954          return this.path != null && !this.path.isEmpty();
955        }
956
957        /**
958         * @param value {@link #path} (The attribute of the sort. 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.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
959         */
960        public DataRequirementSortComponent setPathElement(StringType value) { 
961          this.path = value;
962          return this;
963        }
964
965        /**
966         * @return The attribute of the sort. 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.
967         */
968        public String getPath() { 
969          return this.path == null ? null : this.path.getValue();
970        }
971
972        /**
973         * @param value The attribute of the sort. 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.
974         */
975        public DataRequirementSortComponent setPath(String value) { 
976            if (this.path == null)
977              this.path = new StringType();
978            this.path.setValue(value);
979          return this;
980        }
981
982        /**
983         * @return {@link #direction} (The direction of the sort, ascending or descending.). This is the underlying object with id, value and extensions. The accessor "getDirection" gives direct access to the value
984         */
985        public Enumeration<SortDirection> getDirectionElement() { 
986          if (this.direction == null)
987            if (Configuration.errorOnAutoCreate())
988              throw new Error("Attempt to auto-create DataRequirementSortComponent.direction");
989            else if (Configuration.doAutoCreate())
990              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory()); // bb
991          return this.direction;
992        }
993
994        public boolean hasDirectionElement() { 
995          return this.direction != null && !this.direction.isEmpty();
996        }
997
998        public boolean hasDirection() { 
999          return this.direction != null && !this.direction.isEmpty();
1000        }
1001
1002        /**
1003         * @param value {@link #direction} (The direction of the sort, ascending or descending.). This is the underlying object with id, value and extensions. The accessor "getDirection" gives direct access to the value
1004         */
1005        public DataRequirementSortComponent setDirectionElement(Enumeration<SortDirection> value) { 
1006          this.direction = value;
1007          return this;
1008        }
1009
1010        /**
1011         * @return The direction of the sort, ascending or descending.
1012         */
1013        public SortDirection getDirection() { 
1014          return this.direction == null ? null : this.direction.getValue();
1015        }
1016
1017        /**
1018         * @param value The direction of the sort, ascending or descending.
1019         */
1020        public DataRequirementSortComponent setDirection(SortDirection value) { 
1021            if (this.direction == null)
1022              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory());
1023            this.direction.setValue(value);
1024          return this;
1025        }
1026
1027        protected void listChildren(List<Property> children) {
1028          super.listChildren(children);
1029          children.add(new Property("path", "string", "The attribute of the sort. 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.", 0, 1, path));
1030          children.add(new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction));
1031        }
1032
1033        @Override
1034        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1035          switch (_hash) {
1036          case 3433509: /*path*/  return new Property("path", "string", "The attribute of the sort. 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.", 0, 1, path);
1037          case -962590849: /*direction*/  return new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction);
1038          default: return super.getNamedProperty(_hash, _name, _checkValid);
1039          }
1040
1041        }
1042
1043      @Override
1044      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1045        switch (hash) {
1046        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1047        case -962590849: /*direction*/ return this.direction == null ? new Base[0] : new Base[] {this.direction}; // Enumeration<SortDirection>
1048        default: return super.getProperty(hash, name, checkValid);
1049        }
1050
1051      }
1052
1053      @Override
1054      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1055        switch (hash) {
1056        case 3433509: // path
1057          this.path = TypeConvertor.castToString(value); // StringType
1058          return value;
1059        case -962590849: // direction
1060          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1061          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1062          return value;
1063        default: return super.setProperty(hash, name, value);
1064        }
1065
1066      }
1067
1068      @Override
1069      public Base setProperty(String name, Base value) throws FHIRException {
1070        if (name.equals("path")) {
1071          this.path = TypeConvertor.castToString(value); // StringType
1072        } else if (name.equals("direction")) {
1073          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1074          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1075        } else
1076          return super.setProperty(name, value);
1077        return value;
1078      }
1079
1080      @Override
1081      public Base makeProperty(int hash, String name) throws FHIRException {
1082        switch (hash) {
1083        case 3433509:  return getPathElement();
1084        case -962590849:  return getDirectionElement();
1085        default: return super.makeProperty(hash, name);
1086        }
1087
1088      }
1089
1090      @Override
1091      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1092        switch (hash) {
1093        case 3433509: /*path*/ return new String[] {"string"};
1094        case -962590849: /*direction*/ return new String[] {"code"};
1095        default: return super.getTypesForProperty(hash, name);
1096        }
1097
1098      }
1099
1100      @Override
1101      public Base addChild(String name) throws FHIRException {
1102        if (name.equals("path")) {
1103          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.sort.path");
1104        }
1105        else if (name.equals("direction")) {
1106          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.sort.direction");
1107        }
1108        else
1109          return super.addChild(name);
1110      }
1111
1112      public DataRequirementSortComponent copy() {
1113        DataRequirementSortComponent dst = new DataRequirementSortComponent();
1114        copyValues(dst);
1115        return dst;
1116      }
1117
1118      public void copyValues(DataRequirementSortComponent dst) {
1119        super.copyValues(dst);
1120        dst.path = path == null ? null : path.copy();
1121        dst.direction = direction == null ? null : direction.copy();
1122      }
1123
1124      @Override
1125      public boolean equalsDeep(Base other_) {
1126        if (!super.equalsDeep(other_))
1127          return false;
1128        if (!(other_ instanceof DataRequirementSortComponent))
1129          return false;
1130        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1131        return compareDeep(path, o.path, true) && compareDeep(direction, o.direction, true);
1132      }
1133
1134      @Override
1135      public boolean equalsShallow(Base other_) {
1136        if (!super.equalsShallow(other_))
1137          return false;
1138        if (!(other_ instanceof DataRequirementSortComponent))
1139          return false;
1140        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1141        return compareValues(path, o.path, true) && compareValues(direction, o.direction, true);
1142      }
1143
1144      public boolean isEmpty() {
1145        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, direction);
1146      }
1147
1148  public String fhirType() {
1149    return "DataRequirement.sort";
1150
1151  }
1152
1153  }
1154
1155    /**
1156     * 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.
1157     */
1158    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1159    @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." )
1160    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types")
1161    protected Enumeration<FHIRAllTypes> type;
1162
1163    /**
1164     * The profile of the required data, specified as the uri of the profile definition.
1165     */
1166    @Child(name = "profile", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1167    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
1168    protected List<CanonicalType> profile;
1169
1170    /**
1171     * The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.
1172     */
1173    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=2, min=0, max=1, modifier=false, summary=true)
1174    @Description(shortDefinition="E.g. Patient, Practitioner, RelatedPerson, Organization, Location, Device", formalDefinition="The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed." )
1175    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subject-type")
1176    protected DataType subject;
1177
1178    /**
1179     * 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. 
1180
1181The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).
1182     */
1183    @Child(name = "mustSupport", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1184    @Description(shortDefinition="Indicates specific structure elements that 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. \n\nThe value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details)." )
1185    protected List<StringType> mustSupport;
1186
1187    /**
1188     * Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.
1189     */
1190    @Child(name = "codeFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1191    @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. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed." )
1192    protected List<DataRequirementCodeFilterComponent> codeFilter;
1193
1194    /**
1195     * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.
1196     */
1197    @Child(name = "dateFilter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1198    @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. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed." )
1199    protected List<DataRequirementDateFilterComponent> dateFilter;
1200
1201    /**
1202     * Specifies a maximum number of results that are required (uses the _count search parameter).
1203     */
1204    @Child(name = "limit", type = {PositiveIntType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1205    @Description(shortDefinition="Number of results", formalDefinition="Specifies a maximum number of results that are required (uses the _count search parameter)." )
1206    protected PositiveIntType limit;
1207
1208    /**
1209     * Specifies the order of the results to be returned.
1210     */
1211    @Child(name = "sort", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1212    @Description(shortDefinition="Order of the results", formalDefinition="Specifies the order of the results to be returned." )
1213    protected List<DataRequirementSortComponent> sort;
1214
1215    private static final long serialVersionUID = -1379674933L;
1216
1217  /**
1218   * Constructor
1219   */
1220    public DataRequirement() {
1221      super();
1222    }
1223
1224  /**
1225   * Constructor
1226   */
1227    public DataRequirement(FHIRAllTypes type) {
1228      super();
1229      this.setType(type);
1230    }
1231
1232    /**
1233     * @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
1234     */
1235    public Enumeration<FHIRAllTypes> getTypeElement() { 
1236      if (this.type == null)
1237        if (Configuration.errorOnAutoCreate())
1238          throw new Error("Attempt to auto-create DataRequirement.type");
1239        else if (Configuration.doAutoCreate())
1240          this.type = new Enumeration<FHIRAllTypes>(new FHIRAllTypesEnumFactory()); // bb
1241      return this.type;
1242    }
1243
1244    public boolean hasTypeElement() { 
1245      return this.type != null && !this.type.isEmpty();
1246    }
1247
1248    public boolean hasType() { 
1249      return this.type != null && !this.type.isEmpty();
1250    }
1251
1252    /**
1253     * @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
1254     */
1255    public DataRequirement setTypeElement(Enumeration<FHIRAllTypes> value) { 
1256      this.type = value;
1257      return this;
1258    }
1259
1260    /**
1261     * @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.
1262     */
1263    public FHIRAllTypes getType() { 
1264      return this.type == null ? null : this.type.getValue();
1265    }
1266
1267    /**
1268     * @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.
1269     */
1270    public DataRequirement setType(FHIRAllTypes value) { 
1271        if (this.type == null)
1272          this.type = new Enumeration<FHIRAllTypes>(new FHIRAllTypesEnumFactory());
1273        this.type.setValue(value);
1274      return this;
1275    }
1276
1277    /**
1278     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1279     */
1280    public List<CanonicalType> getProfile() { 
1281      if (this.profile == null)
1282        this.profile = new ArrayList<CanonicalType>();
1283      return this.profile;
1284    }
1285
1286    /**
1287     * @return Returns a reference to <code>this</code> for easy method chaining
1288     */
1289    public DataRequirement setProfile(List<CanonicalType> theProfile) { 
1290      this.profile = theProfile;
1291      return this;
1292    }
1293
1294    public boolean hasProfile() { 
1295      if (this.profile == null)
1296        return false;
1297      for (CanonicalType item : this.profile)
1298        if (!item.isEmpty())
1299          return true;
1300      return false;
1301    }
1302
1303    /**
1304     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1305     */
1306    public CanonicalType addProfileElement() {//2 
1307      CanonicalType t = new CanonicalType();
1308      if (this.profile == null)
1309        this.profile = new ArrayList<CanonicalType>();
1310      this.profile.add(t);
1311      return t;
1312    }
1313
1314    /**
1315     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1316     */
1317    public DataRequirement addProfile(String value) { //1
1318      CanonicalType t = new CanonicalType();
1319      t.setValue(value);
1320      if (this.profile == null)
1321        this.profile = new ArrayList<CanonicalType>();
1322      this.profile.add(t);
1323      return this;
1324    }
1325
1326    /**
1327     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1328     */
1329    public boolean hasProfile(String value) { 
1330      if (this.profile == null)
1331        return false;
1332      for (CanonicalType v : this.profile)
1333        if (v.getValue().equals(value)) // canonical
1334          return true;
1335      return false;
1336    }
1337
1338    /**
1339     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1340     */
1341    public DataType getSubject() { 
1342      return this.subject;
1343    }
1344
1345    /**
1346     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1347     */
1348    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
1349      if (this.subject == null)
1350        this.subject = new CodeableConcept();
1351      if (!(this.subject instanceof CodeableConcept))
1352        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
1353      return (CodeableConcept) this.subject;
1354    }
1355
1356    public boolean hasSubjectCodeableConcept() { 
1357      return this != null && this.subject instanceof CodeableConcept;
1358    }
1359
1360    /**
1361     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1362     */
1363    public Reference getSubjectReference() throws FHIRException { 
1364      if (this.subject == null)
1365        this.subject = new Reference();
1366      if (!(this.subject instanceof Reference))
1367        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
1368      return (Reference) this.subject;
1369    }
1370
1371    public boolean hasSubjectReference() { 
1372      return this != null && this.subject instanceof Reference;
1373    }
1374
1375    public boolean hasSubject() { 
1376      return this.subject != null && !this.subject.isEmpty();
1377    }
1378
1379    /**
1380     * @param value {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1381     */
1382    public DataRequirement setSubject(DataType value) { 
1383      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1384        throw new Error("Not the right type for DataRequirement.subject[x]: "+value.fhirType());
1385      this.subject = value;
1386      return this;
1387    }
1388
1389    /**
1390     * @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. 
1391
1392The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
1393     */
1394    public List<StringType> getMustSupport() { 
1395      if (this.mustSupport == null)
1396        this.mustSupport = new ArrayList<StringType>();
1397      return this.mustSupport;
1398    }
1399
1400    /**
1401     * @return Returns a reference to <code>this</code> for easy method chaining
1402     */
1403    public DataRequirement setMustSupport(List<StringType> theMustSupport) { 
1404      this.mustSupport = theMustSupport;
1405      return this;
1406    }
1407
1408    public boolean hasMustSupport() { 
1409      if (this.mustSupport == null)
1410        return false;
1411      for (StringType item : this.mustSupport)
1412        if (!item.isEmpty())
1413          return true;
1414      return false;
1415    }
1416
1417    /**
1418     * @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. 
1419
1420The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
1421     */
1422    public StringType addMustSupportElement() {//2 
1423      StringType t = new StringType();
1424      if (this.mustSupport == null)
1425        this.mustSupport = new ArrayList<StringType>();
1426      this.mustSupport.add(t);
1427      return t;
1428    }
1429
1430    /**
1431     * @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. 
1432
1433The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
1434     */
1435    public DataRequirement addMustSupport(String value) { //1
1436      StringType t = new StringType();
1437      t.setValue(value);
1438      if (this.mustSupport == null)
1439        this.mustSupport = new ArrayList<StringType>();
1440      this.mustSupport.add(t);
1441      return this;
1442    }
1443
1444    /**
1445     * @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. 
1446
1447The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
1448     */
1449    public boolean hasMustSupport(String value) { 
1450      if (this.mustSupport == null)
1451        return false;
1452      for (StringType v : this.mustSupport)
1453        if (v.getValue().equals(value)) // string
1454          return true;
1455      return false;
1456    }
1457
1458    /**
1459     * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.)
1460     */
1461    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
1462      if (this.codeFilter == null)
1463        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1464      return this.codeFilter;
1465    }
1466
1467    /**
1468     * @return Returns a reference to <code>this</code> for easy method chaining
1469     */
1470    public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 
1471      this.codeFilter = theCodeFilter;
1472      return this;
1473    }
1474
1475    public boolean hasCodeFilter() { 
1476      if (this.codeFilter == null)
1477        return false;
1478      for (DataRequirementCodeFilterComponent item : this.codeFilter)
1479        if (!item.isEmpty())
1480          return true;
1481      return false;
1482    }
1483
1484    public DataRequirementCodeFilterComponent addCodeFilter() { //3
1485      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
1486      if (this.codeFilter == null)
1487        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1488      this.codeFilter.add(t);
1489      return t;
1490    }
1491
1492    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
1493      if (t == null)
1494        return this;
1495      if (this.codeFilter == null)
1496        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1497      this.codeFilter.add(t);
1498      return this;
1499    }
1500
1501    /**
1502     * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist {3}
1503     */
1504    public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 
1505      if (getCodeFilter().isEmpty()) {
1506        addCodeFilter();
1507      }
1508      return getCodeFilter().get(0);
1509    }
1510
1511    /**
1512     * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.)
1513     */
1514    public List<DataRequirementDateFilterComponent> getDateFilter() { 
1515      if (this.dateFilter == null)
1516        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1517      return this.dateFilter;
1518    }
1519
1520    /**
1521     * @return Returns a reference to <code>this</code> for easy method chaining
1522     */
1523    public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 
1524      this.dateFilter = theDateFilter;
1525      return this;
1526    }
1527
1528    public boolean hasDateFilter() { 
1529      if (this.dateFilter == null)
1530        return false;
1531      for (DataRequirementDateFilterComponent item : this.dateFilter)
1532        if (!item.isEmpty())
1533          return true;
1534      return false;
1535    }
1536
1537    public DataRequirementDateFilterComponent addDateFilter() { //3
1538      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
1539      if (this.dateFilter == null)
1540        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1541      this.dateFilter.add(t);
1542      return t;
1543    }
1544
1545    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
1546      if (t == null)
1547        return this;
1548      if (this.dateFilter == null)
1549        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1550      this.dateFilter.add(t);
1551      return this;
1552    }
1553
1554    /**
1555     * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist {3}
1556     */
1557    public DataRequirementDateFilterComponent getDateFilterFirstRep() { 
1558      if (getDateFilter().isEmpty()) {
1559        addDateFilter();
1560      }
1561      return getDateFilter().get(0);
1562    }
1563
1564    /**
1565     * @return {@link #limit} (Specifies a maximum number of results that are required (uses the _count search parameter).). This is the underlying object with id, value and extensions. The accessor "getLimit" gives direct access to the value
1566     */
1567    public PositiveIntType getLimitElement() { 
1568      if (this.limit == null)
1569        if (Configuration.errorOnAutoCreate())
1570          throw new Error("Attempt to auto-create DataRequirement.limit");
1571        else if (Configuration.doAutoCreate())
1572          this.limit = new PositiveIntType(); // bb
1573      return this.limit;
1574    }
1575
1576    public boolean hasLimitElement() { 
1577      return this.limit != null && !this.limit.isEmpty();
1578    }
1579
1580    public boolean hasLimit() { 
1581      return this.limit != null && !this.limit.isEmpty();
1582    }
1583
1584    /**
1585     * @param value {@link #limit} (Specifies a maximum number of results that are required (uses the _count search parameter).). This is the underlying object with id, value and extensions. The accessor "getLimit" gives direct access to the value
1586     */
1587    public DataRequirement setLimitElement(PositiveIntType value) { 
1588      this.limit = value;
1589      return this;
1590    }
1591
1592    /**
1593     * @return Specifies a maximum number of results that are required (uses the _count search parameter).
1594     */
1595    public int getLimit() { 
1596      return this.limit == null || this.limit.isEmpty() ? 0 : this.limit.getValue();
1597    }
1598
1599    /**
1600     * @param value Specifies a maximum number of results that are required (uses the _count search parameter).
1601     */
1602    public DataRequirement setLimit(int value) { 
1603        if (this.limit == null)
1604          this.limit = new PositiveIntType();
1605        this.limit.setValue(value);
1606      return this;
1607    }
1608
1609    /**
1610     * @return {@link #sort} (Specifies the order of the results to be returned.)
1611     */
1612    public List<DataRequirementSortComponent> getSort() { 
1613      if (this.sort == null)
1614        this.sort = new ArrayList<DataRequirementSortComponent>();
1615      return this.sort;
1616    }
1617
1618    /**
1619     * @return Returns a reference to <code>this</code> for easy method chaining
1620     */
1621    public DataRequirement setSort(List<DataRequirementSortComponent> theSort) { 
1622      this.sort = theSort;
1623      return this;
1624    }
1625
1626    public boolean hasSort() { 
1627      if (this.sort == null)
1628        return false;
1629      for (DataRequirementSortComponent item : this.sort)
1630        if (!item.isEmpty())
1631          return true;
1632      return false;
1633    }
1634
1635    public DataRequirementSortComponent addSort() { //3
1636      DataRequirementSortComponent t = new DataRequirementSortComponent();
1637      if (this.sort == null)
1638        this.sort = new ArrayList<DataRequirementSortComponent>();
1639      this.sort.add(t);
1640      return t;
1641    }
1642
1643    public DataRequirement addSort(DataRequirementSortComponent t) { //3
1644      if (t == null)
1645        return this;
1646      if (this.sort == null)
1647        this.sort = new ArrayList<DataRequirementSortComponent>();
1648      this.sort.add(t);
1649      return this;
1650    }
1651
1652    /**
1653     * @return The first repetition of repeating field {@link #sort}, creating it if it does not already exist {3}
1654     */
1655    public DataRequirementSortComponent getSortFirstRep() { 
1656      if (getSort().isEmpty()) {
1657        addSort();
1658      }
1659      return getSort().get(0);
1660    }
1661
1662      protected void listChildren(List<Property> children) {
1663        super.listChildren(children);
1664        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));
1665        children.add(new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
1666        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject));
1667        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. \n\nThe value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, java.lang.Integer.MAX_VALUE, mustSupport));
1668        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. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
1669        children.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
1670        children.add(new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit));
1671        children.add(new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort));
1672      }
1673
1674      @Override
1675      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1676        switch (_hash) {
1677        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);
1678        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile);
1679        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
1680        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
1681        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
1682        case 772938623: /*subjectReference*/  return new Property("subject[x]", "Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
1683        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. \n\nThe value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, java.lang.Integer.MAX_VALUE, mustSupport);
1684        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. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter);
1685        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. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter);
1686        case 102976443: /*limit*/  return new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit);
1687        case 3536286: /*sort*/  return new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort);
1688        default: return super.getNamedProperty(_hash, _name, _checkValid);
1689        }
1690
1691      }
1692
1693      @Override
1694      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1695        switch (hash) {
1696        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<FHIRAllTypes>
1697        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
1698        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
1699        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
1700        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
1701        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
1702        case 102976443: /*limit*/ return this.limit == null ? new Base[0] : new Base[] {this.limit}; // PositiveIntType
1703        case 3536286: /*sort*/ return this.sort == null ? new Base[0] : this.sort.toArray(new Base[this.sort.size()]); // DataRequirementSortComponent
1704        default: return super.getProperty(hash, name, checkValid);
1705        }
1706
1707      }
1708
1709      @Override
1710      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1711        switch (hash) {
1712        case 3575610: // type
1713          value = new FHIRAllTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
1714          this.type = (Enumeration) value; // Enumeration<FHIRAllTypes>
1715          return value;
1716        case -309425751: // profile
1717          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
1718          return value;
1719        case -1867885268: // subject
1720          this.subject = TypeConvertor.castToType(value); // DataType
1721          return value;
1722        case -1402857082: // mustSupport
1723          this.getMustSupport().add(TypeConvertor.castToString(value)); // StringType
1724          return value;
1725        case -1303674939: // codeFilter
1726          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
1727          return value;
1728        case 149531846: // dateFilter
1729          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
1730          return value;
1731        case 102976443: // limit
1732          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1733          return value;
1734        case 3536286: // sort
1735          this.getSort().add((DataRequirementSortComponent) value); // DataRequirementSortComponent
1736          return value;
1737        default: return super.setProperty(hash, name, value);
1738        }
1739
1740      }
1741
1742      @Override
1743      public Base setProperty(String name, Base value) throws FHIRException {
1744        if (name.equals("type")) {
1745          value = new FHIRAllTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
1746          this.type = (Enumeration) value; // Enumeration<FHIRAllTypes>
1747        } else if (name.equals("profile")) {
1748          this.getProfile().add(TypeConvertor.castToCanonical(value));
1749        } else if (name.equals("subject[x]")) {
1750          this.subject = TypeConvertor.castToType(value); // DataType
1751        } else if (name.equals("mustSupport")) {
1752          this.getMustSupport().add(TypeConvertor.castToString(value));
1753        } else if (name.equals("codeFilter")) {
1754          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
1755        } else if (name.equals("dateFilter")) {
1756          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
1757        } else if (name.equals("limit")) {
1758          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1759        } else if (name.equals("sort")) {
1760          this.getSort().add((DataRequirementSortComponent) value);
1761        } else
1762          return super.setProperty(name, value);
1763        return value;
1764      }
1765
1766      @Override
1767      public Base makeProperty(int hash, String name) throws FHIRException {
1768        switch (hash) {
1769        case 3575610:  return getTypeElement();
1770        case -309425751:  return addProfileElement();
1771        case -573640748:  return getSubject();
1772        case -1867885268:  return getSubject();
1773        case -1402857082:  return addMustSupportElement();
1774        case -1303674939:  return addCodeFilter(); 
1775        case 149531846:  return addDateFilter(); 
1776        case 102976443:  return getLimitElement();
1777        case 3536286:  return addSort(); 
1778        default: return super.makeProperty(hash, name);
1779        }
1780
1781      }
1782
1783      @Override
1784      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1785        switch (hash) {
1786        case 3575610: /*type*/ return new String[] {"code"};
1787        case -309425751: /*profile*/ return new String[] {"canonical"};
1788        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
1789        case -1402857082: /*mustSupport*/ return new String[] {"string"};
1790        case -1303674939: /*codeFilter*/ return new String[] {};
1791        case 149531846: /*dateFilter*/ return new String[] {};
1792        case 102976443: /*limit*/ return new String[] {"positiveInt"};
1793        case 3536286: /*sort*/ return new String[] {};
1794        default: return super.getTypesForProperty(hash, name);
1795        }
1796
1797      }
1798
1799      @Override
1800      public Base addChild(String name) throws FHIRException {
1801        if (name.equals("type")) {
1802          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.type");
1803        }
1804        else if (name.equals("profile")) {
1805          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.profile");
1806        }
1807        else if (name.equals("subjectCodeableConcept")) {
1808          this.subject = new CodeableConcept();
1809          return this.subject;
1810        }
1811        else if (name.equals("subjectReference")) {
1812          this.subject = new Reference();
1813          return this.subject;
1814        }
1815        else if (name.equals("mustSupport")) {
1816          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.mustSupport");
1817        }
1818        else if (name.equals("codeFilter")) {
1819          return addCodeFilter();
1820        }
1821        else if (name.equals("dateFilter")) {
1822          return addDateFilter();
1823        }
1824        else if (name.equals("limit")) {
1825          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.limit");
1826        }
1827        else if (name.equals("sort")) {
1828          return addSort();
1829        }
1830        else
1831          return super.addChild(name);
1832      }
1833
1834  public String fhirType() {
1835    return "DataRequirement";
1836
1837  }
1838
1839      public DataRequirement copy() {
1840        DataRequirement dst = new DataRequirement();
1841        copyValues(dst);
1842        return dst;
1843      }
1844
1845      public void copyValues(DataRequirement dst) {
1846        super.copyValues(dst);
1847        dst.type = type == null ? null : type.copy();
1848        if (profile != null) {
1849          dst.profile = new ArrayList<CanonicalType>();
1850          for (CanonicalType i : profile)
1851            dst.profile.add(i.copy());
1852        };
1853        dst.subject = subject == null ? null : subject.copy();
1854        if (mustSupport != null) {
1855          dst.mustSupport = new ArrayList<StringType>();
1856          for (StringType i : mustSupport)
1857            dst.mustSupport.add(i.copy());
1858        };
1859        if (codeFilter != null) {
1860          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1861          for (DataRequirementCodeFilterComponent i : codeFilter)
1862            dst.codeFilter.add(i.copy());
1863        };
1864        if (dateFilter != null) {
1865          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1866          for (DataRequirementDateFilterComponent i : dateFilter)
1867            dst.dateFilter.add(i.copy());
1868        };
1869        dst.limit = limit == null ? null : limit.copy();
1870        if (sort != null) {
1871          dst.sort = new ArrayList<DataRequirementSortComponent>();
1872          for (DataRequirementSortComponent i : sort)
1873            dst.sort.add(i.copy());
1874        };
1875      }
1876
1877      protected DataRequirement typedCopy() {
1878        return copy();
1879      }
1880
1881      @Override
1882      public boolean equalsDeep(Base other_) {
1883        if (!super.equalsDeep(other_))
1884          return false;
1885        if (!(other_ instanceof DataRequirement))
1886          return false;
1887        DataRequirement o = (DataRequirement) other_;
1888        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(subject, o.subject, true)
1889           && compareDeep(mustSupport, o.mustSupport, true) && compareDeep(codeFilter, o.codeFilter, true)
1890           && compareDeep(dateFilter, o.dateFilter, true) && compareDeep(limit, o.limit, true) && compareDeep(sort, o.sort, true)
1891          ;
1892      }
1893
1894      @Override
1895      public boolean equalsShallow(Base other_) {
1896        if (!super.equalsShallow(other_))
1897          return false;
1898        if (!(other_ instanceof DataRequirement))
1899          return false;
1900        DataRequirement o = (DataRequirement) other_;
1901        return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true)
1902           && compareValues(limit, o.limit, true);
1903      }
1904
1905      public boolean isEmpty() {
1906        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, subject, mustSupport
1907          , codeFilter, dateFilter, limit, sort);
1908      }
1909
1910
1911}
1912