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