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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
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         * A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.
172         */
173        @Child(name = "resourceType", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=true)
174        @Description(shortDefinition="Allowed Resource (reference to definition) for this Subscription filter", formalDefinition="A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type." )
175        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-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         * Comparator applied to this filter parameter.
187         */
188        @Child(name = "comparator", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
189        @Description(shortDefinition="eq | ne | gt | lt | ge | le | sa | eb | ap", formalDefinition="Comparator applied to this filter parameter." )
190        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/search-comparator")
191        protected Enumeration<SearchComparator> comparator;
192
193        /**
194         * Modifier applied to this filter parameter.
195         */
196        @Child(name = "modifier", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
197        @Description(shortDefinition="missing | exact | contains | not | text | in | not-in | below | above | type | identifier | of-type | code-text | text-advanced | iterate", formalDefinition="Modifier applied to this filter parameter." )
198        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/search-modifier-code")
199        protected Enumeration<SearchModifierCode> modifier;
200
201        /**
202         * The literal value or resource path as is legal in search - for example, `Patient/123` or `le1950`.
203         */
204        @Child(name = "value", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
205        @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`." )
206        protected StringType value;
207
208        private static final long serialVersionUID = 765605139L;
209
210    /**
211     * Constructor
212     */
213      public SubscriptionFilterByComponent() {
214        super();
215      }
216
217    /**
218     * Constructor
219     */
220      public SubscriptionFilterByComponent(String filterParameter, String value) {
221        super();
222        this.setFilterParameter(filterParameter);
223        this.setValue(value);
224      }
225
226        /**
227         * @return {@link #resourceType} (A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.). This is the underlying object with id, value and extensions. The accessor "getResourceType" gives direct access to the value
228         */
229        public UriType getResourceTypeElement() { 
230          if (this.resourceType == null)
231            if (Configuration.errorOnAutoCreate())
232              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.resourceType");
233            else if (Configuration.doAutoCreate())
234              this.resourceType = new UriType(); // bb
235          return this.resourceType;
236        }
237
238        public boolean hasResourceTypeElement() { 
239          return this.resourceType != null && !this.resourceType.isEmpty();
240        }
241
242        public boolean hasResourceType() { 
243          return this.resourceType != null && !this.resourceType.isEmpty();
244        }
245
246        /**
247         * @param value {@link #resourceType} (A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.). This is the underlying object with id, value and extensions. The accessor "getResourceType" gives direct access to the value
248         */
249        public SubscriptionFilterByComponent setResourceTypeElement(UriType value) { 
250          this.resourceType = value;
251          return this;
252        }
253
254        /**
255         * @return A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.
256         */
257        public String getResourceType() { 
258          return this.resourceType == null ? null : this.resourceType.getValue();
259        }
260
261        /**
262         * @param value A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.
263         */
264        public SubscriptionFilterByComponent setResourceType(String value) { 
265          if (Utilities.noString(value))
266            this.resourceType = null;
267          else {
268            if (this.resourceType == null)
269              this.resourceType = new UriType();
270            this.resourceType.setValue(value);
271          }
272          return this;
273        }
274
275        /**
276         * @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
277         */
278        public StringType getFilterParameterElement() { 
279          if (this.filterParameter == null)
280            if (Configuration.errorOnAutoCreate())
281              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.filterParameter");
282            else if (Configuration.doAutoCreate())
283              this.filterParameter = new StringType(); // bb
284          return this.filterParameter;
285        }
286
287        public boolean hasFilterParameterElement() { 
288          return this.filterParameter != null && !this.filterParameter.isEmpty();
289        }
290
291        public boolean hasFilterParameter() { 
292          return this.filterParameter != null && !this.filterParameter.isEmpty();
293        }
294
295        /**
296         * @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
297         */
298        public SubscriptionFilterByComponent setFilterParameterElement(StringType value) { 
299          this.filterParameter = value;
300          return this;
301        }
302
303        /**
304         * @return The filter as defined in the `SubscriptionTopic.canFilterBy.filterParameter` element.
305         */
306        public String getFilterParameter() { 
307          return this.filterParameter == null ? null : this.filterParameter.getValue();
308        }
309
310        /**
311         * @param value The filter as defined in the `SubscriptionTopic.canFilterBy.filterParameter` element.
312         */
313        public SubscriptionFilterByComponent setFilterParameter(String value) { 
314            if (this.filterParameter == null)
315              this.filterParameter = new StringType();
316            this.filterParameter.setValue(value);
317          return this;
318        }
319
320        /**
321         * @return {@link #comparator} (Comparator applied to this filter parameter.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
322         */
323        public Enumeration<SearchComparator> getComparatorElement() { 
324          if (this.comparator == null)
325            if (Configuration.errorOnAutoCreate())
326              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.comparator");
327            else if (Configuration.doAutoCreate())
328              this.comparator = new Enumeration<SearchComparator>(new SearchComparatorEnumFactory()); // bb
329          return this.comparator;
330        }
331
332        public boolean hasComparatorElement() { 
333          return this.comparator != null && !this.comparator.isEmpty();
334        }
335
336        public boolean hasComparator() { 
337          return this.comparator != null && !this.comparator.isEmpty();
338        }
339
340        /**
341         * @param value {@link #comparator} (Comparator applied to this filter parameter.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
342         */
343        public SubscriptionFilterByComponent setComparatorElement(Enumeration<SearchComparator> value) { 
344          this.comparator = value;
345          return this;
346        }
347
348        /**
349         * @return Comparator applied to this filter parameter.
350         */
351        public SearchComparator getComparator() { 
352          return this.comparator == null ? null : this.comparator.getValue();
353        }
354
355        /**
356         * @param value Comparator applied to this filter parameter.
357         */
358        public SubscriptionFilterByComponent setComparator(SearchComparator value) { 
359          if (value == null)
360            this.comparator = null;
361          else {
362            if (this.comparator == null)
363              this.comparator = new Enumeration<SearchComparator>(new SearchComparatorEnumFactory());
364            this.comparator.setValue(value);
365          }
366          return this;
367        }
368
369        /**
370         * @return {@link #modifier} (Modifier applied to this filter parameter.). This is the underlying object with id, value and extensions. The accessor "getModifier" gives direct access to the value
371         */
372        public Enumeration<SearchModifierCode> getModifierElement() { 
373          if (this.modifier == null)
374            if (Configuration.errorOnAutoCreate())
375              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.modifier");
376            else if (Configuration.doAutoCreate())
377              this.modifier = new Enumeration<SearchModifierCode>(new SearchModifierCodeEnumFactory()); // bb
378          return this.modifier;
379        }
380
381        public boolean hasModifierElement() { 
382          return this.modifier != null && !this.modifier.isEmpty();
383        }
384
385        public boolean hasModifier() { 
386          return this.modifier != null && !this.modifier.isEmpty();
387        }
388
389        /**
390         * @param value {@link #modifier} (Modifier applied to this filter parameter.). This is the underlying object with id, value and extensions. The accessor "getModifier" gives direct access to the value
391         */
392        public SubscriptionFilterByComponent setModifierElement(Enumeration<SearchModifierCode> value) { 
393          this.modifier = value;
394          return this;
395        }
396
397        /**
398         * @return Modifier applied to this filter parameter.
399         */
400        public SearchModifierCode getModifier() { 
401          return this.modifier == null ? null : this.modifier.getValue();
402        }
403
404        /**
405         * @param value Modifier applied to this filter parameter.
406         */
407        public SubscriptionFilterByComponent setModifier(SearchModifierCode value) { 
408          if (value == null)
409            this.modifier = null;
410          else {
411            if (this.modifier == null)
412              this.modifier = new Enumeration<SearchModifierCode>(new SearchModifierCodeEnumFactory());
413            this.modifier.setValue(value);
414          }
415          return this;
416        }
417
418        /**
419         * @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
420         */
421        public StringType getValueElement() { 
422          if (this.value == null)
423            if (Configuration.errorOnAutoCreate())
424              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.value");
425            else if (Configuration.doAutoCreate())
426              this.value = new StringType(); // bb
427          return this.value;
428        }
429
430        public boolean hasValueElement() { 
431          return this.value != null && !this.value.isEmpty();
432        }
433
434        public boolean hasValue() { 
435          return this.value != null && !this.value.isEmpty();
436        }
437
438        /**
439         * @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
440         */
441        public SubscriptionFilterByComponent setValueElement(StringType value) { 
442          this.value = value;
443          return this;
444        }
445
446        /**
447         * @return The literal value or resource path as is legal in search - for example, `Patient/123` or `le1950`.
448         */
449        public String getValue() { 
450          return this.value == null ? null : this.value.getValue();
451        }
452
453        /**
454         * @param value The literal value or resource path as is legal in search - for example, `Patient/123` or `le1950`.
455         */
456        public SubscriptionFilterByComponent setValue(String value) { 
457            if (this.value == null)
458              this.value = new StringType();
459            this.value.setValue(value);
460          return this;
461        }
462
463        protected void listChildren(List<Property> children) {
464          super.listChildren(children);
465          children.add(new Property("resourceType", "uri", "A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.", 0, 1, resourceType));
466          children.add(new Property("filterParameter", "string", "The filter as defined in the `SubscriptionTopic.canFilterBy.filterParameter` element.", 0, 1, filterParameter));
467          children.add(new Property("comparator", "code", "Comparator applied to this filter parameter.", 0, 1, comparator));
468          children.add(new Property("modifier", "code", "Modifier applied to this filter parameter.", 0, 1, modifier));
469          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));
470        }
471
472        @Override
473        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
474          switch (_hash) {
475          case -384364440: /*resourceType*/  return new Property("resourceType", "uri", "A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.", 0, 1, resourceType);
476          case 618257: /*filterParameter*/  return new Property("filterParameter", "string", "The filter as defined in the `SubscriptionTopic.canFilterBy.filterParameter` element.", 0, 1, filterParameter);
477          case -844673834: /*comparator*/  return new Property("comparator", "code", "Comparator applied to this filter parameter.", 0, 1, comparator);
478          case -615513385: /*modifier*/  return new Property("modifier", "code", "Modifier applied to this filter parameter.", 0, 1, modifier);
479          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);
480          default: return super.getNamedProperty(_hash, _name, _checkValid);
481          }
482
483        }
484
485      @Override
486      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
487        switch (hash) {
488        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : new Base[] {this.resourceType}; // UriType
489        case 618257: /*filterParameter*/ return this.filterParameter == null ? new Base[0] : new Base[] {this.filterParameter}; // StringType
490        case -844673834: /*comparator*/ return this.comparator == null ? new Base[0] : new Base[] {this.comparator}; // Enumeration<SearchComparator>
491        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // Enumeration<SearchModifierCode>
492        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
493        default: return super.getProperty(hash, name, checkValid);
494        }
495
496      }
497
498      @Override
499      public Base setProperty(int hash, String name, Base value) throws FHIRException {
500        switch (hash) {
501        case -384364440: // resourceType
502          this.resourceType = TypeConvertor.castToUri(value); // UriType
503          return value;
504        case 618257: // filterParameter
505          this.filterParameter = TypeConvertor.castToString(value); // StringType
506          return value;
507        case -844673834: // comparator
508          value = new SearchComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
509          this.comparator = (Enumeration) value; // Enumeration<SearchComparator>
510          return value;
511        case -615513385: // modifier
512          value = new SearchModifierCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
513          this.modifier = (Enumeration) value; // Enumeration<SearchModifierCode>
514          return value;
515        case 111972721: // value
516          this.value = TypeConvertor.castToString(value); // StringType
517          return value;
518        default: return super.setProperty(hash, name, value);
519        }
520
521      }
522
523      @Override
524      public Base setProperty(String name, Base value) throws FHIRException {
525        if (name.equals("resourceType")) {
526          this.resourceType = TypeConvertor.castToUri(value); // UriType
527        } else if (name.equals("filterParameter")) {
528          this.filterParameter = TypeConvertor.castToString(value); // StringType
529        } else if (name.equals("comparator")) {
530          value = new SearchComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
531          this.comparator = (Enumeration) value; // Enumeration<SearchComparator>
532        } else if (name.equals("modifier")) {
533          value = new SearchModifierCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
534          this.modifier = (Enumeration) value; // Enumeration<SearchModifierCode>
535        } else if (name.equals("value")) {
536          this.value = TypeConvertor.castToString(value); // StringType
537        } else
538          return super.setProperty(name, value);
539        return value;
540      }
541
542  @Override
543  public void removeChild(String name, Base value) throws FHIRException {
544        if (name.equals("resourceType")) {
545          this.resourceType = null;
546        } else if (name.equals("filterParameter")) {
547          this.filterParameter = null;
548        } else if (name.equals("comparator")) {
549          value = new SearchComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
550          this.comparator = (Enumeration) value; // Enumeration<SearchComparator>
551        } else if (name.equals("modifier")) {
552          value = new SearchModifierCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
553          this.modifier = (Enumeration) value; // Enumeration<SearchModifierCode>
554        } else if (name.equals("value")) {
555          this.value = null;
556        } else
557          super.removeChild(name, value);
558        
559      }
560
561      @Override
562      public Base makeProperty(int hash, String name) throws FHIRException {
563        switch (hash) {
564        case -384364440:  return getResourceTypeElement();
565        case 618257:  return getFilterParameterElement();
566        case -844673834:  return getComparatorElement();
567        case -615513385:  return getModifierElement();
568        case 111972721:  return getValueElement();
569        default: return super.makeProperty(hash, name);
570        }
571
572      }
573
574      @Override
575      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
576        switch (hash) {
577        case -384364440: /*resourceType*/ return new String[] {"uri"};
578        case 618257: /*filterParameter*/ return new String[] {"string"};
579        case -844673834: /*comparator*/ return new String[] {"code"};
580        case -615513385: /*modifier*/ return new String[] {"code"};
581        case 111972721: /*value*/ return new String[] {"string"};
582        default: return super.getTypesForProperty(hash, name);
583        }
584
585      }
586
587      @Override
588      public Base addChild(String name) throws FHIRException {
589        if (name.equals("resourceType")) {
590          throw new FHIRException("Cannot call addChild on a singleton property Subscription.filterBy.resourceType");
591        }
592        else if (name.equals("filterParameter")) {
593          throw new FHIRException("Cannot call addChild on a singleton property Subscription.filterBy.filterParameter");
594        }
595        else if (name.equals("comparator")) {
596          throw new FHIRException("Cannot call addChild on a singleton property Subscription.filterBy.comparator");
597        }
598        else if (name.equals("modifier")) {
599          throw new FHIRException("Cannot call addChild on a singleton property Subscription.filterBy.modifier");
600        }
601        else if (name.equals("value")) {
602          throw new FHIRException("Cannot call addChild on a singleton property Subscription.filterBy.value");
603        }
604        else
605          return super.addChild(name);
606      }
607
608      public SubscriptionFilterByComponent copy() {
609        SubscriptionFilterByComponent dst = new SubscriptionFilterByComponent();
610        copyValues(dst);
611        return dst;
612      }
613
614      public void copyValues(SubscriptionFilterByComponent dst) {
615        super.copyValues(dst);
616        dst.resourceType = resourceType == null ? null : resourceType.copy();
617        dst.filterParameter = filterParameter == null ? null : filterParameter.copy();
618        dst.comparator = comparator == null ? null : comparator.copy();
619        dst.modifier = modifier == null ? null : modifier.copy();
620        dst.value = value == null ? null : value.copy();
621      }
622
623      @Override
624      public boolean equalsDeep(Base other_) {
625        if (!super.equalsDeep(other_))
626          return false;
627        if (!(other_ instanceof SubscriptionFilterByComponent))
628          return false;
629        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
630        return compareDeep(resourceType, o.resourceType, true) && compareDeep(filterParameter, o.filterParameter, true)
631           && compareDeep(comparator, o.comparator, true) && compareDeep(modifier, o.modifier, true) && compareDeep(value, o.value, true)
632          ;
633      }
634
635      @Override
636      public boolean equalsShallow(Base other_) {
637        if (!super.equalsShallow(other_))
638          return false;
639        if (!(other_ instanceof SubscriptionFilterByComponent))
640          return false;
641        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
642        return compareValues(resourceType, o.resourceType, true) && compareValues(filterParameter, o.filterParameter, true)
643           && compareValues(comparator, o.comparator, true) && compareValues(modifier, o.modifier, true) && compareValues(value, o.value, true)
644          ;
645      }
646
647      public boolean isEmpty() {
648        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(resourceType, filterParameter
649          , comparator, modifier, value);
650      }
651
652  public String fhirType() {
653    return "Subscription.filterBy";
654
655  }
656
657  }
658
659    @Block()
660    public static class SubscriptionParameterComponent extends BackboneElement implements IBaseBackboneElement {
661        /**
662         * Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.
663         */
664        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
665        @Description(shortDefinition="Name (key) of the parameter", formalDefinition="Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization." )
666        protected StringType name;
667
668        /**
669         * Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.
670         */
671        @Child(name = "value", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
672        @Description(shortDefinition="Value of the parameter to use or pass through", formalDefinition="Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`." )
673        protected StringType value;
674
675        private static final long serialVersionUID = 395259392L;
676
677    /**
678     * Constructor
679     */
680      public SubscriptionParameterComponent() {
681        super();
682      }
683
684    /**
685     * Constructor
686     */
687      public SubscriptionParameterComponent(String name, String value) {
688        super();
689        this.setName(name);
690        this.setValue(value);
691      }
692
693        /**
694         * @return {@link #name} (Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
695         */
696        public StringType getNameElement() { 
697          if (this.name == null)
698            if (Configuration.errorOnAutoCreate())
699              throw new Error("Attempt to auto-create SubscriptionParameterComponent.name");
700            else if (Configuration.doAutoCreate())
701              this.name = new StringType(); // bb
702          return this.name;
703        }
704
705        public boolean hasNameElement() { 
706          return this.name != null && !this.name.isEmpty();
707        }
708
709        public boolean hasName() { 
710          return this.name != null && !this.name.isEmpty();
711        }
712
713        /**
714         * @param value {@link #name} (Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
715         */
716        public SubscriptionParameterComponent setNameElement(StringType value) { 
717          this.name = value;
718          return this;
719        }
720
721        /**
722         * @return Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.
723         */
724        public String getName() { 
725          return this.name == null ? null : this.name.getValue();
726        }
727
728        /**
729         * @param value Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.
730         */
731        public SubscriptionParameterComponent setName(String value) { 
732            if (this.name == null)
733              this.name = new StringType();
734            this.name.setValue(value);
735          return this;
736        }
737
738        /**
739         * @return {@link #value} (Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
740         */
741        public StringType getValueElement() { 
742          if (this.value == null)
743            if (Configuration.errorOnAutoCreate())
744              throw new Error("Attempt to auto-create SubscriptionParameterComponent.value");
745            else if (Configuration.doAutoCreate())
746              this.value = new StringType(); // bb
747          return this.value;
748        }
749
750        public boolean hasValueElement() { 
751          return this.value != null && !this.value.isEmpty();
752        }
753
754        public boolean hasValue() { 
755          return this.value != null && !this.value.isEmpty();
756        }
757
758        /**
759         * @param value {@link #value} (Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
760         */
761        public SubscriptionParameterComponent setValueElement(StringType value) { 
762          this.value = value;
763          return this;
764        }
765
766        /**
767         * @return Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.
768         */
769        public String getValue() { 
770          return this.value == null ? null : this.value.getValue();
771        }
772
773        /**
774         * @param value Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.
775         */
776        public SubscriptionParameterComponent setValue(String value) { 
777            if (this.value == null)
778              this.value = new StringType();
779            this.value.setValue(value);
780          return this;
781        }
782
783        protected void listChildren(List<Property> children) {
784          super.listChildren(children);
785          children.add(new Property("name", "string", "Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.", 0, 1, name));
786          children.add(new Property("value", "string", "Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.", 0, 1, value));
787        }
788
789        @Override
790        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
791          switch (_hash) {
792          case 3373707: /*name*/  return new Property("name", "string", "Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.", 0, 1, name);
793          case 111972721: /*value*/  return new Property("value", "string", "Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.", 0, 1, value);
794          default: return super.getNamedProperty(_hash, _name, _checkValid);
795          }
796
797        }
798
799      @Override
800      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
801        switch (hash) {
802        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
803        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
804        default: return super.getProperty(hash, name, checkValid);
805        }
806
807      }
808
809      @Override
810      public Base setProperty(int hash, String name, Base value) throws FHIRException {
811        switch (hash) {
812        case 3373707: // name
813          this.name = TypeConvertor.castToString(value); // StringType
814          return value;
815        case 111972721: // value
816          this.value = TypeConvertor.castToString(value); // StringType
817          return value;
818        default: return super.setProperty(hash, name, value);
819        }
820
821      }
822
823      @Override
824      public Base setProperty(String name, Base value) throws FHIRException {
825        if (name.equals("name")) {
826          this.name = TypeConvertor.castToString(value); // StringType
827        } else if (name.equals("value")) {
828          this.value = TypeConvertor.castToString(value); // StringType
829        } else
830          return super.setProperty(name, value);
831        return value;
832      }
833
834  @Override
835  public void removeChild(String name, Base value) throws FHIRException {
836        if (name.equals("name")) {
837          this.name = null;
838        } else if (name.equals("value")) {
839          this.value = null;
840        } else
841          super.removeChild(name, value);
842        
843      }
844
845      @Override
846      public Base makeProperty(int hash, String name) throws FHIRException {
847        switch (hash) {
848        case 3373707:  return getNameElement();
849        case 111972721:  return getValueElement();
850        default: return super.makeProperty(hash, name);
851        }
852
853      }
854
855      @Override
856      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
857        switch (hash) {
858        case 3373707: /*name*/ return new String[] {"string"};
859        case 111972721: /*value*/ return new String[] {"string"};
860        default: return super.getTypesForProperty(hash, name);
861        }
862
863      }
864
865      @Override
866      public Base addChild(String name) throws FHIRException {
867        if (name.equals("name")) {
868          throw new FHIRException("Cannot call addChild on a singleton property Subscription.parameter.name");
869        }
870        else if (name.equals("value")) {
871          throw new FHIRException("Cannot call addChild on a singleton property Subscription.parameter.value");
872        }
873        else
874          return super.addChild(name);
875      }
876
877      public SubscriptionParameterComponent copy() {
878        SubscriptionParameterComponent dst = new SubscriptionParameterComponent();
879        copyValues(dst);
880        return dst;
881      }
882
883      public void copyValues(SubscriptionParameterComponent dst) {
884        super.copyValues(dst);
885        dst.name = name == null ? null : name.copy();
886        dst.value = value == null ? null : value.copy();
887      }
888
889      @Override
890      public boolean equalsDeep(Base other_) {
891        if (!super.equalsDeep(other_))
892          return false;
893        if (!(other_ instanceof SubscriptionParameterComponent))
894          return false;
895        SubscriptionParameterComponent o = (SubscriptionParameterComponent) other_;
896        return compareDeep(name, o.name, true) && compareDeep(value, o.value, true);
897      }
898
899      @Override
900      public boolean equalsShallow(Base other_) {
901        if (!super.equalsShallow(other_))
902          return false;
903        if (!(other_ instanceof SubscriptionParameterComponent))
904          return false;
905        SubscriptionParameterComponent o = (SubscriptionParameterComponent) other_;
906        return compareValues(name, o.name, true) && compareValues(value, o.value, true);
907      }
908
909      public boolean isEmpty() {
910        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, value);
911      }
912
913  public String fhirType() {
914    return "Subscription.parameter";
915
916  }
917
918  }
919
920    /**
921     * 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.
922     */
923    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
924    @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." )
925    protected List<Identifier> identifier;
926
927    /**
928     * A natural language name identifying the subscription.
929     */
930    @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
931    @Description(shortDefinition="Human readable name for this subscription", formalDefinition="A natural language name identifying the subscription." )
932    protected StringType name;
933
934    /**
935     * The status of the subscription, which marks the server state for managing the subscription.
936     */
937    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
938    @Description(shortDefinition="requested | active | error | off | entered-in-error", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." )
939    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status")
940    protected Enumeration<SubscriptionStatusCodes> status;
941
942    /**
943     * The reference to the subscription topic to be notified about.
944     */
945    @Child(name = "topic", type = {CanonicalType.class}, order=3, min=1, max=1, modifier=false, summary=true)
946    @Description(shortDefinition="Reference to the subscription topic being subscribed to", formalDefinition="The reference to the subscription topic to be notified about." )
947    protected CanonicalType topic;
948
949    /**
950     * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.
951     */
952    @Child(name = "contact", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
953    @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." )
954    protected List<ContactPoint> contact;
955
956    /**
957     * The time for the server to turn the subscription off.
958     */
959    @Child(name = "end", type = {InstantType.class}, order=5, min=0, max=1, modifier=false, summary=true)
960    @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." )
961    protected InstantType end;
962
963    /**
964     * Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.
965     */
966    @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)
967    @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." )
968    protected Reference managingEntity;
969
970    /**
971     * A description of why this subscription is defined.
972     */
973    @Child(name = "reason", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
974    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
975    protected StringType reason;
976
977    /**
978     * The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions applicable to that resource are met; otherwise it returns false (i.e., logical AND).
979     */
980    @Child(name = "filterBy", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
981    @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 applicable to that resource are met; otherwise it returns false (i.e., logical AND)." )
982    protected List<SubscriptionFilterByComponent> filterBy;
983
984    /**
985     * The type of channel to send notifications on.
986     */
987    @Child(name = "channelType", type = {Coding.class}, order=9, min=1, max=1, modifier=false, summary=true)
988    @Description(shortDefinition="Channel type for notifications", formalDefinition="The type of channel to send notifications on." )
989    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
990    protected Coding channelType;
991
992    /**
993     * The url that describes the actual end-point to send notifications to.
994     */
995    @Child(name = "endpoint", type = {UrlType.class}, order=10, min=0, max=1, modifier=false, summary=true)
996    @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send notifications to." )
997    protected UrlType endpoint;
998
999    /**
1000     * Channel-dependent information to send as part of the notification (e.g., HTTP Headers).
1001     */
1002    @Child(name = "parameter", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1003    @Description(shortDefinition="Channel type", formalDefinition="Channel-dependent information to send as part of the notification (e.g., HTTP Headers)." )
1004    protected List<SubscriptionParameterComponent> parameter;
1005
1006    /**
1007     * If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.
1008     */
1009    @Child(name = "heartbeatPeriod", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1010    @Description(shortDefinition="Interval in seconds to send 'heartbeat' notification", formalDefinition="If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent." )
1011    protected UnsignedIntType heartbeatPeriod;
1012
1013    /**
1014     * If present, the maximum amount of time a server will allow before failing a notification attempt.
1015     */
1016    @Child(name = "timeout", type = {UnsignedIntType.class}, order=13, min=0, max=1, modifier=false, summary=true)
1017    @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." )
1018    protected UnsignedIntType timeout;
1019
1020    /**
1021     * The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:
1022
1023* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.
1024
1025* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.
1026     */
1027    @Child(name = "contentType", type = {CodeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
1028    @Description(shortDefinition="MIME type to send, or omit for no payload", formalDefinition="The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:\n\n* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.\n\n* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel." )
1029    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
1030    protected CodeType contentType;
1031
1032    /**
1033     * 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.
1034     */
1035    @Child(name = "content", type = {CodeType.class}, order=15, min=0, max=1, modifier=false, summary=true)
1036    @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." )
1037    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-payload-content")
1038    protected Enumeration<SubscriptionPayloadContent> content;
1039
1040    /**
1041     * If present, the maximum number of events that will be included in a notification bundle. Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
1042     */
1043    @Child(name = "maxCount", type = {PositiveIntType.class}, order=16, min=0, max=1, modifier=false, summary=true)
1044    @Description(shortDefinition="Maximum number of events that can be combined in a single notification", formalDefinition="If present, the maximum number of events that will be included in a notification bundle. Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included." )
1045    protected PositiveIntType maxCount;
1046
1047    private static final long serialVersionUID = 1396960420L;
1048
1049  /**
1050   * Constructor
1051   */
1052    public Subscription() {
1053      super();
1054    }
1055
1056  /**
1057   * Constructor
1058   */
1059    public Subscription(SubscriptionStatusCodes status, String topic, Coding channelType) {
1060      super();
1061      this.setStatus(status);
1062      this.setTopic(topic);
1063      this.setChannelType(channelType);
1064    }
1065
1066    /**
1067     * @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.)
1068     */
1069    public List<Identifier> getIdentifier() { 
1070      if (this.identifier == null)
1071        this.identifier = new ArrayList<Identifier>();
1072      return this.identifier;
1073    }
1074
1075    /**
1076     * @return Returns a reference to <code>this</code> for easy method chaining
1077     */
1078    public Subscription setIdentifier(List<Identifier> theIdentifier) { 
1079      this.identifier = theIdentifier;
1080      return this;
1081    }
1082
1083    public boolean hasIdentifier() { 
1084      if (this.identifier == null)
1085        return false;
1086      for (Identifier item : this.identifier)
1087        if (!item.isEmpty())
1088          return true;
1089      return false;
1090    }
1091
1092    public Identifier addIdentifier() { //3
1093      Identifier t = new Identifier();
1094      if (this.identifier == null)
1095        this.identifier = new ArrayList<Identifier>();
1096      this.identifier.add(t);
1097      return t;
1098    }
1099
1100    public Subscription addIdentifier(Identifier t) { //3
1101      if (t == null)
1102        return this;
1103      if (this.identifier == null)
1104        this.identifier = new ArrayList<Identifier>();
1105      this.identifier.add(t);
1106      return this;
1107    }
1108
1109    /**
1110     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1111     */
1112    public Identifier getIdentifierFirstRep() { 
1113      if (getIdentifier().isEmpty()) {
1114        addIdentifier();
1115      }
1116      return getIdentifier().get(0);
1117    }
1118
1119    /**
1120     * @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
1121     */
1122    public StringType getNameElement() { 
1123      if (this.name == null)
1124        if (Configuration.errorOnAutoCreate())
1125          throw new Error("Attempt to auto-create Subscription.name");
1126        else if (Configuration.doAutoCreate())
1127          this.name = new StringType(); // bb
1128      return this.name;
1129    }
1130
1131    public boolean hasNameElement() { 
1132      return this.name != null && !this.name.isEmpty();
1133    }
1134
1135    public boolean hasName() { 
1136      return this.name != null && !this.name.isEmpty();
1137    }
1138
1139    /**
1140     * @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
1141     */
1142    public Subscription setNameElement(StringType value) { 
1143      this.name = value;
1144      return this;
1145    }
1146
1147    /**
1148     * @return A natural language name identifying the subscription.
1149     */
1150    public String getName() { 
1151      return this.name == null ? null : this.name.getValue();
1152    }
1153
1154    /**
1155     * @param value A natural language name identifying the subscription.
1156     */
1157    public Subscription setName(String value) { 
1158      if (Utilities.noString(value))
1159        this.name = null;
1160      else {
1161        if (this.name == null)
1162          this.name = new StringType();
1163        this.name.setValue(value);
1164      }
1165      return this;
1166    }
1167
1168    /**
1169     * @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
1170     */
1171    public Enumeration<SubscriptionStatusCodes> getStatusElement() { 
1172      if (this.status == null)
1173        if (Configuration.errorOnAutoCreate())
1174          throw new Error("Attempt to auto-create Subscription.status");
1175        else if (Configuration.doAutoCreate())
1176          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory()); // bb
1177      return this.status;
1178    }
1179
1180    public boolean hasStatusElement() { 
1181      return this.status != null && !this.status.isEmpty();
1182    }
1183
1184    public boolean hasStatus() { 
1185      return this.status != null && !this.status.isEmpty();
1186    }
1187
1188    /**
1189     * @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
1190     */
1191    public Subscription setStatusElement(Enumeration<SubscriptionStatusCodes> value) { 
1192      this.status = value;
1193      return this;
1194    }
1195
1196    /**
1197     * @return The status of the subscription, which marks the server state for managing the subscription.
1198     */
1199    public SubscriptionStatusCodes getStatus() { 
1200      return this.status == null ? null : this.status.getValue();
1201    }
1202
1203    /**
1204     * @param value The status of the subscription, which marks the server state for managing the subscription.
1205     */
1206    public Subscription setStatus(SubscriptionStatusCodes value) { 
1207        if (this.status == null)
1208          this.status = new Enumeration<SubscriptionStatusCodes>(new SubscriptionStatusCodesEnumFactory());
1209        this.status.setValue(value);
1210      return this;
1211    }
1212
1213    /**
1214     * @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
1215     */
1216    public CanonicalType getTopicElement() { 
1217      if (this.topic == null)
1218        if (Configuration.errorOnAutoCreate())
1219          throw new Error("Attempt to auto-create Subscription.topic");
1220        else if (Configuration.doAutoCreate())
1221          this.topic = new CanonicalType(); // bb
1222      return this.topic;
1223    }
1224
1225    public boolean hasTopicElement() { 
1226      return this.topic != null && !this.topic.isEmpty();
1227    }
1228
1229    public boolean hasTopic() { 
1230      return this.topic != null && !this.topic.isEmpty();
1231    }
1232
1233    /**
1234     * @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
1235     */
1236    public Subscription setTopicElement(CanonicalType value) { 
1237      this.topic = value;
1238      return this;
1239    }
1240
1241    /**
1242     * @return The reference to the subscription topic to be notified about.
1243     */
1244    public String getTopic() { 
1245      return this.topic == null ? null : this.topic.getValue();
1246    }
1247
1248    /**
1249     * @param value The reference to the subscription topic to be notified about.
1250     */
1251    public Subscription setTopic(String value) { 
1252        if (this.topic == null)
1253          this.topic = new CanonicalType();
1254        this.topic.setValue(value);
1255      return this;
1256    }
1257
1258    /**
1259     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
1260     */
1261    public List<ContactPoint> getContact() { 
1262      if (this.contact == null)
1263        this.contact = new ArrayList<ContactPoint>();
1264      return this.contact;
1265    }
1266
1267    /**
1268     * @return Returns a reference to <code>this</code> for easy method chaining
1269     */
1270    public Subscription setContact(List<ContactPoint> theContact) { 
1271      this.contact = theContact;
1272      return this;
1273    }
1274
1275    public boolean hasContact() { 
1276      if (this.contact == null)
1277        return false;
1278      for (ContactPoint item : this.contact)
1279        if (!item.isEmpty())
1280          return true;
1281      return false;
1282    }
1283
1284    public ContactPoint addContact() { //3
1285      ContactPoint t = new ContactPoint();
1286      if (this.contact == null)
1287        this.contact = new ArrayList<ContactPoint>();
1288      this.contact.add(t);
1289      return t;
1290    }
1291
1292    public Subscription addContact(ContactPoint t) { //3
1293      if (t == null)
1294        return this;
1295      if (this.contact == null)
1296        this.contact = new ArrayList<ContactPoint>();
1297      this.contact.add(t);
1298      return this;
1299    }
1300
1301    /**
1302     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
1303     */
1304    public ContactPoint getContactFirstRep() { 
1305      if (getContact().isEmpty()) {
1306        addContact();
1307      }
1308      return getContact().get(0);
1309    }
1310
1311    /**
1312     * @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
1313     */
1314    public InstantType getEndElement() { 
1315      if (this.end == null)
1316        if (Configuration.errorOnAutoCreate())
1317          throw new Error("Attempt to auto-create Subscription.end");
1318        else if (Configuration.doAutoCreate())
1319          this.end = new InstantType(); // bb
1320      return this.end;
1321    }
1322
1323    public boolean hasEndElement() { 
1324      return this.end != null && !this.end.isEmpty();
1325    }
1326
1327    public boolean hasEnd() { 
1328      return this.end != null && !this.end.isEmpty();
1329    }
1330
1331    /**
1332     * @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
1333     */
1334    public Subscription setEndElement(InstantType value) { 
1335      this.end = value;
1336      return this;
1337    }
1338
1339    /**
1340     * @return The time for the server to turn the subscription off.
1341     */
1342    public Date getEnd() { 
1343      return this.end == null ? null : this.end.getValue();
1344    }
1345
1346    /**
1347     * @param value The time for the server to turn the subscription off.
1348     */
1349    public Subscription setEnd(Date value) { 
1350      if (value == null)
1351        this.end = null;
1352      else {
1353        if (this.end == null)
1354          this.end = new InstantType();
1355        this.end.setValue(value);
1356      }
1357      return this;
1358    }
1359
1360    /**
1361     * @return {@link #managingEntity} (Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.)
1362     */
1363    public Reference getManagingEntity() { 
1364      if (this.managingEntity == null)
1365        if (Configuration.errorOnAutoCreate())
1366          throw new Error("Attempt to auto-create Subscription.managingEntity");
1367        else if (Configuration.doAutoCreate())
1368          this.managingEntity = new Reference(); // cc
1369      return this.managingEntity;
1370    }
1371
1372    public boolean hasManagingEntity() { 
1373      return this.managingEntity != null && !this.managingEntity.isEmpty();
1374    }
1375
1376    /**
1377     * @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.)
1378     */
1379    public Subscription setManagingEntity(Reference value) { 
1380      this.managingEntity = value;
1381      return this;
1382    }
1383
1384    /**
1385     * @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
1386     */
1387    public StringType getReasonElement() { 
1388      if (this.reason == null)
1389        if (Configuration.errorOnAutoCreate())
1390          throw new Error("Attempt to auto-create Subscription.reason");
1391        else if (Configuration.doAutoCreate())
1392          this.reason = new StringType(); // bb
1393      return this.reason;
1394    }
1395
1396    public boolean hasReasonElement() { 
1397      return this.reason != null && !this.reason.isEmpty();
1398    }
1399
1400    public boolean hasReason() { 
1401      return this.reason != null && !this.reason.isEmpty();
1402    }
1403
1404    /**
1405     * @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
1406     */
1407    public Subscription setReasonElement(StringType value) { 
1408      this.reason = value;
1409      return this;
1410    }
1411
1412    /**
1413     * @return A description of why this subscription is defined.
1414     */
1415    public String getReason() { 
1416      return this.reason == null ? null : this.reason.getValue();
1417    }
1418
1419    /**
1420     * @param value A description of why this subscription is defined.
1421     */
1422    public Subscription setReason(String value) { 
1423      if (Utilities.noString(value))
1424        this.reason = null;
1425      else {
1426        if (this.reason == null)
1427          this.reason = new StringType();
1428        this.reason.setValue(value);
1429      }
1430      return this;
1431    }
1432
1433    /**
1434     * @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 applicable to that resource are met; otherwise it returns false (i.e., logical AND).)
1435     */
1436    public List<SubscriptionFilterByComponent> getFilterBy() { 
1437      if (this.filterBy == null)
1438        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1439      return this.filterBy;
1440    }
1441
1442    /**
1443     * @return Returns a reference to <code>this</code> for easy method chaining
1444     */
1445    public Subscription setFilterBy(List<SubscriptionFilterByComponent> theFilterBy) { 
1446      this.filterBy = theFilterBy;
1447      return this;
1448    }
1449
1450    public boolean hasFilterBy() { 
1451      if (this.filterBy == null)
1452        return false;
1453      for (SubscriptionFilterByComponent item : this.filterBy)
1454        if (!item.isEmpty())
1455          return true;
1456      return false;
1457    }
1458
1459    public SubscriptionFilterByComponent addFilterBy() { //3
1460      SubscriptionFilterByComponent t = new SubscriptionFilterByComponent();
1461      if (this.filterBy == null)
1462        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1463      this.filterBy.add(t);
1464      return t;
1465    }
1466
1467    public Subscription addFilterBy(SubscriptionFilterByComponent t) { //3
1468      if (t == null)
1469        return this;
1470      if (this.filterBy == null)
1471        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1472      this.filterBy.add(t);
1473      return this;
1474    }
1475
1476    /**
1477     * @return The first repetition of repeating field {@link #filterBy}, creating it if it does not already exist {3}
1478     */
1479    public SubscriptionFilterByComponent getFilterByFirstRep() { 
1480      if (getFilterBy().isEmpty()) {
1481        addFilterBy();
1482      }
1483      return getFilterBy().get(0);
1484    }
1485
1486    /**
1487     * @return {@link #channelType} (The type of channel to send notifications on.)
1488     */
1489    public Coding getChannelType() { 
1490      if (this.channelType == null)
1491        if (Configuration.errorOnAutoCreate())
1492          throw new Error("Attempt to auto-create Subscription.channelType");
1493        else if (Configuration.doAutoCreate())
1494          this.channelType = new Coding(); // cc
1495      return this.channelType;
1496    }
1497
1498    public boolean hasChannelType() { 
1499      return this.channelType != null && !this.channelType.isEmpty();
1500    }
1501
1502    /**
1503     * @param value {@link #channelType} (The type of channel to send notifications on.)
1504     */
1505    public Subscription setChannelType(Coding value) { 
1506      this.channelType = value;
1507      return this;
1508    }
1509
1510    /**
1511     * @return {@link #endpoint} (The url that describes the actual end-point to send notifications to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
1512     */
1513    public UrlType getEndpointElement() { 
1514      if (this.endpoint == null)
1515        if (Configuration.errorOnAutoCreate())
1516          throw new Error("Attempt to auto-create Subscription.endpoint");
1517        else if (Configuration.doAutoCreate())
1518          this.endpoint = new UrlType(); // bb
1519      return this.endpoint;
1520    }
1521
1522    public boolean hasEndpointElement() { 
1523      return this.endpoint != null && !this.endpoint.isEmpty();
1524    }
1525
1526    public boolean hasEndpoint() { 
1527      return this.endpoint != null && !this.endpoint.isEmpty();
1528    }
1529
1530    /**
1531     * @param value {@link #endpoint} (The url that describes the actual end-point to send notifications to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
1532     */
1533    public Subscription setEndpointElement(UrlType value) { 
1534      this.endpoint = value;
1535      return this;
1536    }
1537
1538    /**
1539     * @return The url that describes the actual end-point to send notifications to.
1540     */
1541    public String getEndpoint() { 
1542      return this.endpoint == null ? null : this.endpoint.getValue();
1543    }
1544
1545    /**
1546     * @param value The url that describes the actual end-point to send notifications to.
1547     */
1548    public Subscription setEndpoint(String value) { 
1549      if (Utilities.noString(value))
1550        this.endpoint = null;
1551      else {
1552        if (this.endpoint == null)
1553          this.endpoint = new UrlType();
1554        this.endpoint.setValue(value);
1555      }
1556      return this;
1557    }
1558
1559    /**
1560     * @return {@link #parameter} (Channel-dependent information to send as part of the notification (e.g., HTTP Headers).)
1561     */
1562    public List<SubscriptionParameterComponent> getParameter() { 
1563      if (this.parameter == null)
1564        this.parameter = new ArrayList<SubscriptionParameterComponent>();
1565      return this.parameter;
1566    }
1567
1568    /**
1569     * @return Returns a reference to <code>this</code> for easy method chaining
1570     */
1571    public Subscription setParameter(List<SubscriptionParameterComponent> theParameter) { 
1572      this.parameter = theParameter;
1573      return this;
1574    }
1575
1576    public boolean hasParameter() { 
1577      if (this.parameter == null)
1578        return false;
1579      for (SubscriptionParameterComponent item : this.parameter)
1580        if (!item.isEmpty())
1581          return true;
1582      return false;
1583    }
1584
1585    public SubscriptionParameterComponent addParameter() { //3
1586      SubscriptionParameterComponent t = new SubscriptionParameterComponent();
1587      if (this.parameter == null)
1588        this.parameter = new ArrayList<SubscriptionParameterComponent>();
1589      this.parameter.add(t);
1590      return t;
1591    }
1592
1593    public Subscription addParameter(SubscriptionParameterComponent t) { //3
1594      if (t == null)
1595        return this;
1596      if (this.parameter == null)
1597        this.parameter = new ArrayList<SubscriptionParameterComponent>();
1598      this.parameter.add(t);
1599      return this;
1600    }
1601
1602    /**
1603     * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist {3}
1604     */
1605    public SubscriptionParameterComponent getParameterFirstRep() { 
1606      if (getParameter().isEmpty()) {
1607        addParameter();
1608      }
1609      return getParameter().get(0);
1610    }
1611
1612    /**
1613     * @return {@link #heartbeatPeriod} (If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an 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
1614     */
1615    public UnsignedIntType getHeartbeatPeriodElement() { 
1616      if (this.heartbeatPeriod == null)
1617        if (Configuration.errorOnAutoCreate())
1618          throw new Error("Attempt to auto-create Subscription.heartbeatPeriod");
1619        else if (Configuration.doAutoCreate())
1620          this.heartbeatPeriod = new UnsignedIntType(); // bb
1621      return this.heartbeatPeriod;
1622    }
1623
1624    public boolean hasHeartbeatPeriodElement() { 
1625      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1626    }
1627
1628    public boolean hasHeartbeatPeriod() { 
1629      return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
1630    }
1631
1632    /**
1633     * @param value {@link #heartbeatPeriod} (If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an 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
1634     */
1635    public Subscription setHeartbeatPeriodElement(UnsignedIntType value) { 
1636      this.heartbeatPeriod = value;
1637      return this;
1638    }
1639
1640    /**
1641     * @return If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.
1642     */
1643    public int getHeartbeatPeriod() { 
1644      return this.heartbeatPeriod == null || this.heartbeatPeriod.isEmpty() ? 0 : this.heartbeatPeriod.getValue();
1645    }
1646
1647    /**
1648     * @param value If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.
1649     */
1650    public Subscription setHeartbeatPeriod(int value) { 
1651        if (this.heartbeatPeriod == null)
1652          this.heartbeatPeriod = new UnsignedIntType();
1653        this.heartbeatPeriod.setValue(value);
1654      return this;
1655    }
1656
1657    /**
1658     * @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
1659     */
1660    public UnsignedIntType getTimeoutElement() { 
1661      if (this.timeout == null)
1662        if (Configuration.errorOnAutoCreate())
1663          throw new Error("Attempt to auto-create Subscription.timeout");
1664        else if (Configuration.doAutoCreate())
1665          this.timeout = new UnsignedIntType(); // bb
1666      return this.timeout;
1667    }
1668
1669    public boolean hasTimeoutElement() { 
1670      return this.timeout != null && !this.timeout.isEmpty();
1671    }
1672
1673    public boolean hasTimeout() { 
1674      return this.timeout != null && !this.timeout.isEmpty();
1675    }
1676
1677    /**
1678     * @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
1679     */
1680    public Subscription setTimeoutElement(UnsignedIntType value) { 
1681      this.timeout = value;
1682      return this;
1683    }
1684
1685    /**
1686     * @return If present, the maximum amount of time a server will allow before failing a notification attempt.
1687     */
1688    public int getTimeout() { 
1689      return this.timeout == null || this.timeout.isEmpty() ? 0 : this.timeout.getValue();
1690    }
1691
1692    /**
1693     * @param value If present, the maximum amount of time a server will allow before failing a notification attempt.
1694     */
1695    public Subscription setTimeout(int value) { 
1696        if (this.timeout == null)
1697          this.timeout = new UnsignedIntType();
1698        this.timeout.setValue(value);
1699      return this;
1700    }
1701
1702    /**
1703     * @return {@link #contentType} (The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:
1704
1705* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.
1706
1707* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1708     */
1709    public CodeType getContentTypeElement() { 
1710      if (this.contentType == null)
1711        if (Configuration.errorOnAutoCreate())
1712          throw new Error("Attempt to auto-create Subscription.contentType");
1713        else if (Configuration.doAutoCreate())
1714          this.contentType = new CodeType(); // bb
1715      return this.contentType;
1716    }
1717
1718    public boolean hasContentTypeElement() { 
1719      return this.contentType != null && !this.contentType.isEmpty();
1720    }
1721
1722    public boolean hasContentType() { 
1723      return this.contentType != null && !this.contentType.isEmpty();
1724    }
1725
1726    /**
1727     * @param value {@link #contentType} (The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:
1728
1729* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.
1730
1731* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1732     */
1733    public Subscription setContentTypeElement(CodeType value) { 
1734      this.contentType = value;
1735      return this;
1736    }
1737
1738    /**
1739     * @return The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:
1740
1741* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.
1742
1743* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.
1744     */
1745    public String getContentType() { 
1746      return this.contentType == null ? null : this.contentType.getValue();
1747    }
1748
1749    /**
1750     * @param value The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:
1751
1752* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.
1753
1754* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.
1755     */
1756    public Subscription setContentType(String value) { 
1757      if (Utilities.noString(value))
1758        this.contentType = null;
1759      else {
1760        if (this.contentType == null)
1761          this.contentType = new CodeType();
1762        this.contentType.setValue(value);
1763      }
1764      return this;
1765    }
1766
1767    /**
1768     * @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
1769     */
1770    public Enumeration<SubscriptionPayloadContent> getContentElement() { 
1771      if (this.content == null)
1772        if (Configuration.errorOnAutoCreate())
1773          throw new Error("Attempt to auto-create Subscription.content");
1774        else if (Configuration.doAutoCreate())
1775          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory()); // bb
1776      return this.content;
1777    }
1778
1779    public boolean hasContentElement() { 
1780      return this.content != null && !this.content.isEmpty();
1781    }
1782
1783    public boolean hasContent() { 
1784      return this.content != null && !this.content.isEmpty();
1785    }
1786
1787    /**
1788     * @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
1789     */
1790    public Subscription setContentElement(Enumeration<SubscriptionPayloadContent> value) { 
1791      this.content = value;
1792      return this;
1793    }
1794
1795    /**
1796     * @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.
1797     */
1798    public SubscriptionPayloadContent getContent() { 
1799      return this.content == null ? null : this.content.getValue();
1800    }
1801
1802    /**
1803     * @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.
1804     */
1805    public Subscription setContent(SubscriptionPayloadContent value) { 
1806      if (value == null)
1807        this.content = null;
1808      else {
1809        if (this.content == null)
1810          this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory());
1811        this.content.setValue(value);
1812      }
1813      return this;
1814    }
1815
1816    /**
1817     * @return {@link #maxCount} (If present, the maximum number of events that will be included in a notification bundle. 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
1818     */
1819    public PositiveIntType getMaxCountElement() { 
1820      if (this.maxCount == null)
1821        if (Configuration.errorOnAutoCreate())
1822          throw new Error("Attempt to auto-create Subscription.maxCount");
1823        else if (Configuration.doAutoCreate())
1824          this.maxCount = new PositiveIntType(); // bb
1825      return this.maxCount;
1826    }
1827
1828    public boolean hasMaxCountElement() { 
1829      return this.maxCount != null && !this.maxCount.isEmpty();
1830    }
1831
1832    public boolean hasMaxCount() { 
1833      return this.maxCount != null && !this.maxCount.isEmpty();
1834    }
1835
1836    /**
1837     * @param value {@link #maxCount} (If present, the maximum number of events that will be included in a notification bundle. 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
1838     */
1839    public Subscription setMaxCountElement(PositiveIntType value) { 
1840      this.maxCount = value;
1841      return this;
1842    }
1843
1844    /**
1845     * @return If present, the maximum number of events that will be included in a notification bundle. Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
1846     */
1847    public int getMaxCount() { 
1848      return this.maxCount == null || this.maxCount.isEmpty() ? 0 : this.maxCount.getValue();
1849    }
1850
1851    /**
1852     * @param value If present, the maximum number of events that will be included in a notification bundle. Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.
1853     */
1854    public Subscription setMaxCount(int value) { 
1855        if (this.maxCount == null)
1856          this.maxCount = new PositiveIntType();
1857        this.maxCount.setValue(value);
1858      return this;
1859    }
1860
1861      protected void listChildren(List<Property> children) {
1862        super.listChildren(children);
1863        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));
1864        children.add(new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name));
1865        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
1866        children.add(new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic));
1867        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));
1868        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
1869        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));
1870        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
1871        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 applicable to that resource are met; otherwise it returns false (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy));
1872        children.add(new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType));
1873        children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send notifications to.", 0, 1, endpoint));
1874        children.add(new Property("parameter", "", "Channel-dependent information to send as part of the notification (e.g., HTTP Headers).", 0, java.lang.Integer.MAX_VALUE, parameter));
1875        children.add(new Property("heartbeatPeriod", "unsignedInt", "If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod));
1876        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));
1877        children.add(new Property("contentType", "code", "The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:\n\n* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.\n\n* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.", 0, 1, contentType));
1878        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));
1879        children.add(new Property("maxCount", "positiveInt", "If present, the maximum number of events that will be included in a notification bundle. 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));
1880      }
1881
1882      @Override
1883      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1884        switch (_hash) {
1885        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);
1886        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name);
1887        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);
1888        case 110546223: /*topic*/  return new Property("topic", "canonical(SubscriptionTopic)", "The reference to the subscription topic to be notified about.", 0, 1, topic);
1889        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);
1890        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
1891        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);
1892        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
1893        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 applicable to that resource are met; otherwise it returns false (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy);
1894        case 274155229: /*channelType*/  return new Property("channelType", "Coding", "The type of channel to send notifications on.", 0, 1, channelType);
1895        case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send notifications to.", 0, 1, endpoint);
1896        case 1954460585: /*parameter*/  return new Property("parameter", "", "Channel-dependent information to send as part of the notification (e.g., HTTP Headers).", 0, java.lang.Integer.MAX_VALUE, parameter);
1897        case -938465827: /*heartbeatPeriod*/  return new Property("heartbeatPeriod", "unsignedInt", "If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod);
1898        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);
1899        case -389131437: /*contentType*/  return new Property("contentType", "code", "The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:\n\n* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.\n\n* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.", 0, 1, contentType);
1900        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);
1901        case 382106123: /*maxCount*/  return new Property("maxCount", "positiveInt", "If present, the maximum number of events that will be included in a notification bundle. 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);
1902        default: return super.getNamedProperty(_hash, _name, _checkValid);
1903        }
1904
1905      }
1906
1907      @Override
1908      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1909        switch (hash) {
1910        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1911        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1912        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatusCodes>
1913        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // CanonicalType
1914        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1915        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1916        case -988474523: /*managingEntity*/ return this.managingEntity == null ? new Base[0] : new Base[] {this.managingEntity}; // Reference
1917        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
1918        case -721168913: /*filterBy*/ return this.filterBy == null ? new Base[0] : this.filterBy.toArray(new Base[this.filterBy.size()]); // SubscriptionFilterByComponent
1919        case 274155229: /*channelType*/ return this.channelType == null ? new Base[0] : new Base[] {this.channelType}; // Coding
1920        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
1921        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // SubscriptionParameterComponent
1922        case -938465827: /*heartbeatPeriod*/ return this.heartbeatPeriod == null ? new Base[0] : new Base[] {this.heartbeatPeriod}; // UnsignedIntType
1923        case -1313911455: /*timeout*/ return this.timeout == null ? new Base[0] : new Base[] {this.timeout}; // UnsignedIntType
1924        case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
1925        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Enumeration<SubscriptionPayloadContent>
1926        case 382106123: /*maxCount*/ return this.maxCount == null ? new Base[0] : new Base[] {this.maxCount}; // PositiveIntType
1927        default: return super.getProperty(hash, name, checkValid);
1928        }
1929
1930      }
1931
1932      @Override
1933      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1934        switch (hash) {
1935        case -1618432855: // identifier
1936          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1937          return value;
1938        case 3373707: // name
1939          this.name = TypeConvertor.castToString(value); // StringType
1940          return value;
1941        case -892481550: // status
1942          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1943          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
1944          return value;
1945        case 110546223: // topic
1946          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
1947          return value;
1948        case 951526432: // contact
1949          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1950          return value;
1951        case 100571: // end
1952          this.end = TypeConvertor.castToInstant(value); // InstantType
1953          return value;
1954        case -988474523: // managingEntity
1955          this.managingEntity = TypeConvertor.castToReference(value); // Reference
1956          return value;
1957        case -934964668: // reason
1958          this.reason = TypeConvertor.castToString(value); // StringType
1959          return value;
1960        case -721168913: // filterBy
1961          this.getFilterBy().add((SubscriptionFilterByComponent) value); // SubscriptionFilterByComponent
1962          return value;
1963        case 274155229: // channelType
1964          this.channelType = TypeConvertor.castToCoding(value); // Coding
1965          return value;
1966        case 1741102485: // endpoint
1967          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1968          return value;
1969        case 1954460585: // parameter
1970          this.getParameter().add((SubscriptionParameterComponent) value); // SubscriptionParameterComponent
1971          return value;
1972        case -938465827: // heartbeatPeriod
1973          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1974          return value;
1975        case -1313911455: // timeout
1976          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1977          return value;
1978        case -389131437: // contentType
1979          this.contentType = TypeConvertor.castToCode(value); // CodeType
1980          return value;
1981        case 951530617: // content
1982          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1983          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1984          return value;
1985        case 382106123: // maxCount
1986          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1987          return value;
1988        default: return super.setProperty(hash, name, value);
1989        }
1990
1991      }
1992
1993      @Override
1994      public Base setProperty(String name, Base value) throws FHIRException {
1995        if (name.equals("identifier")) {
1996          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1997        } else if (name.equals("name")) {
1998          this.name = TypeConvertor.castToString(value); // StringType
1999        } else if (name.equals("status")) {
2000          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2001          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
2002        } else if (name.equals("topic")) {
2003          this.topic = TypeConvertor.castToCanonical(value); // CanonicalType
2004        } else if (name.equals("contact")) {
2005          this.getContact().add(TypeConvertor.castToContactPoint(value));
2006        } else if (name.equals("end")) {
2007          this.end = TypeConvertor.castToInstant(value); // InstantType
2008        } else if (name.equals("managingEntity")) {
2009          this.managingEntity = TypeConvertor.castToReference(value); // Reference
2010        } else if (name.equals("reason")) {
2011          this.reason = TypeConvertor.castToString(value); // StringType
2012        } else if (name.equals("filterBy")) {
2013          this.getFilterBy().add((SubscriptionFilterByComponent) value);
2014        } else if (name.equals("channelType")) {
2015          this.channelType = TypeConvertor.castToCoding(value); // Coding
2016        } else if (name.equals("endpoint")) {
2017          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
2018        } else if (name.equals("parameter")) {
2019          this.getParameter().add((SubscriptionParameterComponent) value);
2020        } else if (name.equals("heartbeatPeriod")) {
2021          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
2022        } else if (name.equals("timeout")) {
2023          this.timeout = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
2024        } else if (name.equals("contentType")) {
2025          this.contentType = TypeConvertor.castToCode(value); // CodeType
2026        } else if (name.equals("content")) {
2027          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
2028          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
2029        } else if (name.equals("maxCount")) {
2030          this.maxCount = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2031        } else
2032          return super.setProperty(name, value);
2033        return value;
2034      }
2035
2036  @Override
2037  public void removeChild(String name, Base value) throws FHIRException {
2038        if (name.equals("identifier")) {
2039          this.getIdentifier().remove(value);
2040        } else if (name.equals("name")) {
2041          this.name = null;
2042        } else if (name.equals("status")) {
2043          value = new SubscriptionStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2044          this.status = (Enumeration) value; // Enumeration<SubscriptionStatusCodes>
2045        } else if (name.equals("topic")) {
2046          this.topic = null;
2047        } else if (name.equals("contact")) {
2048          this.getContact().remove(value);
2049        } else if (name.equals("end")) {
2050          this.end = null;
2051        } else if (name.equals("managingEntity")) {
2052          this.managingEntity = null;
2053        } else if (name.equals("reason")) {
2054          this.reason = null;
2055        } else if (name.equals("filterBy")) {
2056          this.getFilterBy().remove((SubscriptionFilterByComponent) value);
2057        } else if (name.equals("channelType")) {
2058          this.channelType = null;
2059        } else if (name.equals("endpoint")) {
2060          this.endpoint = null;
2061        } else if (name.equals("parameter")) {
2062          this.getParameter().remove((SubscriptionParameterComponent) value);
2063        } else if (name.equals("heartbeatPeriod")) {
2064          this.heartbeatPeriod = null;
2065        } else if (name.equals("timeout")) {
2066          this.timeout = null;
2067        } else if (name.equals("contentType")) {
2068          this.contentType = null;
2069        } else if (name.equals("content")) {
2070          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
2071          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
2072        } else if (name.equals("maxCount")) {
2073          this.maxCount = null;
2074        } else
2075          super.removeChild(name, value);
2076        
2077      }
2078
2079      @Override
2080      public Base makeProperty(int hash, String name) throws FHIRException {
2081        switch (hash) {
2082        case -1618432855:  return addIdentifier(); 
2083        case 3373707:  return getNameElement();
2084        case -892481550:  return getStatusElement();
2085        case 110546223:  return getTopicElement();
2086        case 951526432:  return addContact(); 
2087        case 100571:  return getEndElement();
2088        case -988474523:  return getManagingEntity();
2089        case -934964668:  return getReasonElement();
2090        case -721168913:  return addFilterBy(); 
2091        case 274155229:  return getChannelType();
2092        case 1741102485:  return getEndpointElement();
2093        case 1954460585:  return addParameter(); 
2094        case -938465827:  return getHeartbeatPeriodElement();
2095        case -1313911455:  return getTimeoutElement();
2096        case -389131437:  return getContentTypeElement();
2097        case 951530617:  return getContentElement();
2098        case 382106123:  return getMaxCountElement();
2099        default: return super.makeProperty(hash, name);
2100        }
2101
2102      }
2103
2104      @Override
2105      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2106        switch (hash) {
2107        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2108        case 3373707: /*name*/ return new String[] {"string"};
2109        case -892481550: /*status*/ return new String[] {"code"};
2110        case 110546223: /*topic*/ return new String[] {"canonical"};
2111        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
2112        case 100571: /*end*/ return new String[] {"instant"};
2113        case -988474523: /*managingEntity*/ return new String[] {"Reference"};
2114        case -934964668: /*reason*/ return new String[] {"string"};
2115        case -721168913: /*filterBy*/ return new String[] {};
2116        case 274155229: /*channelType*/ return new String[] {"Coding"};
2117        case 1741102485: /*endpoint*/ return new String[] {"url"};
2118        case 1954460585: /*parameter*/ return new String[] {};
2119        case -938465827: /*heartbeatPeriod*/ return new String[] {"unsignedInt"};
2120        case -1313911455: /*timeout*/ return new String[] {"unsignedInt"};
2121        case -389131437: /*contentType*/ return new String[] {"code"};
2122        case 951530617: /*content*/ return new String[] {"code"};
2123        case 382106123: /*maxCount*/ return new String[] {"positiveInt"};
2124        default: return super.getTypesForProperty(hash, name);
2125        }
2126
2127      }
2128
2129      @Override
2130      public Base addChild(String name) throws FHIRException {
2131        if (name.equals("identifier")) {
2132          return addIdentifier();
2133        }
2134        else if (name.equals("name")) {
2135          throw new FHIRException("Cannot call addChild on a singleton property Subscription.name");
2136        }
2137        else if (name.equals("status")) {
2138          throw new FHIRException("Cannot call addChild on a singleton property Subscription.status");
2139        }
2140        else if (name.equals("topic")) {
2141          throw new FHIRException("Cannot call addChild on a singleton property Subscription.topic");
2142        }
2143        else if (name.equals("contact")) {
2144          return addContact();
2145        }
2146        else if (name.equals("end")) {
2147          throw new FHIRException("Cannot call addChild on a singleton property Subscription.end");
2148        }
2149        else if (name.equals("managingEntity")) {
2150          this.managingEntity = new Reference();
2151          return this.managingEntity;
2152        }
2153        else if (name.equals("reason")) {
2154          throw new FHIRException("Cannot call addChild on a singleton property Subscription.reason");
2155        }
2156        else if (name.equals("filterBy")) {
2157          return addFilterBy();
2158        }
2159        else if (name.equals("channelType")) {
2160          this.channelType = new Coding();
2161          return this.channelType;
2162        }
2163        else if (name.equals("endpoint")) {
2164          throw new FHIRException("Cannot call addChild on a singleton property Subscription.endpoint");
2165        }
2166        else if (name.equals("parameter")) {
2167          return addParameter();
2168        }
2169        else if (name.equals("heartbeatPeriod")) {
2170          throw new FHIRException("Cannot call addChild on a singleton property Subscription.heartbeatPeriod");
2171        }
2172        else if (name.equals("timeout")) {
2173          throw new FHIRException("Cannot call addChild on a singleton property Subscription.timeout");
2174        }
2175        else if (name.equals("contentType")) {
2176          throw new FHIRException("Cannot call addChild on a singleton property Subscription.contentType");
2177        }
2178        else if (name.equals("content")) {
2179          throw new FHIRException("Cannot call addChild on a singleton property Subscription.content");
2180        }
2181        else if (name.equals("maxCount")) {
2182          throw new FHIRException("Cannot call addChild on a singleton property Subscription.maxCount");
2183        }
2184        else
2185          return super.addChild(name);
2186      }
2187
2188  public String fhirType() {
2189    return "Subscription";
2190
2191  }
2192
2193      public Subscription copy() {
2194        Subscription dst = new Subscription();
2195        copyValues(dst);
2196        return dst;
2197      }
2198
2199      public void copyValues(Subscription dst) {
2200        super.copyValues(dst);
2201        if (identifier != null) {
2202          dst.identifier = new ArrayList<Identifier>();
2203          for (Identifier i : identifier)
2204            dst.identifier.add(i.copy());
2205        };
2206        dst.name = name == null ? null : name.copy();
2207        dst.status = status == null ? null : status.copy();
2208        dst.topic = topic == null ? null : topic.copy();
2209        if (contact != null) {
2210          dst.contact = new ArrayList<ContactPoint>();
2211          for (ContactPoint i : contact)
2212            dst.contact.add(i.copy());
2213        };
2214        dst.end = end == null ? null : end.copy();
2215        dst.managingEntity = managingEntity == null ? null : managingEntity.copy();
2216        dst.reason = reason == null ? null : reason.copy();
2217        if (filterBy != null) {
2218          dst.filterBy = new ArrayList<SubscriptionFilterByComponent>();
2219          for (SubscriptionFilterByComponent i : filterBy)
2220            dst.filterBy.add(i.copy());
2221        };
2222        dst.channelType = channelType == null ? null : channelType.copy();
2223        dst.endpoint = endpoint == null ? null : endpoint.copy();
2224        if (parameter != null) {
2225          dst.parameter = new ArrayList<SubscriptionParameterComponent>();
2226          for (SubscriptionParameterComponent i : parameter)
2227            dst.parameter.add(i.copy());
2228        };
2229        dst.heartbeatPeriod = heartbeatPeriod == null ? null : heartbeatPeriod.copy();
2230        dst.timeout = timeout == null ? null : timeout.copy();
2231        dst.contentType = contentType == null ? null : contentType.copy();
2232        dst.content = content == null ? null : content.copy();
2233        dst.maxCount = maxCount == null ? null : maxCount.copy();
2234      }
2235
2236      protected Subscription typedCopy() {
2237        return copy();
2238      }
2239
2240      @Override
2241      public boolean equalsDeep(Base other_) {
2242        if (!super.equalsDeep(other_))
2243          return false;
2244        if (!(other_ instanceof Subscription))
2245          return false;
2246        Subscription o = (Subscription) other_;
2247        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(status, o.status, true)
2248           && compareDeep(topic, o.topic, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
2249           && compareDeep(managingEntity, o.managingEntity, true) && compareDeep(reason, o.reason, true) && compareDeep(filterBy, o.filterBy, true)
2250           && compareDeep(channelType, o.channelType, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(parameter, o.parameter, true)
2251           && compareDeep(heartbeatPeriod, o.heartbeatPeriod, true) && compareDeep(timeout, o.timeout, true)
2252           && compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true) && compareDeep(maxCount, o.maxCount, true)
2253          ;
2254      }
2255
2256      @Override
2257      public boolean equalsShallow(Base other_) {
2258        if (!super.equalsShallow(other_))
2259          return false;
2260        if (!(other_ instanceof Subscription))
2261          return false;
2262        Subscription o = (Subscription) other_;
2263        return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(topic, o.topic, true)
2264           && compareValues(end, o.end, true) && compareValues(reason, o.reason, true) && compareValues(endpoint, o.endpoint, true)
2265           && compareValues(heartbeatPeriod, o.heartbeatPeriod, true) && compareValues(timeout, o.timeout, true)
2266           && compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true) && compareValues(maxCount, o.maxCount, true)
2267          ;
2268      }
2269
2270      public boolean isEmpty() {
2271        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, status
2272          , topic, contact, end, managingEntity, reason, filterBy, channelType, endpoint
2273          , parameter, heartbeatPeriod, timeout, contentType, content, maxCount);
2274      }
2275
2276  @Override
2277  public ResourceType getResourceType() {
2278    return ResourceType.Subscription;
2279   }
2280
2281 /**
2282   * Search parameter: <b>contact</b>
2283   * <p>
2284   * Description: <b>Contact details for the subscription</b><br>
2285   * Type: <b>token</b><br>
2286   * Path: <b>Subscription.contact</b><br>
2287   * </p>
2288   */
2289  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
2290  public static final String SP_CONTACT = "contact";
2291 /**
2292   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
2293   * <p>
2294   * Description: <b>Contact details for the subscription</b><br>
2295   * Type: <b>token</b><br>
2296   * Path: <b>Subscription.contact</b><br>
2297   * </p>
2298   */
2299  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
2300
2301 /**
2302   * Search parameter: <b>content-level</b>
2303   * <p>
2304   * Description: <b>Content level included in notifications</b><br>
2305   * Type: <b>token</b><br>
2306   * Path: <b>Subscription.content</b><br>
2307   * </p>
2308   */
2309  @SearchParamDefinition(name="content-level", path="Subscription.content", description="Content level included in notifications", type="token" )
2310  public static final String SP_CONTENT_LEVEL = "content-level";
2311 /**
2312   * <b>Fluent Client</b> search parameter constant for <b>content-level</b>
2313   * <p>
2314   * Description: <b>Content level included in notifications</b><br>
2315   * Type: <b>token</b><br>
2316   * Path: <b>Subscription.content</b><br>
2317   * </p>
2318   */
2319  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTENT_LEVEL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTENT_LEVEL);
2320
2321 /**
2322   * Search parameter: <b>filter-value</b>
2323   * <p>
2324   * Description: <b>Filter value used to narrow notifications</b><br>
2325   * Type: <b>string</b><br>
2326   * Path: <b>Subscription.filterBy.value</b><br>
2327   * </p>
2328   */
2329  @SearchParamDefinition(name="filter-value", path="Subscription.filterBy.value", description="Filter value used to narrow notifications", type="string" )
2330  public static final String SP_FILTER_VALUE = "filter-value";
2331 /**
2332   * <b>Fluent Client</b> search parameter constant for <b>filter-value</b>
2333   * <p>
2334   * Description: <b>Filter value used to narrow notifications</b><br>
2335   * Type: <b>string</b><br>
2336   * Path: <b>Subscription.filterBy.value</b><br>
2337   * </p>
2338   */
2339  public static final ca.uhn.fhir.rest.gclient.StringClientParam FILTER_VALUE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_FILTER_VALUE);
2340
2341 /**
2342   * Search parameter: <b>identifier</b>
2343   * <p>
2344   * Description: <b>A subscription identifier</b><br>
2345   * Type: <b>token</b><br>
2346   * Path: <b>Subscription.identifier</b><br>
2347   * </p>
2348   */
2349  @SearchParamDefinition(name="identifier", path="Subscription.identifier", description="A subscription identifier", type="token" )
2350  public static final String SP_IDENTIFIER = "identifier";
2351 /**
2352   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2353   * <p>
2354   * Description: <b>A subscription identifier</b><br>
2355   * Type: <b>token</b><br>
2356   * Path: <b>Subscription.identifier</b><br>
2357   * </p>
2358   */
2359  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2360
2361 /**
2362   * Search parameter: <b>name</b>
2363   * <p>
2364   * Description: <b>A human-readable name</b><br>
2365   * Type: <b>string</b><br>
2366   * Path: <b>Subscription.name</b><br>
2367   * </p>
2368   */
2369  @SearchParamDefinition(name="name", path="Subscription.name", description="A human-readable name", type="string" )
2370  public static final String SP_NAME = "name";
2371 /**
2372   * <b>Fluent Client</b> search parameter constant for <b>name</b>
2373   * <p>
2374   * Description: <b>A human-readable name</b><br>
2375   * Type: <b>string</b><br>
2376   * Path: <b>Subscription.name</b><br>
2377   * </p>
2378   */
2379  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
2380
2381 /**
2382   * Search parameter: <b>owner</b>
2383   * <p>
2384   * Description: <b>The managing entity</b><br>
2385   * Type: <b>reference</b><br>
2386   * Path: <b>Subscription.managingEntity</b><br>
2387   * </p>
2388   */
2389  @SearchParamDefinition(name="owner", path="Subscription.managingEntity", description="The managing entity", type="reference", target={CareTeam.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2390  public static final String SP_OWNER = "owner";
2391 /**
2392   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
2393   * <p>
2394   * Description: <b>The managing entity</b><br>
2395   * Type: <b>reference</b><br>
2396   * Path: <b>Subscription.managingEntity</b><br>
2397   * </p>
2398   */
2399  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
2400
2401/**
2402   * Constant for fluent queries to be used to add include statements. Specifies
2403   * the path value of "<b>Subscription:owner</b>".
2404   */
2405  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Subscription:owner").toLocked();
2406
2407 /**
2408   * Search parameter: <b>payload</b>
2409   * <p>
2410   * Description: <b>The mime-type of notifications</b><br>
2411   * Type: <b>token</b><br>
2412   * Path: <b>Subscription.contentType</b><br>
2413   * </p>
2414   */
2415  @SearchParamDefinition(name="payload", path="Subscription.contentType", description="The mime-type of notifications", type="token" )
2416  public static final String SP_PAYLOAD = "payload";
2417 /**
2418   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
2419   * <p>
2420   * Description: <b>The mime-type of notifications</b><br>
2421   * Type: <b>token</b><br>
2422   * Path: <b>Subscription.contentType</b><br>
2423   * </p>
2424   */
2425  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
2426
2427 /**
2428   * Search parameter: <b>status</b>
2429   * <p>
2430   * Description: <b>The current state of the subscription</b><br>
2431   * Type: <b>token</b><br>
2432   * Path: <b>Subscription.status</b><br>
2433   * </p>
2434   */
2435  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
2436  public static final String SP_STATUS = "status";
2437 /**
2438   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2439   * <p>
2440   * Description: <b>The current state of the subscription</b><br>
2441   * Type: <b>token</b><br>
2442   * Path: <b>Subscription.status</b><br>
2443   * </p>
2444   */
2445  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2446
2447 /**
2448   * Search parameter: <b>topic</b>
2449   * <p>
2450   * Description: <b>The canonical topic url that triggers notifications</b><br>
2451   * Type: <b>uri</b><br>
2452   * Path: <b>Subscription.topic</b><br>
2453   * </p>
2454   */
2455  @SearchParamDefinition(name="topic", path="Subscription.topic", description="The canonical topic url that triggers notifications", type="uri" )
2456  public static final String SP_TOPIC = "topic";
2457 /**
2458   * <b>Fluent Client</b> search parameter constant for <b>topic</b>
2459   * <p>
2460   * Description: <b>The canonical topic url that triggers notifications</b><br>
2461   * Type: <b>uri</b><br>
2462   * Path: <b>Subscription.topic</b><br>
2463   * </p>
2464   */
2465  public static final ca.uhn.fhir.rest.gclient.UriClientParam TOPIC = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_TOPIC);
2466
2467 /**
2468   * Search parameter: <b>type</b>
2469   * <p>
2470   * Description: <b>The type of channel for the sent notifications</b><br>
2471   * Type: <b>token</b><br>
2472   * Path: <b>Subscription.channelType</b><br>
2473   * </p>
2474   */
2475  @SearchParamDefinition(name="type", path="Subscription.channelType", description="The type of channel for the sent notifications", type="token" )
2476  public static final String SP_TYPE = "type";
2477 /**
2478   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2479   * <p>
2480   * Description: <b>The type of channel for the sent notifications</b><br>
2481   * Type: <b>token</b><br>
2482   * Path: <b>Subscription.channelType</b><br>
2483   * </p>
2484   */
2485  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2486
2487 /**
2488   * Search parameter: <b>url</b>
2489   * <p>
2490   * Description: <b>The uri that will receive the notifications</b><br>
2491   * Type: <b>uri</b><br>
2492   * Path: <b>Subscription.endpoint</b><br>
2493   * </p>
2494   */
2495  @SearchParamDefinition(name="url", path="Subscription.endpoint", description="The uri that will receive the notifications", type="uri" )
2496  public static final String SP_URL = "url";
2497 /**
2498   * <b>Fluent Client</b> search parameter constant for <b>url</b>
2499   * <p>
2500   * Description: <b>The uri that will receive the notifications</b><br>
2501   * Type: <b>uri</b><br>
2502   * Path: <b>Subscription.endpoint</b><br>
2503   * </p>
2504   */
2505  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
2506
2507
2508}
2509