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