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