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