001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * The subscription resource is used to define a push-based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system can take an appropriate action.
051 */
052@ResourceDef(name="Subscription", profile="http://hl7.org/fhir/StructureDefinition/Subscription")
053public class Subscription extends DomainResource {
054
055    public enum SubscriptionStatus {
056        /**
057         * The client has requested the subscription, and the server has not yet set it up.
058         */
059        REQUESTED, 
060        /**
061         * The subscription is active.
062         */
063        ACTIVE, 
064        /**
065         * The server has an error executing the notification.
066         */
067        ERROR, 
068        /**
069         * Too many errors have occurred or the subscription has expired.
070         */
071        OFF, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static SubscriptionStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("requested".equals(codeString))
080          return REQUESTED;
081        if ("active".equals(codeString))
082          return ACTIVE;
083        if ("error".equals(codeString))
084          return ERROR;
085        if ("off".equals(codeString))
086          return OFF;
087        if (Configuration.isAcceptInvalidEnums())
088          return null;
089        else
090          throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'");
091        }
092        public String toCode() {
093          switch (this) {
094            case REQUESTED: return "requested";
095            case ACTIVE: return "active";
096            case ERROR: return "error";
097            case OFF: return "off";
098            default: return "?";
099          }
100        }
101        public String getSystem() {
102          switch (this) {
103            case REQUESTED: return "http://hl7.org/fhir/subscription-status";
104            case ACTIVE: return "http://hl7.org/fhir/subscription-status";
105            case ERROR: return "http://hl7.org/fhir/subscription-status";
106            case OFF: return "http://hl7.org/fhir/subscription-status";
107            default: return "?";
108          }
109        }
110        public String getDefinition() {
111          switch (this) {
112            case REQUESTED: return "The client has requested the subscription, and the server has not yet set it up.";
113            case ACTIVE: return "The subscription is active.";
114            case ERROR: return "The server has an error executing the notification.";
115            case OFF: return "Too many errors have occurred or the subscription has expired.";
116            default: return "?";
117          }
118        }
119        public String getDisplay() {
120          switch (this) {
121            case REQUESTED: return "Requested";
122            case ACTIVE: return "Active";
123            case ERROR: return "Error";
124            case OFF: return "Off";
125            default: return "?";
126          }
127        }
128    }
129
130  public static class SubscriptionStatusEnumFactory implements EnumFactory<SubscriptionStatus> {
131    public SubscriptionStatus fromCode(String codeString) throws IllegalArgumentException {
132      if (codeString == null || "".equals(codeString))
133            if (codeString == null || "".equals(codeString))
134                return null;
135        if ("requested".equals(codeString))
136          return SubscriptionStatus.REQUESTED;
137        if ("active".equals(codeString))
138          return SubscriptionStatus.ACTIVE;
139        if ("error".equals(codeString))
140          return SubscriptionStatus.ERROR;
141        if ("off".equals(codeString))
142          return SubscriptionStatus.OFF;
143        throw new IllegalArgumentException("Unknown SubscriptionStatus code '"+codeString+"'");
144        }
145        public Enumeration<SubscriptionStatus> fromType(Base code) throws FHIRException {
146          if (code == null)
147            return null;
148          if (code.isEmpty())
149            return new Enumeration<SubscriptionStatus>(this);
150          String codeString = ((PrimitiveType) code).asStringValue();
151          if (codeString == null || "".equals(codeString))
152            return null;
153        if ("requested".equals(codeString))
154          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.REQUESTED);
155        if ("active".equals(codeString))
156          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ACTIVE);
157        if ("error".equals(codeString))
158          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.ERROR);
159        if ("off".equals(codeString))
160          return new Enumeration<SubscriptionStatus>(this, SubscriptionStatus.OFF);
161        throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'");
162        }
163    public String toCode(SubscriptionStatus code) {
164      if (code == SubscriptionStatus.REQUESTED)
165        return "requested";
166      if (code == SubscriptionStatus.ACTIVE)
167        return "active";
168      if (code == SubscriptionStatus.ERROR)
169        return "error";
170      if (code == SubscriptionStatus.OFF)
171        return "off";
172      return "?";
173      }
174    public String toSystem(SubscriptionStatus code) {
175      return code.getSystem();
176      }
177    }
178
179    public enum SubscriptionChannelType {
180        /**
181         * The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.
182         */
183        RESTHOOK, 
184        /**
185         * The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.
186         */
187        WEBSOCKET, 
188        /**
189         * The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).
190         */
191        EMAIL, 
192        /**
193         * The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).
194         */
195        SMS, 
196        /**
197         * The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.
198         */
199        MESSAGE, 
200        /**
201         * added to help the parsers with the generic types
202         */
203        NULL;
204        public static SubscriptionChannelType fromCode(String codeString) throws FHIRException {
205            if (codeString == null || "".equals(codeString))
206                return null;
207        if ("rest-hook".equals(codeString))
208          return RESTHOOK;
209        if ("websocket".equals(codeString))
210          return WEBSOCKET;
211        if ("email".equals(codeString))
212          return EMAIL;
213        if ("sms".equals(codeString))
214          return SMS;
215        if ("message".equals(codeString))
216          return MESSAGE;
217        if (Configuration.isAcceptInvalidEnums())
218          return null;
219        else
220          throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'");
221        }
222        public String toCode() {
223          switch (this) {
224            case RESTHOOK: return "rest-hook";
225            case WEBSOCKET: return "websocket";
226            case EMAIL: return "email";
227            case SMS: return "sms";
228            case MESSAGE: return "message";
229            default: return "?";
230          }
231        }
232        public String getSystem() {
233          switch (this) {
234            case RESTHOOK: return "http://hl7.org/fhir/subscription-channel-type";
235            case WEBSOCKET: return "http://hl7.org/fhir/subscription-channel-type";
236            case EMAIL: return "http://hl7.org/fhir/subscription-channel-type";
237            case SMS: return "http://hl7.org/fhir/subscription-channel-type";
238            case MESSAGE: return "http://hl7.org/fhir/subscription-channel-type";
239            default: return "?";
240          }
241        }
242        public String getDefinition() {
243          switch (this) {
244            case RESTHOOK: return "The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.";
245            case WEBSOCKET: return "The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.";
246            case EMAIL: return "The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).";
247            case SMS: return "The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).";
248            case MESSAGE: return "The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.";
249            default: return "?";
250          }
251        }
252        public String getDisplay() {
253          switch (this) {
254            case RESTHOOK: return "Rest Hook";
255            case WEBSOCKET: return "Websocket";
256            case EMAIL: return "Email";
257            case SMS: return "SMS";
258            case MESSAGE: return "Message";
259            default: return "?";
260          }
261        }
262    }
263
264  public static class SubscriptionChannelTypeEnumFactory implements EnumFactory<SubscriptionChannelType> {
265    public SubscriptionChannelType fromCode(String codeString) throws IllegalArgumentException {
266      if (codeString == null || "".equals(codeString))
267            if (codeString == null || "".equals(codeString))
268                return null;
269        if ("rest-hook".equals(codeString))
270          return SubscriptionChannelType.RESTHOOK;
271        if ("websocket".equals(codeString))
272          return SubscriptionChannelType.WEBSOCKET;
273        if ("email".equals(codeString))
274          return SubscriptionChannelType.EMAIL;
275        if ("sms".equals(codeString))
276          return SubscriptionChannelType.SMS;
277        if ("message".equals(codeString))
278          return SubscriptionChannelType.MESSAGE;
279        throw new IllegalArgumentException("Unknown SubscriptionChannelType code '"+codeString+"'");
280        }
281        public Enumeration<SubscriptionChannelType> fromType(Base code) throws FHIRException {
282          if (code == null)
283            return null;
284          if (code.isEmpty())
285            return new Enumeration<SubscriptionChannelType>(this);
286          String codeString = ((PrimitiveType) code).asStringValue();
287          if (codeString == null || "".equals(codeString))
288            return null;
289        if ("rest-hook".equals(codeString))
290          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.RESTHOOK);
291        if ("websocket".equals(codeString))
292          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.WEBSOCKET);
293        if ("email".equals(codeString))
294          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.EMAIL);
295        if ("sms".equals(codeString))
296          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.SMS);
297        if ("message".equals(codeString))
298          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.MESSAGE);
299        throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'");
300        }
301    public String toCode(SubscriptionChannelType code) {
302      if (code == SubscriptionChannelType.RESTHOOK)
303        return "rest-hook";
304      if (code == SubscriptionChannelType.WEBSOCKET)
305        return "websocket";
306      if (code == SubscriptionChannelType.EMAIL)
307        return "email";
308      if (code == SubscriptionChannelType.SMS)
309        return "sms";
310      if (code == SubscriptionChannelType.MESSAGE)
311        return "message";
312      return "?";
313      }
314    public String toSystem(SubscriptionChannelType code) {
315      return code.getSystem();
316      }
317    }
318
319    @Block()
320    public static class SubscriptionChannelComponent extends BackboneElement implements IBaseBackboneElement {
321        /**
322         * The type of channel to send notifications on.
323         */
324        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
325        @Description(shortDefinition="rest-hook | websocket | email | sms | message", formalDefinition="The type of channel to send notifications on." )
326        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
327        protected Enumeration<SubscriptionChannelType> type;
328
329        /**
330         * The url that describes the actual end-point to send messages to.
331         */
332        @Child(name = "endpoint", type = {UrlType.class}, order=2, min=0, max=1, modifier=false, summary=true)
333        @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." )
334        protected UrlType endpoint;
335
336        /**
337         * The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
338         */
339        @Child(name = "payload", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
340        @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. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions." )
341        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
342        protected CodeType payload;
343
344        /**
345         * Additional headers / information to send as part of the notification.
346         */
347        @Child(name = "header", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
348        @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
349        protected List<StringType> header;
350
351        private static final long serialVersionUID = -771044852L;
352
353    /**
354     * Constructor
355     */
356      public SubscriptionChannelComponent() {
357        super();
358      }
359
360    /**
361     * Constructor
362     */
363      public SubscriptionChannelComponent(Enumeration<SubscriptionChannelType> type) {
364        super();
365        this.type = type;
366      }
367
368        /**
369         * @return {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
370         */
371        public Enumeration<SubscriptionChannelType> getTypeElement() { 
372          if (this.type == null)
373            if (Configuration.errorOnAutoCreate())
374              throw new Error("Attempt to auto-create SubscriptionChannelComponent.type");
375            else if (Configuration.doAutoCreate())
376              this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); // bb
377          return this.type;
378        }
379
380        public boolean hasTypeElement() { 
381          return this.type != null && !this.type.isEmpty();
382        }
383
384        public boolean hasType() { 
385          return this.type != null && !this.type.isEmpty();
386        }
387
388        /**
389         * @param value {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
390         */
391        public SubscriptionChannelComponent setTypeElement(Enumeration<SubscriptionChannelType> value) { 
392          this.type = value;
393          return this;
394        }
395
396        /**
397         * @return The type of channel to send notifications on.
398         */
399        public SubscriptionChannelType getType() { 
400          return this.type == null ? null : this.type.getValue();
401        }
402
403        /**
404         * @param value The type of channel to send notifications on.
405         */
406        public SubscriptionChannelComponent setType(SubscriptionChannelType value) { 
407            if (this.type == null)
408              this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory());
409            this.type.setValue(value);
410          return this;
411        }
412
413        /**
414         * @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
415         */
416        public UrlType getEndpointElement() { 
417          if (this.endpoint == null)
418            if (Configuration.errorOnAutoCreate())
419              throw new Error("Attempt to auto-create SubscriptionChannelComponent.endpoint");
420            else if (Configuration.doAutoCreate())
421              this.endpoint = new UrlType(); // bb
422          return this.endpoint;
423        }
424
425        public boolean hasEndpointElement() { 
426          return this.endpoint != null && !this.endpoint.isEmpty();
427        }
428
429        public boolean hasEndpoint() { 
430          return this.endpoint != null && !this.endpoint.isEmpty();
431        }
432
433        /**
434         * @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
435         */
436        public SubscriptionChannelComponent setEndpointElement(UrlType value) { 
437          this.endpoint = value;
438          return this;
439        }
440
441        /**
442         * @return The url that describes the actual end-point to send messages to.
443         */
444        public String getEndpoint() { 
445          return this.endpoint == null ? null : this.endpoint.getValue();
446        }
447
448        /**
449         * @param value The url that describes the actual end-point to send messages to.
450         */
451        public SubscriptionChannelComponent setEndpoint(String value) { 
452          if (Utilities.noString(value))
453            this.endpoint = null;
454          else {
455            if (this.endpoint == null)
456              this.endpoint = new UrlType();
457            this.endpoint.setValue(value);
458          }
459          return this;
460        }
461
462        /**
463         * @return {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. 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 "getPayload" gives direct access to the value
464         */
465        public CodeType getPayloadElement() { 
466          if (this.payload == null)
467            if (Configuration.errorOnAutoCreate())
468              throw new Error("Attempt to auto-create SubscriptionChannelComponent.payload");
469            else if (Configuration.doAutoCreate())
470              this.payload = new CodeType(); // bb
471          return this.payload;
472        }
473
474        public boolean hasPayloadElement() { 
475          return this.payload != null && !this.payload.isEmpty();
476        }
477
478        public boolean hasPayload() { 
479          return this.payload != null && !this.payload.isEmpty();
480        }
481
482        /**
483         * @param value {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. 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 "getPayload" gives direct access to the value
484         */
485        public SubscriptionChannelComponent setPayloadElement(CodeType value) { 
486          this.payload = value;
487          return this;
488        }
489
490        /**
491         * @return The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
492         */
493        public String getPayload() { 
494          return this.payload == null ? null : this.payload.getValue();
495        }
496
497        /**
498         * @param value The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
499         */
500        public SubscriptionChannelComponent setPayload(String value) { 
501          if (Utilities.noString(value))
502            this.payload = null;
503          else {
504            if (this.payload == null)
505              this.payload = new CodeType();
506            this.payload.setValue(value);
507          }
508          return this;
509        }
510
511        /**
512         * @return {@link #header} (Additional headers / information to send as part of the notification.)
513         */
514        public List<StringType> getHeader() { 
515          if (this.header == null)
516            this.header = new ArrayList<StringType>();
517          return this.header;
518        }
519
520        /**
521         * @return Returns a reference to <code>this</code> for easy method chaining
522         */
523        public SubscriptionChannelComponent setHeader(List<StringType> theHeader) { 
524          this.header = theHeader;
525          return this;
526        }
527
528        public boolean hasHeader() { 
529          if (this.header == null)
530            return false;
531          for (StringType item : this.header)
532            if (!item.isEmpty())
533              return true;
534          return false;
535        }
536
537        /**
538         * @return {@link #header} (Additional headers / information to send as part of the notification.)
539         */
540        public StringType addHeaderElement() {//2 
541          StringType t = new StringType();
542          if (this.header == null)
543            this.header = new ArrayList<StringType>();
544          this.header.add(t);
545          return t;
546        }
547
548        /**
549         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
550         */
551        public SubscriptionChannelComponent addHeader(String value) { //1
552          StringType t = new StringType();
553          t.setValue(value);
554          if (this.header == null)
555            this.header = new ArrayList<StringType>();
556          this.header.add(t);
557          return this;
558        }
559
560        /**
561         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
562         */
563        public boolean hasHeader(String value) { 
564          if (this.header == null)
565            return false;
566          for (StringType v : this.header)
567            if (v.getValue().equals(value)) // string
568              return true;
569          return false;
570        }
571
572        protected void listChildren(List<Property> children) {
573          super.listChildren(children);
574          children.add(new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type));
575          children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint));
576          children.add(new Property("payload", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions.", 0, 1, payload));
577          children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
578        }
579
580        @Override
581        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
582          switch (_hash) {
583          case 3575610: /*type*/  return new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type);
584          case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint);
585          case -786701938: /*payload*/  return new Property("payload", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions.", 0, 1, payload);
586          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);
587          default: return super.getNamedProperty(_hash, _name, _checkValid);
588          }
589
590        }
591
592      @Override
593      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
594        switch (hash) {
595        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SubscriptionChannelType>
596        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
597        case -786701938: /*payload*/ return this.payload == null ? new Base[0] : new Base[] {this.payload}; // CodeType
598        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
599        default: return super.getProperty(hash, name, checkValid);
600        }
601
602      }
603
604      @Override
605      public Base setProperty(int hash, String name, Base value) throws FHIRException {
606        switch (hash) {
607        case 3575610: // type
608          value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value));
609          this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType>
610          return value;
611        case 1741102485: // endpoint
612          this.endpoint = castToUrl(value); // UrlType
613          return value;
614        case -786701938: // payload
615          this.payload = castToCode(value); // CodeType
616          return value;
617        case -1221270899: // header
618          this.getHeader().add(castToString(value)); // StringType
619          return value;
620        default: return super.setProperty(hash, name, value);
621        }
622
623      }
624
625      @Override
626      public Base setProperty(String name, Base value) throws FHIRException {
627        if (name.equals("type")) {
628          value = new SubscriptionChannelTypeEnumFactory().fromType(castToCode(value));
629          this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType>
630        } else if (name.equals("endpoint")) {
631          this.endpoint = castToUrl(value); // UrlType
632        } else if (name.equals("payload")) {
633          this.payload = castToCode(value); // CodeType
634        } else if (name.equals("header")) {
635          this.getHeader().add(castToString(value));
636        } else
637          return super.setProperty(name, value);
638        return value;
639      }
640
641      @Override
642      public Base makeProperty(int hash, String name) throws FHIRException {
643        switch (hash) {
644        case 3575610:  return getTypeElement();
645        case 1741102485:  return getEndpointElement();
646        case -786701938:  return getPayloadElement();
647        case -1221270899:  return addHeaderElement();
648        default: return super.makeProperty(hash, name);
649        }
650
651      }
652
653      @Override
654      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
655        switch (hash) {
656        case 3575610: /*type*/ return new String[] {"code"};
657        case 1741102485: /*endpoint*/ return new String[] {"url"};
658        case -786701938: /*payload*/ return new String[] {"code"};
659        case -1221270899: /*header*/ return new String[] {"string"};
660        default: return super.getTypesForProperty(hash, name);
661        }
662
663      }
664
665      @Override
666      public Base addChild(String name) throws FHIRException {
667        if (name.equals("type")) {
668          throw new FHIRException("Cannot call addChild on a primitive type Subscription.type");
669        }
670        else if (name.equals("endpoint")) {
671          throw new FHIRException("Cannot call addChild on a primitive type Subscription.endpoint");
672        }
673        else if (name.equals("payload")) {
674          throw new FHIRException("Cannot call addChild on a primitive type Subscription.payload");
675        }
676        else if (name.equals("header")) {
677          throw new FHIRException("Cannot call addChild on a primitive type Subscription.header");
678        }
679        else
680          return super.addChild(name);
681      }
682
683      public SubscriptionChannelComponent copy() {
684        SubscriptionChannelComponent dst = new SubscriptionChannelComponent();
685        copyValues(dst);
686        return dst;
687      }
688
689      public void copyValues(SubscriptionChannelComponent dst) {
690        super.copyValues(dst);
691        dst.type = type == null ? null : type.copy();
692        dst.endpoint = endpoint == null ? null : endpoint.copy();
693        dst.payload = payload == null ? null : payload.copy();
694        if (header != null) {
695          dst.header = new ArrayList<StringType>();
696          for (StringType i : header)
697            dst.header.add(i.copy());
698        };
699      }
700
701      @Override
702      public boolean equalsDeep(Base other_) {
703        if (!super.equalsDeep(other_))
704          return false;
705        if (!(other_ instanceof SubscriptionChannelComponent))
706          return false;
707        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
708        return compareDeep(type, o.type, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(payload, o.payload, true)
709           && compareDeep(header, o.header, true);
710      }
711
712      @Override
713      public boolean equalsShallow(Base other_) {
714        if (!super.equalsShallow(other_))
715          return false;
716        if (!(other_ instanceof SubscriptionChannelComponent))
717          return false;
718        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
719        return compareValues(type, o.type, true) && compareValues(endpoint, o.endpoint, true) && compareValues(payload, o.payload, true)
720           && compareValues(header, o.header, true);
721      }
722
723      public boolean isEmpty() {
724        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, endpoint, payload
725          , header);
726      }
727
728  public String fhirType() {
729    return "Subscription.channel";
730
731  }
732
733  }
734
735    /**
736     * The status of the subscription, which marks the server state for managing the subscription.
737     */
738    @Child(name = "status", type = {CodeType.class}, order=0, min=1, max=1, modifier=true, summary=true)
739    @Description(shortDefinition="requested | active | error | off", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." )
740    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status")
741    protected Enumeration<SubscriptionStatus> status;
742
743    /**
744     * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.
745     */
746    @Child(name = "contact", type = {ContactPoint.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
747    @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." )
748    protected List<ContactPoint> contact;
749
750    /**
751     * The time for the server to turn the subscription off.
752     */
753    @Child(name = "end", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true)
754    @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." )
755    protected InstantType end;
756
757    /**
758     * A description of why this subscription is defined.
759     */
760    @Child(name = "reason", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
761    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
762    protected StringType reason;
763
764    /**
765     * The rules that the server should use to determine when to generate notifications for this subscription.
766     */
767    @Child(name = "criteria", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
768    @Description(shortDefinition="Rule for server push", formalDefinition="The rules that the server should use to determine when to generate notifications for this subscription." )
769    protected StringType criteria;
770
771    /**
772     * A record of the last error that occurred when the server processed a notification.
773     */
774    @Child(name = "error", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
775    @Description(shortDefinition="Latest error note", formalDefinition="A record of the last error that occurred when the server processed a notification." )
776    protected StringType error;
777
778    /**
779     * Details where to send notifications when resources are received that meet the criteria.
780     */
781    @Child(name = "channel", type = {}, order=6, min=1, max=1, modifier=false, summary=true)
782    @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." )
783    protected SubscriptionChannelComponent channel;
784
785    private static final long serialVersionUID = 1072504988L;
786
787  /**
788   * Constructor
789   */
790    public Subscription() {
791      super();
792    }
793
794  /**
795   * Constructor
796   */
797    public Subscription(Enumeration<SubscriptionStatus> status, StringType reason, StringType criteria, SubscriptionChannelComponent channel) {
798      super();
799      this.status = status;
800      this.reason = reason;
801      this.criteria = criteria;
802      this.channel = channel;
803    }
804
805    /**
806     * @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
807     */
808    public Enumeration<SubscriptionStatus> getStatusElement() { 
809      if (this.status == null)
810        if (Configuration.errorOnAutoCreate())
811          throw new Error("Attempt to auto-create Subscription.status");
812        else if (Configuration.doAutoCreate())
813          this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory()); // bb
814      return this.status;
815    }
816
817    public boolean hasStatusElement() { 
818      return this.status != null && !this.status.isEmpty();
819    }
820
821    public boolean hasStatus() { 
822      return this.status != null && !this.status.isEmpty();
823    }
824
825    /**
826     * @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
827     */
828    public Subscription setStatusElement(Enumeration<SubscriptionStatus> value) { 
829      this.status = value;
830      return this;
831    }
832
833    /**
834     * @return The status of the subscription, which marks the server state for managing the subscription.
835     */
836    public SubscriptionStatus getStatus() { 
837      return this.status == null ? null : this.status.getValue();
838    }
839
840    /**
841     * @param value The status of the subscription, which marks the server state for managing the subscription.
842     */
843    public Subscription setStatus(SubscriptionStatus value) { 
844        if (this.status == null)
845          this.status = new Enumeration<SubscriptionStatus>(new SubscriptionStatusEnumFactory());
846        this.status.setValue(value);
847      return this;
848    }
849
850    /**
851     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
852     */
853    public List<ContactPoint> getContact() { 
854      if (this.contact == null)
855        this.contact = new ArrayList<ContactPoint>();
856      return this.contact;
857    }
858
859    /**
860     * @return Returns a reference to <code>this</code> for easy method chaining
861     */
862    public Subscription setContact(List<ContactPoint> theContact) { 
863      this.contact = theContact;
864      return this;
865    }
866
867    public boolean hasContact() { 
868      if (this.contact == null)
869        return false;
870      for (ContactPoint item : this.contact)
871        if (!item.isEmpty())
872          return true;
873      return false;
874    }
875
876    public ContactPoint addContact() { //3
877      ContactPoint t = new ContactPoint();
878      if (this.contact == null)
879        this.contact = new ArrayList<ContactPoint>();
880      this.contact.add(t);
881      return t;
882    }
883
884    public Subscription addContact(ContactPoint t) { //3
885      if (t == null)
886        return this;
887      if (this.contact == null)
888        this.contact = new ArrayList<ContactPoint>();
889      this.contact.add(t);
890      return this;
891    }
892
893    /**
894     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
895     */
896    public ContactPoint getContactFirstRep() { 
897      if (getContact().isEmpty()) {
898        addContact();
899      }
900      return getContact().get(0);
901    }
902
903    /**
904     * @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
905     */
906    public InstantType getEndElement() { 
907      if (this.end == null)
908        if (Configuration.errorOnAutoCreate())
909          throw new Error("Attempt to auto-create Subscription.end");
910        else if (Configuration.doAutoCreate())
911          this.end = new InstantType(); // bb
912      return this.end;
913    }
914
915    public boolean hasEndElement() { 
916      return this.end != null && !this.end.isEmpty();
917    }
918
919    public boolean hasEnd() { 
920      return this.end != null && !this.end.isEmpty();
921    }
922
923    /**
924     * @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
925     */
926    public Subscription setEndElement(InstantType value) { 
927      this.end = value;
928      return this;
929    }
930
931    /**
932     * @return The time for the server to turn the subscription off.
933     */
934    public Date getEnd() { 
935      return this.end == null ? null : this.end.getValue();
936    }
937
938    /**
939     * @param value The time for the server to turn the subscription off.
940     */
941    public Subscription setEnd(Date value) { 
942      if (value == null)
943        this.end = null;
944      else {
945        if (this.end == null)
946          this.end = new InstantType();
947        this.end.setValue(value);
948      }
949      return this;
950    }
951
952    /**
953     * @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
954     */
955    public StringType getReasonElement() { 
956      if (this.reason == null)
957        if (Configuration.errorOnAutoCreate())
958          throw new Error("Attempt to auto-create Subscription.reason");
959        else if (Configuration.doAutoCreate())
960          this.reason = new StringType(); // bb
961      return this.reason;
962    }
963
964    public boolean hasReasonElement() { 
965      return this.reason != null && !this.reason.isEmpty();
966    }
967
968    public boolean hasReason() { 
969      return this.reason != null && !this.reason.isEmpty();
970    }
971
972    /**
973     * @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
974     */
975    public Subscription setReasonElement(StringType value) { 
976      this.reason = value;
977      return this;
978    }
979
980    /**
981     * @return A description of why this subscription is defined.
982     */
983    public String getReason() { 
984      return this.reason == null ? null : this.reason.getValue();
985    }
986
987    /**
988     * @param value A description of why this subscription is defined.
989     */
990    public Subscription setReason(String value) { 
991        if (this.reason == null)
992          this.reason = new StringType();
993        this.reason.setValue(value);
994      return this;
995    }
996
997    /**
998     * @return {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value
999     */
1000    public StringType getCriteriaElement() { 
1001      if (this.criteria == null)
1002        if (Configuration.errorOnAutoCreate())
1003          throw new Error("Attempt to auto-create Subscription.criteria");
1004        else if (Configuration.doAutoCreate())
1005          this.criteria = new StringType(); // bb
1006      return this.criteria;
1007    }
1008
1009    public boolean hasCriteriaElement() { 
1010      return this.criteria != null && !this.criteria.isEmpty();
1011    }
1012
1013    public boolean hasCriteria() { 
1014      return this.criteria != null && !this.criteria.isEmpty();
1015    }
1016
1017    /**
1018     * @param value {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value
1019     */
1020    public Subscription setCriteriaElement(StringType value) { 
1021      this.criteria = value;
1022      return this;
1023    }
1024
1025    /**
1026     * @return The rules that the server should use to determine when to generate notifications for this subscription.
1027     */
1028    public String getCriteria() { 
1029      return this.criteria == null ? null : this.criteria.getValue();
1030    }
1031
1032    /**
1033     * @param value The rules that the server should use to determine when to generate notifications for this subscription.
1034     */
1035    public Subscription setCriteria(String value) { 
1036        if (this.criteria == null)
1037          this.criteria = new StringType();
1038        this.criteria.setValue(value);
1039      return this;
1040    }
1041
1042    /**
1043     * @return {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value
1044     */
1045    public StringType getErrorElement() { 
1046      if (this.error == null)
1047        if (Configuration.errorOnAutoCreate())
1048          throw new Error("Attempt to auto-create Subscription.error");
1049        else if (Configuration.doAutoCreate())
1050          this.error = new StringType(); // bb
1051      return this.error;
1052    }
1053
1054    public boolean hasErrorElement() { 
1055      return this.error != null && !this.error.isEmpty();
1056    }
1057
1058    public boolean hasError() { 
1059      return this.error != null && !this.error.isEmpty();
1060    }
1061
1062    /**
1063     * @param value {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value
1064     */
1065    public Subscription setErrorElement(StringType value) { 
1066      this.error = value;
1067      return this;
1068    }
1069
1070    /**
1071     * @return A record of the last error that occurred when the server processed a notification.
1072     */
1073    public String getError() { 
1074      return this.error == null ? null : this.error.getValue();
1075    }
1076
1077    /**
1078     * @param value A record of the last error that occurred when the server processed a notification.
1079     */
1080    public Subscription setError(String value) { 
1081      if (Utilities.noString(value))
1082        this.error = null;
1083      else {
1084        if (this.error == null)
1085          this.error = new StringType();
1086        this.error.setValue(value);
1087      }
1088      return this;
1089    }
1090
1091    /**
1092     * @return {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
1093     */
1094    public SubscriptionChannelComponent getChannel() { 
1095      if (this.channel == null)
1096        if (Configuration.errorOnAutoCreate())
1097          throw new Error("Attempt to auto-create Subscription.channel");
1098        else if (Configuration.doAutoCreate())
1099          this.channel = new SubscriptionChannelComponent(); // cc
1100      return this.channel;
1101    }
1102
1103    public boolean hasChannel() { 
1104      return this.channel != null && !this.channel.isEmpty();
1105    }
1106
1107    /**
1108     * @param value {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
1109     */
1110    public Subscription setChannel(SubscriptionChannelComponent value) { 
1111      this.channel = value;
1112      return this;
1113    }
1114
1115      protected void listChildren(List<Property> children) {
1116        super.listChildren(children);
1117        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
1118        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));
1119        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
1120        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
1121        children.add(new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria));
1122        children.add(new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error));
1123        children.add(new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel));
1124      }
1125
1126      @Override
1127      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1128        switch (_hash) {
1129        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);
1130        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);
1131        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
1132        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
1133        case 1952046943: /*criteria*/  return new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria);
1134        case 96784904: /*error*/  return new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error);
1135        case 738950403: /*channel*/  return new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel);
1136        default: return super.getNamedProperty(_hash, _name, _checkValid);
1137        }
1138
1139      }
1140
1141      @Override
1142      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1143        switch (hash) {
1144        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SubscriptionStatus>
1145        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1146        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1147        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
1148        case 1952046943: /*criteria*/ return this.criteria == null ? new Base[0] : new Base[] {this.criteria}; // StringType
1149        case 96784904: /*error*/ return this.error == null ? new Base[0] : new Base[] {this.error}; // StringType
1150        case 738950403: /*channel*/ return this.channel == null ? new Base[0] : new Base[] {this.channel}; // SubscriptionChannelComponent
1151        default: return super.getProperty(hash, name, checkValid);
1152        }
1153
1154      }
1155
1156      @Override
1157      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1158        switch (hash) {
1159        case -892481550: // status
1160          value = new SubscriptionStatusEnumFactory().fromType(castToCode(value));
1161          this.status = (Enumeration) value; // Enumeration<SubscriptionStatus>
1162          return value;
1163        case 951526432: // contact
1164          this.getContact().add(castToContactPoint(value)); // ContactPoint
1165          return value;
1166        case 100571: // end
1167          this.end = castToInstant(value); // InstantType
1168          return value;
1169        case -934964668: // reason
1170          this.reason = castToString(value); // StringType
1171          return value;
1172        case 1952046943: // criteria
1173          this.criteria = castToString(value); // StringType
1174          return value;
1175        case 96784904: // error
1176          this.error = castToString(value); // StringType
1177          return value;
1178        case 738950403: // channel
1179          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
1180          return value;
1181        default: return super.setProperty(hash, name, value);
1182        }
1183
1184      }
1185
1186      @Override
1187      public Base setProperty(String name, Base value) throws FHIRException {
1188        if (name.equals("status")) {
1189          value = new SubscriptionStatusEnumFactory().fromType(castToCode(value));
1190          this.status = (Enumeration) value; // Enumeration<SubscriptionStatus>
1191        } else if (name.equals("contact")) {
1192          this.getContact().add(castToContactPoint(value));
1193        } else if (name.equals("end")) {
1194          this.end = castToInstant(value); // InstantType
1195        } else if (name.equals("reason")) {
1196          this.reason = castToString(value); // StringType
1197        } else if (name.equals("criteria")) {
1198          this.criteria = castToString(value); // StringType
1199        } else if (name.equals("error")) {
1200          this.error = castToString(value); // StringType
1201        } else if (name.equals("channel")) {
1202          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
1203        } else
1204          return super.setProperty(name, value);
1205        return value;
1206      }
1207
1208      @Override
1209      public Base makeProperty(int hash, String name) throws FHIRException {
1210        switch (hash) {
1211        case -892481550:  return getStatusElement();
1212        case 951526432:  return addContact(); 
1213        case 100571:  return getEndElement();
1214        case -934964668:  return getReasonElement();
1215        case 1952046943:  return getCriteriaElement();
1216        case 96784904:  return getErrorElement();
1217        case 738950403:  return getChannel(); 
1218        default: return super.makeProperty(hash, name);
1219        }
1220
1221      }
1222
1223      @Override
1224      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1225        switch (hash) {
1226        case -892481550: /*status*/ return new String[] {"code"};
1227        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
1228        case 100571: /*end*/ return new String[] {"instant"};
1229        case -934964668: /*reason*/ return new String[] {"string"};
1230        case 1952046943: /*criteria*/ return new String[] {"string"};
1231        case 96784904: /*error*/ return new String[] {"string"};
1232        case 738950403: /*channel*/ return new String[] {};
1233        default: return super.getTypesForProperty(hash, name);
1234        }
1235
1236      }
1237
1238      @Override
1239      public Base addChild(String name) throws FHIRException {
1240        if (name.equals("status")) {
1241          throw new FHIRException("Cannot call addChild on a primitive type Subscription.status");
1242        }
1243        else if (name.equals("contact")) {
1244          return addContact();
1245        }
1246        else if (name.equals("end")) {
1247          throw new FHIRException("Cannot call addChild on a primitive type Subscription.end");
1248        }
1249        else if (name.equals("reason")) {
1250          throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason");
1251        }
1252        else if (name.equals("criteria")) {
1253          throw new FHIRException("Cannot call addChild on a primitive type Subscription.criteria");
1254        }
1255        else if (name.equals("error")) {
1256          throw new FHIRException("Cannot call addChild on a primitive type Subscription.error");
1257        }
1258        else if (name.equals("channel")) {
1259          this.channel = new SubscriptionChannelComponent();
1260          return this.channel;
1261        }
1262        else
1263          return super.addChild(name);
1264      }
1265
1266  public String fhirType() {
1267    return "Subscription";
1268
1269  }
1270
1271      public Subscription copy() {
1272        Subscription dst = new Subscription();
1273        copyValues(dst);
1274        return dst;
1275      }
1276
1277      public void copyValues(Subscription dst) {
1278        super.copyValues(dst);
1279        dst.status = status == null ? null : status.copy();
1280        if (contact != null) {
1281          dst.contact = new ArrayList<ContactPoint>();
1282          for (ContactPoint i : contact)
1283            dst.contact.add(i.copy());
1284        };
1285        dst.end = end == null ? null : end.copy();
1286        dst.reason = reason == null ? null : reason.copy();
1287        dst.criteria = criteria == null ? null : criteria.copy();
1288        dst.error = error == null ? null : error.copy();
1289        dst.channel = channel == null ? null : channel.copy();
1290      }
1291
1292      protected Subscription typedCopy() {
1293        return copy();
1294      }
1295
1296      @Override
1297      public boolean equalsDeep(Base other_) {
1298        if (!super.equalsDeep(other_))
1299          return false;
1300        if (!(other_ instanceof Subscription))
1301          return false;
1302        Subscription o = (Subscription) other_;
1303        return compareDeep(status, o.status, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
1304           && compareDeep(reason, o.reason, true) && compareDeep(criteria, o.criteria, true) && compareDeep(error, o.error, true)
1305           && compareDeep(channel, o.channel, true);
1306      }
1307
1308      @Override
1309      public boolean equalsShallow(Base other_) {
1310        if (!super.equalsShallow(other_))
1311          return false;
1312        if (!(other_ instanceof Subscription))
1313          return false;
1314        Subscription o = (Subscription) other_;
1315        return compareValues(status, o.status, true) && compareValues(end, o.end, true) && compareValues(reason, o.reason, true)
1316           && compareValues(criteria, o.criteria, true) && compareValues(error, o.error, true);
1317      }
1318
1319      public boolean isEmpty() {
1320        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, contact, end, reason
1321          , criteria, error, channel);
1322      }
1323
1324  @Override
1325  public ResourceType getResourceType() {
1326    return ResourceType.Subscription;
1327   }
1328
1329 /**
1330   * Search parameter: <b>payload</b>
1331   * <p>
1332   * Description: <b>The mime-type of the notification payload</b><br>
1333   * Type: <b>token</b><br>
1334   * Path: <b>Subscription.channel.payload</b><br>
1335   * </p>
1336   */
1337  @SearchParamDefinition(name="payload", path="Subscription.channel.payload", description="The mime-type of the notification payload", type="token" )
1338  public static final String SP_PAYLOAD = "payload";
1339 /**
1340   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
1341   * <p>
1342   * Description: <b>The mime-type of the notification payload</b><br>
1343   * Type: <b>token</b><br>
1344   * Path: <b>Subscription.channel.payload</b><br>
1345   * </p>
1346   */
1347  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
1348
1349 /**
1350   * Search parameter: <b>criteria</b>
1351   * <p>
1352   * Description: <b>The search rules used to determine when to send a notification</b><br>
1353   * Type: <b>string</b><br>
1354   * Path: <b>Subscription.criteria</b><br>
1355   * </p>
1356   */
1357  @SearchParamDefinition(name="criteria", path="Subscription.criteria", description="The search rules used to determine when to send a notification", type="string" )
1358  public static final String SP_CRITERIA = "criteria";
1359 /**
1360   * <b>Fluent Client</b> search parameter constant for <b>criteria</b>
1361   * <p>
1362   * Description: <b>The search rules used to determine when to send a notification</b><br>
1363   * Type: <b>string</b><br>
1364   * Path: <b>Subscription.criteria</b><br>
1365   * </p>
1366   */
1367  public static final ca.uhn.fhir.rest.gclient.StringClientParam CRITERIA = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CRITERIA);
1368
1369 /**
1370   * Search parameter: <b>contact</b>
1371   * <p>
1372   * Description: <b>Contact details for the subscription</b><br>
1373   * Type: <b>token</b><br>
1374   * Path: <b>Subscription.contact</b><br>
1375   * </p>
1376   */
1377  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
1378  public static final String SP_CONTACT = "contact";
1379 /**
1380   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
1381   * <p>
1382   * Description: <b>Contact details for the subscription</b><br>
1383   * Type: <b>token</b><br>
1384   * Path: <b>Subscription.contact</b><br>
1385   * </p>
1386   */
1387  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
1388
1389 /**
1390   * Search parameter: <b>type</b>
1391   * <p>
1392   * Description: <b>The type of channel for the sent notifications</b><br>
1393   * Type: <b>token</b><br>
1394   * Path: <b>Subscription.channel.type</b><br>
1395   * </p>
1396   */
1397  @SearchParamDefinition(name="type", path="Subscription.channel.type", description="The type of channel for the sent notifications", type="token" )
1398  public static final String SP_TYPE = "type";
1399 /**
1400   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1401   * <p>
1402   * Description: <b>The type of channel for the sent notifications</b><br>
1403   * Type: <b>token</b><br>
1404   * Path: <b>Subscription.channel.type</b><br>
1405   * </p>
1406   */
1407  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1408
1409 /**
1410   * Search parameter: <b>url</b>
1411   * <p>
1412   * Description: <b>The uri that will receive the notifications</b><br>
1413   * Type: <b>uri</b><br>
1414   * Path: <b>Subscription.channel.endpoint</b><br>
1415   * </p>
1416   */
1417  @SearchParamDefinition(name="url", path="Subscription.channel.endpoint", description="The uri that will receive the notifications", type="uri" )
1418  public static final String SP_URL = "url";
1419 /**
1420   * <b>Fluent Client</b> search parameter constant for <b>url</b>
1421   * <p>
1422   * Description: <b>The uri that will receive the notifications</b><br>
1423   * Type: <b>uri</b><br>
1424   * Path: <b>Subscription.channel.endpoint</b><br>
1425   * </p>
1426   */
1427  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
1428
1429 /**
1430   * Search parameter: <b>status</b>
1431   * <p>
1432   * Description: <b>The current state of the subscription</b><br>
1433   * Type: <b>token</b><br>
1434   * Path: <b>Subscription.status</b><br>
1435   * </p>
1436   */
1437  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
1438  public static final String SP_STATUS = "status";
1439 /**
1440   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1441   * <p>
1442   * Description: <b>The current state of the subscription</b><br>
1443   * Type: <b>token</b><br>
1444   * Path: <b>Subscription.status</b><br>
1445   * </p>
1446   */
1447  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1448
1449
1450}