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