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