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 Fri, Mar 16, 2018 15:21+1100 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; 045import org.hl7.fhir.exceptions.FHIRFormatError; 046/** 047 * The subscription resource is used to define a push based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system is able to take an appropriate action. 048 */ 049@ResourceDef(name="Subscription", profile="http://hl7.org/fhir/StructureDefinition/Subscription") 050public class Subscription extends DomainResource { 051 052 public enum SubscriptionStatus { 053 /** 054 * The client has requested the subscription, and the server has not yet set it up. 055 */ 056 REQUESTED, 057 /** 058 * The subscription is active. 059 */ 060 ACTIVE, 061 /** 062 * The server has an error executing the notification. 063 */ 064 ERROR, 065 /** 066 * Too many errors have occurred or the subscription has expired. 067 */ 068 OFF, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 public static SubscriptionStatus fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("requested".equals(codeString)) 077 return REQUESTED; 078 if ("active".equals(codeString)) 079 return ACTIVE; 080 if ("error".equals(codeString)) 081 return ERROR; 082 if ("off".equals(codeString)) 083 return OFF; 084 if (Configuration.isAcceptInvalidEnums()) 085 return null; 086 else 087 throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'"); 088 } 089 public String toCode() { 090 switch (this) { 091 case REQUESTED: return "requested"; 092 case ACTIVE: return "active"; 093 case ERROR: return "error"; 094 case OFF: return "off"; 095 default: return "?"; 096 } 097 } 098 public String getSystem() { 099 switch (this) { 100 case REQUESTED: return "http://hl7.org/fhir/subscription-status"; 101 case ACTIVE: return "http://hl7.org/fhir/subscription-status"; 102 case ERROR: return "http://hl7.org/fhir/subscription-status"; 103 case OFF: return "http://hl7.org/fhir/subscription-status"; 104 default: return "?"; 105 } 106 } 107 public String getDefinition() { 108 switch (this) { 109 case REQUESTED: return "The client has requested the subscription, and the server has not yet set it up."; 110 case ACTIVE: return "The subscription is active."; 111 case ERROR: return "The server has an error executing the notification."; 112 case OFF: return "Too many errors have occurred or the subscription has expired."; 113 default: return "?"; 114 } 115 } 116 public String getDisplay() { 117 switch (this) { 118 case REQUESTED: return "Requested"; 119 case ACTIVE: return "Active"; 120 case ERROR: return "Error"; 121 case OFF: return "Off"; 122 default: return "?"; 123 } 124 } 125 } 126 127 public static class SubscriptionStatusEnumFactory implements EnumFactory<SubscriptionStatus> { 128 public SubscriptionStatus fromCode(String codeString) throws IllegalArgumentException { 129 if (codeString == null || "".equals(codeString)) 130 if (codeString == null || "".equals(codeString)) 131 return null; 132 if ("requested".equals(codeString)) 133 return SubscriptionStatus.REQUESTED; 134 if ("active".equals(codeString)) 135 return SubscriptionStatus.ACTIVE; 136 if ("error".equals(codeString)) 137 return SubscriptionStatus.ERROR; 138 if ("off".equals(codeString)) 139 return SubscriptionStatus.OFF; 140 throw new IllegalArgumentException("Unknown SubscriptionStatus code '"+codeString+"'"); 141 } 142 public Enumeration<SubscriptionStatus> fromType(Base code) throws FHIRException { 143 if (code == null) 144 return null; 145 if (code.isEmpty()) 146 return new Enumeration<SubscriptionStatus>(this); 147 String codeString = ((PrimitiveType) code).asStringValue(); 148 if (codeString == null || "".equals(codeString)) 149 return null; 150 if ("requested".equals(codeString)) 151 return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.REQUESTED); 152 if ("active".equals(codeString)) 153 return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ACTIVE); 154 if ("error".equals(codeString)) 155 return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ERROR); 156 if ("off".equals(codeString)) 157 return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.OFF); 158 throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'"); 159 } 160 public String toCode(SubscriptionStatus code) { 161 if (code == SubscriptionStatus.REQUESTED) 162 return "requested"; 163 if (code == SubscriptionStatus.ACTIVE) 164 return "active"; 165 if (code == SubscriptionStatus.ERROR) 166 return "error"; 167 if (code == SubscriptionStatus.OFF) 168 return "off"; 169 return "?"; 170 } 171 public String toSystem(SubscriptionStatus code) { 172 return code.getSystem(); 173 } 174 } 175 176 public enum SubscriptionChannelType { 177 /** 178 * The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made. 179 */ 180 RESTHOOK, 181 /** 182 * The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL. 183 */ 184 WEBSOCKET, 185 /** 186 * The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:). 187 */ 188 EMAIL, 189 /** 190 * The channel is executed by sending an SMS message to the phone number identified in the URL (tel:). 191 */ 192 SMS, 193 /** 194 * The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI. 195 */ 196 MESSAGE, 197 /** 198 * added to help the parsers with the generic types 199 */ 200 NULL; 201 public static SubscriptionChannelType fromCode(String codeString) throws FHIRException { 202 if (codeString == null || "".equals(codeString)) 203 return null; 204 if ("rest-hook".equals(codeString)) 205 return RESTHOOK; 206 if ("websocket".equals(codeString)) 207 return WEBSOCKET; 208 if ("email".equals(codeString)) 209 return EMAIL; 210 if ("sms".equals(codeString)) 211 return SMS; 212 if ("message".equals(codeString)) 213 return MESSAGE; 214 if (Configuration.isAcceptInvalidEnums()) 215 return null; 216 else 217 throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'"); 218 } 219 public String toCode() { 220 switch (this) { 221 case RESTHOOK: return "rest-hook"; 222 case WEBSOCKET: return "websocket"; 223 case EMAIL: return "email"; 224 case SMS: return "sms"; 225 case MESSAGE: return "message"; 226 default: return "?"; 227 } 228 } 229 public String getSystem() { 230 switch (this) { 231 case RESTHOOK: return "http://hl7.org/fhir/subscription-channel-type"; 232 case WEBSOCKET: return "http://hl7.org/fhir/subscription-channel-type"; 233 case EMAIL: return "http://hl7.org/fhir/subscription-channel-type"; 234 case SMS: return "http://hl7.org/fhir/subscription-channel-type"; 235 case MESSAGE: return "http://hl7.org/fhir/subscription-channel-type"; 236 default: return "?"; 237 } 238 } 239 public String getDefinition() { 240 switch (this) { 241 case RESTHOOK: return "The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made."; 242 case WEBSOCKET: return "The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL."; 243 case EMAIL: return "The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:)."; 244 case SMS: return "The channel is executed by sending an SMS message to the phone number identified in the URL (tel:)."; 245 case MESSAGE: return "The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI."; 246 default: return "?"; 247 } 248 } 249 public String getDisplay() { 250 switch (this) { 251 case RESTHOOK: return "Rest Hook"; 252 case WEBSOCKET: return "Websocket"; 253 case EMAIL: return "Email"; 254 case SMS: return "SMS"; 255 case MESSAGE: return "Message"; 256 default: return "?"; 257 } 258 } 259 } 260 261 public static class SubscriptionChannelTypeEnumFactory implements EnumFactory<SubscriptionChannelType> { 262 public SubscriptionChannelType fromCode(String codeString) throws IllegalArgumentException { 263 if (codeString == null || "".equals(codeString)) 264 if (codeString == null || "".equals(codeString)) 265 return null; 266 if ("rest-hook".equals(codeString)) 267 return SubscriptionChannelType.RESTHOOK; 268 if ("websocket".equals(codeString)) 269 return SubscriptionChannelType.WEBSOCKET; 270 if ("email".equals(codeString)) 271 return SubscriptionChannelType.EMAIL; 272 if ("sms".equals(codeString)) 273 return SubscriptionChannelType.SMS; 274 if ("message".equals(codeString)) 275 return SubscriptionChannelType.MESSAGE; 276 throw new IllegalArgumentException("Unknown SubscriptionChannelType code '"+codeString+"'"); 277 } 278 public Enumeration<SubscriptionChannelType> fromType(Base code) throws FHIRException { 279 if (code == null) 280 return null; 281 if (code.isEmpty()) 282 return new Enumeration<SubscriptionChannelType>(this); 283 String codeString = ((PrimitiveType) code).asStringValue(); 284 if (codeString == null || "".equals(codeString)) 285 return null; 286 if ("rest-hook".equals(codeString)) 287 return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.RESTHOOK); 288 if ("websocket".equals(codeString)) 289 return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.WEBSOCKET); 290 if ("email".equals(codeString)) 291 return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.EMAIL); 292 if ("sms".equals(codeString)) 293 return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.SMS); 294 if ("message".equals(codeString)) 295 return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.MESSAGE); 296 throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'"); 297 } 298 public String toCode(SubscriptionChannelType code) { 299 if (code == SubscriptionChannelType.RESTHOOK) 300 return "rest-hook"; 301 if (code == SubscriptionChannelType.WEBSOCKET) 302 return "websocket"; 303 if (code == SubscriptionChannelType.EMAIL) 304 return "email"; 305 if (code == SubscriptionChannelType.SMS) 306 return "sms"; 307 if (code == SubscriptionChannelType.MESSAGE) 308 return "message"; 309 return "?"; 310 } 311 public String toSystem(SubscriptionChannelType code) { 312 return code.getSystem(); 313 } 314 } 315 316 @Block() 317 public static class SubscriptionChannelComponent extends BackboneElement implements IBaseBackboneElement { 318 /** 319 * The type of channel to send notifications on. 320 */ 321 @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 322 @Description(shortDefinition="rest-hook | websocket | email | sms | message", formalDefinition="The type of channel to send notifications on." ) 323 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type") 324 protected Enumeration<SubscriptionChannelType> type; 325 326 /** 327 * The uri that describes the actual end-point to send messages to. 328 */ 329 @Child(name = "endpoint", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 330 @Description(shortDefinition="Where the channel points to", formalDefinition="The uri that describes the actual end-point to send messages to." ) 331 protected UriType endpoint; 332 333 /** 334 * The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. 335 */ 336 @Child(name = "payload", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 337 @Description(shortDefinition="Mimetype to send, or omit for no payload", formalDefinition="The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification." ) 338 protected StringType payload; 339 340 /** 341 * Additional headers / information to send as part of the notification. 342 */ 343 @Child(name = "header", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 344 @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." ) 345 protected List<StringType> header; 346 347 private static final long serialVersionUID = -854610293L; 348 349 /** 350 * Constructor 351 */ 352 public SubscriptionChannelComponent() { 353 super(); 354 } 355 356 /** 357 * Constructor 358 */ 359 public SubscriptionChannelComponent(Enumeration<SubscriptionChannelType> type) { 360 super(); 361 this.type = type; 362 } 363 364 /** 365 * @return {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 366 */ 367 public Enumeration<SubscriptionChannelType> getTypeElement() { 368 if (this.type == null) 369 if (Configuration.errorOnAutoCreate()) 370 throw new Error("Attempt to auto-create SubscriptionChannelComponent.type"); 371 else if (Configuration.doAutoCreate()) 372 this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); // bb 373 return this.type; 374 } 375 376 public boolean hasTypeElement() { 377 return this.type != null && !this.type.isEmpty(); 378 } 379 380 public boolean hasType() { 381 return this.type != null && !this.type.isEmpty(); 382 } 383 384 /** 385 * @param value {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 386 */ 387 public SubscriptionChannelComponent setTypeElement(Enumeration<SubscriptionChannelType> value) { 388 this.type = value; 389 return this; 390 } 391 392 /** 393 * @return The type of channel to send notifications on. 394 */ 395 public SubscriptionChannelType getType() { 396 return this.type == null ? null : this.type.getValue(); 397 } 398 399 /** 400 * @param value The type of channel to send notifications on. 401 */ 402 public SubscriptionChannelComponent setType(SubscriptionChannelType value) { 403 if (this.type == null) 404 this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); 405 this.type.setValue(value); 406 return this; 407 } 408 409 /** 410 * @return {@link #endpoint} (The uri that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 411 */ 412 public UriType getEndpointElement() { 413 if (this.endpoint == null) 414 if (Configuration.errorOnAutoCreate()) 415 throw new Error("Attempt to auto-create SubscriptionChannelComponent.endpoint"); 416 else if (Configuration.doAutoCreate()) 417 this.endpoint = new UriType(); // bb 418 return this.endpoint; 419 } 420 421 public boolean hasEndpointElement() { 422 return this.endpoint != null && !this.endpoint.isEmpty(); 423 } 424 425 public boolean hasEndpoint() { 426 return this.endpoint != null && !this.endpoint.isEmpty(); 427 } 428 429 /** 430 * @param value {@link #endpoint} (The uri that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 431 */ 432 public SubscriptionChannelComponent setEndpointElement(UriType value) { 433 this.endpoint = value; 434 return this; 435 } 436 437 /** 438 * @return The uri that describes the actual end-point to send messages to. 439 */ 440 public String getEndpoint() { 441 return this.endpoint == null ? null : this.endpoint.getValue(); 442 } 443 444 /** 445 * @param value The uri that describes the actual end-point to send messages to. 446 */ 447 public SubscriptionChannelComponent setEndpoint(String value) { 448 if (Utilities.noString(value)) 449 this.endpoint = null; 450 else { 451 if (this.endpoint == null) 452 this.endpoint = new UriType(); 453 this.endpoint.setValue(value); 454 } 455 return this; 456 } 457 458 /** 459 * @return {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.). This is the underlying object with id, value and extensions. The accessor "getPayload" gives direct access to the value 460 */ 461 public StringType getPayloadElement() { 462 if (this.payload == null) 463 if (Configuration.errorOnAutoCreate()) 464 throw new Error("Attempt to auto-create SubscriptionChannelComponent.payload"); 465 else if (Configuration.doAutoCreate()) 466 this.payload = new StringType(); // bb 467 return this.payload; 468 } 469 470 public boolean hasPayloadElement() { 471 return this.payload != null && !this.payload.isEmpty(); 472 } 473 474 public boolean hasPayload() { 475 return this.payload != null && !this.payload.isEmpty(); 476 } 477 478 /** 479 * @param value {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.). This is the underlying object with id, value and extensions. The accessor "getPayload" gives direct access to the value 480 */ 481 public SubscriptionChannelComponent setPayloadElement(StringType value) { 482 this.payload = value; 483 return this; 484 } 485 486 /** 487 * @return The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. 488 */ 489 public String getPayload() { 490 return this.payload == null ? null : this.payload.getValue(); 491 } 492 493 /** 494 * @param value The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. 495 */ 496 public SubscriptionChannelComponent setPayload(String value) { 497 if (Utilities.noString(value)) 498 this.payload = null; 499 else { 500 if (this.payload == null) 501 this.payload = new StringType(); 502 this.payload.setValue(value); 503 } 504 return this; 505 } 506 507 /** 508 * @return {@link #header} (Additional headers / information to send as part of the notification.) 509 */ 510 public List<StringType> getHeader() { 511 if (this.header == null) 512 this.header = new ArrayList<StringType>(); 513 return this.header; 514 } 515 516 /** 517 * @return Returns a reference to <code>this</code> for easy method chaining 518 */ 519 public SubscriptionChannelComponent setHeader(List<StringType> theHeader) { 520 this.header = theHeader; 521 return this; 522 } 523 524 public boolean hasHeader() { 525 if (this.header == null) 526 return false; 527 for (StringType item : this.header) 528 if (!item.isEmpty()) 529 return true; 530 return false; 531 } 532 533 /** 534 * @return {@link #header} (Additional headers / information to send as part of the notification.) 535 */ 536 public StringType addHeaderElement() {//2 537 StringType t = new StringType(); 538 if (this.header == null) 539 this.header = new ArrayList<StringType>(); 540 this.header.add(t); 541 return t; 542 } 543 544 /** 545 * @param value {@link #header} (Additional headers / information to send as part of the notification.) 546 */ 547 public SubscriptionChannelComponent addHeader(String value) { //1 548 StringType t = new StringType(); 549 t.setValue(value); 550 if (this.header == null) 551 this.header = new ArrayList<StringType>(); 552 this.header.add(t); 553 return this; 554 } 555 556 /** 557 * @param value {@link #header} (Additional headers / information to send as part of the notification.) 558 */ 559 public boolean hasHeader(String value) { 560 if (this.header == null) 561 return false; 562 for (StringType v : this.header) 563 if (v.getValue().equals(value)) // string 564 return true; 565 return false; 566 } 567 568 protected void listChildren(List<Property> children) { 569 super.listChildren(children); 570 children.add(new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type)); 571 children.add(new Property("endpoint", "uri", "The uri that describes the actual end-point to send messages to.", 0, 1, endpoint)); 572 children.add(new Property("payload", "string", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.", 0, 1, payload)); 573 children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header)); 574 } 575 576 @Override 577 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 578 switch (_hash) { 579 case 3575610: /*type*/ return new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type); 580 case 1741102485: /*endpoint*/ return new Property("endpoint", "uri", "The uri that describes the actual end-point to send messages to.", 0, 1, endpoint); 581 case -786701938: /*payload*/ return new Property("payload", "string", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.", 0, 1, payload); 582 case -1221270899: /*header*/ return new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header); 583 default: return super.getNamedProperty(_hash, _name, _checkValid); 584 } 585 586 } 587 588 @Override 589 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 590 switch (hash) { 591 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SubscriptionChannelType> 592 case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UriType 593 case -786701938: /*payload*/ return this.payload == null ? new Base[0] : new Base[] {this.payload}; // StringType 594 case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType 595 default: return super.getProperty(hash, name, checkValid); 596 } 597 598 } 599 600 @Override 601 public Base setProperty(int hash, String name, Base value) throws FHIRException { 602 switch (hash) { 603 case 3575610: // type 604 value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value)); 605 this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType> 606 return value; 607 case 1741102485: // endpoint 608 this.endpoint = castToUri(value); // UriType 609 return value; 610 case -786701938: // payload 611 this.payload = castToString(value); // StringType 612 return value; 613 case -1221270899: // header 614 this.getHeader().add(castToString(value)); // StringType 615 return value; 616 default: return super.setProperty(hash, name, value); 617 } 618 619 } 620 621 @Override 622 public Base setProperty(String name, Base value) throws FHIRException { 623 if (name.equals("type")) { 624 value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value)); 625 this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType> 626 } else if (name.equals("endpoint")) { 627 this.endpoint = castToUri(value); // UriType 628 } else if (name.equals("payload")) { 629 this.payload = castToString(value); // StringType 630 } else if (name.equals("header")) { 631 this.getHeader().add(castToString(value)); 632 } else 633 return super.setProperty(name, value); 634 return value; 635 } 636 637 @Override 638 public Base makeProperty(int hash, String name) throws FHIRException { 639 switch (hash) { 640 case 3575610: return getTypeElement(); 641 case 1741102485: return getEndpointElement(); 642 case -786701938: return getPayloadElement(); 643 case -1221270899: return addHeaderElement(); 644 default: return super.makeProperty(hash, name); 645 } 646 647 } 648 649 @Override 650 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 651 switch (hash) { 652 case 3575610: /*type*/ return new String[] {"code"}; 653 case 1741102485: /*endpoint*/ return new String[] {"uri"}; 654 case -786701938: /*payload*/ return new String[] {"string"}; 655 case -1221270899: /*header*/ return new String[] {"string"}; 656 default: return super.getTypesForProperty(hash, name); 657 } 658 659 } 660 661 @Override 662 public Base addChild(String name) throws FHIRException { 663 if (name.equals("type")) { 664 throw new FHIRException("Cannot call addChild on a primitive type Subscription.type"); 665 } 666 else if (name.equals("endpoint")) { 667 throw new FHIRException("Cannot call addChild on a primitive type Subscription.endpoint"); 668 } 669 else if (name.equals("payload")) { 670 throw new FHIRException("Cannot call addChild on a primitive type Subscription.payload"); 671 } 672 else if (name.equals("header")) { 673 throw new FHIRException("Cannot call addChild on a primitive type Subscription.header"); 674 } 675 else 676 return super.addChild(name); 677 } 678 679 public SubscriptionChannelComponent copy() { 680 SubscriptionChannelComponent dst = new SubscriptionChannelComponent(); 681 copyValues(dst); 682 dst.type = type == null ? null : type.copy(); 683 dst.endpoint = endpoint == null ? null : endpoint.copy(); 684 dst.payload = payload == null ? null : payload.copy(); 685 if (header != null) { 686 dst.header = new ArrayList<StringType>(); 687 for (StringType i : header) 688 dst.header.add(i.copy()); 689 }; 690 return dst; 691 } 692 693 @Override 694 public boolean equalsDeep(Base other_) { 695 if (!super.equalsDeep(other_)) 696 return false; 697 if (!(other_ instanceof SubscriptionChannelComponent)) 698 return false; 699 SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_; 700 return compareDeep(type, o.type, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(payload, o.payload, true) 701 && compareDeep(header, o.header, true); 702 } 703 704 @Override 705 public boolean equalsShallow(Base other_) { 706 if (!super.equalsShallow(other_)) 707 return false; 708 if (!(other_ instanceof SubscriptionChannelComponent)) 709 return false; 710 SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_; 711 return compareValues(type, o.type, true) && compareValues(endpoint, o.endpoint, true) && compareValues(payload, o.payload, true) 712 && compareValues(header, o.header, true); 713 } 714 715 public boolean isEmpty() { 716 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, endpoint, payload 717 , header); 718 } 719 720 public String fhirType() { 721 return "Subscription.channel"; 722 723 } 724 725 } 726 727 /** 728 * The status of the subscription, which marks the server state for managing the subscription. 729 */ 730 @Child(name = "status", type = {CodeType.class}, order=0, min=1, max=1, modifier=true, summary=true) 731 @Description(shortDefinition="requested | active | error | off", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." ) 732 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status") 733 protected Enumeration<SubscriptionStatus> status; 734 735 /** 736 * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting. 737 */ 738 @Child(name = "contact", type = {ContactPoint.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 739 @Description(shortDefinition="Contact details for source (e.g. troubleshooting)", formalDefinition="Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting." ) 740 protected List<ContactPoint> contact; 741 742 /** 743 * The time for the server to turn the subscription off. 744 */ 745 @Child(name = "end", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true) 746 @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." ) 747 protected InstantType end; 748 749 /** 750 * A description of why this subscription is defined. 751 */ 752 @Child(name = "reason", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true) 753 @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." ) 754 protected StringType reason; 755 756 /** 757 * The rules that the server should use to determine when to generate notifications for this subscription. 758 */ 759 @Child(name = "criteria", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true) 760 @Description(shortDefinition="Rule for server push criteria", formalDefinition="The rules that the server should use to determine when to generate notifications for this subscription." ) 761 protected StringType criteria; 762 763 /** 764 * A record of the last error that occurred when the server processed a notification. 765 */ 766 @Child(name = "error", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 767 @Description(shortDefinition="Latest error note", formalDefinition="A record of the last error that occurred when the server processed a notification." ) 768 protected StringType error; 769 770 /** 771 * Details where to send notifications when resources are received that meet the criteria. 772 */ 773 @Child(name = "channel", type = {}, order=6, min=1, max=1, modifier=false, summary=true) 774 @Description(shortDefinition="The channel on which to report matches to the criteria", formalDefinition="Details where to send notifications when resources are received that meet the criteria." ) 775 protected SubscriptionChannelComponent channel; 776 777 /** 778 * A tag to add to any resource that matches the criteria, after the subscription is processed. 779 */ 780 @Child(name = "tag", type = {Coding.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 781 @Description(shortDefinition="A tag to add to matching resources", formalDefinition="A tag to add to any resource that matches the criteria, after the subscription is processed." ) 782 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-tag") 783 protected List<Coding> tag; 784 785 private static final long serialVersionUID = 99986202L; 786 787 /** 788 * Constructor 789 */ 790 public Subscription() { 791 super(); 792 } 793 794 /** 795 * Constructor 796 */ 797 public Subscription(Enumeration<SubscriptionStatus> status, StringType reason, StringType criteria, SubscriptionChannelComponent channel) { 798 super(); 799 this.status = status; 800 this.reason = reason; 801 this.criteria = criteria; 802 this.channel = channel; 803 } 804 805 /** 806 * @return {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 807 */ 808 public Enumeration<SubscriptionStatus> getStatusElement() { 809 if (this.status == null) 810 if (Configuration.errorOnAutoCreate()) 811 throw new Error("Attempt to auto-create Subscription.status"); 812 else if (Configuration.doAutoCreate()) 813 this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); // bb 814 return this.status; 815 } 816 817 public boolean hasStatusElement() { 818 return this.status != null && !this.status.isEmpty(); 819 } 820 821 public boolean hasStatus() { 822 return this.status != null && !this.status.isEmpty(); 823 } 824 825 /** 826 * @param value {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 827 */ 828 public Subscription setStatusElement(Enumeration<SubscriptionStatus> value) { 829 this.status = value; 830 return this; 831 } 832 833 /** 834 * @return The status of the subscription, which marks the server state for managing the subscription. 835 */ 836 public SubscriptionStatus getStatus() { 837 return this.status == null ? null : this.status.getValue(); 838 } 839 840 /** 841 * @param value The status of the subscription, which marks the server state for managing the subscription. 842 */ 843 public Subscription setStatus(SubscriptionStatus value) { 844 if (this.status == null) 845 this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); 846 this.status.setValue(value); 847 return this; 848 } 849 850 /** 851 * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.) 852 */ 853 public List<ContactPoint> getContact() { 854 if (this.contact == null) 855 this.contact = new ArrayList<ContactPoint>(); 856 return this.contact; 857 } 858 859 /** 860 * @return Returns a reference to <code>this</code> for easy method chaining 861 */ 862 public Subscription setContact(List<ContactPoint> theContact) { 863 this.contact = theContact; 864 return this; 865 } 866 867 public boolean hasContact() { 868 if (this.contact == null) 869 return false; 870 for (ContactPoint item : this.contact) 871 if (!item.isEmpty()) 872 return true; 873 return false; 874 } 875 876 public ContactPoint addContact() { //3 877 ContactPoint t = new ContactPoint(); 878 if (this.contact == null) 879 this.contact = new ArrayList<ContactPoint>(); 880 this.contact.add(t); 881 return t; 882 } 883 884 public Subscription addContact(ContactPoint t) { //3 885 if (t == null) 886 return this; 887 if (this.contact == null) 888 this.contact = new ArrayList<ContactPoint>(); 889 this.contact.add(t); 890 return this; 891 } 892 893 /** 894 * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist 895 */ 896 public ContactPoint getContactFirstRep() { 897 if (getContact().isEmpty()) { 898 addContact(); 899 } 900 return getContact().get(0); 901 } 902 903 /** 904 * @return {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value 905 */ 906 public InstantType getEndElement() { 907 if (this.end == null) 908 if (Configuration.errorOnAutoCreate()) 909 throw new Error("Attempt to auto-create Subscription.end"); 910 else if (Configuration.doAutoCreate()) 911 this.end = new InstantType(); // bb 912 return this.end; 913 } 914 915 public boolean hasEndElement() { 916 return this.end != null && !this.end.isEmpty(); 917 } 918 919 public boolean hasEnd() { 920 return this.end != null && !this.end.isEmpty(); 921 } 922 923 /** 924 * @param value {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value 925 */ 926 public Subscription setEndElement(InstantType value) { 927 this.end = value; 928 return this; 929 } 930 931 /** 932 * @return The time for the server to turn the subscription off. 933 */ 934 public Date getEnd() { 935 return this.end == null ? null : this.end.getValue(); 936 } 937 938 /** 939 * @param value The time for the server to turn the subscription off. 940 */ 941 public Subscription setEnd(Date value) { 942 if (value == null) 943 this.end = null; 944 else { 945 if (this.end == null) 946 this.end = new InstantType(); 947 this.end.setValue(value); 948 } 949 return this; 950 } 951 952 /** 953 * @return {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value 954 */ 955 public StringType getReasonElement() { 956 if (this.reason == null) 957 if (Configuration.errorOnAutoCreate()) 958 throw new Error("Attempt to auto-create Subscription.reason"); 959 else if (Configuration.doAutoCreate()) 960 this.reason = new StringType(); // bb 961 return this.reason; 962 } 963 964 public boolean hasReasonElement() { 965 return this.reason != null && !this.reason.isEmpty(); 966 } 967 968 public boolean hasReason() { 969 return this.reason != null && !this.reason.isEmpty(); 970 } 971 972 /** 973 * @param value {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value 974 */ 975 public Subscription setReasonElement(StringType value) { 976 this.reason = value; 977 return this; 978 } 979 980 /** 981 * @return A description of why this subscription is defined. 982 */ 983 public String getReason() { 984 return this.reason == null ? null : this.reason.getValue(); 985 } 986 987 /** 988 * @param value A description of why this subscription is defined. 989 */ 990 public Subscription setReason(String value) { 991 if (this.reason == null) 992 this.reason = new StringType(); 993 this.reason.setValue(value); 994 return this; 995 } 996 997 /** 998 * @return {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value 999 */ 1000 public StringType getCriteriaElement() { 1001 if (this.criteria == null) 1002 if (Configuration.errorOnAutoCreate()) 1003 throw new Error("Attempt to auto-create Subscription.criteria"); 1004 else if (Configuration.doAutoCreate()) 1005 this.criteria = new StringType(); // bb 1006 return this.criteria; 1007 } 1008 1009 public boolean hasCriteriaElement() { 1010 return this.criteria != null && !this.criteria.isEmpty(); 1011 } 1012 1013 public boolean hasCriteria() { 1014 return this.criteria != null && !this.criteria.isEmpty(); 1015 } 1016 1017 /** 1018 * @param value {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value 1019 */ 1020 public Subscription setCriteriaElement(StringType value) { 1021 this.criteria = value; 1022 return this; 1023 } 1024 1025 /** 1026 * @return The rules that the server should use to determine when to generate notifications for this subscription. 1027 */ 1028 public String getCriteria() { 1029 return this.criteria == null ? null : this.criteria.getValue(); 1030 } 1031 1032 /** 1033 * @param value The rules that the server should use to determine when to generate notifications for this subscription. 1034 */ 1035 public Subscription setCriteria(String value) { 1036 if (this.criteria == null) 1037 this.criteria = new StringType(); 1038 this.criteria.setValue(value); 1039 return this; 1040 } 1041 1042 /** 1043 * @return {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value 1044 */ 1045 public StringType getErrorElement() { 1046 if (this.error == null) 1047 if (Configuration.errorOnAutoCreate()) 1048 throw new Error("Attempt to auto-create Subscription.error"); 1049 else if (Configuration.doAutoCreate()) 1050 this.error = new StringType(); // bb 1051 return this.error; 1052 } 1053 1054 public boolean hasErrorElement() { 1055 return this.error != null && !this.error.isEmpty(); 1056 } 1057 1058 public boolean hasError() { 1059 return this.error != null && !this.error.isEmpty(); 1060 } 1061 1062 /** 1063 * @param value {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value 1064 */ 1065 public Subscription setErrorElement(StringType value) { 1066 this.error = value; 1067 return this; 1068 } 1069 1070 /** 1071 * @return A record of the last error that occurred when the server processed a notification. 1072 */ 1073 public String getError() { 1074 return this.error == null ? null : this.error.getValue(); 1075 } 1076 1077 /** 1078 * @param value A record of the last error that occurred when the server processed a notification. 1079 */ 1080 public Subscription setError(String value) { 1081 if (Utilities.noString(value)) 1082 this.error = null; 1083 else { 1084 if (this.error == null) 1085 this.error = new StringType(); 1086 this.error.setValue(value); 1087 } 1088 return this; 1089 } 1090 1091 /** 1092 * @return {@link #channel} (Details where to send notifications when resources are received that meet the criteria.) 1093 */ 1094 public SubscriptionChannelComponent getChannel() { 1095 if (this.channel == null) 1096 if (Configuration.errorOnAutoCreate()) 1097 throw new Error("Attempt to auto-create Subscription.channel"); 1098 else if (Configuration.doAutoCreate()) 1099 this.channel = new SubscriptionChannelComponent(); // cc 1100 return this.channel; 1101 } 1102 1103 public boolean hasChannel() { 1104 return this.channel != null && !this.channel.isEmpty(); 1105 } 1106 1107 /** 1108 * @param value {@link #channel} (Details where to send notifications when resources are received that meet the criteria.) 1109 */ 1110 public Subscription setChannel(SubscriptionChannelComponent value) { 1111 this.channel = value; 1112 return this; 1113 } 1114 1115 /** 1116 * @return {@link #tag} (A tag to add to any resource that matches the criteria, after the subscription is processed.) 1117 */ 1118 public List<Coding> getTag() { 1119 if (this.tag == null) 1120 this.tag = new ArrayList<Coding>(); 1121 return this.tag; 1122 } 1123 1124 /** 1125 * @return Returns a reference to <code>this</code> for easy method chaining 1126 */ 1127 public Subscription setTag(List<Coding> theTag) { 1128 this.tag = theTag; 1129 return this; 1130 } 1131 1132 public boolean hasTag() { 1133 if (this.tag == null) 1134 return false; 1135 for (Coding item : this.tag) 1136 if (!item.isEmpty()) 1137 return true; 1138 return false; 1139 } 1140 1141 public Coding addTag() { //3 1142 Coding t = new Coding(); 1143 if (this.tag == null) 1144 this.tag = new ArrayList<Coding>(); 1145 this.tag.add(t); 1146 return t; 1147 } 1148 1149 public Subscription addTag(Coding t) { //3 1150 if (t == null) 1151 return this; 1152 if (this.tag == null) 1153 this.tag = new ArrayList<Coding>(); 1154 this.tag.add(t); 1155 return this; 1156 } 1157 1158 /** 1159 * @return The first repetition of repeating field {@link #tag}, creating it if it does not already exist 1160 */ 1161 public Coding getTagFirstRep() { 1162 if (getTag().isEmpty()) { 1163 addTag(); 1164 } 1165 return getTag().get(0); 1166 } 1167 1168 protected void listChildren(List<Property> children) { 1169 super.listChildren(children); 1170 children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status)); 1171 children.add(new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact)); 1172 children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end)); 1173 children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason)); 1174 children.add(new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria)); 1175 children.add(new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error)); 1176 children.add(new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel)); 1177 children.add(new Property("tag", "Coding", "A tag to add to any resource that matches the criteria, after the subscription is processed.", 0, java.lang.Integer.MAX_VALUE, tag)); 1178 } 1179 1180 @Override 1181 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1182 switch (_hash) { 1183 case -892481550: /*status*/ return new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status); 1184 case 951526432: /*contact*/ return new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact); 1185 case 100571: /*end*/ return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end); 1186 case -934964668: /*reason*/ return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason); 1187 case 1952046943: /*criteria*/ return new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria); 1188 case 96784904: /*error*/ return new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error); 1189 case 738950403: /*channel*/ return new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel); 1190 case 114586: /*tag*/ return new Property("tag", "Coding", "A tag to add to any resource that matches the criteria, after the subscription is processed.", 0, java.lang.Integer.MAX_VALUE, tag); 1191 default: return super.getNamedProperty(_hash, _name, _checkValid); 1192 } 1193 1194 } 1195 1196 @Override 1197 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1198 switch (hash) { 1199 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatus> 1200 case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint 1201 case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType 1202 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType 1203 case 1952046943: /*criteria*/ return this.criteria == null ? new Base[0] : new Base[] {this.criteria}; // StringType 1204 case 96784904: /*error*/ return this.error == null ? new Base[0] : new Base[] {this.error}; // StringType 1205 case 738950403: /*channel*/ return this.channel == null ? new Base[0] : new Base[] {this.channel}; // SubscriptionChannelComponent 1206 case 114586: /*tag*/ return this.tag == null ? new Base[0] : this.tag.toArray(new Base[this.tag.size()]); // Coding 1207 default: return super.getProperty(hash, name, checkValid); 1208 } 1209 1210 } 1211 1212 @Override 1213 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1214 switch (hash) { 1215 case -892481550: // status 1216 value = new SubscriptionStatusEnumFactory().fromType(castToCode(value)); 1217 this.status = (Enumeration) value; // Enumeration<SubscriptionStatus> 1218 return value; 1219 case 951526432: // contact 1220 this.getContact().add(castToContactPoint(value)); // ContactPoint 1221 return value; 1222 case 100571: // end 1223 this.end = castToInstant(value); // InstantType 1224 return value; 1225 case -934964668: // reason 1226 this.reason = castToString(value); // StringType 1227 return value; 1228 case 1952046943: // criteria 1229 this.criteria = castToString(value); // StringType 1230 return value; 1231 case 96784904: // error 1232 this.error = castToString(value); // StringType 1233 return value; 1234 case 738950403: // channel 1235 this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent 1236 return value; 1237 case 114586: // tag 1238 this.getTag().add(castToCoding(value)); // Coding 1239 return value; 1240 default: return super.setProperty(hash, name, value); 1241 } 1242 1243 } 1244 1245 @Override 1246 public Base setProperty(String name, Base value) throws FHIRException { 1247 if (name.equals("status")) { 1248 value = new SubscriptionStatusEnumFactory().fromType(castToCode(value)); 1249 this.status = (Enumeration) value; // Enumeration<SubscriptionStatus> 1250 } else if (name.equals("contact")) { 1251 this.getContact().add(castToContactPoint(value)); 1252 } else if (name.equals("end")) { 1253 this.end = castToInstant(value); // InstantType 1254 } else if (name.equals("reason")) { 1255 this.reason = castToString(value); // StringType 1256 } else if (name.equals("criteria")) { 1257 this.criteria = castToString(value); // StringType 1258 } else if (name.equals("error")) { 1259 this.error = castToString(value); // StringType 1260 } else if (name.equals("channel")) { 1261 this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent 1262 } else if (name.equals("tag")) { 1263 this.getTag().add(castToCoding(value)); 1264 } else 1265 return super.setProperty(name, value); 1266 return value; 1267 } 1268 1269 @Override 1270 public Base makeProperty(int hash, String name) throws FHIRException { 1271 switch (hash) { 1272 case -892481550: return getStatusElement(); 1273 case 951526432: return addContact(); 1274 case 100571: return getEndElement(); 1275 case -934964668: return getReasonElement(); 1276 case 1952046943: return getCriteriaElement(); 1277 case 96784904: return getErrorElement(); 1278 case 738950403: return getChannel(); 1279 case 114586: return addTag(); 1280 default: return super.makeProperty(hash, name); 1281 } 1282 1283 } 1284 1285 @Override 1286 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1287 switch (hash) { 1288 case -892481550: /*status*/ return new String[] {"code"}; 1289 case 951526432: /*contact*/ return new String[] {"ContactPoint"}; 1290 case 100571: /*end*/ return new String[] {"instant"}; 1291 case -934964668: /*reason*/ return new String[] {"string"}; 1292 case 1952046943: /*criteria*/ return new String[] {"string"}; 1293 case 96784904: /*error*/ return new String[] {"string"}; 1294 case 738950403: /*channel*/ return new String[] {}; 1295 case 114586: /*tag*/ return new String[] {"Coding"}; 1296 default: return super.getTypesForProperty(hash, name); 1297 } 1298 1299 } 1300 1301 @Override 1302 public Base addChild(String name) throws FHIRException { 1303 if (name.equals("status")) { 1304 throw new FHIRException("Cannot call addChild on a primitive type Subscription.status"); 1305 } 1306 else if (name.equals("contact")) { 1307 return addContact(); 1308 } 1309 else if (name.equals("end")) { 1310 throw new FHIRException("Cannot call addChild on a primitive type Subscription.end"); 1311 } 1312 else if (name.equals("reason")) { 1313 throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason"); 1314 } 1315 else if (name.equals("criteria")) { 1316 throw new FHIRException("Cannot call addChild on a primitive type Subscription.criteria"); 1317 } 1318 else if (name.equals("error")) { 1319 throw new FHIRException("Cannot call addChild on a primitive type Subscription.error"); 1320 } 1321 else if (name.equals("channel")) { 1322 this.channel = new SubscriptionChannelComponent(); 1323 return this.channel; 1324 } 1325 else if (name.equals("tag")) { 1326 return addTag(); 1327 } 1328 else 1329 return super.addChild(name); 1330 } 1331 1332 public String fhirType() { 1333 return "Subscription"; 1334 1335 } 1336 1337 public Subscription copy() { 1338 Subscription dst = new Subscription(); 1339 copyValues(dst); 1340 dst.status = status == null ? null : status.copy(); 1341 if (contact != null) { 1342 dst.contact = new ArrayList<ContactPoint>(); 1343 for (ContactPoint i : contact) 1344 dst.contact.add(i.copy()); 1345 }; 1346 dst.end = end == null ? null : end.copy(); 1347 dst.reason = reason == null ? null : reason.copy(); 1348 dst.criteria = criteria == null ? null : criteria.copy(); 1349 dst.error = error == null ? null : error.copy(); 1350 dst.channel = channel == null ? null : channel.copy(); 1351 if (tag != null) { 1352 dst.tag = new ArrayList<Coding>(); 1353 for (Coding i : tag) 1354 dst.tag.add(i.copy()); 1355 }; 1356 return dst; 1357 } 1358 1359 protected Subscription typedCopy() { 1360 return copy(); 1361 } 1362 1363 @Override 1364 public boolean equalsDeep(Base other_) { 1365 if (!super.equalsDeep(other_)) 1366 return false; 1367 if (!(other_ instanceof Subscription)) 1368 return false; 1369 Subscription o = (Subscription) other_; 1370 return compareDeep(status, o.status, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true) 1371 && compareDeep(reason, o.reason, true) && compareDeep(criteria, o.criteria, true) && compareDeep(error, o.error, true) 1372 && compareDeep(channel, o.channel, true) && compareDeep(tag, o.tag, true); 1373 } 1374 1375 @Override 1376 public boolean equalsShallow(Base other_) { 1377 if (!super.equalsShallow(other_)) 1378 return false; 1379 if (!(other_ instanceof Subscription)) 1380 return false; 1381 Subscription o = (Subscription) other_; 1382 return compareValues(status, o.status, true) && compareValues(end, o.end, true) && compareValues(reason, o.reason, true) 1383 && compareValues(criteria, o.criteria, true) && compareValues(error, o.error, true); 1384 } 1385 1386 public boolean isEmpty() { 1387 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, contact, end, reason 1388 , criteria, error, channel, tag); 1389 } 1390 1391 @Override 1392 public ResourceType getResourceType() { 1393 return ResourceType.Subscription; 1394 } 1395 1396 /** 1397 * Search parameter: <b>payload</b> 1398 * <p> 1399 * Description: <b>The mime-type of the notification payload</b><br> 1400 * Type: <b>string</b><br> 1401 * Path: <b>Subscription.channel.payload</b><br> 1402 * </p> 1403 */ 1404 @SearchParamDefinition(name="payload", path="Subscription.channel.payload", description="The mime-type of the notification payload", type="string" ) 1405 public static final String SP_PAYLOAD = "payload"; 1406 /** 1407 * <b>Fluent Client</b> search parameter constant for <b>payload</b> 1408 * <p> 1409 * Description: <b>The mime-type of the notification payload</b><br> 1410 * Type: <b>string</b><br> 1411 * Path: <b>Subscription.channel.payload</b><br> 1412 * </p> 1413 */ 1414 public static final ca.uhn.fhir.rest.gclient.StringClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PAYLOAD); 1415 1416 /** 1417 * Search parameter: <b>criteria</b> 1418 * <p> 1419 * Description: <b>The search rules used to determine when to send a notification</b><br> 1420 * Type: <b>string</b><br> 1421 * Path: <b>Subscription.criteria</b><br> 1422 * </p> 1423 */ 1424 @SearchParamDefinition(name="criteria", path="Subscription.criteria", description="The search rules used to determine when to send a notification", type="string" ) 1425 public static final String SP_CRITERIA = "criteria"; 1426 /** 1427 * <b>Fluent Client</b> search parameter constant for <b>criteria</b> 1428 * <p> 1429 * Description: <b>The search rules used to determine when to send a notification</b><br> 1430 * Type: <b>string</b><br> 1431 * Path: <b>Subscription.criteria</b><br> 1432 * </p> 1433 */ 1434 public static final ca.uhn.fhir.rest.gclient.StringClientParam CRITERIA = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CRITERIA); 1435 1436 /** 1437 * Search parameter: <b>add-tag</b> 1438 * <p> 1439 * Description: <b>A tag to be added to the resource matching the criteria</b><br> 1440 * Type: <b>token</b><br> 1441 * Path: <b>Subscription.tag</b><br> 1442 * </p> 1443 */ 1444 @SearchParamDefinition(name="add-tag", path="Subscription.tag", description="A tag to be added to the resource matching the criteria", type="token" ) 1445 public static final String SP_ADD_TAG = "add-tag"; 1446 /** 1447 * <b>Fluent Client</b> search parameter constant for <b>add-tag</b> 1448 * <p> 1449 * Description: <b>A tag to be added to the resource matching the criteria</b><br> 1450 * Type: <b>token</b><br> 1451 * Path: <b>Subscription.tag</b><br> 1452 * </p> 1453 */ 1454 public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADD_TAG = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADD_TAG); 1455 1456 /** 1457 * Search parameter: <b>contact</b> 1458 * <p> 1459 * Description: <b>Contact details for the subscription</b><br> 1460 * Type: <b>token</b><br> 1461 * Path: <b>Subscription.contact</b><br> 1462 * </p> 1463 */ 1464 @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" ) 1465 public static final String SP_CONTACT = "contact"; 1466 /** 1467 * <b>Fluent Client</b> search parameter constant for <b>contact</b> 1468 * <p> 1469 * Description: <b>Contact details for the subscription</b><br> 1470 * Type: <b>token</b><br> 1471 * Path: <b>Subscription.contact</b><br> 1472 * </p> 1473 */ 1474 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT); 1475 1476 /** 1477 * Search parameter: <b>type</b> 1478 * <p> 1479 * Description: <b>The type of channel for the sent notifications</b><br> 1480 * Type: <b>token</b><br> 1481 * Path: <b>Subscription.channel.type</b><br> 1482 * </p> 1483 */ 1484 @SearchParamDefinition(name="type", path="Subscription.channel.type", description="The type of channel for the sent notifications", type="token" ) 1485 public static final String SP_TYPE = "type"; 1486 /** 1487 * <b>Fluent Client</b> search parameter constant for <b>type</b> 1488 * <p> 1489 * Description: <b>The type of channel for the sent notifications</b><br> 1490 * Type: <b>token</b><br> 1491 * Path: <b>Subscription.channel.type</b><br> 1492 * </p> 1493 */ 1494 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 1495 1496 /** 1497 * Search parameter: <b>url</b> 1498 * <p> 1499 * Description: <b>The uri that will receive the notifications</b><br> 1500 * Type: <b>uri</b><br> 1501 * Path: <b>Subscription.channel.endpoint</b><br> 1502 * </p> 1503 */ 1504 @SearchParamDefinition(name="url", path="Subscription.channel.endpoint", description="The uri that will receive the notifications", type="uri" ) 1505 public static final String SP_URL = "url"; 1506 /** 1507 * <b>Fluent Client</b> search parameter constant for <b>url</b> 1508 * <p> 1509 * Description: <b>The uri that will receive the notifications</b><br> 1510 * Type: <b>uri</b><br> 1511 * Path: <b>Subscription.channel.endpoint</b><br> 1512 * </p> 1513 */ 1514 public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL); 1515 1516 /** 1517 * Search parameter: <b>status</b> 1518 * <p> 1519 * Description: <b>The current state of the subscription</b><br> 1520 * Type: <b>token</b><br> 1521 * Path: <b>Subscription.status</b><br> 1522 * </p> 1523 */ 1524 @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" ) 1525 public static final String SP_STATUS = "status"; 1526 /** 1527 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1528 * <p> 1529 * Description: <b>The current state of the subscription</b><br> 1530 * Type: <b>token</b><br> 1531 * Path: <b>Subscription.status</b><br> 1532 * </p> 1533 */ 1534 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1535 1536 1537} 1538