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