001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.Child;
038import ca.uhn.fhir.model.api.annotation.ChildOrder;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.DatatypeDef;
041import ca.uhn.fhir.model.api.annotation.Block;
042import org.hl7.fhir.instance.model.api.*;
043import org.hl7.fhir.exceptions.FHIRException;
044import org.hl7.fhir.exceptions.FHIRFormatError;
045/**
046 * A description of a triggering event.
047 */
048@DatatypeDef(name="TriggerDefinition")
049public class TriggerDefinition extends Type implements ICompositeType {
050
051    public enum TriggerType {
052        /**
053         * The trigger occurs in response to a specific named event
054         */
055        NAMEDEVENT, 
056        /**
057         * The trigger occurs at a specific time or periodically as described by a timing or schedule
058         */
059        PERIODIC, 
060        /**
061         * The trigger occurs whenever data of a particular type is added
062         */
063        DATAADDED, 
064        /**
065         * The trigger occurs whenever data of a particular type is modified
066         */
067        DATAMODIFIED, 
068        /**
069         * The trigger occurs whenever data of a particular type is removed
070         */
071        DATAREMOVED, 
072        /**
073         * The trigger occurs whenever data of a particular type is accessed
074         */
075        DATAACCESSED, 
076        /**
077         * The trigger occurs whenever access to data of a particular type is completed
078         */
079        DATAACCESSENDED, 
080        /**
081         * added to help the parsers with the generic types
082         */
083        NULL;
084        public static TriggerType fromCode(String codeString) throws FHIRException {
085            if (codeString == null || "".equals(codeString))
086                return null;
087        if ("named-event".equals(codeString))
088          return NAMEDEVENT;
089        if ("periodic".equals(codeString))
090          return PERIODIC;
091        if ("data-added".equals(codeString))
092          return DATAADDED;
093        if ("data-modified".equals(codeString))
094          return DATAMODIFIED;
095        if ("data-removed".equals(codeString))
096          return DATAREMOVED;
097        if ("data-accessed".equals(codeString))
098          return DATAACCESSED;
099        if ("data-access-ended".equals(codeString))
100          return DATAACCESSENDED;
101        if (Configuration.isAcceptInvalidEnums())
102          return null;
103        else
104          throw new FHIRException("Unknown TriggerType code '"+codeString+"'");
105        }
106        public String toCode() {
107          switch (this) {
108            case NAMEDEVENT: return "named-event";
109            case PERIODIC: return "periodic";
110            case DATAADDED: return "data-added";
111            case DATAMODIFIED: return "data-modified";
112            case DATAREMOVED: return "data-removed";
113            case DATAACCESSED: return "data-accessed";
114            case DATAACCESSENDED: return "data-access-ended";
115            default: return "?";
116          }
117        }
118        public String getSystem() {
119          switch (this) {
120            case NAMEDEVENT: return "http://hl7.org/fhir/trigger-type";
121            case PERIODIC: return "http://hl7.org/fhir/trigger-type";
122            case DATAADDED: return "http://hl7.org/fhir/trigger-type";
123            case DATAMODIFIED: return "http://hl7.org/fhir/trigger-type";
124            case DATAREMOVED: return "http://hl7.org/fhir/trigger-type";
125            case DATAACCESSED: return "http://hl7.org/fhir/trigger-type";
126            case DATAACCESSENDED: return "http://hl7.org/fhir/trigger-type";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case NAMEDEVENT: return "The trigger occurs in response to a specific named event";
133            case PERIODIC: return "The trigger occurs at a specific time or periodically as described by a timing or schedule";
134            case DATAADDED: return "The trigger occurs whenever data of a particular type is added";
135            case DATAMODIFIED: return "The trigger occurs whenever data of a particular type is modified";
136            case DATAREMOVED: return "The trigger occurs whenever data of a particular type is removed";
137            case DATAACCESSED: return "The trigger occurs whenever data of a particular type is accessed";
138            case DATAACCESSENDED: return "The trigger occurs whenever access to data of a particular type is completed";
139            default: return "?";
140          }
141        }
142        public String getDisplay() {
143          switch (this) {
144            case NAMEDEVENT: return "Named Event";
145            case PERIODIC: return "Periodic";
146            case DATAADDED: return "Data Added";
147            case DATAMODIFIED: return "Data Modified";
148            case DATAREMOVED: return "Data Removed";
149            case DATAACCESSED: return "Data Accessed";
150            case DATAACCESSENDED: return "Data Access Ended";
151            default: return "?";
152          }
153        }
154    }
155
156  public static class TriggerTypeEnumFactory implements EnumFactory<TriggerType> {
157    public TriggerType fromCode(String codeString) throws IllegalArgumentException {
158      if (codeString == null || "".equals(codeString))
159            if (codeString == null || "".equals(codeString))
160                return null;
161        if ("named-event".equals(codeString))
162          return TriggerType.NAMEDEVENT;
163        if ("periodic".equals(codeString))
164          return TriggerType.PERIODIC;
165        if ("data-added".equals(codeString))
166          return TriggerType.DATAADDED;
167        if ("data-modified".equals(codeString))
168          return TriggerType.DATAMODIFIED;
169        if ("data-removed".equals(codeString))
170          return TriggerType.DATAREMOVED;
171        if ("data-accessed".equals(codeString))
172          return TriggerType.DATAACCESSED;
173        if ("data-access-ended".equals(codeString))
174          return TriggerType.DATAACCESSENDED;
175        throw new IllegalArgumentException("Unknown TriggerType code '"+codeString+"'");
176        }
177        public Enumeration<TriggerType> fromType(Base code) throws FHIRException {
178          if (code == null)
179            return null;
180          if (code.isEmpty())
181            return new Enumeration<TriggerType>(this);
182          String codeString = ((PrimitiveType) code).asStringValue();
183          if (codeString == null || "".equals(codeString))
184            return null;
185        if ("named-event".equals(codeString))
186          return new Enumeration<TriggerType>(this, TriggerType.NAMEDEVENT);
187        if ("periodic".equals(codeString))
188          return new Enumeration<TriggerType>(this, TriggerType.PERIODIC);
189        if ("data-added".equals(codeString))
190          return new Enumeration<TriggerType>(this, TriggerType.DATAADDED);
191        if ("data-modified".equals(codeString))
192          return new Enumeration<TriggerType>(this, TriggerType.DATAMODIFIED);
193        if ("data-removed".equals(codeString))
194          return new Enumeration<TriggerType>(this, TriggerType.DATAREMOVED);
195        if ("data-accessed".equals(codeString))
196          return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSED);
197        if ("data-access-ended".equals(codeString))
198          return new Enumeration<TriggerType>(this, TriggerType.DATAACCESSENDED);
199        throw new FHIRException("Unknown TriggerType code '"+codeString+"'");
200        }
201    public String toCode(TriggerType code) {
202      if (code == TriggerType.NAMEDEVENT)
203        return "named-event";
204      if (code == TriggerType.PERIODIC)
205        return "periodic";
206      if (code == TriggerType.DATAADDED)
207        return "data-added";
208      if (code == TriggerType.DATAMODIFIED)
209        return "data-modified";
210      if (code == TriggerType.DATAREMOVED)
211        return "data-removed";
212      if (code == TriggerType.DATAACCESSED)
213        return "data-accessed";
214      if (code == TriggerType.DATAACCESSENDED)
215        return "data-access-ended";
216      return "?";
217      }
218    public String toSystem(TriggerType code) {
219      return code.getSystem();
220      }
221    }
222
223    /**
224     * The type of triggering event.
225     */
226    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
227    @Description(shortDefinition="named-event | periodic | data-added | data-modified | data-removed | data-accessed | data-access-ended", formalDefinition="The type of triggering event." )
228    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/trigger-type")
229    protected Enumeration<TriggerType> type;
230
231    /**
232     * The name of the event (if this is a named-event trigger).
233     */
234    @Child(name = "eventName", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
235    @Description(shortDefinition="Triggering event name", formalDefinition="The name of the event (if this is a named-event trigger)." )
236    protected StringType eventName;
237
238    /**
239     * The timing of the event (if this is a period trigger).
240     */
241    @Child(name = "eventTiming", type = {Timing.class, Schedule.class, DateType.class, DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
242    @Description(shortDefinition="Timing of the event", formalDefinition="The timing of the event (if this is a period trigger)." )
243    protected Type eventTiming;
244
245    /**
246     * The triggering data of the event (if this is a data trigger).
247     */
248    @Child(name = "eventData", type = {DataRequirement.class}, order=3, min=0, max=1, modifier=false, summary=true)
249    @Description(shortDefinition="Triggering data of the event", formalDefinition="The triggering data of the event (if this is a data trigger)." )
250    protected DataRequirement eventData;
251
252    private static final long serialVersionUID = -1695534864L;
253
254  /**
255   * Constructor
256   */
257    public TriggerDefinition() {
258      super();
259    }
260
261  /**
262   * Constructor
263   */
264    public TriggerDefinition(Enumeration<TriggerType> type) {
265      super();
266      this.type = type;
267    }
268
269    /**
270     * @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
271     */
272    public Enumeration<TriggerType> getTypeElement() { 
273      if (this.type == null)
274        if (Configuration.errorOnAutoCreate())
275          throw new Error("Attempt to auto-create TriggerDefinition.type");
276        else if (Configuration.doAutoCreate())
277          this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory()); // bb
278      return this.type;
279    }
280
281    public boolean hasTypeElement() { 
282      return this.type != null && !this.type.isEmpty();
283    }
284
285    public boolean hasType() { 
286      return this.type != null && !this.type.isEmpty();
287    }
288
289    /**
290     * @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
291     */
292    public TriggerDefinition setTypeElement(Enumeration<TriggerType> value) { 
293      this.type = value;
294      return this;
295    }
296
297    /**
298     * @return The type of triggering event.
299     */
300    public TriggerType getType() { 
301      return this.type == null ? null : this.type.getValue();
302    }
303
304    /**
305     * @param value The type of triggering event.
306     */
307    public TriggerDefinition setType(TriggerType value) { 
308        if (this.type == null)
309          this.type = new Enumeration<TriggerType>(new TriggerTypeEnumFactory());
310        this.type.setValue(value);
311      return this;
312    }
313
314    /**
315     * @return {@link #eventName} (The name of the event (if this is a named-event trigger).). This is the underlying object with id, value and extensions. The accessor "getEventName" gives direct access to the value
316     */
317    public StringType getEventNameElement() { 
318      if (this.eventName == null)
319        if (Configuration.errorOnAutoCreate())
320          throw new Error("Attempt to auto-create TriggerDefinition.eventName");
321        else if (Configuration.doAutoCreate())
322          this.eventName = new StringType(); // bb
323      return this.eventName;
324    }
325
326    public boolean hasEventNameElement() { 
327      return this.eventName != null && !this.eventName.isEmpty();
328    }
329
330    public boolean hasEventName() { 
331      return this.eventName != null && !this.eventName.isEmpty();
332    }
333
334    /**
335     * @param value {@link #eventName} (The name of the event (if this is a named-event trigger).). This is the underlying object with id, value and extensions. The accessor "getEventName" gives direct access to the value
336     */
337    public TriggerDefinition setEventNameElement(StringType value) { 
338      this.eventName = value;
339      return this;
340    }
341
342    /**
343     * @return The name of the event (if this is a named-event trigger).
344     */
345    public String getEventName() { 
346      return this.eventName == null ? null : this.eventName.getValue();
347    }
348
349    /**
350     * @param value The name of the event (if this is a named-event trigger).
351     */
352    public TriggerDefinition setEventName(String value) { 
353      if (Utilities.noString(value))
354        this.eventName = null;
355      else {
356        if (this.eventName == null)
357          this.eventName = new StringType();
358        this.eventName.setValue(value);
359      }
360      return this;
361    }
362
363    /**
364     * @return {@link #eventTiming} (The timing of the event (if this is a period trigger).)
365     */
366    public Type getEventTiming() { 
367      return this.eventTiming;
368    }
369
370    /**
371     * @return {@link #eventTiming} (The timing of the event (if this is a period trigger).)
372     */
373    public Timing getEventTimingTiming() throws FHIRException { 
374      if (this.eventTiming == null)
375        return null;
376      if (!(this.eventTiming instanceof Timing))
377        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.eventTiming.getClass().getName()+" was encountered");
378      return (Timing) this.eventTiming;
379    }
380
381    public boolean hasEventTimingTiming() { 
382      return this != null && this.eventTiming instanceof Timing;
383    }
384
385    /**
386     * @return {@link #eventTiming} (The timing of the event (if this is a period trigger).)
387     */
388    public Reference getEventTimingReference() throws FHIRException { 
389      if (this.eventTiming == null)
390        return null;
391      if (!(this.eventTiming instanceof Reference))
392        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.eventTiming.getClass().getName()+" was encountered");
393      return (Reference) this.eventTiming;
394    }
395
396    public boolean hasEventTimingReference() { 
397      return this != null && this.eventTiming instanceof Reference;
398    }
399
400    /**
401     * @return {@link #eventTiming} (The timing of the event (if this is a period trigger).)
402     */
403    public DateType getEventTimingDateType() throws FHIRException { 
404      if (this.eventTiming == null)
405        return null;
406      if (!(this.eventTiming instanceof DateType))
407        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.eventTiming.getClass().getName()+" was encountered");
408      return (DateType) this.eventTiming;
409    }
410
411    public boolean hasEventTimingDateType() { 
412      return this != null && this.eventTiming instanceof DateType;
413    }
414
415    /**
416     * @return {@link #eventTiming} (The timing of the event (if this is a period trigger).)
417     */
418    public DateTimeType getEventTimingDateTimeType() throws FHIRException { 
419      if (this.eventTiming == null)
420        return null;
421      if (!(this.eventTiming instanceof DateTimeType))
422        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.eventTiming.getClass().getName()+" was encountered");
423      return (DateTimeType) this.eventTiming;
424    }
425
426    public boolean hasEventTimingDateTimeType() { 
427      return this != null && this.eventTiming instanceof DateTimeType;
428    }
429
430    public boolean hasEventTiming() { 
431      return this.eventTiming != null && !this.eventTiming.isEmpty();
432    }
433
434    /**
435     * @param value {@link #eventTiming} (The timing of the event (if this is a period trigger).)
436     */
437    public TriggerDefinition setEventTiming(Type value) throws FHIRFormatError { 
438      if (value != null && !(value instanceof Timing || value instanceof Reference || value instanceof DateType || value instanceof DateTimeType))
439        throw new FHIRFormatError("Not the right type for TriggerDefinition.eventTiming[x]: "+value.fhirType());
440      this.eventTiming = value;
441      return this;
442    }
443
444    /**
445     * @return {@link #eventData} (The triggering data of the event (if this is a data trigger).)
446     */
447    public DataRequirement getEventData() { 
448      if (this.eventData == null)
449        if (Configuration.errorOnAutoCreate())
450          throw new Error("Attempt to auto-create TriggerDefinition.eventData");
451        else if (Configuration.doAutoCreate())
452          this.eventData = new DataRequirement(); // cc
453      return this.eventData;
454    }
455
456    public boolean hasEventData() { 
457      return this.eventData != null && !this.eventData.isEmpty();
458    }
459
460    /**
461     * @param value {@link #eventData} (The triggering data of the event (if this is a data trigger).)
462     */
463    public TriggerDefinition setEventData(DataRequirement value)  { 
464      this.eventData = value;
465      return this;
466    }
467
468      protected void listChildren(List<Property> children) {
469        super.listChildren(children);
470        children.add(new Property("type", "code", "The type of triggering event.", 0, 1, type));
471        children.add(new Property("eventName", "string", "The name of the event (if this is a named-event trigger).", 0, 1, eventName));
472        children.add(new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming));
473        children.add(new Property("eventData", "DataRequirement", "The triggering data of the event (if this is a data trigger).", 0, 1, eventData));
474      }
475
476      @Override
477      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
478        switch (_hash) {
479        case 3575610: /*type*/  return new Property("type", "code", "The type of triggering event.", 0, 1, type);
480        case 31228997: /*eventName*/  return new Property("eventName", "string", "The name of the event (if this is a named-event trigger).", 0, 1, eventName);
481        case 1120539260: /*eventTiming[x]*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
482        case 125465476: /*eventTiming*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
483        case 1285594350: /*eventTimingTiming*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
484        case -171794393: /*eventTimingReference*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
485        case 376272210: /*eventTimingDate*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
486        case -1923726529: /*eventTimingDateTime*/  return new Property("eventTiming[x]", "Timing|Reference(Schedule)|date|dateTime", "The timing of the event (if this is a period trigger).", 0, 1, eventTiming);
487        case 30931300: /*eventData*/  return new Property("eventData", "DataRequirement", "The triggering data of the event (if this is a data trigger).", 0, 1, eventData);
488        default: return super.getNamedProperty(_hash, _name, _checkValid);
489        }
490
491      }
492
493      @Override
494      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
495        switch (hash) {
496        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<TriggerType>
497        case 31228997: /*eventName*/ return this.eventName == null ? new Base[0] : new Base[] {this.eventName}; // StringType
498        case 125465476: /*eventTiming*/ return this.eventTiming == null ? new Base[0] : new Base[] {this.eventTiming}; // Type
499        case 30931300: /*eventData*/ return this.eventData == null ? new Base[0] : new Base[] {this.eventData}; // DataRequirement
500        default: return super.getProperty(hash, name, checkValid);
501        }
502
503      }
504
505      @Override
506      public Base setProperty(int hash, String name, Base value) throws FHIRException {
507        switch (hash) {
508        case 3575610: // type
509          value = new TriggerTypeEnumFactory().fromType(castToCode(value));
510          this.type = (Enumeration) value; // Enumeration<TriggerType>
511          return value;
512        case 31228997: // eventName
513          this.eventName = castToString(value); // StringType
514          return value;
515        case 125465476: // eventTiming
516          this.eventTiming = castToType(value); // Type
517          return value;
518        case 30931300: // eventData
519          this.eventData = castToDataRequirement(value); // DataRequirement
520          return value;
521        default: return super.setProperty(hash, name, value);
522        }
523
524      }
525
526      @Override
527      public Base setProperty(String name, Base value) throws FHIRException {
528        if (name.equals("type")) {
529          value = new TriggerTypeEnumFactory().fromType(castToCode(value));
530          this.type = (Enumeration) value; // Enumeration<TriggerType>
531        } else if (name.equals("eventName")) {
532          this.eventName = castToString(value); // StringType
533        } else if (name.equals("eventTiming[x]")) {
534          this.eventTiming = castToType(value); // Type
535        } else if (name.equals("eventData")) {
536          this.eventData = castToDataRequirement(value); // DataRequirement
537        } else
538          return super.setProperty(name, value);
539        return value;
540      }
541
542      @Override
543      public Base makeProperty(int hash, String name) throws FHIRException {
544        switch (hash) {
545        case 3575610:  return getTypeElement();
546        case 31228997:  return getEventNameElement();
547        case 1120539260:  return getEventTiming(); 
548        case 125465476:  return getEventTiming(); 
549        case 30931300:  return getEventData(); 
550        default: return super.makeProperty(hash, name);
551        }
552
553      }
554
555      @Override
556      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
557        switch (hash) {
558        case 3575610: /*type*/ return new String[] {"code"};
559        case 31228997: /*eventName*/ return new String[] {"string"};
560        case 125465476: /*eventTiming*/ return new String[] {"Timing", "Reference", "date", "dateTime"};
561        case 30931300: /*eventData*/ return new String[] {"DataRequirement"};
562        default: return super.getTypesForProperty(hash, name);
563        }
564
565      }
566
567      @Override
568      public Base addChild(String name) throws FHIRException {
569        if (name.equals("type")) {
570          throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.type");
571        }
572        else if (name.equals("eventName")) {
573          throw new FHIRException("Cannot call addChild on a primitive type TriggerDefinition.eventName");
574        }
575        else if (name.equals("eventTimingTiming")) {
576          this.eventTiming = new Timing();
577          return this.eventTiming;
578        }
579        else if (name.equals("eventTimingReference")) {
580          this.eventTiming = new Reference();
581          return this.eventTiming;
582        }
583        else if (name.equals("eventTimingDate")) {
584          this.eventTiming = new DateType();
585          return this.eventTiming;
586        }
587        else if (name.equals("eventTimingDateTime")) {
588          this.eventTiming = new DateTimeType();
589          return this.eventTiming;
590        }
591        else if (name.equals("eventData")) {
592          this.eventData = new DataRequirement();
593          return this.eventData;
594        }
595        else
596          return super.addChild(name);
597      }
598
599  public String fhirType() {
600    return "TriggerDefinition";
601
602  }
603
604      public TriggerDefinition copy() {
605        TriggerDefinition dst = new TriggerDefinition();
606        copyValues(dst);
607        dst.type = type == null ? null : type.copy();
608        dst.eventName = eventName == null ? null : eventName.copy();
609        dst.eventTiming = eventTiming == null ? null : eventTiming.copy();
610        dst.eventData = eventData == null ? null : eventData.copy();
611        return dst;
612      }
613
614      protected TriggerDefinition typedCopy() {
615        return copy();
616      }
617
618      @Override
619      public boolean equalsDeep(Base other_) {
620        if (!super.equalsDeep(other_))
621          return false;
622        if (!(other_ instanceof TriggerDefinition))
623          return false;
624        TriggerDefinition o = (TriggerDefinition) other_;
625        return compareDeep(type, o.type, true) && compareDeep(eventName, o.eventName, true) && compareDeep(eventTiming, o.eventTiming, true)
626           && compareDeep(eventData, o.eventData, true);
627      }
628
629      @Override
630      public boolean equalsShallow(Base other_) {
631        if (!super.equalsShallow(other_))
632          return false;
633        if (!(other_ instanceof TriggerDefinition))
634          return false;
635        TriggerDefinition o = (TriggerDefinition) other_;
636        return compareValues(type, o.type, true) && compareValues(eventName, o.eventName, true);
637      }
638
639      public boolean isEmpty() {
640        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, eventName, eventTiming
641          , eventData);
642      }
643
644
645}
646