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 ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * This special resource type is used to represent an operation request and response (operations.html). It has no other use, and there is no RESTful endpoint associated with it. 047 */ 048@ResourceDef(name="Parameters", profile="http://hl7.org/fhir/Profile/Parameters") 049public class Parameters extends Resource implements IBaseParameters { 050 051 @Block() 052 public static class ParametersParameterComponent extends BackboneElement implements IBaseBackboneElement { 053 /** 054 * The name of the parameter (reference to the operation definition). 055 */ 056 @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 057 @Description(shortDefinition="Name from the definition", formalDefinition="The name of the parameter (reference to the operation definition)." ) 058 protected StringType name; 059 060 /** 061 * If the parameter is a data type. 062 */ 063 @Child(name = "value", type = {}, order=2, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="If parameter is a data type", formalDefinition="If the parameter is a data type." ) 065 protected org.hl7.fhir.dstu3.model.Type value; 066 067 /** 068 * If the parameter is a whole resource. 069 */ 070 @Child(name = "resource", type = {Resource.class}, order=3, min=0, max=1, modifier=false, summary=true) 071 @Description(shortDefinition="If parameter is a whole resource", formalDefinition="If the parameter is a whole resource." ) 072 protected Resource resource; 073 074 /** 075 * A named part of a multi-part parameter. 076 */ 077 @Child(name = "part", type = {ParametersParameterComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 078 @Description(shortDefinition="Named part of a multi-part parameter", formalDefinition="A named part of a multi-part parameter." ) 079 protected List<ParametersParameterComponent> part; 080 081 private static final long serialVersionUID = -839605058L; 082 083 /** 084 * Constructor 085 */ 086 public ParametersParameterComponent() { 087 super(); 088 } 089 090 /** 091 * Constructor 092 */ 093 public ParametersParameterComponent(StringType name) { 094 super(); 095 this.name = name; 096 } 097 098 /** 099 * @return {@link #name} (The name of the parameter (reference to the operation definition).). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 100 */ 101 public StringType getNameElement() { 102 if (this.name == null) 103 if (Configuration.errorOnAutoCreate()) 104 throw new Error("Attempt to auto-create ParametersParameterComponent.name"); 105 else if (Configuration.doAutoCreate()) 106 this.name = new StringType(); // bb 107 return this.name; 108 } 109 110 public boolean hasNameElement() { 111 return this.name != null && !this.name.isEmpty(); 112 } 113 114 public boolean hasName() { 115 return this.name != null && !this.name.isEmpty(); 116 } 117 118 /** 119 * @param value {@link #name} (The name of the parameter (reference to the operation definition).). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 120 */ 121 public ParametersParameterComponent setNameElement(StringType value) { 122 this.name = value; 123 return this; 124 } 125 126 /** 127 * @return The name of the parameter (reference to the operation definition). 128 */ 129 public String getName() { 130 return this.name == null ? null : this.name.getValue(); 131 } 132 133 /** 134 * @param value The name of the parameter (reference to the operation definition). 135 */ 136 public ParametersParameterComponent setName(String value) { 137 if (this.name == null) 138 this.name = new StringType(); 139 this.name.setValue(value); 140 return this; 141 } 142 143 /** 144 * @return {@link #value} (If the parameter is a data type.) 145 */ 146 public org.hl7.fhir.dstu3.model.Type getValue() { 147 return this.value; 148 } 149 150 public boolean hasValue() { 151 return this.value != null && !this.value.isEmpty(); 152 } 153 154 /** 155 * @param value {@link #value} (If the parameter is a data type.) 156 */ 157 public ParametersParameterComponent setValue(org.hl7.fhir.dstu3.model.Type value) { 158 this.value = value; 159 return this; 160 } 161 162 /** 163 * @return {@link #resource} (If the parameter is a whole resource.) 164 */ 165 public Resource getResource() { 166 return this.resource; 167 } 168 169 public boolean hasResource() { 170 return this.resource != null && !this.resource.isEmpty(); 171 } 172 173 /** 174 * @param value {@link #resource} (If the parameter is a whole resource.) 175 */ 176 public ParametersParameterComponent setResource(Resource value) { 177 this.resource = value; 178 return this; 179 } 180 181 /** 182 * @return {@link #part} (A named part of a multi-part parameter.) 183 */ 184 public List<ParametersParameterComponent> getPart() { 185 if (this.part == null) 186 this.part = new ArrayList<ParametersParameterComponent>(); 187 return this.part; 188 } 189 190 /** 191 * @return Returns a reference to <code>this</code> for easy method chaining 192 */ 193 public ParametersParameterComponent setPart(List<ParametersParameterComponent> thePart) { 194 this.part = thePart; 195 return this; 196 } 197 198 public boolean hasPart() { 199 if (this.part == null) 200 return false; 201 for (ParametersParameterComponent item : this.part) 202 if (!item.isEmpty()) 203 return true; 204 return false; 205 } 206 207 public ParametersParameterComponent addPart() { //3 208 ParametersParameterComponent t = new ParametersParameterComponent(); 209 if (this.part == null) 210 this.part = new ArrayList<ParametersParameterComponent>(); 211 this.part.add(t); 212 return t; 213 } 214 215 public ParametersParameterComponent addPart(ParametersParameterComponent t) { //3 216 if (t == null) 217 return this; 218 if (this.part == null) 219 this.part = new ArrayList<ParametersParameterComponent>(); 220 this.part.add(t); 221 return this; 222 } 223 224 /** 225 * @return The first repetition of repeating field {@link #part}, creating it if it does not already exist 226 */ 227 public ParametersParameterComponent getPartFirstRep() { 228 if (getPart().isEmpty()) { 229 addPart(); 230 } 231 return getPart().get(0); 232 } 233 234 protected void listChildren(List<Property> childrenList) { 235 super.listChildren(childrenList); 236 childrenList.add(new Property("name", "string", "The name of the parameter (reference to the operation definition).", 0, java.lang.Integer.MAX_VALUE, name)); 237 childrenList.add(new Property("value[x]", "*", "If the parameter is a data type.", 0, java.lang.Integer.MAX_VALUE, value)); 238 childrenList.add(new Property("resource", "Resource", "If the parameter is a whole resource.", 0, java.lang.Integer.MAX_VALUE, resource)); 239 childrenList.add(new Property("part", "@Parameters.parameter", "A named part of a multi-part parameter.", 0, java.lang.Integer.MAX_VALUE, part)); 240 } 241 242 @Override 243 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 244 switch (hash) { 245 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 246 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu3.model.Type 247 case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Resource 248 case 3433459: /*part*/ return this.part == null ? new Base[0] : this.part.toArray(new Base[this.part.size()]); // ParametersParameterComponent 249 default: return super.getProperty(hash, name, checkValid); 250 } 251 252 } 253 254 @Override 255 public Base setProperty(int hash, String name, Base value) throws FHIRException { 256 switch (hash) { 257 case 3373707: // name 258 this.name = castToString(value); // StringType 259 return value; 260 case 111972721: // value 261 this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type 262 return value; 263 case -341064690: // resource 264 this.resource = castToResource(value); // Resource 265 return value; 266 case 3433459: // part 267 this.getPart().add((ParametersParameterComponent) value); // ParametersParameterComponent 268 return value; 269 default: return super.setProperty(hash, name, value); 270 } 271 272 } 273 274 @Override 275 public Base setProperty(String name, Base value) throws FHIRException { 276 if (name.equals("name")) { 277 this.name = castToString(value); // StringType 278 } else if (name.equals("value[x]")) { 279 this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type 280 } else if (name.equals("resource")) { 281 this.resource = castToResource(value); // Resource 282 } else if (name.equals("part")) { 283 this.getPart().add((ParametersParameterComponent) value); 284 } else 285 return super.setProperty(name, value); 286 return value; 287 } 288 289 @Override 290 public Base makeProperty(int hash, String name) throws FHIRException { 291 switch (hash) { 292 case 3373707: return getNameElement(); 293 case -1410166417: return getValue(); 294 case 111972721: return getValue(); 295 case -341064690: throw new FHIRException("Cannot make property resource as it is not a complex type"); // Resource 296 case 3433459: return addPart(); 297 default: return super.makeProperty(hash, name); 298 } 299 300 } 301 302 @Override 303 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 304 switch (hash) { 305 case 3373707: /*name*/ return new String[] {"string"}; 306 case 111972721: /*value*/ return new String[] {"*"}; 307 case -341064690: /*resource*/ return new String[] {"Resource"}; 308 case 3433459: /*part*/ return new String[] {"@Parameters.parameter"}; 309 default: return super.getTypesForProperty(hash, name); 310 } 311 312 } 313 314 @Override 315 public Base addChild(String name) throws FHIRException { 316 if (name.equals("name")) { 317 throw new FHIRException("Cannot call addChild on a primitive type Parameters.name"); 318 } 319 else if (name.equals("valueBoolean")) { 320 this.value = new BooleanType(); 321 return this.value; 322 } 323 else if (name.equals("valueInteger")) { 324 this.value = new IntegerType(); 325 return this.value; 326 } 327 else if (name.equals("valueDecimal")) { 328 this.value = new DecimalType(); 329 return this.value; 330 } 331 else if (name.equals("valueBase64Binary")) { 332 this.value = new Base64BinaryType(); 333 return this.value; 334 } 335 else if (name.equals("valueInstant")) { 336 this.value = new InstantType(); 337 return this.value; 338 } 339 else if (name.equals("valueString")) { 340 this.value = new StringType(); 341 return this.value; 342 } 343 else if (name.equals("valueUri")) { 344 this.value = new UriType(); 345 return this.value; 346 } 347 else if (name.equals("valueDate")) { 348 this.value = new DateType(); 349 return this.value; 350 } 351 else if (name.equals("valueDateTime")) { 352 this.value = new DateTimeType(); 353 return this.value; 354 } 355 else if (name.equals("valueTime")) { 356 this.value = new TimeType(); 357 return this.value; 358 } 359 else if (name.equals("valueCode")) { 360 this.value = new CodeType(); 361 return this.value; 362 } 363 else if (name.equals("valueOid")) { 364 this.value = new OidType(); 365 return this.value; 366 } 367 else if (name.equals("valueId")) { 368 this.value = new IdType(); 369 return this.value; 370 } 371 else if (name.equals("valueUnsignedInt")) { 372 this.value = new UnsignedIntType(); 373 return this.value; 374 } 375 else if (name.equals("valuePositiveInt")) { 376 this.value = new PositiveIntType(); 377 return this.value; 378 } 379 else if (name.equals("valueMarkdown")) { 380 this.value = new MarkdownType(); 381 return this.value; 382 } 383 else if (name.equals("valueAnnotation")) { 384 this.value = new Annotation(); 385 return this.value; 386 } 387 else if (name.equals("valueAttachment")) { 388 this.value = new Attachment(); 389 return this.value; 390 } 391 else if (name.equals("valueIdentifier")) { 392 this.value = new Identifier(); 393 return this.value; 394 } 395 else if (name.equals("valueCodeableConcept")) { 396 this.value = new CodeableConcept(); 397 return this.value; 398 } 399 else if (name.equals("valueCoding")) { 400 this.value = new Coding(); 401 return this.value; 402 } 403 else if (name.equals("valueQuantity")) { 404 this.value = new Quantity(); 405 return this.value; 406 } 407 else if (name.equals("valueRange")) { 408 this.value = new Range(); 409 return this.value; 410 } 411 else if (name.equals("valuePeriod")) { 412 this.value = new Period(); 413 return this.value; 414 } 415 else if (name.equals("valueRatio")) { 416 this.value = new Ratio(); 417 return this.value; 418 } 419 else if (name.equals("valueSampledData")) { 420 this.value = new SampledData(); 421 return this.value; 422 } 423 else if (name.equals("valueSignature")) { 424 this.value = new Signature(); 425 return this.value; 426 } 427 else if (name.equals("valueHumanName")) { 428 this.value = new HumanName(); 429 return this.value; 430 } 431 else if (name.equals("valueAddress")) { 432 this.value = new Address(); 433 return this.value; 434 } 435 else if (name.equals("valueContactPoint")) { 436 this.value = new ContactPoint(); 437 return this.value; 438 } 439 else if (name.equals("valueTiming")) { 440 this.value = new Timing(); 441 return this.value; 442 } 443 else if (name.equals("valueReference")) { 444 this.value = new Reference(); 445 return this.value; 446 } 447 else if (name.equals("valueMeta")) { 448 this.value = new Meta(); 449 return this.value; 450 } 451 else if (name.equals("resource")) { 452 throw new FHIRException("Cannot call addChild on an abstract type Parameters.resource"); 453 } 454 else if (name.equals("part")) { 455 return addPart(); 456 } 457 else 458 return super.addChild(name); 459 } 460 461 public ParametersParameterComponent copy() { 462 ParametersParameterComponent dst = new ParametersParameterComponent(); 463 copyValues(dst); 464 dst.name = name == null ? null : name.copy(); 465 dst.value = value == null ? null : value.copy(); 466 dst.resource = resource == null ? null : resource.copy(); 467 if (part != null) { 468 dst.part = new ArrayList<ParametersParameterComponent>(); 469 for (ParametersParameterComponent i : part) 470 dst.part.add(i.copy()); 471 }; 472 return dst; 473 } 474 475 @Override 476 public boolean equalsDeep(Base other) { 477 if (!super.equalsDeep(other)) 478 return false; 479 if (!(other instanceof ParametersParameterComponent)) 480 return false; 481 ParametersParameterComponent o = (ParametersParameterComponent) other; 482 return compareDeep(name, o.name, true) && compareDeep(value, o.value, true) && compareDeep(resource, o.resource, true) 483 && compareDeep(part, o.part, true); 484 } 485 486 @Override 487 public boolean equalsShallow(Base other) { 488 if (!super.equalsShallow(other)) 489 return false; 490 if (!(other instanceof ParametersParameterComponent)) 491 return false; 492 ParametersParameterComponent o = (ParametersParameterComponent) other; 493 return compareValues(name, o.name, true); 494 } 495 496 public boolean isEmpty() { 497 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, value, resource, part 498 ); 499 } 500 501 public String fhirType() { 502 return "Parameters.parameter"; 503 504 } 505 506 } 507 508 /** 509 * A parameter passed to or received from the operation. 510 */ 511 @Child(name = "parameter", type = {}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 512 @Description(shortDefinition="Operation Parameter", formalDefinition="A parameter passed to or received from the operation." ) 513 protected List<ParametersParameterComponent> parameter; 514 515 private static final long serialVersionUID = -1495940293L; 516 517 /** 518 * Constructor 519 */ 520 public Parameters() { 521 super(); 522 } 523 524 /** 525 * @return {@link #parameter} (A parameter passed to or received from the operation.) 526 */ 527 public List<ParametersParameterComponent> getParameter() { 528 if (this.parameter == null) 529 this.parameter = new ArrayList<ParametersParameterComponent>(); 530 return this.parameter; 531 } 532 533 /** 534 * @return Returns a reference to <code>this</code> for easy method chaining 535 */ 536 public Parameters setParameter(List<ParametersParameterComponent> theParameter) { 537 this.parameter = theParameter; 538 return this; 539 } 540 541 public boolean hasParameter() { 542 if (this.parameter == null) 543 return false; 544 for (ParametersParameterComponent item : this.parameter) 545 if (!item.isEmpty()) 546 return true; 547 return false; 548 } 549 550 public ParametersParameterComponent addParameter() { //3 551 ParametersParameterComponent t = new ParametersParameterComponent(); 552 if (this.parameter == null) 553 this.parameter = new ArrayList<ParametersParameterComponent>(); 554 this.parameter.add(t); 555 return t; 556 } 557 558 public Parameters addParameter(ParametersParameterComponent t) { //3 559 if (t == null) 560 return this; 561 if (this.parameter == null) 562 this.parameter = new ArrayList<ParametersParameterComponent>(); 563 this.parameter.add(t); 564 return this; 565 } 566 567 /** 568 * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist 569 */ 570 public ParametersParameterComponent getParameterFirstRep() { 571 if (getParameter().isEmpty()) { 572 addParameter(); 573 } 574 return getParameter().get(0); 575 } 576 577 protected void listChildren(List<Property> childrenList) { 578 super.listChildren(childrenList); 579 childrenList.add(new Property("parameter", "", "A parameter passed to or received from the operation.", 0, java.lang.Integer.MAX_VALUE, parameter)); 580 } 581 582 @Override 583 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 584 switch (hash) { 585 case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ParametersParameterComponent 586 default: return super.getProperty(hash, name, checkValid); 587 } 588 589 } 590 591 @Override 592 public Base setProperty(int hash, String name, Base value) throws FHIRException { 593 switch (hash) { 594 case 1954460585: // parameter 595 this.getParameter().add((ParametersParameterComponent) value); // ParametersParameterComponent 596 return value; 597 default: return super.setProperty(hash, name, value); 598 } 599 600 } 601 602 @Override 603 public Base setProperty(String name, Base value) throws FHIRException { 604 if (name.equals("parameter")) { 605 this.getParameter().add((ParametersParameterComponent) value); 606 } else 607 return super.setProperty(name, value); 608 return value; 609 } 610 611 @Override 612 public Base makeProperty(int hash, String name) throws FHIRException { 613 switch (hash) { 614 case 1954460585: return addParameter(); 615 default: return super.makeProperty(hash, name); 616 } 617 618 } 619 620 @Override 621 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 622 switch (hash) { 623 case 1954460585: /*parameter*/ return new String[] {}; 624 default: return super.getTypesForProperty(hash, name); 625 } 626 627 } 628 629 @Override 630 public Base addChild(String name) throws FHIRException { 631 if (name.equals("parameter")) { 632 return addParameter(); 633 } 634 else 635 return super.addChild(name); 636 } 637 638 public String fhirType() { 639 return "Parameters"; 640 641 } 642 643 public Parameters copy() { 644 Parameters dst = new Parameters(); 645 copyValues(dst); 646 if (parameter != null) { 647 dst.parameter = new ArrayList<ParametersParameterComponent>(); 648 for (ParametersParameterComponent i : parameter) 649 dst.parameter.add(i.copy()); 650 }; 651 return dst; 652 } 653 654 protected Parameters typedCopy() { 655 return copy(); 656 } 657 658 @Override 659 public boolean equalsDeep(Base other) { 660 if (!super.equalsDeep(other)) 661 return false; 662 if (!(other instanceof Parameters)) 663 return false; 664 Parameters o = (Parameters) other; 665 return compareDeep(parameter, o.parameter, true); 666 } 667 668 @Override 669 public boolean equalsShallow(Base other) { 670 if (!super.equalsShallow(other)) 671 return false; 672 if (!(other instanceof Parameters)) 673 return false; 674 Parameters o = (Parameters) other; 675 return true; 676 } 677 678 public boolean isEmpty() { 679 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(parameter); 680 } 681 682 @Override 683 public ResourceType getResourceType() { 684 return ResourceType.Parameters; 685 } 686 687 688} 689