001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import org.hl7.fhir.utilities.Utilities; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.ChildOrder; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Block; 045import org.hl7.fhir.instance.model.api.*; 046import org.hl7.fhir.exceptions.FHIRException; 047/** 048 * A description of a triggering event. Triggering events can be named events, data events, or periodic, as determined by the type element. 049 */ 050@DatatypeDef(name="TriggerDefinition") 051public class TriggerDefinition extends Type implements ICompositeType { 052 053 public enum TriggerType { 054 /** 055 * The trigger occurs in response to a specific named event, and no other information about the trigger is specified. Named events are completely pre-coordinated, and the formal semantics of the trigger are not provided. 056 */ 057 NAMEDEVENT, 058 /** 059 * The trigger occurs at a specific time or periodically as described by a timing or schedule. A periodic event cannot have any data elements, but may have a name assigned as a shorthand for the event. 060 */ 061 PERIODIC, 062 /** 063 * The trigger occurs whenever data of a particular type is changed in any way, either added, modified, or removed. 064 */ 065 DATACHANGED, 066 /** 067 * The trigger occurs whenever data of a particular type is added. 068 */ 069 DATAADDED, 070 /** 071 * The trigger occurs whenever data of a particular type is modified. 072 */ 073 DATAMODIFIED, 074 /** 075 * The trigger occurs whenever data of a particular type is removed. 076 */ 077 DATAREMOVED, 078 /** 079 * The trigger occurs whenever data of a particular type is accessed. 080 */ 081 DATAACCESSED, 082 /** 083 * The trigger occurs whenever access to data of a particular type is completed. 084 */ 085 DATAACCESSENDED, 086 /** 087 * added to help the parsers with the generic types 088 */ 089 NULL; 090 public static TriggerType fromCode(String codeString) throws FHIRException { 091 if (codeString == null || "".equals(codeString)) 092 return null; 093 if ("named-event".equals(codeString)) 094 return NAMEDEVENT; 095 if ("periodic".equals(codeString)) 096 return PERIODIC; 097 if ("data-changed".equals(codeString)) 098 return DATACHANGED; 099 if ("data-added".equals(codeString)) 100 return DATAADDED; 101 if ("data-modified".equals(codeString)) 102 return DATAMODIFIED; 103 if ("data-removed".equals(codeString)) 104 return DATAREMOVED; 105 if ("data-accessed".equals(codeString)) 106 return DATAACCESSED; 107 if ("data-access-ended".equals(codeString)) 108 return DATAACCESSENDED; 109 if (Configuration.isAcceptInvalidEnums()) 110 return null; 111 else 112 throw new FHIRException("Unknown TriggerType code '"+codeString+"'"); 113 } 114 public String toCode() { 115 switch (this) { 116 case NAMEDEVENT: return "named-event"; 117 case PERIODIC: return "periodic"; 118 case DATACHANGED: return "data-changed"; 119 case DATAADDED: return "data-added"; 120 case DATAMODIFIED: return "data-modified"; 121 case DATAREMOVED: return "data-removed"; 122 case DATAACCESSED: return "data-accessed"; 123 case DATAACCESSENDED: return "data-access-ended"; 124 case NULL: return null; 125 default: return "?"; 126 } 127 } 128 public String getSystem() { 129 switch (this) { 130 case NAMEDEVENT: return "http://hl7.org/fhir/trigger-type"; 131 case PERIODIC: return "http://hl7.org/fhir/trigger-type"; 132 case DATACHANGED: return "http://hl7.org/fhir/trigger-type"; 133 case DATAADDED: return "http://hl7.org/fhir/trigger-type"; 134 case DATAMODIFIED: return "http://hl7.org/fhir/trigger-type"; 135 case DATAREMOVED: return "http://hl7.org/fhir/trigger-type"; 136 case DATAACCESSED: return "http://hl7.org/fhir/trigger-type"; 137 case DATAACCESSENDED: return "http://hl7.org/fhir/trigger-type"; 138 case NULL: return null; 139 default: return "?"; 140 } 141 } 142 public String getDefinition() { 143 switch (this) { 144 case NAMEDEVENT: return "The trigger occurs in response to a specific named event, and no other information about the trigger is specified. Named events are completely pre-coordinated, and the formal semantics of the trigger are not provided."; 145 case PERIODIC: return "The trigger occurs at a specific time or periodically as described by a timing or schedule. A periodic event cannot have any data elements, but may have a name assigned as a shorthand for the event."; 146 case DATACHANGED: return "The trigger occurs whenever data of a particular type is changed in any way, either added, modified, or removed."; 147 case DATAADDED: return "The trigger occurs whenever data of a particular type is added."; 148 case DATAMODIFIED: return "The trigger occurs whenever data of a particular type is modified."; 149 case DATAREMOVED: return "The trigger occurs whenever data of a particular type is removed."; 150 case DATAACCESSED: return "The trigger occurs whenever data of a particular type is accessed."; 151 case DATAACCESSENDED: return "The trigger occurs whenever access to data of a particular type is completed."; 152 case NULL: return null; 153 default: return "?"; 154 } 155 } 156 public String getDisplay() { 157 switch (this) { 158 case NAMEDEVENT: return "Named Event"; 159 case PERIODIC: return "Periodic"; 160 case DATACHANGED: return "Data Changed"; 161 case DATAADDED: return "Data Added"; 162 case DATAMODIFIED: return "Data Updated"; 163 case DATAREMOVED: return "Data Removed"; 164 case DATAACCESSED: return "Data Accessed"; 165 case DATAACCESSENDED: return "Data Access Ended"; 166 case NULL: return null; 167 default: return "?"; 168 } 169 } 170 } 171 172 public static class TriggerTypeEnumFactory implements EnumFactory<TriggerType> { 173 public TriggerType fromCode(String codeString) throws IllegalArgumentException { 174 if (codeString == null || "".equals(codeString)) 175 if (codeString == null || "".equals(codeString)) 176 return null; 177 if ("named-event".equals(codeString)) 178 return TriggerType.NAMEDEVENT; 179 if ("periodic".equals(codeString)) 180 return TriggerType.PERIODIC; 181 if ("data-changed".equals(codeString)) 182 return TriggerType.DATACHANGED; 183 if ("data-added".equals(codeString)) 184 return TriggerType.DATAADDED; 185 if ("data-modified".equals(codeString)) 186 return TriggerType.DATAMODIFIED; 187 if ("data-removed".equals(codeString)) 188 return TriggerType.DATAREMOVED; 189 if ("data-accessed".equals(codeString)) 190 return TriggerType.DATAACCESSED; 191 if ("data-access-ended".equals(codeString)) 192 return TriggerType.DATAACCESSENDED; 193 throw new IllegalArgumentException("Unknown TriggerType code '"+codeString+"'"); 194 } 195 public Enumeration<TriggerType> fromType(Base code) throws FHIRException { 196 if (code == null) 197 return null; 198 if (code.isEmpty()) 199 return new Enumeration<TriggerType>(this); 200 String codeString = ((PrimitiveType) code).asStringValue(); 201 if (codeString == null || "".equals(codeString)) 202 return null; 203 if ("named-event".equals(codeString)) 204 return new Enumeration<TriggerType>(this, TriggerType.NAMEDEVENT); 205 if ("periodic".equals(codeString)) 206 return new Enumeration<TriggerType>(this, TriggerType.PERIODIC); 207 if ("data-changed".equals(codeString)) 208 return new Enumeration<TriggerType>(this, TriggerType.DATACHANGED); 209 if ("data-added".equals(codeString)) 210 return new Enumeration<TriggerType>(this, TriggerType.DATAADDED); 211 if ("data-modified".equals(codeString)) 212 return new Enumeration<TriggerType>(this, TriggerType.DATAMODIFIED); 213 if ("data-removed".equals(codeString)) 214 return new Enumeration<TriggerType>(this, TriggerType.DATAREMOVED); 215 if ("data-accessed".equals(codeString)) 216 return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSED); 217 if ("data-access-ended".equals(codeString)) 218 return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSENDED); 219 throw new FHIRException("Unknown TriggerType code '"+codeString+"'"); 220 } 221 public String toCode(TriggerType code) { 222 if (code == TriggerType.NAMEDEVENT) 223 return "named-event"; 224 if (code == TriggerType.PERIODIC) 225 return "periodic"; 226 if (code == TriggerType.DATACHANGED) 227 return "data-changed"; 228 if (code == TriggerType.DATAADDED) 229 return "data-added"; 230 if (code == TriggerType.DATAMODIFIED) 231 return "data-modified"; 232 if (code == TriggerType.DATAREMOVED) 233 return "data-removed"; 234 if (code == TriggerType.DATAACCESSED) 235 return "data-accessed"; 236 if (code == TriggerType.DATAACCESSENDED) 237 return "data-access-ended"; 238 return "?"; 239 } 240 public String toSystem(TriggerType code) { 241 return code.getSystem(); 242 } 243 } 244 245 /** 246 * The type of triggering event. 247 */ 248 @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true) 249 @Description(shortDefinition="named-event | periodic | data-changed | data-added | data-modified | data-removed | data-accessed | data-access-ended", formalDefinition="The type of triggering event." ) 250 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/trigger-type") 251 protected Enumeration<TriggerType> type; 252 253 /** 254 * A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context. 255 */ 256 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 257 @Description(shortDefinition="Name or URI that identifies the event", formalDefinition="A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context." ) 258 protected StringType name; 259 260 /** 261 * The timing of the event (if this is a periodic trigger). 262 */ 263 @Child(name = "timing", type = {Timing.class, Schedule.class, DateType.class, DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true) 264 @Description(shortDefinition="Timing of the event", formalDefinition="The timing of the event (if this is a periodic trigger)." ) 265 protected Type timing; 266 267 /** 268 * The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true. 269 */ 270 @Child(name = "data", type = {DataRequirement.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 271 @Description(shortDefinition="Triggering data of the event (multiple = 'and')", formalDefinition="The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true." ) 272 protected List<DataRequirement> data; 273 274 /** 275 * A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires. 276 */ 277 @Child(name = "condition", type = {Expression.class}, order=4, min=0, max=1, modifier=false, summary=true) 278 @Description(shortDefinition="Whether the event triggers (boolean expression)", formalDefinition="A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires." ) 279 protected Expression condition; 280 281 private static final long serialVersionUID = -1706033335L; 282 283 /** 284 * Constructor 285 */ 286 public TriggerDefinition() { 287 super(); 288 } 289 290 /** 291 * Constructor 292 */ 293 public TriggerDefinition(Enumeration<TriggerType> type) { 294 super(); 295 this.type = type; 296 } 297 298 /** 299 * @return {@link #type} (The type of triggering event.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 300 */ 301 public Enumeration<TriggerType> getTypeElement() { 302 if (this.type == null) 303 if (Configuration.errorOnAutoCreate()) 304 throw new Error("Attempt to auto-create TriggerDefinition.type"); 305 else if (Configuration.doAutoCreate()) 306 this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory()); // bb 307 return this.type; 308 } 309 310 public boolean hasTypeElement() { 311 return this.type != null && !this.type.isEmpty(); 312 } 313 314 public boolean hasType() { 315 return this.type != null && !this.type.isEmpty(); 316 } 317 318 /** 319 * @param value {@link #type} (The type of triggering event.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 320 */ 321 public TriggerDefinition setTypeElement(Enumeration<TriggerType> value) { 322 this.type = value; 323 return this; 324 } 325 326 /** 327 * @return The type of triggering event. 328 */ 329 public TriggerType getType() { 330 return this.type == null ? null : this.type.getValue(); 331 } 332 333 /** 334 * @param value The type of triggering event. 335 */ 336 public TriggerDefinition setType(TriggerType value) { 337 if (this.type == null) 338 this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory()); 339 this.type.setValue(value); 340 return this; 341 } 342 343 /** 344 * @return {@link #name} (A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 345 */ 346 public StringType getNameElement() { 347 if (this.name == null) 348 if (Configuration.errorOnAutoCreate()) 349 throw new Error("Attempt to auto-create TriggerDefinition.name"); 350 else if (Configuration.doAutoCreate()) 351 this.name = new StringType(); // bb 352 return this.name; 353 } 354 355 public boolean hasNameElement() { 356 return this.name != null && !this.name.isEmpty(); 357 } 358 359 public boolean hasName() { 360 return this.name != null && !this.name.isEmpty(); 361 } 362 363 /** 364 * @param value {@link #name} (A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 365 */ 366 public TriggerDefinition setNameElement(StringType value) { 367 this.name = value; 368 return this; 369 } 370 371 /** 372 * @return A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context. 373 */ 374 public String getName() { 375 return this.name == null ? null : this.name.getValue(); 376 } 377 378 /** 379 * @param value A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context. 380 */ 381 public TriggerDefinition setName(String value) { 382 if (Utilities.noString(value)) 383 this.name = null; 384 else { 385 if (this.name == null) 386 this.name = new StringType(); 387 this.name.setValue(value); 388 } 389 return this; 390 } 391 392 /** 393 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 394 */ 395 public Type getTiming() { 396 return this.timing; 397 } 398 399 /** 400 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 401 */ 402 public Timing getTimingTiming() throws FHIRException { 403 if (this.timing == null) 404 this.timing = new Timing(); 405 if (!(this.timing instanceof Timing)) 406 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 407 return (Timing) this.timing; 408 } 409 410 public boolean hasTimingTiming() { 411 return this != null && this.timing instanceof Timing; 412 } 413 414 /** 415 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 416 */ 417 public Reference getTimingReference() throws FHIRException { 418 if (this.timing == null) 419 this.timing = new Reference(); 420 if (!(this.timing instanceof Reference)) 421 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.timing.getClass().getName()+" was encountered"); 422 return (Reference) this.timing; 423 } 424 425 public boolean hasTimingReference() { 426 return this != null && this.timing instanceof Reference; 427 } 428 429 /** 430 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 431 */ 432 public DateType getTimingDateType() throws FHIRException { 433 if (this.timing == null) 434 this.timing = new DateType(); 435 if (!(this.timing instanceof DateType)) 436 throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered"); 437 return (DateType) this.timing; 438 } 439 440 public boolean hasTimingDateType() { 441 return this != null && this.timing instanceof DateType; 442 } 443 444 /** 445 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 446 */ 447 public DateTimeType getTimingDateTimeType() throws FHIRException { 448 if (this.timing == null) 449 this.timing = new DateTimeType(); 450 if (!(this.timing instanceof DateTimeType)) 451 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 452 return (DateTimeType) this.timing; 453 } 454 455 public boolean hasTimingDateTimeType() { 456 return this != null && this.timing instanceof DateTimeType; 457 } 458 459 public boolean hasTiming() { 460 return this.timing != null && !this.timing.isEmpty(); 461 } 462 463 /** 464 * @param value {@link #timing} (The timing of the event (if this is a periodic trigger).) 465 */ 466 public TriggerDefinition setTiming(Type value) { 467 if (value != null && !(value instanceof Timing || value instanceof Reference || value instanceof DateType || value instanceof DateTimeType)) 468 throw new Error("Not the right type for TriggerDefinition.timing[x]: "+value.fhirType()); 469 this.timing = value; 470 return this; 471 } 472 473 /** 474 * @return {@link #data} (The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true.) 475 */ 476 public List<DataRequirement> getData() { 477 if (this.data == null) 478 this.data = new ArrayList<DataRequirement>(); 479 return this.data; 480 } 481 482 /** 483 * @return Returns a reference to <code>this</code> for easy method chaining 484 */ 485 public TriggerDefinition setData(List<DataRequirement> theData) { 486 this.data = theData; 487 return this; 488 } 489 490 public boolean hasData() { 491 if (this.data == null) 492 return false; 493 for (DataRequirement item : this.data) 494 if (!item.isEmpty()) 495 return true; 496 return false; 497 } 498 499 public DataRequirement addData() { //3 500 DataRequirement t = new DataRequirement(); 501 if (this.data == null) 502 this.data = new ArrayList<DataRequirement>(); 503 this.data.add(t); 504 return t; 505 } 506 507 public TriggerDefinition addData(DataRequirement t) { //3 508 if (t == null) 509 return this; 510 if (this.data == null) 511 this.data = new ArrayList<DataRequirement>(); 512 this.data.add(t); 513 return this; 514 } 515 516 /** 517 * @return The first repetition of repeating field {@link #data}, creating it if it does not already exist 518 */ 519 public DataRequirement getDataFirstRep() { 520 if (getData().isEmpty()) { 521 addData(); 522 } 523 return getData().get(0); 524 } 525 526 /** 527 * @return {@link #condition} (A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires.) 528 */ 529 public Expression getCondition() { 530 if (this.condition == null) 531 if (Configuration.errorOnAutoCreate()) 532 throw new Error("Attempt to auto-create TriggerDefinition.condition"); 533 else if (Configuration.doAutoCreate()) 534 this.condition = new Expression(); // cc 535 return this.condition; 536 } 537 538 public boolean hasCondition() { 539 return this.condition != null && !this.condition.isEmpty(); 540 } 541 542 /** 543 * @param value {@link #condition} (A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires.) 544 */ 545 public TriggerDefinition setCondition(Expression value) { 546 this.condition = value; 547 return this; 548 } 549 550 protected void listChildren(List<Property> children) { 551 super.listChildren(children); 552 children.add(new Property("type", "code", "The type of triggering event.", 0, 1, type)); 553 children.add(new Property("name", "string", "A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context.", 0, 1, name)); 554 children.add(new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing)); 555 children.add(new Property("data", "DataRequirement", "The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true.", 0, java.lang.Integer.MAX_VALUE, data)); 556 children.add(new Property("condition", "Expression", "A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires.", 0, 1, condition)); 557 } 558 559 @Override 560 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 561 switch (_hash) { 562 case 3575610: /*type*/ return new Property("type", "code", "The type of triggering event.", 0, 1, type); 563 case 3373707: /*name*/ return new Property("name", "string", "A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context.", 0, 1, name); 564 case 164632566: /*timing[x]*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 565 case -873664438: /*timing*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 566 case -497554124: /*timingTiming*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 567 case -1792466399: /*timingReference*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 568 case 807935768: /*timingDate*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 569 case -1837458939: /*timingDateTime*/ return new Property("timing[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 570 case 3076010: /*data*/ return new Property("data", "DataRequirement", "The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true.", 0, java.lang.Integer.MAX_VALUE, data); 571 case -861311717: /*condition*/ return new Property("condition", "Expression", "A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires.", 0, 1, condition); 572 default: return super.getNamedProperty(_hash, _name, _checkValid); 573 } 574 575 } 576 577 @Override 578 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 579 switch (hash) { 580 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<TriggerType> 581 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 582 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type 583 case 3076010: /*data*/ return this.data == null ? new Base[0] : this.data.toArray(new Base[this.data.size()]); // DataRequirement 584 case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // Expression 585 default: return super.getProperty(hash, name, checkValid); 586 } 587 588 } 589 590 @Override 591 public Base setProperty(int hash, String name, Base value) throws FHIRException { 592 switch (hash) { 593 case 3575610: // type 594 value = new TriggerTypeEnumFactory().fromType(castToCode(value)); 595 this.type = (Enumeration) value; // Enumeration<TriggerType> 596 return value; 597 case 3373707: // name 598 this.name = castToString(value); // StringType 599 return value; 600 case -873664438: // timing 601 this.timing = castToType(value); // Type 602 return value; 603 case 3076010: // data 604 this.getData().add(castToDataRequirement(value)); // DataRequirement 605 return value; 606 case -861311717: // condition 607 this.condition = castToExpression(value); // Expression 608 return value; 609 default: return super.setProperty(hash, name, value); 610 } 611 612 } 613 614 @Override 615 public Base setProperty(String name, Base value) throws FHIRException { 616 if (name.equals("type")) { 617 value = new TriggerTypeEnumFactory().fromType(castToCode(value)); 618 this.type = (Enumeration) value; // Enumeration<TriggerType> 619 } else if (name.equals("name")) { 620 this.name = castToString(value); // StringType 621 } else if (name.equals("timing[x]")) { 622 this.timing = castToType(value); // Type 623 } else if (name.equals("data")) { 624 this.getData().add(castToDataRequirement(value)); 625 } else if (name.equals("condition")) { 626 this.condition = castToExpression(value); // Expression 627 } else 628 return super.setProperty(name, value); 629 return value; 630 } 631 632 @Override 633 public Base makeProperty(int hash, String name) throws FHIRException { 634 switch (hash) { 635 case 3575610: return getTypeElement(); 636 case 3373707: return getNameElement(); 637 case 164632566: return getTiming(); 638 case -873664438: return getTiming(); 639 case 3076010: return addData(); 640 case -861311717: return getCondition(); 641 default: return super.makeProperty(hash, name); 642 } 643 644 } 645 646 @Override 647 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 648 switch (hash) { 649 case 3575610: /*type*/ return new String[] {"code"}; 650 case 3373707: /*name*/ return new String[] {"string"}; 651 case -873664438: /*timing*/ return new String[] {"Timing", "Reference", "date", "dateTime"}; 652 case 3076010: /*data*/ return new String[] {"DataRequirement"}; 653 case -861311717: /*condition*/ return new String[] {"Expression"}; 654 default: return super.getTypesForProperty(hash, name); 655 } 656 657 } 658 659 @Override 660 public Base addChild(String name) throws FHIRException { 661 if (name.equals("type")) { 662 throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.type"); 663 } 664 else if (name.equals("name")) { 665 throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.name"); 666 } 667 else if (name.equals("timingTiming")) { 668 this.timing = new Timing(); 669 return this.timing; 670 } 671 else if (name.equals("timingReference")) { 672 this.timing = new Reference(); 673 return this.timing; 674 } 675 else if (name.equals("timingDate")) { 676 this.timing = new DateType(); 677 return this.timing; 678 } 679 else if (name.equals("timingDateTime")) { 680 this.timing = new DateTimeType(); 681 return this.timing; 682 } 683 else if (name.equals("data")) { 684 return addData(); 685 } 686 else if (name.equals("condition")) { 687 this.condition = new Expression(); 688 return this.condition; 689 } 690 else 691 return super.addChild(name); 692 } 693 694 public String fhirType() { 695 return "TriggerDefinition"; 696 697 } 698 699 public TriggerDefinition copy() { 700 TriggerDefinition dst = new TriggerDefinition(); 701 copyValues(dst); 702 return dst; 703 } 704 705 public void copyValues(TriggerDefinition dst) { 706 super.copyValues(dst); 707 dst.type = type == null ? null : type.copy(); 708 dst.name = name == null ? null : name.copy(); 709 dst.timing = timing == null ? null : timing.copy(); 710 if (data != null) { 711 dst.data = new ArrayList<DataRequirement>(); 712 for (DataRequirement i : data) 713 dst.data.add(i.copy()); 714 }; 715 dst.condition = condition == null ? null : condition.copy(); 716 } 717 718 protected TriggerDefinition typedCopy() { 719 return copy(); 720 } 721 722 @Override 723 public boolean equalsDeep(Base other_) { 724 if (!super.equalsDeep(other_)) 725 return false; 726 if (!(other_ instanceof TriggerDefinition)) 727 return false; 728 TriggerDefinition o = (TriggerDefinition) other_; 729 return compareDeep(type, o.type, true) && compareDeep(name, o.name, true) && compareDeep(timing, o.timing, true) 730 && compareDeep(data, o.data, true) && compareDeep(condition, o.condition, true); 731 } 732 733 @Override 734 public boolean equalsShallow(Base other_) { 735 if (!super.equalsShallow(other_)) 736 return false; 737 if (!(other_ instanceof TriggerDefinition)) 738 return false; 739 TriggerDefinition o = (TriggerDefinition) other_; 740 return compareValues(type, o.type, true) && compareValues(name, o.name, true); 741 } 742 743 public boolean isEmpty() { 744 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, name, timing, data 745 , condition); 746 } 747 748 749}