001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * 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 Type 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
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 = castToString(value); // StringType
426          return value;
427        case -553645115: // searchParam
428          this.searchParam = castToString(value); // StringType
429          return value;
430        case -1410174671: // valueSet
431          this.valueSet = castToCanonical(value); // CanonicalType
432          return value;
433        case 3059181: // code
434          this.getCode().add(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 = castToString(value); // StringType
445        } else if (name.equals("searchParam")) {
446          this.searchParam = castToString(value); // StringType
447        } else if (name.equals("valueSet")) {
448          this.valueSet = castToCanonical(value); // CanonicalType
449        } else if (name.equals("code")) {
450          this.getCode().add(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.path");
484        }
485        else if (name.equals("searchParam")) {
486          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.searchParam");
487        }
488        else if (name.equals("valueSet")) {
489          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.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);
535      }
536
537      public boolean isEmpty() {
538        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, valueSet
539          , code);
540      }
541
542  public String fhirType() {
543    return "DataRequirement.codeFilter";
544
545  }
546
547  }
548
549    @Block()
550    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
551        /**
552         * 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.
553         */
554        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
555        @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." )
556        protected StringType path;
557
558        /**
559         * 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.
560         */
561        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
562        @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." )
563        protected StringType searchParam;
564
565        /**
566         * 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.
567         */
568        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
569        @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." )
570        protected Type value;
571
572        private static final long serialVersionUID = 1151620053L;
573
574    /**
575     * Constructor
576     */
577      public DataRequirementDateFilterComponent() {
578        super();
579      }
580
581        /**
582         * @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
583         */
584        public StringType getPathElement() { 
585          if (this.path == null)
586            if (Configuration.errorOnAutoCreate())
587              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
588            else if (Configuration.doAutoCreate())
589              this.path = new StringType(); // bb
590          return this.path;
591        }
592
593        public boolean hasPathElement() { 
594          return this.path != null && !this.path.isEmpty();
595        }
596
597        public boolean hasPath() { 
598          return this.path != null && !this.path.isEmpty();
599        }
600
601        /**
602         * @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
603         */
604        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
605          this.path = value;
606          return this;
607        }
608
609        /**
610         * @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.
611         */
612        public String getPath() { 
613          return this.path == null ? null : this.path.getValue();
614        }
615
616        /**
617         * @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.
618         */
619        public DataRequirementDateFilterComponent setPath(String value) { 
620          if (Utilities.noString(value))
621            this.path = null;
622          else {
623            if (this.path == null)
624              this.path = new StringType();
625            this.path.setValue(value);
626          }
627          return this;
628        }
629
630        /**
631         * @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
632         */
633        public StringType getSearchParamElement() { 
634          if (this.searchParam == null)
635            if (Configuration.errorOnAutoCreate())
636              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.searchParam");
637            else if (Configuration.doAutoCreate())
638              this.searchParam = new StringType(); // bb
639          return this.searchParam;
640        }
641
642        public boolean hasSearchParamElement() { 
643          return this.searchParam != null && !this.searchParam.isEmpty();
644        }
645
646        public boolean hasSearchParam() { 
647          return this.searchParam != null && !this.searchParam.isEmpty();
648        }
649
650        /**
651         * @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
652         */
653        public DataRequirementDateFilterComponent setSearchParamElement(StringType value) { 
654          this.searchParam = value;
655          return this;
656        }
657
658        /**
659         * @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.
660         */
661        public String getSearchParam() { 
662          return this.searchParam == null ? null : this.searchParam.getValue();
663        }
664
665        /**
666         * @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.
667         */
668        public DataRequirementDateFilterComponent setSearchParam(String value) { 
669          if (Utilities.noString(value))
670            this.searchParam = null;
671          else {
672            if (this.searchParam == null)
673              this.searchParam = new StringType();
674            this.searchParam.setValue(value);
675          }
676          return this;
677        }
678
679        /**
680         * @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.)
681         */
682        public Type getValue() { 
683          return this.value;
684        }
685
686        /**
687         * @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.)
688         */
689        public DateTimeType getValueDateTimeType() throws FHIRException { 
690          if (this.value == null)
691            this.value = new DateTimeType();
692          if (!(this.value instanceof DateTimeType))
693            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
694          return (DateTimeType) this.value;
695        }
696
697        public boolean hasValueDateTimeType() { 
698          return this != null && this.value instanceof DateTimeType;
699        }
700
701        /**
702         * @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.)
703         */
704        public Period getValuePeriod() throws FHIRException { 
705          if (this.value == null)
706            this.value = new Period();
707          if (!(this.value instanceof Period))
708            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
709          return (Period) this.value;
710        }
711
712        public boolean hasValuePeriod() { 
713          return this != null && this.value instanceof Period;
714        }
715
716        /**
717         * @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.)
718         */
719        public Duration getValueDuration() throws FHIRException { 
720          if (this.value == null)
721            this.value = new Duration();
722          if (!(this.value instanceof Duration))
723            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
724          return (Duration) this.value;
725        }
726
727        public boolean hasValueDuration() { 
728          return this != null && this.value instanceof Duration;
729        }
730
731        public boolean hasValue() { 
732          return this.value != null && !this.value.isEmpty();
733        }
734
735        /**
736         * @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.)
737         */
738        public DataRequirementDateFilterComponent setValue(Type value) { 
739          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
740            throw new Error("Not the right type for DataRequirement.dateFilter.value[x]: "+value.fhirType());
741          this.value = value;
742          return this;
743        }
744
745        protected void listChildren(List<Property> children) {
746          super.listChildren(children);
747          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));
748          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));
749          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));
750        }
751
752        @Override
753        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
754          switch (_hash) {
755          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);
756          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);
757          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);
758          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);
759          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
760          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
761          case 1558135333: /*valueDuration*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
762          default: return super.getNamedProperty(_hash, _name, _checkValid);
763          }
764
765        }
766
767      @Override
768      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
769        switch (hash) {
770        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
771        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
772        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
773        default: return super.getProperty(hash, name, checkValid);
774        }
775
776      }
777
778      @Override
779      public Base setProperty(int hash, String name, Base value) throws FHIRException {
780        switch (hash) {
781        case 3433509: // path
782          this.path = castToString(value); // StringType
783          return value;
784        case -553645115: // searchParam
785          this.searchParam = castToString(value); // StringType
786          return value;
787        case 111972721: // value
788          this.value = castToType(value); // Type
789          return value;
790        default: return super.setProperty(hash, name, value);
791        }
792
793      }
794
795      @Override
796      public Base setProperty(String name, Base value) throws FHIRException {
797        if (name.equals("path")) {
798          this.path = castToString(value); // StringType
799        } else if (name.equals("searchParam")) {
800          this.searchParam = castToString(value); // StringType
801        } else if (name.equals("value[x]")) {
802          this.value = castToType(value); // Type
803        } else
804          return super.setProperty(name, value);
805        return value;
806      }
807
808      @Override
809      public Base makeProperty(int hash, String name) throws FHIRException {
810        switch (hash) {
811        case 3433509:  return getPathElement();
812        case -553645115:  return getSearchParamElement();
813        case -1410166417:  return getValue(); 
814        case 111972721:  return getValue(); 
815        default: return super.makeProperty(hash, name);
816        }
817
818      }
819
820      @Override
821      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
822        switch (hash) {
823        case 3433509: /*path*/ return new String[] {"string"};
824        case -553645115: /*searchParam*/ return new String[] {"string"};
825        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
826        default: return super.getTypesForProperty(hash, name);
827        }
828
829      }
830
831      @Override
832      public Base addChild(String name) throws FHIRException {
833        if (name.equals("path")) {
834          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
835        }
836        else if (name.equals("searchParam")) {
837          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.searchParam");
838        }
839        else if (name.equals("valueDateTime")) {
840          this.value = new DateTimeType();
841          return this.value;
842        }
843        else if (name.equals("valuePeriod")) {
844          this.value = new Period();
845          return this.value;
846        }
847        else if (name.equals("valueDuration")) {
848          this.value = new Duration();
849          return this.value;
850        }
851        else
852          return super.addChild(name);
853      }
854
855      public DataRequirementDateFilterComponent copy() {
856        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
857        copyValues(dst);
858        return dst;
859      }
860
861      public void copyValues(DataRequirementDateFilterComponent dst) {
862        super.copyValues(dst);
863        dst.path = path == null ? null : path.copy();
864        dst.searchParam = searchParam == null ? null : searchParam.copy();
865        dst.value = value == null ? null : value.copy();
866      }
867
868      @Override
869      public boolean equalsDeep(Base other_) {
870        if (!super.equalsDeep(other_))
871          return false;
872        if (!(other_ instanceof DataRequirementDateFilterComponent))
873          return false;
874        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
875        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(value, o.value, true)
876          ;
877      }
878
879      @Override
880      public boolean equalsShallow(Base other_) {
881        if (!super.equalsShallow(other_))
882          return false;
883        if (!(other_ instanceof DataRequirementDateFilterComponent))
884          return false;
885        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
886        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true);
887      }
888
889      public boolean isEmpty() {
890        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, value
891          );
892      }
893
894  public String fhirType() {
895    return "DataRequirement.dateFilter";
896
897  }
898
899  }
900
901    @Block()
902    public static class DataRequirementSortComponent extends Element implements IBaseDatatypeElement {
903        /**
904         * 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.
905         */
906        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
907        @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." )
908        protected StringType path;
909
910        /**
911         * The direction of the sort, ascending or descending.
912         */
913        @Child(name = "direction", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
914        @Description(shortDefinition="ascending | descending", formalDefinition="The direction of the sort, ascending or descending." )
915        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/sort-direction")
916        protected Enumeration<SortDirection> direction;
917
918        private static final long serialVersionUID = -694498683L;
919
920    /**
921     * Constructor
922     */
923      public DataRequirementSortComponent() {
924        super();
925      }
926
927    /**
928     * Constructor
929     */
930      public DataRequirementSortComponent(StringType path, Enumeration<SortDirection> direction) {
931        super();
932        this.path = path;
933        this.direction = direction;
934      }
935
936        /**
937         * @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
938         */
939        public StringType getPathElement() { 
940          if (this.path == null)
941            if (Configuration.errorOnAutoCreate())
942              throw new Error("Attempt to auto-create DataRequirementSortComponent.path");
943            else if (Configuration.doAutoCreate())
944              this.path = new StringType(); // bb
945          return this.path;
946        }
947
948        public boolean hasPathElement() { 
949          return this.path != null && !this.path.isEmpty();
950        }
951
952        public boolean hasPath() { 
953          return this.path != null && !this.path.isEmpty();
954        }
955
956        /**
957         * @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
958         */
959        public DataRequirementSortComponent setPathElement(StringType value) { 
960          this.path = value;
961          return this;
962        }
963
964        /**
965         * @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.
966         */
967        public String getPath() { 
968          return this.path == null ? null : this.path.getValue();
969        }
970
971        /**
972         * @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.
973         */
974        public DataRequirementSortComponent setPath(String value) { 
975            if (this.path == null)
976              this.path = new StringType();
977            this.path.setValue(value);
978          return this;
979        }
980
981        /**
982         * @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
983         */
984        public Enumeration<SortDirection> getDirectionElement() { 
985          if (this.direction == null)
986            if (Configuration.errorOnAutoCreate())
987              throw new Error("Attempt to auto-create DataRequirementSortComponent.direction");
988            else if (Configuration.doAutoCreate())
989              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory()); // bb
990          return this.direction;
991        }
992
993        public boolean hasDirectionElement() { 
994          return this.direction != null && !this.direction.isEmpty();
995        }
996
997        public boolean hasDirection() { 
998          return this.direction != null && !this.direction.isEmpty();
999        }
1000
1001        /**
1002         * @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
1003         */
1004        public DataRequirementSortComponent setDirectionElement(Enumeration<SortDirection> value) { 
1005          this.direction = value;
1006          return this;
1007        }
1008
1009        /**
1010         * @return The direction of the sort, ascending or descending.
1011         */
1012        public SortDirection getDirection() { 
1013          return this.direction == null ? null : this.direction.getValue();
1014        }
1015
1016        /**
1017         * @param value The direction of the sort, ascending or descending.
1018         */
1019        public DataRequirementSortComponent setDirection(SortDirection value) { 
1020            if (this.direction == null)
1021              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory());
1022            this.direction.setValue(value);
1023          return this;
1024        }
1025
1026        protected void listChildren(List<Property> children) {
1027          super.listChildren(children);
1028          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));
1029          children.add(new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction));
1030        }
1031
1032        @Override
1033        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1034          switch (_hash) {
1035          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);
1036          case -962590849: /*direction*/  return new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction);
1037          default: return super.getNamedProperty(_hash, _name, _checkValid);
1038          }
1039
1040        }
1041
1042      @Override
1043      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1044        switch (hash) {
1045        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1046        case -962590849: /*direction*/ return this.direction == null ? new Base[0] : new Base[] {this.direction}; // Enumeration<SortDirection>
1047        default: return super.getProperty(hash, name, checkValid);
1048        }
1049
1050      }
1051
1052      @Override
1053      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1054        switch (hash) {
1055        case 3433509: // path
1056          this.path = castToString(value); // StringType
1057          return value;
1058        case -962590849: // direction
1059          value = new SortDirectionEnumFactory().fromType(castToCode(value));
1060          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1061          return value;
1062        default: return super.setProperty(hash, name, value);
1063        }
1064
1065      }
1066
1067      @Override
1068      public Base setProperty(String name, Base value) throws FHIRException {
1069        if (name.equals("path")) {
1070          this.path = castToString(value); // StringType
1071        } else if (name.equals("direction")) {
1072          value = new SortDirectionEnumFactory().fromType(castToCode(value));
1073          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1074        } else
1075          return super.setProperty(name, value);
1076        return value;
1077      }
1078
1079      @Override
1080      public Base makeProperty(int hash, String name) throws FHIRException {
1081        switch (hash) {
1082        case 3433509:  return getPathElement();
1083        case -962590849:  return getDirectionElement();
1084        default: return super.makeProperty(hash, name);
1085        }
1086
1087      }
1088
1089      @Override
1090      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1091        switch (hash) {
1092        case 3433509: /*path*/ return new String[] {"string"};
1093        case -962590849: /*direction*/ return new String[] {"code"};
1094        default: return super.getTypesForProperty(hash, name);
1095        }
1096
1097      }
1098
1099      @Override
1100      public Base addChild(String name) throws FHIRException {
1101        if (name.equals("path")) {
1102          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
1103        }
1104        else if (name.equals("direction")) {
1105          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.direction");
1106        }
1107        else
1108          return super.addChild(name);
1109      }
1110
1111      public DataRequirementSortComponent copy() {
1112        DataRequirementSortComponent dst = new DataRequirementSortComponent();
1113        copyValues(dst);
1114        return dst;
1115      }
1116
1117      public void copyValues(DataRequirementSortComponent dst) {
1118        super.copyValues(dst);
1119        dst.path = path == null ? null : path.copy();
1120        dst.direction = direction == null ? null : direction.copy();
1121      }
1122
1123      @Override
1124      public boolean equalsDeep(Base other_) {
1125        if (!super.equalsDeep(other_))
1126          return false;
1127        if (!(other_ instanceof DataRequirementSortComponent))
1128          return false;
1129        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1130        return compareDeep(path, o.path, true) && compareDeep(direction, o.direction, true);
1131      }
1132
1133      @Override
1134      public boolean equalsShallow(Base other_) {
1135        if (!super.equalsShallow(other_))
1136          return false;
1137        if (!(other_ instanceof DataRequirementSortComponent))
1138          return false;
1139        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1140        return compareValues(path, o.path, true) && compareValues(direction, o.direction, true);
1141      }
1142
1143      public boolean isEmpty() {
1144        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, direction);
1145      }
1146
1147  public String fhirType() {
1148    return "DataRequirement.sort";
1149
1150  }
1151
1152  }
1153
1154    /**
1155     * 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.
1156     */
1157    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1158    @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." )
1159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types")
1160    protected CodeType type;
1161
1162    /**
1163     * The profile of the required data, specified as the uri of the profile definition.
1164     */
1165    @Child(name = "profile", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1166    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
1167    protected List<CanonicalType> profile;
1168
1169    /**
1170     * The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.
1171     */
1172    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=2, min=0, max=1, modifier=false, summary=true)
1173    @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." )
1174    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subject-type")
1175    protected Type subject;
1176
1177    /**
1178     * 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. 
1179
1180The 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).
1181     */
1182    @Child(name = "mustSupport", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1183    @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)." )
1184    protected List<StringType> mustSupport;
1185
1186    /**
1187     * 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.
1188     */
1189    @Child(name = "codeFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1190    @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." )
1191    protected List<DataRequirementCodeFilterComponent> codeFilter;
1192
1193    /**
1194     * 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.
1195     */
1196    @Child(name = "dateFilter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1197    @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." )
1198    protected List<DataRequirementDateFilterComponent> dateFilter;
1199
1200    /**
1201     * Specifies a maximum number of results that are required (uses the _count search parameter).
1202     */
1203    @Child(name = "limit", type = {PositiveIntType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1204    @Description(shortDefinition="Number of results", formalDefinition="Specifies a maximum number of results that are required (uses the _count search parameter)." )
1205    protected PositiveIntType limit;
1206
1207    /**
1208     * Specifies the order of the results to be returned.
1209     */
1210    @Child(name = "sort", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1211    @Description(shortDefinition="Order of the results", formalDefinition="Specifies the order of the results to be returned." )
1212    protected List<DataRequirementSortComponent> sort;
1213
1214    private static final long serialVersionUID = 74042278L;
1215
1216  /**
1217   * Constructor
1218   */
1219    public DataRequirement() {
1220      super();
1221    }
1222
1223  /**
1224   * Constructor
1225   */
1226    public DataRequirement(CodeType type) {
1227      super();
1228      this.type = type;
1229    }
1230
1231    /**
1232     * @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
1233     */
1234    public CodeType getTypeElement() { 
1235      if (this.type == null)
1236        if (Configuration.errorOnAutoCreate())
1237          throw new Error("Attempt to auto-create DataRequirement.type");
1238        else if (Configuration.doAutoCreate())
1239          this.type = new CodeType(); // bb
1240      return this.type;
1241    }
1242
1243    public boolean hasTypeElement() { 
1244      return this.type != null && !this.type.isEmpty();
1245    }
1246
1247    public boolean hasType() { 
1248      return this.type != null && !this.type.isEmpty();
1249    }
1250
1251    /**
1252     * @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
1253     */
1254    public DataRequirement setTypeElement(CodeType value) { 
1255      this.type = value;
1256      return this;
1257    }
1258
1259    /**
1260     * @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.
1261     */
1262    public String getType() { 
1263      return this.type == null ? null : this.type.getValue();
1264    }
1265
1266    /**
1267     * @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.
1268     */
1269    public DataRequirement setType(String value) { 
1270        if (this.type == null)
1271          this.type = new CodeType();
1272        this.type.setValue(value);
1273      return this;
1274    }
1275
1276    /**
1277     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1278     */
1279    public List<CanonicalType> getProfile() { 
1280      if (this.profile == null)
1281        this.profile = new ArrayList<CanonicalType>();
1282      return this.profile;
1283    }
1284
1285    /**
1286     * @return Returns a reference to <code>this</code> for easy method chaining
1287     */
1288    public DataRequirement setProfile(List<CanonicalType> theProfile) { 
1289      this.profile = theProfile;
1290      return this;
1291    }
1292
1293    public boolean hasProfile() { 
1294      if (this.profile == null)
1295        return false;
1296      for (CanonicalType item : this.profile)
1297        if (!item.isEmpty())
1298          return true;
1299      return false;
1300    }
1301
1302    /**
1303     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1304     */
1305    public CanonicalType addProfileElement() {//2 
1306      CanonicalType t = new CanonicalType();
1307      if (this.profile == null)
1308        this.profile = new ArrayList<CanonicalType>();
1309      this.profile.add(t);
1310      return t;
1311    }
1312
1313    /**
1314     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1315     */
1316    public DataRequirement addProfile(String value) { //1
1317      CanonicalType t = new CanonicalType();
1318      t.setValue(value);
1319      if (this.profile == null)
1320        this.profile = new ArrayList<CanonicalType>();
1321      this.profile.add(t);
1322      return this;
1323    }
1324
1325    /**
1326     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1327     */
1328    public boolean hasProfile(String value) { 
1329      if (this.profile == null)
1330        return false;
1331      for (CanonicalType v : this.profile)
1332        if (v.getValue().equals(value)) // canonical(StructureDefinition)
1333          return true;
1334      return false;
1335    }
1336
1337    /**
1338     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1339     */
1340    public Type getSubject() { 
1341      return this.subject;
1342    }
1343
1344    /**
1345     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1346     */
1347    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
1348      if (this.subject == null)
1349        this.subject = new CodeableConcept();
1350      if (!(this.subject instanceof CodeableConcept))
1351        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
1352      return (CodeableConcept) this.subject;
1353    }
1354
1355    public boolean hasSubjectCodeableConcept() { 
1356      return this != null && this.subject instanceof CodeableConcept;
1357    }
1358
1359    /**
1360     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1361     */
1362    public Reference getSubjectReference() throws FHIRException { 
1363      if (this.subject == null)
1364        this.subject = new Reference();
1365      if (!(this.subject instanceof Reference))
1366        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
1367      return (Reference) this.subject;
1368    }
1369
1370    public boolean hasSubjectReference() { 
1371      return this != null && this.subject instanceof Reference;
1372    }
1373
1374    public boolean hasSubject() { 
1375      return this.subject != null && !this.subject.isEmpty();
1376    }
1377
1378    /**
1379     * @param value {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1380     */
1381    public DataRequirement setSubject(Type value) { 
1382      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1383        throw new Error("Not the right type for DataRequirement.subject[x]: "+value.fhirType());
1384      this.subject = value;
1385      return this;
1386    }
1387
1388    /**
1389     * @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. 
1390
1391The 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).)
1392     */
1393    public List<StringType> getMustSupport() { 
1394      if (this.mustSupport == null)
1395        this.mustSupport = new ArrayList<StringType>();
1396      return this.mustSupport;
1397    }
1398
1399    /**
1400     * @return Returns a reference to <code>this</code> for easy method chaining
1401     */
1402    public DataRequirement setMustSupport(List<StringType> theMustSupport) { 
1403      this.mustSupport = theMustSupport;
1404      return this;
1405    }
1406
1407    public boolean hasMustSupport() { 
1408      if (this.mustSupport == null)
1409        return false;
1410      for (StringType item : this.mustSupport)
1411        if (!item.isEmpty())
1412          return true;
1413      return false;
1414    }
1415
1416    /**
1417     * @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. 
1418
1419The 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).)
1420     */
1421    public StringType addMustSupportElement() {//2 
1422      StringType t = new StringType();
1423      if (this.mustSupport == null)
1424        this.mustSupport = new ArrayList<StringType>();
1425      this.mustSupport.add(t);
1426      return t;
1427    }
1428
1429    /**
1430     * @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. 
1431
1432The 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).)
1433     */
1434    public DataRequirement addMustSupport(String value) { //1
1435      StringType t = new StringType();
1436      t.setValue(value);
1437      if (this.mustSupport == null)
1438        this.mustSupport = new ArrayList<StringType>();
1439      this.mustSupport.add(t);
1440      return this;
1441    }
1442
1443    /**
1444     * @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. 
1445
1446The 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).)
1447     */
1448    public boolean hasMustSupport(String value) { 
1449      if (this.mustSupport == null)
1450        return false;
1451      for (StringType v : this.mustSupport)
1452        if (v.getValue().equals(value)) // string
1453          return true;
1454      return false;
1455    }
1456
1457    /**
1458     * @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.)
1459     */
1460    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
1461      if (this.codeFilter == null)
1462        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1463      return this.codeFilter;
1464    }
1465
1466    /**
1467     * @return Returns a reference to <code>this</code> for easy method chaining
1468     */
1469    public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 
1470      this.codeFilter = theCodeFilter;
1471      return this;
1472    }
1473
1474    public boolean hasCodeFilter() { 
1475      if (this.codeFilter == null)
1476        return false;
1477      for (DataRequirementCodeFilterComponent item : this.codeFilter)
1478        if (!item.isEmpty())
1479          return true;
1480      return false;
1481    }
1482
1483    public DataRequirementCodeFilterComponent addCodeFilter() { //3
1484      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
1485      if (this.codeFilter == null)
1486        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1487      this.codeFilter.add(t);
1488      return t;
1489    }
1490
1491    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
1492      if (t == null)
1493        return this;
1494      if (this.codeFilter == null)
1495        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1496      this.codeFilter.add(t);
1497      return this;
1498    }
1499
1500    /**
1501     * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist
1502     */
1503    public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 
1504      if (getCodeFilter().isEmpty()) {
1505        addCodeFilter();
1506      }
1507      return getCodeFilter().get(0);
1508    }
1509
1510    /**
1511     * @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.)
1512     */
1513    public List<DataRequirementDateFilterComponent> getDateFilter() { 
1514      if (this.dateFilter == null)
1515        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1516      return this.dateFilter;
1517    }
1518
1519    /**
1520     * @return Returns a reference to <code>this</code> for easy method chaining
1521     */
1522    public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 
1523      this.dateFilter = theDateFilter;
1524      return this;
1525    }
1526
1527    public boolean hasDateFilter() { 
1528      if (this.dateFilter == null)
1529        return false;
1530      for (DataRequirementDateFilterComponent item : this.dateFilter)
1531        if (!item.isEmpty())
1532          return true;
1533      return false;
1534    }
1535
1536    public DataRequirementDateFilterComponent addDateFilter() { //3
1537      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
1538      if (this.dateFilter == null)
1539        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1540      this.dateFilter.add(t);
1541      return t;
1542    }
1543
1544    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
1545      if (t == null)
1546        return this;
1547      if (this.dateFilter == null)
1548        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1549      this.dateFilter.add(t);
1550      return this;
1551    }
1552
1553    /**
1554     * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist
1555     */
1556    public DataRequirementDateFilterComponent getDateFilterFirstRep() { 
1557      if (getDateFilter().isEmpty()) {
1558        addDateFilter();
1559      }
1560      return getDateFilter().get(0);
1561    }
1562
1563    /**
1564     * @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
1565     */
1566    public PositiveIntType getLimitElement() { 
1567      if (this.limit == null)
1568        if (Configuration.errorOnAutoCreate())
1569          throw new Error("Attempt to auto-create DataRequirement.limit");
1570        else if (Configuration.doAutoCreate())
1571          this.limit = new PositiveIntType(); // bb
1572      return this.limit;
1573    }
1574
1575    public boolean hasLimitElement() { 
1576      return this.limit != null && !this.limit.isEmpty();
1577    }
1578
1579    public boolean hasLimit() { 
1580      return this.limit != null && !this.limit.isEmpty();
1581    }
1582
1583    /**
1584     * @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
1585     */
1586    public DataRequirement setLimitElement(PositiveIntType value) { 
1587      this.limit = value;
1588      return this;
1589    }
1590
1591    /**
1592     * @return Specifies a maximum number of results that are required (uses the _count search parameter).
1593     */
1594    public int getLimit() { 
1595      return this.limit == null || this.limit.isEmpty() ? 0 : this.limit.getValue();
1596    }
1597
1598    /**
1599     * @param value Specifies a maximum number of results that are required (uses the _count search parameter).
1600     */
1601    public DataRequirement setLimit(int value) { 
1602        if (this.limit == null)
1603          this.limit = new PositiveIntType();
1604        this.limit.setValue(value);
1605      return this;
1606    }
1607
1608    /**
1609     * @return {@link #sort} (Specifies the order of the results to be returned.)
1610     */
1611    public List<DataRequirementSortComponent> getSort() { 
1612      if (this.sort == null)
1613        this.sort = new ArrayList<DataRequirementSortComponent>();
1614      return this.sort;
1615    }
1616
1617    /**
1618     * @return Returns a reference to <code>this</code> for easy method chaining
1619     */
1620    public DataRequirement setSort(List<DataRequirementSortComponent> theSort) { 
1621      this.sort = theSort;
1622      return this;
1623    }
1624
1625    public boolean hasSort() { 
1626      if (this.sort == null)
1627        return false;
1628      for (DataRequirementSortComponent item : this.sort)
1629        if (!item.isEmpty())
1630          return true;
1631      return false;
1632    }
1633
1634    public DataRequirementSortComponent addSort() { //3
1635      DataRequirementSortComponent t = new DataRequirementSortComponent();
1636      if (this.sort == null)
1637        this.sort = new ArrayList<DataRequirementSortComponent>();
1638      this.sort.add(t);
1639      return t;
1640    }
1641
1642    public DataRequirement addSort(DataRequirementSortComponent t) { //3
1643      if (t == null)
1644        return this;
1645      if (this.sort == null)
1646        this.sort = new ArrayList<DataRequirementSortComponent>();
1647      this.sort.add(t);
1648      return this;
1649    }
1650
1651    /**
1652     * @return The first repetition of repeating field {@link #sort}, creating it if it does not already exist
1653     */
1654    public DataRequirementSortComponent getSortFirstRep() { 
1655      if (getSort().isEmpty()) {
1656        addSort();
1657      }
1658      return getSort().get(0);
1659    }
1660
1661      protected void listChildren(List<Property> children) {
1662        super.listChildren(children);
1663        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));
1664        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));
1665        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));
1666        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));
1667        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));
1668        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));
1669        children.add(new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit));
1670        children.add(new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort));
1671      }
1672
1673      @Override
1674      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1675        switch (_hash) {
1676        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);
1677        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);
1678        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);
1679        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);
1680        case -1257122603: /*subjectCodeableConcept*/  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 772938623: /*subjectReference*/  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);
1682        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);
1683        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);
1684        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);
1685        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);
1686        case 3536286: /*sort*/  return new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort);
1687        default: return super.getNamedProperty(_hash, _name, _checkValid);
1688        }
1689
1690      }
1691
1692      @Override
1693      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1694        switch (hash) {
1695        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1696        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
1697        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Type
1698        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
1699        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
1700        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
1701        case 102976443: /*limit*/ return this.limit == null ? new Base[0] : new Base[] {this.limit}; // PositiveIntType
1702        case 3536286: /*sort*/ return this.sort == null ? new Base[0] : this.sort.toArray(new Base[this.sort.size()]); // DataRequirementSortComponent
1703        default: return super.getProperty(hash, name, checkValid);
1704        }
1705
1706      }
1707
1708      @Override
1709      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1710        switch (hash) {
1711        case 3575610: // type
1712          this.type = castToCode(value); // CodeType
1713          return value;
1714        case -309425751: // profile
1715          this.getProfile().add(castToCanonical(value)); // CanonicalType
1716          return value;
1717        case -1867885268: // subject
1718          this.subject = castToType(value); // Type
1719          return value;
1720        case -1402857082: // mustSupport
1721          this.getMustSupport().add(castToString(value)); // StringType
1722          return value;
1723        case -1303674939: // codeFilter
1724          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
1725          return value;
1726        case 149531846: // dateFilter
1727          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
1728          return value;
1729        case 102976443: // limit
1730          this.limit = castToPositiveInt(value); // PositiveIntType
1731          return value;
1732        case 3536286: // sort
1733          this.getSort().add((DataRequirementSortComponent) value); // DataRequirementSortComponent
1734          return value;
1735        default: return super.setProperty(hash, name, value);
1736        }
1737
1738      }
1739
1740      @Override
1741      public Base setProperty(String name, Base value) throws FHIRException {
1742        if (name.equals("type")) {
1743          this.type = castToCode(value); // CodeType
1744        } else if (name.equals("profile")) {
1745          this.getProfile().add(castToCanonical(value));
1746        } else if (name.equals("subject[x]")) {
1747          this.subject = castToType(value); // Type
1748        } else if (name.equals("mustSupport")) {
1749          this.getMustSupport().add(castToString(value));
1750        } else if (name.equals("codeFilter")) {
1751          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
1752        } else if (name.equals("dateFilter")) {
1753          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
1754        } else if (name.equals("limit")) {
1755          this.limit = castToPositiveInt(value); // PositiveIntType
1756        } else if (name.equals("sort")) {
1757          this.getSort().add((DataRequirementSortComponent) value);
1758        } else
1759          return super.setProperty(name, value);
1760        return value;
1761      }
1762
1763      @Override
1764      public Base makeProperty(int hash, String name) throws FHIRException {
1765        switch (hash) {
1766        case 3575610:  return getTypeElement();
1767        case -309425751:  return addProfileElement();
1768        case -573640748:  return getSubject(); 
1769        case -1867885268:  return getSubject(); 
1770        case -1402857082:  return addMustSupportElement();
1771        case -1303674939:  return addCodeFilter(); 
1772        case 149531846:  return addDateFilter(); 
1773        case 102976443:  return getLimitElement();
1774        case 3536286:  return addSort(); 
1775        default: return super.makeProperty(hash, name);
1776        }
1777
1778      }
1779
1780      @Override
1781      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1782        switch (hash) {
1783        case 3575610: /*type*/ return new String[] {"code"};
1784        case -309425751: /*profile*/ return new String[] {"canonical"};
1785        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
1786        case -1402857082: /*mustSupport*/ return new String[] {"string"};
1787        case -1303674939: /*codeFilter*/ return new String[] {};
1788        case 149531846: /*dateFilter*/ return new String[] {};
1789        case 102976443: /*limit*/ return new String[] {"positiveInt"};
1790        case 3536286: /*sort*/ return new String[] {};
1791        default: return super.getTypesForProperty(hash, name);
1792        }
1793
1794      }
1795
1796      @Override
1797      public Base addChild(String name) throws FHIRException {
1798        if (name.equals("type")) {
1799          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.type");
1800        }
1801        else if (name.equals("profile")) {
1802          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.profile");
1803        }
1804        else if (name.equals("subjectCodeableConcept")) {
1805          this.subject = new CodeableConcept();
1806          return this.subject;
1807        }
1808        else if (name.equals("subjectReference")) {
1809          this.subject = new Reference();
1810          return this.subject;
1811        }
1812        else if (name.equals("mustSupport")) {
1813          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.mustSupport");
1814        }
1815        else if (name.equals("codeFilter")) {
1816          return addCodeFilter();
1817        }
1818        else if (name.equals("dateFilter")) {
1819          return addDateFilter();
1820        }
1821        else if (name.equals("limit")) {
1822          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.limit");
1823        }
1824        else if (name.equals("sort")) {
1825          return addSort();
1826        }
1827        else
1828          return super.addChild(name);
1829      }
1830
1831  public String fhirType() {
1832    return "DataRequirement";
1833
1834  }
1835
1836      public DataRequirement copy() {
1837        DataRequirement dst = new DataRequirement();
1838        copyValues(dst);
1839        return dst;
1840      }
1841
1842      public void copyValues(DataRequirement dst) {
1843        super.copyValues(dst);
1844        dst.type = type == null ? null : type.copy();
1845        if (profile != null) {
1846          dst.profile = new ArrayList<CanonicalType>();
1847          for (CanonicalType i : profile)
1848            dst.profile.add(i.copy());
1849        };
1850        dst.subject = subject == null ? null : subject.copy();
1851        if (mustSupport != null) {
1852          dst.mustSupport = new ArrayList<StringType>();
1853          for (StringType i : mustSupport)
1854            dst.mustSupport.add(i.copy());
1855        };
1856        if (codeFilter != null) {
1857          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1858          for (DataRequirementCodeFilterComponent i : codeFilter)
1859            dst.codeFilter.add(i.copy());
1860        };
1861        if (dateFilter != null) {
1862          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1863          for (DataRequirementDateFilterComponent i : dateFilter)
1864            dst.dateFilter.add(i.copy());
1865        };
1866        dst.limit = limit == null ? null : limit.copy();
1867        if (sort != null) {
1868          dst.sort = new ArrayList<DataRequirementSortComponent>();
1869          for (DataRequirementSortComponent i : sort)
1870            dst.sort.add(i.copy());
1871        };
1872      }
1873
1874      protected DataRequirement typedCopy() {
1875        return copy();
1876      }
1877
1878      @Override
1879      public boolean equalsDeep(Base other_) {
1880        if (!super.equalsDeep(other_))
1881          return false;
1882        if (!(other_ instanceof DataRequirement))
1883          return false;
1884        DataRequirement o = (DataRequirement) other_;
1885        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(subject, o.subject, true)
1886           && compareDeep(mustSupport, o.mustSupport, true) && compareDeep(codeFilter, o.codeFilter, true)
1887           && compareDeep(dateFilter, o.dateFilter, true) && compareDeep(limit, o.limit, true) && compareDeep(sort, o.sort, true)
1888          ;
1889      }
1890
1891      @Override
1892      public boolean equalsShallow(Base other_) {
1893        if (!super.equalsShallow(other_))
1894          return false;
1895        if (!(other_ instanceof DataRequirement))
1896          return false;
1897        DataRequirement o = (DataRequirement) other_;
1898        return compareValues(type, o.type, true) && compareValues(mustSupport, o.mustSupport, true) && compareValues(limit, o.limit, true)
1899          ;
1900      }
1901
1902      public boolean isEmpty() {
1903        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, subject, mustSupport
1904          , codeFilter, dateFilter, limit, sort);
1905      }
1906
1907
1908}