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