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