001package org.hl7.fhir.r4.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 Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import org.hl7.fhir.r4.model.Enumerations.*; 038import ca.uhn.fhir.model.api.annotation.ResourceDef; 039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.ChildOrder; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.Block; 044import org.hl7.fhir.instance.model.api.*; 045import org.hl7.fhir.exceptions.FHIRException; 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 can 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 url that describes the actual end-point to send messages to. 328 */ 329 @Child(name = "endpoint", type = {UrlType.class}, order=2, min=0, max=1, modifier=false, summary=true) 330 @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." ) 331 protected UrlType 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. The mime type "text/plain" may also be used for Email and SMS subscriptions. 335 */ 336 @Child(name = "payload", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true) 337 @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." ) 338 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes") 339 protected CodeType payload; 340 341 /** 342 * Additional headers / information to send as part of the notification. 343 */ 344 @Child(name = "header", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 345 @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." ) 346 protected List<StringType> header; 347 348 private static final long serialVersionUID = -771044852L; 349 350 /** 351 * Constructor 352 */ 353 public SubscriptionChannelComponent() { 354 super(); 355 } 356 357 /** 358 * Constructor 359 */ 360 public SubscriptionChannelComponent(Enumeration<SubscriptionChannelType> type) { 361 super(); 362 this.type = type; 363 } 364 365 /** 366 * @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 367 */ 368 public Enumeration<SubscriptionChannelType> getTypeElement() { 369 if (this.type == null) 370 if (Configuration.errorOnAutoCreate()) 371 throw new Error("Attempt to auto-create SubscriptionChannelComponent.type"); 372 else if (Configuration.doAutoCreate()) 373 this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); // bb 374 return this.type; 375 } 376 377 public boolean hasTypeElement() { 378 return this.type != null && !this.type.isEmpty(); 379 } 380 381 public boolean hasType() { 382 return this.type != null && !this.type.isEmpty(); 383 } 384 385 /** 386 * @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 387 */ 388 public SubscriptionChannelComponent setTypeElement(Enumeration<SubscriptionChannelType> value) { 389 this.type = value; 390 return this; 391 } 392 393 /** 394 * @return The type of channel to send notifications on. 395 */ 396 public SubscriptionChannelType getType() { 397 return this.type == null ? null : this.type.getValue(); 398 } 399 400 /** 401 * @param value The type of channel to send notifications on. 402 */ 403 public SubscriptionChannelComponent setType(SubscriptionChannelType value) { 404 if (this.type == null) 405 this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); 406 this.type.setValue(value); 407 return this; 408 } 409 410 /** 411 * @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 412 */ 413 public UrlType getEndpointElement() { 414 if (this.endpoint == null) 415 if (Configuration.errorOnAutoCreate()) 416 throw new Error("Attempt to auto-create SubscriptionChannelComponent.endpoint"); 417 else if (Configuration.doAutoCreate()) 418 this.endpoint = new UrlType(); // bb 419 return this.endpoint; 420 } 421 422 public boolean hasEndpointElement() { 423 return this.endpoint != null && !this.endpoint.isEmpty(); 424 } 425 426 public boolean hasEndpoint() { 427 return this.endpoint != null && !this.endpoint.isEmpty(); 428 } 429 430 /** 431 * @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 432 */ 433 public SubscriptionChannelComponent setEndpointElement(UrlType value) { 434 this.endpoint = value; 435 return this; 436 } 437 438 /** 439 * @return The url that describes the actual end-point to send messages to. 440 */ 441 public String getEndpoint() { 442 return this.endpoint == null ? null : this.endpoint.getValue(); 443 } 444 445 /** 446 * @param value The url that describes the actual end-point to send messages to. 447 */ 448 public SubscriptionChannelComponent setEndpoint(String value) { 449 if (Utilities.noString(value)) 450 this.endpoint = null; 451 else { 452 if (this.endpoint == null) 453 this.endpoint = new UrlType(); 454 this.endpoint.setValue(value); 455 } 456 return this; 457 } 458 459 /** 460 * @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 461 */ 462 public CodeType getPayloadElement() { 463 if (this.payload == null) 464 if (Configuration.errorOnAutoCreate()) 465 throw new Error("Attempt to auto-create SubscriptionChannelComponent.payload"); 466 else if (Configuration.doAutoCreate()) 467 this.payload = new CodeType(); // bb 468 return this.payload; 469 } 470 471 public boolean hasPayloadElement() { 472 return this.payload != null && !this.payload.isEmpty(); 473 } 474 475 public boolean hasPayload() { 476 return this.payload != null && !this.payload.isEmpty(); 477 } 478 479 /** 480 * @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 481 */ 482 public SubscriptionChannelComponent setPayloadElement(CodeType value) { 483 this.payload = value; 484 return this; 485 } 486 487 /** 488 * @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. 489 */ 490 public String getPayload() { 491 return this.payload == null ? null : this.payload.getValue(); 492 } 493 494 /** 495 * @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. 496 */ 497 public SubscriptionChannelComponent setPayload(String value) { 498 if (Utilities.noString(value)) 499 this.payload = null; 500 else { 501 if (this.payload == null) 502 this.payload = new CodeType(); 503 this.payload.setValue(value); 504 } 505 return this; 506 } 507 508 /** 509 * @return {@link #header} (Additional headers / information to send as part of the notification.) 510 */ 511 public List<StringType> getHeader() { 512 if (this.header == null) 513 this.header = new ArrayList<StringType>(); 514 return this.header; 515 } 516 517 /** 518 * @return Returns a reference to <code>this</code> for easy method chaining 519 */ 520 public SubscriptionChannelComponent setHeader(List<StringType> theHeader) { 521 this.header = theHeader; 522 return this; 523 } 524 525 public boolean hasHeader() { 526 if (this.header == null) 527 return false; 528 for (StringType item : this.header) 529 if (!item.isEmpty()) 530 return true; 531 return false; 532 } 533 534 /** 535 * @return {@link #header} (Additional headers / information to send as part of the notification.) 536 */ 537 public StringType addHeaderElement() {//2 538 StringType t = new StringType(); 539 if (this.header == null) 540 this.header = new ArrayList<StringType>(); 541 this.header.add(t); 542 return t; 543 } 544 545 /** 546 * @param value {@link #header} (Additional headers / information to send as part of the notification.) 547 */ 548 public SubscriptionChannelComponent addHeader(String value) { //1 549 StringType t = new StringType(); 550 t.setValue(value); 551 if (this.header == null) 552 this.header = new ArrayList<StringType>(); 553 this.header.add(t); 554 return this; 555 } 556 557 /** 558 * @param value {@link #header} (Additional headers / information to send as part of the notification.) 559 */ 560 public boolean hasHeader(String value) { 561 if (this.header == null) 562 return false; 563 for (StringType v : this.header) 564 if (v.getValue().equals(value)) // string 565 return true; 566 return false; 567 } 568 569 protected void listChildren(List<Property> children) { 570 super.listChildren(children); 571 children.add(new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type)); 572 children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint)); 573 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)); 574 children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header)); 575 } 576 577 @Override 578 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 579 switch (_hash) { 580 case 3575610: /*type*/ return new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type); 581 case 1741102485: /*endpoint*/ return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint); 582 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); 583 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); 584 default: return super.getNamedProperty(_hash, _name, _checkValid); 585 } 586 587 } 588 589 @Override 590 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 591 switch (hash) { 592 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SubscriptionChannelType> 593 case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType 594 case -786701938: /*payload*/ return this.payload == null ? new Base[0] : new Base[] {this.payload}; // CodeType 595 case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType 596 default: return super.getProperty(hash, name, checkValid); 597 } 598 599 } 600 601 @Override 602 public Base setProperty(int hash, String name, Base value) throws FHIRException { 603 switch (hash) { 604 case 3575610: // type 605 value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value)); 606 this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType> 607 return value; 608 case 1741102485: // endpoint 609 this.endpoint = castToUrl(value); // UrlType 610 return value; 611 case -786701938: // payload 612 this.payload = castToCode(value); // CodeType 613 return value; 614 case -1221270899: // header 615 this.getHeader().add(castToString(value)); // StringType 616 return value; 617 default: return super.setProperty(hash, name, value); 618 } 619 620 } 621 622 @Override 623 public Base setProperty(String name, Base value) throws FHIRException { 624 if (name.equals("type")) { 625 value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value)); 626 this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType> 627 } else if (name.equals("endpoint")) { 628 this.endpoint = castToUrl(value); // UrlType 629 } else if (name.equals("payload")) { 630 this.payload = castToCode(value); // CodeType 631 } else if (name.equals("header")) { 632 this.getHeader().add(castToString(value)); 633 } else 634 return super.setProperty(name, value); 635 return value; 636 } 637 638 @Override 639 public Base makeProperty(int hash, String name) throws FHIRException { 640 switch (hash) { 641 case 3575610: return getTypeElement(); 642 case 1741102485: return getEndpointElement(); 643 case -786701938: return getPayloadElement(); 644 case -1221270899: return addHeaderElement(); 645 default: return super.makeProperty(hash, name); 646 } 647 648 } 649 650 @Override 651 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 652 switch (hash) { 653 case 3575610: /*type*/ return new String[] {"code"}; 654 case 1741102485: /*endpoint*/ return new String[] {"url"}; 655 case -786701938: /*payload*/ return new String[] {"code"}; 656 case -1221270899: /*header*/ return new String[] {"string"}; 657 default: return super.getTypesForProperty(hash, name); 658 } 659 660 } 661 662 @Override 663 public Base addChild(String name) throws FHIRException { 664 if (name.equals("type")) { 665 throw new FHIRException("Cannot call addChild on a primitive type Subscription.type"); 666 } 667 else if (name.equals("endpoint")) { 668 throw new FHIRException("Cannot call addChild on a primitive type Subscription.endpoint"); 669 } 670 else if (name.equals("payload")) { 671 throw new FHIRException("Cannot call addChild on a primitive type Subscription.payload"); 672 } 673 else if (name.equals("header")) { 674 throw new FHIRException("Cannot call addChild on a primitive type Subscription.header"); 675 } 676 else 677 return super.addChild(name); 678 } 679 680 public SubscriptionChannelComponent copy() { 681 SubscriptionChannelComponent dst = new SubscriptionChannelComponent(); 682 copyValues(dst); 683 dst.type = type == null ? null : type.copy(); 684 dst.endpoint = endpoint == null ? null : endpoint.copy(); 685 dst.payload = payload == null ? null : payload.copy(); 686 if (header != null) { 687 dst.header = new ArrayList<StringType>(); 688 for (StringType i : header) 689 dst.header.add(i.copy()); 690 }; 691 return dst; 692 } 693 694 @Override 695 public boolean equalsDeep(Base other_) { 696 if (!super.equalsDeep(other_)) 697 return false; 698 if (!(other_ instanceof SubscriptionChannelComponent)) 699 return false; 700 SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_; 701 return compareDeep(type, o.type, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(payload, o.payload, true) 702 && compareDeep(header, o.header, true); 703 } 704 705 @Override 706 public boolean equalsShallow(Base other_) { 707 if (!super.equalsShallow(other_)) 708 return false; 709 if (!(other_ instanceof SubscriptionChannelComponent)) 710 return false; 711 SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_; 712 return compareValues(type, o.type, true) && compareValues(endpoint, o.endpoint, true) && compareValues(payload, o.payload, true) 713 && compareValues(header, o.header, true); 714 } 715 716 public boolean isEmpty() { 717 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, endpoint, payload 718 , header); 719 } 720 721 public String fhirType() { 722 return "Subscription.channel"; 723 724 } 725 726 } 727 728 /** 729 * The status of the subscription, which marks the server state for managing the subscription. 730 */ 731 @Child(name = "status", type = {CodeType.class}, order=0, min=1, max=1, modifier=true, summary=true) 732 @Description(shortDefinition="requested | active | error | off", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." ) 733 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status") 734 protected Enumeration<SubscriptionStatus> status; 735 736 /** 737 * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting. 738 */ 739 @Child(name = "contact", type = {ContactPoint.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 740 @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." ) 741 protected List<ContactPoint> contact; 742 743 /** 744 * The time for the server to turn the subscription off. 745 */ 746 @Child(name = "end", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true) 747 @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." ) 748 protected InstantType end; 749 750 /** 751 * A description of why this subscription is defined. 752 */ 753 @Child(name = "reason", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true) 754 @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." ) 755 protected StringType reason; 756 757 /** 758 * The rules that the server should use to determine when to generate notifications for this subscription. 759 */ 760 @Child(name = "criteria", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true) 761 @Description(shortDefinition="Rule for server push", formalDefinition="The rules that the server should use to determine when to generate notifications for this subscription." ) 762 protected StringType criteria; 763 764 /** 765 * A record of the last error that occurred when the server processed a notification. 766 */ 767 @Child(name = "error", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 768 @Description(shortDefinition="Latest error note", formalDefinition="A record of the last error that occurred when the server processed a notification." ) 769 protected StringType error; 770 771 /** 772 * Details where to send notifications when resources are received that meet the criteria. 773 */ 774 @Child(name = "channel", type = {}, order=6, min=1, max=1, modifier=false, summary=true) 775 @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." ) 776 protected SubscriptionChannelComponent channel; 777 778 private static final long serialVersionUID = 1072504988L; 779 780 /** 781 * Constructor 782 */ 783 public Subscription() { 784 super(); 785 } 786 787 /** 788 * Constructor 789 */ 790 public Subscription(Enumeration<SubscriptionStatus> status, StringType reason, StringType criteria, SubscriptionChannelComponent channel) { 791 super(); 792 this.status = status; 793 this.reason = reason; 794 this.criteria = criteria; 795 this.channel = channel; 796 } 797 798 /** 799 * @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 800 */ 801 public Enumeration<SubscriptionStatus> getStatusElement() { 802 if (this.status == null) 803 if (Configuration.errorOnAutoCreate()) 804 throw new Error("Attempt to auto-create Subscription.status"); 805 else if (Configuration.doAutoCreate()) 806 this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); // bb 807 return this.status; 808 } 809 810 public boolean hasStatusElement() { 811 return this.status != null && !this.status.isEmpty(); 812 } 813 814 public boolean hasStatus() { 815 return this.status != null && !this.status.isEmpty(); 816 } 817 818 /** 819 * @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 820 */ 821 public Subscription setStatusElement(Enumeration<SubscriptionStatus> value) { 822 this.status = value; 823 return this; 824 } 825 826 /** 827 * @return The status of the subscription, which marks the server state for managing the subscription. 828 */ 829 public SubscriptionStatus getStatus() { 830 return this.status == null ? null : this.status.getValue(); 831 } 832 833 /** 834 * @param value The status of the subscription, which marks the server state for managing the subscription. 835 */ 836 public Subscription setStatus(SubscriptionStatus value) { 837 if (this.status == null) 838 this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); 839 this.status.setValue(value); 840 return this; 841 } 842 843 /** 844 * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.) 845 */ 846 public List<ContactPoint> getContact() { 847 if (this.contact == null) 848 this.contact = new ArrayList<ContactPoint>(); 849 return this.contact; 850 } 851 852 /** 853 * @return Returns a reference to <code>this</code> for easy method chaining 854 */ 855 public Subscription setContact(List<ContactPoint> theContact) { 856 this.contact = theContact; 857 return this; 858 } 859 860 public boolean hasContact() { 861 if (this.contact == null) 862 return false; 863 for (ContactPoint item : this.contact) 864 if (!item.isEmpty()) 865 return true; 866 return false; 867 } 868 869 public ContactPoint addContact() { //3 870 ContactPoint t = new ContactPoint(); 871 if (this.contact == null) 872 this.contact = new ArrayList<ContactPoint>(); 873 this.contact.add(t); 874 return t; 875 } 876 877 public Subscription addContact(ContactPoint t) { //3 878 if (t == null) 879 return this; 880 if (this.contact == null) 881 this.contact = new ArrayList<ContactPoint>(); 882 this.contact.add(t); 883 return this; 884 } 885 886 /** 887 * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist 888 */ 889 public ContactPoint getContactFirstRep() { 890 if (getContact().isEmpty()) { 891 addContact(); 892 } 893 return getContact().get(0); 894 } 895 896 /** 897 * @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 898 */ 899 public InstantType getEndElement() { 900 if (this.end == null) 901 if (Configuration.errorOnAutoCreate()) 902 throw new Error("Attempt to auto-create Subscription.end"); 903 else if (Configuration.doAutoCreate()) 904 this.end = new InstantType(); // bb 905 return this.end; 906 } 907 908 public boolean hasEndElement() { 909 return this.end != null && !this.end.isEmpty(); 910 } 911 912 public boolean hasEnd() { 913 return this.end != null && !this.end.isEmpty(); 914 } 915 916 /** 917 * @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 918 */ 919 public Subscription setEndElement(InstantType value) { 920 this.end = value; 921 return this; 922 } 923 924 /** 925 * @return The time for the server to turn the subscription off. 926 */ 927 public Date getEnd() { 928 return this.end == null ? null : this.end.getValue(); 929 } 930 931 /** 932 * @param value The time for the server to turn the subscription off. 933 */ 934 public Subscription setEnd(Date value) { 935 if (value == null) 936 this.end = null; 937 else { 938 if (this.end == null) 939 this.end = new InstantType(); 940 this.end.setValue(value); 941 } 942 return this; 943 } 944 945 /** 946 * @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 947 */ 948 public StringType getReasonElement() { 949 if (this.reason == null) 950 if (Configuration.errorOnAutoCreate()) 951 throw new Error("Attempt to auto-create Subscription.reason"); 952 else if (Configuration.doAutoCreate()) 953 this.reason = new StringType(); // bb 954 return this.reason; 955 } 956 957 public boolean hasReasonElement() { 958 return this.reason != null && !this.reason.isEmpty(); 959 } 960 961 public boolean hasReason() { 962 return this.reason != null && !this.reason.isEmpty(); 963 } 964 965 /** 966 * @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 967 */ 968 public Subscription setReasonElement(StringType value) { 969 this.reason = value; 970 return this; 971 } 972 973 /** 974 * @return A description of why this subscription is defined. 975 */ 976 public String getReason() { 977 return this.reason == null ? null : this.reason.getValue(); 978 } 979 980 /** 981 * @param value A description of why this subscription is defined. 982 */ 983 public Subscription setReason(String value) { 984 if (this.reason == null) 985 this.reason = new StringType(); 986 this.reason.setValue(value); 987 return this; 988 } 989 990 /** 991 * @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 992 */ 993 public StringType getCriteriaElement() { 994 if (this.criteria == null) 995 if (Configuration.errorOnAutoCreate()) 996 throw new Error("Attempt to auto-create Subscription.criteria"); 997 else if (Configuration.doAutoCreate()) 998 this.criteria = new StringType(); // bb 999 return this.criteria; 1000 } 1001 1002 public boolean hasCriteriaElement() { 1003 return this.criteria != null && !this.criteria.isEmpty(); 1004 } 1005 1006 public boolean hasCriteria() { 1007 return this.criteria != null && !this.criteria.isEmpty(); 1008 } 1009 1010 /** 1011 * @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 1012 */ 1013 public Subscription setCriteriaElement(StringType value) { 1014 this.criteria = value; 1015 return this; 1016 } 1017 1018 /** 1019 * @return The rules that the server should use to determine when to generate notifications for this subscription. 1020 */ 1021 public String getCriteria() { 1022 return this.criteria == null ? null : this.criteria.getValue(); 1023 } 1024 1025 /** 1026 * @param value The rules that the server should use to determine when to generate notifications for this subscription. 1027 */ 1028 public Subscription setCriteria(String value) { 1029 if (this.criteria == null) 1030 this.criteria = new StringType(); 1031 this.criteria.setValue(value); 1032 return this; 1033 } 1034 1035 /** 1036 * @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 1037 */ 1038 public StringType getErrorElement() { 1039 if (this.error == null) 1040 if (Configuration.errorOnAutoCreate()) 1041 throw new Error("Attempt to auto-create Subscription.error"); 1042 else if (Configuration.doAutoCreate()) 1043 this.error = new StringType(); // bb 1044 return this.error; 1045 } 1046 1047 public boolean hasErrorElement() { 1048 return this.error != null && !this.error.isEmpty(); 1049 } 1050 1051 public boolean hasError() { 1052 return this.error != null && !this.error.isEmpty(); 1053 } 1054 1055 /** 1056 * @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 1057 */ 1058 public Subscription setErrorElement(StringType value) { 1059 this.error = value; 1060 return this; 1061 } 1062 1063 /** 1064 * @return A record of the last error that occurred when the server processed a notification. 1065 */ 1066 public String getError() { 1067 return this.error == null ? null : this.error.getValue(); 1068 } 1069 1070 /** 1071 * @param value A record of the last error that occurred when the server processed a notification. 1072 */ 1073 public Subscription setError(String value) { 1074 if (Utilities.noString(value)) 1075 this.error = null; 1076 else { 1077 if (this.error == null) 1078 this.error = new StringType(); 1079 this.error.setValue(value); 1080 } 1081 return this; 1082 } 1083 1084 /** 1085 * @return {@link #channel} (Details where to send notifications when resources are received that meet the criteria.) 1086 */ 1087 public SubscriptionChannelComponent getChannel() { 1088 if (this.channel == null) 1089 if (Configuration.errorOnAutoCreate()) 1090 throw new Error("Attempt to auto-create Subscription.channel"); 1091 else if (Configuration.doAutoCreate()) 1092 this.channel = new SubscriptionChannelComponent(); // cc 1093 return this.channel; 1094 } 1095 1096 public boolean hasChannel() { 1097 return this.channel != null && !this.channel.isEmpty(); 1098 } 1099 1100 /** 1101 * @param value {@link #channel} (Details where to send notifications when resources are received that meet the criteria.) 1102 */ 1103 public Subscription setChannel(SubscriptionChannelComponent value) { 1104 this.channel = value; 1105 return this; 1106 } 1107 1108 protected void listChildren(List<Property> children) { 1109 super.listChildren(children); 1110 children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status)); 1111 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)); 1112 children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end)); 1113 children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason)); 1114 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)); 1115 children.add(new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error)); 1116 children.add(new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel)); 1117 } 1118 1119 @Override 1120 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1121 switch (_hash) { 1122 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); 1123 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); 1124 case 100571: /*end*/ return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end); 1125 case -934964668: /*reason*/ return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason); 1126 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); 1127 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); 1128 case 738950403: /*channel*/ return new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel); 1129 default: return super.getNamedProperty(_hash, _name, _checkValid); 1130 } 1131 1132 } 1133 1134 @Override 1135 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1136 switch (hash) { 1137 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatus> 1138 case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint 1139 case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType 1140 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType 1141 case 1952046943: /*criteria*/ return this.criteria == null ? new Base[0] : new Base[] {this.criteria}; // StringType 1142 case 96784904: /*error*/ return this.error == null ? new Base[0] : new Base[] {this.error}; // StringType 1143 case 738950403: /*channel*/ return this.channel == null ? new Base[0] : new Base[] {this.channel}; // SubscriptionChannelComponent 1144 default: return super.getProperty(hash, name, checkValid); 1145 } 1146 1147 } 1148 1149 @Override 1150 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1151 switch (hash) { 1152 case -892481550: // status 1153 value = new SubscriptionStatusEnumFactory().fromType(castToCode(value)); 1154 this.status = (Enumeration) value; // Enumeration<SubscriptionStatus> 1155 return value; 1156 case 951526432: // contact 1157 this.getContact().add(castToContactPoint(value)); // ContactPoint 1158 return value; 1159 case 100571: // end 1160 this.end = castToInstant(value); // InstantType 1161 return value; 1162 case -934964668: // reason 1163 this.reason = castToString(value); // StringType 1164 return value; 1165 case 1952046943: // criteria 1166 this.criteria = castToString(value); // StringType 1167 return value; 1168 case 96784904: // error 1169 this.error = castToString(value); // StringType 1170 return value; 1171 case 738950403: // channel 1172 this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent 1173 return value; 1174 default: return super.setProperty(hash, name, value); 1175 } 1176 1177 } 1178 1179 @Override 1180 public Base setProperty(String name, Base value) throws FHIRException { 1181 if (name.equals("status")) { 1182 value = new SubscriptionStatusEnumFactory().fromType(castToCode(value)); 1183 this.status = (Enumeration) value; // Enumeration<SubscriptionStatus> 1184 } else if (name.equals("contact")) { 1185 this.getContact().add(castToContactPoint(value)); 1186 } else if (name.equals("end")) { 1187 this.end = castToInstant(value); // InstantType 1188 } else if (name.equals("reason")) { 1189 this.reason = castToString(value); // StringType 1190 } else if (name.equals("criteria")) { 1191 this.criteria = castToString(value); // StringType 1192 } else if (name.equals("error")) { 1193 this.error = castToString(value); // StringType 1194 } else if (name.equals("channel")) { 1195 this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent 1196 } else 1197 return super.setProperty(name, value); 1198 return value; 1199 } 1200 1201 @Override 1202 public Base makeProperty(int hash, String name) throws FHIRException { 1203 switch (hash) { 1204 case -892481550: return getStatusElement(); 1205 case 951526432: return addContact(); 1206 case 100571: return getEndElement(); 1207 case -934964668: return getReasonElement(); 1208 case 1952046943: return getCriteriaElement(); 1209 case 96784904: return getErrorElement(); 1210 case 738950403: return getChannel(); 1211 default: return super.makeProperty(hash, name); 1212 } 1213 1214 } 1215 1216 @Override 1217 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1218 switch (hash) { 1219 case -892481550: /*status*/ return new String[] {"code"}; 1220 case 951526432: /*contact*/ return new String[] {"ContactPoint"}; 1221 case 100571: /*end*/ return new String[] {"instant"}; 1222 case -934964668: /*reason*/ return new String[] {"string"}; 1223 case 1952046943: /*criteria*/ return new String[] {"string"}; 1224 case 96784904: /*error*/ return new String[] {"string"}; 1225 case 738950403: /*channel*/ return new String[] {}; 1226 default: return super.getTypesForProperty(hash, name); 1227 } 1228 1229 } 1230 1231 @Override 1232 public Base addChild(String name) throws FHIRException { 1233 if (name.equals("status")) { 1234 throw new FHIRException("Cannot call addChild on a primitive type Subscription.status"); 1235 } 1236 else if (name.equals("contact")) { 1237 return addContact(); 1238 } 1239 else if (name.equals("end")) { 1240 throw new FHIRException("Cannot call addChild on a primitive type Subscription.end"); 1241 } 1242 else if (name.equals("reason")) { 1243 throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason"); 1244 } 1245 else if (name.equals("criteria")) { 1246 throw new FHIRException("Cannot call addChild on a primitive type Subscription.criteria"); 1247 } 1248 else if (name.equals("error")) { 1249 throw new FHIRException("Cannot call addChild on a primitive type Subscription.error"); 1250 } 1251 else if (name.equals("channel")) { 1252 this.channel = new SubscriptionChannelComponent(); 1253 return this.channel; 1254 } 1255 else 1256 return super.addChild(name); 1257 } 1258 1259 public String fhirType() { 1260 return "Subscription"; 1261 1262 } 1263 1264 public Subscription copy() { 1265 Subscription dst = new Subscription(); 1266 copyValues(dst); 1267 dst.status = status == null ? null : status.copy(); 1268 if (contact != null) { 1269 dst.contact = new ArrayList<ContactPoint>(); 1270 for (ContactPoint i : contact) 1271 dst.contact.add(i.copy()); 1272 }; 1273 dst.end = end == null ? null : end.copy(); 1274 dst.reason = reason == null ? null : reason.copy(); 1275 dst.criteria = criteria == null ? null : criteria.copy(); 1276 dst.error = error == null ? null : error.copy(); 1277 dst.channel = channel == null ? null : channel.copy(); 1278 return dst; 1279 } 1280 1281 protected Subscription typedCopy() { 1282 return copy(); 1283 } 1284 1285 @Override 1286 public boolean equalsDeep(Base other_) { 1287 if (!super.equalsDeep(other_)) 1288 return false; 1289 if (!(other_ instanceof Subscription)) 1290 return false; 1291 Subscription o = (Subscription) other_; 1292 return compareDeep(status, o.status, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true) 1293 && compareDeep(reason, o.reason, true) && compareDeep(criteria, o.criteria, true) && compareDeep(error, o.error, true) 1294 && compareDeep(channel, o.channel, true); 1295 } 1296 1297 @Override 1298 public boolean equalsShallow(Base other_) { 1299 if (!super.equalsShallow(other_)) 1300 return false; 1301 if (!(other_ instanceof Subscription)) 1302 return false; 1303 Subscription o = (Subscription) other_; 1304 return compareValues(status, o.status, true) && compareValues(end, o.end, true) && compareValues(reason, o.reason, true) 1305 && compareValues(criteria, o.criteria, true) && compareValues(error, o.error, true); 1306 } 1307 1308 public boolean isEmpty() { 1309 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, contact, end, reason 1310 , criteria, error, channel); 1311 } 1312 1313 @Override 1314 public ResourceType getResourceType() { 1315 return ResourceType.Subscription; 1316 } 1317 1318 /** 1319 * Search parameter: <b>payload</b> 1320 * <p> 1321 * Description: <b>The mime-type of the notification payload</b><br> 1322 * Type: <b>token</b><br> 1323 * Path: <b>Subscription.channel.payload</b><br> 1324 * </p> 1325 */ 1326 @SearchParamDefinition(name="payload", path="Subscription.channel.payload", description="The mime-type of the notification payload", type="token" ) 1327 public static final String SP_PAYLOAD = "payload"; 1328 /** 1329 * <b>Fluent Client</b> search parameter constant for <b>payload</b> 1330 * <p> 1331 * Description: <b>The mime-type of the notification payload</b><br> 1332 * Type: <b>token</b><br> 1333 * Path: <b>Subscription.channel.payload</b><br> 1334 * </p> 1335 */ 1336 public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD); 1337 1338 /** 1339 * Search parameter: <b>criteria</b> 1340 * <p> 1341 * Description: <b>The search rules used to determine when to send a notification</b><br> 1342 * Type: <b>string</b><br> 1343 * Path: <b>Subscription.criteria</b><br> 1344 * </p> 1345 */ 1346 @SearchParamDefinition(name="criteria", path="Subscription.criteria", description="The search rules used to determine when to send a notification", type="string" ) 1347 public static final String SP_CRITERIA = "criteria"; 1348 /** 1349 * <b>Fluent Client</b> search parameter constant for <b>criteria</b> 1350 * <p> 1351 * Description: <b>The search rules used to determine when to send a notification</b><br> 1352 * Type: <b>string</b><br> 1353 * Path: <b>Subscription.criteria</b><br> 1354 * </p> 1355 */ 1356 public static final ca.uhn.fhir.rest.gclient.StringClientParam CRITERIA = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CRITERIA); 1357 1358 /** 1359 * Search parameter: <b>contact</b> 1360 * <p> 1361 * Description: <b>Contact details for the subscription</b><br> 1362 * Type: <b>token</b><br> 1363 * Path: <b>Subscription.contact</b><br> 1364 * </p> 1365 */ 1366 @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" ) 1367 public static final String SP_CONTACT = "contact"; 1368 /** 1369 * <b>Fluent Client</b> search parameter constant for <b>contact</b> 1370 * <p> 1371 * Description: <b>Contact details for the subscription</b><br> 1372 * Type: <b>token</b><br> 1373 * Path: <b>Subscription.contact</b><br> 1374 * </p> 1375 */ 1376 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT); 1377 1378 /** 1379 * Search parameter: <b>type</b> 1380 * <p> 1381 * Description: <b>The type of channel for the sent notifications</b><br> 1382 * Type: <b>token</b><br> 1383 * Path: <b>Subscription.channel.type</b><br> 1384 * </p> 1385 */ 1386 @SearchParamDefinition(name="type", path="Subscription.channel.type", description="The type of channel for the sent notifications", type="token" ) 1387 public static final String SP_TYPE = "type"; 1388 /** 1389 * <b>Fluent Client</b> search parameter constant for <b>type</b> 1390 * <p> 1391 * Description: <b>The type of channel for the sent notifications</b><br> 1392 * Type: <b>token</b><br> 1393 * Path: <b>Subscription.channel.type</b><br> 1394 * </p> 1395 */ 1396 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 1397 1398 /** 1399 * Search parameter: <b>url</b> 1400 * <p> 1401 * Description: <b>The uri that will receive the notifications</b><br> 1402 * Type: <b>uri</b><br> 1403 * Path: <b>Subscription.channel.endpoint</b><br> 1404 * </p> 1405 */ 1406 @SearchParamDefinition(name="url", path="Subscription.channel.endpoint", description="The uri that will receive the notifications", type="uri" ) 1407 public static final String SP_URL = "url"; 1408 /** 1409 * <b>Fluent Client</b> search parameter constant for <b>url</b> 1410 * <p> 1411 * Description: <b>The uri that will receive the notifications</b><br> 1412 * Type: <b>uri</b><br> 1413 * Path: <b>Subscription.channel.endpoint</b><br> 1414 * </p> 1415 */ 1416 public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL); 1417 1418 /** 1419 * Search parameter: <b>status</b> 1420 * <p> 1421 * Description: <b>The current state of the subscription</b><br> 1422 * Type: <b>token</b><br> 1423 * Path: <b>Subscription.status</b><br> 1424 * </p> 1425 */ 1426 @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" ) 1427 public static final String SP_STATUS = "status"; 1428 /** 1429 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1430 * <p> 1431 * Description: <b>The current state of the subscription</b><br> 1432 * Type: <b>token</b><br> 1433 * Path: <b>Subscription.status</b><br> 1434 * </p> 1435 */ 1436 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1437 1438 1439} 1440