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