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