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 Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
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(PrimitiveType<?> code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.NULL, code);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.NULL, code);
146        if ("empty".equals(codeString))
147          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.EMPTY, code);
148        if ("id-only".equals(codeString))
149          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.IDONLY, code);
150        if ("full-resource".equals(codeString))
151          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.FULLRESOURCE, code);
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/fhir-types")
176        protected UriType resourceType;
177
178        /**
179         * The filter 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 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 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 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 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 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 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 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     * Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.
610     */
611    @Child(name = "managingEntity", type = {CareTeam.class, HealthcareService.class, Organization.class, RelatedPerson.class, Patient.class, Practitioner.class, PractitionerRole.class}, order=6, min=0, max=1, modifier=false, summary=true)
612    @Description(shortDefinition="Entity responsible for Subscription changes", formalDefinition="Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose." )
613    protected Reference managingEntity;
614
615    /**
616     * A description of why this subscription is defined.
617     */
618    @Child(name = "reason", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
619    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
620    protected StringType reason;
621
622    /**
623     * 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).
624     */
625    @Child(name = "filterBy", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
626    @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)." )
627    protected List<SubscriptionFilterByComponent> filterBy;
628
629    /**
630     * The type of channel to send notifications on.
631     */
632    @Child(name = "channelType", type = {Coding.class}, order=9, min=1, max=1, modifier=false, summary=true)
633    @Description(shortDefinition="Channel type for notifications", formalDefinition="The type of channel to send notifications on." )
634    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
635    protected Coding channelType;
636
637    /**
638     * The url that describes the actual end-point to send messages to.
639     */
640    @Child(name = "endpoint", type = {UrlType.class}, order=10, min=0, max=1, modifier=false, summary=true)
641    @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." )
642    protected UrlType endpoint;
643
644    /**
645     * Additional headers / information to send as part of the notification.
646     */
647    @Child(name = "header", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
648    @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
649    protected List<StringType> header;
650
651    /**
652     * 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.
653     */
654    @Child(name = "heartbeatPeriod", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
655    @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." )
656    protected UnsignedIntType heartbeatPeriod;
657
658    /**
659     * If present, the maximum amount of time a server will allow before failing a notification attempt.
660     */
661    @Child(name = "timeout", type = {UnsignedIntType.class}, order=13, min=0, max=1, modifier=false, summary=true)
662    @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." )
663    protected UnsignedIntType timeout;
664
665    /**
666     * 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.
667     */
668    @Child(name = "contentType", type = {CodeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
669    @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." )
670    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
671    protected CodeType contentType;
672
673    /**
674     * 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.
675     */
676    @Child(name = "content", type = {CodeType.class}, order=15, min=0, max=1, modifier=false, summary=true)
677    @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." )
678    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-payload-content")
679    protected Enumeration<SubscriptionPayloadContent> content;
680
681    /**
682     * 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.
683     */
684    @Child(name = "maxCount", type = {PositiveIntType.class}, order=16, min=0, max=1, modifier=false, summary=true)
685    @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." )
686    protected PositiveIntType maxCount;
687
688    private static final long serialVersionUID = 715551030L;
689
690  /**
691   * Constructor
692   */
693    public Subscription() {
694      super();
695    }
696
697  /**
698   * Constructor
699   */
700    public Subscription(SubscriptionStatusCodes status, String topic, Coding channelType) {
701      super();
702      this.setStatus(status);
703      this.setTopic(topic);
704      this.setChannelType(channelType);
705    }
706
707    /**
708     * @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.)
709     */
710    public List<Identifier> getIdentifier() { 
711      if (this.identifier == null)
712        this.identifier = new ArrayList<Identifier>();
713      return this.identifier;
714    }
715
716    /**
717     * @return Returns a reference to <code>this</code> for easy method chaining
718     */
719    public Subscription setIdentifier(List<Identifier> theIdentifier) { 
720      this.identifier = theIdentifier;
721      return this;
722    }
723
724    public boolean hasIdentifier() { 
725      if (this.identifier == null)
726        return false;
727      for (Identifier item : this.identifier)
728        if (!item.isEmpty())
729          return true;
730      return false;
731    }
732
733    public Identifier addIdentifier() { //3
734      Identifier t = new Identifier();
735      if (this.identifier == null)
736        this.identifier = new ArrayList<Identifier>();
737      this.identifier.add(t);
738      return t;
739    }
740
741    public Subscription addIdentifier(Identifier t) { //3
742      if (t == null)
743        return this;
744      if (this.identifier == null)
745        this.identifier = new ArrayList<Identifier>();
746      this.identifier.add(t);
747      return this;
748    }
749
750    /**
751     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
752     */
753    public Identifier getIdentifierFirstRep() { 
754      if (getIdentifier().isEmpty()) {
755        addIdentifier();
756      }
757      return getIdentifier().get(0);
758    }
759
760    /**
761     * @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
762     */
763    public StringType getNameElement() { 
764      if (this.name == null)
765        if (Configuration.errorOnAutoCreate())
766          throw new Error("Attempt to auto-create Subscription.name");
767        else if (Configuration.doAutoCreate())
768          this.name = new StringType(); // bb
769      return this.name;
770    }
771
772    public boolean hasNameElement() { 
773      return this.name != null && !this.name.isEmpty();
774    }
775
776    public boolean hasName() { 
777      return this.name != null && !this.name.isEmpty();
778    }
779
780    /**
781     * @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
782     */
783    public Subscription setNameElement(StringType value) { 
784      this.name = value;
785      return this;
786    }
787
788    /**
789     * @return A natural language name identifying the subscription.
790     */
791    public String getName() { 
792      return this.name == null ? null : this.name.getValue();
793    }
794
795    /**
796     * @param value A natural language name identifying the subscription.
797     */
798    public Subscription setName(String value) { 
799      if (Utilities.noString(value))
800        this.name = null;
801      else {
802        if (this.name == null)
803          this.name = new StringType();
804        this.name.setValue(value);
805      }
806      return this;
807    }
808
809    /**
810     * @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
811     */
812    public Enumeration<SubscriptionStatusCodes> getStatusElement() { 
813      if (this.status == null)
814        if (Configuration.errorOnAutoCreate())
815          throw new Error("Attempt to auto-create Subscription.status");
816        else if (Configuration.doAutoCreate())
817          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory()); // bb
818      return this.status;
819    }
820
821    public boolean hasStatusElement() { 
822      return this.status != null && !this.status.isEmpty();
823    }
824
825    public boolean hasStatus() { 
826      return this.status != null && !this.status.isEmpty();
827    }
828
829    /**
830     * @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
831     */
832    public Subscription setStatusElement(Enumeration<SubscriptionStatusCodes> value) { 
833      this.status = value;
834      return this;
835    }
836
837    /**
838     * @return The status of the subscription, which marks the server state for managing the subscription.
839     */
840    public SubscriptionStatusCodes getStatus() { 
841      return this.status == null ? null : this.status.getValue();
842    }
843
844    /**
845     * @param value The status of the subscription, which marks the server state for managing the subscription.
846     */
847    public Subscription setStatus(SubscriptionStatusCodes value) { 
848        if (this.status == null)
849          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory());
850        this.status.setValue(value);
851      return this;
852    }
853
854    /**
855     * @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
856     */
857    public CanonicalType getTopicElement() { 
858      if (this.topic == null)
859        if (Configuration.errorOnAutoCreate())
860          throw new Error("Attempt to auto-create Subscription.topic");
861        else if (Configuration.doAutoCreate())
862          this.topic = new CanonicalType(); // bb
863      return this.topic;
864    }
865
866    public boolean hasTopicElement() { 
867      return this.topic != null && !this.topic.isEmpty();
868    }
869
870    public boolean hasTopic() { 
871      return this.topic != null && !this.topic.isEmpty();
872    }
873
874    /**
875     * @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
876     */
877    public Subscription setTopicElement(CanonicalType value) { 
878      this.topic = value;
879      return this;
880    }
881
882    /**
883     * @return The reference to the subscription topic to be notified about.
884     */
885    public String getTopic() { 
886      return this.topic == null ? null : this.topic.getValue();
887    }
888
889    /**
890     * @param value The reference to the subscription topic to be notified about.
891     */
892    public Subscription setTopic(String value) { 
893        if (this.topic == null)
894          this.topic = new CanonicalType();
895        this.topic.setValue(value);
896      return this;
897    }
898
899    /**
900     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
901     */
902    public List<ContactPoint> getContact() { 
903      if (this.contact == null)
904        this.contact = new ArrayList<ContactPoint>();
905      return this.contact;
906    }
907
908    /**
909     * @return Returns a reference to <code>this</code> for easy method chaining
910     */
911    public Subscription setContact(List<ContactPoint> theContact) { 
912      this.contact = theContact;
913      return this;
914    }
915
916    public boolean hasContact() { 
917      if (this.contact == null)
918        return false;
919      for (ContactPoint item : this.contact)
920        if (!item.isEmpty())
921          return true;
922      return false;
923    }
924
925    public ContactPoint addContact() { //3
926      ContactPoint t = new ContactPoint();
927      if (this.contact == null)
928        this.contact = new ArrayList<ContactPoint>();
929      this.contact.add(t);
930      return t;
931    }
932
933    public Subscription addContact(ContactPoint t) { //3
934      if (t == null)
935        return this;
936      if (this.contact == null)
937        this.contact = new ArrayList<ContactPoint>();
938      this.contact.add(t);
939      return this;
940    }
941
942    /**
943     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
944     */
945    public ContactPoint getContactFirstRep() { 
946      if (getContact().isEmpty()) {
947        addContact();
948      }
949      return getContact().get(0);
950    }
951
952    /**
953     * @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
954     */
955    public InstantType getEndElement() { 
956      if (this.end == null)
957        if (Configuration.errorOnAutoCreate())
958          throw new Error("Attempt to auto-create Subscription.end");
959        else if (Configuration.doAutoCreate())
960          this.end = new InstantType(); // bb
961      return this.end;
962    }
963
964    public boolean hasEndElement() { 
965      return this.end != null && !this.end.isEmpty();
966    }
967
968    public boolean hasEnd() { 
969      return this.end != null && !this.end.isEmpty();
970    }
971
972    /**
973     * @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
974     */
975    public Subscription setEndElement(InstantType value) { 
976      this.end = value;
977      return this;
978    }
979
980    /**
981     * @return The time for the server to turn the subscription off.
982     */
983    public Date getEnd() { 
984      return this.end == null ? null : this.end.getValue();
985    }
986
987    /**
988     * @param value The time for the server to turn the subscription off.
989     */
990    public Subscription setEnd(Date value) { 
991      if (value == null)
992        this.end = null;
993      else {
994        if (this.end == null)
995          this.end = new InstantType();
996        this.end.setValue(value);
997      }
998      return this;
999    }
1000
1001    /**
1002     * @return {@link #managingEntity} (Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.)
1003     */
1004    public Reference getManagingEntity() { 
1005      if (this.managingEntity == null)
1006        if (Configuration.errorOnAutoCreate())
1007          throw new Error("Attempt to auto-create Subscription.managingEntity");
1008        else if (Configuration.doAutoCreate())
1009          this.managingEntity = new Reference(); // cc
1010      return this.managingEntity;
1011    }
1012
1013    public boolean hasManagingEntity() { 
1014      return this.managingEntity != null && !this.managingEntity.isEmpty();
1015    }
1016
1017    /**
1018     * @param value {@link #managingEntity} (Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.)
1019     */
1020    public Subscription setManagingEntity(Reference value) { 
1021      this.managingEntity = value;
1022      return this;
1023    }
1024
1025    /**
1026     * @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
1027     */
1028    public StringType getReasonElement() { 
1029      if (this.reason == null)
1030        if (Configuration.errorOnAutoCreate())
1031          throw new Error("Attempt to auto-create Subscription.reason");
1032        else if (Configuration.doAutoCreate())
1033          this.reason = new StringType(); // bb
1034      return this.reason;
1035    }
1036
1037    public boolean hasReasonElement() { 
1038      return this.reason != null && !this.reason.isEmpty();
1039    }
1040
1041    public boolean hasReason() { 
1042      return this.reason != null && !this.reason.isEmpty();
1043    }
1044
1045    /**
1046     * @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
1047     */
1048    public Subscription setReasonElement(StringType value) { 
1049      this.reason = value;
1050      return this;
1051    }
1052
1053    /**
1054     * @return A description of why this subscription is defined.
1055     */
1056    public String getReason() { 
1057      return this.reason == null ? null : this.reason.getValue();
1058    }
1059
1060    /**
1061     * @param value A description of why this subscription is defined.
1062     */
1063    public Subscription setReason(String value) { 
1064      if (Utilities.noString(value))
1065        this.reason = null;
1066      else {
1067        if (this.reason == null)
1068          this.reason = new StringType();
1069        this.reason.setValue(value);
1070      }
1071      return this;
1072    }
1073
1074    /**
1075     * @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).)
1076     */
1077    public List<SubscriptionFilterByComponent> getFilterBy() { 
1078      if (this.filterBy == null)
1079        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1080      return this.filterBy;
1081    }
1082
1083    /**
1084     * @return Returns a reference to <code>this</code> for easy method chaining
1085     */
1086    public Subscription setFilterBy(List<SubscriptionFilterByComponent> theFilterBy) { 
1087      this.filterBy = theFilterBy;
1088      return this;
1089    }
1090
1091    public boolean hasFilterBy() { 
1092      if (this.filterBy == null)
1093        return false;
1094      for (SubscriptionFilterByComponent item : this.filterBy)
1095        if (!item.isEmpty())
1096          return true;
1097      return false;
1098    }
1099
1100    public SubscriptionFilterByComponent addFilterBy() { //3
1101      SubscriptionFilterByComponent t = new SubscriptionFilterByComponent();
1102      if (this.filterBy == null)
1103        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1104      this.filterBy.add(t);
1105      return t;
1106    }
1107
1108    public Subscription addFilterBy(SubscriptionFilterByComponent t) { //3
1109      if (t == null)
1110        return this;
1111      if (this.filterBy == null)
1112        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1113      this.filterBy.add(t);
1114      return this;
1115    }
1116
1117    /**
1118     * @return The first repetition of repeating field {@link #filterBy}, creating it if it does not already exist {3}
1119     */
1120    public SubscriptionFilterByComponent getFilterByFirstRep() { 
1121      if (getFilterBy().isEmpty()) {
1122        addFilterBy();
1123      }
1124      return getFilterBy().get(0);
1125    }
1126
1127    /**
1128     * @return {@link #channelType} (The type of channel to send notifications on.)
1129     */
1130    public Coding getChannelType() { 
1131      if (this.channelType == null)
1132        if (Configuration.errorOnAutoCreate())
1133          throw new Error("Attempt to auto-create Subscription.channelType");
1134        else if (Configuration.doAutoCreate())
1135          this.channelType = new Coding(); // cc
1136      return this.channelType;
1137    }
1138
1139    public boolean hasChannelType() { 
1140      return this.channelType != null && !this.channelType.isEmpty();
1141    }
1142
1143    /**
1144     * @param value {@link #channelType} (The type of channel to send notifications on.)
1145     */
1146    public Subscription setChannelType(Coding value) { 
1147      this.channelType = value;
1148      return this;
1149    }
1150
1151    /**
1152     * @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
1153     */
1154    public UrlType getEndpointElement() { 
1155      if (this.endpoint == null)
1156        if (Configuration.errorOnAutoCreate())
1157          throw new Error("Attempt to auto-create Subscription.endpoint");
1158        else if (Configuration.doAutoCreate())
1159          this.endpoint = new UrlType(); // bb
1160      return this.endpoint;
1161    }
1162
1163    public boolean hasEndpointElement() { 
1164      return this.endpoint != null && !this.endpoint.isEmpty();
1165    }
1166
1167    public boolean hasEndpoint() { 
1168      return this.endpoint != null && !this.endpoint.isEmpty();
1169    }
1170
1171    /**
1172     * @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
1173     */
1174    public Subscription setEndpointElement(UrlType value) { 
1175      this.endpoint = value;
1176      return this;
1177    }
1178
1179    /**
1180     * @return The url that describes the actual end-point to send messages to.
1181     */
1182    public String getEndpoint() { 
1183      return this.endpoint == null ? null : this.endpoint.getValue();
1184    }
1185
1186    /**
1187     * @param value The url that describes the actual end-point to send messages to.
1188     */
1189    public Subscription setEndpoint(String value) { 
1190      if (Utilities.noString(value))
1191        this.endpoint = null;
1192      else {
1193        if (this.endpoint == null)
1194          this.endpoint = new UrlType();
1195        this.endpoint.setValue(value);
1196      }
1197      return this;
1198    }
1199
1200    /**
1201     * @return {@link #header} (Additional headers / information to send as part of the notification.)
1202     */
1203    public List<StringType> getHeader() { 
1204      if (this.header == null)
1205        this.header = new ArrayList<StringType>();
1206      return this.header;
1207    }
1208
1209    /**
1210     * @return Returns a reference to <code>this</code> for easy method chaining
1211     */
1212    public Subscription setHeader(List<StringType> theHeader) { 
1213      this.header = theHeader;
1214      return this;
1215    }
1216
1217    public boolean hasHeader() { 
1218      if (this.header == null)
1219        return false;
1220      for (StringType item : this.header)
1221        if (!item.isEmpty())
1222          return true;
1223      return false;
1224    }
1225
1226    /**
1227     * @return {@link #header} (Additional headers / information to send as part of the notification.)
1228     */
1229    public StringType addHeaderElement() {//2 
1230      StringType t = new StringType();
1231      if (this.header == null)
1232        this.header = new ArrayList<StringType>();
1233      this.header.add(t);
1234      return t;
1235    }
1236
1237    /**
1238     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
1239     */
1240    public Subscription addHeader(String value) { //1
1241      StringType t = new StringType();
1242      t.setValue(value);
1243      if (this.header == null)
1244        this.header = new ArrayList<StringType>();
1245      this.header.add(t);
1246      return this;
1247    }
1248
1249    /**
1250     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
1251     */
1252    public boolean hasHeader(String value) { 
1253      if (this.header == null)
1254        return false;
1255      for (StringType v : this.header)
1256        if (v.getValue().equals(value)) // string
1257          return true;
1258      return false;
1259    }
1260
1261    /**
1262     * @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
1263     */
1264    public UnsignedIntType getHeartbeatPeriodElement() { 
1265      if (this.heartbeatPeriod == null)
1266        if (Configuration.errorOnAutoCreate())
1267          throw new Error("Attempt to auto-create Subscription.heartbeatPeriod");
1268        else if (Configuration.doAutoCreate())
1269          this.heartbeatPeriod = new UnsignedIntType(); // bb
1270      return this.heartbeatPeriod;
1271    }
1272
1273    public boolean hasHeartbeatPeriodElement() { 
1274      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1275    }
1276
1277    public boolean hasHeartbeatPeriod() { 
1278      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1279    }
1280
1281    /**
1282     * @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
1283     */
1284    public Subscription setHeartbeatPeriodElement(UnsignedIntType value) { 
1285      this.heartbeatPeriod = value;
1286      return this;
1287    }
1288
1289    /**
1290     * @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.
1291     */
1292    public int getHeartbeatPeriod() { 
1293      return this.heartbeatPeriod == null || this.heartbeatPeriod.isEmpty() ? 0 : this.heartbeatPeriod.getValue();
1294    }
1295
1296    /**
1297     * @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.
1298     */
1299    public Subscription setHeartbeatPeriod(int value) { 
1300        if (this.heartbeatPeriod == null)
1301          this.heartbeatPeriod = new UnsignedIntType();
1302        this.heartbeatPeriod.setValue(value);
1303      return this;
1304    }
1305
1306    /**
1307     * @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
1308     */
1309    public UnsignedIntType getTimeoutElement() { 
1310      if (this.timeout == null)
1311        if (Configuration.errorOnAutoCreate())
1312          throw new Error("Attempt to auto-create Subscription.timeout");
1313        else if (Configuration.doAutoCreate())
1314          this.timeout = new UnsignedIntType(); // bb
1315      return this.timeout;
1316    }
1317
1318    public boolean hasTimeoutElement() { 
1319      return this.timeout != null && !this.timeout.isEmpty();
1320    }
1321
1322    public boolean hasTimeout() { 
1323      return this.timeout != null && !this.timeout.isEmpty();
1324    }
1325
1326    /**
1327     * @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
1328     */
1329    public Subscription setTimeoutElement(UnsignedIntType value) { 
1330      this.timeout = value;
1331      return this;
1332    }
1333
1334    /**
1335     * @return If present, the maximum amount of time a server will allow before failing a notification attempt.
1336     */
1337    public int getTimeout() { 
1338      return this.timeout == null || this.timeout.isEmpty() ? 0 : this.timeout.getValue();
1339    }
1340
1341    /**
1342     * @param value If present, the maximum amount of time a server will allow before failing a notification attempt.
1343     */
1344    public Subscription setTimeout(int value) { 
1345        if (this.timeout == null)
1346          this.timeout = new UnsignedIntType();
1347        this.timeout.setValue(value);
1348      return this;
1349    }
1350
1351    /**
1352     * @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
1353     */
1354    public CodeType getContentTypeElement() { 
1355      if (this.contentType == null)
1356        if (Configuration.errorOnAutoCreate())
1357          throw new Error("Attempt to auto-create Subscription.contentType");
1358        else if (Configuration.doAutoCreate())
1359          this.contentType = new CodeType(); // bb
1360      return this.contentType;
1361    }
1362
1363    public boolean hasContentTypeElement() { 
1364      return this.contentType != null && !this.contentType.isEmpty();
1365    }
1366
1367    public boolean hasContentType() { 
1368      return this.contentType != null && !this.contentType.isEmpty();
1369    }
1370
1371    /**
1372     * @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
1373     */
1374    public Subscription setContentTypeElement(CodeType value) { 
1375      this.contentType = value;
1376      return this;
1377    }
1378
1379    /**
1380     * @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.
1381     */
1382    public String getContentType() { 
1383      return this.contentType == null ? null : this.contentType.getValue();
1384    }
1385
1386    /**
1387     * @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.
1388     */
1389    public Subscription setContentType(String value) { 
1390      if (Utilities.noString(value))
1391        this.contentType = null;
1392      else {
1393        if (this.contentType == null)
1394          this.contentType = new CodeType();
1395        this.contentType.setValue(value);
1396      }
1397      return this;
1398    }
1399
1400    /**
1401     * @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
1402     */
1403    public Enumeration<SubscriptionPayloadContent> getContentElement() { 
1404      if (this.content == null)
1405        if (Configuration.errorOnAutoCreate())
1406          throw new Error("Attempt to auto-create Subscription.content");
1407        else if (Configuration.doAutoCreate())
1408          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory()); // bb
1409      return this.content;
1410    }
1411
1412    public boolean hasContentElement() { 
1413      return this.content != null && !this.content.isEmpty();
1414    }
1415
1416    public boolean hasContent() { 
1417      return this.content != null && !this.content.isEmpty();
1418    }
1419
1420    /**
1421     * @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
1422     */
1423    public Subscription setContentElement(Enumeration<SubscriptionPayloadContent> value) { 
1424      this.content = value;
1425      return this;
1426    }
1427
1428    /**
1429     * @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.
1430     */
1431    public SubscriptionPayloadContent getContent() { 
1432      return this.content == null ? null : this.content.getValue();
1433    }
1434
1435    /**
1436     * @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.
1437     */
1438    public Subscription setContent(SubscriptionPayloadContent value) { 
1439      if (value == null)
1440        this.content = null;
1441      else {
1442        if (this.content == null)
1443          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory());
1444        this.content.setValue(value);
1445      }
1446      return this;
1447    }
1448
1449    /**
1450     * @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
1451     */
1452    public PositiveIntType getMaxCountElement() { 
1453      if (this.maxCount == null)
1454        if (Configuration.errorOnAutoCreate())
1455          throw new Error("Attempt to auto-create Subscription.maxCount");
1456        else if (Configuration.doAutoCreate())
1457          this.maxCount = new PositiveIntType(); // bb
1458      return this.maxCount;
1459    }
1460
1461    public boolean hasMaxCountElement() { 
1462      return this.maxCount != null && !this.maxCount.isEmpty();
1463    }
1464
1465    public boolean hasMaxCount() { 
1466      return this.maxCount != null && !this.maxCount.isEmpty();
1467    }
1468
1469    /**
1470     * @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
1471     */
1472    public Subscription setMaxCountElement(PositiveIntType value) { 
1473      this.maxCount = value;
1474      return this;
1475    }
1476
1477    /**
1478     * @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.
1479     */
1480    public int getMaxCount() { 
1481      return this.maxCount == null || this.maxCount.isEmpty() ? 0 : this.maxCount.getValue();
1482    }
1483
1484    /**
1485     * @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.
1486     */
1487    public Subscription setMaxCount(int value) { 
1488        if (this.maxCount == null)
1489          this.maxCount = new PositiveIntType();
1490        this.maxCount.setValue(value);
1491      return this;
1492    }
1493
1494      protected void listChildren(List<Property> children) {
1495        super.listChildren(children);
1496        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));
1497        children.add(new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name));
1498        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
1499        children.add(new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic));
1500        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));
1501        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
1502        children.add(new Property("managingEntity", "Reference(CareTeam|HealthcareService|Organization|RelatedPerson|Patient|Practitioner|PractitionerRole)", "Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.", 0, 1, managingEntity));
1503        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
1504        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));
1505        children.add(new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType));
1506        children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint));
1507        children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
1508        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));
1509        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));
1510        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));
1511        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));
1512        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));
1513      }
1514
1515      @Override
1516      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1517        switch (_hash) {
1518        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);
1519        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name);
1520        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);
1521        case 110546223: /*topic*/  return new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic);
1522        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);
1523        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
1524        case -988474523: /*managingEntity*/  return new Property("managingEntity", "Reference(CareTeam|HealthcareService|Organization|RelatedPerson|Patient|Practitioner|PractitionerRole)", "Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.", 0, 1, managingEntity);
1525        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
1526        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);
1527        case 274155229: /*channelType*/  return new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType);
1528        case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint);
1529        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);
1530        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);
1531        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);
1532        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);
1533        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);
1534        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);
1535        default: return super.getNamedProperty(_hash, _name, _checkValid);
1536        }
1537
1538      }
1539
1540      @Override
1541      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1542        switch (hash) {
1543        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1544        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1545        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatusCodes>
1546        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // CanonicalType
1547        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1548        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1549        case -988474523: /*managingEntity*/ return this.managingEntity == null ? new Base[0] : new Base[] {this.managingEntity}; // Reference
1550        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
1551        case -721168913: /*filterBy*/ return this.filterBy == null ? new Base[0] : this.filterBy.toArray(new Base[this.filterBy.size()]); // SubscriptionFilterByComponent
1552        case 274155229: /*channelType*/ return this.channelType == null ? new Base[0] : new Base[] {this.channelType}; // Coding
1553        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
1554        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
1555        case -938465827: /*heartbeatPeriod*/ return this.heartbeatPeriod == null ? new Base[0] : new Base[] {this.heartbeatPeriod}; // UnsignedIntType
1556        case -1313911455: /*timeout*/ return this.timeout == null ? new Base[0] : new Base[] {this.timeout}; // UnsignedIntType
1557        case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
1558        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Enumeration<SubscriptionPayloadContent>
1559        case 382106123: /*maxCount*/ return this.maxCount == null ? new Base[0] : new Base[] {this.maxCount}; // PositiveIntType
1560        default: return super.getProperty(hash, name, checkValid);
1561        }
1562
1563      }
1564
1565      @Override
1566      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1567        switch (hash) {
1568        case -1618432855: // identifier
1569          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1570          return value;
1571        case 3373707: // name
1572          this.name = TypeConvertor.castToString(value); // StringType
1573          return value;
1574        case -892481550: // status
1575          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1576          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
1577          return value;
1578        case 110546223: // topic
1579          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
1580          return value;
1581        case 951526432: // contact
1582          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1583          return value;
1584        case 100571: // end
1585          this.end = TypeConvertor.castToInstant(value); // InstantType
1586          return value;
1587        case -988474523: // managingEntity
1588          this.managingEntity = TypeConvertor.castToReference(value); // Reference
1589          return value;
1590        case -934964668: // reason
1591          this.reason = TypeConvertor.castToString(value); // StringType
1592          return value;
1593        case -721168913: // filterBy
1594          this.getFilterBy().add((SubscriptionFilterByComponent) value); // SubscriptionFilterByComponent
1595          return value;
1596        case 274155229: // channelType
1597          this.channelType = TypeConvertor.castToCoding(value); // Coding
1598          return value;
1599        case 1741102485: // endpoint
1600          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1601          return value;
1602        case -1221270899: // header
1603          this.getHeader().add(TypeConvertor.castToString(value)); // StringType
1604          return value;
1605        case -938465827: // heartbeatPeriod
1606          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1607          return value;
1608        case -1313911455: // timeout
1609          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1610          return value;
1611        case -389131437: // contentType
1612          this.contentType = TypeConvertor.castToCode(value); // CodeType
1613          return value;
1614        case 951530617: // content
1615          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1616          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1617          return value;
1618        case 382106123: // maxCount
1619          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1620          return value;
1621        default: return super.setProperty(hash, name, value);
1622        }
1623
1624      }
1625
1626      @Override
1627      public Base setProperty(String name, Base value) throws FHIRException {
1628        if (name.equals("identifier")) {
1629          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1630        } else if (name.equals("name")) {
1631          this.name = TypeConvertor.castToString(value); // StringType
1632        } else if (name.equals("status")) {
1633          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1634          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
1635        } else if (name.equals("topic")) {
1636          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
1637        } else if (name.equals("contact")) {
1638          this.getContact().add(TypeConvertor.castToContactPoint(value));
1639        } else if (name.equals("end")) {
1640          this.end = TypeConvertor.castToInstant(value); // InstantType
1641        } else if (name.equals("managingEntity")) {
1642          this.managingEntity = TypeConvertor.castToReference(value); // Reference
1643        } else if (name.equals("reason")) {
1644          this.reason = TypeConvertor.castToString(value); // StringType
1645        } else if (name.equals("filterBy")) {
1646          this.getFilterBy().add((SubscriptionFilterByComponent) value);
1647        } else if (name.equals("channelType")) {
1648          this.channelType = TypeConvertor.castToCoding(value); // Coding
1649        } else if (name.equals("endpoint")) {
1650          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1651        } else if (name.equals("header")) {
1652          this.getHeader().add(TypeConvertor.castToString(value));
1653        } else if (name.equals("heartbeatPeriod")) {
1654          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1655        } else if (name.equals("timeout")) {
1656          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1657        } else if (name.equals("contentType")) {
1658          this.contentType = TypeConvertor.castToCode(value); // CodeType
1659        } else if (name.equals("content")) {
1660          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1661          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1662        } else if (name.equals("maxCount")) {
1663          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1664        } else
1665          return super.setProperty(name, value);
1666        return value;
1667      }
1668
1669      @Override
1670      public Base makeProperty(int hash, String name) throws FHIRException {
1671        switch (hash) {
1672        case -1618432855:  return addIdentifier(); 
1673        case 3373707:  return getNameElement();
1674        case -892481550:  return getStatusElement();
1675        case 110546223:  return getTopicElement();
1676        case 951526432:  return addContact(); 
1677        case 100571:  return getEndElement();
1678        case -988474523:  return getManagingEntity();
1679        case -934964668:  return getReasonElement();
1680        case -721168913:  return addFilterBy(); 
1681        case 274155229:  return getChannelType();
1682        case 1741102485:  return getEndpointElement();
1683        case -1221270899:  return addHeaderElement();
1684        case -938465827:  return getHeartbeatPeriodElement();
1685        case -1313911455:  return getTimeoutElement();
1686        case -389131437:  return getContentTypeElement();
1687        case 951530617:  return getContentElement();
1688        case 382106123:  return getMaxCountElement();
1689        default: return super.makeProperty(hash, name);
1690        }
1691
1692      }
1693
1694      @Override
1695      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1696        switch (hash) {
1697        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1698        case 3373707: /*name*/ return new String[] {"string"};
1699        case -892481550: /*status*/ return new String[] {"code"};
1700        case 110546223: /*topic*/ return new String[] {"canonical"};
1701        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
1702        case 100571: /*end*/ return new String[] {"instant"};
1703        case -988474523: /*managingEntity*/ return new String[] {"Reference"};
1704        case -934964668: /*reason*/ return new String[] {"string"};
1705        case -721168913: /*filterBy*/ return new String[] {};
1706        case 274155229: /*channelType*/ return new String[] {"Coding"};
1707        case 1741102485: /*endpoint*/ return new String[] {"url"};
1708        case -1221270899: /*header*/ return new String[] {"string"};
1709        case -938465827: /*heartbeatPeriod*/ return new String[] {"unsignedInt"};
1710        case -1313911455: /*timeout*/ return new String[] {"unsignedInt"};
1711        case -389131437: /*contentType*/ return new String[] {"code"};
1712        case 951530617: /*content*/ return new String[] {"code"};
1713        case 382106123: /*maxCount*/ return new String[] {"positiveInt"};
1714        default: return super.getTypesForProperty(hash, name);
1715        }
1716
1717      }
1718
1719      @Override
1720      public Base addChild(String name) throws FHIRException {
1721        if (name.equals("identifier")) {
1722          return addIdentifier();
1723        }
1724        else if (name.equals("name")) {
1725          throw new FHIRException("Cannot call addChild on a primitive type Subscription.name");
1726        }
1727        else if (name.equals("status")) {
1728          throw new FHIRException("Cannot call addChild on a primitive type Subscription.status");
1729        }
1730        else if (name.equals("topic")) {
1731          throw new FHIRException("Cannot call addChild on a primitive type Subscription.topic");
1732        }
1733        else if (name.equals("contact")) {
1734          return addContact();
1735        }
1736        else if (name.equals("end")) {
1737          throw new FHIRException("Cannot call addChild on a primitive type Subscription.end");
1738        }
1739        else if (name.equals("managingEntity")) {
1740          this.managingEntity = new Reference();
1741          return this.managingEntity;
1742        }
1743        else if (name.equals("reason")) {
1744          throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason");
1745        }
1746        else if (name.equals("filterBy")) {
1747          return addFilterBy();
1748        }
1749        else if (name.equals("channelType")) {
1750          this.channelType = new Coding();
1751          return this.channelType;
1752        }
1753        else if (name.equals("endpoint")) {
1754          throw new FHIRException("Cannot call addChild on a primitive type Subscription.endpoint");
1755        }
1756        else if (name.equals("header")) {
1757          throw new FHIRException("Cannot call addChild on a primitive type Subscription.header");
1758        }
1759        else if (name.equals("heartbeatPeriod")) {
1760          throw new FHIRException("Cannot call addChild on a primitive type Subscription.heartbeatPeriod");
1761        }
1762        else if (name.equals("timeout")) {
1763          throw new FHIRException("Cannot call addChild on a primitive type Subscription.timeout");
1764        }
1765        else if (name.equals("contentType")) {
1766          throw new FHIRException("Cannot call addChild on a primitive type Subscription.contentType");
1767        }
1768        else if (name.equals("content")) {
1769          throw new FHIRException("Cannot call addChild on a primitive type Subscription.content");
1770        }
1771        else if (name.equals("maxCount")) {
1772          throw new FHIRException("Cannot call addChild on a primitive type Subscription.maxCount");
1773        }
1774        else
1775          return super.addChild(name);
1776      }
1777
1778  public String fhirType() {
1779    return "Subscription";
1780
1781  }
1782
1783      public Subscription copy() {
1784        Subscription dst = new Subscription();
1785        copyValues(dst);
1786        return dst;
1787      }
1788
1789      public void copyValues(Subscription dst) {
1790        super.copyValues(dst);
1791        if (identifier != null) {
1792          dst.identifier = new ArrayList<Identifier>();
1793          for (Identifier i : identifier)
1794            dst.identifier.add(i.copy());
1795        };
1796        dst.name = name == null ? null : name.copy();
1797        dst.status = status == null ? null : status.copy();
1798        dst.topic = topic == null ? null : topic.copy();
1799        if (contact != null) {
1800          dst.contact = new ArrayList<ContactPoint>();
1801          for (ContactPoint i : contact)
1802            dst.contact.add(i.copy());
1803        };
1804        dst.end = end == null ? null : end.copy();
1805        dst.managingEntity = managingEntity == null ? null : managingEntity.copy();
1806        dst.reason = reason == null ? null : reason.copy();
1807        if (filterBy != null) {
1808          dst.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1809          for (SubscriptionFilterByComponent i : filterBy)
1810            dst.filterBy.add(i.copy());
1811        };
1812        dst.channelType = channelType == null ? null : channelType.copy();
1813        dst.endpoint = endpoint == null ? null : endpoint.copy();
1814        if (header != null) {
1815          dst.header = new ArrayList<StringType>();
1816          for (StringType i : header)
1817            dst.header.add(i.copy());
1818        };
1819        dst.heartbeatPeriod = heartbeatPeriod == null ? null : heartbeatPeriod.copy();
1820        dst.timeout = timeout == null ? null : timeout.copy();
1821        dst.contentType = contentType == null ? null : contentType.copy();
1822        dst.content = content == null ? null : content.copy();
1823        dst.maxCount = maxCount == null ? null : maxCount.copy();
1824      }
1825
1826      protected Subscription typedCopy() {
1827        return copy();
1828      }
1829
1830      @Override
1831      public boolean equalsDeep(Base other_) {
1832        if (!super.equalsDeep(other_))
1833          return false;
1834        if (!(other_ instanceof Subscription))
1835          return false;
1836        Subscription o = (Subscription) other_;
1837        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(status, o.status, true)
1838           && compareDeep(topic, o.topic, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
1839           && compareDeep(managingEntity, o.managingEntity, true) && compareDeep(reason, o.reason, true) && compareDeep(filterBy, o.filterBy, true)
1840           && compareDeep(channelType, o.channelType, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(header, o.header, true)
1841           && compareDeep(heartbeatPeriod, o.heartbeatPeriod, true) && compareDeep(timeout, o.timeout, true)
1842           && compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true) && compareDeep(maxCount, o.maxCount, true)
1843          ;
1844      }
1845
1846      @Override
1847      public boolean equalsShallow(Base other_) {
1848        if (!super.equalsShallow(other_))
1849          return false;
1850        if (!(other_ instanceof Subscription))
1851          return false;
1852        Subscription o = (Subscription) other_;
1853        return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(topic, o.topic, true)
1854           && compareValues(end, o.end, true) && compareValues(reason, o.reason, true) && compareValues(endpoint, o.endpoint, true)
1855           && compareValues(header, o.header, true) && compareValues(heartbeatPeriod, o.heartbeatPeriod, true)
1856           && compareValues(timeout, o.timeout, true) && compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true)
1857           && compareValues(maxCount, o.maxCount, true);
1858      }
1859
1860      public boolean isEmpty() {
1861        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, status
1862          , topic, contact, end, managingEntity, reason, filterBy, channelType, endpoint
1863          , header, heartbeatPeriod, timeout, contentType, content, maxCount);
1864      }
1865
1866  @Override
1867  public ResourceType getResourceType() {
1868    return ResourceType.Subscription;
1869   }
1870
1871 /**
1872   * Search parameter: <b>contact</b>
1873   * <p>
1874   * Description: <b>Contact details for the subscription</b><br>
1875   * Type: <b>token</b><br>
1876   * Path: <b>Subscription.contact</b><br>
1877   * </p>
1878   */
1879  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
1880  public static final String SP_CONTACT = "contact";
1881 /**
1882   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
1883   * <p>
1884   * Description: <b>Contact details for the subscription</b><br>
1885   * Type: <b>token</b><br>
1886   * Path: <b>Subscription.contact</b><br>
1887   * </p>
1888   */
1889  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
1890
1891 /**
1892   * Search parameter: <b>identifier</b>
1893   * <p>
1894   * Description: <b>A subscription identifier</b><br>
1895   * Type: <b>token</b><br>
1896   * Path: <b>Subscription.identifier</b><br>
1897   * </p>
1898   */
1899  @SearchParamDefinition(name="identifier", path="Subscription.identifier", description="A subscription identifier", type="token" )
1900  public static final String SP_IDENTIFIER = "identifier";
1901 /**
1902   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1903   * <p>
1904   * Description: <b>A subscription identifier</b><br>
1905   * Type: <b>token</b><br>
1906   * Path: <b>Subscription.identifier</b><br>
1907   * </p>
1908   */
1909  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1910
1911 /**
1912   * Search parameter: <b>payload</b>
1913   * <p>
1914   * Description: <b>The mime-type of the notification payload</b><br>
1915   * Type: <b>token</b><br>
1916   * Path: <b>null</b><br>
1917   * </p>
1918   */
1919  @SearchParamDefinition(name="payload", path="", description="The mime-type of the notification payload", type="token" )
1920  public static final String SP_PAYLOAD = "payload";
1921 /**
1922   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
1923   * <p>
1924   * Description: <b>The mime-type of the notification payload</b><br>
1925   * Type: <b>token</b><br>
1926   * Path: <b>null</b><br>
1927   * </p>
1928   */
1929  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
1930
1931 /**
1932   * Search parameter: <b>status</b>
1933   * <p>
1934   * Description: <b>The current state of the subscription</b><br>
1935   * Type: <b>token</b><br>
1936   * Path: <b>Subscription.status</b><br>
1937   * </p>
1938   */
1939  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
1940  public static final String SP_STATUS = "status";
1941 /**
1942   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1943   * <p>
1944   * Description: <b>The current state of the subscription</b><br>
1945   * Type: <b>token</b><br>
1946   * Path: <b>Subscription.status</b><br>
1947   * </p>
1948   */
1949  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1950
1951 /**
1952   * Search parameter: <b>type</b>
1953   * <p>
1954   * Description: <b>The type of channel for the sent notifications</b><br>
1955   * Type: <b>token</b><br>
1956   * Path: <b>null</b><br>
1957   * </p>
1958   */
1959  @SearchParamDefinition(name="type", path="", description="The type of channel for the sent notifications", type="token" )
1960  public static final String SP_TYPE = "type";
1961 /**
1962   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1963   * <p>
1964   * Description: <b>The type of channel for the sent notifications</b><br>
1965   * Type: <b>token</b><br>
1966   * Path: <b>null</b><br>
1967   * </p>
1968   */
1969  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1970
1971 /**
1972   * Search parameter: <b>url</b>
1973   * <p>
1974   * Description: <b>The uri that will receive the notifications</b><br>
1975   * Type: <b>uri</b><br>
1976   * Path: <b>null</b><br>
1977   * </p>
1978   */
1979  @SearchParamDefinition(name="url", path="", description="The uri that will receive the notifications", type="uri" )
1980  public static final String SP_URL = "url";
1981 /**
1982   * <b>Fluent Client</b> search parameter constant for <b>url</b>
1983   * <p>
1984   * Description: <b>The uri that will receive the notifications</b><br>
1985   * Type: <b>uri</b><br>
1986   * Path: <b>null</b><br>
1987   * </p>
1988   */
1989  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
1990
1991
1992}