001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.
052 */
053@ResourceDef(name="Subscription", profile="http://hl7.org/fhir/StructureDefinition/Subscription")
054public class Subscription extends DomainResource {
055
056    public enum SubscriptionPayloadContent {
057        /**
058         * No resource content is transacted in the notification payload.
059         */
060        EMPTY, 
061        /**
062         * Only the resource id is transacted in the notification payload.
063         */
064        IDONLY, 
065        /**
066         * The entire resource is transacted in the notification payload.
067         */
068        FULLRESOURCE, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static SubscriptionPayloadContent fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("empty".equals(codeString))
077          return EMPTY;
078        if ("id-only".equals(codeString))
079          return IDONLY;
080        if ("full-resource".equals(codeString))
081          return FULLRESOURCE;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case EMPTY: return "empty";
090            case IDONLY: return "id-only";
091            case FULLRESOURCE: return "full-resource";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case EMPTY: return "http://hl7.org/fhir/subscription-payload-content";
099            case IDONLY: return "http://hl7.org/fhir/subscription-payload-content";
100            case FULLRESOURCE: return "http://hl7.org/fhir/subscription-payload-content";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case EMPTY: return "No resource content is transacted in the notification payload.";
108            case IDONLY: return "Only the resource id is transacted in the notification payload.";
109            case FULLRESOURCE: return "The entire resource is transacted in the notification payload.";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case EMPTY: return "empty";
117            case IDONLY: return "id-only";
118            case FULLRESOURCE: return "full-resource";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class SubscriptionPayloadContentEnumFactory implements EnumFactory<SubscriptionPayloadContent> {
126    public SubscriptionPayloadContent fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("empty".equals(codeString))
131          return SubscriptionPayloadContent.EMPTY;
132        if ("id-only".equals(codeString))
133          return SubscriptionPayloadContent.IDONLY;
134        if ("full-resource".equals(codeString))
135          return SubscriptionPayloadContent.FULLRESOURCE;
136        throw new IllegalArgumentException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
137        }
138        public Enumeration<SubscriptionPayloadContent> fromType(Base code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<SubscriptionPayloadContent>(this);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return null;
146        if ("empty".equals(codeString))
147          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.EMPTY);
148        if ("id-only".equals(codeString))
149          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.IDONLY);
150        if ("full-resource".equals(codeString))
151          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.FULLRESOURCE);
152        throw new FHIRException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
153        }
154    public String toCode(SubscriptionPayloadContent code) {
155      if (code == SubscriptionPayloadContent.EMPTY)
156        return "empty";
157      if (code == SubscriptionPayloadContent.IDONLY)
158        return "id-only";
159      if (code == SubscriptionPayloadContent.FULLRESOURCE)
160        return "full-resource";
161      return "?";
162      }
163    public String toSystem(SubscriptionPayloadContent code) {
164      return code.getSystem();
165      }
166    }
167
168    @Block()
169    public static class SubscriptionFilterByComponent extends BackboneElement implements IBaseBackboneElement {
170        /**
171         * If the element is a reference to another resource, this element contains "Reference", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).
172         */
173        @Child(name = "resourceType", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=true)
174        @Description(shortDefinition="Allowed Data type or Resource (reference to definition) for this Subscription", formalDefinition="If the element is a reference to another resource, this element contains \"Reference\", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient)." )
175        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/defined-types")
176        protected UriType resourceType;
177
178        /**
179         * The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.
180         */
181        @Child(name = "filterParameter", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
182        @Description(shortDefinition="Filter label defined in SubscriptionTopic", formalDefinition="The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element." )
183        protected StringType filterParameter;
184
185        /**
186         * Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.
187         */
188        @Child(name = "modifier", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
189        @Description(shortDefinition="= | eq | ne | gt | lt | ge | le | sa | eb | ap | above | below | in | not-in | of-type", formalDefinition="Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic." )
190        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-search-modifier")
191        protected Enumeration<SubscriptionSearchModifier> modifier;
192
193        /**
194         * The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
195         */
196        @Child(name = "value", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
197        @Description(shortDefinition="Literal value or resource path", formalDefinition="The literal value or resource path as is legal in search - for example, \"Patient/123\" or \"le1950\"." )
198        protected StringType value;
199
200        private static final long serialVersionUID = -642146252L;
201
202    /**
203     * Constructor
204     */
205      public SubscriptionFilterByComponent() {
206        super();
207      }
208
209    /**
210     * Constructor
211     */
212      public SubscriptionFilterByComponent(String filterParameter, String value) {
213        super();
214        this.setFilterParameter(filterParameter);
215        this.setValue(value);
216      }
217
218        /**
219         * @return {@link #resourceType} (If the element is a reference to another resource, this element contains "Reference", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).). This is the underlying object with id, value and extensions. The accessor "getResourceType" gives direct access to the value
220         */
221        public UriType getResourceTypeElement() { 
222          if (this.resourceType == null)
223            if (Configuration.errorOnAutoCreate())
224              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.resourceType");
225            else if (Configuration.doAutoCreate())
226              this.resourceType = new UriType(); // bb
227          return this.resourceType;
228        }
229
230        public boolean hasResourceTypeElement() { 
231          return this.resourceType != null && !this.resourceType.isEmpty();
232        }
233
234        public boolean hasResourceType() { 
235          return this.resourceType != null && !this.resourceType.isEmpty();
236        }
237
238        /**
239         * @param value {@link #resourceType} (If the element is a reference to another resource, this element contains "Reference", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).). This is the underlying object with id, value and extensions. The accessor "getResourceType" gives direct access to the value
240         */
241        public SubscriptionFilterByComponent setResourceTypeElement(UriType value) { 
242          this.resourceType = value;
243          return this;
244        }
245
246        /**
247         * @return If the element is a reference to another resource, this element contains "Reference", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).
248         */
249        public String getResourceType() { 
250          return this.resourceType == null ? null : this.resourceType.getValue();
251        }
252
253        /**
254         * @param value If the element is a reference to another resource, this element contains "Reference", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).
255         */
256        public SubscriptionFilterByComponent setResourceType(String value) { 
257          if (Utilities.noString(value))
258            this.resourceType = null;
259          else {
260            if (this.resourceType == null)
261              this.resourceType = new UriType();
262            this.resourceType.setValue(value);
263          }
264          return this;
265        }
266
267        /**
268         * @return {@link #filterParameter} (The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.). This is the underlying object with id, value and extensions. The accessor "getFilterParameter" gives direct access to the value
269         */
270        public StringType getFilterParameterElement() { 
271          if (this.filterParameter == null)
272            if (Configuration.errorOnAutoCreate())
273              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.filterParameter");
274            else if (Configuration.doAutoCreate())
275              this.filterParameter = new StringType(); // bb
276          return this.filterParameter;
277        }
278
279        public boolean hasFilterParameterElement() { 
280          return this.filterParameter != null && !this.filterParameter.isEmpty();
281        }
282
283        public boolean hasFilterParameter() { 
284          return this.filterParameter != null && !this.filterParameter.isEmpty();
285        }
286
287        /**
288         * @param value {@link #filterParameter} (The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.). This is the underlying object with id, value and extensions. The accessor "getFilterParameter" gives direct access to the value
289         */
290        public SubscriptionFilterByComponent setFilterParameterElement(StringType value) { 
291          this.filterParameter = value;
292          return this;
293        }
294
295        /**
296         * @return The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.
297         */
298        public String getFilterParameter() { 
299          return this.filterParameter == null ? null : this.filterParameter.getValue();
300        }
301
302        /**
303         * @param value The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.
304         */
305        public SubscriptionFilterByComponent setFilterParameter(String value) { 
306            if (this.filterParameter == null)
307              this.filterParameter = new StringType();
308            this.filterParameter.setValue(value);
309          return this;
310        }
311
312        /**
313         * @return {@link #modifier} (Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.). This is the underlying object with id, value and extensions. The accessor "getModifier" gives direct access to the value
314         */
315        public Enumeration<SubscriptionSearchModifier> getModifierElement() { 
316          if (this.modifier == null)
317            if (Configuration.errorOnAutoCreate())
318              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.modifier");
319            else if (Configuration.doAutoCreate())
320              this.modifier = new Enumeration<SubscriptionSearchModifier>(new SubscriptionSearchModifierEnumFactory()); // bb
321          return this.modifier;
322        }
323
324        public boolean hasModifierElement() { 
325          return this.modifier != null && !this.modifier.isEmpty();
326        }
327
328        public boolean hasModifier() { 
329          return this.modifier != null && !this.modifier.isEmpty();
330        }
331
332        /**
333         * @param value {@link #modifier} (Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.). This is the underlying object with id, value and extensions. The accessor "getModifier" gives direct access to the value
334         */
335        public SubscriptionFilterByComponent setModifierElement(Enumeration<SubscriptionSearchModifier> value) { 
336          this.modifier = value;
337          return this;
338        }
339
340        /**
341         * @return Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.
342         */
343        public SubscriptionSearchModifier getModifier() { 
344          return this.modifier == null ? null : this.modifier.getValue();
345        }
346
347        /**
348         * @param value Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.
349         */
350        public SubscriptionFilterByComponent setModifier(SubscriptionSearchModifier value) { 
351          if (value == null)
352            this.modifier = null;
353          else {
354            if (this.modifier == null)
355              this.modifier = new Enumeration<SubscriptionSearchModifier>(new SubscriptionSearchModifierEnumFactory());
356            this.modifier.setValue(value);
357          }
358          return this;
359        }
360
361        /**
362         * @return {@link #value} (The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
363         */
364        public StringType getValueElement() { 
365          if (this.value == null)
366            if (Configuration.errorOnAutoCreate())
367              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.value");
368            else if (Configuration.doAutoCreate())
369              this.value = new StringType(); // bb
370          return this.value;
371        }
372
373        public boolean hasValueElement() { 
374          return this.value != null && !this.value.isEmpty();
375        }
376
377        public boolean hasValue() { 
378          return this.value != null && !this.value.isEmpty();
379        }
380
381        /**
382         * @param value {@link #value} (The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
383         */
384        public SubscriptionFilterByComponent setValueElement(StringType value) { 
385          this.value = value;
386          return this;
387        }
388
389        /**
390         * @return The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
391         */
392        public String getValue() { 
393          return this.value == null ? null : this.value.getValue();
394        }
395
396        /**
397         * @param value The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
398         */
399        public SubscriptionFilterByComponent setValue(String value) { 
400            if (this.value == null)
401              this.value = new StringType();
402            this.value.setValue(value);
403          return this;
404        }
405
406        protected void listChildren(List<Property> children) {
407          super.listChildren(children);
408          children.add(new Property("resourceType", "uri", "If the element is a reference to another resource, this element contains \"Reference\", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).", 0, 1, resourceType));
409          children.add(new Property("filterParameter", "string", "The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.", 0, 1, filterParameter));
410          children.add(new Property("modifier", "code", "Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.", 0, 1, modifier));
411          children.add(new Property("value", "string", "The literal value or resource path as is legal in search - for example, \"Patient/123\" or \"le1950\".", 0, 1, value));
412        }
413
414        @Override
415        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
416          switch (_hash) {
417          case -384364440: /*resourceType*/  return new Property("resourceType", "uri", "If the element is a reference to another resource, this element contains \"Reference\", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).", 0, 1, resourceType);
418          case 618257: /*filterParameter*/  return new Property("filterParameter", "string", "The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.", 0, 1, filterParameter);
419          case -615513385: /*modifier*/  return new Property("modifier", "code", "Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.", 0, 1, modifier);
420          case 111972721: /*value*/  return new Property("value", "string", "The literal value or resource path as is legal in search - for example, \"Patient/123\" or \"le1950\".", 0, 1, value);
421          default: return super.getNamedProperty(_hash, _name, _checkValid);
422          }
423
424        }
425
426      @Override
427      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
428        switch (hash) {
429        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // UriType
430        case 618257: /*filterParameter*/ return this.filterParameter == null ? new Base[0] : new Base[] {this.filterParameter}; // StringType
431        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // Enumeration<SubscriptionSearchModifier>
432        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
433        default: return super.getProperty(hash, name, checkValid);
434        }
435
436      }
437
438      @Override
439      public Base setProperty(int hash, String name, Base value) throws FHIRException {
440        switch (hash) {
441        case -384364440: // resourceType
442          this.resourceType = TypeConvertor.castToUri(value); // UriType
443          return value;
444        case 618257: // filterParameter
445          this.filterParameter = TypeConvertor.castToString(value); // StringType
446          return value;
447        case -615513385: // modifier
448          value = new SubscriptionSearchModifierEnumFactory().fromType(TypeConvertor.castToCode(value));
449          this.modifier = (Enumeration) value; // Enumeration<SubscriptionSearchModifier>
450          return value;
451        case 111972721: // value
452          this.value = TypeConvertor.castToString(value); // StringType
453          return value;
454        default: return super.setProperty(hash, name, value);
455        }
456
457      }
458
459      @Override
460      public Base setProperty(String name, Base value) throws FHIRException {
461        if (name.equals("resourceType")) {
462          this.resourceType = TypeConvertor.castToUri(value); // UriType
463        } else if (name.equals("filterParameter")) {
464          this.filterParameter = TypeConvertor.castToString(value); // StringType
465        } else if (name.equals("modifier")) {
466          value = new SubscriptionSearchModifierEnumFactory().fromType(TypeConvertor.castToCode(value));
467          this.modifier = (Enumeration) value; // Enumeration<SubscriptionSearchModifier>
468        } else if (name.equals("value")) {
469          this.value = TypeConvertor.castToString(value); // StringType
470        } else
471          return super.setProperty(name, value);
472        return value;
473      }
474
475      @Override
476      public Base makeProperty(int hash, String name) throws FHIRException {
477        switch (hash) {
478        case -384364440:  return getResourceTypeElement();
479        case 618257:  return getFilterParameterElement();
480        case -615513385:  return getModifierElement();
481        case 111972721:  return getValueElement();
482        default: return super.makeProperty(hash, name);
483        }
484
485      }
486
487      @Override
488      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
489        switch (hash) {
490        case -384364440: /*resourceType*/ return new String[] {"uri"};
491        case 618257: /*filterParameter*/ return new String[] {"string"};
492        case -615513385: /*modifier*/ return new String[] {"code"};
493        case 111972721: /*value*/ return new String[] {"string"};
494        default: return super.getTypesForProperty(hash, name);
495        }
496
497      }
498
499      @Override
500      public Base addChild(String name) throws FHIRException {
501        if (name.equals("resourceType")) {
502          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.resourceType");
503        }
504        else if (name.equals("filterParameter")) {
505          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.filterParameter");
506        }
507        else if (name.equals("modifier")) {
508          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.modifier");
509        }
510        else if (name.equals("value")) {
511          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.value");
512        }
513        else
514          return super.addChild(name);
515      }
516
517      public SubscriptionFilterByComponent copy() {
518        SubscriptionFilterByComponent dst = new SubscriptionFilterByComponent();
519        copyValues(dst);
520        return dst;
521      }
522
523      public void copyValues(SubscriptionFilterByComponent dst) {
524        super.copyValues(dst);
525        dst.resourceType = resourceType == null ? null : resourceType.copy();
526        dst.filterParameter = filterParameter == null ? null : filterParameter.copy();
527        dst.modifier = modifier == null ? null : modifier.copy();
528        dst.value = value == null ? null : value.copy();
529      }
530
531      @Override
532      public boolean equalsDeep(Base other_) {
533        if (!super.equalsDeep(other_))
534          return false;
535        if (!(other_ instanceof SubscriptionFilterByComponent))
536          return false;
537        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
538        return compareDeep(resourceType, o.resourceType, true) && compareDeep(filterParameter, o.filterParameter, true)
539           && compareDeep(modifier, o.modifier, true) && compareDeep(value, o.value, true);
540      }
541
542      @Override
543      public boolean equalsShallow(Base other_) {
544        if (!super.equalsShallow(other_))
545          return false;
546        if (!(other_ instanceof SubscriptionFilterByComponent))
547          return false;
548        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
549        return compareValues(resourceType, o.resourceType, true) && compareValues(filterParameter, o.filterParameter, true)
550           && compareValues(modifier, o.modifier, true) && compareValues(value, o.value, true);
551      }
552
553      public boolean isEmpty() {
554        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(resourceType, filterParameter
555          , modifier, value);
556      }
557
558  public String fhirType() {
559    return "Subscription.filterBy";
560
561  }
562
563  }
564
565    /**
566     * A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.
567     */
568    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
569    @Description(shortDefinition="Additional identifiers (business identifier)", formalDefinition="A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance." )
570    protected List<Identifier> identifier;
571
572    /**
573     * A natural language name identifying the subscription.
574     */
575    @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
576    @Description(shortDefinition="Human readable name for this subscription", formalDefinition="A natural language name identifying the subscription." )
577    protected StringType name;
578
579    /**
580     * The status of the subscription, which marks the server state for managing the subscription.
581     */
582    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
583    @Description(shortDefinition="requested | active | error | off | entered-in-error", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." )
584    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status")
585    protected Enumeration<SubscriptionStatusCodes> status;
586
587    /**
588     * The reference to the subscription topic to be notified about.
589     */
590    @Child(name = "topic", type = {CanonicalType.class}, order=3, min=1, max=1, modifier=false, summary=true)
591    @Description(shortDefinition="Reference to the subscription topic being subscribed to", formalDefinition="The reference to the subscription topic to be notified about." )
592    protected CanonicalType topic;
593
594    /**
595     * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.
596     */
597    @Child(name = "contact", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
598    @Description(shortDefinition="Contact details for source (e.g. troubleshooting)", formalDefinition="Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting." )
599    protected List<ContactPoint> contact;
600
601    /**
602     * The time for the server to turn the subscription off.
603     */
604    @Child(name = "end", type = {InstantType.class}, order=5, min=0, max=1, modifier=false, summary=true)
605    @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." )
606    protected InstantType end;
607
608    /**
609     * A description of why this subscription is defined.
610     */
611    @Child(name = "reason", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
612    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
613    protected StringType reason;
614
615    /**
616     * The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).
617     */
618    @Child(name = "filterBy", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
619    @Description(shortDefinition="Criteria for narrowing the subscription topic stream", formalDefinition="The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND)." )
620    protected List<SubscriptionFilterByComponent> filterBy;
621
622    /**
623     * The type of channel to send notifications on.
624     */
625    @Child(name = "channelType", type = {Coding.class}, order=8, min=1, max=1, modifier=false, summary=true)
626    @Description(shortDefinition="Channel type for notifications", formalDefinition="The type of channel to send notifications on." )
627    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
628    protected Coding channelType;
629
630    /**
631     * The url that describes the actual end-point to send messages to.
632     */
633    @Child(name = "endpoint", type = {UrlType.class}, order=9, min=0, max=1, modifier=false, summary=true)
634    @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." )
635    protected UrlType endpoint;
636
637    /**
638     * Additional headers / information to send as part of the notification.
639     */
640    @Child(name = "header", type = {StringType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
641    @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
642    protected List<StringType> header;
643
644    /**
645     * If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
646     */
647    @Child(name = "heartbeatPeriod", type = {UnsignedIntType.class}, order=11, min=0, max=1, modifier=false, summary=true)
648    @Description(shortDefinition="Interval in seconds to send 'heartbeat' notification", formalDefinition="If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent." )
649    protected UnsignedIntType heartbeatPeriod;
650
651    /**
652     * If present, the maximum amount of time a server will allow before failing a notification attempt.
653     */
654    @Child(name = "timeout", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
655    @Description(shortDefinition="Timeout in seconds to attempt notification delivery", formalDefinition="If present, the maximum amount of time a server will allow before failing a notification attempt." )
656    protected UnsignedIntType timeout;
657
658    /**
659     * The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
660     */
661    @Child(name = "contentType", type = {CodeType.class}, order=13, min=0, max=1, modifier=false, summary=true)
662    @Description(shortDefinition="MIME type to send, or omit for no payload", formalDefinition="The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions." )
663    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
664    protected CodeType contentType;
665
666    /**
667     * How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.
668     */
669    @Child(name = "content", type = {CodeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
670    @Description(shortDefinition="empty | id-only | full-resource", formalDefinition="How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content." )
671    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-payload-content")
672    protected Enumeration<SubscriptionPayloadContent> content;
673
674    /**
675     * If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
676     */
677    @Child(name = "maxCount", type = {PositiveIntType.class}, order=15, min=0, max=1, modifier=false, summary=true)
678    @Description(shortDefinition="Maximum number of triggering resources included in notification bundles", formalDefinition="If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included." )
679    protected PositiveIntType maxCount;
680
681    private static final long serialVersionUID = -881003340L;
682
683  /**
684   * Constructor
685   */
686    public Subscription() {
687      super();
688    }
689
690  /**
691   * Constructor
692   */
693    public Subscription(SubscriptionStatusCodes status, String topic, Coding channelType) {
694      super();
695      this.setStatus(status);
696      this.setTopic(topic);
697      this.setChannelType(channelType);
698    }
699
700    /**
701     * @return {@link #identifier} (A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.)
702     */
703    public List<Identifier> getIdentifier() { 
704      if (this.identifier == null)
705        this.identifier = new ArrayList<Identifier>();
706      return this.identifier;
707    }
708
709    /**
710     * @return Returns a reference to <code>this</code> for easy method chaining
711     */
712    public Subscription setIdentifier(List<Identifier> theIdentifier) { 
713      this.identifier = theIdentifier;
714      return this;
715    }
716
717    public boolean hasIdentifier() { 
718      if (this.identifier == null)
719        return false;
720      for (Identifier item : this.identifier)
721        if (!item.isEmpty())
722          return true;
723      return false;
724    }
725
726    public Identifier addIdentifier() { //3
727      Identifier t = new Identifier();
728      if (this.identifier == null)
729        this.identifier = new ArrayList<Identifier>();
730      this.identifier.add(t);
731      return t;
732    }
733
734    public Subscription addIdentifier(Identifier t) { //3
735      if (t == null)
736        return this;
737      if (this.identifier == null)
738        this.identifier = new ArrayList<Identifier>();
739      this.identifier.add(t);
740      return this;
741    }
742
743    /**
744     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
745     */
746    public Identifier getIdentifierFirstRep() { 
747      if (getIdentifier().isEmpty()) {
748        addIdentifier();
749      }
750      return getIdentifier().get(0);
751    }
752
753    /**
754     * @return {@link #name} (A natural language name identifying the subscription.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
755     */
756    public StringType getNameElement() { 
757      if (this.name == null)
758        if (Configuration.errorOnAutoCreate())
759          throw new Error("Attempt to auto-create Subscription.name");
760        else if (Configuration.doAutoCreate())
761          this.name = new StringType(); // bb
762      return this.name;
763    }
764
765    public boolean hasNameElement() { 
766      return this.name != null && !this.name.isEmpty();
767    }
768
769    public boolean hasName() { 
770      return this.name != null && !this.name.isEmpty();
771    }
772
773    /**
774     * @param value {@link #name} (A natural language name identifying the subscription.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
775     */
776    public Subscription setNameElement(StringType value) { 
777      this.name = value;
778      return this;
779    }
780
781    /**
782     * @return A natural language name identifying the subscription.
783     */
784    public String getName() { 
785      return this.name == null ? null : this.name.getValue();
786    }
787
788    /**
789     * @param value A natural language name identifying the subscription.
790     */
791    public Subscription setName(String value) { 
792      if (Utilities.noString(value))
793        this.name = null;
794      else {
795        if (this.name == null)
796          this.name = new StringType();
797        this.name.setValue(value);
798      }
799      return this;
800    }
801
802    /**
803     * @return {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
804     */
805    public Enumeration<SubscriptionStatusCodes> getStatusElement() { 
806      if (this.status == null)
807        if (Configuration.errorOnAutoCreate())
808          throw new Error("Attempt to auto-create Subscription.status");
809        else if (Configuration.doAutoCreate())
810          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory()); // bb
811      return this.status;
812    }
813
814    public boolean hasStatusElement() { 
815      return this.status != null && !this.status.isEmpty();
816    }
817
818    public boolean hasStatus() { 
819      return this.status != null && !this.status.isEmpty();
820    }
821
822    /**
823     * @param value {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
824     */
825    public Subscription setStatusElement(Enumeration<SubscriptionStatusCodes> value) { 
826      this.status = value;
827      return this;
828    }
829
830    /**
831     * @return The status of the subscription, which marks the server state for managing the subscription.
832     */
833    public SubscriptionStatusCodes getStatus() { 
834      return this.status == null ? null : this.status.getValue();
835    }
836
837    /**
838     * @param value The status of the subscription, which marks the server state for managing the subscription.
839     */
840    public Subscription setStatus(SubscriptionStatusCodes value) { 
841        if (this.status == null)
842          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory());
843        this.status.setValue(value);
844      return this;
845    }
846
847    /**
848     * @return {@link #topic} (The reference to the subscription topic to be notified about.). This is the underlying object with id, value and extensions. The accessor "getTopic" gives direct access to the value
849     */
850    public CanonicalType getTopicElement() { 
851      if (this.topic == null)
852        if (Configuration.errorOnAutoCreate())
853          throw new Error("Attempt to auto-create Subscription.topic");
854        else if (Configuration.doAutoCreate())
855          this.topic = new CanonicalType(); // bb
856      return this.topic;
857    }
858
859    public boolean hasTopicElement() { 
860      return this.topic != null && !this.topic.isEmpty();
861    }
862
863    public boolean hasTopic() { 
864      return this.topic != null && !this.topic.isEmpty();
865    }
866
867    /**
868     * @param value {@link #topic} (The reference to the subscription topic to be notified about.). This is the underlying object with id, value and extensions. The accessor "getTopic" gives direct access to the value
869     */
870    public Subscription setTopicElement(CanonicalType value) { 
871      this.topic = value;
872      return this;
873    }
874
875    /**
876     * @return The reference to the subscription topic to be notified about.
877     */
878    public String getTopic() { 
879      return this.topic == null ? null : this.topic.getValue();
880    }
881
882    /**
883     * @param value The reference to the subscription topic to be notified about.
884     */
885    public Subscription setTopic(String value) { 
886        if (this.topic == null)
887          this.topic = new CanonicalType();
888        this.topic.setValue(value);
889      return this;
890    }
891
892    /**
893     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
894     */
895    public List<ContactPoint> getContact() { 
896      if (this.contact == null)
897        this.contact = new ArrayList<ContactPoint>();
898      return this.contact;
899    }
900
901    /**
902     * @return Returns a reference to <code>this</code> for easy method chaining
903     */
904    public Subscription setContact(List<ContactPoint> theContact) { 
905      this.contact = theContact;
906      return this;
907    }
908
909    public boolean hasContact() { 
910      if (this.contact == null)
911        return false;
912      for (ContactPoint item : this.contact)
913        if (!item.isEmpty())
914          return true;
915      return false;
916    }
917
918    public ContactPoint addContact() { //3
919      ContactPoint t = new ContactPoint();
920      if (this.contact == null)
921        this.contact = new ArrayList<ContactPoint>();
922      this.contact.add(t);
923      return t;
924    }
925
926    public Subscription addContact(ContactPoint t) { //3
927      if (t == null)
928        return this;
929      if (this.contact == null)
930        this.contact = new ArrayList<ContactPoint>();
931      this.contact.add(t);
932      return this;
933    }
934
935    /**
936     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
937     */
938    public ContactPoint getContactFirstRep() { 
939      if (getContact().isEmpty()) {
940        addContact();
941      }
942      return getContact().get(0);
943    }
944
945    /**
946     * @return {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
947     */
948    public InstantType getEndElement() { 
949      if (this.end == null)
950        if (Configuration.errorOnAutoCreate())
951          throw new Error("Attempt to auto-create Subscription.end");
952        else if (Configuration.doAutoCreate())
953          this.end = new InstantType(); // bb
954      return this.end;
955    }
956
957    public boolean hasEndElement() { 
958      return this.end != null && !this.end.isEmpty();
959    }
960
961    public boolean hasEnd() { 
962      return this.end != null && !this.end.isEmpty();
963    }
964
965    /**
966     * @param value {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
967     */
968    public Subscription setEndElement(InstantType value) { 
969      this.end = value;
970      return this;
971    }
972
973    /**
974     * @return The time for the server to turn the subscription off.
975     */
976    public Date getEnd() { 
977      return this.end == null ? null : this.end.getValue();
978    }
979
980    /**
981     * @param value The time for the server to turn the subscription off.
982     */
983    public Subscription setEnd(Date value) { 
984      if (value == null)
985        this.end = null;
986      else {
987        if (this.end == null)
988          this.end = new InstantType();
989        this.end.setValue(value);
990      }
991      return this;
992    }
993
994    /**
995     * @return {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
996     */
997    public StringType getReasonElement() { 
998      if (this.reason == null)
999        if (Configuration.errorOnAutoCreate())
1000          throw new Error("Attempt to auto-create Subscription.reason");
1001        else if (Configuration.doAutoCreate())
1002          this.reason = new StringType(); // bb
1003      return this.reason;
1004    }
1005
1006    public boolean hasReasonElement() { 
1007      return this.reason != null && !this.reason.isEmpty();
1008    }
1009
1010    public boolean hasReason() { 
1011      return this.reason != null && !this.reason.isEmpty();
1012    }
1013
1014    /**
1015     * @param value {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
1016     */
1017    public Subscription setReasonElement(StringType value) { 
1018      this.reason = value;
1019      return this;
1020    }
1021
1022    /**
1023     * @return A description of why this subscription is defined.
1024     */
1025    public String getReason() { 
1026      return this.reason == null ? null : this.reason.getValue();
1027    }
1028
1029    /**
1030     * @param value A description of why this subscription is defined.
1031     */
1032    public Subscription setReason(String value) { 
1033      if (Utilities.noString(value))
1034        this.reason = null;
1035      else {
1036        if (this.reason == null)
1037          this.reason = new StringType();
1038        this.reason.setValue(value);
1039      }
1040      return this;
1041    }
1042
1043    /**
1044     * @return {@link #filterBy} (The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).)
1045     */
1046    public List<SubscriptionFilterByComponent> getFilterBy() { 
1047      if (this.filterBy == null)
1048        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1049      return this.filterBy;
1050    }
1051
1052    /**
1053     * @return Returns a reference to <code>this</code> for easy method chaining
1054     */
1055    public Subscription setFilterBy(List<SubscriptionFilterByComponent> theFilterBy) { 
1056      this.filterBy = theFilterBy;
1057      return this;
1058    }
1059
1060    public boolean hasFilterBy() { 
1061      if (this.filterBy == null)
1062        return false;
1063      for (SubscriptionFilterByComponent item : this.filterBy)
1064        if (!item.isEmpty())
1065          return true;
1066      return false;
1067    }
1068
1069    public SubscriptionFilterByComponent addFilterBy() { //3
1070      SubscriptionFilterByComponent t = new SubscriptionFilterByComponent();
1071      if (this.filterBy == null)
1072        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1073      this.filterBy.add(t);
1074      return t;
1075    }
1076
1077    public Subscription addFilterBy(SubscriptionFilterByComponent t) { //3
1078      if (t == null)
1079        return this;
1080      if (this.filterBy == null)
1081        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1082      this.filterBy.add(t);
1083      return this;
1084    }
1085
1086    /**
1087     * @return The first repetition of repeating field {@link #filterBy}, creating it if it does not already exist {3}
1088     */
1089    public SubscriptionFilterByComponent getFilterByFirstRep() { 
1090      if (getFilterBy().isEmpty()) {
1091        addFilterBy();
1092      }
1093      return getFilterBy().get(0);
1094    }
1095
1096    /**
1097     * @return {@link #channelType} (The type of channel to send notifications on.)
1098     */
1099    public Coding getChannelType() { 
1100      if (this.channelType == null)
1101        if (Configuration.errorOnAutoCreate())
1102          throw new Error("Attempt to auto-create Subscription.channelType");
1103        else if (Configuration.doAutoCreate())
1104          this.channelType = new Coding(); // cc
1105      return this.channelType;
1106    }
1107
1108    public boolean hasChannelType() { 
1109      return this.channelType != null && !this.channelType.isEmpty();
1110    }
1111
1112    /**
1113     * @param value {@link #channelType} (The type of channel to send notifications on.)
1114     */
1115    public Subscription setChannelType(Coding value) { 
1116      this.channelType = value;
1117      return this;
1118    }
1119
1120    /**
1121     * @return {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
1122     */
1123    public UrlType getEndpointElement() { 
1124      if (this.endpoint == null)
1125        if (Configuration.errorOnAutoCreate())
1126          throw new Error("Attempt to auto-create Subscription.endpoint");
1127        else if (Configuration.doAutoCreate())
1128          this.endpoint = new UrlType(); // bb
1129      return this.endpoint;
1130    }
1131
1132    public boolean hasEndpointElement() { 
1133      return this.endpoint != null && !this.endpoint.isEmpty();
1134    }
1135
1136    public boolean hasEndpoint() { 
1137      return this.endpoint != null && !this.endpoint.isEmpty();
1138    }
1139
1140    /**
1141     * @param value {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
1142     */
1143    public Subscription setEndpointElement(UrlType value) { 
1144      this.endpoint = value;
1145      return this;
1146    }
1147
1148    /**
1149     * @return The url that describes the actual end-point to send messages to.
1150     */
1151    public String getEndpoint() { 
1152      return this.endpoint == null ? null : this.endpoint.getValue();
1153    }
1154
1155    /**
1156     * @param value The url that describes the actual end-point to send messages to.
1157     */
1158    public Subscription setEndpoint(String value) { 
1159      if (Utilities.noString(value))
1160        this.endpoint = null;
1161      else {
1162        if (this.endpoint == null)
1163          this.endpoint = new UrlType();
1164        this.endpoint.setValue(value);
1165      }
1166      return this;
1167    }
1168
1169    /**
1170     * @return {@link #header} (Additional headers / information to send as part of the notification.)
1171     */
1172    public List<StringType> getHeader() { 
1173      if (this.header == null)
1174        this.header = new ArrayList<StringType>();
1175      return this.header;
1176    }
1177
1178    /**
1179     * @return Returns a reference to <code>this</code> for easy method chaining
1180     */
1181    public Subscription setHeader(List<StringType> theHeader) { 
1182      this.header = theHeader;
1183      return this;
1184    }
1185
1186    public boolean hasHeader() { 
1187      if (this.header == null)
1188        return false;
1189      for (StringType item : this.header)
1190        if (!item.isEmpty())
1191          return true;
1192      return false;
1193    }
1194
1195    /**
1196     * @return {@link #header} (Additional headers / information to send as part of the notification.)
1197     */
1198    public StringType addHeaderElement() {//2 
1199      StringType t = new StringType();
1200      if (this.header == null)
1201        this.header = new ArrayList<StringType>();
1202      this.header.add(t);
1203      return t;
1204    }
1205
1206    /**
1207     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
1208     */
1209    public Subscription addHeader(String value) { //1
1210      StringType t = new StringType();
1211      t.setValue(value);
1212      if (this.header == null)
1213        this.header = new ArrayList<StringType>();
1214      this.header.add(t);
1215      return this;
1216    }
1217
1218    /**
1219     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
1220     */
1221    public boolean hasHeader(String value) { 
1222      if (this.header == null)
1223        return false;
1224      for (StringType v : this.header)
1225        if (v.getValue().equals(value)) // string
1226          return true;
1227      return false;
1228    }
1229
1230    /**
1231     * @return {@link #heartbeatPeriod} (If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.). This is the underlying object with id, value and extensions. The accessor "getHeartbeatPeriod" gives direct access to the value
1232     */
1233    public UnsignedIntType getHeartbeatPeriodElement() { 
1234      if (this.heartbeatPeriod == null)
1235        if (Configuration.errorOnAutoCreate())
1236          throw new Error("Attempt to auto-create Subscription.heartbeatPeriod");
1237        else if (Configuration.doAutoCreate())
1238          this.heartbeatPeriod = new UnsignedIntType(); // bb
1239      return this.heartbeatPeriod;
1240    }
1241
1242    public boolean hasHeartbeatPeriodElement() { 
1243      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1244    }
1245
1246    public boolean hasHeartbeatPeriod() { 
1247      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1248    }
1249
1250    /**
1251     * @param value {@link #heartbeatPeriod} (If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.). This is the underlying object with id, value and extensions. The accessor "getHeartbeatPeriod" gives direct access to the value
1252     */
1253    public Subscription setHeartbeatPeriodElement(UnsignedIntType value) { 
1254      this.heartbeatPeriod = value;
1255      return this;
1256    }
1257
1258    /**
1259     * @return If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
1260     */
1261    public int getHeartbeatPeriod() { 
1262      return this.heartbeatPeriod == null || this.heartbeatPeriod.isEmpty() ? 0 : this.heartbeatPeriod.getValue();
1263    }
1264
1265    /**
1266     * @param value If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
1267     */
1268    public Subscription setHeartbeatPeriod(int value) { 
1269        if (this.heartbeatPeriod == null)
1270          this.heartbeatPeriod = new UnsignedIntType();
1271        this.heartbeatPeriod.setValue(value);
1272      return this;
1273    }
1274
1275    /**
1276     * @return {@link #timeout} (If present, the maximum amount of time a server will allow before failing a notification attempt.). This is the underlying object with id, value and extensions. The accessor "getTimeout" gives direct access to the value
1277     */
1278    public UnsignedIntType getTimeoutElement() { 
1279      if (this.timeout == null)
1280        if (Configuration.errorOnAutoCreate())
1281          throw new Error("Attempt to auto-create Subscription.timeout");
1282        else if (Configuration.doAutoCreate())
1283          this.timeout = new UnsignedIntType(); // bb
1284      return this.timeout;
1285    }
1286
1287    public boolean hasTimeoutElement() { 
1288      return this.timeout != null && !this.timeout.isEmpty();
1289    }
1290
1291    public boolean hasTimeout() { 
1292      return this.timeout != null && !this.timeout.isEmpty();
1293    }
1294
1295    /**
1296     * @param value {@link #timeout} (If present, the maximum amount of time a server will allow before failing a notification attempt.). This is the underlying object with id, value and extensions. The accessor "getTimeout" gives direct access to the value
1297     */
1298    public Subscription setTimeoutElement(UnsignedIntType value) { 
1299      this.timeout = value;
1300      return this;
1301    }
1302
1303    /**
1304     * @return If present, the maximum amount of time a server will allow before failing a notification attempt.
1305     */
1306    public int getTimeout() { 
1307      return this.timeout == null || this.timeout.isEmpty() ? 0 : this.timeout.getValue();
1308    }
1309
1310    /**
1311     * @param value If present, the maximum amount of time a server will allow before failing a notification attempt.
1312     */
1313    public Subscription setTimeout(int value) { 
1314        if (this.timeout == null)
1315          this.timeout = new UnsignedIntType();
1316        this.timeout.setValue(value);
1317      return this;
1318    }
1319
1320    /**
1321     * @return {@link #contentType} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1322     */
1323    public CodeType getContentTypeElement() { 
1324      if (this.contentType == null)
1325        if (Configuration.errorOnAutoCreate())
1326          throw new Error("Attempt to auto-create Subscription.contentType");
1327        else if (Configuration.doAutoCreate())
1328          this.contentType = new CodeType(); // bb
1329      return this.contentType;
1330    }
1331
1332    public boolean hasContentTypeElement() { 
1333      return this.contentType != null && !this.contentType.isEmpty();
1334    }
1335
1336    public boolean hasContentType() { 
1337      return this.contentType != null && !this.contentType.isEmpty();
1338    }
1339
1340    /**
1341     * @param value {@link #contentType} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1342     */
1343    public Subscription setContentTypeElement(CodeType value) { 
1344      this.contentType = value;
1345      return this;
1346    }
1347
1348    /**
1349     * @return The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
1350     */
1351    public String getContentType() { 
1352      return this.contentType == null ? null : this.contentType.getValue();
1353    }
1354
1355    /**
1356     * @param value The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
1357     */
1358    public Subscription setContentType(String value) { 
1359      if (Utilities.noString(value))
1360        this.contentType = null;
1361      else {
1362        if (this.contentType == null)
1363          this.contentType = new CodeType();
1364        this.contentType.setValue(value);
1365      }
1366      return this;
1367    }
1368
1369    /**
1370     * @return {@link #content} (How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
1371     */
1372    public Enumeration<SubscriptionPayloadContent> getContentElement() { 
1373      if (this.content == null)
1374        if (Configuration.errorOnAutoCreate())
1375          throw new Error("Attempt to auto-create Subscription.content");
1376        else if (Configuration.doAutoCreate())
1377          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory()); // bb
1378      return this.content;
1379    }
1380
1381    public boolean hasContentElement() { 
1382      return this.content != null && !this.content.isEmpty();
1383    }
1384
1385    public boolean hasContent() { 
1386      return this.content != null && !this.content.isEmpty();
1387    }
1388
1389    /**
1390     * @param value {@link #content} (How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
1391     */
1392    public Subscription setContentElement(Enumeration<SubscriptionPayloadContent> value) { 
1393      this.content = value;
1394      return this;
1395    }
1396
1397    /**
1398     * @return How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.
1399     */
1400    public SubscriptionPayloadContent getContent() { 
1401      return this.content == null ? null : this.content.getValue();
1402    }
1403
1404    /**
1405     * @param value How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.
1406     */
1407    public Subscription setContent(SubscriptionPayloadContent value) { 
1408      if (value == null)
1409        this.content = null;
1410      else {
1411        if (this.content == null)
1412          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory());
1413        this.content.setValue(value);
1414      }
1415      return this;
1416    }
1417
1418    /**
1419     * @return {@link #maxCount} (If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.). This is the underlying object with id, value and extensions. The accessor "getMaxCount" gives direct access to the value
1420     */
1421    public PositiveIntType getMaxCountElement() { 
1422      if (this.maxCount == null)
1423        if (Configuration.errorOnAutoCreate())
1424          throw new Error("Attempt to auto-create Subscription.maxCount");
1425        else if (Configuration.doAutoCreate())
1426          this.maxCount = new PositiveIntType(); // bb
1427      return this.maxCount;
1428    }
1429
1430    public boolean hasMaxCountElement() { 
1431      return this.maxCount != null && !this.maxCount.isEmpty();
1432    }
1433
1434    public boolean hasMaxCount() { 
1435      return this.maxCount != null && !this.maxCount.isEmpty();
1436    }
1437
1438    /**
1439     * @param value {@link #maxCount} (If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.). This is the underlying object with id, value and extensions. The accessor "getMaxCount" gives direct access to the value
1440     */
1441    public Subscription setMaxCountElement(PositiveIntType value) { 
1442      this.maxCount = value;
1443      return this;
1444    }
1445
1446    /**
1447     * @return If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
1448     */
1449    public int getMaxCount() { 
1450      return this.maxCount == null || this.maxCount.isEmpty() ? 0 : this.maxCount.getValue();
1451    }
1452
1453    /**
1454     * @param value If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
1455     */
1456    public Subscription setMaxCount(int value) { 
1457        if (this.maxCount == null)
1458          this.maxCount = new PositiveIntType();
1459        this.maxCount.setValue(value);
1460      return this;
1461    }
1462
1463      protected void listChildren(List<Property> children) {
1464        super.listChildren(children);
1465        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
1466        children.add(new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name));
1467        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
1468        children.add(new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic));
1469        children.add(new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact));
1470        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
1471        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
1472        children.add(new Property("filterBy", "", "The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy));
1473        children.add(new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType));
1474        children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint));
1475        children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
1476        children.add(new Property("heartbeatPeriod", "unsignedInt", "If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod));
1477        children.add(new Property("timeout", "unsignedInt", "If present, the maximum amount of time a server will allow before failing a notification attempt.", 0, 1, timeout));
1478        children.add(new Property("contentType", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions.", 0, 1, contentType));
1479        children.add(new Property("content", "code", "How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.", 0, 1, content));
1480        children.add(new Property("maxCount", "positiveInt", "If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.", 0, 1, maxCount));
1481      }
1482
1483      @Override
1484      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1485        switch (_hash) {
1486        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
1487        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name);
1488        case -892481550: /*status*/  return new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status);
1489        case 110546223: /*topic*/  return new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic);
1490        case 951526432: /*contact*/  return new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact);
1491        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
1492        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
1493        case -721168913: /*filterBy*/  return new Property("filterBy", "", "The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy);
1494        case 274155229: /*channelType*/  return new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType);
1495        case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint);
1496        case -1221270899: /*header*/  return new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header);
1497        case -938465827: /*heartbeatPeriod*/  return new Property("heartbeatPeriod", "unsignedInt", "If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod);
1498        case -1313911455: /*timeout*/  return new Property("timeout", "unsignedInt", "If present, the maximum amount of time a server will allow before failing a notification attempt.", 0, 1, timeout);
1499        case -389131437: /*contentType*/  return new Property("contentType", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions.", 0, 1, contentType);
1500        case 951530617: /*content*/  return new Property("content", "code", "How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.", 0, 1, content);
1501        case 382106123: /*maxCount*/  return new Property("maxCount", "positiveInt", "If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.", 0, 1, maxCount);
1502        default: return super.getNamedProperty(_hash, _name, _checkValid);
1503        }
1504
1505      }
1506
1507      @Override
1508      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1509        switch (hash) {
1510        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1511        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1512        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatusCodes>
1513        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // CanonicalType
1514        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1515        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1516        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
1517        case -721168913: /*filterBy*/ return this.filterBy == null ? new Base[0] : this.filterBy.toArray(new Base[this.filterBy.size()]); // SubscriptionFilterByComponent
1518        case 274155229: /*channelType*/ return this.channelType == null ? new Base[0] : new Base[] {this.channelType}; // Coding
1519        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
1520        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
1521        case -938465827: /*heartbeatPeriod*/ return this.heartbeatPeriod == null ? new Base[0] : new Base[] {this.heartbeatPeriod}; // UnsignedIntType
1522        case -1313911455: /*timeout*/ return this.timeout == null ? new Base[0] : new Base[] {this.timeout}; // UnsignedIntType
1523        case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
1524        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Enumeration<SubscriptionPayloadContent>
1525        case 382106123: /*maxCount*/ return this.maxCount == null ? new Base[0] : new Base[] {this.maxCount}; // PositiveIntType
1526        default: return super.getProperty(hash, name, checkValid);
1527        }
1528
1529      }
1530
1531      @Override
1532      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1533        switch (hash) {
1534        case -1618432855: // identifier
1535          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1536          return value;
1537        case 3373707: // name
1538          this.name = TypeConvertor.castToString(value); // StringType
1539          return value;
1540        case -892481550: // status
1541          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1542          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
1543          return value;
1544        case 110546223: // topic
1545          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
1546          return value;
1547        case 951526432: // contact
1548          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1549          return value;
1550        case 100571: // end
1551          this.end = TypeConvertor.castToInstant(value); // InstantType
1552          return value;
1553        case -934964668: // reason
1554          this.reason = TypeConvertor.castToString(value); // StringType
1555          return value;
1556        case -721168913: // filterBy
1557          this.getFilterBy().add((SubscriptionFilterByComponent) value); // SubscriptionFilterByComponent
1558          return value;
1559        case 274155229: // channelType
1560          this.channelType = TypeConvertor.castToCoding(value); // Coding
1561          return value;
1562        case 1741102485: // endpoint
1563          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1564          return value;
1565        case -1221270899: // header
1566          this.getHeader().add(TypeConvertor.castToString(value)); // StringType
1567          return value;
1568        case -938465827: // heartbeatPeriod
1569          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1570          return value;
1571        case -1313911455: // timeout
1572          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1573          return value;
1574        case -389131437: // contentType
1575          this.contentType = TypeConvertor.castToCode(value); // CodeType
1576          return value;
1577        case 951530617: // content
1578          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1579          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1580          return value;
1581        case 382106123: // maxCount
1582          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1583          return value;
1584        default: return super.setProperty(hash, name, value);
1585        }
1586
1587      }
1588
1589      @Override
1590      public Base setProperty(String name, Base value) throws FHIRException {
1591        if (name.equals("identifier")) {
1592          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1593        } else if (name.equals("name")) {
1594          this.name = TypeConvertor.castToString(value); // StringType
1595        } else if (name.equals("status")) {
1596          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1597          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
1598        } else if (name.equals("topic")) {
1599          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
1600        } else if (name.equals("contact")) {
1601          this.getContact().add(TypeConvertor.castToContactPoint(value));
1602        } else if (name.equals("end")) {
1603          this.end = TypeConvertor.castToInstant(value); // InstantType
1604        } else if (name.equals("reason")) {
1605          this.reason = TypeConvertor.castToString(value); // StringType
1606        } else if (name.equals("filterBy")) {
1607          this.getFilterBy().add((SubscriptionFilterByComponent) value);
1608        } else if (name.equals("channelType")) {
1609          this.channelType = TypeConvertor.castToCoding(value); // Coding
1610        } else if (name.equals("endpoint")) {
1611          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1612        } else if (name.equals("header")) {
1613          this.getHeader().add(TypeConvertor.castToString(value));
1614        } else if (name.equals("heartbeatPeriod")) {
1615          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1616        } else if (name.equals("timeout")) {
1617          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1618        } else if (name.equals("contentType")) {
1619          this.contentType = TypeConvertor.castToCode(value); // CodeType
1620        } else if (name.equals("content")) {
1621          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1622          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1623        } else if (name.equals("maxCount")) {
1624          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1625        } else
1626          return super.setProperty(name, value);
1627        return value;
1628      }
1629
1630      @Override
1631      public Base makeProperty(int hash, String name) throws FHIRException {
1632        switch (hash) {
1633        case -1618432855:  return addIdentifier(); 
1634        case 3373707:  return getNameElement();
1635        case -892481550:  return getStatusElement();
1636        case 110546223:  return getTopicElement();
1637        case 951526432:  return addContact(); 
1638        case 100571:  return getEndElement();
1639        case -934964668:  return getReasonElement();
1640        case -721168913:  return addFilterBy(); 
1641        case 274155229:  return getChannelType();
1642        case 1741102485:  return getEndpointElement();
1643        case -1221270899:  return addHeaderElement();
1644        case -938465827:  return getHeartbeatPeriodElement();
1645        case -1313911455:  return getTimeoutElement();
1646        case -389131437:  return getContentTypeElement();
1647        case 951530617:  return getContentElement();
1648        case 382106123:  return getMaxCountElement();
1649        default: return super.makeProperty(hash, name);
1650        }
1651
1652      }
1653
1654      @Override
1655      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1656        switch (hash) {
1657        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1658        case 3373707: /*name*/ return new String[] {"string"};
1659        case -892481550: /*status*/ return new String[] {"code"};
1660        case 110546223: /*topic*/ return new String[] {"canonical"};
1661        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
1662        case 100571: /*end*/ return new String[] {"instant"};
1663        case -934964668: /*reason*/ return new String[] {"string"};
1664        case -721168913: /*filterBy*/ return new String[] {};
1665        case 274155229: /*channelType*/ return new String[] {"Coding"};
1666        case 1741102485: /*endpoint*/ return new String[] {"url"};
1667        case -1221270899: /*header*/ return new String[] {"string"};
1668        case -938465827: /*heartbeatPeriod*/ return new String[] {"unsignedInt"};
1669        case -1313911455: /*timeout*/ return new String[] {"unsignedInt"};
1670        case -389131437: /*contentType*/ return new String[] {"code"};
1671        case 951530617: /*content*/ return new String[] {"code"};
1672        case 382106123: /*maxCount*/ return new String[] {"positiveInt"};
1673        default: return super.getTypesForProperty(hash, name);
1674        }
1675
1676      }
1677
1678      @Override
1679      public Base addChild(String name) throws FHIRException {
1680        if (name.equals("identifier")) {
1681          return addIdentifier();
1682        }
1683        else if (name.equals("name")) {
1684          throw new FHIRException("Cannot call addChild on a primitive type Subscription.name");
1685        }
1686        else if (name.equals("status")) {
1687          throw new FHIRException("Cannot call addChild on a primitive type Subscription.status");
1688        }
1689        else if (name.equals("topic")) {
1690          throw new FHIRException("Cannot call addChild on a primitive type Subscription.topic");
1691        }
1692        else if (name.equals("contact")) {
1693          return addContact();
1694        }
1695        else if (name.equals("end")) {
1696          throw new FHIRException("Cannot call addChild on a primitive type Subscription.end");
1697        }
1698        else if (name.equals("reason")) {
1699          throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason");
1700        }
1701        else if (name.equals("filterBy")) {
1702          return addFilterBy();
1703        }
1704        else if (name.equals("channelType")) {
1705          this.channelType = new Coding();
1706          return this.channelType;
1707        }
1708        else if (name.equals("endpoint")) {
1709          throw new FHIRException("Cannot call addChild on a primitive type Subscription.endpoint");
1710        }
1711        else if (name.equals("header")) {
1712          throw new FHIRException("Cannot call addChild on a primitive type Subscription.header");
1713        }
1714        else if (name.equals("heartbeatPeriod")) {
1715          throw new FHIRException("Cannot call addChild on a primitive type Subscription.heartbeatPeriod");
1716        }
1717        else if (name.equals("timeout")) {
1718          throw new FHIRException("Cannot call addChild on a primitive type Subscription.timeout");
1719        }
1720        else if (name.equals("contentType")) {
1721          throw new FHIRException("Cannot call addChild on a primitive type Subscription.contentType");
1722        }
1723        else if (name.equals("content")) {
1724          throw new FHIRException("Cannot call addChild on a primitive type Subscription.content");
1725        }
1726        else if (name.equals("maxCount")) {
1727          throw new FHIRException("Cannot call addChild on a primitive type Subscription.maxCount");
1728        }
1729        else
1730          return super.addChild(name);
1731      }
1732
1733  public String fhirType() {
1734    return "Subscription";
1735
1736  }
1737
1738      public Subscription copy() {
1739        Subscription dst = new Subscription();
1740        copyValues(dst);
1741        return dst;
1742      }
1743
1744      public void copyValues(Subscription dst) {
1745        super.copyValues(dst);
1746        if (identifier != null) {
1747          dst.identifier = new ArrayList<Identifier>();
1748          for (Identifier i : identifier)
1749            dst.identifier.add(i.copy());
1750        };
1751        dst.name = name == null ? null : name.copy();
1752        dst.status = status == null ? null : status.copy();
1753        dst.topic = topic == null ? null : topic.copy();
1754        if (contact != null) {
1755          dst.contact = new ArrayList<ContactPoint>();
1756          for (ContactPoint i : contact)
1757            dst.contact.add(i.copy());
1758        };
1759        dst.end = end == null ? null : end.copy();
1760        dst.reason = reason == null ? null : reason.copy();
1761        if (filterBy != null) {
1762          dst.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1763          for (SubscriptionFilterByComponent i : filterBy)
1764            dst.filterBy.add(i.copy());
1765        };
1766        dst.channelType = channelType == null ? null : channelType.copy();
1767        dst.endpoint = endpoint == null ? null : endpoint.copy();
1768        if (header != null) {
1769          dst.header = new ArrayList<StringType>();
1770          for (StringType i : header)
1771            dst.header.add(i.copy());
1772        };
1773        dst.heartbeatPeriod = heartbeatPeriod == null ? null : heartbeatPeriod.copy();
1774        dst.timeout = timeout == null ? null : timeout.copy();
1775        dst.contentType = contentType == null ? null : contentType.copy();
1776        dst.content = content == null ? null : content.copy();
1777        dst.maxCount = maxCount == null ? null : maxCount.copy();
1778      }
1779
1780      protected Subscription typedCopy() {
1781        return copy();
1782      }
1783
1784      @Override
1785      public boolean equalsDeep(Base other_) {
1786        if (!super.equalsDeep(other_))
1787          return false;
1788        if (!(other_ instanceof Subscription))
1789          return false;
1790        Subscription o = (Subscription) other_;
1791        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(status, o.status, true)
1792           && compareDeep(topic, o.topic, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
1793           && compareDeep(reason, o.reason, true) && compareDeep(filterBy, o.filterBy, true) && compareDeep(channelType, o.channelType, true)
1794           && compareDeep(endpoint, o.endpoint, true) && compareDeep(header, o.header, true) && compareDeep(heartbeatPeriod, o.heartbeatPeriod, true)
1795           && compareDeep(timeout, o.timeout, true) && compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true)
1796           && compareDeep(maxCount, o.maxCount, true);
1797      }
1798
1799      @Override
1800      public boolean equalsShallow(Base other_) {
1801        if (!super.equalsShallow(other_))
1802          return false;
1803        if (!(other_ instanceof Subscription))
1804          return false;
1805        Subscription o = (Subscription) other_;
1806        return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(topic, o.topic, true)
1807           && compareValues(end, o.end, true) && compareValues(reason, o.reason, true) && compareValues(endpoint, o.endpoint, true)
1808           && compareValues(header, o.header, true) && compareValues(heartbeatPeriod, o.heartbeatPeriod, true)
1809           && compareValues(timeout, o.timeout, true) && compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true)
1810           && compareValues(maxCount, o.maxCount, true);
1811      }
1812
1813      public boolean isEmpty() {
1814        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, status
1815          , topic, contact, end, reason, filterBy, channelType, endpoint, header, heartbeatPeriod
1816          , timeout, contentType, content, maxCount);
1817      }
1818
1819  @Override
1820  public ResourceType getResourceType() {
1821    return ResourceType.Subscription;
1822   }
1823
1824 /**
1825   * Search parameter: <b>contact</b>
1826   * <p>
1827   * Description: <b>Contact details for the subscription</b><br>
1828   * Type: <b>token</b><br>
1829   * Path: <b>Subscription.contact</b><br>
1830   * </p>
1831   */
1832  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
1833  public static final String SP_CONTACT = "contact";
1834 /**
1835   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
1836   * <p>
1837   * Description: <b>Contact details for the subscription</b><br>
1838   * Type: <b>token</b><br>
1839   * Path: <b>Subscription.contact</b><br>
1840   * </p>
1841   */
1842  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
1843
1844 /**
1845   * Search parameter: <b>identifier</b>
1846   * <p>
1847   * Description: <b>A subscription identifier</b><br>
1848   * Type: <b>token</b><br>
1849   * Path: <b>Subscription.identifier</b><br>
1850   * </p>
1851   */
1852  @SearchParamDefinition(name="identifier", path="Subscription.identifier", description="A subscription identifier", type="token" )
1853  public static final String SP_IDENTIFIER = "identifier";
1854 /**
1855   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1856   * <p>
1857   * Description: <b>A subscription identifier</b><br>
1858   * Type: <b>token</b><br>
1859   * Path: <b>Subscription.identifier</b><br>
1860   * </p>
1861   */
1862  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1863
1864 /**
1865   * Search parameter: <b>payload</b>
1866   * <p>
1867   * Description: <b>The mime-type of the notification payload</b><br>
1868   * Type: <b>token</b><br>
1869   * Path: <b>null</b><br>
1870   * </p>
1871   */
1872  @SearchParamDefinition(name="payload", path="", description="The mime-type of the notification payload", type="token" )
1873  public static final String SP_PAYLOAD = "payload";
1874 /**
1875   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
1876   * <p>
1877   * Description: <b>The mime-type of the notification payload</b><br>
1878   * Type: <b>token</b><br>
1879   * Path: <b>null</b><br>
1880   * </p>
1881   */
1882  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
1883
1884 /**
1885   * Search parameter: <b>status</b>
1886   * <p>
1887   * Description: <b>The current state of the subscription</b><br>
1888   * Type: <b>token</b><br>
1889   * Path: <b>Subscription.status</b><br>
1890   * </p>
1891   */
1892  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
1893  public static final String SP_STATUS = "status";
1894 /**
1895   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1896   * <p>
1897   * Description: <b>The current state of the subscription</b><br>
1898   * Type: <b>token</b><br>
1899   * Path: <b>Subscription.status</b><br>
1900   * </p>
1901   */
1902  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1903
1904 /**
1905   * Search parameter: <b>type</b>
1906   * <p>
1907   * Description: <b>The type of channel for the sent notifications</b><br>
1908   * Type: <b>token</b><br>
1909   * Path: <b>null</b><br>
1910   * </p>
1911   */
1912  @SearchParamDefinition(name="type", path="", description="The type of channel for the sent notifications", type="token" )
1913  public static final String SP_TYPE = "type";
1914 /**
1915   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1916   * <p>
1917   * Description: <b>The type of channel for the sent notifications</b><br>
1918   * Type: <b>token</b><br>
1919   * Path: <b>null</b><br>
1920   * </p>
1921   */
1922  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1923
1924 /**
1925   * Search parameter: <b>url</b>
1926   * <p>
1927   * Description: <b>The uri that will receive the notifications</b><br>
1928   * Type: <b>uri</b><br>
1929   * Path: <b>null</b><br>
1930   * </p>
1931   */
1932  @SearchParamDefinition(name="url", path="", description="The uri that will receive the notifications", type="uri" )
1933  public static final String SP_URL = "url";
1934 /**
1935   * <b>Fluent Client</b> search parameter constant for <b>url</b>
1936   * <p>
1937   * Description: <b>The uri that will receive the notifications</b><br>
1938   * Type: <b>uri</b><br>
1939   * Path: <b>null</b><br>
1940   * </p>
1941   */
1942  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
1943
1944
1945}
1946