001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038import org.hl7.fhir.instance.model.api.IBaseParameters; 039 040import ca.uhn.fhir.model.api.annotation.*; 041/** 042 * 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. 043 */ 044@ResourceDef(name="Parameters", profile="http://hl7.org/fhir/Profile/Parameters") 045public class Parameters extends Resource implements IBaseParameters { 046 047 @Block() 048 public static class ParametersParameterComponent extends BackboneElement implements IBaseBackboneElement { 049 /** 050 * The name of the parameter (reference to the operation definition). 051 */ 052 @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 053 @Description(shortDefinition="Name from the definition", formalDefinition="The name of the parameter (reference to the operation definition)." ) 054 protected StringType name; 055 056 /** 057 * If the parameter is a data type. 058 */ 059 @Child(name = "value", type = {}, order=2, min=0, max=1, modifier=false, summary=false) 060 @Description(shortDefinition="If parameter is a data type", formalDefinition="If the parameter is a data type." ) 061 protected org.hl7.fhir.instance.model.Type value; 062 063 /** 064 * If the parameter is a whole resource. 065 */ 066 @Child(name = "resource", type = {Resource.class}, order=3, min=0, max=1, modifier=false, summary=false) 067 @Description(shortDefinition="If parameter is a whole resource", formalDefinition="If the parameter is a whole resource." ) 068 protected Resource resource; 069 070 /** 071 * A named part of a parameter. In many implementation context, a set of named parts is known as a "Tuple". 072 */ 073 @Child(name = "part", type = {ParametersParameterComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 074 @Description(shortDefinition="Named part of a parameter (e.g. Tuple)", formalDefinition="A named part of a parameter. In many implementation context, a set of named parts is known as a \"Tuple\"." ) 075 protected List<ParametersParameterComponent> part; 076 077 private static final long serialVersionUID = -198518915L; 078 079 /* 080 * Constructor 081 */ 082 public ParametersParameterComponent() { 083 super(); 084 } 085 086 /* 087 * Constructor 088 */ 089 public ParametersParameterComponent(StringType name) { 090 super(); 091 this.name = name; 092 } 093 094 /** 095 * @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 096 */ 097 public StringType getNameElement() { 098 if (this.name == null) 099 if (Configuration.errorOnAutoCreate()) 100 throw new Error("Attempt to auto-create ParametersParameterComponent.name"); 101 else if (Configuration.doAutoCreate()) 102 this.name = new StringType(); // bb 103 return this.name; 104 } 105 106 public boolean hasNameElement() { 107 return this.name != null && !this.name.isEmpty(); 108 } 109 110 public boolean hasName() { 111 return this.name != null && !this.name.isEmpty(); 112 } 113 114 /** 115 * @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 116 */ 117 public ParametersParameterComponent setNameElement(StringType value) { 118 this.name = value; 119 return this; 120 } 121 122 /** 123 * @return The name of the parameter (reference to the operation definition). 124 */ 125 public String getName() { 126 return this.name == null ? null : this.name.getValue(); 127 } 128 129 /** 130 * @param value The name of the parameter (reference to the operation definition). 131 */ 132 public ParametersParameterComponent setName(String value) { 133 if (this.name == null) 134 this.name = new StringType(); 135 this.name.setValue(value); 136 return this; 137 } 138 139 /** 140 * @return {@link #value} (If the parameter is a data type.) 141 */ 142 public org.hl7.fhir.instance.model.Type getValue() { 143 return this.value; 144 } 145 146 public boolean hasValue() { 147 return this.value != null && !this.value.isEmpty(); 148 } 149 150 /** 151 * @param value {@link #value} (If the parameter is a data type.) 152 */ 153 public ParametersParameterComponent setValue(org.hl7.fhir.instance.model.Type value) { 154 this.value = value; 155 return this; 156 } 157 158 /** 159 * @return {@link #resource} (If the parameter is a whole resource.) 160 */ 161 public Resource getResource() { 162 return this.resource; 163 } 164 165 public boolean hasResource() { 166 return this.resource != null && !this.resource.isEmpty(); 167 } 168 169 /** 170 * @param value {@link #resource} (If the parameter is a whole resource.) 171 */ 172 public ParametersParameterComponent setResource(Resource value) { 173 this.resource = value; 174 return this; 175 } 176 177 /** 178 * @return {@link #part} (A named part of a parameter. In many implementation context, a set of named parts is known as a "Tuple".) 179 */ 180 public List<ParametersParameterComponent> getPart() { 181 if (this.part == null) 182 this.part = new ArrayList<ParametersParameterComponent>(); 183 return this.part; 184 } 185 186 public boolean hasPart() { 187 if (this.part == null) 188 return false; 189 for (ParametersParameterComponent item : this.part) 190 if (!item.isEmpty()) 191 return true; 192 return false; 193 } 194 195 /** 196 * @return {@link #part} (A named part of a parameter. In many implementation context, a set of named parts is known as a "Tuple".) 197 */ 198 // syntactic sugar 199 public ParametersParameterComponent addPart() { //3 200 ParametersParameterComponent t = new ParametersParameterComponent(); 201 if (this.part == null) 202 this.part = new ArrayList<ParametersParameterComponent>(); 203 this.part.add(t); 204 return t; 205 } 206 207 // syntactic sugar 208 public ParametersParameterComponent addPart(ParametersParameterComponent t) { //3 209 if (t == null) 210 return this; 211 if (this.part == null) 212 this.part = new ArrayList<ParametersParameterComponent>(); 213 this.part.add(t); 214 return this; 215 } 216 217 protected void listChildren(List<Property> childrenList) { 218 super.listChildren(childrenList); 219 childrenList.add(new Property("name", "string", "The name of the parameter (reference to the operation definition).", 0, java.lang.Integer.MAX_VALUE, name)); 220 childrenList.add(new Property("value[x]", "*", "If the parameter is a data type.", 0, java.lang.Integer.MAX_VALUE, value)); 221 childrenList.add(new Property("resource", "Resource", "If the parameter is a whole resource.", 0, java.lang.Integer.MAX_VALUE, resource)); 222 childrenList.add(new Property("part", "@Parameters.parameter", "A named part of a parameter. In many implementation context, a set of named parts is known as a \"Tuple\".", 0, java.lang.Integer.MAX_VALUE, part)); 223 } 224 225 @Override 226 public void setProperty(String name, Base value) throws FHIRException { 227 if (name.equals("name")) 228 this.name = castToString(value); // StringType 229 else if (name.equals("value[x]")) 230 this.value = (org.hl7.fhir.instance.model.Type) value; // org.hl7.fhir.instance.model.Type 231 else if (name.equals("resource")) 232 this.resource = castToResource(value); // Resource 233 else if (name.equals("part")) 234 this.getPart().add((ParametersParameterComponent) value); 235 else 236 super.setProperty(name, value); 237 } 238 239 @Override 240 public Base addChild(String name) throws FHIRException { 241 if (name.equals("name")) { 242 throw new FHIRException("Cannot call addChild on a primitive type Parameters.name"); 243 } 244 else if (name.equals("valueBoolean")) { 245 this.value = new BooleanType(); 246 return this.value; 247 } 248 else if (name.equals("valueInteger")) { 249 this.value = new IntegerType(); 250 return this.value; 251 } 252 else if (name.equals("valueDecimal")) { 253 this.value = new DecimalType(); 254 return this.value; 255 } 256 else if (name.equals("valueBase64Binary")) { 257 this.value = new Base64BinaryType(); 258 return this.value; 259 } 260 else if (name.equals("valueInstant")) { 261 this.value = new InstantType(); 262 return this.value; 263 } 264 else if (name.equals("valueString")) { 265 this.value = new StringType(); 266 return this.value; 267 } 268 else if (name.equals("valueUri")) { 269 this.value = new UriType(); 270 return this.value; 271 } 272 else if (name.equals("valueDate")) { 273 this.value = new DateType(); 274 return this.value; 275 } 276 else if (name.equals("valueDateTime")) { 277 this.value = new DateTimeType(); 278 return this.value; 279 } 280 else if (name.equals("valueTime")) { 281 this.value = new TimeType(); 282 return this.value; 283 } 284 else if (name.equals("valueCode")) { 285 this.value = new CodeType(); 286 return this.value; 287 } 288 else if (name.equals("valueOid")) { 289 this.value = new OidType(); 290 return this.value; 291 } 292 else if (name.equals("valueId")) { 293 this.value = new IdType(); 294 return this.value; 295 } 296 else if (name.equals("valueUnsignedInt")) { 297 this.value = new UnsignedIntType(); 298 return this.value; 299 } 300 else if (name.equals("valuePositiveInt")) { 301 this.value = new PositiveIntType(); 302 return this.value; 303 } 304 else if (name.equals("valueMarkdown")) { 305 this.value = new MarkdownType(); 306 return this.value; 307 } 308 else if (name.equals("valueAnnotation")) { 309 this.value = new Annotation(); 310 return this.value; 311 } 312 else if (name.equals("valueAttachment")) { 313 this.value = new Attachment(); 314 return this.value; 315 } 316 else if (name.equals("valueIdentifier")) { 317 this.value = new Identifier(); 318 return this.value; 319 } 320 else if (name.equals("valueCodeableConcept")) { 321 this.value = new CodeableConcept(); 322 return this.value; 323 } 324 else if (name.equals("valueCoding")) { 325 this.value = new Coding(); 326 return this.value; 327 } 328 else if (name.equals("valueQuantity")) { 329 this.value = new Quantity(); 330 return this.value; 331 } 332 else if (name.equals("valueRange")) { 333 this.value = new Range(); 334 return this.value; 335 } 336 else if (name.equals("valuePeriod")) { 337 this.value = new Period(); 338 return this.value; 339 } 340 else if (name.equals("valueRatio")) { 341 this.value = new Ratio(); 342 return this.value; 343 } 344 else if (name.equals("valueSampledData")) { 345 this.value = new SampledData(); 346 return this.value; 347 } 348 else if (name.equals("valueSignature")) { 349 this.value = new Signature(); 350 return this.value; 351 } 352 else if (name.equals("valueHumanName")) { 353 this.value = new HumanName(); 354 return this.value; 355 } 356 else if (name.equals("valueAddress")) { 357 this.value = new Address(); 358 return this.value; 359 } 360 else if (name.equals("valueContactPoint")) { 361 this.value = new ContactPoint(); 362 return this.value; 363 } 364 else if (name.equals("valueTiming")) { 365 this.value = new Timing(); 366 return this.value; 367 } 368 else if (name.equals("valueReference")) { 369 this.value = new Reference(); 370 return this.value; 371 } 372 else if (name.equals("valueMeta")) { 373 this.value = new Meta(); 374 return this.value; 375 } 376 else if (name.equals("resource")) { 377 throw new FHIRException("Cannot call addChild on an abstract type Parameters.resource"); 378 } 379 else if (name.equals("part")) { 380 return addPart(); 381 } 382 else 383 return super.addChild(name); 384 } 385 386 public ParametersParameterComponent copy() { 387 ParametersParameterComponent dst = new ParametersParameterComponent(); 388 copyValues(dst); 389 dst.name = name == null ? null : name.copy(); 390 dst.value = value == null ? null : value.copy(); 391 dst.resource = resource == null ? null : resource.copy(); 392 if (part != null) { 393 dst.part = new ArrayList<ParametersParameterComponent>(); 394 for (ParametersParameterComponent i : part) 395 dst.part.add(i.copy()); 396 }; 397 return dst; 398 } 399 400 @Override 401 public boolean equalsDeep(Base other) { 402 if (!super.equalsDeep(other)) 403 return false; 404 if (!(other instanceof ParametersParameterComponent)) 405 return false; 406 ParametersParameterComponent o = (ParametersParameterComponent) other; 407 return compareDeep(name, o.name, true) && compareDeep(value, o.value, true) && compareDeep(resource, o.resource, true) 408 && compareDeep(part, o.part, true); 409 } 410 411 @Override 412 public boolean equalsShallow(Base other) { 413 if (!super.equalsShallow(other)) 414 return false; 415 if (!(other instanceof ParametersParameterComponent)) 416 return false; 417 ParametersParameterComponent o = (ParametersParameterComponent) other; 418 return compareValues(name, o.name, true); 419 } 420 421 public boolean isEmpty() { 422 return super.isEmpty() && (name == null || name.isEmpty()) && (value == null || value.isEmpty()) 423 && (resource == null || resource.isEmpty()) && (part == null || part.isEmpty()); 424 } 425 426 public String fhirType() { 427 return "null"; 428 429 } 430 431 } 432 433 /** 434 * A parameter passed to or received from the operation. 435 */ 436 @Child(name = "parameter", type = {}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 437 @Description(shortDefinition="Operation Parameter", formalDefinition="A parameter passed to or received from the operation." ) 438 protected List<ParametersParameterComponent> parameter; 439 440 private static final long serialVersionUID = -1495940293L; 441 442 /* 443 * Constructor 444 */ 445 public Parameters() { 446 super(); 447 } 448 449 /** 450 * @return {@link #parameter} (A parameter passed to or received from the operation.) 451 */ 452 public List<ParametersParameterComponent> getParameter() { 453 if (this.parameter == null) 454 this.parameter = new ArrayList<ParametersParameterComponent>(); 455 return this.parameter; 456 } 457 458 public boolean hasParameter() { 459 if (this.parameter == null) 460 return false; 461 for (ParametersParameterComponent item : this.parameter) 462 if (!item.isEmpty()) 463 return true; 464 return false; 465 } 466 467 /** 468 * @return {@link #parameter} (A parameter passed to or received from the operation.) 469 */ 470 // syntactic sugar 471 public ParametersParameterComponent addParameter() { //3 472 ParametersParameterComponent t = new ParametersParameterComponent(); 473 if (this.parameter == null) 474 this.parameter = new ArrayList<ParametersParameterComponent>(); 475 this.parameter.add(t); 476 return t; 477 } 478 479 // syntactic sugar 480 public Parameters addParameter(ParametersParameterComponent t) { //3 481 if (t == null) 482 return this; 483 if (this.parameter == null) 484 this.parameter = new ArrayList<ParametersParameterComponent>(); 485 this.parameter.add(t); 486 return this; 487 } 488 489 protected void listChildren(List<Property> childrenList) { 490 super.listChildren(childrenList); 491 childrenList.add(new Property("parameter", "", "A parameter passed to or received from the operation.", 0, java.lang.Integer.MAX_VALUE, parameter)); 492 } 493 494 @Override 495 public void setProperty(String name, Base value) throws FHIRException { 496 if (name.equals("parameter")) 497 this.getParameter().add((ParametersParameterComponent) value); 498 else 499 super.setProperty(name, value); 500 } 501 502 @Override 503 public Base addChild(String name) throws FHIRException { 504 if (name.equals("parameter")) { 505 return addParameter(); 506 } 507 else 508 return super.addChild(name); 509 } 510 511 public String fhirType() { 512 return "Parameters"; 513 514 } 515 516 public Parameters copy() { 517 Parameters dst = new Parameters(); 518 copyValues(dst); 519 if (parameter != null) { 520 dst.parameter = new ArrayList<ParametersParameterComponent>(); 521 for (ParametersParameterComponent i : parameter) 522 dst.parameter.add(i.copy()); 523 }; 524 return dst; 525 } 526 527 protected Parameters typedCopy() { 528 return copy(); 529 } 530 531 @Override 532 public boolean equalsDeep(Base other) { 533 if (!super.equalsDeep(other)) 534 return false; 535 if (!(other instanceof Parameters)) 536 return false; 537 Parameters o = (Parameters) other; 538 return compareDeep(parameter, o.parameter, true); 539 } 540 541 @Override 542 public boolean equalsShallow(Base other) { 543 if (!super.equalsShallow(other)) 544 return false; 545 if (!(other instanceof Parameters)) 546 return false; 547 Parameters o = (Parameters) other; 548 return true; 549 } 550 551 public boolean isEmpty() { 552 return super.isEmpty() && (parameter == null || parameter.isEmpty()); 553 } 554 555 @Override 556 public ResourceType getResourceType() { 557 return ResourceType.Parameters; 558 } 559 560 561} 562