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