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