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.IBaseDatatypeElement; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.Block; 047 048/** 049 * Base StructureDefinition for TriggerDefinition Type: A description of a triggering event. Triggering events can be named events, data events, or periodic, as determined by the type element. 050 */ 051@DatatypeDef(name="TriggerDefinition") 052public class TriggerDefinition extends DataType implements ICompositeType { 053 054 public enum TriggerType { 055 /** 056 * 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. 057 */ 058 NAMEDEVENT, 059 /** 060 * 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. 061 */ 062 PERIODIC, 063 /** 064 * The trigger occurs whenever data of a particular type is changed in any way, either added, modified, or removed. 065 */ 066 DATACHANGED, 067 /** 068 * The trigger occurs whenever data of a particular type is added. 069 */ 070 DATAADDED, 071 /** 072 * The trigger occurs whenever data of a particular type is modified. 073 */ 074 DATAMODIFIED, 075 /** 076 * The trigger occurs whenever data of a particular type is removed. 077 */ 078 DATAREMOVED, 079 /** 080 * The trigger occurs whenever data of a particular type is accessed. 081 */ 082 DATAACCESSED, 083 /** 084 * The trigger occurs whenever access to data of a particular type is completed. 085 */ 086 DATAACCESSENDED, 087 /** 088 * added to help the parsers with the generic types 089 */ 090 NULL; 091 public static TriggerType fromCode(String codeString) throws FHIRException { 092 if (codeString == null || "".equals(codeString)) 093 return null; 094 if ("named-event".equals(codeString)) 095 return NAMEDEVENT; 096 if ("periodic".equals(codeString)) 097 return PERIODIC; 098 if ("data-changed".equals(codeString)) 099 return DATACHANGED; 100 if ("data-added".equals(codeString)) 101 return DATAADDED; 102 if ("data-modified".equals(codeString)) 103 return DATAMODIFIED; 104 if ("data-removed".equals(codeString)) 105 return DATAREMOVED; 106 if ("data-accessed".equals(codeString)) 107 return DATAACCESSED; 108 if ("data-access-ended".equals(codeString)) 109 return DATAACCESSENDED; 110 if (Configuration.isAcceptInvalidEnums()) 111 return null; 112 else 113 throw new FHIRException("Unknown TriggerType code '"+codeString+"'"); 114 } 115 public String toCode() { 116 switch (this) { 117 case NAMEDEVENT: return "named-event"; 118 case PERIODIC: return "periodic"; 119 case DATACHANGED: return "data-changed"; 120 case DATAADDED: return "data-added"; 121 case DATAMODIFIED: return "data-modified"; 122 case DATAREMOVED: return "data-removed"; 123 case DATAACCESSED: return "data-accessed"; 124 case DATAACCESSENDED: return "data-access-ended"; 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 default: return "?"; 139 } 140 } 141 public String getDefinition() { 142 switch (this) { 143 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."; 144 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."; 145 case DATACHANGED: return "The trigger occurs whenever data of a particular type is changed in any way, either added, modified, or removed."; 146 case DATAADDED: return "The trigger occurs whenever data of a particular type is added."; 147 case DATAMODIFIED: return "The trigger occurs whenever data of a particular type is modified."; 148 case DATAREMOVED: return "The trigger occurs whenever data of a particular type is removed."; 149 case DATAACCESSED: return "The trigger occurs whenever data of a particular type is accessed."; 150 case DATAACCESSENDED: return "The trigger occurs whenever access to data of a particular type is completed."; 151 default: return "?"; 152 } 153 } 154 public String getDisplay() { 155 switch (this) { 156 case NAMEDEVENT: return "Named Event"; 157 case PERIODIC: return "Periodic"; 158 case DATACHANGED: return "Data Changed"; 159 case DATAADDED: return "Data Added"; 160 case DATAMODIFIED: return "Data Updated"; 161 case DATAREMOVED: return "Data Removed"; 162 case DATAACCESSED: return "Data Accessed"; 163 case DATAACCESSENDED: return "Data Access Ended"; 164 default: return "?"; 165 } 166 } 167 } 168 169 public static class TriggerTypeEnumFactory implements EnumFactory<TriggerType> { 170 public TriggerType fromCode(String codeString) throws IllegalArgumentException { 171 if (codeString == null || "".equals(codeString)) 172 if (codeString == null || "".equals(codeString)) 173 return null; 174 if ("named-event".equals(codeString)) 175 return TriggerType.NAMEDEVENT; 176 if ("periodic".equals(codeString)) 177 return TriggerType.PERIODIC; 178 if ("data-changed".equals(codeString)) 179 return TriggerType.DATACHANGED; 180 if ("data-added".equals(codeString)) 181 return TriggerType.DATAADDED; 182 if ("data-modified".equals(codeString)) 183 return TriggerType.DATAMODIFIED; 184 if ("data-removed".equals(codeString)) 185 return TriggerType.DATAREMOVED; 186 if ("data-accessed".equals(codeString)) 187 return TriggerType.DATAACCESSED; 188 if ("data-access-ended".equals(codeString)) 189 return TriggerType.DATAACCESSENDED; 190 throw new IllegalArgumentException("Unknown TriggerType code '"+codeString+"'"); 191 } 192 public Enumeration<TriggerType> fromType(Base code) throws FHIRException { 193 if (code == null) 194 return null; 195 if (code.isEmpty()) 196 return new Enumeration<TriggerType>(this); 197 String codeString = ((PrimitiveType) code).asStringValue(); 198 if (codeString == null || "".equals(codeString)) 199 return null; 200 if ("named-event".equals(codeString)) 201 return new Enumeration<TriggerType>(this, TriggerType.NAMEDEVENT); 202 if ("periodic".equals(codeString)) 203 return new Enumeration<TriggerType>(this, TriggerType.PERIODIC); 204 if ("data-changed".equals(codeString)) 205 return new Enumeration<TriggerType>(this, TriggerType.DATACHANGED); 206 if ("data-added".equals(codeString)) 207 return new Enumeration<TriggerType>(this, TriggerType.DATAADDED); 208 if ("data-modified".equals(codeString)) 209 return new Enumeration<TriggerType>(this, TriggerType.DATAMODIFIED); 210 if ("data-removed".equals(codeString)) 211 return new Enumeration<TriggerType>(this, TriggerType.DATAREMOVED); 212 if ("data-accessed".equals(codeString)) 213 return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSED); 214 if ("data-access-ended".equals(codeString)) 215 return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSENDED); 216 throw new FHIRException("Unknown TriggerType code '"+codeString+"'"); 217 } 218 public String toCode(TriggerType code) { 219 if (code == TriggerType.NAMEDEVENT) 220 return "named-event"; 221 if (code == TriggerType.PERIODIC) 222 return "periodic"; 223 if (code == TriggerType.DATACHANGED) 224 return "data-changed"; 225 if (code == TriggerType.DATAADDED) 226 return "data-added"; 227 if (code == TriggerType.DATAMODIFIED) 228 return "data-modified"; 229 if (code == TriggerType.DATAREMOVED) 230 return "data-removed"; 231 if (code == TriggerType.DATAACCESSED) 232 return "data-accessed"; 233 if (code == TriggerType.DATAACCESSENDED) 234 return "data-access-ended"; 235 return "?"; 236 } 237 public String toSystem(TriggerType code) { 238 return code.getSystem(); 239 } 240 } 241 242 /** 243 * The type of triggering event. 244 */ 245 @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true) 246 @Description(shortDefinition="named-event | periodic | data-changed | data-added | data-modified | data-removed | data-accessed | data-access-ended", formalDefinition="The type of triggering event." ) 247 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/trigger-type") 248 protected Enumeration<TriggerType> type; 249 250 /** 251 * 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. 252 */ 253 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 254 @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." ) 255 protected StringType name; 256 257 /** 258 * The timing of the event (if this is a periodic trigger). 259 */ 260 @Child(name = "timing", type = {Timing.class, Schedule.class, DateType.class, DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true) 261 @Description(shortDefinition="Timing of the event", formalDefinition="The timing of the event (if this is a periodic trigger)." ) 262 protected DataType timing; 263 264 /** 265 * 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. 266 */ 267 @Child(name = "data", type = {DataRequirement.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 268 @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." ) 269 protected List<DataRequirement> data; 270 271 /** 272 * 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. 273 */ 274 @Child(name = "condition", type = {Expression.class}, order=4, min=0, max=1, modifier=false, summary=true) 275 @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." ) 276 protected Expression condition; 277 278 private static final long serialVersionUID = 137099027L; 279 280 /** 281 * Constructor 282 */ 283 public TriggerDefinition() { 284 super(); 285 } 286 287 /** 288 * Constructor 289 */ 290 public TriggerDefinition(TriggerType type) { 291 super(); 292 this.setType(type); 293 } 294 295 /** 296 * @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 297 */ 298 public Enumeration<TriggerType> getTypeElement() { 299 if (this.type == null) 300 if (Configuration.errorOnAutoCreate()) 301 throw new Error("Attempt to auto-create TriggerDefinition.type"); 302 else if (Configuration.doAutoCreate()) 303 this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory()); // bb 304 return this.type; 305 } 306 307 public boolean hasTypeElement() { 308 return this.type != null && !this.type.isEmpty(); 309 } 310 311 public boolean hasType() { 312 return this.type != null && !this.type.isEmpty(); 313 } 314 315 /** 316 * @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 317 */ 318 public TriggerDefinition setTypeElement(Enumeration<TriggerType> value) { 319 this.type = value; 320 return this; 321 } 322 323 /** 324 * @return The type of triggering event. 325 */ 326 public TriggerType getType() { 327 return this.type == null ? null : this.type.getValue(); 328 } 329 330 /** 331 * @param value The type of triggering event. 332 */ 333 public TriggerDefinition setType(TriggerType value) { 334 if (this.type == null) 335 this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory()); 336 this.type.setValue(value); 337 return this; 338 } 339 340 /** 341 * @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 342 */ 343 public StringType getNameElement() { 344 if (this.name == null) 345 if (Configuration.errorOnAutoCreate()) 346 throw new Error("Attempt to auto-create TriggerDefinition.name"); 347 else if (Configuration.doAutoCreate()) 348 this.name = new StringType(); // bb 349 return this.name; 350 } 351 352 public boolean hasNameElement() { 353 return this.name != null && !this.name.isEmpty(); 354 } 355 356 public boolean hasName() { 357 return this.name != null && !this.name.isEmpty(); 358 } 359 360 /** 361 * @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 362 */ 363 public TriggerDefinition setNameElement(StringType value) { 364 this.name = value; 365 return this; 366 } 367 368 /** 369 * @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. 370 */ 371 public String getName() { 372 return this.name == null ? null : this.name.getValue(); 373 } 374 375 /** 376 * @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. 377 */ 378 public TriggerDefinition setName(String value) { 379 if (Utilities.noString(value)) 380 this.name = null; 381 else { 382 if (this.name == null) 383 this.name = new StringType(); 384 this.name.setValue(value); 385 } 386 return this; 387 } 388 389 /** 390 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 391 */ 392 public DataType getTiming() { 393 return this.timing; 394 } 395 396 /** 397 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 398 */ 399 public Timing getTimingTiming() throws FHIRException { 400 if (this.timing == null) 401 this.timing = new Timing(); 402 if (!(this.timing instanceof Timing)) 403 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 404 return (Timing) this.timing; 405 } 406 407 public boolean hasTimingTiming() { 408 return this != null && this.timing instanceof Timing; 409 } 410 411 /** 412 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 413 */ 414 public Reference getTimingReference() throws FHIRException { 415 if (this.timing == null) 416 this.timing = new Reference(); 417 if (!(this.timing instanceof Reference)) 418 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.timing.getClass().getName()+" was encountered"); 419 return (Reference) this.timing; 420 } 421 422 public boolean hasTimingReference() { 423 return this != null && this.timing instanceof Reference; 424 } 425 426 /** 427 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 428 */ 429 public DateType getTimingDateType() throws FHIRException { 430 if (this.timing == null) 431 this.timing = new DateType(); 432 if (!(this.timing instanceof DateType)) 433 throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered"); 434 return (DateType) this.timing; 435 } 436 437 public boolean hasTimingDateType() { 438 return this != null && this.timing instanceof DateType; 439 } 440 441 /** 442 * @return {@link #timing} (The timing of the event (if this is a periodic trigger).) 443 */ 444 public DateTimeType getTimingDateTimeType() throws FHIRException { 445 if (this.timing == null) 446 this.timing = new DateTimeType(); 447 if (!(this.timing instanceof DateTimeType)) 448 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 449 return (DateTimeType) this.timing; 450 } 451 452 public boolean hasTimingDateTimeType() { 453 return this != null && this.timing instanceof DateTimeType; 454 } 455 456 public boolean hasTiming() { 457 return this.timing != null && !this.timing.isEmpty(); 458 } 459 460 /** 461 * @param value {@link #timing} (The timing of the event (if this is a periodic trigger).) 462 */ 463 public TriggerDefinition setTiming(DataType value) { 464 if (value != null && !(value instanceof Timing || value instanceof Reference || value instanceof DateType || value instanceof DateTimeType)) 465 throw new Error("Not the right type for TriggerDefinition.timing[x]: "+value.fhirType()); 466 this.timing = value; 467 return this; 468 } 469 470 /** 471 * @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.) 472 */ 473 public List<DataRequirement> getData() { 474 if (this.data == null) 475 this.data = new ArrayList<DataRequirement>(); 476 return this.data; 477 } 478 479 /** 480 * @return Returns a reference to <code>this</code> for easy method chaining 481 */ 482 public TriggerDefinition setData(List<DataRequirement> theData) { 483 this.data = theData; 484 return this; 485 } 486 487 public boolean hasData() { 488 if (this.data == null) 489 return false; 490 for (DataRequirement item : this.data) 491 if (!item.isEmpty()) 492 return true; 493 return false; 494 } 495 496 public DataRequirement addData() { //3 497 DataRequirement t = new DataRequirement(); 498 if (this.data == null) 499 this.data = new ArrayList<DataRequirement>(); 500 this.data.add(t); 501 return t; 502 } 503 504 public TriggerDefinition addData(DataRequirement t) { //3 505 if (t == null) 506 return this; 507 if (this.data == null) 508 this.data = new ArrayList<DataRequirement>(); 509 this.data.add(t); 510 return this; 511 } 512 513 /** 514 * @return The first repetition of repeating field {@link #data}, creating it if it does not already exist {3} 515 */ 516 public DataRequirement getDataFirstRep() { 517 if (getData().isEmpty()) { 518 addData(); 519 } 520 return getData().get(0); 521 } 522 523 /** 524 * @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.) 525 */ 526 public Expression getCondition() { 527 if (this.condition == null) 528 if (Configuration.errorOnAutoCreate()) 529 throw new Error("Attempt to auto-create TriggerDefinition.condition"); 530 else if (Configuration.doAutoCreate()) 531 this.condition = new Expression(); // cc 532 return this.condition; 533 } 534 535 public boolean hasCondition() { 536 return this.condition != null && !this.condition.isEmpty(); 537 } 538 539 /** 540 * @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.) 541 */ 542 public TriggerDefinition setCondition(Expression value) { 543 this.condition = value; 544 return this; 545 } 546 547 protected void listChildren(List<Property> children) { 548 super.listChildren(children); 549 children.add(new Property("type", "code", "The type of triggering event.", 0, 1, type)); 550 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)); 551 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)); 552 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)); 553 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)); 554 } 555 556 @Override 557 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 558 switch (_hash) { 559 case 3575610: /*type*/ return new Property("type", "code", "The type of triggering event.", 0, 1, type); 560 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); 561 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); 562 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); 563 case -497554124: /*timingTiming*/ return new Property("timing[x]", "Timing", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 564 case -1792466399: /*timingReference*/ return new Property("timing[x]", "Reference(Schedule)", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 565 case 807935768: /*timingDate*/ return new Property("timing[x]", "date", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 566 case -1837458939: /*timingDateTime*/ return new Property("timing[x]", "dateTime", "The timing of the event (if this is a periodic trigger).", 0, 1, timing); 567 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); 568 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); 569 default: return super.getNamedProperty(_hash, _name, _checkValid); 570 } 571 572 } 573 574 @Override 575 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 576 switch (hash) { 577 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<TriggerType> 578 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 579 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType 580 case 3076010: /*data*/ return this.data == null ? new Base[0] : this.data.toArray(new Base[this.data.size()]); // DataRequirement 581 case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // Expression 582 default: return super.getProperty(hash, name, checkValid); 583 } 584 585 } 586 587 @Override 588 public Base setProperty(int hash, String name, Base value) throws FHIRException { 589 switch (hash) { 590 case 3575610: // type 591 value = new TriggerTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 592 this.type = (Enumeration) value; // Enumeration<TriggerType> 593 return value; 594 case 3373707: // name 595 this.name = TypeConvertor.castToString(value); // StringType 596 return value; 597 case -873664438: // timing 598 this.timing = TypeConvertor.castToType(value); // DataType 599 return value; 600 case 3076010: // data 601 this.getData().add(TypeConvertor.castToDataRequirement(value)); // DataRequirement 602 return value; 603 case -861311717: // condition 604 this.condition = TypeConvertor.castToExpression(value); // Expression 605 return value; 606 default: return super.setProperty(hash, name, value); 607 } 608 609 } 610 611 @Override 612 public Base setProperty(String name, Base value) throws FHIRException { 613 if (name.equals("type")) { 614 value = new TriggerTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 615 this.type = (Enumeration) value; // Enumeration<TriggerType> 616 } else if (name.equals("name")) { 617 this.name = TypeConvertor.castToString(value); // StringType 618 } else if (name.equals("timing[x]")) { 619 this.timing = TypeConvertor.castToType(value); // DataType 620 } else if (name.equals("data")) { 621 this.getData().add(TypeConvertor.castToDataRequirement(value)); 622 } else if (name.equals("condition")) { 623 this.condition = TypeConvertor.castToExpression(value); // Expression 624 } else 625 return super.setProperty(name, value); 626 return value; 627 } 628 629 @Override 630 public Base makeProperty(int hash, String name) throws FHIRException { 631 switch (hash) { 632 case 3575610: return getTypeElement(); 633 case 3373707: return getNameElement(); 634 case 164632566: return getTiming(); 635 case -873664438: return getTiming(); 636 case 3076010: return addData(); 637 case -861311717: return getCondition(); 638 default: return super.makeProperty(hash, name); 639 } 640 641 } 642 643 @Override 644 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 645 switch (hash) { 646 case 3575610: /*type*/ return new String[] {"code"}; 647 case 3373707: /*name*/ return new String[] {"string"}; 648 case -873664438: /*timing*/ return new String[] {"Timing", "Reference", "date", "dateTime"}; 649 case 3076010: /*data*/ return new String[] {"DataRequirement"}; 650 case -861311717: /*condition*/ return new String[] {"Expression"}; 651 default: return super.getTypesForProperty(hash, name); 652 } 653 654 } 655 656 @Override 657 public Base addChild(String name) throws FHIRException { 658 if (name.equals("type")) { 659 throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.type"); 660 } 661 else if (name.equals("name")) { 662 throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.name"); 663 } 664 else if (name.equals("timingTiming")) { 665 this.timing = new Timing(); 666 return this.timing; 667 } 668 else if (name.equals("timingReference")) { 669 this.timing = new Reference(); 670 return this.timing; 671 } 672 else if (name.equals("timingDate")) { 673 this.timing = new DateType(); 674 return this.timing; 675 } 676 else if (name.equals("timingDateTime")) { 677 this.timing = new DateTimeType(); 678 return this.timing; 679 } 680 else if (name.equals("data")) { 681 return addData(); 682 } 683 else if (name.equals("condition")) { 684 this.condition = new Expression(); 685 return this.condition; 686 } 687 else 688 return super.addChild(name); 689 } 690 691 public String fhirType() { 692 return "TriggerDefinition"; 693 694 } 695 696 public TriggerDefinition copy() { 697 TriggerDefinition dst = new TriggerDefinition(); 698 copyValues(dst); 699 return dst; 700 } 701 702 public void copyValues(TriggerDefinition dst) { 703 super.copyValues(dst); 704 dst.type = type == null ? null : type.copy(); 705 dst.name = name == null ? null : name.copy(); 706 dst.timing = timing == null ? null : timing.copy(); 707 if (data != null) { 708 dst.data = new ArrayList<DataRequirement>(); 709 for (DataRequirement i : data) 710 dst.data.add(i.copy()); 711 }; 712 dst.condition = condition == null ? null : condition.copy(); 713 } 714 715 protected TriggerDefinition typedCopy() { 716 return copy(); 717 } 718 719 @Override 720 public boolean equalsDeep(Base other_) { 721 if (!super.equalsDeep(other_)) 722 return false; 723 if (!(other_ instanceof TriggerDefinition)) 724 return false; 725 TriggerDefinition o = (TriggerDefinition) other_; 726 return compareDeep(type, o.type, true) && compareDeep(name, o.name, true) && compareDeep(timing, o.timing, true) 727 && compareDeep(data, o.data, true) && compareDeep(condition, o.condition, true); 728 } 729 730 @Override 731 public boolean equalsShallow(Base other_) { 732 if (!super.equalsShallow(other_)) 733 return false; 734 if (!(other_ instanceof TriggerDefinition)) 735 return false; 736 TriggerDefinition o = (TriggerDefinition) other_; 737 return compareValues(type, o.type, true) && compareValues(name, o.name, true); 738 } 739 740 public boolean isEmpty() { 741 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, name, timing, data 742 , condition); 743 } 744 745 746} 747