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