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