001package org.hl7.fhir.r4b.model; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r4b.model.Enumerations.*; 039import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.ChildOrder; 047import ca.uhn.fhir.model.api.annotation.Description; 048import ca.uhn.fhir.model.api.annotation.Block; 049 050/** 051 * The SubscriptionStatus resource describes the state of a Subscription during notifications. 052 */ 053@ResourceDef(name="SubscriptionStatus", profile="http://hl7.org/fhir/StructureDefinition/SubscriptionStatus") 054public class SubscriptionStatus extends DomainResource { 055 056 public enum SubscriptionNotificationType { 057 /** 058 * The status was generated as part of the setup or verification of a communications channel. 059 */ 060 HANDSHAKE, 061 /** 062 * The status was generated to perform a heartbeat notification to the subscriber. 063 */ 064 HEARTBEAT, 065 /** 066 * The status was generated for an event to the subscriber. 067 */ 068 EVENTNOTIFICATION, 069 /** 070 * The status was generated in response to a status query/request. 071 */ 072 QUERYSTATUS, 073 /** 074 * The status was generated in response to an event query/request. 075 */ 076 QUERYEVENT, 077 /** 078 * added to help the parsers with the generic types 079 */ 080 NULL; 081 public static SubscriptionNotificationType fromCode(String codeString) throws FHIRException { 082 if (codeString == null || "".equals(codeString)) 083 return null; 084 if ("handshake".equals(codeString)) 085 return HANDSHAKE; 086 if ("heartbeat".equals(codeString)) 087 return HEARTBEAT; 088 if ("event-notification".equals(codeString)) 089 return EVENTNOTIFICATION; 090 if ("query-status".equals(codeString)) 091 return QUERYSTATUS; 092 if ("query-event".equals(codeString)) 093 return QUERYEVENT; 094 if (Configuration.isAcceptInvalidEnums()) 095 return null; 096 else 097 throw new FHIRException("Unknown SubscriptionNotificationType code '"+codeString+"'"); 098 } 099 public String toCode() { 100 switch (this) { 101 case HANDSHAKE: return "handshake"; 102 case HEARTBEAT: return "heartbeat"; 103 case EVENTNOTIFICATION: return "event-notification"; 104 case QUERYSTATUS: return "query-status"; 105 case QUERYEVENT: return "query-event"; 106 case NULL: return null; 107 default: return "?"; 108 } 109 } 110 public String getSystem() { 111 switch (this) { 112 case HANDSHAKE: return "http://hl7.org/fhir/subscription-notification-type"; 113 case HEARTBEAT: return "http://hl7.org/fhir/subscription-notification-type"; 114 case EVENTNOTIFICATION: return "http://hl7.org/fhir/subscription-notification-type"; 115 case QUERYSTATUS: return "http://hl7.org/fhir/subscription-notification-type"; 116 case QUERYEVENT: return "http://hl7.org/fhir/subscription-notification-type"; 117 case NULL: return null; 118 default: return "?"; 119 } 120 } 121 public String getDefinition() { 122 switch (this) { 123 case HANDSHAKE: return "The status was generated as part of the setup or verification of a communications channel."; 124 case HEARTBEAT: return "The status was generated to perform a heartbeat notification to the subscriber."; 125 case EVENTNOTIFICATION: return "The status was generated for an event to the subscriber."; 126 case QUERYSTATUS: return "The status was generated in response to a status query/request."; 127 case QUERYEVENT: return "The status was generated in response to an event query/request."; 128 case NULL: return null; 129 default: return "?"; 130 } 131 } 132 public String getDisplay() { 133 switch (this) { 134 case HANDSHAKE: return "Handshake"; 135 case HEARTBEAT: return "Heartbeat"; 136 case EVENTNOTIFICATION: return "Event Notification"; 137 case QUERYSTATUS: return "Query Status"; 138 case QUERYEVENT: return "Query Event"; 139 case NULL: return null; 140 default: return "?"; 141 } 142 } 143 } 144 145 public static class SubscriptionNotificationTypeEnumFactory implements EnumFactory<SubscriptionNotificationType> { 146 public SubscriptionNotificationType fromCode(String codeString) throws IllegalArgumentException { 147 if (codeString == null || "".equals(codeString)) 148 if (codeString == null || "".equals(codeString)) 149 return null; 150 if ("handshake".equals(codeString)) 151 return SubscriptionNotificationType.HANDSHAKE; 152 if ("heartbeat".equals(codeString)) 153 return SubscriptionNotificationType.HEARTBEAT; 154 if ("event-notification".equals(codeString)) 155 return SubscriptionNotificationType.EVENTNOTIFICATION; 156 if ("query-status".equals(codeString)) 157 return SubscriptionNotificationType.QUERYSTATUS; 158 if ("query-event".equals(codeString)) 159 return SubscriptionNotificationType.QUERYEVENT; 160 throw new IllegalArgumentException("Unknown SubscriptionNotificationType code '"+codeString+"'"); 161 } 162 public Enumeration<SubscriptionNotificationType> fromType(Base code) throws FHIRException { 163 if (code == null) 164 return null; 165 if (code.isEmpty()) 166 return new Enumeration<SubscriptionNotificationType>(this); 167 String codeString = ((PrimitiveType) code).asStringValue(); 168 if (codeString == null || "".equals(codeString)) 169 return null; 170 if ("handshake".equals(codeString)) 171 return new Enumeration<SubscriptionNotificationType>(this, SubscriptionNotificationType.HANDSHAKE); 172 if ("heartbeat".equals(codeString)) 173 return new Enumeration<SubscriptionNotificationType>(this, SubscriptionNotificationType.HEARTBEAT); 174 if ("event-notification".equals(codeString)) 175 return new Enumeration<SubscriptionNotificationType>(this, SubscriptionNotificationType.EVENTNOTIFICATION); 176 if ("query-status".equals(codeString)) 177 return new Enumeration<SubscriptionNotificationType>(this, SubscriptionNotificationType.QUERYSTATUS); 178 if ("query-event".equals(codeString)) 179 return new Enumeration<SubscriptionNotificationType>(this, SubscriptionNotificationType.QUERYEVENT); 180 throw new FHIRException("Unknown SubscriptionNotificationType code '"+codeString+"'"); 181 } 182 public String toCode(SubscriptionNotificationType code) { 183 if (code == SubscriptionNotificationType.HANDSHAKE) 184 return "handshake"; 185 if (code == SubscriptionNotificationType.HEARTBEAT) 186 return "heartbeat"; 187 if (code == SubscriptionNotificationType.EVENTNOTIFICATION) 188 return "event-notification"; 189 if (code == SubscriptionNotificationType.QUERYSTATUS) 190 return "query-status"; 191 if (code == SubscriptionNotificationType.QUERYEVENT) 192 return "query-event"; 193 return "?"; 194 } 195 public String toSystem(SubscriptionNotificationType code) { 196 return code.getSystem(); 197 } 198 } 199 200 @Block() 201 public static class SubscriptionStatusNotificationEventComponent extends BackboneElement implements IBaseBackboneElement { 202 /** 203 * The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string. 204 */ 205 @Child(name = "eventNumber", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 206 @Description(shortDefinition="Event number", formalDefinition="The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string." ) 207 protected StringType eventNumber; 208 209 /** 210 * The actual time this event occured on the server. 211 */ 212 @Child(name = "timestamp", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=false) 213 @Description(shortDefinition="The instant this event occurred", formalDefinition="The actual time this event occured on the server." ) 214 protected InstantType timestamp; 215 216 /** 217 * The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object. 218 */ 219 @Child(name = "focus", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=false) 220 @Description(shortDefinition="The focus of this event", formalDefinition="The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object." ) 221 protected Reference focus; 222 223 /** 224 * Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects. 225 */ 226 @Child(name = "additionalContext", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 227 @Description(shortDefinition="Additional context for this event", formalDefinition="Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects." ) 228 protected List<Reference> additionalContext; 229 230 private static final long serialVersionUID = -1582756503L; 231 232 /** 233 * Constructor 234 */ 235 public SubscriptionStatusNotificationEventComponent() { 236 super(); 237 } 238 239 /** 240 * Constructor 241 */ 242 public SubscriptionStatusNotificationEventComponent(String eventNumber) { 243 super(); 244 this.setEventNumber(eventNumber); 245 } 246 247 /** 248 * @return {@link #eventNumber} (The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string.). This is the underlying object with id, value and extensions. The accessor "getEventNumber" gives direct access to the value 249 */ 250 public StringType getEventNumberElement() { 251 if (this.eventNumber == null) 252 if (Configuration.errorOnAutoCreate()) 253 throw new Error("Attempt to auto-create SubscriptionStatusNotificationEventComponent.eventNumber"); 254 else if (Configuration.doAutoCreate()) 255 this.eventNumber = new StringType(); // bb 256 return this.eventNumber; 257 } 258 259 public boolean hasEventNumberElement() { 260 return this.eventNumber != null && !this.eventNumber.isEmpty(); 261 } 262 263 public boolean hasEventNumber() { 264 return this.eventNumber != null && !this.eventNumber.isEmpty(); 265 } 266 267 /** 268 * @param value {@link #eventNumber} (The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string.). This is the underlying object with id, value and extensions. The accessor "getEventNumber" gives direct access to the value 269 */ 270 public SubscriptionStatusNotificationEventComponent setEventNumberElement(StringType value) { 271 this.eventNumber = value; 272 return this; 273 } 274 275 /** 276 * @return The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string. 277 */ 278 public String getEventNumber() { 279 return this.eventNumber == null ? null : this.eventNumber.getValue(); 280 } 281 282 /** 283 * @param value The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string. 284 */ 285 public SubscriptionStatusNotificationEventComponent setEventNumber(String value) { 286 if (this.eventNumber == null) 287 this.eventNumber = new StringType(); 288 this.eventNumber.setValue(value); 289 return this; 290 } 291 292 /** 293 * @return {@link #timestamp} (The actual time this event occured on the server.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 294 */ 295 public InstantType getTimestampElement() { 296 if (this.timestamp == null) 297 if (Configuration.errorOnAutoCreate()) 298 throw new Error("Attempt to auto-create SubscriptionStatusNotificationEventComponent.timestamp"); 299 else if (Configuration.doAutoCreate()) 300 this.timestamp = new InstantType(); // bb 301 return this.timestamp; 302 } 303 304 public boolean hasTimestampElement() { 305 return this.timestamp != null && !this.timestamp.isEmpty(); 306 } 307 308 public boolean hasTimestamp() { 309 return this.timestamp != null && !this.timestamp.isEmpty(); 310 } 311 312 /** 313 * @param value {@link #timestamp} (The actual time this event occured on the server.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 314 */ 315 public SubscriptionStatusNotificationEventComponent setTimestampElement(InstantType value) { 316 this.timestamp = value; 317 return this; 318 } 319 320 /** 321 * @return The actual time this event occured on the server. 322 */ 323 public Date getTimestamp() { 324 return this.timestamp == null ? null : this.timestamp.getValue(); 325 } 326 327 /** 328 * @param value The actual time this event occured on the server. 329 */ 330 public SubscriptionStatusNotificationEventComponent setTimestamp(Date value) { 331 if (value == null) 332 this.timestamp = null; 333 else { 334 if (this.timestamp == null) 335 this.timestamp = new InstantType(); 336 this.timestamp.setValue(value); 337 } 338 return this; 339 } 340 341 /** 342 * @return {@link #focus} (The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.) 343 */ 344 public Reference getFocus() { 345 if (this.focus == null) 346 if (Configuration.errorOnAutoCreate()) 347 throw new Error("Attempt to auto-create SubscriptionStatusNotificationEventComponent.focus"); 348 else if (Configuration.doAutoCreate()) 349 this.focus = new Reference(); // cc 350 return this.focus; 351 } 352 353 public boolean hasFocus() { 354 return this.focus != null && !this.focus.isEmpty(); 355 } 356 357 /** 358 * @param value {@link #focus} (The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.) 359 */ 360 public SubscriptionStatusNotificationEventComponent setFocus(Reference value) { 361 this.focus = value; 362 return this; 363 } 364 365 /** 366 * @return {@link #additionalContext} (Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects.) 367 */ 368 public List<Reference> getAdditionalContext() { 369 if (this.additionalContext == null) 370 this.additionalContext = new ArrayList<Reference>(); 371 return this.additionalContext; 372 } 373 374 /** 375 * @return Returns a reference to <code>this</code> for easy method chaining 376 */ 377 public SubscriptionStatusNotificationEventComponent setAdditionalContext(List<Reference> theAdditionalContext) { 378 this.additionalContext = theAdditionalContext; 379 return this; 380 } 381 382 public boolean hasAdditionalContext() { 383 if (this.additionalContext == null) 384 return false; 385 for (Reference item : this.additionalContext) 386 if (!item.isEmpty()) 387 return true; 388 return false; 389 } 390 391 public Reference addAdditionalContext() { //3 392 Reference t = new Reference(); 393 if (this.additionalContext == null) 394 this.additionalContext = new ArrayList<Reference>(); 395 this.additionalContext.add(t); 396 return t; 397 } 398 399 public SubscriptionStatusNotificationEventComponent addAdditionalContext(Reference t) { //3 400 if (t == null) 401 return this; 402 if (this.additionalContext == null) 403 this.additionalContext = new ArrayList<Reference>(); 404 this.additionalContext.add(t); 405 return this; 406 } 407 408 /** 409 * @return The first repetition of repeating field {@link #additionalContext}, creating it if it does not already exist {3} 410 */ 411 public Reference getAdditionalContextFirstRep() { 412 if (getAdditionalContext().isEmpty()) { 413 addAdditionalContext(); 414 } 415 return getAdditionalContext().get(0); 416 } 417 418 protected void listChildren(List<Property> children) { 419 super.listChildren(children); 420 children.add(new Property("eventNumber", "string", "The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string.", 0, 1, eventNumber)); 421 children.add(new Property("timestamp", "instant", "The actual time this event occured on the server.", 0, 1, timestamp)); 422 children.add(new Property("focus", "Reference(Any)", "The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.", 0, 1, focus)); 423 children.add(new Property("additionalContext", "Reference(Any)", "Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects.", 0, java.lang.Integer.MAX_VALUE, additionalContext)); 424 } 425 426 @Override 427 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 428 switch (_hash) { 429 case -35234173: /*eventNumber*/ return new Property("eventNumber", "string", "The sequential number of this event in this subscription context. Note that this value is a 64-bit integer value, encoded as a string.", 0, 1, eventNumber); 430 case 55126294: /*timestamp*/ return new Property("timestamp", "instant", "The actual time this event occured on the server.", 0, 1, timestamp); 431 case 97604824: /*focus*/ return new Property("focus", "Reference(Any)", "The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.", 0, 1, focus); 432 case -908743800: /*additionalContext*/ return new Property("additionalContext", "Reference(Any)", "Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects.", 0, java.lang.Integer.MAX_VALUE, additionalContext); 433 default: return super.getNamedProperty(_hash, _name, _checkValid); 434 } 435 436 } 437 438 @Override 439 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 440 switch (hash) { 441 case -35234173: /*eventNumber*/ return this.eventNumber == null ? new Base[0] : new Base[] {this.eventNumber}; // StringType 442 case 55126294: /*timestamp*/ return this.timestamp == null ? new Base[0] : new Base[] {this.timestamp}; // InstantType 443 case 97604824: /*focus*/ return this.focus == null ? new Base[0] : new Base[] {this.focus}; // Reference 444 case -908743800: /*additionalContext*/ return this.additionalContext == null ? new Base[0] : this.additionalContext.toArray(new Base[this.additionalContext.size()]); // Reference 445 default: return super.getProperty(hash, name, checkValid); 446 } 447 448 } 449 450 @Override 451 public Base setProperty(int hash, String name, Base value) throws FHIRException { 452 switch (hash) { 453 case -35234173: // eventNumber 454 this.eventNumber = TypeConvertor.castToString(value); // StringType 455 return value; 456 case 55126294: // timestamp 457 this.timestamp = TypeConvertor.castToInstant(value); // InstantType 458 return value; 459 case 97604824: // focus 460 this.focus = TypeConvertor.castToReference(value); // Reference 461 return value; 462 case -908743800: // additionalContext 463 this.getAdditionalContext().add(TypeConvertor.castToReference(value)); // Reference 464 return value; 465 default: return super.setProperty(hash, name, value); 466 } 467 468 } 469 470 @Override 471 public Base setProperty(String name, Base value) throws FHIRException { 472 if (name.equals("eventNumber")) { 473 this.eventNumber = TypeConvertor.castToString(value); // StringType 474 } else if (name.equals("timestamp")) { 475 this.timestamp = TypeConvertor.castToInstant(value); // InstantType 476 } else if (name.equals("focus")) { 477 this.focus = TypeConvertor.castToReference(value); // Reference 478 } else if (name.equals("additionalContext")) { 479 this.getAdditionalContext().add(TypeConvertor.castToReference(value)); 480 } else 481 return super.setProperty(name, value); 482 return value; 483 } 484 485 @Override 486 public Base makeProperty(int hash, String name) throws FHIRException { 487 switch (hash) { 488 case -35234173: return getEventNumberElement(); 489 case 55126294: return getTimestampElement(); 490 case 97604824: return getFocus(); 491 case -908743800: return addAdditionalContext(); 492 default: return super.makeProperty(hash, name); 493 } 494 495 } 496 497 @Override 498 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 499 switch (hash) { 500 case -35234173: /*eventNumber*/ return new String[] {"string"}; 501 case 55126294: /*timestamp*/ return new String[] {"instant"}; 502 case 97604824: /*focus*/ return new String[] {"Reference"}; 503 case -908743800: /*additionalContext*/ return new String[] {"Reference"}; 504 default: return super.getTypesForProperty(hash, name); 505 } 506 507 } 508 509 @Override 510 public Base addChild(String name) throws FHIRException { 511 if (name.equals("eventNumber")) { 512 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.notificationEvent.eventNumber"); 513 } 514 else if (name.equals("timestamp")) { 515 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.notificationEvent.timestamp"); 516 } 517 else if (name.equals("focus")) { 518 this.focus = new Reference(); 519 return this.focus; 520 } 521 else if (name.equals("additionalContext")) { 522 return addAdditionalContext(); 523 } 524 else 525 return super.addChild(name); 526 } 527 528 public SubscriptionStatusNotificationEventComponent copy() { 529 SubscriptionStatusNotificationEventComponent dst = new SubscriptionStatusNotificationEventComponent(); 530 copyValues(dst); 531 return dst; 532 } 533 534 public void copyValues(SubscriptionStatusNotificationEventComponent dst) { 535 super.copyValues(dst); 536 dst.eventNumber = eventNumber == null ? null : eventNumber.copy(); 537 dst.timestamp = timestamp == null ? null : timestamp.copy(); 538 dst.focus = focus == null ? null : focus.copy(); 539 if (additionalContext != null) { 540 dst.additionalContext = new ArrayList<Reference>(); 541 for (Reference i : additionalContext) 542 dst.additionalContext.add(i.copy()); 543 }; 544 } 545 546 @Override 547 public boolean equalsDeep(Base other_) { 548 if (!super.equalsDeep(other_)) 549 return false; 550 if (!(other_ instanceof SubscriptionStatusNotificationEventComponent)) 551 return false; 552 SubscriptionStatusNotificationEventComponent o = (SubscriptionStatusNotificationEventComponent) other_; 553 return compareDeep(eventNumber, o.eventNumber, true) && compareDeep(timestamp, o.timestamp, true) 554 && compareDeep(focus, o.focus, true) && compareDeep(additionalContext, o.additionalContext, true) 555 ; 556 } 557 558 @Override 559 public boolean equalsShallow(Base other_) { 560 if (!super.equalsShallow(other_)) 561 return false; 562 if (!(other_ instanceof SubscriptionStatusNotificationEventComponent)) 563 return false; 564 SubscriptionStatusNotificationEventComponent o = (SubscriptionStatusNotificationEventComponent) other_; 565 return compareValues(eventNumber, o.eventNumber, true) && compareValues(timestamp, o.timestamp, true) 566 ; 567 } 568 569 public boolean isEmpty() { 570 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(eventNumber, timestamp, focus 571 , additionalContext); 572 } 573 574 public String fhirType() { 575 return "SubscriptionStatus.notificationEvent"; 576 577 } 578 579 } 580 581 /** 582 * The status of the subscription, which marks the server state for managing the subscription. 583 */ 584 @Child(name = "status", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 585 @Description(shortDefinition="requested | active | error | off | entered-in-error", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." ) 586 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status") 587 protected Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> status; 588 589 /** 590 * The type of event being conveyed with this notificaiton. 591 */ 592 @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 593 @Description(shortDefinition="handshake | heartbeat | event-notification | query-status | query-event", formalDefinition="The type of event being conveyed with this notificaiton." ) 594 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-notification-type") 595 protected Enumeration<SubscriptionNotificationType> type; 596 597 /** 598 * The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications. 599 */ 600 @Child(name = "eventsSinceSubscriptionStart", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 601 @Description(shortDefinition="Events since the Subscription was created", formalDefinition="The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications." ) 602 protected StringType eventsSinceSubscriptionStart; 603 604 /** 605 * The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching. 606 */ 607 @Child(name = "eventsInNotification", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=true) 608 @Description(shortDefinition="The number of actual notifications represented by this bundle", formalDefinition="The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching." ) 609 protected IntegerType eventsInNotification; 610 611 /** 612 * Detailed information about events relevant to this subscription notification. 613 */ 614 @Child(name = "notificationEvent", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 615 @Description(shortDefinition="Detailed information about any events relevant to this notification", formalDefinition="Detailed information about events relevant to this subscription notification." ) 616 protected List<SubscriptionStatusNotificationEventComponent> notificationEvent; 617 618 /** 619 * The reference to the Subscription which generated this notification. 620 */ 621 @Child(name = "subscription", type = {Subscription.class}, order=5, min=1, max=1, modifier=false, summary=true) 622 @Description(shortDefinition="Reference to the Subscription responsible for this notification", formalDefinition="The reference to the Subscription which generated this notification." ) 623 protected Reference subscription; 624 625 /** 626 * The reference to the SubscriptionTopic for the Subscription which generated this notification. 627 */ 628 @Child(name = "topic", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true) 629 @Description(shortDefinition="Reference to the SubscriptionTopic this notification relates to", formalDefinition="The reference to the SubscriptionTopic for the Subscription which generated this notification." ) 630 protected CanonicalType topic; 631 632 /** 633 * A record of errors that occurred when the server processed a notification. 634 */ 635 @Child(name = "error", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 636 @Description(shortDefinition="List of errors on the subscription", formalDefinition="A record of errors that occurred when the server processed a notification." ) 637 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-error") 638 protected List<CodeableConcept> error; 639 640 private static final long serialVersionUID = 509923202L; 641 642 /** 643 * Constructor 644 */ 645 public SubscriptionStatus() { 646 super(); 647 } 648 649 /** 650 * Constructor 651 */ 652 public SubscriptionStatus(SubscriptionNotificationType type, Reference subscription) { 653 super(); 654 this.setType(type); 655 this.setSubscription(subscription); 656 } 657 658 /** 659 * @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 660 */ 661 public Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> getStatusElement() { 662 if (this.status == null) 663 if (Configuration.errorOnAutoCreate()) 664 throw new Error("Attempt to auto-create SubscriptionStatus.status"); 665 else if (Configuration.doAutoCreate()) 666 this.status = new Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>(new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory()); // bb 667 return this.status; 668 } 669 670 public boolean hasStatusElement() { 671 return this.status != null && !this.status.isEmpty(); 672 } 673 674 public boolean hasStatus() { 675 return this.status != null && !this.status.isEmpty(); 676 } 677 678 /** 679 * @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 680 */ 681 public SubscriptionStatus setStatusElement(Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> value) { 682 this.status = value; 683 return this; 684 } 685 686 /** 687 * @return The status of the subscription, which marks the server state for managing the subscription. 688 */ 689 public org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus getStatus() { 690 return this.status == null ? null : this.status.getValue(); 691 } 692 693 /** 694 * @param value The status of the subscription, which marks the server state for managing the subscription. 695 */ 696 public SubscriptionStatus setStatus(org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus value) { 697 if (value == null) 698 this.status = null; 699 else { 700 if (this.status == null) 701 this.status = new Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>(new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory()); 702 this.status.setValue(value); 703 } 704 return this; 705 } 706 707 /** 708 * @return {@link #type} (The type of event being conveyed with this notificaiton.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 709 */ 710 public Enumeration<SubscriptionNotificationType> getTypeElement() { 711 if (this.type == null) 712 if (Configuration.errorOnAutoCreate()) 713 throw new Error("Attempt to auto-create SubscriptionStatus.type"); 714 else if (Configuration.doAutoCreate()) 715 this.type = new Enumeration<SubscriptionNotificationType>(new SubscriptionNotificationTypeEnumFactory()); // bb 716 return this.type; 717 } 718 719 public boolean hasTypeElement() { 720 return this.type != null && !this.type.isEmpty(); 721 } 722 723 public boolean hasType() { 724 return this.type != null && !this.type.isEmpty(); 725 } 726 727 /** 728 * @param value {@link #type} (The type of event being conveyed with this notificaiton.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 729 */ 730 public SubscriptionStatus setTypeElement(Enumeration<SubscriptionNotificationType> value) { 731 this.type = value; 732 return this; 733 } 734 735 /** 736 * @return The type of event being conveyed with this notificaiton. 737 */ 738 public SubscriptionNotificationType getType() { 739 return this.type == null ? null : this.type.getValue(); 740 } 741 742 /** 743 * @param value The type of event being conveyed with this notificaiton. 744 */ 745 public SubscriptionStatus setType(SubscriptionNotificationType value) { 746 if (this.type == null) 747 this.type = new Enumeration<SubscriptionNotificationType>(new SubscriptionNotificationTypeEnumFactory()); 748 this.type.setValue(value); 749 return this; 750 } 751 752 /** 753 * @return {@link #eventsSinceSubscriptionStart} (The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications.). This is the underlying object with id, value and extensions. The accessor "getEventsSinceSubscriptionStart" gives direct access to the value 754 */ 755 public StringType getEventsSinceSubscriptionStartElement() { 756 if (this.eventsSinceSubscriptionStart == null) 757 if (Configuration.errorOnAutoCreate()) 758 throw new Error("Attempt to auto-create SubscriptionStatus.eventsSinceSubscriptionStart"); 759 else if (Configuration.doAutoCreate()) 760 this.eventsSinceSubscriptionStart = new StringType(); // bb 761 return this.eventsSinceSubscriptionStart; 762 } 763 764 public boolean hasEventsSinceSubscriptionStartElement() { 765 return this.eventsSinceSubscriptionStart != null && !this.eventsSinceSubscriptionStart.isEmpty(); 766 } 767 768 public boolean hasEventsSinceSubscriptionStart() { 769 return this.eventsSinceSubscriptionStart != null && !this.eventsSinceSubscriptionStart.isEmpty(); 770 } 771 772 /** 773 * @param value {@link #eventsSinceSubscriptionStart} (The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications.). This is the underlying object with id, value and extensions. The accessor "getEventsSinceSubscriptionStart" gives direct access to the value 774 */ 775 public SubscriptionStatus setEventsSinceSubscriptionStartElement(StringType value) { 776 this.eventsSinceSubscriptionStart = value; 777 return this; 778 } 779 780 /** 781 * @return The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications. 782 */ 783 public String getEventsSinceSubscriptionStart() { 784 return this.eventsSinceSubscriptionStart == null ? null : this.eventsSinceSubscriptionStart.getValue(); 785 } 786 787 /** 788 * @param value The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications. 789 */ 790 public SubscriptionStatus setEventsSinceSubscriptionStart(String value) { 791 if (Utilities.noString(value)) 792 this.eventsSinceSubscriptionStart = null; 793 else { 794 if (this.eventsSinceSubscriptionStart == null) 795 this.eventsSinceSubscriptionStart = new StringType(); 796 this.eventsSinceSubscriptionStart.setValue(value); 797 } 798 return this; 799 } 800 801 /** 802 * @return {@link #eventsInNotification} (The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching.). This is the underlying object with id, value and extensions. The accessor "getEventsInNotification" gives direct access to the value 803 */ 804 public IntegerType getEventsInNotificationElement() { 805 if (this.eventsInNotification == null) 806 if (Configuration.errorOnAutoCreate()) 807 throw new Error("Attempt to auto-create SubscriptionStatus.eventsInNotification"); 808 else if (Configuration.doAutoCreate()) 809 this.eventsInNotification = new IntegerType(); // bb 810 return this.eventsInNotification; 811 } 812 813 public boolean hasEventsInNotificationElement() { 814 return this.eventsInNotification != null && !this.eventsInNotification.isEmpty(); 815 } 816 817 public boolean hasEventsInNotification() { 818 return this.eventsInNotification != null && !this.eventsInNotification.isEmpty(); 819 } 820 821 /** 822 * @param value {@link #eventsInNotification} (The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching.). This is the underlying object with id, value and extensions. The accessor "getEventsInNotification" gives direct access to the value 823 */ 824 public SubscriptionStatus setEventsInNotificationElement(IntegerType value) { 825 this.eventsInNotification = value; 826 return this; 827 } 828 829 /** 830 * @return The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching. 831 */ 832 public int getEventsInNotification() { 833 return this.eventsInNotification == null || this.eventsInNotification.isEmpty() ? 0 : this.eventsInNotification.getValue(); 834 } 835 836 /** 837 * @param value The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching. 838 */ 839 public SubscriptionStatus setEventsInNotification(int value) { 840 if (this.eventsInNotification == null) 841 this.eventsInNotification = new IntegerType(); 842 this.eventsInNotification.setValue(value); 843 return this; 844 } 845 846 /** 847 * @return {@link #notificationEvent} (Detailed information about events relevant to this subscription notification.) 848 */ 849 public List<SubscriptionStatusNotificationEventComponent> getNotificationEvent() { 850 if (this.notificationEvent == null) 851 this.notificationEvent = new ArrayList<SubscriptionStatusNotificationEventComponent>(); 852 return this.notificationEvent; 853 } 854 855 /** 856 * @return Returns a reference to <code>this</code> for easy method chaining 857 */ 858 public SubscriptionStatus setNotificationEvent(List<SubscriptionStatusNotificationEventComponent> theNotificationEvent) { 859 this.notificationEvent = theNotificationEvent; 860 return this; 861 } 862 863 public boolean hasNotificationEvent() { 864 if (this.notificationEvent == null) 865 return false; 866 for (SubscriptionStatusNotificationEventComponent item : this.notificationEvent) 867 if (!item.isEmpty()) 868 return true; 869 return false; 870 } 871 872 public SubscriptionStatusNotificationEventComponent addNotificationEvent() { //3 873 SubscriptionStatusNotificationEventComponent t = new SubscriptionStatusNotificationEventComponent(); 874 if (this.notificationEvent == null) 875 this.notificationEvent = new ArrayList<SubscriptionStatusNotificationEventComponent>(); 876 this.notificationEvent.add(t); 877 return t; 878 } 879 880 public SubscriptionStatus addNotificationEvent(SubscriptionStatusNotificationEventComponent t) { //3 881 if (t == null) 882 return this; 883 if (this.notificationEvent == null) 884 this.notificationEvent = new ArrayList<SubscriptionStatusNotificationEventComponent>(); 885 this.notificationEvent.add(t); 886 return this; 887 } 888 889 /** 890 * @return The first repetition of repeating field {@link #notificationEvent}, creating it if it does not already exist {3} 891 */ 892 public SubscriptionStatusNotificationEventComponent getNotificationEventFirstRep() { 893 if (getNotificationEvent().isEmpty()) { 894 addNotificationEvent(); 895 } 896 return getNotificationEvent().get(0); 897 } 898 899 /** 900 * @return {@link #subscription} (The reference to the Subscription which generated this notification.) 901 */ 902 public Reference getSubscription() { 903 if (this.subscription == null) 904 if (Configuration.errorOnAutoCreate()) 905 throw new Error("Attempt to auto-create SubscriptionStatus.subscription"); 906 else if (Configuration.doAutoCreate()) 907 this.subscription = new Reference(); // cc 908 return this.subscription; 909 } 910 911 public boolean hasSubscription() { 912 return this.subscription != null && !this.subscription.isEmpty(); 913 } 914 915 /** 916 * @param value {@link #subscription} (The reference to the Subscription which generated this notification.) 917 */ 918 public SubscriptionStatus setSubscription(Reference value) { 919 this.subscription = value; 920 return this; 921 } 922 923 /** 924 * @return {@link #topic} (The reference to the SubscriptionTopic for the Subscription which generated this notification.). This is the underlying object with id, value and extensions. The accessor "getTopic" gives direct access to the value 925 */ 926 public CanonicalType getTopicElement() { 927 if (this.topic == null) 928 if (Configuration.errorOnAutoCreate()) 929 throw new Error("Attempt to auto-create SubscriptionStatus.topic"); 930 else if (Configuration.doAutoCreate()) 931 this.topic = new CanonicalType(); // bb 932 return this.topic; 933 } 934 935 public boolean hasTopicElement() { 936 return this.topic != null && !this.topic.isEmpty(); 937 } 938 939 public boolean hasTopic() { 940 return this.topic != null && !this.topic.isEmpty(); 941 } 942 943 /** 944 * @param value {@link #topic} (The reference to the SubscriptionTopic for the Subscription which generated this notification.). This is the underlying object with id, value and extensions. The accessor "getTopic" gives direct access to the value 945 */ 946 public SubscriptionStatus setTopicElement(CanonicalType value) { 947 this.topic = value; 948 return this; 949 } 950 951 /** 952 * @return The reference to the SubscriptionTopic for the Subscription which generated this notification. 953 */ 954 public String getTopic() { 955 return this.topic == null ? null : this.topic.getValue(); 956 } 957 958 /** 959 * @param value The reference to the SubscriptionTopic for the Subscription which generated this notification. 960 */ 961 public SubscriptionStatus setTopic(String value) { 962 if (Utilities.noString(value)) 963 this.topic = null; 964 else { 965 if (this.topic == null) 966 this.topic = new CanonicalType(); 967 this.topic.setValue(value); 968 } 969 return this; 970 } 971 972 /** 973 * @return {@link #error} (A record of errors that occurred when the server processed a notification.) 974 */ 975 public List<CodeableConcept> getError() { 976 if (this.error == null) 977 this.error = new ArrayList<CodeableConcept>(); 978 return this.error; 979 } 980 981 /** 982 * @return Returns a reference to <code>this</code> for easy method chaining 983 */ 984 public SubscriptionStatus setError(List<CodeableConcept> theError) { 985 this.error = theError; 986 return this; 987 } 988 989 public boolean hasError() { 990 if (this.error == null) 991 return false; 992 for (CodeableConcept item : this.error) 993 if (!item.isEmpty()) 994 return true; 995 return false; 996 } 997 998 public CodeableConcept addError() { //3 999 CodeableConcept t = new CodeableConcept(); 1000 if (this.error == null) 1001 this.error = new ArrayList<CodeableConcept>(); 1002 this.error.add(t); 1003 return t; 1004 } 1005 1006 public SubscriptionStatus addError(CodeableConcept t) { //3 1007 if (t == null) 1008 return this; 1009 if (this.error == null) 1010 this.error = new ArrayList<CodeableConcept>(); 1011 this.error.add(t); 1012 return this; 1013 } 1014 1015 /** 1016 * @return The first repetition of repeating field {@link #error}, creating it if it does not already exist {3} 1017 */ 1018 public CodeableConcept getErrorFirstRep() { 1019 if (getError().isEmpty()) { 1020 addError(); 1021 } 1022 return getError().get(0); 1023 } 1024 1025 protected void listChildren(List<Property> children) { 1026 super.listChildren(children); 1027 children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status)); 1028 children.add(new Property("type", "code", "The type of event being conveyed with this notificaiton.", 0, 1, type)); 1029 children.add(new Property("eventsSinceSubscriptionStart", "string", "The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications.", 0, 1, eventsSinceSubscriptionStart)); 1030 children.add(new Property("eventsInNotification", "integer", "The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching.", 0, 1, eventsInNotification)); 1031 children.add(new Property("notificationEvent", "", "Detailed information about events relevant to this subscription notification.", 0, java.lang.Integer.MAX_VALUE, notificationEvent)); 1032 children.add(new Property("subscription", "Reference(Subscription)", "The reference to the Subscription which generated this notification.", 0, 1, subscription)); 1033 children.add(new Property("topic", "canonical(SubscriptionTopic)", "The reference to the SubscriptionTopic for the Subscription which generated this notification.", 0, 1, topic)); 1034 children.add(new Property("error", "CodeableConcept", "A record of errors that occurred when the server processed a notification.", 0, java.lang.Integer.MAX_VALUE, error)); 1035 } 1036 1037 @Override 1038 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1039 switch (_hash) { 1040 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); 1041 case 3575610: /*type*/ return new Property("type", "code", "The type of event being conveyed with this notificaiton.", 0, 1, type); 1042 case 304566692: /*eventsSinceSubscriptionStart*/ return new Property("eventsSinceSubscriptionStart", "string", "The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notifications.", 0, 1, eventsSinceSubscriptionStart); 1043 case 191408169: /*eventsInNotification*/ return new Property("eventsInNotification", "integer", "The total number of actual events represented within this notification. For handshake and heartbeat notifications, this will be zero or not present. For event-notifications, this number may be one or more, depending on server batching.", 0, 1, eventsInNotification); 1044 case -1595878289: /*notificationEvent*/ return new Property("notificationEvent", "", "Detailed information about events relevant to this subscription notification.", 0, java.lang.Integer.MAX_VALUE, notificationEvent); 1045 case 341203229: /*subscription*/ return new Property("subscription", "Reference(Subscription)", "The reference to the Subscription which generated this notification.", 0, 1, subscription); 1046 case 110546223: /*topic*/ return new Property("topic", "canonical(SubscriptionTopic)", "The reference to the SubscriptionTopic for the Subscription which generated this notification.", 0, 1, topic); 1047 case 96784904: /*error*/ return new Property("error", "CodeableConcept", "A record of errors that occurred when the server processed a notification.", 0, java.lang.Integer.MAX_VALUE, error); 1048 default: return super.getNamedProperty(_hash, _name, _checkValid); 1049 } 1050 1051 } 1052 1053 @Override 1054 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1055 switch (hash) { 1056 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> 1057 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SubscriptionNotificationType> 1058 case 304566692: /*eventsSinceSubscriptionStart*/ return this.eventsSinceSubscriptionStart == null ? new Base[0] : new Base[] {this.eventsSinceSubscriptionStart}; // StringType 1059 case 191408169: /*eventsInNotification*/ return this.eventsInNotification == null ? new Base[0] : new Base[] {this.eventsInNotification}; // IntegerType 1060 case -1595878289: /*notificationEvent*/ return this.notificationEvent == null ? new Base[0] : this.notificationEvent.toArray(new Base[this.notificationEvent.size()]); // SubscriptionStatusNotificationEventComponent 1061 case 341203229: /*subscription*/ return this.subscription == null ? new Base[0] : new Base[] {this.subscription}; // Reference 1062 case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // CanonicalType 1063 case 96784904: /*error*/ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // CodeableConcept 1064 default: return super.getProperty(hash, name, checkValid); 1065 } 1066 1067 } 1068 1069 @Override 1070 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1071 switch (hash) { 1072 case -892481550: // status 1073 value = new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value)); 1074 this.status = (Enumeration) value; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> 1075 return value; 1076 case 3575610: // type 1077 value = new SubscriptionNotificationTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 1078 this.type = (Enumeration) value; // Enumeration<SubscriptionNotificationType> 1079 return value; 1080 case 304566692: // eventsSinceSubscriptionStart 1081 this.eventsSinceSubscriptionStart = TypeConvertor.castToString(value); // StringType 1082 return value; 1083 case 191408169: // eventsInNotification 1084 this.eventsInNotification = TypeConvertor.castToInteger(value); // IntegerType 1085 return value; 1086 case -1595878289: // notificationEvent 1087 this.getNotificationEvent().add((SubscriptionStatusNotificationEventComponent) value); // SubscriptionStatusNotificationEventComponent 1088 return value; 1089 case 341203229: // subscription 1090 this.subscription = TypeConvertor.castToReference(value); // Reference 1091 return value; 1092 case 110546223: // topic 1093 this.topic = TypeConvertor.castToCanonical(value); // CanonicalType 1094 return value; 1095 case 96784904: // error 1096 this.getError().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept 1097 return value; 1098 default: return super.setProperty(hash, name, value); 1099 } 1100 1101 } 1102 1103 @Override 1104 public Base setProperty(String name, Base value) throws FHIRException { 1105 if (name.equals("status")) { 1106 value = new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value)); 1107 this.status = (Enumeration) value; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> 1108 } else if (name.equals("type")) { 1109 value = new SubscriptionNotificationTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 1110 this.type = (Enumeration) value; // Enumeration<SubscriptionNotificationType> 1111 } else if (name.equals("eventsSinceSubscriptionStart")) { 1112 this.eventsSinceSubscriptionStart = TypeConvertor.castToString(value); // StringType 1113 } else if (name.equals("eventsInNotification")) { 1114 this.eventsInNotification = TypeConvertor.castToInteger(value); // IntegerType 1115 } else if (name.equals("notificationEvent")) { 1116 this.getNotificationEvent().add((SubscriptionStatusNotificationEventComponent) value); 1117 } else if (name.equals("subscription")) { 1118 this.subscription = TypeConvertor.castToReference(value); // Reference 1119 } else if (name.equals("topic")) { 1120 this.topic = TypeConvertor.castToCanonical(value); // CanonicalType 1121 } else if (name.equals("error")) { 1122 this.getError().add(TypeConvertor.castToCodeableConcept(value)); 1123 } else 1124 return super.setProperty(name, value); 1125 return value; 1126 } 1127 1128 @Override 1129 public Base makeProperty(int hash, String name) throws FHIRException { 1130 switch (hash) { 1131 case -892481550: return getStatusElement(); 1132 case 3575610: return getTypeElement(); 1133 case 304566692: return getEventsSinceSubscriptionStartElement(); 1134 case 191408169: return getEventsInNotificationElement(); 1135 case -1595878289: return addNotificationEvent(); 1136 case 341203229: return getSubscription(); 1137 case 110546223: return getTopicElement(); 1138 case 96784904: return addError(); 1139 default: return super.makeProperty(hash, name); 1140 } 1141 1142 } 1143 1144 @Override 1145 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1146 switch (hash) { 1147 case -892481550: /*status*/ return new String[] {"code"}; 1148 case 3575610: /*type*/ return new String[] {"code"}; 1149 case 304566692: /*eventsSinceSubscriptionStart*/ return new String[] {"string"}; 1150 case 191408169: /*eventsInNotification*/ return new String[] {"integer"}; 1151 case -1595878289: /*notificationEvent*/ return new String[] {}; 1152 case 341203229: /*subscription*/ return new String[] {"Reference"}; 1153 case 110546223: /*topic*/ return new String[] {"canonical"}; 1154 case 96784904: /*error*/ return new String[] {"CodeableConcept"}; 1155 default: return super.getTypesForProperty(hash, name); 1156 } 1157 1158 } 1159 1160 @Override 1161 public Base addChild(String name) throws FHIRException { 1162 if (name.equals("status")) { 1163 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.status"); 1164 } 1165 else if (name.equals("type")) { 1166 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.type"); 1167 } 1168 else if (name.equals("eventsSinceSubscriptionStart")) { 1169 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.eventsSinceSubscriptionStart"); 1170 } 1171 else if (name.equals("eventsInNotification")) { 1172 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.eventsInNotification"); 1173 } 1174 else if (name.equals("notificationEvent")) { 1175 return addNotificationEvent(); 1176 } 1177 else if (name.equals("subscription")) { 1178 this.subscription = new Reference(); 1179 return this.subscription; 1180 } 1181 else if (name.equals("topic")) { 1182 throw new FHIRException("Cannot call addChild on a primitive type SubscriptionStatus.topic"); 1183 } 1184 else if (name.equals("error")) { 1185 return addError(); 1186 } 1187 else 1188 return super.addChild(name); 1189 } 1190 1191 public String fhirType() { 1192 return "SubscriptionStatus"; 1193 1194 } 1195 1196 public SubscriptionStatus copy() { 1197 SubscriptionStatus dst = new SubscriptionStatus(); 1198 copyValues(dst); 1199 return dst; 1200 } 1201 1202 public void copyValues(SubscriptionStatus dst) { 1203 super.copyValues(dst); 1204 dst.status = status == null ? null : status.copy(); 1205 dst.type = type == null ? null : type.copy(); 1206 dst.eventsSinceSubscriptionStart = eventsSinceSubscriptionStart == null ? null : eventsSinceSubscriptionStart.copy(); 1207 dst.eventsInNotification = eventsInNotification == null ? null : eventsInNotification.copy(); 1208 if (notificationEvent != null) { 1209 dst.notificationEvent = new ArrayList<SubscriptionStatusNotificationEventComponent>(); 1210 for (SubscriptionStatusNotificationEventComponent i : notificationEvent) 1211 dst.notificationEvent.add(i.copy()); 1212 }; 1213 dst.subscription = subscription == null ? null : subscription.copy(); 1214 dst.topic = topic == null ? null : topic.copy(); 1215 if (error != null) { 1216 dst.error = new ArrayList<CodeableConcept>(); 1217 for (CodeableConcept i : error) 1218 dst.error.add(i.copy()); 1219 }; 1220 } 1221 1222 protected SubscriptionStatus typedCopy() { 1223 return copy(); 1224 } 1225 1226 @Override 1227 public boolean equalsDeep(Base other_) { 1228 if (!super.equalsDeep(other_)) 1229 return false; 1230 if (!(other_ instanceof SubscriptionStatus)) 1231 return false; 1232 SubscriptionStatus o = (SubscriptionStatus) other_; 1233 return compareDeep(status, o.status, true) && compareDeep(type, o.type, true) && compareDeep(eventsSinceSubscriptionStart, o.eventsSinceSubscriptionStart, true) 1234 && compareDeep(eventsInNotification, o.eventsInNotification, true) && compareDeep(notificationEvent, o.notificationEvent, true) 1235 && compareDeep(subscription, o.subscription, true) && compareDeep(topic, o.topic, true) && compareDeep(error, o.error, true) 1236 ; 1237 } 1238 1239 @Override 1240 public boolean equalsShallow(Base other_) { 1241 if (!super.equalsShallow(other_)) 1242 return false; 1243 if (!(other_ instanceof SubscriptionStatus)) 1244 return false; 1245 SubscriptionStatus o = (SubscriptionStatus) other_; 1246 return compareValues(status, o.status, true) && compareValues(type, o.type, true) && compareValues(eventsSinceSubscriptionStart, o.eventsSinceSubscriptionStart, true) 1247 && compareValues(eventsInNotification, o.eventsInNotification, true) && compareValues(topic, o.topic, true) 1248 ; 1249 } 1250 1251 public boolean isEmpty() { 1252 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, type, eventsSinceSubscriptionStart 1253 , eventsInNotification, notificationEvent, subscription, topic, error); 1254 } 1255 1256 @Override 1257 public ResourceType getResourceType() { 1258 return ResourceType.SubscriptionStatus; 1259 } 1260 1261 1262} 1263