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