001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * The subscription resource describes a particular client's request to be notified about a Topic.
072 */
073@ResourceDef(name="Subscription", profile="http://hl7.org/fhir/StructureDefinition/Subscription")
074public class Subscription extends DomainResource {
075
076    public enum SubscriptionFilterByMatchType {
077        /**
078         * Used to match a value according to FHIR Search rules (e.g., Patient/123, Encounter/2002).
079         */
080        EQUAL, 
081        /**
082         * The key value in the topic stream is an active members of the reference set identified by the concept provided as the filter value.
083         */
084        IN, 
085        /**
086         * The key value in the topic stream is NOT an active members of the reference set identified by the concept provided as the filter value.
087         */
088        NOTIN, 
089        /**
090         * The key value is subsumes the value in the filter value.
091         */
092        ABOVE, 
093        /**
094         * The key value is subsumed by the value in the filter value.
095         */
096        BELOW, 
097        /**
098         * added to help the parsers with the generic types
099         */
100        NULL;
101        public static SubscriptionFilterByMatchType fromCode(String codeString) throws FHIRException {
102            if (codeString == null || "".equals(codeString))
103                return null;
104        if ("=".equals(codeString))
105          return EQUAL;
106        if ("in".equals(codeString))
107          return IN;
108        if ("not-in".equals(codeString))
109          return NOTIN;
110        if ("above".equals(codeString))
111          return ABOVE;
112        if ("below".equals(codeString))
113          return BELOW;
114        if (Configuration.isAcceptInvalidEnums())
115          return null;
116        else
117          throw new FHIRException("Unknown SubscriptionFilterByMatchType code '"+codeString+"'");
118        }
119        public String toCode() {
120          switch (this) {
121            case EQUAL: return "=";
122            case IN: return "in";
123            case NOTIN: return "not-in";
124            case ABOVE: return "above";
125            case BELOW: return "below";
126            default: return "?";
127          }
128        }
129        public String getSystem() {
130          switch (this) {
131            case EQUAL: return "http://hl7.org/fhir/subscription-operator";
132            case IN: return "http://hl7.org/fhir/subscription-operator";
133            case NOTIN: return "http://hl7.org/fhir/subscription-operator";
134            case ABOVE: return "http://hl7.org/fhir/subscription-operator";
135            case BELOW: return "http://hl7.org/fhir/subscription-operator";
136            default: return "?";
137          }
138        }
139        public String getDefinition() {
140          switch (this) {
141            case EQUAL: return "Used to match a value according to FHIR Search rules (e.g., Patient/123, Encounter/2002).";
142            case IN: return "The key value in the topic stream is an active members of the reference set identified by the concept provided as the filter value.";
143            case NOTIN: return "The key value in the topic stream is NOT an active members of the reference set identified by the concept provided as the filter value.";
144            case ABOVE: return "The key value is subsumes the value in the filter value.";
145            case BELOW: return "The key value is subsumed by the value in the filter value.";
146            default: return "?";
147          }
148        }
149        public String getDisplay() {
150          switch (this) {
151            case EQUAL: return "=";
152            case IN: return "in";
153            case NOTIN: return "not-in";
154            case ABOVE: return "above";
155            case BELOW: return "below";
156            default: return "?";
157          }
158        }
159    }
160
161  public static class SubscriptionFilterByMatchTypeEnumFactory implements EnumFactory<SubscriptionFilterByMatchType> {
162    public SubscriptionFilterByMatchType fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("=".equals(codeString))
167          return SubscriptionFilterByMatchType.EQUAL;
168        if ("in".equals(codeString))
169          return SubscriptionFilterByMatchType.IN;
170        if ("not-in".equals(codeString))
171          return SubscriptionFilterByMatchType.NOTIN;
172        if ("above".equals(codeString))
173          return SubscriptionFilterByMatchType.ABOVE;
174        if ("below".equals(codeString))
175          return SubscriptionFilterByMatchType.BELOW;
176        throw new IllegalArgumentException("Unknown SubscriptionFilterByMatchType code '"+codeString+"'");
177        }
178        public Enumeration<SubscriptionFilterByMatchType> fromType(Base code) throws FHIRException {
179          if (code == null)
180            return null;
181          if (code.isEmpty())
182            return new Enumeration<SubscriptionFilterByMatchType>(this);
183          String codeString = ((PrimitiveType) code).asStringValue();
184          if (codeString == null || "".equals(codeString))
185            return null;
186        if ("=".equals(codeString))
187          return new Enumeration<SubscriptionFilterByMatchType>(this, SubscriptionFilterByMatchType.EQUAL);
188        if ("in".equals(codeString))
189          return new Enumeration<SubscriptionFilterByMatchType>(this, SubscriptionFilterByMatchType.IN);
190        if ("not-in".equals(codeString))
191          return new Enumeration<SubscriptionFilterByMatchType>(this, SubscriptionFilterByMatchType.NOTIN);
192        if ("above".equals(codeString))
193          return new Enumeration<SubscriptionFilterByMatchType>(this, SubscriptionFilterByMatchType.ABOVE);
194        if ("below".equals(codeString))
195          return new Enumeration<SubscriptionFilterByMatchType>(this, SubscriptionFilterByMatchType.BELOW);
196        throw new FHIRException("Unknown SubscriptionFilterByMatchType code '"+codeString+"'");
197        }
198    public String toCode(SubscriptionFilterByMatchType code) {
199      if (code == SubscriptionFilterByMatchType.EQUAL)
200        return "=";
201      if (code == SubscriptionFilterByMatchType.IN)
202        return "in";
203      if (code == SubscriptionFilterByMatchType.NOTIN)
204        return "not-in";
205      if (code == SubscriptionFilterByMatchType.ABOVE)
206        return "above";
207      if (code == SubscriptionFilterByMatchType.BELOW)
208        return "below";
209      return "?";
210      }
211    public String toSystem(SubscriptionFilterByMatchType code) {
212      return code.getSystem();
213      }
214    }
215
216    public enum SubscriptionPayloadContent {
217        /**
218         * No resource content is transacted in the notification payload.
219         */
220        EMPTY, 
221        /**
222         * Only the resource id is transacted in the notification payload.
223         */
224        IDONLY, 
225        /**
226         * The entire resource is transacted in the notification payload.
227         */
228        FULLRESOURCE, 
229        /**
230         * added to help the parsers with the generic types
231         */
232        NULL;
233        public static SubscriptionPayloadContent fromCode(String codeString) throws FHIRException {
234            if (codeString == null || "".equals(codeString))
235                return null;
236        if ("empty".equals(codeString))
237          return EMPTY;
238        if ("id-only".equals(codeString))
239          return IDONLY;
240        if ("full-resource".equals(codeString))
241          return FULLRESOURCE;
242        if (Configuration.isAcceptInvalidEnums())
243          return null;
244        else
245          throw new FHIRException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
246        }
247        public String toCode() {
248          switch (this) {
249            case EMPTY: return "empty";
250            case IDONLY: return "id-only";
251            case FULLRESOURCE: return "full-resource";
252            default: return "?";
253          }
254        }
255        public String getSystem() {
256          switch (this) {
257            case EMPTY: return "http://hl7.org/fhir/subscription-payload-content";
258            case IDONLY: return "http://hl7.org/fhir/subscription-payload-content";
259            case FULLRESOURCE: return "http://hl7.org/fhir/subscription-payload-content";
260            default: return "?";
261          }
262        }
263        public String getDefinition() {
264          switch (this) {
265            case EMPTY: return "No resource content is transacted in the notification payload.";
266            case IDONLY: return "Only the resource id is transacted in the notification payload.";
267            case FULLRESOURCE: return "The entire resource is transacted in the notification payload.";
268            default: return "?";
269          }
270        }
271        public String getDisplay() {
272          switch (this) {
273            case EMPTY: return "empty";
274            case IDONLY: return "id-only";
275            case FULLRESOURCE: return "full-resource";
276            default: return "?";
277          }
278        }
279    }
280
281  public static class SubscriptionPayloadContentEnumFactory implements EnumFactory<SubscriptionPayloadContent> {
282    public SubscriptionPayloadContent fromCode(String codeString) throws IllegalArgumentException {
283      if (codeString == null || "".equals(codeString))
284            if (codeString == null || "".equals(codeString))
285                return null;
286        if ("empty".equals(codeString))
287          return SubscriptionPayloadContent.EMPTY;
288        if ("id-only".equals(codeString))
289          return SubscriptionPayloadContent.IDONLY;
290        if ("full-resource".equals(codeString))
291          return SubscriptionPayloadContent.FULLRESOURCE;
292        throw new IllegalArgumentException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
293        }
294        public Enumeration<SubscriptionPayloadContent> fromType(Base code) throws FHIRException {
295          if (code == null)
296            return null;
297          if (code.isEmpty())
298            return new Enumeration<SubscriptionPayloadContent>(this);
299          String codeString = ((PrimitiveType) code).asStringValue();
300          if (codeString == null || "".equals(codeString))
301            return null;
302        if ("empty".equals(codeString))
303          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.EMPTY);
304        if ("id-only".equals(codeString))
305          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.IDONLY);
306        if ("full-resource".equals(codeString))
307          return new Enumeration<SubscriptionPayloadContent>(this, SubscriptionPayloadContent.FULLRESOURCE);
308        throw new FHIRException("Unknown SubscriptionPayloadContent code '"+codeString+"'");
309        }
310    public String toCode(SubscriptionPayloadContent code) {
311      if (code == SubscriptionPayloadContent.EMPTY)
312        return "empty";
313      if (code == SubscriptionPayloadContent.IDONLY)
314        return "id-only";
315      if (code == SubscriptionPayloadContent.FULLRESOURCE)
316        return "full-resource";
317      return "?";
318      }
319    public String toSystem(SubscriptionPayloadContent code) {
320      return code.getSystem();
321      }
322    }
323
324    public enum SubscriptionStatus {
325        /**
326         * The client has requested the subscription, and the server has not yet set it up.
327         */
328        REQUESTED, 
329        /**
330         * The subscription is active.
331         */
332        ACTIVE, 
333        /**
334         * The server has an error executing the notification.
335         */
336        ERROR, 
337        /**
338         * Too many errors have occurred or the subscription has expired.
339         */
340        OFF, 
341        /**
342         * added to help the parsers with the generic types
343         */
344        NULL;
345        public static SubscriptionStatus fromCode(String codeString) throws FHIRException {
346            if (codeString == null || "".equals(codeString))
347                return null;
348        if ("requested".equals(codeString))
349          return REQUESTED;
350        if ("active".equals(codeString))
351          return ACTIVE;
352        if ("error".equals(codeString))
353          return ERROR;
354        if ("off".equals(codeString))
355          return OFF;
356        if (Configuration.isAcceptInvalidEnums())
357          return null;
358        else
359          throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'");
360        }
361        public String toCode() {
362          switch (this) {
363            case REQUESTED: return "requested";
364            case ACTIVE: return "active";
365            case ERROR: return "error";
366            case OFF: return "off";
367            default: return "?";
368          }
369        }
370        public String getSystem() {
371          switch (this) {
372            case REQUESTED: return "http://hl7.org/fhir/subscription-status";
373            case ACTIVE: return "http://hl7.org/fhir/subscription-status";
374            case ERROR: return "http://hl7.org/fhir/subscription-status";
375            case OFF: return "http://hl7.org/fhir/subscription-status";
376            default: return "?";
377          }
378        }
379        public String getDefinition() {
380          switch (this) {
381            case REQUESTED: return "The client has requested the subscription, and the server has not yet set it up.";
382            case ACTIVE: return "The subscription is active.";
383            case ERROR: return "The server has an error executing the notification.";
384            case OFF: return "Too many errors have occurred or the subscription has expired.";
385            default: return "?";
386          }
387        }
388        public String getDisplay() {
389          switch (this) {
390            case REQUESTED: return "Requested";
391            case ACTIVE: return "Active";
392            case ERROR: return "Error";
393            case OFF: return "Off";
394            default: return "?";
395          }
396        }
397    }
398
399  public static class SubscriptionStatusEnumFactory implements EnumFactory<SubscriptionStatus> {
400    public SubscriptionStatus fromCode(String codeString) throws IllegalArgumentException {
401      if (codeString == null || "".equals(codeString))
402            if (codeString == null || "".equals(codeString))
403                return null;
404        if ("requested".equals(codeString))
405          return SubscriptionStatus.REQUESTED;
406        if ("active".equals(codeString))
407          return SubscriptionStatus.ACTIVE;
408        if ("error".equals(codeString))
409          return SubscriptionStatus.ERROR;
410        if ("off".equals(codeString))
411          return SubscriptionStatus.OFF;
412        throw new IllegalArgumentException("Unknown SubscriptionStatus code '"+codeString+"'");
413        }
414        public Enumeration<SubscriptionStatus> fromType(Base code) throws FHIRException {
415          if (code == null)
416            return null;
417          if (code.isEmpty())
418            return new Enumeration<SubscriptionStatus>(this);
419          String codeString = ((PrimitiveType) code).asStringValue();
420          if (codeString == null || "".equals(codeString))
421            return null;
422        if ("requested".equals(codeString))
423          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.REQUESTED);
424        if ("active".equals(codeString))
425          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ACTIVE);
426        if ("error".equals(codeString))
427          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ERROR);
428        if ("off".equals(codeString))
429          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.OFF);
430        throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'");
431        }
432    public String toCode(SubscriptionStatus code) {
433      if (code == SubscriptionStatus.REQUESTED)
434        return "requested";
435      if (code == SubscriptionStatus.ACTIVE)
436        return "active";
437      if (code == SubscriptionStatus.ERROR)
438        return "error";
439      if (code == SubscriptionStatus.OFF)
440        return "off";
441      return "?";
442      }
443    public String toSystem(SubscriptionStatus code) {
444      return code.getSystem();
445      }
446    }
447
448    @Block()
449    public static class SubscriptionFilterByComponent extends BackboneElement implements IBaseBackboneElement {
450        /**
451         * The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.
452         */
453        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
454        @Description(shortDefinition="Filter label defined in Topic", formalDefinition="The filter label (=key) as defined in the `Topic.canFilterBy.name`  element." )
455        protected StringType name;
456
457        /**
458         * The operator to apply to the filter value when determining matches (Search modifiers).
459         */
460        @Child(name = "matchType", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
461        @Description(shortDefinition="= | in | not-in | above | below", formalDefinition="The operator to apply to the filter value when determining matches (Search modifiers)." )
462        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-operator")
463        protected Enumeration<SubscriptionFilterByMatchType> matchType;
464
465        /**
466         * The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
467         */
468        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
469        @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\"." )
470        protected StringType value;
471
472        private static final long serialVersionUID = -1805389171L;
473
474    /**
475     * Constructor
476     */
477      public SubscriptionFilterByComponent() {
478        super();
479      }
480
481    /**
482     * Constructor
483     */
484      public SubscriptionFilterByComponent(String name, String value) {
485        super();
486        this.setName(name);
487        this.setValue(value);
488      }
489
490        /**
491         * @return {@link #name} (The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
492         */
493        public StringType getNameElement() { 
494          if (this.name == null)
495            if (Configuration.errorOnAutoCreate())
496              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.name");
497            else if (Configuration.doAutoCreate())
498              this.name = new StringType(); // bb
499          return this.name;
500        }
501
502        public boolean hasNameElement() { 
503          return this.name != null && !this.name.isEmpty();
504        }
505
506        public boolean hasName() { 
507          return this.name != null && !this.name.isEmpty();
508        }
509
510        /**
511         * @param value {@link #name} (The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
512         */
513        public SubscriptionFilterByComponent setNameElement(StringType value) { 
514          this.name = value;
515          return this;
516        }
517
518        /**
519         * @return The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.
520         */
521        public String getName() { 
522          return this.name == null ? null : this.name.getValue();
523        }
524
525        /**
526         * @param value The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.
527         */
528        public SubscriptionFilterByComponent setName(String value) { 
529            if (this.name == null)
530              this.name = new StringType();
531            this.name.setValue(value);
532          return this;
533        }
534
535        /**
536         * @return {@link #matchType} (The operator to apply to the filter value when determining matches (Search modifiers).). This is the underlying object with id, value and extensions. The accessor "getMatchType" gives direct access to the value
537         */
538        public Enumeration<SubscriptionFilterByMatchType> getMatchTypeElement() { 
539          if (this.matchType == null)
540            if (Configuration.errorOnAutoCreate())
541              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.matchType");
542            else if (Configuration.doAutoCreate())
543              this.matchType = new Enumeration<SubscriptionFilterByMatchType>(new SubscriptionFilterByMatchTypeEnumFactory()); // bb
544          return this.matchType;
545        }
546
547        public boolean hasMatchTypeElement() { 
548          return this.matchType != null && !this.matchType.isEmpty();
549        }
550
551        public boolean hasMatchType() { 
552          return this.matchType != null && !this.matchType.isEmpty();
553        }
554
555        /**
556         * @param value {@link #matchType} (The operator to apply to the filter value when determining matches (Search modifiers).). This is the underlying object with id, value and extensions. The accessor "getMatchType" gives direct access to the value
557         */
558        public SubscriptionFilterByComponent setMatchTypeElement(Enumeration<SubscriptionFilterByMatchType> value) { 
559          this.matchType = value;
560          return this;
561        }
562
563        /**
564         * @return The operator to apply to the filter value when determining matches (Search modifiers).
565         */
566        public SubscriptionFilterByMatchType getMatchType() { 
567          return this.matchType == null ? null : this.matchType.getValue();
568        }
569
570        /**
571         * @param value The operator to apply to the filter value when determining matches (Search modifiers).
572         */
573        public SubscriptionFilterByComponent setMatchType(SubscriptionFilterByMatchType value) { 
574          if (value == null)
575            this.matchType = null;
576          else {
577            if (this.matchType == null)
578              this.matchType = new Enumeration<SubscriptionFilterByMatchType>(new SubscriptionFilterByMatchTypeEnumFactory());
579            this.matchType.setValue(value);
580          }
581          return this;
582        }
583
584        /**
585         * @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
586         */
587        public StringType getValueElement() { 
588          if (this.value == null)
589            if (Configuration.errorOnAutoCreate())
590              throw new Error("Attempt to auto-create SubscriptionFilterByComponent.value");
591            else if (Configuration.doAutoCreate())
592              this.value = new StringType(); // bb
593          return this.value;
594        }
595
596        public boolean hasValueElement() { 
597          return this.value != null && !this.value.isEmpty();
598        }
599
600        public boolean hasValue() { 
601          return this.value != null && !this.value.isEmpty();
602        }
603
604        /**
605         * @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
606         */
607        public SubscriptionFilterByComponent setValueElement(StringType value) { 
608          this.value = value;
609          return this;
610        }
611
612        /**
613         * @return The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
614         */
615        public String getValue() { 
616          return this.value == null ? null : this.value.getValue();
617        }
618
619        /**
620         * @param value The literal value or resource path as is legal in search - for example, "Patient/123" or "le1950".
621         */
622        public SubscriptionFilterByComponent setValue(String value) { 
623            if (this.value == null)
624              this.value = new StringType();
625            this.value.setValue(value);
626          return this;
627        }
628
629        protected void listChildren(List<Property> children) {
630          super.listChildren(children);
631          children.add(new Property("name", "string", "The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.", 0, 1, name));
632          children.add(new Property("matchType", "code", "The operator to apply to the filter value when determining matches (Search modifiers).", 0, 1, matchType));
633          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));
634        }
635
636        @Override
637        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
638          switch (_hash) {
639          case 3373707: /*name*/  return new Property("name", "string", "The filter label (=key) as defined in the `Topic.canFilterBy.name`  element.", 0, 1, name);
640          case 614036127: /*matchType*/  return new Property("matchType", "code", "The operator to apply to the filter value when determining matches (Search modifiers).", 0, 1, matchType);
641          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);
642          default: return super.getNamedProperty(_hash, _name, _checkValid);
643          }
644
645        }
646
647      @Override
648      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
649        switch (hash) {
650        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
651        case 614036127: /*matchType*/ return this.matchType == null ? new Base[0] : new Base[] {this.matchType}; // Enumeration<SubscriptionFilterByMatchType>
652        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
653        default: return super.getProperty(hash, name, checkValid);
654        }
655
656      }
657
658      @Override
659      public Base setProperty(int hash, String name, Base value) throws FHIRException {
660        switch (hash) {
661        case 3373707: // name
662          this.name = TypeConvertor.castToString(value); // StringType
663          return value;
664        case 614036127: // matchType
665          value = new SubscriptionFilterByMatchTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
666          this.matchType = (Enumeration) value; // Enumeration<SubscriptionFilterByMatchType>
667          return value;
668        case 111972721: // value
669          this.value = TypeConvertor.castToString(value); // StringType
670          return value;
671        default: return super.setProperty(hash, name, value);
672        }
673
674      }
675
676      @Override
677      public Base setProperty(String name, Base value) throws FHIRException {
678        if (name.equals("name")) {
679          this.name = TypeConvertor.castToString(value); // StringType
680        } else if (name.equals("matchType")) {
681          value = new SubscriptionFilterByMatchTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
682          this.matchType = (Enumeration) value; // Enumeration<SubscriptionFilterByMatchType>
683        } else if (name.equals("value")) {
684          this.value = TypeConvertor.castToString(value); // StringType
685        } else
686          return super.setProperty(name, value);
687        return value;
688      }
689
690      @Override
691      public Base makeProperty(int hash, String name) throws FHIRException {
692        switch (hash) {
693        case 3373707:  return getNameElement();
694        case 614036127:  return getMatchTypeElement();
695        case 111972721:  return getValueElement();
696        default: return super.makeProperty(hash, name);
697        }
698
699      }
700
701      @Override
702      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
703        switch (hash) {
704        case 3373707: /*name*/ return new String[] {"string"};
705        case 614036127: /*matchType*/ return new String[] {"code"};
706        case 111972721: /*value*/ return new String[] {"string"};
707        default: return super.getTypesForProperty(hash, name);
708        }
709
710      }
711
712      @Override
713      public Base addChild(String name) throws FHIRException {
714        if (name.equals("name")) {
715          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.name");
716        }
717        else if (name.equals("matchType")) {
718          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.matchType");
719        }
720        else if (name.equals("value")) {
721          throw new FHIRException("Cannot call addChild on a primitive type Subscription.filterBy.value");
722        }
723        else
724          return super.addChild(name);
725      }
726
727      public SubscriptionFilterByComponent copy() {
728        SubscriptionFilterByComponent dst = new SubscriptionFilterByComponent();
729        copyValues(dst);
730        return dst;
731      }
732
733      public void copyValues(SubscriptionFilterByComponent dst) {
734        super.copyValues(dst);
735        dst.name = name == null ? null : name.copy();
736        dst.matchType = matchType == null ? null : matchType.copy();
737        dst.value = value == null ? null : value.copy();
738      }
739
740      @Override
741      public boolean equalsDeep(Base other_) {
742        if (!super.equalsDeep(other_))
743          return false;
744        if (!(other_ instanceof SubscriptionFilterByComponent))
745          return false;
746        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
747        return compareDeep(name, o.name, true) && compareDeep(matchType, o.matchType, true) && compareDeep(value, o.value, true)
748          ;
749      }
750
751      @Override
752      public boolean equalsShallow(Base other_) {
753        if (!super.equalsShallow(other_))
754          return false;
755        if (!(other_ instanceof SubscriptionFilterByComponent))
756          return false;
757        SubscriptionFilterByComponent o = (SubscriptionFilterByComponent) other_;
758        return compareValues(name, o.name, true) && compareValues(matchType, o.matchType, true) && compareValues(value, o.value, true)
759          ;
760      }
761
762      public boolean isEmpty() {
763        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, matchType, value);
764      }
765
766  public String fhirType() {
767    return "Subscription.filterBy";
768
769  }
770
771  }
772
773    @Block()
774    public static class SubscriptionChannelComponent extends BackboneElement implements IBaseBackboneElement {
775        /**
776         * The type of channel to send notifications on.
777         */
778        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
779        @Description(shortDefinition="rest-hook | websocket | email | message", formalDefinition="The type of channel to send notifications on." )
780        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
781        protected CodeableConcept type;
782
783        /**
784         * The url that describes the actual end-point to send messages to.
785         */
786        @Child(name = "endpoint", type = {UrlType.class}, order=2, min=0, max=1, modifier=false, summary=true)
787        @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." )
788        protected UrlType endpoint;
789
790        /**
791         * Additional headers / information to send as part of the notification.
792         */
793        @Child(name = "header", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
794        @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
795        protected List<StringType> header;
796
797        /**
798         * If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
799         */
800        @Child(name = "heartbeatPeriod", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=true)
801        @Description(shortDefinition="Interval in seconds to send 'heartbeat' notification", formalDefinition="If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent." )
802        protected UnsignedIntType heartbeatPeriod;
803
804        /**
805         * The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification.
806         */
807        @Child(name = "payload", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
808        @Description(shortDefinition="Payload definition", formalDefinition="The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification." )
809        protected SubscriptionChannelPayloadComponent payload;
810
811        private static final long serialVersionUID = -1807149281L;
812
813    /**
814     * Constructor
815     */
816      public SubscriptionChannelComponent() {
817        super();
818      }
819
820    /**
821     * Constructor
822     */
823      public SubscriptionChannelComponent(CodeableConcept type) {
824        super();
825        this.setType(type);
826      }
827
828        /**
829         * @return {@link #type} (The type of channel to send notifications on.)
830         */
831        public CodeableConcept getType() { 
832          if (this.type == null)
833            if (Configuration.errorOnAutoCreate())
834              throw new Error("Attempt to auto-create SubscriptionChannelComponent.type");
835            else if (Configuration.doAutoCreate())
836              this.type = new CodeableConcept(); // cc
837          return this.type;
838        }
839
840        public boolean hasType() { 
841          return this.type != null && !this.type.isEmpty();
842        }
843
844        /**
845         * @param value {@link #type} (The type of channel to send notifications on.)
846         */
847        public SubscriptionChannelComponent setType(CodeableConcept value) { 
848          this.type = value;
849          return this;
850        }
851
852        /**
853         * @return {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
854         */
855        public UrlType getEndpointElement() { 
856          if (this.endpoint == null)
857            if (Configuration.errorOnAutoCreate())
858              throw new Error("Attempt to auto-create SubscriptionChannelComponent.endpoint");
859            else if (Configuration.doAutoCreate())
860              this.endpoint = new UrlType(); // bb
861          return this.endpoint;
862        }
863
864        public boolean hasEndpointElement() { 
865          return this.endpoint != null && !this.endpoint.isEmpty();
866        }
867
868        public boolean hasEndpoint() { 
869          return this.endpoint != null && !this.endpoint.isEmpty();
870        }
871
872        /**
873         * @param value {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
874         */
875        public SubscriptionChannelComponent setEndpointElement(UrlType value) { 
876          this.endpoint = value;
877          return this;
878        }
879
880        /**
881         * @return The url that describes the actual end-point to send messages to.
882         */
883        public String getEndpoint() { 
884          return this.endpoint == null ? null : this.endpoint.getValue();
885        }
886
887        /**
888         * @param value The url that describes the actual end-point to send messages to.
889         */
890        public SubscriptionChannelComponent setEndpoint(String value) { 
891          if (Utilities.noString(value))
892            this.endpoint = null;
893          else {
894            if (this.endpoint == null)
895              this.endpoint = new UrlType();
896            this.endpoint.setValue(value);
897          }
898          return this;
899        }
900
901        /**
902         * @return {@link #header} (Additional headers / information to send as part of the notification.)
903         */
904        public List<StringType> getHeader() { 
905          if (this.header == null)
906            this.header = new ArrayList<StringType>();
907          return this.header;
908        }
909
910        /**
911         * @return Returns a reference to <code>this</code> for easy method chaining
912         */
913        public SubscriptionChannelComponent setHeader(List<StringType> theHeader) { 
914          this.header = theHeader;
915          return this;
916        }
917
918        public boolean hasHeader() { 
919          if (this.header == null)
920            return false;
921          for (StringType item : this.header)
922            if (!item.isEmpty())
923              return true;
924          return false;
925        }
926
927        /**
928         * @return {@link #header} (Additional headers / information to send as part of the notification.)
929         */
930        public StringType addHeaderElement() {//2 
931          StringType t = new StringType();
932          if (this.header == null)
933            this.header = new ArrayList<StringType>();
934          this.header.add(t);
935          return t;
936        }
937
938        /**
939         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
940         */
941        public SubscriptionChannelComponent addHeader(String value) { //1
942          StringType t = new StringType();
943          t.setValue(value);
944          if (this.header == null)
945            this.header = new ArrayList<StringType>();
946          this.header.add(t);
947          return this;
948        }
949
950        /**
951         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
952         */
953        public boolean hasHeader(String value) { 
954          if (this.header == null)
955            return false;
956          for (StringType v : this.header)
957            if (v.getValue().equals(value)) // string
958              return true;
959          return false;
960        }
961
962        /**
963         * @return {@link #heartbeatPeriod} (If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.). This is the underlying object with id, value and extensions. The accessor "getHeartbeatPeriod" gives direct access to the value
964         */
965        public UnsignedIntType getHeartbeatPeriodElement() { 
966          if (this.heartbeatPeriod == null)
967            if (Configuration.errorOnAutoCreate())
968              throw new Error("Attempt to auto-create SubscriptionChannelComponent.heartbeatPeriod");
969            else if (Configuration.doAutoCreate())
970              this.heartbeatPeriod = new UnsignedIntType(); // bb
971          return this.heartbeatPeriod;
972        }
973
974        public boolean hasHeartbeatPeriodElement() { 
975          return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
976        }
977
978        public boolean hasHeartbeatPeriod() { 
979          return this.heartbeatPeriod != null && !this.heartbeatPeriod.isEmpty();
980        }
981
982        /**
983         * @param value {@link #heartbeatPeriod} (If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.). This is the underlying object with id, value and extensions. The accessor "getHeartbeatPeriod" gives direct access to the value
984         */
985        public SubscriptionChannelComponent setHeartbeatPeriodElement(UnsignedIntType value) { 
986          this.heartbeatPeriod = value;
987          return this;
988        }
989
990        /**
991         * @return If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
992         */
993        public int getHeartbeatPeriod() { 
994          return this.heartbeatPeriod == null || this.heartbeatPeriod.isEmpty() ? 0 : this.heartbeatPeriod.getValue();
995        }
996
997        /**
998         * @param value If present,  a 'hearbeat" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.
999         */
1000        public SubscriptionChannelComponent setHeartbeatPeriod(int value) { 
1001            if (this.heartbeatPeriod == null)
1002              this.heartbeatPeriod = new UnsignedIntType();
1003            this.heartbeatPeriod.setValue(value);
1004          return this;
1005        }
1006
1007        /**
1008         * @return {@link #payload} (The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification.)
1009         */
1010        public SubscriptionChannelPayloadComponent getPayload() { 
1011          if (this.payload == null)
1012            if (Configuration.errorOnAutoCreate())
1013              throw new Error("Attempt to auto-create SubscriptionChannelComponent.payload");
1014            else if (Configuration.doAutoCreate())
1015              this.payload = new SubscriptionChannelPayloadComponent(); // cc
1016          return this.payload;
1017        }
1018
1019        public boolean hasPayload() { 
1020          return this.payload != null && !this.payload.isEmpty();
1021        }
1022
1023        /**
1024         * @param value {@link #payload} (The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification.)
1025         */
1026        public SubscriptionChannelComponent setPayload(SubscriptionChannelPayloadComponent value) { 
1027          this.payload = value;
1028          return this;
1029        }
1030
1031        protected void listChildren(List<Property> children) {
1032          super.listChildren(children);
1033          children.add(new Property("type", "CodeableConcept", "The type of channel to send notifications on.", 0, 1, type));
1034          children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint));
1035          children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
1036          children.add(new Property("heartbeatPeriod", "unsignedInt", "If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod));
1037          children.add(new Property("payload", "", "The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification.", 0, 1, payload));
1038        }
1039
1040        @Override
1041        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1042          switch (_hash) {
1043          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of channel to send notifications on.", 0, 1, type);
1044          case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint);
1045          case -1221270899: /*header*/  return new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header);
1046          case -938465827: /*heartbeatPeriod*/  return new Property("heartbeatPeriod", "unsignedInt", "If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.", 0, 1, heartbeatPeriod);
1047          case -786701938: /*payload*/  return new Property("payload", "", "The payload mimetype and content.  If the payload is not present, then there is no payload in the notification, just a notification.", 0, 1, payload);
1048          default: return super.getNamedProperty(_hash, _name, _checkValid);
1049          }
1050
1051        }
1052
1053      @Override
1054      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1055        switch (hash) {
1056        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1057        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
1058        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
1059        case -938465827: /*heartbeatPeriod*/ return this.heartbeatPeriod == null ? new Base[0] : new Base[] {this.heartbeatPeriod}; // UnsignedIntType
1060        case -786701938: /*payload*/ return this.payload == null ? new Base[0] : new Base[] {this.payload}; // SubscriptionChannelPayloadComponent
1061        default: return super.getProperty(hash, name, checkValid);
1062        }
1063
1064      }
1065
1066      @Override
1067      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1068        switch (hash) {
1069        case 3575610: // type
1070          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1071          return value;
1072        case 1741102485: // endpoint
1073          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1074          return value;
1075        case -1221270899: // header
1076          this.getHeader().add(TypeConvertor.castToString(value)); // StringType
1077          return value;
1078        case -938465827: // heartbeatPeriod
1079          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1080          return value;
1081        case -786701938: // payload
1082          this.payload = (SubscriptionChannelPayloadComponent) value; // SubscriptionChannelPayloadComponent
1083          return value;
1084        default: return super.setProperty(hash, name, value);
1085        }
1086
1087      }
1088
1089      @Override
1090      public Base setProperty(String name, Base value) throws FHIRException {
1091        if (name.equals("type")) {
1092          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1093        } else if (name.equals("endpoint")) {
1094          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
1095        } else if (name.equals("header")) {
1096          this.getHeader().add(TypeConvertor.castToString(value));
1097        } else if (name.equals("heartbeatPeriod")) {
1098          this.heartbeatPeriod = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1099        } else if (name.equals("payload")) {
1100          this.payload = (SubscriptionChannelPayloadComponent) value; // SubscriptionChannelPayloadComponent
1101        } else
1102          return super.setProperty(name, value);
1103        return value;
1104      }
1105
1106      @Override
1107      public Base makeProperty(int hash, String name) throws FHIRException {
1108        switch (hash) {
1109        case 3575610:  return getType();
1110        case 1741102485:  return getEndpointElement();
1111        case -1221270899:  return addHeaderElement();
1112        case -938465827:  return getHeartbeatPeriodElement();
1113        case -786701938:  return getPayload();
1114        default: return super.makeProperty(hash, name);
1115        }
1116
1117      }
1118
1119      @Override
1120      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1121        switch (hash) {
1122        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1123        case 1741102485: /*endpoint*/ return new String[] {"url"};
1124        case -1221270899: /*header*/ return new String[] {"string"};
1125        case -938465827: /*heartbeatPeriod*/ return new String[] {"unsignedInt"};
1126        case -786701938: /*payload*/ return new String[] {};
1127        default: return super.getTypesForProperty(hash, name);
1128        }
1129
1130      }
1131
1132      @Override
1133      public Base addChild(String name) throws FHIRException {
1134        if (name.equals("type")) {
1135          this.type = new CodeableConcept();
1136          return this.type;
1137        }
1138        else if (name.equals("endpoint")) {
1139          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.endpoint");
1140        }
1141        else if (name.equals("header")) {
1142          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.header");
1143        }
1144        else if (name.equals("heartbeatPeriod")) {
1145          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.heartbeatPeriod");
1146        }
1147        else if (name.equals("payload")) {
1148          this.payload = new SubscriptionChannelPayloadComponent();
1149          return this.payload;
1150        }
1151        else
1152          return super.addChild(name);
1153      }
1154
1155      public SubscriptionChannelComponent copy() {
1156        SubscriptionChannelComponent dst = new SubscriptionChannelComponent();
1157        copyValues(dst);
1158        return dst;
1159      }
1160
1161      public void copyValues(SubscriptionChannelComponent dst) {
1162        super.copyValues(dst);
1163        dst.type = type == null ? null : type.copy();
1164        dst.endpoint = endpoint == null ? null : endpoint.copy();
1165        if (header != null) {
1166          dst.header = new ArrayList<StringType>();
1167          for (StringType i : header)
1168            dst.header.add(i.copy());
1169        };
1170        dst.heartbeatPeriod = heartbeatPeriod == null ? null : heartbeatPeriod.copy();
1171        dst.payload = payload == null ? null : payload.copy();
1172      }
1173
1174      @Override
1175      public boolean equalsDeep(Base other_) {
1176        if (!super.equalsDeep(other_))
1177          return false;
1178        if (!(other_ instanceof SubscriptionChannelComponent))
1179          return false;
1180        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
1181        return compareDeep(type, o.type, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(header, o.header, true)
1182           && compareDeep(heartbeatPeriod, o.heartbeatPeriod, true) && compareDeep(payload, o.payload, true)
1183          ;
1184      }
1185
1186      @Override
1187      public boolean equalsShallow(Base other_) {
1188        if (!super.equalsShallow(other_))
1189          return false;
1190        if (!(other_ instanceof SubscriptionChannelComponent))
1191          return false;
1192        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
1193        return compareValues(endpoint, o.endpoint, true) && compareValues(header, o.header, true) && compareValues(heartbeatPeriod, o.heartbeatPeriod, true)
1194          ;
1195      }
1196
1197      public boolean isEmpty() {
1198        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, endpoint, header, heartbeatPeriod
1199          , payload);
1200      }
1201
1202  public String fhirType() {
1203    return "Subscription.channel";
1204
1205  }
1206
1207  }
1208
1209    @Block()
1210    public static class SubscriptionChannelPayloadComponent extends BackboneElement implements IBaseBackboneElement {
1211        /**
1212         * The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
1213         */
1214        @Child(name = "contentType", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1215        @Description(shortDefinition="MIME type to send, or omit for no payload", formalDefinition="The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions." )
1216        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
1217        protected CodeType contentType;
1218
1219        /**
1220         * 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.
1221         */
1222        @Child(name = "content", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1223        @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." )
1224        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-payload-content")
1225        protected Enumeration<SubscriptionPayloadContent> content;
1226
1227        private static final long serialVersionUID = -1128800132L;
1228
1229    /**
1230     * Constructor
1231     */
1232      public SubscriptionChannelPayloadComponent() {
1233        super();
1234      }
1235
1236        /**
1237         * @return {@link #contentType} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1238         */
1239        public CodeType getContentTypeElement() { 
1240          if (this.contentType == null)
1241            if (Configuration.errorOnAutoCreate())
1242              throw new Error("Attempt to auto-create SubscriptionChannelPayloadComponent.contentType");
1243            else if (Configuration.doAutoCreate())
1244              this.contentType = new CodeType(); // bb
1245          return this.contentType;
1246        }
1247
1248        public boolean hasContentTypeElement() { 
1249          return this.contentType != null && !this.contentType.isEmpty();
1250        }
1251
1252        public boolean hasContentType() { 
1253          return this.contentType != null && !this.contentType.isEmpty();
1254        }
1255
1256        /**
1257         * @param value {@link #contentType} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
1258         */
1259        public SubscriptionChannelPayloadComponent setContentTypeElement(CodeType value) { 
1260          this.contentType = value;
1261          return this;
1262        }
1263
1264        /**
1265         * @return The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
1266         */
1267        public String getContentType() { 
1268          return this.contentType == null ? null : this.contentType.getValue();
1269        }
1270
1271        /**
1272         * @param value The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types "text/plain" and "text/html" may also be used for Email subscriptions.
1273         */
1274        public SubscriptionChannelPayloadComponent setContentType(String value) { 
1275          if (Utilities.noString(value))
1276            this.contentType = null;
1277          else {
1278            if (this.contentType == null)
1279              this.contentType = new CodeType();
1280            this.contentType.setValue(value);
1281          }
1282          return this;
1283        }
1284
1285        /**
1286         * @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
1287         */
1288        public Enumeration<SubscriptionPayloadContent> getContentElement() { 
1289          if (this.content == null)
1290            if (Configuration.errorOnAutoCreate())
1291              throw new Error("Attempt to auto-create SubscriptionChannelPayloadComponent.content");
1292            else if (Configuration.doAutoCreate())
1293              this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory()); // bb
1294          return this.content;
1295        }
1296
1297        public boolean hasContentElement() { 
1298          return this.content != null && !this.content.isEmpty();
1299        }
1300
1301        public boolean hasContent() { 
1302          return this.content != null && !this.content.isEmpty();
1303        }
1304
1305        /**
1306         * @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
1307         */
1308        public SubscriptionChannelPayloadComponent setContentElement(Enumeration<SubscriptionPayloadContent> value) { 
1309          this.content = value;
1310          return this;
1311        }
1312
1313        /**
1314         * @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.
1315         */
1316        public SubscriptionPayloadContent getContent() { 
1317          return this.content == null ? null : this.content.getValue();
1318        }
1319
1320        /**
1321         * @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.
1322         */
1323        public SubscriptionChannelPayloadComponent setContent(SubscriptionPayloadContent value) { 
1324          if (value == null)
1325            this.content = null;
1326          else {
1327            if (this.content == null)
1328              this.content = new Enumeration<SubscriptionPayloadContent>(new SubscriptionPayloadContentEnumFactory());
1329            this.content.setValue(value);
1330          }
1331          return this;
1332        }
1333
1334        protected void listChildren(List<Property> children) {
1335          super.listChildren(children);
1336          children.add(new Property("contentType", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions.", 0, 1, contentType));
1337          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));
1338        }
1339
1340        @Override
1341        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1342          switch (_hash) {
1343          case -389131437: /*contentType*/  return new Property("contentType", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions.", 0, 1, contentType);
1344          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);
1345          default: return super.getNamedProperty(_hash, _name, _checkValid);
1346          }
1347
1348        }
1349
1350      @Override
1351      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1352        switch (hash) {
1353        case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
1354        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Enumeration<SubscriptionPayloadContent>
1355        default: return super.getProperty(hash, name, checkValid);
1356        }
1357
1358      }
1359
1360      @Override
1361      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1362        switch (hash) {
1363        case -389131437: // contentType
1364          this.contentType = TypeConvertor.castToCode(value); // CodeType
1365          return value;
1366        case 951530617: // content
1367          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1368          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1369          return value;
1370        default: return super.setProperty(hash, name, value);
1371        }
1372
1373      }
1374
1375      @Override
1376      public Base setProperty(String name, Base value) throws FHIRException {
1377        if (name.equals("contentType")) {
1378          this.contentType = TypeConvertor.castToCode(value); // CodeType
1379        } else if (name.equals("content")) {
1380          value = new SubscriptionPayloadContentEnumFactory().fromType(TypeConvertor.castToCode(value));
1381          this.content = (Enumeration) value; // Enumeration<SubscriptionPayloadContent>
1382        } else
1383          return super.setProperty(name, value);
1384        return value;
1385      }
1386
1387      @Override
1388      public Base makeProperty(int hash, String name) throws FHIRException {
1389        switch (hash) {
1390        case -389131437:  return getContentTypeElement();
1391        case 951530617:  return getContentElement();
1392        default: return super.makeProperty(hash, name);
1393        }
1394
1395      }
1396
1397      @Override
1398      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1399        switch (hash) {
1400        case -389131437: /*contentType*/ return new String[] {"code"};
1401        case 951530617: /*content*/ return new String[] {"code"};
1402        default: return super.getTypesForProperty(hash, name);
1403        }
1404
1405      }
1406
1407      @Override
1408      public Base addChild(String name) throws FHIRException {
1409        if (name.equals("contentType")) {
1410          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.payload.contentType");
1411        }
1412        else if (name.equals("content")) {
1413          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.payload.content");
1414        }
1415        else
1416          return super.addChild(name);
1417      }
1418
1419      public SubscriptionChannelPayloadComponent copy() {
1420        SubscriptionChannelPayloadComponent dst = new SubscriptionChannelPayloadComponent();
1421        copyValues(dst);
1422        return dst;
1423      }
1424
1425      public void copyValues(SubscriptionChannelPayloadComponent dst) {
1426        super.copyValues(dst);
1427        dst.contentType = contentType == null ? null : contentType.copy();
1428        dst.content = content == null ? null : content.copy();
1429      }
1430
1431      @Override
1432      public boolean equalsDeep(Base other_) {
1433        if (!super.equalsDeep(other_))
1434          return false;
1435        if (!(other_ instanceof SubscriptionChannelPayloadComponent))
1436          return false;
1437        SubscriptionChannelPayloadComponent o = (SubscriptionChannelPayloadComponent) other_;
1438        return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true);
1439      }
1440
1441      @Override
1442      public boolean equalsShallow(Base other_) {
1443        if (!super.equalsShallow(other_))
1444          return false;
1445        if (!(other_ instanceof SubscriptionChannelPayloadComponent))
1446          return false;
1447        SubscriptionChannelPayloadComponent o = (SubscriptionChannelPayloadComponent) other_;
1448        return compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true);
1449      }
1450
1451      public boolean isEmpty() {
1452        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(contentType, content);
1453      }
1454
1455  public String fhirType() {
1456    return "Subscription.channel.payload";
1457
1458  }
1459
1460  }
1461
1462    /**
1463     * 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.
1464     */
1465    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1466    @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." )
1467    protected List<Identifier> identifier;
1468
1469    /**
1470     * A natural language name identifying the subscription.
1471     */
1472    @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1473    @Description(shortDefinition="Human readable name for this subscription", formalDefinition="A natural language name identifying the subscription." )
1474    protected StringType name;
1475
1476    /**
1477     * The status of the subscription, which marks the server state for managing the subscription.
1478     */
1479    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1480    @Description(shortDefinition="requested | active | error | off", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." )
1481    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status")
1482    protected Enumeration<SubscriptionStatus> status;
1483
1484    /**
1485     * The reference to the topic to be notified about.
1486     */
1487    @Child(name = "topic", type = {Topic.class}, order=3, min=1, max=1, modifier=false, summary=true)
1488    @Description(shortDefinition="Reference to the topic being subscribed to", formalDefinition="The reference to the topic to be notified about." )
1489    protected Reference topic;
1490
1491    /**
1492     * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.
1493     */
1494    @Child(name = "contact", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1495    @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." )
1496    protected List<ContactPoint> contact;
1497
1498    /**
1499     * The time for the server to turn the subscription off.
1500     */
1501    @Child(name = "end", type = {InstantType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1502    @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." )
1503    protected InstantType end;
1504
1505    /**
1506     * A description of why this subscription is defined.
1507     */
1508    @Child(name = "reason", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1509    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
1510    protected StringType reason;
1511
1512    /**
1513     * The filter properties to be applied to narrow the topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).
1514     */
1515    @Child(name = "filterBy", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1516    @Description(shortDefinition="Criteria for narrowing the topic stream", formalDefinition="The filter properties to be applied to narrow the topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND)." )
1517    protected List<SubscriptionFilterByComponent> filterBy;
1518
1519    /**
1520     * A record of the last error that occurred when the server processed a notification.
1521     */
1522    @Child(name = "error", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1523    @Description(shortDefinition="Latest error code or note", formalDefinition="A record of the last error that occurred when the server processed a notification." )
1524    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-error")
1525    protected List<CodeableConcept> error;
1526
1527    /**
1528     * A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an "active" or "error" state -- not "requested" or "off").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.
1529     */
1530    @Child(name = "eventCount", type = {UnsignedIntType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1531    @Description(shortDefinition="Notification event counter", formalDefinition="A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an \"active\" or \"error\" state -- not \"requested\" or \"off\").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values." )
1532    protected UnsignedIntType eventCount;
1533
1534    /**
1535     * Details where to send notifications when resources are received that meet the criteria.
1536     */
1537    @Child(name = "channel", type = {}, order=10, min=1, max=1, modifier=false, summary=true)
1538    @Description(shortDefinition="The channel on which to report matches to the criteria", formalDefinition="Details where to send notifications when resources are received that meet the criteria." )
1539    protected SubscriptionChannelComponent channel;
1540
1541    private static final long serialVersionUID = -1374014223L;
1542
1543  /**
1544   * Constructor
1545   */
1546    public Subscription() {
1547      super();
1548    }
1549
1550  /**
1551   * Constructor
1552   */
1553    public Subscription(SubscriptionStatus status, Reference topic, SubscriptionChannelComponent channel) {
1554      super();
1555      this.setStatus(status);
1556      this.setTopic(topic);
1557      this.setChannel(channel);
1558    }
1559
1560    /**
1561     * @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.)
1562     */
1563    public List<Identifier> getIdentifier() { 
1564      if (this.identifier == null)
1565        this.identifier = new ArrayList<Identifier>();
1566      return this.identifier;
1567    }
1568
1569    /**
1570     * @return Returns a reference to <code>this</code> for easy method chaining
1571     */
1572    public Subscription setIdentifier(List<Identifier> theIdentifier) { 
1573      this.identifier = theIdentifier;
1574      return this;
1575    }
1576
1577    public boolean hasIdentifier() { 
1578      if (this.identifier == null)
1579        return false;
1580      for (Identifier item : this.identifier)
1581        if (!item.isEmpty())
1582          return true;
1583      return false;
1584    }
1585
1586    public Identifier addIdentifier() { //3
1587      Identifier t = new Identifier();
1588      if (this.identifier == null)
1589        this.identifier = new ArrayList<Identifier>();
1590      this.identifier.add(t);
1591      return t;
1592    }
1593
1594    public Subscription addIdentifier(Identifier t) { //3
1595      if (t == null)
1596        return this;
1597      if (this.identifier == null)
1598        this.identifier = new ArrayList<Identifier>();
1599      this.identifier.add(t);
1600      return this;
1601    }
1602
1603    /**
1604     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1605     */
1606    public Identifier getIdentifierFirstRep() { 
1607      if (getIdentifier().isEmpty()) {
1608        addIdentifier();
1609      }
1610      return getIdentifier().get(0);
1611    }
1612
1613    /**
1614     * @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
1615     */
1616    public StringType getNameElement() { 
1617      if (this.name == null)
1618        if (Configuration.errorOnAutoCreate())
1619          throw new Error("Attempt to auto-create Subscription.name");
1620        else if (Configuration.doAutoCreate())
1621          this.name = new StringType(); // bb
1622      return this.name;
1623    }
1624
1625    public boolean hasNameElement() { 
1626      return this.name != null && !this.name.isEmpty();
1627    }
1628
1629    public boolean hasName() { 
1630      return this.name != null && !this.name.isEmpty();
1631    }
1632
1633    /**
1634     * @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
1635     */
1636    public Subscription setNameElement(StringType value) { 
1637      this.name = value;
1638      return this;
1639    }
1640
1641    /**
1642     * @return A natural language name identifying the subscription.
1643     */
1644    public String getName() { 
1645      return this.name == null ? null : this.name.getValue();
1646    }
1647
1648    /**
1649     * @param value A natural language name identifying the subscription.
1650     */
1651    public Subscription setName(String value) { 
1652      if (Utilities.noString(value))
1653        this.name = null;
1654      else {
1655        if (this.name == null)
1656          this.name = new StringType();
1657        this.name.setValue(value);
1658      }
1659      return this;
1660    }
1661
1662    /**
1663     * @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
1664     */
1665    public Enumeration<SubscriptionStatus> getStatusElement() { 
1666      if (this.status == null)
1667        if (Configuration.errorOnAutoCreate())
1668          throw new Error("Attempt to auto-create Subscription.status");
1669        else if (Configuration.doAutoCreate())
1670          this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); // bb
1671      return this.status;
1672    }
1673
1674    public boolean hasStatusElement() { 
1675      return this.status != null && !this.status.isEmpty();
1676    }
1677
1678    public boolean hasStatus() { 
1679      return this.status != null && !this.status.isEmpty();
1680    }
1681
1682    /**
1683     * @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
1684     */
1685    public Subscription setStatusElement(Enumeration<SubscriptionStatus> value) { 
1686      this.status = value;
1687      return this;
1688    }
1689
1690    /**
1691     * @return The status of the subscription, which marks the server state for managing the subscription.
1692     */
1693    public SubscriptionStatus getStatus() { 
1694      return this.status == null ? null : this.status.getValue();
1695    }
1696
1697    /**
1698     * @param value The status of the subscription, which marks the server state for managing the subscription.
1699     */
1700    public Subscription setStatus(SubscriptionStatus value) { 
1701        if (this.status == null)
1702          this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory());
1703        this.status.setValue(value);
1704      return this;
1705    }
1706
1707    /**
1708     * @return {@link #topic} (The reference to the topic to be notified about.)
1709     */
1710    public Reference getTopic() { 
1711      if (this.topic == null)
1712        if (Configuration.errorOnAutoCreate())
1713          throw new Error("Attempt to auto-create Subscription.topic");
1714        else if (Configuration.doAutoCreate())
1715          this.topic = new Reference(); // cc
1716      return this.topic;
1717    }
1718
1719    public boolean hasTopic() { 
1720      return this.topic != null && !this.topic.isEmpty();
1721    }
1722
1723    /**
1724     * @param value {@link #topic} (The reference to the topic to be notified about.)
1725     */
1726    public Subscription setTopic(Reference value) { 
1727      this.topic = value;
1728      return this;
1729    }
1730
1731    /**
1732     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
1733     */
1734    public List<ContactPoint> getContact() { 
1735      if (this.contact == null)
1736        this.contact = new ArrayList<ContactPoint>();
1737      return this.contact;
1738    }
1739
1740    /**
1741     * @return Returns a reference to <code>this</code> for easy method chaining
1742     */
1743    public Subscription setContact(List<ContactPoint> theContact) { 
1744      this.contact = theContact;
1745      return this;
1746    }
1747
1748    public boolean hasContact() { 
1749      if (this.contact == null)
1750        return false;
1751      for (ContactPoint item : this.contact)
1752        if (!item.isEmpty())
1753          return true;
1754      return false;
1755    }
1756
1757    public ContactPoint addContact() { //3
1758      ContactPoint t = new ContactPoint();
1759      if (this.contact == null)
1760        this.contact = new ArrayList<ContactPoint>();
1761      this.contact.add(t);
1762      return t;
1763    }
1764
1765    public Subscription addContact(ContactPoint t) { //3
1766      if (t == null)
1767        return this;
1768      if (this.contact == null)
1769        this.contact = new ArrayList<ContactPoint>();
1770      this.contact.add(t);
1771      return this;
1772    }
1773
1774    /**
1775     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
1776     */
1777    public ContactPoint getContactFirstRep() { 
1778      if (getContact().isEmpty()) {
1779        addContact();
1780      }
1781      return getContact().get(0);
1782    }
1783
1784    /**
1785     * @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
1786     */
1787    public InstantType getEndElement() { 
1788      if (this.end == null)
1789        if (Configuration.errorOnAutoCreate())
1790          throw new Error("Attempt to auto-create Subscription.end");
1791        else if (Configuration.doAutoCreate())
1792          this.end = new InstantType(); // bb
1793      return this.end;
1794    }
1795
1796    public boolean hasEndElement() { 
1797      return this.end != null && !this.end.isEmpty();
1798    }
1799
1800    public boolean hasEnd() { 
1801      return this.end != null && !this.end.isEmpty();
1802    }
1803
1804    /**
1805     * @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
1806     */
1807    public Subscription setEndElement(InstantType value) { 
1808      this.end = value;
1809      return this;
1810    }
1811
1812    /**
1813     * @return The time for the server to turn the subscription off.
1814     */
1815    public Date getEnd() { 
1816      return this.end == null ? null : this.end.getValue();
1817    }
1818
1819    /**
1820     * @param value The time for the server to turn the subscription off.
1821     */
1822    public Subscription setEnd(Date value) { 
1823      if (value == null)
1824        this.end = null;
1825      else {
1826        if (this.end == null)
1827          this.end = new InstantType();
1828        this.end.setValue(value);
1829      }
1830      return this;
1831    }
1832
1833    /**
1834     * @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
1835     */
1836    public StringType getReasonElement() { 
1837      if (this.reason == null)
1838        if (Configuration.errorOnAutoCreate())
1839          throw new Error("Attempt to auto-create Subscription.reason");
1840        else if (Configuration.doAutoCreate())
1841          this.reason = new StringType(); // bb
1842      return this.reason;
1843    }
1844
1845    public boolean hasReasonElement() { 
1846      return this.reason != null && !this.reason.isEmpty();
1847    }
1848
1849    public boolean hasReason() { 
1850      return this.reason != null && !this.reason.isEmpty();
1851    }
1852
1853    /**
1854     * @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
1855     */
1856    public Subscription setReasonElement(StringType value) { 
1857      this.reason = value;
1858      return this;
1859    }
1860
1861    /**
1862     * @return A description of why this subscription is defined.
1863     */
1864    public String getReason() { 
1865      return this.reason == null ? null : this.reason.getValue();
1866    }
1867
1868    /**
1869     * @param value A description of why this subscription is defined.
1870     */
1871    public Subscription setReason(String value) { 
1872      if (Utilities.noString(value))
1873        this.reason = null;
1874      else {
1875        if (this.reason == null)
1876          this.reason = new StringType();
1877        this.reason.setValue(value);
1878      }
1879      return this;
1880    }
1881
1882    /**
1883     * @return {@link #filterBy} (The filter properties to be applied to narrow the topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).)
1884     */
1885    public List<SubscriptionFilterByComponent> getFilterBy() { 
1886      if (this.filterBy == null)
1887        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1888      return this.filterBy;
1889    }
1890
1891    /**
1892     * @return Returns a reference to <code>this</code> for easy method chaining
1893     */
1894    public Subscription setFilterBy(List<SubscriptionFilterByComponent> theFilterBy) { 
1895      this.filterBy = theFilterBy;
1896      return this;
1897    }
1898
1899    public boolean hasFilterBy() { 
1900      if (this.filterBy == null)
1901        return false;
1902      for (SubscriptionFilterByComponent item : this.filterBy)
1903        if (!item.isEmpty())
1904          return true;
1905      return false;
1906    }
1907
1908    public SubscriptionFilterByComponent addFilterBy() { //3
1909      SubscriptionFilterByComponent t = new SubscriptionFilterByComponent();
1910      if (this.filterBy == null)
1911        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1912      this.filterBy.add(t);
1913      return t;
1914    }
1915
1916    public Subscription addFilterBy(SubscriptionFilterByComponent t) { //3
1917      if (t == null)
1918        return this;
1919      if (this.filterBy == null)
1920        this.filterBy = new ArrayList<SubscriptionFilterByComponent>();
1921      this.filterBy.add(t);
1922      return this;
1923    }
1924
1925    /**
1926     * @return The first repetition of repeating field {@link #filterBy}, creating it if it does not already exist {3}
1927     */
1928    public SubscriptionFilterByComponent getFilterByFirstRep() { 
1929      if (getFilterBy().isEmpty()) {
1930        addFilterBy();
1931      }
1932      return getFilterBy().get(0);
1933    }
1934
1935    /**
1936     * @return {@link #error} (A record of the last error that occurred when the server processed a notification.)
1937     */
1938    public List<CodeableConcept> getError() { 
1939      if (this.error == null)
1940        this.error = new ArrayList<CodeableConcept>();
1941      return this.error;
1942    }
1943
1944    /**
1945     * @return Returns a reference to <code>this</code> for easy method chaining
1946     */
1947    public Subscription setError(List<CodeableConcept> theError) { 
1948      this.error = theError;
1949      return this;
1950    }
1951
1952    public boolean hasError() { 
1953      if (this.error == null)
1954        return false;
1955      for (CodeableConcept item : this.error)
1956        if (!item.isEmpty())
1957          return true;
1958      return false;
1959    }
1960
1961    public CodeableConcept addError() { //3
1962      CodeableConcept t = new CodeableConcept();
1963      if (this.error == null)
1964        this.error = new ArrayList<CodeableConcept>();
1965      this.error.add(t);
1966      return t;
1967    }
1968
1969    public Subscription addError(CodeableConcept t) { //3
1970      if (t == null)
1971        return this;
1972      if (this.error == null)
1973        this.error = new ArrayList<CodeableConcept>();
1974      this.error.add(t);
1975      return this;
1976    }
1977
1978    /**
1979     * @return The first repetition of repeating field {@link #error}, creating it if it does not already exist {3}
1980     */
1981    public CodeableConcept getErrorFirstRep() { 
1982      if (getError().isEmpty()) {
1983        addError();
1984      }
1985      return getError().get(0);
1986    }
1987
1988    /**
1989     * @return {@link #eventCount} (A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an "active" or "error" state -- not "requested" or "off").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.). This is the underlying object with id, value and extensions. The accessor "getEventCount" gives direct access to the value
1990     */
1991    public UnsignedIntType getEventCountElement() { 
1992      if (this.eventCount == null)
1993        if (Configuration.errorOnAutoCreate())
1994          throw new Error("Attempt to auto-create Subscription.eventCount");
1995        else if (Configuration.doAutoCreate())
1996          this.eventCount = new UnsignedIntType(); // bb
1997      return this.eventCount;
1998    }
1999
2000    public boolean hasEventCountElement() { 
2001      return this.eventCount != null && !this.eventCount.isEmpty();
2002    }
2003
2004    public boolean hasEventCount() { 
2005      return this.eventCount != null && !this.eventCount.isEmpty();
2006    }
2007
2008    /**
2009     * @param value {@link #eventCount} (A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an "active" or "error" state -- not "requested" or "off").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.). This is the underlying object with id, value and extensions. The accessor "getEventCount" gives direct access to the value
2010     */
2011    public Subscription setEventCountElement(UnsignedIntType value) { 
2012      this.eventCount = value;
2013      return this;
2014    }
2015
2016    /**
2017     * @return A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an "active" or "error" state -- not "requested" or "off").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.
2018     */
2019    public int getEventCount() { 
2020      return this.eventCount == null || this.eventCount.isEmpty() ? 0 : this.eventCount.getValue();
2021    }
2022
2023    /**
2024     * @param value A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an "active" or "error" state -- not "requested" or "off").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.
2025     */
2026    public Subscription setEventCount(int value) { 
2027        if (this.eventCount == null)
2028          this.eventCount = new UnsignedIntType();
2029        this.eventCount.setValue(value);
2030      return this;
2031    }
2032
2033    /**
2034     * @return {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
2035     */
2036    public SubscriptionChannelComponent getChannel() { 
2037      if (this.channel == null)
2038        if (Configuration.errorOnAutoCreate())
2039          throw new Error("Attempt to auto-create Subscription.channel");
2040        else if (Configuration.doAutoCreate())
2041          this.channel = new SubscriptionChannelComponent(); // cc
2042      return this.channel;
2043    }
2044
2045    public boolean hasChannel() { 
2046      return this.channel != null && !this.channel.isEmpty();
2047    }
2048
2049    /**
2050     * @param value {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
2051     */
2052    public Subscription setChannel(SubscriptionChannelComponent value) { 
2053      this.channel = value;
2054      return this;
2055    }
2056
2057      protected void listChildren(List<Property> children) {
2058        super.listChildren(children);
2059        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));
2060        children.add(new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name));
2061        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
2062        children.add(new Property("topic", "Reference(Topic)", "The reference to the topic to be notified about.", 0, 1, topic));
2063        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));
2064        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
2065        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
2066        children.add(new Property("filterBy", "", "The filter properties to be applied to narrow the topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy));
2067        children.add(new Property("error", "CodeableConcept", "A record of the last error that occurred when the server processed a notification.", 0, java.lang.Integer.MAX_VALUE, error));
2068        children.add(new Property("eventCount", "unsignedInt", "A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an \"active\" or \"error\" state -- not \"requested\" or \"off\").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.", 0, 1, eventCount));
2069        children.add(new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel));
2070      }
2071
2072      @Override
2073      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2074        switch (_hash) {
2075        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);
2076        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the subscription.", 0, 1, name);
2077        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);
2078        case 110546223: /*topic*/  return new Property("topic", "Reference(Topic)", "The reference to the topic to be notified about.", 0, 1, topic);
2079        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);
2080        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
2081        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
2082        case -721168913: /*filterBy*/  return new Property("filterBy", "", "The filter properties to be applied to narrow the topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).", 0, java.lang.Integer.MAX_VALUE, filterBy);
2083        case 96784904: /*error*/  return new Property("error", "CodeableConcept", "A record of the last error that occurred when the server processed a notification.", 0, java.lang.Integer.MAX_VALUE, error);
2084        case 958365333: /*eventCount*/  return new Property("eventCount", "unsignedInt", "A record of  the number of events for which the server has attempted delivery on this subscription (i.e., the number of events that occurred while the subscription is in an \"active\" or \"error\" state -- not \"requested\" or \"off\").   Server Initializes to 0 for a new subscription.  Repeated attempts at delivery of the *same* event notification do not increment this counter.  Valid values are unsigned integers (0+).  The decmial type is used to ensure that counts can grow larger than 32-bit values.", 0, 1, eventCount);
2085        case 738950403: /*channel*/  return new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel);
2086        default: return super.getNamedProperty(_hash, _name, _checkValid);
2087        }
2088
2089      }
2090
2091      @Override
2092      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2093        switch (hash) {
2094        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2095        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2096        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatus>
2097        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Reference
2098        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
2099        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
2100        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
2101        case -721168913: /*filterBy*/ return this.filterBy == null ? new Base[0] : this.filterBy.toArray(new Base[this.filterBy.size()]); // SubscriptionFilterByComponent
2102        case 96784904: /*error*/ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // CodeableConcept
2103        case 958365333: /*eventCount*/ return this.eventCount == null ? new Base[0] : new Base[] {this.eventCount}; // UnsignedIntType
2104        case 738950403: /*channel*/ return this.channel == null ? new Base[0] : new Base[] {this.channel}; // SubscriptionChannelComponent
2105        default: return super.getProperty(hash, name, checkValid);
2106        }
2107
2108      }
2109
2110      @Override
2111      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2112        switch (hash) {
2113        case -1618432855: // identifier
2114          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2115          return value;
2116        case 3373707: // name
2117          this.name = TypeConvertor.castToString(value); // StringType
2118          return value;
2119        case -892481550: // status
2120          value = new SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2121          this.status = (Enumeration) value; // Enumeration<SubscriptionStatus>
2122          return value;
2123        case 110546223: // topic
2124          this.topic = TypeConvertor.castToReference(value); // Reference
2125          return value;
2126        case 951526432: // contact
2127          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
2128          return value;
2129        case 100571: // end
2130          this.end = TypeConvertor.castToInstant(value); // InstantType
2131          return value;
2132        case -934964668: // reason
2133          this.reason = TypeConvertor.castToString(value); // StringType
2134          return value;
2135        case -721168913: // filterBy
2136          this.getFilterBy().add((SubscriptionFilterByComponent) value); // SubscriptionFilterByComponent
2137          return value;
2138        case 96784904: // error
2139          this.getError().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2140          return value;
2141        case 958365333: // eventCount
2142          this.eventCount = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
2143          return value;
2144        case 738950403: // channel
2145          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
2146          return value;
2147        default: return super.setProperty(hash, name, value);
2148        }
2149
2150      }
2151
2152      @Override
2153      public Base setProperty(String name, Base value) throws FHIRException {
2154        if (name.equals("identifier")) {
2155          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2156        } else if (name.equals("name")) {
2157          this.name = TypeConvertor.castToString(value); // StringType
2158        } else if (name.equals("status")) {
2159          value = new SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2160          this.status = (Enumeration) value; // Enumeration<SubscriptionStatus>
2161        } else if (name.equals("topic")) {
2162          this.topic = TypeConvertor.castToReference(value); // Reference
2163        } else if (name.equals("contact")) {
2164          this.getContact().add(TypeConvertor.castToContactPoint(value));
2165        } else if (name.equals("end")) {
2166          this.end = TypeConvertor.castToInstant(value); // InstantType
2167        } else if (name.equals("reason")) {
2168          this.reason = TypeConvertor.castToString(value); // StringType
2169        } else if (name.equals("filterBy")) {
2170          this.getFilterBy().add((SubscriptionFilterByComponent) value);
2171        } else if (name.equals("error")) {
2172          this.getError().add(TypeConvertor.castToCodeableConcept(value));
2173        } else if (name.equals("eventCount")) {
2174          this.eventCount = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
2175        } else if (name.equals("channel")) {
2176          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
2177        } else
2178          return super.setProperty(name, value);
2179        return value;
2180      }
2181
2182      @Override
2183      public Base makeProperty(int hash, String name) throws FHIRException {
2184        switch (hash) {
2185        case -1618432855:  return addIdentifier(); 
2186        case 3373707:  return getNameElement();
2187        case -892481550:  return getStatusElement();
2188        case 110546223:  return getTopic();
2189        case 951526432:  return addContact(); 
2190        case 100571:  return getEndElement();
2191        case -934964668:  return getReasonElement();
2192        case -721168913:  return addFilterBy(); 
2193        case 96784904:  return addError(); 
2194        case 958365333:  return getEventCountElement();
2195        case 738950403:  return getChannel();
2196        default: return super.makeProperty(hash, name);
2197        }
2198
2199      }
2200
2201      @Override
2202      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2203        switch (hash) {
2204        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2205        case 3373707: /*name*/ return new String[] {"string"};
2206        case -892481550: /*status*/ return new String[] {"code"};
2207        case 110546223: /*topic*/ return new String[] {"Reference"};
2208        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
2209        case 100571: /*end*/ return new String[] {"instant"};
2210        case -934964668: /*reason*/ return new String[] {"string"};
2211        case -721168913: /*filterBy*/ return new String[] {};
2212        case 96784904: /*error*/ return new String[] {"CodeableConcept"};
2213        case 958365333: /*eventCount*/ return new String[] {"unsignedInt"};
2214        case 738950403: /*channel*/ return new String[] {};
2215        default: return super.getTypesForProperty(hash, name);
2216        }
2217
2218      }
2219
2220      @Override
2221      public Base addChild(String name) throws FHIRException {
2222        if (name.equals("identifier")) {
2223          return addIdentifier();
2224        }
2225        else if (name.equals("name")) {
2226          throw new FHIRException("Cannot call addChild on a primitive type Subscription.name");
2227        }
2228        else if (name.equals("status")) {
2229          throw new FHIRException("Cannot call addChild on a primitive type Subscription.status");
2230        }
2231        else if (name.equals("topic")) {
2232          this.topic = new Reference();
2233          return this.topic;
2234        }
2235        else if (name.equals("contact")) {
2236          return addContact();
2237        }
2238        else if (name.equals("end")) {
2239          throw new FHIRException("Cannot call addChild on a primitive type Subscription.end");
2240        }
2241        else if (name.equals("reason")) {
2242          throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason");
2243        }
2244        else if (name.equals("filterBy")) {
2245          return addFilterBy();
2246        }
2247        else if (name.equals("error")) {
2248          return addError();
2249        }
2250        else if (name.equals("eventCount")) {
2251          throw new FHIRException("Cannot call addChild on a primitive type Subscription.eventCount");
2252        }
2253        else if (name.equals("channel")) {
2254          this.channel = new SubscriptionChannelComponent();
2255          return this.channel;
2256        }
2257        else
2258          return super.addChild(name);
2259      }
2260
2261  public String fhirType() {
2262    return "Subscription";
2263
2264  }
2265
2266      public Subscription copy() {
2267        Subscription dst = new Subscription();
2268        copyValues(dst);
2269        return dst;
2270      }
2271
2272      public void copyValues(Subscription dst) {
2273        super.copyValues(dst);
2274        if (identifier != null) {
2275          dst.identifier = new ArrayList<Identifier>();
2276          for (Identifier i : identifier)
2277            dst.identifier.add(i.copy());
2278        };
2279        dst.name = name == null ? null : name.copy();
2280        dst.status = status == null ? null : status.copy();
2281        dst.topic = topic == null ? null : topic.copy();
2282        if (contact != null) {
2283          dst.contact = new ArrayList<ContactPoint>();
2284          for (ContactPoint i : contact)
2285            dst.contact.add(i.copy());
2286        };
2287        dst.end = end == null ? null : end.copy();
2288        dst.reason = reason == null ? null : reason.copy();
2289        if (filterBy != null) {
2290          dst.filterBy = new ArrayList<SubscriptionFilterByComponent>();
2291          for (SubscriptionFilterByComponent i : filterBy)
2292            dst.filterBy.add(i.copy());
2293        };
2294        if (error != null) {
2295          dst.error = new ArrayList<CodeableConcept>();
2296          for (CodeableConcept i : error)
2297            dst.error.add(i.copy());
2298        };
2299        dst.eventCount = eventCount == null ? null : eventCount.copy();
2300        dst.channel = channel == null ? null : channel.copy();
2301      }
2302
2303      protected Subscription typedCopy() {
2304        return copy();
2305      }
2306
2307      @Override
2308      public boolean equalsDeep(Base other_) {
2309        if (!super.equalsDeep(other_))
2310          return false;
2311        if (!(other_ instanceof Subscription))
2312          return false;
2313        Subscription o = (Subscription) other_;
2314        return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(status, o.status, true)
2315           && compareDeep(topic, o.topic, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
2316           && compareDeep(reason, o.reason, true) && compareDeep(filterBy, o.filterBy, true) && compareDeep(error, o.error, true)
2317           && compareDeep(eventCount, o.eventCount, true) && compareDeep(channel, o.channel, true);
2318      }
2319
2320      @Override
2321      public boolean equalsShallow(Base other_) {
2322        if (!super.equalsShallow(other_))
2323          return false;
2324        if (!(other_ instanceof Subscription))
2325          return false;
2326        Subscription o = (Subscription) other_;
2327        return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(end, o.end, true)
2328           && compareValues(reason, o.reason, true) && compareValues(eventCount, o.eventCount, true);
2329      }
2330
2331      public boolean isEmpty() {
2332        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, status
2333          , topic, contact, end, reason, filterBy, error, eventCount, channel);
2334      }
2335
2336  @Override
2337  public ResourceType getResourceType() {
2338    return ResourceType.Subscription;
2339   }
2340
2341 /**
2342   * Search parameter: <b>contact</b>
2343   * <p>
2344   * Description: <b>Contact details for the subscription</b><br>
2345   * Type: <b>token</b><br>
2346   * Path: <b>Subscription.contact</b><br>
2347   * </p>
2348   */
2349  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
2350  public static final String SP_CONTACT = "contact";
2351 /**
2352   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
2353   * <p>
2354   * Description: <b>Contact details for the subscription</b><br>
2355   * Type: <b>token</b><br>
2356   * Path: <b>Subscription.contact</b><br>
2357   * </p>
2358   */
2359  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
2360
2361 /**
2362   * Search parameter: <b>payload</b>
2363   * <p>
2364   * Description: <b>The mime-type of the notification payload</b><br>
2365   * Type: <b>token</b><br>
2366   * Path: <b>Subscription.channel.payload.contentType</b><br>
2367   * </p>
2368   */
2369  @SearchParamDefinition(name="payload", path="Subscription.channel.payload.contentType", description="The mime-type of the notification payload", type="token" )
2370  public static final String SP_PAYLOAD = "payload";
2371 /**
2372   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
2373   * <p>
2374   * Description: <b>The mime-type of the notification payload</b><br>
2375   * Type: <b>token</b><br>
2376   * Path: <b>Subscription.channel.payload.contentType</b><br>
2377   * </p>
2378   */
2379  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
2380
2381 /**
2382   * Search parameter: <b>status</b>
2383   * <p>
2384   * Description: <b>The current state of the subscription</b><br>
2385   * Type: <b>token</b><br>
2386   * Path: <b>Subscription.status</b><br>
2387   * </p>
2388   */
2389  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
2390  public static final String SP_STATUS = "status";
2391 /**
2392   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2393   * <p>
2394   * Description: <b>The current state of the subscription</b><br>
2395   * Type: <b>token</b><br>
2396   * Path: <b>Subscription.status</b><br>
2397   * </p>
2398   */
2399  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2400
2401 /**
2402   * Search parameter: <b>type</b>
2403   * <p>
2404   * Description: <b>The type of channel for the sent notifications</b><br>
2405   * Type: <b>token</b><br>
2406   * Path: <b>Subscription.channel.type</b><br>
2407   * </p>
2408   */
2409  @SearchParamDefinition(name="type", path="Subscription.channel.type", description="The type of channel for the sent notifications", type="token" )
2410  public static final String SP_TYPE = "type";
2411 /**
2412   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2413   * <p>
2414   * Description: <b>The type of channel for the sent notifications</b><br>
2415   * Type: <b>token</b><br>
2416   * Path: <b>Subscription.channel.type</b><br>
2417   * </p>
2418   */
2419  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2420
2421 /**
2422   * Search parameter: <b>url</b>
2423   * <p>
2424   * Description: <b>The uri that will receive the notifications</b><br>
2425   * Type: <b>uri</b><br>
2426   * Path: <b>Subscription.channel.endpoint</b><br>
2427   * </p>
2428   */
2429  @SearchParamDefinition(name="url", path="Subscription.channel.endpoint", description="The uri that will receive the notifications", type="uri" )
2430  public static final String SP_URL = "url";
2431 /**
2432   * <b>Fluent Client</b> search parameter constant for <b>url</b>
2433   * <p>
2434   * Description: <b>The uri that will receive the notifications</b><br>
2435   * Type: <b>uri</b><br>
2436   * Path: <b>Subscription.channel.endpoint</b><br>
2437   * </p>
2438   */
2439  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
2440
2441
2442}
2443