001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import org.hl7.fhir.dstu3.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 @Block() 052 public static class DataRequirementCodeFilterComponent extends Element implements IBaseDatatypeElement { 053 /** 054 * The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept. 055 */ 056 @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 057 @Description(shortDefinition="The code-valued attribute of the filter", formalDefinition="The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." ) 058 protected StringType path; 059 060 /** 061 * The valueset for the code filter. The valueSet and value elements are exclusive. 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. 062 */ 063 @Child(name = "valueSet", type = {StringType.class, ValueSet.class}, order=2, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="Valueset for the filter", formalDefinition="The valueset for the code filter. The valueSet and value elements are exclusive. 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." ) 065 protected Type valueSet; 066 067 /** 068 * The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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. 069 */ 070 @Child(name = "valueCode", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 071 @Description(shortDefinition="What code is expected", formalDefinition="The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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." ) 072 protected List<CodeType> valueCode; 073 074 /** 075 * The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 Codings. 076 */ 077 @Child(name = "valueCoding", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 078 @Description(shortDefinition="What Coding is expected", formalDefinition="The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 Codings." ) 079 protected List<Coding> valueCoding; 080 081 /** 082 * The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 CodeableConcepts. 083 */ 084 @Child(name = "valueCodeableConcept", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 085 @Description(shortDefinition="What CodeableConcept is expected", formalDefinition="The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 CodeableConcepts." ) 086 protected List<CodeableConcept> valueCodeableConcept; 087 088 private static final long serialVersionUID = -888422840L; 089 090 /** 091 * Constructor 092 */ 093 public DataRequirementCodeFilterComponent() { 094 super(); 095 } 096 097 /** 098 * Constructor 099 */ 100 public DataRequirementCodeFilterComponent(StringType path) { 101 super(); 102 this.path = path; 103 } 104 105 /** 106 * @return {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 107 */ 108 public StringType getPathElement() { 109 if (this.path == null) 110 if (Configuration.errorOnAutoCreate()) 111 throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.path"); 112 else if (Configuration.doAutoCreate()) 113 this.path = new StringType(); // bb 114 return this.path; 115 } 116 117 public boolean hasPathElement() { 118 return this.path != null && !this.path.isEmpty(); 119 } 120 121 public boolean hasPath() { 122 return this.path != null && !this.path.isEmpty(); 123 } 124 125 /** 126 * @param value {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 127 */ 128 public DataRequirementCodeFilterComponent setPathElement(StringType value) { 129 this.path = value; 130 return this; 131 } 132 133 /** 134 * @return The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept. 135 */ 136 public String getPath() { 137 return this.path == null ? null : this.path.getValue(); 138 } 139 140 /** 141 * @param value The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept. 142 */ 143 public DataRequirementCodeFilterComponent setPath(String value) { 144 if (this.path == null) 145 this.path = new StringType(); 146 this.path.setValue(value); 147 return this; 148 } 149 150 /** 151 * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. 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.) 152 */ 153 public Type getValueSet() { 154 return this.valueSet; 155 } 156 157 /** 158 * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. 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.) 159 */ 160 public StringType getValueSetStringType() throws FHIRException { 161 if (!(this.valueSet instanceof StringType)) 162 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.valueSet.getClass().getName()+" was encountered"); 163 return (StringType) this.valueSet; 164 } 165 166 public boolean hasValueSetStringType() { 167 return this.valueSet instanceof StringType; 168 } 169 170 /** 171 * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. 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.) 172 */ 173 public Reference getValueSetReference() throws FHIRException { 174 if (!(this.valueSet instanceof Reference)) 175 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered"); 176 return (Reference) this.valueSet; 177 } 178 179 public boolean hasValueSetReference() { 180 return this.valueSet instanceof Reference; 181 } 182 183 public boolean hasValueSet() { 184 return this.valueSet != null && !this.valueSet.isEmpty(); 185 } 186 187 /** 188 * @param value {@link #valueSet} (The valueset for the code filter. The valueSet and value elements are exclusive. 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.) 189 */ 190 public DataRequirementCodeFilterComponent setValueSet(Type value) { 191 this.valueSet = value; 192 return this; 193 } 194 195 /** 196 * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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.) 197 */ 198 public List<CodeType> getValueCode() { 199 if (this.valueCode == null) 200 this.valueCode = new ArrayList<CodeType>(); 201 return this.valueCode; 202 } 203 204 /** 205 * @return Returns a reference to <code>this</code> for easy method chaining 206 */ 207 public DataRequirementCodeFilterComponent setValueCode(List<CodeType> theValueCode) { 208 this.valueCode = theValueCode; 209 return this; 210 } 211 212 public boolean hasValueCode() { 213 if (this.valueCode == null) 214 return false; 215 for (CodeType item : this.valueCode) 216 if (!item.isEmpty()) 217 return true; 218 return false; 219 } 220 221 /** 222 * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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.) 223 */ 224 public CodeType addValueCodeElement() {//2 225 CodeType t = new CodeType(); 226 if (this.valueCode == null) 227 this.valueCode = new ArrayList<CodeType>(); 228 this.valueCode.add(t); 229 return t; 230 } 231 232 /** 233 * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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.) 234 */ 235 public DataRequirementCodeFilterComponent addValueCode(String value) { //1 236 CodeType t = new CodeType(); 237 t.setValue(value); 238 if (this.valueCode == null) 239 this.valueCode = new ArrayList<CodeType>(); 240 this.valueCode.add(t); 241 return this; 242 } 243 244 /** 245 * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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.) 246 */ 247 public boolean hasValueCode(String value) { 248 if (this.valueCode == null) 249 return false; 250 for (CodeType v : this.valueCode) 251 if (v.equals(value)) // code 252 return true; 253 return false; 254 } 255 256 /** 257 * @return {@link #valueCoding} (The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 Codings.) 258 */ 259 public List<Coding> getValueCoding() { 260 if (this.valueCoding == null) 261 this.valueCoding = new ArrayList<Coding>(); 262 return this.valueCoding; 263 } 264 265 /** 266 * @return Returns a reference to <code>this</code> for easy method chaining 267 */ 268 public DataRequirementCodeFilterComponent setValueCoding(List<Coding> theValueCoding) { 269 this.valueCoding = theValueCoding; 270 return this; 271 } 272 273 public boolean hasValueCoding() { 274 if (this.valueCoding == null) 275 return false; 276 for (Coding item : this.valueCoding) 277 if (!item.isEmpty()) 278 return true; 279 return false; 280 } 281 282 public Coding addValueCoding() { //3 283 Coding t = new Coding(); 284 if (this.valueCoding == null) 285 this.valueCoding = new ArrayList<Coding>(); 286 this.valueCoding.add(t); 287 return t; 288 } 289 290 public DataRequirementCodeFilterComponent addValueCoding(Coding t) { //3 291 if (t == null) 292 return this; 293 if (this.valueCoding == null) 294 this.valueCoding = new ArrayList<Coding>(); 295 this.valueCoding.add(t); 296 return this; 297 } 298 299 /** 300 * @return The first repetition of repeating field {@link #valueCoding}, creating it if it does not already exist 301 */ 302 public Coding getValueCodingFirstRep() { 303 if (getValueCoding().isEmpty()) { 304 addValueCoding(); 305 } 306 return getValueCoding().get(0); 307 } 308 309 /** 310 * @return {@link #valueCodeableConcept} (The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 CodeableConcepts.) 311 */ 312 public List<CodeableConcept> getValueCodeableConcept() { 313 if (this.valueCodeableConcept == null) 314 this.valueCodeableConcept = new ArrayList<CodeableConcept>(); 315 return this.valueCodeableConcept; 316 } 317 318 /** 319 * @return Returns a reference to <code>this</code> for easy method chaining 320 */ 321 public DataRequirementCodeFilterComponent setValueCodeableConcept(List<CodeableConcept> theValueCodeableConcept) { 322 this.valueCodeableConcept = theValueCodeableConcept; 323 return this; 324 } 325 326 public boolean hasValueCodeableConcept() { 327 if (this.valueCodeableConcept == null) 328 return false; 329 for (CodeableConcept item : this.valueCodeableConcept) 330 if (!item.isEmpty()) 331 return true; 332 return false; 333 } 334 335 public CodeableConcept addValueCodeableConcept() { //3 336 CodeableConcept t = new CodeableConcept(); 337 if (this.valueCodeableConcept == null) 338 this.valueCodeableConcept = new ArrayList<CodeableConcept>(); 339 this.valueCodeableConcept.add(t); 340 return t; 341 } 342 343 public DataRequirementCodeFilterComponent addValueCodeableConcept(CodeableConcept t) { //3 344 if (t == null) 345 return this; 346 if (this.valueCodeableConcept == null) 347 this.valueCodeableConcept = new ArrayList<CodeableConcept>(); 348 this.valueCodeableConcept.add(t); 349 return this; 350 } 351 352 /** 353 * @return The first repetition of repeating field {@link #valueCodeableConcept}, creating it if it does not already exist 354 */ 355 public CodeableConcept getValueCodeableConceptFirstRep() { 356 if (getValueCodeableConcept().isEmpty()) { 357 addValueCodeableConcept(); 358 } 359 return getValueCodeableConcept().get(0); 360 } 361 362 protected void listChildren(List<Property> childrenList) { 363 super.listChildren(childrenList); 364 childrenList.add(new Property("path", "string", "The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, java.lang.Integer.MAX_VALUE, path)); 365 childrenList.add(new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value elements are exclusive. 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, java.lang.Integer.MAX_VALUE, valueSet)); 366 childrenList.add(new Property("valueCode", "code", "The codes for the code filter. Only one of valueSet, valueCode, valueCoding, or valueCodeableConcept may be specified. 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.", 0, java.lang.Integer.MAX_VALUE, valueCode)); 367 childrenList.add(new Property("valueCoding", "Coding", "The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 Codings.", 0, java.lang.Integer.MAX_VALUE, valueCoding)); 368 childrenList.add(new Property("valueCodeableConcept", "CodeableConcept", "The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. 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 CodeableConcepts.", 0, java.lang.Integer.MAX_VALUE, valueCodeableConcept)); 369 } 370 371 @Override 372 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 373 switch (hash) { 374 case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType 375 case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type 376 case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // CodeType 377 case -1887705029: /*valueCoding*/ return this.valueCoding == null ? new Base[0] : this.valueCoding.toArray(new Base[this.valueCoding.size()]); // Coding 378 case 924902896: /*valueCodeableConcept*/ return this.valueCodeableConcept == null ? new Base[0] : this.valueCodeableConcept.toArray(new Base[this.valueCodeableConcept.size()]); // CodeableConcept 379 default: return super.getProperty(hash, name, checkValid); 380 } 381 382 } 383 384 @Override 385 public Base setProperty(int hash, String name, Base value) throws FHIRException { 386 switch (hash) { 387 case 3433509: // path 388 this.path = castToString(value); // StringType 389 return value; 390 case -1410174671: // valueSet 391 this.valueSet = castToType(value); // Type 392 return value; 393 case -766209282: // valueCode 394 this.getValueCode().add(castToCode(value)); // CodeType 395 return value; 396 case -1887705029: // valueCoding 397 this.getValueCoding().add(castToCoding(value)); // Coding 398 return value; 399 case 924902896: // valueCodeableConcept 400 this.getValueCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept 401 return value; 402 default: return super.setProperty(hash, name, value); 403 } 404 405 } 406 407 @Override 408 public Base setProperty(String name, Base value) throws FHIRException { 409 if (name.equals("path")) { 410 this.path = castToString(value); // StringType 411 } else if (name.equals("valueSet[x]")) { 412 this.valueSet = castToType(value); // Type 413 } else if (name.equals("valueCode")) { 414 this.getValueCode().add(castToCode(value)); 415 } else if (name.equals("valueCoding")) { 416 this.getValueCoding().add(castToCoding(value)); 417 } else if (name.equals("valueCodeableConcept")) { 418 this.getValueCodeableConcept().add(castToCodeableConcept(value)); 419 } else 420 return super.setProperty(name, value); 421 return value; 422 } 423 424 @Override 425 public Base makeProperty(int hash, String name) throws FHIRException { 426 switch (hash) { 427 case 3433509: return getPathElement(); 428 case -1438410321: return getValueSet(); 429 case -1410174671: return getValueSet(); 430 case -766209282: return addValueCodeElement(); 431 case -1887705029: return addValueCoding(); 432 case 924902896: return addValueCodeableConcept(); 433 default: return super.makeProperty(hash, name); 434 } 435 436 } 437 438 @Override 439 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 440 switch (hash) { 441 case 3433509: /*path*/ return new String[] {"string"}; 442 case -1410174671: /*valueSet*/ return new String[] {"string", "Reference"}; 443 case -766209282: /*valueCode*/ return new String[] {"code"}; 444 case -1887705029: /*valueCoding*/ return new String[] {"Coding"}; 445 case 924902896: /*valueCodeableConcept*/ return new String[] {"CodeableConcept"}; 446 default: return super.getTypesForProperty(hash, name); 447 } 448 449 } 450 451 @Override 452 public Base addChild(String name) throws FHIRException { 453 if (name.equals("path")) { 454 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path"); 455 } 456 else if (name.equals("valueSetString")) { 457 this.valueSet = new StringType(); 458 return this.valueSet; 459 } 460 else if (name.equals("valueSetReference")) { 461 this.valueSet = new Reference(); 462 return this.valueSet; 463 } 464 else if (name.equals("valueCode")) { 465 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.valueCode"); 466 } 467 else if (name.equals("valueCoding")) { 468 return addValueCoding(); 469 } 470 else if (name.equals("valueCodeableConcept")) { 471 return addValueCodeableConcept(); 472 } 473 else 474 return super.addChild(name); 475 } 476 477 public DataRequirementCodeFilterComponent copy() { 478 DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent(); 479 copyValues(dst); 480 dst.path = path == null ? null : path.copy(); 481 dst.valueSet = valueSet == null ? null : valueSet.copy(); 482 if (valueCode != null) { 483 dst.valueCode = new ArrayList<CodeType>(); 484 for (CodeType i : valueCode) 485 dst.valueCode.add(i.copy()); 486 }; 487 if (valueCoding != null) { 488 dst.valueCoding = new ArrayList<Coding>(); 489 for (Coding i : valueCoding) 490 dst.valueCoding.add(i.copy()); 491 }; 492 if (valueCodeableConcept != null) { 493 dst.valueCodeableConcept = new ArrayList<CodeableConcept>(); 494 for (CodeableConcept i : valueCodeableConcept) 495 dst.valueCodeableConcept.add(i.copy()); 496 }; 497 return dst; 498 } 499 500 @Override 501 public boolean equalsDeep(Base other) { 502 if (!super.equalsDeep(other)) 503 return false; 504 if (!(other instanceof DataRequirementCodeFilterComponent)) 505 return false; 506 DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other; 507 return compareDeep(path, o.path, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(valueCode, o.valueCode, true) 508 && compareDeep(valueCoding, o.valueCoding, true) && compareDeep(valueCodeableConcept, o.valueCodeableConcept, true) 509 ; 510 } 511 512 @Override 513 public boolean equalsShallow(Base other) { 514 if (!super.equalsShallow(other)) 515 return false; 516 if (!(other instanceof DataRequirementCodeFilterComponent)) 517 return false; 518 DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other; 519 return compareValues(path, o.path, true) && compareValues(valueCode, o.valueCode, true); 520 } 521 522 public boolean isEmpty() { 523 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, valueSet, valueCode 524 , valueCoding, valueCodeableConcept); 525 } 526 527 public String fhirType() { 528 return "DataRequirement.codeFilter"; 529 530 } 531 532 } 533 534 @Block() 535 public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement { 536 /** 537 * The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing. 538 */ 539 @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 540 @Description(shortDefinition="The date-valued attribute of the filter", formalDefinition="The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing." ) 541 protected StringType path; 542 543 /** 544 * 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 from now. 545 */ 546 @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=2, min=0, max=1, modifier=false, summary=true) 547 @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 from now." ) 548 protected Type value; 549 550 private static final long serialVersionUID = 1791957163L; 551 552 /** 553 * Constructor 554 */ 555 public DataRequirementDateFilterComponent() { 556 super(); 557 } 558 559 /** 560 * Constructor 561 */ 562 public DataRequirementDateFilterComponent(StringType path) { 563 super(); 564 this.path = path; 565 } 566 567 /** 568 * @return {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 569 */ 570 public StringType getPathElement() { 571 if (this.path == null) 572 if (Configuration.errorOnAutoCreate()) 573 throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path"); 574 else if (Configuration.doAutoCreate()) 575 this.path = new StringType(); // bb 576 return this.path; 577 } 578 579 public boolean hasPathElement() { 580 return this.path != null && !this.path.isEmpty(); 581 } 582 583 public boolean hasPath() { 584 return this.path != null && !this.path.isEmpty(); 585 } 586 587 /** 588 * @param value {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 589 */ 590 public DataRequirementDateFilterComponent setPathElement(StringType value) { 591 this.path = value; 592 return this; 593 } 594 595 /** 596 * @return The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing. 597 */ 598 public String getPath() { 599 return this.path == null ? null : this.path.getValue(); 600 } 601 602 /** 603 * @param value The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing. 604 */ 605 public DataRequirementDateFilterComponent setPath(String value) { 606 if (this.path == null) 607 this.path = new StringType(); 608 this.path.setValue(value); 609 return this; 610 } 611 612 /** 613 * @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 from now.) 614 */ 615 public Type getValue() { 616 return this.value; 617 } 618 619 /** 620 * @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 from now.) 621 */ 622 public DateTimeType getValueDateTimeType() throws FHIRException { 623 if (!(this.value instanceof DateTimeType)) 624 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered"); 625 return (DateTimeType) this.value; 626 } 627 628 public boolean hasValueDateTimeType() { 629 return this.value instanceof DateTimeType; 630 } 631 632 /** 633 * @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 from now.) 634 */ 635 public Period getValuePeriod() throws FHIRException { 636 if (!(this.value instanceof Period)) 637 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered"); 638 return (Period) this.value; 639 } 640 641 public boolean hasValuePeriod() { 642 return this.value instanceof Period; 643 } 644 645 /** 646 * @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 from now.) 647 */ 648 public Duration getValueDuration() throws FHIRException { 649 if (!(this.value instanceof Duration)) 650 throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered"); 651 return (Duration) this.value; 652 } 653 654 public boolean hasValueDuration() { 655 return this.value instanceof Duration; 656 } 657 658 public boolean hasValue() { 659 return this.value != null && !this.value.isEmpty(); 660 } 661 662 /** 663 * @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 from now.) 664 */ 665 public DataRequirementDateFilterComponent setValue(Type value) { 666 this.value = value; 667 return this; 668 } 669 670 protected void listChildren(List<Property> childrenList) { 671 super.listChildren(childrenList); 672 childrenList.add(new Property("path", "string", "The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.", 0, java.lang.Integer.MAX_VALUE, path)); 673 childrenList.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 from now.", 0, java.lang.Integer.MAX_VALUE, value)); 674 } 675 676 @Override 677 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 678 switch (hash) { 679 case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType 680 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type 681 default: return super.getProperty(hash, name, checkValid); 682 } 683 684 } 685 686 @Override 687 public Base setProperty(int hash, String name, Base value) throws FHIRException { 688 switch (hash) { 689 case 3433509: // path 690 this.path = castToString(value); // StringType 691 return value; 692 case 111972721: // value 693 this.value = castToType(value); // Type 694 return value; 695 default: return super.setProperty(hash, name, value); 696 } 697 698 } 699 700 @Override 701 public Base setProperty(String name, Base value) throws FHIRException { 702 if (name.equals("path")) { 703 this.path = castToString(value); // StringType 704 } else if (name.equals("value[x]")) { 705 this.value = castToType(value); // Type 706 } else 707 return super.setProperty(name, value); 708 return value; 709 } 710 711 @Override 712 public Base makeProperty(int hash, String name) throws FHIRException { 713 switch (hash) { 714 case 3433509: return getPathElement(); 715 case -1410166417: return getValue(); 716 case 111972721: return getValue(); 717 default: return super.makeProperty(hash, name); 718 } 719 720 } 721 722 @Override 723 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 724 switch (hash) { 725 case 3433509: /*path*/ return new String[] {"string"}; 726 case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"}; 727 default: return super.getTypesForProperty(hash, name); 728 } 729 730 } 731 732 @Override 733 public Base addChild(String name) throws FHIRException { 734 if (name.equals("path")) { 735 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path"); 736 } 737 else if (name.equals("valueDateTime")) { 738 this.value = new DateTimeType(); 739 return this.value; 740 } 741 else if (name.equals("valuePeriod")) { 742 this.value = new Period(); 743 return this.value; 744 } 745 else if (name.equals("valueDuration")) { 746 this.value = new Duration(); 747 return this.value; 748 } 749 else 750 return super.addChild(name); 751 } 752 753 public DataRequirementDateFilterComponent copy() { 754 DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent(); 755 copyValues(dst); 756 dst.path = path == null ? null : path.copy(); 757 dst.value = value == null ? null : value.copy(); 758 return dst; 759 } 760 761 @Override 762 public boolean equalsDeep(Base other) { 763 if (!super.equalsDeep(other)) 764 return false; 765 if (!(other instanceof DataRequirementDateFilterComponent)) 766 return false; 767 DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other; 768 return compareDeep(path, o.path, true) && compareDeep(value, o.value, true); 769 } 770 771 @Override 772 public boolean equalsShallow(Base other) { 773 if (!super.equalsShallow(other)) 774 return false; 775 if (!(other instanceof DataRequirementDateFilterComponent)) 776 return false; 777 DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other; 778 return compareValues(path, o.path, true); 779 } 780 781 public boolean isEmpty() { 782 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, value); 783 } 784 785 public String fhirType() { 786 return "DataRequirement.dateFilter"; 787 788 } 789 790 } 791 792 /** 793 * 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. 794 */ 795 @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true) 796 @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." ) 797 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types") 798 protected CodeType type; 799 800 /** 801 * The profile of the required data, specified as the uri of the profile definition. 802 */ 803 @Child(name = "profile", type = {UriType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 804 @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." ) 805 protected List<UriType> profile; 806 807 /** 808 * Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported. 809 */ 810 @Child(name = "mustSupport", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 811 @Description(shortDefinition="Indicates that specific structure elements are referenced by the knowledge module", formalDefinition="Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported." ) 812 protected List<StringType> mustSupport; 813 814 /** 815 * Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. 816 */ 817 @Child(name = "codeFilter", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 818 @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." ) 819 protected List<DataRequirementCodeFilterComponent> codeFilter; 820 821 /** 822 * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. 823 */ 824 @Child(name = "dateFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 825 @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." ) 826 protected List<DataRequirementDateFilterComponent> dateFilter; 827 828 private static final long serialVersionUID = 274786645L; 829 830 /** 831 * Constructor 832 */ 833 public DataRequirement() { 834 super(); 835 } 836 837 /** 838 * Constructor 839 */ 840 public DataRequirement(CodeType type) { 841 super(); 842 this.type = type; 843 } 844 845 /** 846 * @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 847 */ 848 public CodeType getTypeElement() { 849 if (this.type == null) 850 if (Configuration.errorOnAutoCreate()) 851 throw new Error("Attempt to auto-create DataRequirement.type"); 852 else if (Configuration.doAutoCreate()) 853 this.type = new CodeType(); // bb 854 return this.type; 855 } 856 857 public boolean hasTypeElement() { 858 return this.type != null && !this.type.isEmpty(); 859 } 860 861 public boolean hasType() { 862 return this.type != null && !this.type.isEmpty(); 863 } 864 865 /** 866 * @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 867 */ 868 public DataRequirement setTypeElement(CodeType value) { 869 this.type = value; 870 return this; 871 } 872 873 /** 874 * @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. 875 */ 876 public String getType() { 877 return this.type == null ? null : this.type.getValue(); 878 } 879 880 /** 881 * @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. 882 */ 883 public DataRequirement setType(String value) { 884 if (this.type == null) 885 this.type = new CodeType(); 886 this.type.setValue(value); 887 return this; 888 } 889 890 /** 891 * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.) 892 */ 893 public List<UriType> getProfile() { 894 if (this.profile == null) 895 this.profile = new ArrayList<UriType>(); 896 return this.profile; 897 } 898 899 /** 900 * @return Returns a reference to <code>this</code> for easy method chaining 901 */ 902 public DataRequirement setProfile(List<UriType> theProfile) { 903 this.profile = theProfile; 904 return this; 905 } 906 907 public boolean hasProfile() { 908 if (this.profile == null) 909 return false; 910 for (UriType item : this.profile) 911 if (!item.isEmpty()) 912 return true; 913 return false; 914 } 915 916 /** 917 * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.) 918 */ 919 public UriType addProfileElement() {//2 920 UriType t = new UriType(); 921 if (this.profile == null) 922 this.profile = new ArrayList<UriType>(); 923 this.profile.add(t); 924 return t; 925 } 926 927 /** 928 * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.) 929 */ 930 public DataRequirement addProfile(String value) { //1 931 UriType t = new UriType(); 932 t.setValue(value); 933 if (this.profile == null) 934 this.profile = new ArrayList<UriType>(); 935 this.profile.add(t); 936 return this; 937 } 938 939 /** 940 * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.) 941 */ 942 public boolean hasProfile(String value) { 943 if (this.profile == null) 944 return false; 945 for (UriType v : this.profile) 946 if (v.equals(value)) // uri 947 return true; 948 return false; 949 } 950 951 /** 952 * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.) 953 */ 954 public List<StringType> getMustSupport() { 955 if (this.mustSupport == null) 956 this.mustSupport = new ArrayList<StringType>(); 957 return this.mustSupport; 958 } 959 960 /** 961 * @return Returns a reference to <code>this</code> for easy method chaining 962 */ 963 public DataRequirement setMustSupport(List<StringType> theMustSupport) { 964 this.mustSupport = theMustSupport; 965 return this; 966 } 967 968 public boolean hasMustSupport() { 969 if (this.mustSupport == null) 970 return false; 971 for (StringType item : this.mustSupport) 972 if (!item.isEmpty()) 973 return true; 974 return false; 975 } 976 977 /** 978 * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.) 979 */ 980 public StringType addMustSupportElement() {//2 981 StringType t = new StringType(); 982 if (this.mustSupport == null) 983 this.mustSupport = new ArrayList<StringType>(); 984 this.mustSupport.add(t); 985 return t; 986 } 987 988 /** 989 * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.) 990 */ 991 public DataRequirement addMustSupport(String value) { //1 992 StringType t = new StringType(); 993 t.setValue(value); 994 if (this.mustSupport == null) 995 this.mustSupport = new ArrayList<StringType>(); 996 this.mustSupport.add(t); 997 return this; 998 } 999 1000 /** 1001 * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.) 1002 */ 1003 public boolean hasMustSupport(String value) { 1004 if (this.mustSupport == null) 1005 return false; 1006 for (StringType v : this.mustSupport) 1007 if (v.equals(value)) // string 1008 return true; 1009 return false; 1010 } 1011 1012 /** 1013 * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.) 1014 */ 1015 public List<DataRequirementCodeFilterComponent> getCodeFilter() { 1016 if (this.codeFilter == null) 1017 this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>(); 1018 return this.codeFilter; 1019 } 1020 1021 /** 1022 * @return Returns a reference to <code>this</code> for easy method chaining 1023 */ 1024 public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 1025 this.codeFilter = theCodeFilter; 1026 return this; 1027 } 1028 1029 public boolean hasCodeFilter() { 1030 if (this.codeFilter == null) 1031 return false; 1032 for (DataRequirementCodeFilterComponent item : this.codeFilter) 1033 if (!item.isEmpty()) 1034 return true; 1035 return false; 1036 } 1037 1038 public DataRequirementCodeFilterComponent addCodeFilter() { //3 1039 DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent(); 1040 if (this.codeFilter == null) 1041 this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>(); 1042 this.codeFilter.add(t); 1043 return t; 1044 } 1045 1046 public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3 1047 if (t == null) 1048 return this; 1049 if (this.codeFilter == null) 1050 this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>(); 1051 this.codeFilter.add(t); 1052 return this; 1053 } 1054 1055 /** 1056 * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist 1057 */ 1058 public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 1059 if (getCodeFilter().isEmpty()) { 1060 addCodeFilter(); 1061 } 1062 return getCodeFilter().get(0); 1063 } 1064 1065 /** 1066 * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.) 1067 */ 1068 public List<DataRequirementDateFilterComponent> getDateFilter() { 1069 if (this.dateFilter == null) 1070 this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>(); 1071 return this.dateFilter; 1072 } 1073 1074 /** 1075 * @return Returns a reference to <code>this</code> for easy method chaining 1076 */ 1077 public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 1078 this.dateFilter = theDateFilter; 1079 return this; 1080 } 1081 1082 public boolean hasDateFilter() { 1083 if (this.dateFilter == null) 1084 return false; 1085 for (DataRequirementDateFilterComponent item : this.dateFilter) 1086 if (!item.isEmpty()) 1087 return true; 1088 return false; 1089 } 1090 1091 public DataRequirementDateFilterComponent addDateFilter() { //3 1092 DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent(); 1093 if (this.dateFilter == null) 1094 this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>(); 1095 this.dateFilter.add(t); 1096 return t; 1097 } 1098 1099 public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3 1100 if (t == null) 1101 return this; 1102 if (this.dateFilter == null) 1103 this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>(); 1104 this.dateFilter.add(t); 1105 return this; 1106 } 1107 1108 /** 1109 * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist 1110 */ 1111 public DataRequirementDateFilterComponent getDateFilterFirstRep() { 1112 if (getDateFilter().isEmpty()) { 1113 addDateFilter(); 1114 } 1115 return getDateFilter().get(0); 1116 } 1117 1118 protected void listChildren(List<Property> childrenList) { 1119 super.listChildren(childrenList); 1120 childrenList.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, java.lang.Integer.MAX_VALUE, type)); 1121 childrenList.add(new Property("profile", "uri", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile)); 1122 childrenList.add(new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport)); 1123 childrenList.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.", 0, java.lang.Integer.MAX_VALUE, codeFilter)); 1124 childrenList.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.", 0, java.lang.Integer.MAX_VALUE, dateFilter)); 1125 } 1126 1127 @Override 1128 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1129 switch (hash) { 1130 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType 1131 case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // UriType 1132 case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType 1133 case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent 1134 case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent 1135 default: return super.getProperty(hash, name, checkValid); 1136 } 1137 1138 } 1139 1140 @Override 1141 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1142 switch (hash) { 1143 case 3575610: // type 1144 this.type = castToCode(value); // CodeType 1145 return value; 1146 case -309425751: // profile 1147 this.getProfile().add(castToUri(value)); // UriType 1148 return value; 1149 case -1402857082: // mustSupport 1150 this.getMustSupport().add(castToString(value)); // StringType 1151 return value; 1152 case -1303674939: // codeFilter 1153 this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent 1154 return value; 1155 case 149531846: // dateFilter 1156 this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent 1157 return value; 1158 default: return super.setProperty(hash, name, value); 1159 } 1160 1161 } 1162 1163 @Override 1164 public Base setProperty(String name, Base value) throws FHIRException { 1165 if (name.equals("type")) { 1166 this.type = castToCode(value); // CodeType 1167 } else if (name.equals("profile")) { 1168 this.getProfile().add(castToUri(value)); 1169 } else if (name.equals("mustSupport")) { 1170 this.getMustSupport().add(castToString(value)); 1171 } else if (name.equals("codeFilter")) { 1172 this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); 1173 } else if (name.equals("dateFilter")) { 1174 this.getDateFilter().add((DataRequirementDateFilterComponent) value); 1175 } else 1176 return super.setProperty(name, value); 1177 return value; 1178 } 1179 1180 @Override 1181 public Base makeProperty(int hash, String name) throws FHIRException { 1182 switch (hash) { 1183 case 3575610: return getTypeElement(); 1184 case -309425751: return addProfileElement(); 1185 case -1402857082: return addMustSupportElement(); 1186 case -1303674939: return addCodeFilter(); 1187 case 149531846: return addDateFilter(); 1188 default: return super.makeProperty(hash, name); 1189 } 1190 1191 } 1192 1193 @Override 1194 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1195 switch (hash) { 1196 case 3575610: /*type*/ return new String[] {"code"}; 1197 case -309425751: /*profile*/ return new String[] {"uri"}; 1198 case -1402857082: /*mustSupport*/ return new String[] {"string"}; 1199 case -1303674939: /*codeFilter*/ return new String[] {}; 1200 case 149531846: /*dateFilter*/ return new String[] {}; 1201 default: return super.getTypesForProperty(hash, name); 1202 } 1203 1204 } 1205 1206 @Override 1207 public Base addChild(String name) throws FHIRException { 1208 if (name.equals("type")) { 1209 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.type"); 1210 } 1211 else if (name.equals("profile")) { 1212 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.profile"); 1213 } 1214 else if (name.equals("mustSupport")) { 1215 throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.mustSupport"); 1216 } 1217 else if (name.equals("codeFilter")) { 1218 return addCodeFilter(); 1219 } 1220 else if (name.equals("dateFilter")) { 1221 return addDateFilter(); 1222 } 1223 else 1224 return super.addChild(name); 1225 } 1226 1227 public String fhirType() { 1228 return "DataRequirement"; 1229 1230 } 1231 1232 public DataRequirement copy() { 1233 DataRequirement dst = new DataRequirement(); 1234 copyValues(dst); 1235 dst.type = type == null ? null : type.copy(); 1236 if (profile != null) { 1237 dst.profile = new ArrayList<UriType>(); 1238 for (UriType i : profile) 1239 dst.profile.add(i.copy()); 1240 }; 1241 if (mustSupport != null) { 1242 dst.mustSupport = new ArrayList<StringType>(); 1243 for (StringType i : mustSupport) 1244 dst.mustSupport.add(i.copy()); 1245 }; 1246 if (codeFilter != null) { 1247 dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>(); 1248 for (DataRequirementCodeFilterComponent i : codeFilter) 1249 dst.codeFilter.add(i.copy()); 1250 }; 1251 if (dateFilter != null) { 1252 dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>(); 1253 for (DataRequirementDateFilterComponent i : dateFilter) 1254 dst.dateFilter.add(i.copy()); 1255 }; 1256 return dst; 1257 } 1258 1259 protected DataRequirement typedCopy() { 1260 return copy(); 1261 } 1262 1263 @Override 1264 public boolean equalsDeep(Base other) { 1265 if (!super.equalsDeep(other)) 1266 return false; 1267 if (!(other instanceof DataRequirement)) 1268 return false; 1269 DataRequirement o = (DataRequirement) other; 1270 return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(mustSupport, o.mustSupport, true) 1271 && compareDeep(codeFilter, o.codeFilter, true) && compareDeep(dateFilter, o.dateFilter, true); 1272 } 1273 1274 @Override 1275 public boolean equalsShallow(Base other) { 1276 if (!super.equalsShallow(other)) 1277 return false; 1278 if (!(other instanceof DataRequirement)) 1279 return false; 1280 DataRequirement o = (DataRequirement) other; 1281 return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true) 1282 ; 1283 } 1284 1285 public boolean isEmpty() { 1286 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, mustSupport 1287 , codeFilter, dateFilter); 1288 } 1289 1290 1291} 1292