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