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