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