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