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