001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, the CDS system proposes that the public health agency be notified about a reportable condition.
050 */
051@ResourceDef(name="CommunicationRequest", profile="http://hl7.org/fhir/Profile/CommunicationRequest")
052public class CommunicationRequest extends DomainResource {
053
054    public enum CommunicationRequestStatus {
055        /**
056         * The request has been created but is not yet complete or ready for action
057         */
058        DRAFT, 
059        /**
060         * The request is ready to be acted upon
061         */
062        ACTIVE, 
063        /**
064         * The authorization/request to act has been temporarily withdrawn but is expected to resume in the future
065         */
066        SUSPENDED, 
067        /**
068         * The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.
069         */
070        CANCELLED, 
071        /**
072         * Activity against the request has been sufficiently completed to the satisfaction of the requester
073         */
074        COMPLETED, 
075        /**
076         * This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
077         */
078        ENTEREDINERROR, 
079        /**
080         * The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" . One of the listed statuses is presumed to apply,  but the system creating the request doesn't know.
081         */
082        UNKNOWN, 
083        /**
084         * added to help the parsers with the generic types
085         */
086        NULL;
087        public static CommunicationRequestStatus fromCode(String codeString) throws FHIRException {
088            if (codeString == null || "".equals(codeString))
089                return null;
090        if ("draft".equals(codeString))
091          return DRAFT;
092        if ("active".equals(codeString))
093          return ACTIVE;
094        if ("suspended".equals(codeString))
095          return SUSPENDED;
096        if ("cancelled".equals(codeString))
097          return CANCELLED;
098        if ("completed".equals(codeString))
099          return COMPLETED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if ("unknown".equals(codeString))
103          return UNKNOWN;
104        if (Configuration.isAcceptInvalidEnums())
105          return null;
106        else
107          throw new FHIRException("Unknown CommunicationRequestStatus code '"+codeString+"'");
108        }
109        public String toCode() {
110          switch (this) {
111            case DRAFT: return "draft";
112            case ACTIVE: return "active";
113            case SUSPENDED: return "suspended";
114            case CANCELLED: return "cancelled";
115            case COMPLETED: return "completed";
116            case ENTEREDINERROR: return "entered-in-error";
117            case UNKNOWN: return "unknown";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getSystem() {
123          switch (this) {
124            case DRAFT: return "http://hl7.org/fhir/request-status";
125            case ACTIVE: return "http://hl7.org/fhir/request-status";
126            case SUSPENDED: return "http://hl7.org/fhir/request-status";
127            case CANCELLED: return "http://hl7.org/fhir/request-status";
128            case COMPLETED: return "http://hl7.org/fhir/request-status";
129            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
130            case UNKNOWN: return "http://hl7.org/fhir/request-status";
131            case NULL: return null;
132            default: return "?";
133          }
134        }
135        public String getDefinition() {
136          switch (this) {
137            case DRAFT: return "The request has been created but is not yet complete or ready for action";
138            case ACTIVE: return "The request is ready to be acted upon";
139            case SUSPENDED: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future";
140            case CANCELLED: return "The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.";
141            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester";
142            case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
143            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" . One of the listed statuses is presumed to apply,  but the system creating the request doesn't know.";
144            case NULL: return null;
145            default: return "?";
146          }
147        }
148        public String getDisplay() {
149          switch (this) {
150            case DRAFT: return "Draft";
151            case ACTIVE: return "Active";
152            case SUSPENDED: return "Suspended";
153            case CANCELLED: return "Cancelled";
154            case COMPLETED: return "Completed";
155            case ENTEREDINERROR: return "Entered in Error";
156            case UNKNOWN: return "Unknown";
157            case NULL: return null;
158            default: return "?";
159          }
160        }
161    }
162
163  public static class CommunicationRequestStatusEnumFactory implements EnumFactory<CommunicationRequestStatus> {
164    public CommunicationRequestStatus fromCode(String codeString) throws IllegalArgumentException {
165      if (codeString == null || "".equals(codeString))
166            if (codeString == null || "".equals(codeString))
167                return null;
168        if ("draft".equals(codeString))
169          return CommunicationRequestStatus.DRAFT;
170        if ("active".equals(codeString))
171          return CommunicationRequestStatus.ACTIVE;
172        if ("suspended".equals(codeString))
173          return CommunicationRequestStatus.SUSPENDED;
174        if ("cancelled".equals(codeString))
175          return CommunicationRequestStatus.CANCELLED;
176        if ("completed".equals(codeString))
177          return CommunicationRequestStatus.COMPLETED;
178        if ("entered-in-error".equals(codeString))
179          return CommunicationRequestStatus.ENTEREDINERROR;
180        if ("unknown".equals(codeString))
181          return CommunicationRequestStatus.UNKNOWN;
182        throw new IllegalArgumentException("Unknown CommunicationRequestStatus code '"+codeString+"'");
183        }
184        public Enumeration<CommunicationRequestStatus> fromType(Base code) throws FHIRException {
185          if (code == null)
186            return null;
187          if (code.isEmpty())
188            return new Enumeration<CommunicationRequestStatus>(this);
189          String codeString = ((PrimitiveType) code).asStringValue();
190          if (codeString == null || "".equals(codeString))
191            return null;
192        if ("draft".equals(codeString))
193          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.DRAFT);
194        if ("active".equals(codeString))
195          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.ACTIVE);
196        if ("suspended".equals(codeString))
197          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.SUSPENDED);
198        if ("cancelled".equals(codeString))
199          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.CANCELLED);
200        if ("completed".equals(codeString))
201          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.COMPLETED);
202        if ("entered-in-error".equals(codeString))
203          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.ENTEREDINERROR);
204        if ("unknown".equals(codeString))
205          return new Enumeration<CommunicationRequestStatus>(this, CommunicationRequestStatus.UNKNOWN);
206        throw new FHIRException("Unknown CommunicationRequestStatus code '"+codeString+"'");
207        }
208    public String toCode(CommunicationRequestStatus code) {
209      if (code == CommunicationRequestStatus.DRAFT)
210        return "draft";
211      if (code == CommunicationRequestStatus.ACTIVE)
212        return "active";
213      if (code == CommunicationRequestStatus.SUSPENDED)
214        return "suspended";
215      if (code == CommunicationRequestStatus.CANCELLED)
216        return "cancelled";
217      if (code == CommunicationRequestStatus.COMPLETED)
218        return "completed";
219      if (code == CommunicationRequestStatus.ENTEREDINERROR)
220        return "entered-in-error";
221      if (code == CommunicationRequestStatus.UNKNOWN)
222        return "unknown";
223      return "?";
224      }
225    public String toSystem(CommunicationRequestStatus code) {
226      return code.getSystem();
227      }
228    }
229
230    public enum CommunicationPriority {
231        /**
232         * The request has normal priority
233         */
234        ROUTINE, 
235        /**
236         * The request should be actioned promptly - higher priority than routine
237         */
238        URGENT, 
239        /**
240         * The request should be actioned as soon as possible - higher priority than urgent
241         */
242        ASAP, 
243        /**
244         * The request should be actioned immediately - highest possible priority.  E.g. an emergency
245         */
246        STAT, 
247        /**
248         * added to help the parsers with the generic types
249         */
250        NULL;
251        public static CommunicationPriority fromCode(String codeString) throws FHIRException {
252            if (codeString == null || "".equals(codeString))
253                return null;
254        if ("routine".equals(codeString))
255          return ROUTINE;
256        if ("urgent".equals(codeString))
257          return URGENT;
258        if ("asap".equals(codeString))
259          return ASAP;
260        if ("stat".equals(codeString))
261          return STAT;
262        if (Configuration.isAcceptInvalidEnums())
263          return null;
264        else
265          throw new FHIRException("Unknown CommunicationPriority code '"+codeString+"'");
266        }
267        public String toCode() {
268          switch (this) {
269            case ROUTINE: return "routine";
270            case URGENT: return "urgent";
271            case ASAP: return "asap";
272            case STAT: return "stat";
273            case NULL: return null;
274            default: return "?";
275          }
276        }
277        public String getSystem() {
278          switch (this) {
279            case ROUTINE: return "http://hl7.org/fhir/request-priority";
280            case URGENT: return "http://hl7.org/fhir/request-priority";
281            case ASAP: return "http://hl7.org/fhir/request-priority";
282            case STAT: return "http://hl7.org/fhir/request-priority";
283            case NULL: return null;
284            default: return "?";
285          }
286        }
287        public String getDefinition() {
288          switch (this) {
289            case ROUTINE: return "The request has normal priority";
290            case URGENT: return "The request should be actioned promptly - higher priority than routine";
291            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent";
292            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency";
293            case NULL: return null;
294            default: return "?";
295          }
296        }
297        public String getDisplay() {
298          switch (this) {
299            case ROUTINE: return "Routine";
300            case URGENT: return "Urgent";
301            case ASAP: return "ASAP";
302            case STAT: return "STAT";
303            case NULL: return null;
304            default: return "?";
305          }
306        }
307    }
308
309  public static class CommunicationPriorityEnumFactory implements EnumFactory<CommunicationPriority> {
310    public CommunicationPriority fromCode(String codeString) throws IllegalArgumentException {
311      if (codeString == null || "".equals(codeString))
312            if (codeString == null || "".equals(codeString))
313                return null;
314        if ("routine".equals(codeString))
315          return CommunicationPriority.ROUTINE;
316        if ("urgent".equals(codeString))
317          return CommunicationPriority.URGENT;
318        if ("asap".equals(codeString))
319          return CommunicationPriority.ASAP;
320        if ("stat".equals(codeString))
321          return CommunicationPriority.STAT;
322        throw new IllegalArgumentException("Unknown CommunicationPriority code '"+codeString+"'");
323        }
324        public Enumeration<CommunicationPriority> fromType(Base code) throws FHIRException {
325          if (code == null)
326            return null;
327          if (code.isEmpty())
328            return new Enumeration<CommunicationPriority>(this);
329          String codeString = ((PrimitiveType) code).asStringValue();
330          if (codeString == null || "".equals(codeString))
331            return null;
332        if ("routine".equals(codeString))
333          return new Enumeration<CommunicationPriority>(this, CommunicationPriority.ROUTINE);
334        if ("urgent".equals(codeString))
335          return new Enumeration<CommunicationPriority>(this, CommunicationPriority.URGENT);
336        if ("asap".equals(codeString))
337          return new Enumeration<CommunicationPriority>(this, CommunicationPriority.ASAP);
338        if ("stat".equals(codeString))
339          return new Enumeration<CommunicationPriority>(this, CommunicationPriority.STAT);
340        throw new FHIRException("Unknown CommunicationPriority code '"+codeString+"'");
341        }
342    public String toCode(CommunicationPriority code) {
343      if (code == CommunicationPriority.ROUTINE)
344        return "routine";
345      if (code == CommunicationPriority.URGENT)
346        return "urgent";
347      if (code == CommunicationPriority.ASAP)
348        return "asap";
349      if (code == CommunicationPriority.STAT)
350        return "stat";
351      return "?";
352      }
353    public String toSystem(CommunicationPriority code) {
354      return code.getSystem();
355      }
356    }
357
358    @Block()
359    public static class CommunicationRequestPayloadComponent extends BackboneElement implements IBaseBackboneElement {
360        /**
361         * The communicated content (or for multi-part communications, one portion of the communication).
362         */
363        @Child(name = "content", type = {StringType.class, Attachment.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
364        @Description(shortDefinition="Message part content", formalDefinition="The communicated content (or for multi-part communications, one portion of the communication)." )
365        protected Type content;
366
367        private static final long serialVersionUID = -1763459053L;
368
369    /**
370     * Constructor
371     */
372      public CommunicationRequestPayloadComponent() {
373        super();
374      }
375
376    /**
377     * Constructor
378     */
379      public CommunicationRequestPayloadComponent(Type content) {
380        super();
381        this.content = content;
382      }
383
384        /**
385         * @return {@link #content} (The communicated content (or for multi-part communications, one portion of the communication).)
386         */
387        public Type getContent() { 
388          return this.content;
389        }
390
391        /**
392         * @return {@link #content} (The communicated content (or for multi-part communications, one portion of the communication).)
393         */
394        public StringType getContentStringType() throws FHIRException { 
395          if (this.content == null)
396            return null;
397          if (!(this.content instanceof StringType))
398            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.content.getClass().getName()+" was encountered");
399          return (StringType) this.content;
400        }
401
402        public boolean hasContentStringType() { 
403          return this != null && this.content instanceof StringType;
404        }
405
406        /**
407         * @return {@link #content} (The communicated content (or for multi-part communications, one portion of the communication).)
408         */
409        public Attachment getContentAttachment() throws FHIRException { 
410          if (this.content == null)
411            return null;
412          if (!(this.content instanceof Attachment))
413            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
414          return (Attachment) this.content;
415        }
416
417        public boolean hasContentAttachment() { 
418          return this != null && this.content instanceof Attachment;
419        }
420
421        /**
422         * @return {@link #content} (The communicated content (or for multi-part communications, one portion of the communication).)
423         */
424        public Reference getContentReference() throws FHIRException { 
425          if (this.content == null)
426            return null;
427          if (!(this.content instanceof Reference))
428            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
429          return (Reference) this.content;
430        }
431
432        public boolean hasContentReference() { 
433          return this != null && this.content instanceof Reference;
434        }
435
436        public boolean hasContent() { 
437          return this.content != null && !this.content.isEmpty();
438        }
439
440        /**
441         * @param value {@link #content} (The communicated content (or for multi-part communications, one portion of the communication).)
442         */
443        public CommunicationRequestPayloadComponent setContent(Type value) throws FHIRFormatError { 
444          if (value != null && !(value instanceof StringType || value instanceof Attachment || value instanceof Reference))
445            throw new FHIRFormatError("Not the right type for CommunicationRequest.payload.content[x]: "+value.fhirType());
446          this.content = value;
447          return this;
448        }
449
450        protected void listChildren(List<Property> children) {
451          super.listChildren(children);
452          children.add(new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content));
453        }
454
455        @Override
456        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
457          switch (_hash) {
458          case 264548711: /*content[x]*/  return new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content);
459          case 951530617: /*content*/  return new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content);
460          case -326336022: /*contentString*/  return new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content);
461          case -702028164: /*contentAttachment*/  return new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content);
462          case 1193747154: /*contentReference*/  return new Property("content[x]", "string|Attachment|Reference(Any)", "The communicated content (or for multi-part communications, one portion of the communication).", 0, 1, content);
463          default: return super.getNamedProperty(_hash, _name, _checkValid);
464          }
465
466        }
467
468      @Override
469      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
470        switch (hash) {
471        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
472        default: return super.getProperty(hash, name, checkValid);
473        }
474
475      }
476
477      @Override
478      public Base setProperty(int hash, String name, Base value) throws FHIRException {
479        switch (hash) {
480        case 951530617: // content
481          this.content = castToType(value); // Type
482          return value;
483        default: return super.setProperty(hash, name, value);
484        }
485
486      }
487
488      @Override
489      public Base setProperty(String name, Base value) throws FHIRException {
490        if (name.equals("content[x]")) {
491          this.content = castToType(value); // Type
492        } else
493          return super.setProperty(name, value);
494        return value;
495      }
496
497      @Override
498      public Base makeProperty(int hash, String name) throws FHIRException {
499        switch (hash) {
500        case 264548711:  return getContent(); 
501        case 951530617:  return getContent(); 
502        default: return super.makeProperty(hash, name);
503        }
504
505      }
506
507      @Override
508      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
509        switch (hash) {
510        case 951530617: /*content*/ return new String[] {"string", "Attachment", "Reference"};
511        default: return super.getTypesForProperty(hash, name);
512        }
513
514      }
515
516      @Override
517      public Base addChild(String name) throws FHIRException {
518        if (name.equals("contentString")) {
519          this.content = new StringType();
520          return this.content;
521        }
522        else if (name.equals("contentAttachment")) {
523          this.content = new Attachment();
524          return this.content;
525        }
526        else if (name.equals("contentReference")) {
527          this.content = new Reference();
528          return this.content;
529        }
530        else
531          return super.addChild(name);
532      }
533
534      public CommunicationRequestPayloadComponent copy() {
535        CommunicationRequestPayloadComponent dst = new CommunicationRequestPayloadComponent();
536        copyValues(dst);
537        dst.content = content == null ? null : content.copy();
538        return dst;
539      }
540
541      @Override
542      public boolean equalsDeep(Base other_) {
543        if (!super.equalsDeep(other_))
544          return false;
545        if (!(other_ instanceof CommunicationRequestPayloadComponent))
546          return false;
547        CommunicationRequestPayloadComponent o = (CommunicationRequestPayloadComponent) other_;
548        return compareDeep(content, o.content, true);
549      }
550
551      @Override
552      public boolean equalsShallow(Base other_) {
553        if (!super.equalsShallow(other_))
554          return false;
555        if (!(other_ instanceof CommunicationRequestPayloadComponent))
556          return false;
557        CommunicationRequestPayloadComponent o = (CommunicationRequestPayloadComponent) other_;
558        return true;
559      }
560
561      public boolean isEmpty() {
562        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
563      }
564
565  public String fhirType() {
566    return "CommunicationRequest.payload";
567
568  }
569
570  }
571
572    @Block()
573    public static class CommunicationRequestRequesterComponent extends BackboneElement implements IBaseBackboneElement {
574        /**
575         * The device, practitioner, etc. who initiated the request.
576         */
577        @Child(name = "agent", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
578        @Description(shortDefinition="Individual making the request", formalDefinition="The device, practitioner, etc. who initiated the request." )
579        protected Reference agent;
580
581        /**
582         * The actual object that is the target of the reference (The device, practitioner, etc. who initiated the request.)
583         */
584        protected Resource agentTarget;
585
586        /**
587         * The organization the device or practitioner was acting on behalf of.
588         */
589        @Child(name = "onBehalfOf", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=true)
590        @Description(shortDefinition="Organization agent is acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." )
591        protected Reference onBehalfOf;
592
593        /**
594         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.)
595         */
596        protected Organization onBehalfOfTarget;
597
598        private static final long serialVersionUID = -71453027L;
599
600    /**
601     * Constructor
602     */
603      public CommunicationRequestRequesterComponent() {
604        super();
605      }
606
607    /**
608     * Constructor
609     */
610      public CommunicationRequestRequesterComponent(Reference agent) {
611        super();
612        this.agent = agent;
613      }
614
615        /**
616         * @return {@link #agent} (The device, practitioner, etc. who initiated the request.)
617         */
618        public Reference getAgent() { 
619          if (this.agent == null)
620            if (Configuration.errorOnAutoCreate())
621              throw new Error("Attempt to auto-create CommunicationRequestRequesterComponent.agent");
622            else if (Configuration.doAutoCreate())
623              this.agent = new Reference(); // cc
624          return this.agent;
625        }
626
627        public boolean hasAgent() { 
628          return this.agent != null && !this.agent.isEmpty();
629        }
630
631        /**
632         * @param value {@link #agent} (The device, practitioner, etc. who initiated the request.)
633         */
634        public CommunicationRequestRequesterComponent setAgent(Reference value)  { 
635          this.agent = value;
636          return this;
637        }
638
639        /**
640         * @return {@link #agent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The device, practitioner, etc. who initiated the request.)
641         */
642        public Resource getAgentTarget() { 
643          return this.agentTarget;
644        }
645
646        /**
647         * @param value {@link #agent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The device, practitioner, etc. who initiated the request.)
648         */
649        public CommunicationRequestRequesterComponent setAgentTarget(Resource value) { 
650          this.agentTarget = value;
651          return this;
652        }
653
654        /**
655         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
656         */
657        public Reference getOnBehalfOf() { 
658          if (this.onBehalfOf == null)
659            if (Configuration.errorOnAutoCreate())
660              throw new Error("Attempt to auto-create CommunicationRequestRequesterComponent.onBehalfOf");
661            else if (Configuration.doAutoCreate())
662              this.onBehalfOf = new Reference(); // cc
663          return this.onBehalfOf;
664        }
665
666        public boolean hasOnBehalfOf() { 
667          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
668        }
669
670        /**
671         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
672         */
673        public CommunicationRequestRequesterComponent setOnBehalfOf(Reference value)  { 
674          this.onBehalfOf = value;
675          return this;
676        }
677
678        /**
679         * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
680         */
681        public Organization getOnBehalfOfTarget() { 
682          if (this.onBehalfOfTarget == null)
683            if (Configuration.errorOnAutoCreate())
684              throw new Error("Attempt to auto-create CommunicationRequestRequesterComponent.onBehalfOf");
685            else if (Configuration.doAutoCreate())
686              this.onBehalfOfTarget = new Organization(); // aa
687          return this.onBehalfOfTarget;
688        }
689
690        /**
691         * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
692         */
693        public CommunicationRequestRequesterComponent setOnBehalfOfTarget(Organization value) { 
694          this.onBehalfOfTarget = value;
695          return this;
696        }
697
698        protected void listChildren(List<Property> children) {
699          super.listChildren(children);
700          children.add(new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The device, practitioner, etc. who initiated the request.", 0, 1, agent));
701          children.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf));
702        }
703
704        @Override
705        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
706          switch (_hash) {
707          case 92750597: /*agent*/  return new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The device, practitioner, etc. who initiated the request.", 0, 1, agent);
708          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf);
709          default: return super.getNamedProperty(_hash, _name, _checkValid);
710          }
711
712        }
713
714      @Override
715      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
716        switch (hash) {
717        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : new Base[] {this.agent}; // Reference
718        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
719        default: return super.getProperty(hash, name, checkValid);
720        }
721
722      }
723
724      @Override
725      public Base setProperty(int hash, String name, Base value) throws FHIRException {
726        switch (hash) {
727        case 92750597: // agent
728          this.agent = castToReference(value); // Reference
729          return value;
730        case -14402964: // onBehalfOf
731          this.onBehalfOf = castToReference(value); // Reference
732          return value;
733        default: return super.setProperty(hash, name, value);
734        }
735
736      }
737
738      @Override
739      public Base setProperty(String name, Base value) throws FHIRException {
740        if (name.equals("agent")) {
741          this.agent = castToReference(value); // Reference
742        } else if (name.equals("onBehalfOf")) {
743          this.onBehalfOf = castToReference(value); // Reference
744        } else
745          return super.setProperty(name, value);
746        return value;
747      }
748
749      @Override
750      public Base makeProperty(int hash, String name) throws FHIRException {
751        switch (hash) {
752        case 92750597:  return getAgent(); 
753        case -14402964:  return getOnBehalfOf(); 
754        default: return super.makeProperty(hash, name);
755        }
756
757      }
758
759      @Override
760      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
761        switch (hash) {
762        case 92750597: /*agent*/ return new String[] {"Reference"};
763        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
764        default: return super.getTypesForProperty(hash, name);
765        }
766
767      }
768
769      @Override
770      public Base addChild(String name) throws FHIRException {
771        if (name.equals("agent")) {
772          this.agent = new Reference();
773          return this.agent;
774        }
775        else if (name.equals("onBehalfOf")) {
776          this.onBehalfOf = new Reference();
777          return this.onBehalfOf;
778        }
779        else
780          return super.addChild(name);
781      }
782
783      public CommunicationRequestRequesterComponent copy() {
784        CommunicationRequestRequesterComponent dst = new CommunicationRequestRequesterComponent();
785        copyValues(dst);
786        dst.agent = agent == null ? null : agent.copy();
787        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
788        return dst;
789      }
790
791      @Override
792      public boolean equalsDeep(Base other_) {
793        if (!super.equalsDeep(other_))
794          return false;
795        if (!(other_ instanceof CommunicationRequestRequesterComponent))
796          return false;
797        CommunicationRequestRequesterComponent o = (CommunicationRequestRequesterComponent) other_;
798        return compareDeep(agent, o.agent, true) && compareDeep(onBehalfOf, o.onBehalfOf, true);
799      }
800
801      @Override
802      public boolean equalsShallow(Base other_) {
803        if (!super.equalsShallow(other_))
804          return false;
805        if (!(other_ instanceof CommunicationRequestRequesterComponent))
806          return false;
807        CommunicationRequestRequesterComponent o = (CommunicationRequestRequesterComponent) other_;
808        return true;
809      }
810
811      public boolean isEmpty() {
812        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(agent, onBehalfOf);
813      }
814
815  public String fhirType() {
816    return "CommunicationRequest.requester";
817
818  }
819
820  }
821
822    /**
823     * A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system.
824     */
825    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
826    @Description(shortDefinition="Unique identifier", formalDefinition="A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system." )
827    protected List<Identifier> identifier;
828
829    /**
830     * A plan or proposal that is fulfilled in whole or in part by this request.
831     */
832    @Child(name = "basedOn", type = {Reference.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
833    @Description(shortDefinition="Fulfills plan or proposal", formalDefinition="A plan or proposal that is fulfilled in whole or in part by this request." )
834    protected List<Reference> basedOn;
835    /**
836     * The actual objects that are the target of the reference (A plan or proposal that is fulfilled in whole or in part by this request.)
837     */
838    protected List<Resource> basedOnTarget;
839
840
841    /**
842     * Completed or terminated request(s) whose function is taken by this new request.
843     */
844    @Child(name = "replaces", type = {CommunicationRequest.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
845    @Description(shortDefinition="Request(s) replaced by this request", formalDefinition="Completed or terminated request(s) whose function is taken by this new request." )
846    protected List<Reference> replaces;
847    /**
848     * The actual objects that are the target of the reference (Completed or terminated request(s) whose function is taken by this new request.)
849     */
850    protected List<CommunicationRequest> replacesTarget;
851
852
853    /**
854     * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.
855     */
856    @Child(name = "groupIdentifier", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
857    @Description(shortDefinition="Composite request this is part of", formalDefinition="A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form." )
858    protected Identifier groupIdentifier;
859
860    /**
861     * The status of the proposal or order.
862     */
863    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
864    @Description(shortDefinition="draft | active | suspended | cancelled | completed | entered-in-error | unknown", formalDefinition="The status of the proposal or order." )
865    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
866    protected Enumeration<CommunicationRequestStatus> status;
867
868    /**
869     * The type of message to be sent such as alert, notification, reminder, instruction, etc.
870     */
871    @Child(name = "category", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
872    @Description(shortDefinition="Message category", formalDefinition="The type of message to be sent such as alert, notification, reminder, instruction, etc." )
873    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/communication-category")
874    protected List<CodeableConcept> category;
875
876    /**
877     * Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.
878     */
879    @Child(name = "priority", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
880    @Description(shortDefinition="Message urgency", formalDefinition="Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine." )
881    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
882    protected Enumeration<CommunicationPriority> priority;
883
884    /**
885     * A channel that was used for this communication (e.g. email, fax).
886     */
887    @Child(name = "medium", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
888    @Description(shortDefinition="A channel of communication", formalDefinition="A channel that was used for this communication (e.g. email, fax)." )
889    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ParticipationMode")
890    protected List<CodeableConcept> medium;
891
892    /**
893     * The patient or group that is the focus of this communication request.
894     */
895    @Child(name = "subject", type = {Patient.class, Group.class}, order=8, min=0, max=1, modifier=false, summary=false)
896    @Description(shortDefinition="Focus of message", formalDefinition="The patient or group that is the focus of this communication request." )
897    protected Reference subject;
898
899    /**
900     * The actual object that is the target of the reference (The patient or group that is the focus of this communication request.)
901     */
902    protected Resource subjectTarget;
903
904    /**
905     * The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.
906     */
907    @Child(name = "recipient", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Group.class, CareTeam.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
908    @Description(shortDefinition="Message recipient", formalDefinition="The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication." )
909    protected List<Reference> recipient;
910    /**
911     * The actual objects that are the target of the reference (The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.)
912     */
913    protected List<Resource> recipientTarget;
914
915
916    /**
917     * The resources which were related to producing this communication request.
918     */
919    @Child(name = "topic", type = {Reference.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
920    @Description(shortDefinition="Focal resources", formalDefinition="The resources which were related to producing this communication request." )
921    protected List<Reference> topic;
922    /**
923     * The actual objects that are the target of the reference (The resources which were related to producing this communication request.)
924     */
925    protected List<Resource> topicTarget;
926
927
928    /**
929     * The encounter or episode of care within which the communication request was created.
930     */
931    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=11, min=0, max=1, modifier=false, summary=true)
932    @Description(shortDefinition="Encounter or episode leading to message", formalDefinition="The encounter or episode of care within which the communication request was created." )
933    protected Reference context;
934
935    /**
936     * The actual object that is the target of the reference (The encounter or episode of care within which the communication request was created.)
937     */
938    protected Resource contextTarget;
939
940    /**
941     * Text, attachment(s), or resource(s) to be communicated to the recipient.
942     */
943    @Child(name = "payload", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
944    @Description(shortDefinition="Message payload", formalDefinition="Text, attachment(s), or resource(s) to be communicated to the recipient." )
945    protected List<CommunicationRequestPayloadComponent> payload;
946
947    /**
948     * The time when this communication is to occur.
949     */
950    @Child(name = "occurrence", type = {DateTimeType.class, Period.class}, order=13, min=0, max=1, modifier=false, summary=true)
951    @Description(shortDefinition="When scheduled", formalDefinition="The time when this communication is to occur." )
952    protected Type occurrence;
953
954    /**
955     * For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.
956     */
957    @Child(name = "authoredOn", type = {DateTimeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
958    @Description(shortDefinition="When request transitioned to being actionable", formalDefinition="For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation." )
959    protected DateTimeType authoredOn;
960
961    /**
962     * The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.
963     */
964    @Child(name = "sender", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=15, min=0, max=1, modifier=false, summary=false)
965    @Description(shortDefinition="Message sender", formalDefinition="The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication." )
966    protected Reference sender;
967
968    /**
969     * The actual object that is the target of the reference (The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.)
970     */
971    protected Resource senderTarget;
972
973    /**
974     * The individual who initiated the request and has responsibility for its activation.
975     */
976    @Child(name = "requester", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
977    @Description(shortDefinition="Who/what is requesting service", formalDefinition="The individual who initiated the request and has responsibility for its activation." )
978    protected CommunicationRequestRequesterComponent requester;
979
980    /**
981     * Describes why the request is being made in coded or textual form.
982     */
983    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
984    @Description(shortDefinition="Why is communication needed?", formalDefinition="Describes why the request is being made in coded or textual form." )
985    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActReason")
986    protected List<CodeableConcept> reasonCode;
987
988    /**
989     * Indicates another resource whose existence justifies this request.
990     */
991    @Child(name = "reasonReference", type = {Condition.class, Observation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
992    @Description(shortDefinition="Why is communication needed?", formalDefinition="Indicates another resource whose existence justifies this request." )
993    protected List<Reference> reasonReference;
994    /**
995     * The actual objects that are the target of the reference (Indicates another resource whose existence justifies this request.)
996     */
997    protected List<Resource> reasonReferenceTarget;
998
999
1000    /**
1001     * Comments made about the request by the requester, sender, recipient, subject or other participants.
1002     */
1003    @Child(name = "note", type = {Annotation.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1004    @Description(shortDefinition="Comments made about communication request", formalDefinition="Comments made about the request by the requester, sender, recipient, subject or other participants." )
1005    protected List<Annotation> note;
1006
1007    private static final long serialVersionUID = -722867744L;
1008
1009  /**
1010   * Constructor
1011   */
1012    public CommunicationRequest() {
1013      super();
1014    }
1015
1016  /**
1017   * Constructor
1018   */
1019    public CommunicationRequest(Enumeration<CommunicationRequestStatus> status) {
1020      super();
1021      this.status = status;
1022    }
1023
1024    /**
1025     * @return {@link #identifier} (A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system.)
1026     */
1027    public List<Identifier> getIdentifier() { 
1028      if (this.identifier == null)
1029        this.identifier = new ArrayList<Identifier>();
1030      return this.identifier;
1031    }
1032
1033    /**
1034     * @return Returns a reference to <code>this</code> for easy method chaining
1035     */
1036    public CommunicationRequest setIdentifier(List<Identifier> theIdentifier) { 
1037      this.identifier = theIdentifier;
1038      return this;
1039    }
1040
1041    public boolean hasIdentifier() { 
1042      if (this.identifier == null)
1043        return false;
1044      for (Identifier item : this.identifier)
1045        if (!item.isEmpty())
1046          return true;
1047      return false;
1048    }
1049
1050    public Identifier addIdentifier() { //3
1051      Identifier t = new Identifier();
1052      if (this.identifier == null)
1053        this.identifier = new ArrayList<Identifier>();
1054      this.identifier.add(t);
1055      return t;
1056    }
1057
1058    public CommunicationRequest addIdentifier(Identifier t) { //3
1059      if (t == null)
1060        return this;
1061      if (this.identifier == null)
1062        this.identifier = new ArrayList<Identifier>();
1063      this.identifier.add(t);
1064      return this;
1065    }
1066
1067    /**
1068     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1069     */
1070    public Identifier getIdentifierFirstRep() { 
1071      if (getIdentifier().isEmpty()) {
1072        addIdentifier();
1073      }
1074      return getIdentifier().get(0);
1075    }
1076
1077    /**
1078     * @return {@link #basedOn} (A plan or proposal that is fulfilled in whole or in part by this request.)
1079     */
1080    public List<Reference> getBasedOn() { 
1081      if (this.basedOn == null)
1082        this.basedOn = new ArrayList<Reference>();
1083      return this.basedOn;
1084    }
1085
1086    /**
1087     * @return Returns a reference to <code>this</code> for easy method chaining
1088     */
1089    public CommunicationRequest setBasedOn(List<Reference> theBasedOn) { 
1090      this.basedOn = theBasedOn;
1091      return this;
1092    }
1093
1094    public boolean hasBasedOn() { 
1095      if (this.basedOn == null)
1096        return false;
1097      for (Reference item : this.basedOn)
1098        if (!item.isEmpty())
1099          return true;
1100      return false;
1101    }
1102
1103    public Reference addBasedOn() { //3
1104      Reference t = new Reference();
1105      if (this.basedOn == null)
1106        this.basedOn = new ArrayList<Reference>();
1107      this.basedOn.add(t);
1108      return t;
1109    }
1110
1111    public CommunicationRequest addBasedOn(Reference t) { //3
1112      if (t == null)
1113        return this;
1114      if (this.basedOn == null)
1115        this.basedOn = new ArrayList<Reference>();
1116      this.basedOn.add(t);
1117      return this;
1118    }
1119
1120    /**
1121     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
1122     */
1123    public Reference getBasedOnFirstRep() { 
1124      if (getBasedOn().isEmpty()) {
1125        addBasedOn();
1126      }
1127      return getBasedOn().get(0);
1128    }
1129
1130    /**
1131     * @deprecated Use Reference#setResource(IBaseResource) instead
1132     */
1133    @Deprecated
1134    public List<Resource> getBasedOnTarget() { 
1135      if (this.basedOnTarget == null)
1136        this.basedOnTarget = new ArrayList<Resource>();
1137      return this.basedOnTarget;
1138    }
1139
1140    /**
1141     * @return {@link #replaces} (Completed or terminated request(s) whose function is taken by this new request.)
1142     */
1143    public List<Reference> getReplaces() { 
1144      if (this.replaces == null)
1145        this.replaces = new ArrayList<Reference>();
1146      return this.replaces;
1147    }
1148
1149    /**
1150     * @return Returns a reference to <code>this</code> for easy method chaining
1151     */
1152    public CommunicationRequest setReplaces(List<Reference> theReplaces) { 
1153      this.replaces = theReplaces;
1154      return this;
1155    }
1156
1157    public boolean hasReplaces() { 
1158      if (this.replaces == null)
1159        return false;
1160      for (Reference item : this.replaces)
1161        if (!item.isEmpty())
1162          return true;
1163      return false;
1164    }
1165
1166    public Reference addReplaces() { //3
1167      Reference t = new Reference();
1168      if (this.replaces == null)
1169        this.replaces = new ArrayList<Reference>();
1170      this.replaces.add(t);
1171      return t;
1172    }
1173
1174    public CommunicationRequest addReplaces(Reference t) { //3
1175      if (t == null)
1176        return this;
1177      if (this.replaces == null)
1178        this.replaces = new ArrayList<Reference>();
1179      this.replaces.add(t);
1180      return this;
1181    }
1182
1183    /**
1184     * @return The first repetition of repeating field {@link #replaces}, creating it if it does not already exist
1185     */
1186    public Reference getReplacesFirstRep() { 
1187      if (getReplaces().isEmpty()) {
1188        addReplaces();
1189      }
1190      return getReplaces().get(0);
1191    }
1192
1193    /**
1194     * @deprecated Use Reference#setResource(IBaseResource) instead
1195     */
1196    @Deprecated
1197    public List<CommunicationRequest> getReplacesTarget() { 
1198      if (this.replacesTarget == null)
1199        this.replacesTarget = new ArrayList<CommunicationRequest>();
1200      return this.replacesTarget;
1201    }
1202
1203    /**
1204     * @deprecated Use Reference#setResource(IBaseResource) instead
1205     */
1206    @Deprecated
1207    public CommunicationRequest addReplacesTarget() { 
1208      CommunicationRequest r = new CommunicationRequest();
1209      if (this.replacesTarget == null)
1210        this.replacesTarget = new ArrayList<CommunicationRequest>();
1211      this.replacesTarget.add(r);
1212      return r;
1213    }
1214
1215    /**
1216     * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.)
1217     */
1218    public Identifier getGroupIdentifier() { 
1219      if (this.groupIdentifier == null)
1220        if (Configuration.errorOnAutoCreate())
1221          throw new Error("Attempt to auto-create CommunicationRequest.groupIdentifier");
1222        else if (Configuration.doAutoCreate())
1223          this.groupIdentifier = new Identifier(); // cc
1224      return this.groupIdentifier;
1225    }
1226
1227    public boolean hasGroupIdentifier() { 
1228      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
1229    }
1230
1231    /**
1232     * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.)
1233     */
1234    public CommunicationRequest setGroupIdentifier(Identifier value)  { 
1235      this.groupIdentifier = value;
1236      return this;
1237    }
1238
1239    /**
1240     * @return {@link #status} (The status of the proposal or order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1241     */
1242    public Enumeration<CommunicationRequestStatus> getStatusElement() { 
1243      if (this.status == null)
1244        if (Configuration.errorOnAutoCreate())
1245          throw new Error("Attempt to auto-create CommunicationRequest.status");
1246        else if (Configuration.doAutoCreate())
1247          this.status = new Enumeration<CommunicationRequestStatus>(new CommunicationRequestStatusEnumFactory()); // bb
1248      return this.status;
1249    }
1250
1251    public boolean hasStatusElement() { 
1252      return this.status != null && !this.status.isEmpty();
1253    }
1254
1255    public boolean hasStatus() { 
1256      return this.status != null && !this.status.isEmpty();
1257    }
1258
1259    /**
1260     * @param value {@link #status} (The status of the proposal or order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1261     */
1262    public CommunicationRequest setStatusElement(Enumeration<CommunicationRequestStatus> value) { 
1263      this.status = value;
1264      return this;
1265    }
1266
1267    /**
1268     * @return The status of the proposal or order.
1269     */
1270    public CommunicationRequestStatus getStatus() { 
1271      return this.status == null ? null : this.status.getValue();
1272    }
1273
1274    /**
1275     * @param value The status of the proposal or order.
1276     */
1277    public CommunicationRequest setStatus(CommunicationRequestStatus value) { 
1278        if (this.status == null)
1279          this.status = new Enumeration<CommunicationRequestStatus>(new CommunicationRequestStatusEnumFactory());
1280        this.status.setValue(value);
1281      return this;
1282    }
1283
1284    /**
1285     * @return {@link #category} (The type of message to be sent such as alert, notification, reminder, instruction, etc.)
1286     */
1287    public List<CodeableConcept> getCategory() { 
1288      if (this.category == null)
1289        this.category = new ArrayList<CodeableConcept>();
1290      return this.category;
1291    }
1292
1293    /**
1294     * @return Returns a reference to <code>this</code> for easy method chaining
1295     */
1296    public CommunicationRequest setCategory(List<CodeableConcept> theCategory) { 
1297      this.category = theCategory;
1298      return this;
1299    }
1300
1301    public boolean hasCategory() { 
1302      if (this.category == null)
1303        return false;
1304      for (CodeableConcept item : this.category)
1305        if (!item.isEmpty())
1306          return true;
1307      return false;
1308    }
1309
1310    public CodeableConcept addCategory() { //3
1311      CodeableConcept t = new CodeableConcept();
1312      if (this.category == null)
1313        this.category = new ArrayList<CodeableConcept>();
1314      this.category.add(t);
1315      return t;
1316    }
1317
1318    public CommunicationRequest addCategory(CodeableConcept t) { //3
1319      if (t == null)
1320        return this;
1321      if (this.category == null)
1322        this.category = new ArrayList<CodeableConcept>();
1323      this.category.add(t);
1324      return this;
1325    }
1326
1327    /**
1328     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
1329     */
1330    public CodeableConcept getCategoryFirstRep() { 
1331      if (getCategory().isEmpty()) {
1332        addCategory();
1333      }
1334      return getCategory().get(0);
1335    }
1336
1337    /**
1338     * @return {@link #priority} (Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1339     */
1340    public Enumeration<CommunicationPriority> getPriorityElement() { 
1341      if (this.priority == null)
1342        if (Configuration.errorOnAutoCreate())
1343          throw new Error("Attempt to auto-create CommunicationRequest.priority");
1344        else if (Configuration.doAutoCreate())
1345          this.priority = new Enumeration<CommunicationPriority>(new CommunicationPriorityEnumFactory()); // bb
1346      return this.priority;
1347    }
1348
1349    public boolean hasPriorityElement() { 
1350      return this.priority != null && !this.priority.isEmpty();
1351    }
1352
1353    public boolean hasPriority() { 
1354      return this.priority != null && !this.priority.isEmpty();
1355    }
1356
1357    /**
1358     * @param value {@link #priority} (Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1359     */
1360    public CommunicationRequest setPriorityElement(Enumeration<CommunicationPriority> value) { 
1361      this.priority = value;
1362      return this;
1363    }
1364
1365    /**
1366     * @return Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.
1367     */
1368    public CommunicationPriority getPriority() { 
1369      return this.priority == null ? null : this.priority.getValue();
1370    }
1371
1372    /**
1373     * @param value Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.
1374     */
1375    public CommunicationRequest setPriority(CommunicationPriority value) { 
1376      if (value == null)
1377        this.priority = null;
1378      else {
1379        if (this.priority == null)
1380          this.priority = new Enumeration<CommunicationPriority>(new CommunicationPriorityEnumFactory());
1381        this.priority.setValue(value);
1382      }
1383      return this;
1384    }
1385
1386    /**
1387     * @return {@link #medium} (A channel that was used for this communication (e.g. email, fax).)
1388     */
1389    public List<CodeableConcept> getMedium() { 
1390      if (this.medium == null)
1391        this.medium = new ArrayList<CodeableConcept>();
1392      return this.medium;
1393    }
1394
1395    /**
1396     * @return Returns a reference to <code>this</code> for easy method chaining
1397     */
1398    public CommunicationRequest setMedium(List<CodeableConcept> theMedium) { 
1399      this.medium = theMedium;
1400      return this;
1401    }
1402
1403    public boolean hasMedium() { 
1404      if (this.medium == null)
1405        return false;
1406      for (CodeableConcept item : this.medium)
1407        if (!item.isEmpty())
1408          return true;
1409      return false;
1410    }
1411
1412    public CodeableConcept addMedium() { //3
1413      CodeableConcept t = new CodeableConcept();
1414      if (this.medium == null)
1415        this.medium = new ArrayList<CodeableConcept>();
1416      this.medium.add(t);
1417      return t;
1418    }
1419
1420    public CommunicationRequest addMedium(CodeableConcept t) { //3
1421      if (t == null)
1422        return this;
1423      if (this.medium == null)
1424        this.medium = new ArrayList<CodeableConcept>();
1425      this.medium.add(t);
1426      return this;
1427    }
1428
1429    /**
1430     * @return The first repetition of repeating field {@link #medium}, creating it if it does not already exist
1431     */
1432    public CodeableConcept getMediumFirstRep() { 
1433      if (getMedium().isEmpty()) {
1434        addMedium();
1435      }
1436      return getMedium().get(0);
1437    }
1438
1439    /**
1440     * @return {@link #subject} (The patient or group that is the focus of this communication request.)
1441     */
1442    public Reference getSubject() { 
1443      if (this.subject == null)
1444        if (Configuration.errorOnAutoCreate())
1445          throw new Error("Attempt to auto-create CommunicationRequest.subject");
1446        else if (Configuration.doAutoCreate())
1447          this.subject = new Reference(); // cc
1448      return this.subject;
1449    }
1450
1451    public boolean hasSubject() { 
1452      return this.subject != null && !this.subject.isEmpty();
1453    }
1454
1455    /**
1456     * @param value {@link #subject} (The patient or group that is the focus of this communication request.)
1457     */
1458    public CommunicationRequest setSubject(Reference value)  { 
1459      this.subject = value;
1460      return this;
1461    }
1462
1463    /**
1464     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient or group that is the focus of this communication request.)
1465     */
1466    public Resource getSubjectTarget() { 
1467      return this.subjectTarget;
1468    }
1469
1470    /**
1471     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient or group that is the focus of this communication request.)
1472     */
1473    public CommunicationRequest setSubjectTarget(Resource value) { 
1474      this.subjectTarget = value;
1475      return this;
1476    }
1477
1478    /**
1479     * @return {@link #recipient} (The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.)
1480     */
1481    public List<Reference> getRecipient() { 
1482      if (this.recipient == null)
1483        this.recipient = new ArrayList<Reference>();
1484      return this.recipient;
1485    }
1486
1487    /**
1488     * @return Returns a reference to <code>this</code> for easy method chaining
1489     */
1490    public CommunicationRequest setRecipient(List<Reference> theRecipient) { 
1491      this.recipient = theRecipient;
1492      return this;
1493    }
1494
1495    public boolean hasRecipient() { 
1496      if (this.recipient == null)
1497        return false;
1498      for (Reference item : this.recipient)
1499        if (!item.isEmpty())
1500          return true;
1501      return false;
1502    }
1503
1504    public Reference addRecipient() { //3
1505      Reference t = new Reference();
1506      if (this.recipient == null)
1507        this.recipient = new ArrayList<Reference>();
1508      this.recipient.add(t);
1509      return t;
1510    }
1511
1512    public CommunicationRequest addRecipient(Reference t) { //3
1513      if (t == null)
1514        return this;
1515      if (this.recipient == null)
1516        this.recipient = new ArrayList<Reference>();
1517      this.recipient.add(t);
1518      return this;
1519    }
1520
1521    /**
1522     * @return The first repetition of repeating field {@link #recipient}, creating it if it does not already exist
1523     */
1524    public Reference getRecipientFirstRep() { 
1525      if (getRecipient().isEmpty()) {
1526        addRecipient();
1527      }
1528      return getRecipient().get(0);
1529    }
1530
1531    /**
1532     * @deprecated Use Reference#setResource(IBaseResource) instead
1533     */
1534    @Deprecated
1535    public List<Resource> getRecipientTarget() { 
1536      if (this.recipientTarget == null)
1537        this.recipientTarget = new ArrayList<Resource>();
1538      return this.recipientTarget;
1539    }
1540
1541    /**
1542     * @return {@link #topic} (The resources which were related to producing this communication request.)
1543     */
1544    public List<Reference> getTopic() { 
1545      if (this.topic == null)
1546        this.topic = new ArrayList<Reference>();
1547      return this.topic;
1548    }
1549
1550    /**
1551     * @return Returns a reference to <code>this</code> for easy method chaining
1552     */
1553    public CommunicationRequest setTopic(List<Reference> theTopic) { 
1554      this.topic = theTopic;
1555      return this;
1556    }
1557
1558    public boolean hasTopic() { 
1559      if (this.topic == null)
1560        return false;
1561      for (Reference item : this.topic)
1562        if (!item.isEmpty())
1563          return true;
1564      return false;
1565    }
1566
1567    public Reference addTopic() { //3
1568      Reference t = new Reference();
1569      if (this.topic == null)
1570        this.topic = new ArrayList<Reference>();
1571      this.topic.add(t);
1572      return t;
1573    }
1574
1575    public CommunicationRequest addTopic(Reference t) { //3
1576      if (t == null)
1577        return this;
1578      if (this.topic == null)
1579        this.topic = new ArrayList<Reference>();
1580      this.topic.add(t);
1581      return this;
1582    }
1583
1584    /**
1585     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
1586     */
1587    public Reference getTopicFirstRep() { 
1588      if (getTopic().isEmpty()) {
1589        addTopic();
1590      }
1591      return getTopic().get(0);
1592    }
1593
1594    /**
1595     * @deprecated Use Reference#setResource(IBaseResource) instead
1596     */
1597    @Deprecated
1598    public List<Resource> getTopicTarget() { 
1599      if (this.topicTarget == null)
1600        this.topicTarget = new ArrayList<Resource>();
1601      return this.topicTarget;
1602    }
1603
1604    /**
1605     * @return {@link #context} (The encounter or episode of care within which the communication request was created.)
1606     */
1607    public Reference getContext() { 
1608      if (this.context == null)
1609        if (Configuration.errorOnAutoCreate())
1610          throw new Error("Attempt to auto-create CommunicationRequest.context");
1611        else if (Configuration.doAutoCreate())
1612          this.context = new Reference(); // cc
1613      return this.context;
1614    }
1615
1616    public boolean hasContext() { 
1617      return this.context != null && !this.context.isEmpty();
1618    }
1619
1620    /**
1621     * @param value {@link #context} (The encounter or episode of care within which the communication request was created.)
1622     */
1623    public CommunicationRequest setContext(Reference value)  { 
1624      this.context = value;
1625      return this;
1626    }
1627
1628    /**
1629     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter or episode of care within which the communication request was created.)
1630     */
1631    public Resource getContextTarget() { 
1632      return this.contextTarget;
1633    }
1634
1635    /**
1636     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter or episode of care within which the communication request was created.)
1637     */
1638    public CommunicationRequest setContextTarget(Resource value) { 
1639      this.contextTarget = value;
1640      return this;
1641    }
1642
1643    /**
1644     * @return {@link #payload} (Text, attachment(s), or resource(s) to be communicated to the recipient.)
1645     */
1646    public List<CommunicationRequestPayloadComponent> getPayload() { 
1647      if (this.payload == null)
1648        this.payload = new ArrayList<CommunicationRequestPayloadComponent>();
1649      return this.payload;
1650    }
1651
1652    /**
1653     * @return Returns a reference to <code>this</code> for easy method chaining
1654     */
1655    public CommunicationRequest setPayload(List<CommunicationRequestPayloadComponent> thePayload) { 
1656      this.payload = thePayload;
1657      return this;
1658    }
1659
1660    public boolean hasPayload() { 
1661      if (this.payload == null)
1662        return false;
1663      for (CommunicationRequestPayloadComponent item : this.payload)
1664        if (!item.isEmpty())
1665          return true;
1666      return false;
1667    }
1668
1669    public CommunicationRequestPayloadComponent addPayload() { //3
1670      CommunicationRequestPayloadComponent t = new CommunicationRequestPayloadComponent();
1671      if (this.payload == null)
1672        this.payload = new ArrayList<CommunicationRequestPayloadComponent>();
1673      this.payload.add(t);
1674      return t;
1675    }
1676
1677    public CommunicationRequest addPayload(CommunicationRequestPayloadComponent t) { //3
1678      if (t == null)
1679        return this;
1680      if (this.payload == null)
1681        this.payload = new ArrayList<CommunicationRequestPayloadComponent>();
1682      this.payload.add(t);
1683      return this;
1684    }
1685
1686    /**
1687     * @return The first repetition of repeating field {@link #payload}, creating it if it does not already exist
1688     */
1689    public CommunicationRequestPayloadComponent getPayloadFirstRep() { 
1690      if (getPayload().isEmpty()) {
1691        addPayload();
1692      }
1693      return getPayload().get(0);
1694    }
1695
1696    /**
1697     * @return {@link #occurrence} (The time when this communication is to occur.)
1698     */
1699    public Type getOccurrence() { 
1700      return this.occurrence;
1701    }
1702
1703    /**
1704     * @return {@link #occurrence} (The time when this communication is to occur.)
1705     */
1706    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1707      if (this.occurrence == null)
1708        return null;
1709      if (!(this.occurrence instanceof DateTimeType))
1710        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1711      return (DateTimeType) this.occurrence;
1712    }
1713
1714    public boolean hasOccurrenceDateTimeType() { 
1715      return this != null && this.occurrence instanceof DateTimeType;
1716    }
1717
1718    /**
1719     * @return {@link #occurrence} (The time when this communication is to occur.)
1720     */
1721    public Period getOccurrencePeriod() throws FHIRException { 
1722      if (this.occurrence == null)
1723        return null;
1724      if (!(this.occurrence instanceof Period))
1725        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1726      return (Period) this.occurrence;
1727    }
1728
1729    public boolean hasOccurrencePeriod() { 
1730      return this != null && this.occurrence instanceof Period;
1731    }
1732
1733    public boolean hasOccurrence() { 
1734      return this.occurrence != null && !this.occurrence.isEmpty();
1735    }
1736
1737    /**
1738     * @param value {@link #occurrence} (The time when this communication is to occur.)
1739     */
1740    public CommunicationRequest setOccurrence(Type value) throws FHIRFormatError { 
1741      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1742        throw new FHIRFormatError("Not the right type for CommunicationRequest.occurrence[x]: "+value.fhirType());
1743      this.occurrence = value;
1744      return this;
1745    }
1746
1747    /**
1748     * @return {@link #authoredOn} (For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1749     */
1750    public DateTimeType getAuthoredOnElement() { 
1751      if (this.authoredOn == null)
1752        if (Configuration.errorOnAutoCreate())
1753          throw new Error("Attempt to auto-create CommunicationRequest.authoredOn");
1754        else if (Configuration.doAutoCreate())
1755          this.authoredOn = new DateTimeType(); // bb
1756      return this.authoredOn;
1757    }
1758
1759    public boolean hasAuthoredOnElement() { 
1760      return this.authoredOn != null && !this.authoredOn.isEmpty();
1761    }
1762
1763    public boolean hasAuthoredOn() { 
1764      return this.authoredOn != null && !this.authoredOn.isEmpty();
1765    }
1766
1767    /**
1768     * @param value {@link #authoredOn} (For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1769     */
1770    public CommunicationRequest setAuthoredOnElement(DateTimeType value) { 
1771      this.authoredOn = value;
1772      return this;
1773    }
1774
1775    /**
1776     * @return For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.
1777     */
1778    public Date getAuthoredOn() { 
1779      return this.authoredOn == null ? null : this.authoredOn.getValue();
1780    }
1781
1782    /**
1783     * @param value For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.
1784     */
1785    public CommunicationRequest setAuthoredOn(Date value) { 
1786      if (value == null)
1787        this.authoredOn = null;
1788      else {
1789        if (this.authoredOn == null)
1790          this.authoredOn = new DateTimeType();
1791        this.authoredOn.setValue(value);
1792      }
1793      return this;
1794    }
1795
1796    /**
1797     * @return {@link #sender} (The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.)
1798     */
1799    public Reference getSender() { 
1800      if (this.sender == null)
1801        if (Configuration.errorOnAutoCreate())
1802          throw new Error("Attempt to auto-create CommunicationRequest.sender");
1803        else if (Configuration.doAutoCreate())
1804          this.sender = new Reference(); // cc
1805      return this.sender;
1806    }
1807
1808    public boolean hasSender() { 
1809      return this.sender != null && !this.sender.isEmpty();
1810    }
1811
1812    /**
1813     * @param value {@link #sender} (The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.)
1814     */
1815    public CommunicationRequest setSender(Reference value)  { 
1816      this.sender = value;
1817      return this;
1818    }
1819
1820    /**
1821     * @return {@link #sender} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.)
1822     */
1823    public Resource getSenderTarget() { 
1824      return this.senderTarget;
1825    }
1826
1827    /**
1828     * @param value {@link #sender} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.)
1829     */
1830    public CommunicationRequest setSenderTarget(Resource value) { 
1831      this.senderTarget = value;
1832      return this;
1833    }
1834
1835    /**
1836     * @return {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1837     */
1838    public CommunicationRequestRequesterComponent getRequester() { 
1839      if (this.requester == null)
1840        if (Configuration.errorOnAutoCreate())
1841          throw new Error("Attempt to auto-create CommunicationRequest.requester");
1842        else if (Configuration.doAutoCreate())
1843          this.requester = new CommunicationRequestRequesterComponent(); // cc
1844      return this.requester;
1845    }
1846
1847    public boolean hasRequester() { 
1848      return this.requester != null && !this.requester.isEmpty();
1849    }
1850
1851    /**
1852     * @param value {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1853     */
1854    public CommunicationRequest setRequester(CommunicationRequestRequesterComponent value)  { 
1855      this.requester = value;
1856      return this;
1857    }
1858
1859    /**
1860     * @return {@link #reasonCode} (Describes why the request is being made in coded or textual form.)
1861     */
1862    public List<CodeableConcept> getReasonCode() { 
1863      if (this.reasonCode == null)
1864        this.reasonCode = new ArrayList<CodeableConcept>();
1865      return this.reasonCode;
1866    }
1867
1868    /**
1869     * @return Returns a reference to <code>this</code> for easy method chaining
1870     */
1871    public CommunicationRequest setReasonCode(List<CodeableConcept> theReasonCode) { 
1872      this.reasonCode = theReasonCode;
1873      return this;
1874    }
1875
1876    public boolean hasReasonCode() { 
1877      if (this.reasonCode == null)
1878        return false;
1879      for (CodeableConcept item : this.reasonCode)
1880        if (!item.isEmpty())
1881          return true;
1882      return false;
1883    }
1884
1885    public CodeableConcept addReasonCode() { //3
1886      CodeableConcept t = new CodeableConcept();
1887      if (this.reasonCode == null)
1888        this.reasonCode = new ArrayList<CodeableConcept>();
1889      this.reasonCode.add(t);
1890      return t;
1891    }
1892
1893    public CommunicationRequest addReasonCode(CodeableConcept t) { //3
1894      if (t == null)
1895        return this;
1896      if (this.reasonCode == null)
1897        this.reasonCode = new ArrayList<CodeableConcept>();
1898      this.reasonCode.add(t);
1899      return this;
1900    }
1901
1902    /**
1903     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1904     */
1905    public CodeableConcept getReasonCodeFirstRep() { 
1906      if (getReasonCode().isEmpty()) {
1907        addReasonCode();
1908      }
1909      return getReasonCode().get(0);
1910    }
1911
1912    /**
1913     * @return {@link #reasonReference} (Indicates another resource whose existence justifies this request.)
1914     */
1915    public List<Reference> getReasonReference() { 
1916      if (this.reasonReference == null)
1917        this.reasonReference = new ArrayList<Reference>();
1918      return this.reasonReference;
1919    }
1920
1921    /**
1922     * @return Returns a reference to <code>this</code> for easy method chaining
1923     */
1924    public CommunicationRequest setReasonReference(List<Reference> theReasonReference) { 
1925      this.reasonReference = theReasonReference;
1926      return this;
1927    }
1928
1929    public boolean hasReasonReference() { 
1930      if (this.reasonReference == null)
1931        return false;
1932      for (Reference item : this.reasonReference)
1933        if (!item.isEmpty())
1934          return true;
1935      return false;
1936    }
1937
1938    public Reference addReasonReference() { //3
1939      Reference t = new Reference();
1940      if (this.reasonReference == null)
1941        this.reasonReference = new ArrayList<Reference>();
1942      this.reasonReference.add(t);
1943      return t;
1944    }
1945
1946    public CommunicationRequest addReasonReference(Reference t) { //3
1947      if (t == null)
1948        return this;
1949      if (this.reasonReference == null)
1950        this.reasonReference = new ArrayList<Reference>();
1951      this.reasonReference.add(t);
1952      return this;
1953    }
1954
1955    /**
1956     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1957     */
1958    public Reference getReasonReferenceFirstRep() { 
1959      if (getReasonReference().isEmpty()) {
1960        addReasonReference();
1961      }
1962      return getReasonReference().get(0);
1963    }
1964
1965    /**
1966     * @deprecated Use Reference#setResource(IBaseResource) instead
1967     */
1968    @Deprecated
1969    public List<Resource> getReasonReferenceTarget() { 
1970      if (this.reasonReferenceTarget == null)
1971        this.reasonReferenceTarget = new ArrayList<Resource>();
1972      return this.reasonReferenceTarget;
1973    }
1974
1975    /**
1976     * @return {@link #note} (Comments made about the request by the requester, sender, recipient, subject or other participants.)
1977     */
1978    public List<Annotation> getNote() { 
1979      if (this.note == null)
1980        this.note = new ArrayList<Annotation>();
1981      return this.note;
1982    }
1983
1984    /**
1985     * @return Returns a reference to <code>this</code> for easy method chaining
1986     */
1987    public CommunicationRequest setNote(List<Annotation> theNote) { 
1988      this.note = theNote;
1989      return this;
1990    }
1991
1992    public boolean hasNote() { 
1993      if (this.note == null)
1994        return false;
1995      for (Annotation item : this.note)
1996        if (!item.isEmpty())
1997          return true;
1998      return false;
1999    }
2000
2001    public Annotation addNote() { //3
2002      Annotation t = new Annotation();
2003      if (this.note == null)
2004        this.note = new ArrayList<Annotation>();
2005      this.note.add(t);
2006      return t;
2007    }
2008
2009    public CommunicationRequest addNote(Annotation t) { //3
2010      if (t == null)
2011        return this;
2012      if (this.note == null)
2013        this.note = new ArrayList<Annotation>();
2014      this.note.add(t);
2015      return this;
2016    }
2017
2018    /**
2019     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2020     */
2021    public Annotation getNoteFirstRep() { 
2022      if (getNote().isEmpty()) {
2023        addNote();
2024      }
2025      return getNote().get(0);
2026    }
2027
2028      protected void listChildren(List<Property> children) {
2029        super.listChildren(children);
2030        children.add(new Property("identifier", "Identifier", "A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system.", 0, java.lang.Integer.MAX_VALUE, identifier));
2031        children.add(new Property("basedOn", "Reference(Any)", "A plan or proposal that is fulfilled in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2032        children.add(new Property("replaces", "Reference(CommunicationRequest)", "Completed or terminated request(s) whose function is taken by this new request.", 0, java.lang.Integer.MAX_VALUE, replaces));
2033        children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.", 0, 1, groupIdentifier));
2034        children.add(new Property("status", "code", "The status of the proposal or order.", 0, 1, status));
2035        children.add(new Property("category", "CodeableConcept", "The type of message to be sent such as alert, notification, reminder, instruction, etc.", 0, java.lang.Integer.MAX_VALUE, category));
2036        children.add(new Property("priority", "code", "Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.", 0, 1, priority));
2037        children.add(new Property("medium", "CodeableConcept", "A channel that was used for this communication (e.g. email, fax).", 0, java.lang.Integer.MAX_VALUE, medium));
2038        children.add(new Property("subject", "Reference(Patient|Group)", "The patient or group that is the focus of this communication request.", 0, 1, subject));
2039        children.add(new Property("recipient", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson|Group|CareTeam)", "The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.", 0, java.lang.Integer.MAX_VALUE, recipient));
2040        children.add(new Property("topic", "Reference(Any)", "The resources which were related to producing this communication request.", 0, java.lang.Integer.MAX_VALUE, topic));
2041        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care within which the communication request was created.", 0, 1, context));
2042        children.add(new Property("payload", "", "Text, attachment(s), or resource(s) to be communicated to the recipient.", 0, java.lang.Integer.MAX_VALUE, payload));
2043        children.add(new Property("occurrence[x]", "dateTime|Period", "The time when this communication is to occur.", 0, 1, occurrence));
2044        children.add(new Property("authoredOn", "dateTime", "For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.", 0, 1, authoredOn));
2045        children.add(new Property("sender", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.", 0, 1, sender));
2046        children.add(new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester));
2047        children.add(new Property("reasonCode", "CodeableConcept", "Describes why the request is being made in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2048        children.add(new Property("reasonReference", "Reference(Condition|Observation)", "Indicates another resource whose existence justifies this request.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2049        children.add(new Property("note", "Annotation", "Comments made about the request by the requester, sender, recipient, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
2050      }
2051
2052      @Override
2053      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2054        switch (_hash) {
2055        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system.", 0, java.lang.Integer.MAX_VALUE, identifier);
2056        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(Any)", "A plan or proposal that is fulfilled in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2057        case -430332865: /*replaces*/  return new Property("replaces", "Reference(CommunicationRequest)", "Completed or terminated request(s) whose function is taken by this new request.", 0, java.lang.Integer.MAX_VALUE, replaces);
2058        case -445338488: /*groupIdentifier*/  return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.", 0, 1, groupIdentifier);
2059        case -892481550: /*status*/  return new Property("status", "code", "The status of the proposal or order.", 0, 1, status);
2060        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The type of message to be sent such as alert, notification, reminder, instruction, etc.", 0, java.lang.Integer.MAX_VALUE, category);
2061        case -1165461084: /*priority*/  return new Property("priority", "code", "Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.", 0, 1, priority);
2062        case -1078030475: /*medium*/  return new Property("medium", "CodeableConcept", "A channel that was used for this communication (e.g. email, fax).", 0, java.lang.Integer.MAX_VALUE, medium);
2063        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The patient or group that is the focus of this communication request.", 0, 1, subject);
2064        case 820081177: /*recipient*/  return new Property("recipient", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson|Group|CareTeam)", "The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.", 0, java.lang.Integer.MAX_VALUE, recipient);
2065        case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The resources which were related to producing this communication request.", 0, java.lang.Integer.MAX_VALUE, topic);
2066        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care within which the communication request was created.", 0, 1, context);
2067        case -786701938: /*payload*/  return new Property("payload", "", "Text, attachment(s), or resource(s) to be communicated to the recipient.", 0, java.lang.Integer.MAX_VALUE, payload);
2068        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period", "The time when this communication is to occur.", 0, 1, occurrence);
2069        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period", "The time when this communication is to occur.", 0, 1, occurrence);
2070        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period", "The time when this communication is to occur.", 0, 1, occurrence);
2071        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period", "The time when this communication is to occur.", 0, 1, occurrence);
2072        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.", 0, 1, authoredOn);
2073        case -905962955: /*sender*/  return new Property("sender", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.", 0, 1, sender);
2074        case 693933948: /*requester*/  return new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
2075        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Describes why the request is being made in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2076        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation)", "Indicates another resource whose existence justifies this request.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2077        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the request by the requester, sender, recipient, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
2078        default: return super.getNamedProperty(_hash, _name, _checkValid);
2079        }
2080
2081      }
2082
2083      @Override
2084      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2085        switch (hash) {
2086        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2087        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2088        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
2089        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
2090        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CommunicationRequestStatus>
2091        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2092        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<CommunicationPriority>
2093        case -1078030475: /*medium*/ return this.medium == null ? new Base[0] : this.medium.toArray(new Base[this.medium.size()]); // CodeableConcept
2094        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2095        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : this.recipient.toArray(new Base[this.recipient.size()]); // Reference
2096        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // Reference
2097        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
2098        case -786701938: /*payload*/ return this.payload == null ? new Base[0] : this.payload.toArray(new Base[this.payload.size()]); // CommunicationRequestPayloadComponent
2099        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
2100        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
2101        case -905962955: /*sender*/ return this.sender == null ? new Base[0] : new Base[] {this.sender}; // Reference
2102        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // CommunicationRequestRequesterComponent
2103        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2104        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2105        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2106        default: return super.getProperty(hash, name, checkValid);
2107        }
2108
2109      }
2110
2111      @Override
2112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2113        switch (hash) {
2114        case -1618432855: // identifier
2115          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2116          return value;
2117        case -332612366: // basedOn
2118          this.getBasedOn().add(castToReference(value)); // Reference
2119          return value;
2120        case -430332865: // replaces
2121          this.getReplaces().add(castToReference(value)); // Reference
2122          return value;
2123        case -445338488: // groupIdentifier
2124          this.groupIdentifier = castToIdentifier(value); // Identifier
2125          return value;
2126        case -892481550: // status
2127          value = new CommunicationRequestStatusEnumFactory().fromType(castToCode(value));
2128          this.status = (Enumeration) value; // Enumeration<CommunicationRequestStatus>
2129          return value;
2130        case 50511102: // category
2131          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2132          return value;
2133        case -1165461084: // priority
2134          value = new CommunicationPriorityEnumFactory().fromType(castToCode(value));
2135          this.priority = (Enumeration) value; // Enumeration<CommunicationPriority>
2136          return value;
2137        case -1078030475: // medium
2138          this.getMedium().add(castToCodeableConcept(value)); // CodeableConcept
2139          return value;
2140        case -1867885268: // subject
2141          this.subject = castToReference(value); // Reference
2142          return value;
2143        case 820081177: // recipient
2144          this.getRecipient().add(castToReference(value)); // Reference
2145          return value;
2146        case 110546223: // topic
2147          this.getTopic().add(castToReference(value)); // Reference
2148          return value;
2149        case 951530927: // context
2150          this.context = castToReference(value); // Reference
2151          return value;
2152        case -786701938: // payload
2153          this.getPayload().add((CommunicationRequestPayloadComponent) value); // CommunicationRequestPayloadComponent
2154          return value;
2155        case 1687874001: // occurrence
2156          this.occurrence = castToType(value); // Type
2157          return value;
2158        case -1500852503: // authoredOn
2159          this.authoredOn = castToDateTime(value); // DateTimeType
2160          return value;
2161        case -905962955: // sender
2162          this.sender = castToReference(value); // Reference
2163          return value;
2164        case 693933948: // requester
2165          this.requester = (CommunicationRequestRequesterComponent) value; // CommunicationRequestRequesterComponent
2166          return value;
2167        case 722137681: // reasonCode
2168          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2169          return value;
2170        case -1146218137: // reasonReference
2171          this.getReasonReference().add(castToReference(value)); // Reference
2172          return value;
2173        case 3387378: // note
2174          this.getNote().add(castToAnnotation(value)); // Annotation
2175          return value;
2176        default: return super.setProperty(hash, name, value);
2177        }
2178
2179      }
2180
2181      @Override
2182      public Base setProperty(String name, Base value) throws FHIRException {
2183        if (name.equals("identifier")) {
2184          this.getIdentifier().add(castToIdentifier(value));
2185        } else if (name.equals("basedOn")) {
2186          this.getBasedOn().add(castToReference(value));
2187        } else if (name.equals("replaces")) {
2188          this.getReplaces().add(castToReference(value));
2189        } else if (name.equals("groupIdentifier")) {
2190          this.groupIdentifier = castToIdentifier(value); // Identifier
2191        } else if (name.equals("status")) {
2192          value = new CommunicationRequestStatusEnumFactory().fromType(castToCode(value));
2193          this.status = (Enumeration) value; // Enumeration<CommunicationRequestStatus>
2194        } else if (name.equals("category")) {
2195          this.getCategory().add(castToCodeableConcept(value));
2196        } else if (name.equals("priority")) {
2197          value = new CommunicationPriorityEnumFactory().fromType(castToCode(value));
2198          this.priority = (Enumeration) value; // Enumeration<CommunicationPriority>
2199        } else if (name.equals("medium")) {
2200          this.getMedium().add(castToCodeableConcept(value));
2201        } else if (name.equals("subject")) {
2202          this.subject = castToReference(value); // Reference
2203        } else if (name.equals("recipient")) {
2204          this.getRecipient().add(castToReference(value));
2205        } else if (name.equals("topic")) {
2206          this.getTopic().add(castToReference(value));
2207        } else if (name.equals("context")) {
2208          this.context = castToReference(value); // Reference
2209        } else if (name.equals("payload")) {
2210          this.getPayload().add((CommunicationRequestPayloadComponent) value);
2211        } else if (name.equals("occurrence[x]")) {
2212          this.occurrence = castToType(value); // Type
2213        } else if (name.equals("authoredOn")) {
2214          this.authoredOn = castToDateTime(value); // DateTimeType
2215        } else if (name.equals("sender")) {
2216          this.sender = castToReference(value); // Reference
2217        } else if (name.equals("requester")) {
2218          this.requester = (CommunicationRequestRequesterComponent) value; // CommunicationRequestRequesterComponent
2219        } else if (name.equals("reasonCode")) {
2220          this.getReasonCode().add(castToCodeableConcept(value));
2221        } else if (name.equals("reasonReference")) {
2222          this.getReasonReference().add(castToReference(value));
2223        } else if (name.equals("note")) {
2224          this.getNote().add(castToAnnotation(value));
2225        } else
2226          return super.setProperty(name, value);
2227        return value;
2228      }
2229
2230      @Override
2231      public Base makeProperty(int hash, String name) throws FHIRException {
2232        switch (hash) {
2233        case -1618432855:  return addIdentifier(); 
2234        case -332612366:  return addBasedOn(); 
2235        case -430332865:  return addReplaces(); 
2236        case -445338488:  return getGroupIdentifier(); 
2237        case -892481550:  return getStatusElement();
2238        case 50511102:  return addCategory(); 
2239        case -1165461084:  return getPriorityElement();
2240        case -1078030475:  return addMedium(); 
2241        case -1867885268:  return getSubject(); 
2242        case 820081177:  return addRecipient(); 
2243        case 110546223:  return addTopic(); 
2244        case 951530927:  return getContext(); 
2245        case -786701938:  return addPayload(); 
2246        case -2022646513:  return getOccurrence(); 
2247        case 1687874001:  return getOccurrence(); 
2248        case -1500852503:  return getAuthoredOnElement();
2249        case -905962955:  return getSender(); 
2250        case 693933948:  return getRequester(); 
2251        case 722137681:  return addReasonCode(); 
2252        case -1146218137:  return addReasonReference(); 
2253        case 3387378:  return addNote(); 
2254        default: return super.makeProperty(hash, name);
2255        }
2256
2257      }
2258
2259      @Override
2260      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2261        switch (hash) {
2262        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2263        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2264        case -430332865: /*replaces*/ return new String[] {"Reference"};
2265        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
2266        case -892481550: /*status*/ return new String[] {"code"};
2267        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2268        case -1165461084: /*priority*/ return new String[] {"code"};
2269        case -1078030475: /*medium*/ return new String[] {"CodeableConcept"};
2270        case -1867885268: /*subject*/ return new String[] {"Reference"};
2271        case 820081177: /*recipient*/ return new String[] {"Reference"};
2272        case 110546223: /*topic*/ return new String[] {"Reference"};
2273        case 951530927: /*context*/ return new String[] {"Reference"};
2274        case -786701938: /*payload*/ return new String[] {};
2275        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period"};
2276        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
2277        case -905962955: /*sender*/ return new String[] {"Reference"};
2278        case 693933948: /*requester*/ return new String[] {};
2279        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2280        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2281        case 3387378: /*note*/ return new String[] {"Annotation"};
2282        default: return super.getTypesForProperty(hash, name);
2283        }
2284
2285      }
2286
2287      @Override
2288      public Base addChild(String name) throws FHIRException {
2289        if (name.equals("identifier")) {
2290          return addIdentifier();
2291        }
2292        else if (name.equals("basedOn")) {
2293          return addBasedOn();
2294        }
2295        else if (name.equals("replaces")) {
2296          return addReplaces();
2297        }
2298        else if (name.equals("groupIdentifier")) {
2299          this.groupIdentifier = new Identifier();
2300          return this.groupIdentifier;
2301        }
2302        else if (name.equals("status")) {
2303          throw new FHIRException("Cannot call addChild on a primitive type CommunicationRequest.status");
2304        }
2305        else if (name.equals("category")) {
2306          return addCategory();
2307        }
2308        else if (name.equals("priority")) {
2309          throw new FHIRException("Cannot call addChild on a primitive type CommunicationRequest.priority");
2310        }
2311        else if (name.equals("medium")) {
2312          return addMedium();
2313        }
2314        else if (name.equals("subject")) {
2315          this.subject = new Reference();
2316          return this.subject;
2317        }
2318        else if (name.equals("recipient")) {
2319          return addRecipient();
2320        }
2321        else if (name.equals("topic")) {
2322          return addTopic();
2323        }
2324        else if (name.equals("context")) {
2325          this.context = new Reference();
2326          return this.context;
2327        }
2328        else if (name.equals("payload")) {
2329          return addPayload();
2330        }
2331        else if (name.equals("occurrenceDateTime")) {
2332          this.occurrence = new DateTimeType();
2333          return this.occurrence;
2334        }
2335        else if (name.equals("occurrencePeriod")) {
2336          this.occurrence = new Period();
2337          return this.occurrence;
2338        }
2339        else if (name.equals("authoredOn")) {
2340          throw new FHIRException("Cannot call addChild on a primitive type CommunicationRequest.authoredOn");
2341        }
2342        else if (name.equals("sender")) {
2343          this.sender = new Reference();
2344          return this.sender;
2345        }
2346        else if (name.equals("requester")) {
2347          this.requester = new CommunicationRequestRequesterComponent();
2348          return this.requester;
2349        }
2350        else if (name.equals("reasonCode")) {
2351          return addReasonCode();
2352        }
2353        else if (name.equals("reasonReference")) {
2354          return addReasonReference();
2355        }
2356        else if (name.equals("note")) {
2357          return addNote();
2358        }
2359        else
2360          return super.addChild(name);
2361      }
2362
2363  public String fhirType() {
2364    return "CommunicationRequest";
2365
2366  }
2367
2368      public CommunicationRequest copy() {
2369        CommunicationRequest dst = new CommunicationRequest();
2370        copyValues(dst);
2371        if (identifier != null) {
2372          dst.identifier = new ArrayList<Identifier>();
2373          for (Identifier i : identifier)
2374            dst.identifier.add(i.copy());
2375        };
2376        if (basedOn != null) {
2377          dst.basedOn = new ArrayList<Reference>();
2378          for (Reference i : basedOn)
2379            dst.basedOn.add(i.copy());
2380        };
2381        if (replaces != null) {
2382          dst.replaces = new ArrayList<Reference>();
2383          for (Reference i : replaces)
2384            dst.replaces.add(i.copy());
2385        };
2386        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
2387        dst.status = status == null ? null : status.copy();
2388        if (category != null) {
2389          dst.category = new ArrayList<CodeableConcept>();
2390          for (CodeableConcept i : category)
2391            dst.category.add(i.copy());
2392        };
2393        dst.priority = priority == null ? null : priority.copy();
2394        if (medium != null) {
2395          dst.medium = new ArrayList<CodeableConcept>();
2396          for (CodeableConcept i : medium)
2397            dst.medium.add(i.copy());
2398        };
2399        dst.subject = subject == null ? null : subject.copy();
2400        if (recipient != null) {
2401          dst.recipient = new ArrayList<Reference>();
2402          for (Reference i : recipient)
2403            dst.recipient.add(i.copy());
2404        };
2405        if (topic != null) {
2406          dst.topic = new ArrayList<Reference>();
2407          for (Reference i : topic)
2408            dst.topic.add(i.copy());
2409        };
2410        dst.context = context == null ? null : context.copy();
2411        if (payload != null) {
2412          dst.payload = new ArrayList<CommunicationRequestPayloadComponent>();
2413          for (CommunicationRequestPayloadComponent i : payload)
2414            dst.payload.add(i.copy());
2415        };
2416        dst.occurrence = occurrence == null ? null : occurrence.copy();
2417        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
2418        dst.sender = sender == null ? null : sender.copy();
2419        dst.requester = requester == null ? null : requester.copy();
2420        if (reasonCode != null) {
2421          dst.reasonCode = new ArrayList<CodeableConcept>();
2422          for (CodeableConcept i : reasonCode)
2423            dst.reasonCode.add(i.copy());
2424        };
2425        if (reasonReference != null) {
2426          dst.reasonReference = new ArrayList<Reference>();
2427          for (Reference i : reasonReference)
2428            dst.reasonReference.add(i.copy());
2429        };
2430        if (note != null) {
2431          dst.note = new ArrayList<Annotation>();
2432          for (Annotation i : note)
2433            dst.note.add(i.copy());
2434        };
2435        return dst;
2436      }
2437
2438      protected CommunicationRequest typedCopy() {
2439        return copy();
2440      }
2441
2442      @Override
2443      public boolean equalsDeep(Base other_) {
2444        if (!super.equalsDeep(other_))
2445          return false;
2446        if (!(other_ instanceof CommunicationRequest))
2447          return false;
2448        CommunicationRequest o = (CommunicationRequest) other_;
2449        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(replaces, o.replaces, true)
2450           && compareDeep(groupIdentifier, o.groupIdentifier, true) && compareDeep(status, o.status, true)
2451           && compareDeep(category, o.category, true) && compareDeep(priority, o.priority, true) && compareDeep(medium, o.medium, true)
2452           && compareDeep(subject, o.subject, true) && compareDeep(recipient, o.recipient, true) && compareDeep(topic, o.topic, true)
2453           && compareDeep(context, o.context, true) && compareDeep(payload, o.payload, true) && compareDeep(occurrence, o.occurrence, true)
2454           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(sender, o.sender, true) && compareDeep(requester, o.requester, true)
2455           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2456           && compareDeep(note, o.note, true);
2457      }
2458
2459      @Override
2460      public boolean equalsShallow(Base other_) {
2461        if (!super.equalsShallow(other_))
2462          return false;
2463        if (!(other_ instanceof CommunicationRequest))
2464          return false;
2465        CommunicationRequest o = (CommunicationRequest) other_;
2466        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(authoredOn, o.authoredOn, true)
2467          ;
2468      }
2469
2470      public boolean isEmpty() {
2471        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, replaces
2472          , groupIdentifier, status, category, priority, medium, subject, recipient, topic
2473          , context, payload, occurrence, authoredOn, sender, requester, reasonCode, reasonReference
2474          , note);
2475      }
2476
2477  @Override
2478  public ResourceType getResourceType() {
2479    return ResourceType.CommunicationRequest;
2480   }
2481
2482 /**
2483   * Search parameter: <b>requester</b>
2484   * <p>
2485   * Description: <b>Individual making the request</b><br>
2486   * Type: <b>reference</b><br>
2487   * Path: <b>CommunicationRequest.requester.agent</b><br>
2488   * </p>
2489   */
2490  @SearchParamDefinition(name="requester", path="CommunicationRequest.requester.agent", description="Individual making the request", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2491  public static final String SP_REQUESTER = "requester";
2492 /**
2493   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
2494   * <p>
2495   * Description: <b>Individual making the request</b><br>
2496   * Type: <b>reference</b><br>
2497   * Path: <b>CommunicationRequest.requester.agent</b><br>
2498   * </p>
2499   */
2500  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
2501
2502/**
2503   * Constant for fluent queries to be used to add include statements. Specifies
2504   * the path value of "<b>CommunicationRequest:requester</b>".
2505   */
2506  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("CommunicationRequest:requester").toLocked();
2507
2508 /**
2509   * Search parameter: <b>authored</b>
2510   * <p>
2511   * Description: <b>When request transitioned to being actionable</b><br>
2512   * Type: <b>date</b><br>
2513   * Path: <b>CommunicationRequest.authoredOn</b><br>
2514   * </p>
2515   */
2516  @SearchParamDefinition(name="authored", path="CommunicationRequest.authoredOn", description="When request transitioned to being actionable", type="date" )
2517  public static final String SP_AUTHORED = "authored";
2518 /**
2519   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
2520   * <p>
2521   * Description: <b>When request transitioned to being actionable</b><br>
2522   * Type: <b>date</b><br>
2523   * Path: <b>CommunicationRequest.authoredOn</b><br>
2524   * </p>
2525   */
2526  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED);
2527
2528 /**
2529   * Search parameter: <b>identifier</b>
2530   * <p>
2531   * Description: <b>Unique identifier</b><br>
2532   * Type: <b>token</b><br>
2533   * Path: <b>CommunicationRequest.identifier</b><br>
2534   * </p>
2535   */
2536  @SearchParamDefinition(name="identifier", path="CommunicationRequest.identifier", description="Unique identifier", type="token" )
2537  public static final String SP_IDENTIFIER = "identifier";
2538 /**
2539   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2540   * <p>
2541   * Description: <b>Unique identifier</b><br>
2542   * Type: <b>token</b><br>
2543   * Path: <b>CommunicationRequest.identifier</b><br>
2544   * </p>
2545   */
2546  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2547
2548 /**
2549   * Search parameter: <b>subject</b>
2550   * <p>
2551   * Description: <b>Focus of message</b><br>
2552   * Type: <b>reference</b><br>
2553   * Path: <b>CommunicationRequest.subject</b><br>
2554   * </p>
2555   */
2556  @SearchParamDefinition(name="subject", path="CommunicationRequest.subject", description="Focus of message", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } )
2557  public static final String SP_SUBJECT = "subject";
2558 /**
2559   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2560   * <p>
2561   * Description: <b>Focus of message</b><br>
2562   * Type: <b>reference</b><br>
2563   * Path: <b>CommunicationRequest.subject</b><br>
2564   * </p>
2565   */
2566  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2567
2568/**
2569   * Constant for fluent queries to be used to add include statements. Specifies
2570   * the path value of "<b>CommunicationRequest:subject</b>".
2571   */
2572  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CommunicationRequest:subject").toLocked();
2573
2574 /**
2575   * Search parameter: <b>replaces</b>
2576   * <p>
2577   * Description: <b>Request(s) replaced by this request</b><br>
2578   * Type: <b>reference</b><br>
2579   * Path: <b>CommunicationRequest.replaces</b><br>
2580   * </p>
2581   */
2582  @SearchParamDefinition(name="replaces", path="CommunicationRequest.replaces", description="Request(s) replaced by this request", type="reference", target={CommunicationRequest.class } )
2583  public static final String SP_REPLACES = "replaces";
2584 /**
2585   * <b>Fluent Client</b> search parameter constant for <b>replaces</b>
2586   * <p>
2587   * Description: <b>Request(s) replaced by this request</b><br>
2588   * Type: <b>reference</b><br>
2589   * Path: <b>CommunicationRequest.replaces</b><br>
2590   * </p>
2591   */
2592  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPLACES = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REPLACES);
2593
2594/**
2595   * Constant for fluent queries to be used to add include statements. Specifies
2596   * the path value of "<b>CommunicationRequest:replaces</b>".
2597   */
2598  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPLACES = new ca.uhn.fhir.model.api.Include("CommunicationRequest:replaces").toLocked();
2599
2600 /**
2601   * Search parameter: <b>medium</b>
2602   * <p>
2603   * Description: <b>A channel of communication</b><br>
2604   * Type: <b>token</b><br>
2605   * Path: <b>CommunicationRequest.medium</b><br>
2606   * </p>
2607   */
2608  @SearchParamDefinition(name="medium", path="CommunicationRequest.medium", description="A channel of communication", type="token" )
2609  public static final String SP_MEDIUM = "medium";
2610 /**
2611   * <b>Fluent Client</b> search parameter constant for <b>medium</b>
2612   * <p>
2613   * Description: <b>A channel of communication</b><br>
2614   * Type: <b>token</b><br>
2615   * Path: <b>CommunicationRequest.medium</b><br>
2616   * </p>
2617   */
2618  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MEDIUM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MEDIUM);
2619
2620 /**
2621   * Search parameter: <b>occurrence</b>
2622   * <p>
2623   * Description: <b>When scheduled</b><br>
2624   * Type: <b>date</b><br>
2625   * Path: <b>CommunicationRequest.occurrenceDateTime</b><br>
2626   * </p>
2627   */
2628  @SearchParamDefinition(name="occurrence", path="CommunicationRequest.occurrence.as(DateTime)", description="When scheduled", type="date" )
2629  public static final String SP_OCCURRENCE = "occurrence";
2630 /**
2631   * <b>Fluent Client</b> search parameter constant for <b>occurrence</b>
2632   * <p>
2633   * Description: <b>When scheduled</b><br>
2634   * Type: <b>date</b><br>
2635   * Path: <b>CommunicationRequest.occurrenceDateTime</b><br>
2636   * </p>
2637   */
2638  public static final ca.uhn.fhir.rest.gclient.DateClientParam OCCURRENCE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_OCCURRENCE);
2639
2640 /**
2641   * Search parameter: <b>encounter</b>
2642   * <p>
2643   * Description: <b>Encounter leading to message</b><br>
2644   * Type: <b>reference</b><br>
2645   * Path: <b>CommunicationRequest.context</b><br>
2646   * </p>
2647   */
2648  @SearchParamDefinition(name="encounter", path="CommunicationRequest.context", description="Encounter leading to message", type="reference", target={Encounter.class } )
2649  public static final String SP_ENCOUNTER = "encounter";
2650 /**
2651   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2652   * <p>
2653   * Description: <b>Encounter leading to message</b><br>
2654   * Type: <b>reference</b><br>
2655   * Path: <b>CommunicationRequest.context</b><br>
2656   * </p>
2657   */
2658  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2659
2660/**
2661   * Constant for fluent queries to be used to add include statements. Specifies
2662   * the path value of "<b>CommunicationRequest:encounter</b>".
2663   */
2664  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("CommunicationRequest:encounter").toLocked();
2665
2666 /**
2667   * Search parameter: <b>priority</b>
2668   * <p>
2669   * Description: <b>Message urgency</b><br>
2670   * Type: <b>token</b><br>
2671   * Path: <b>CommunicationRequest.priority</b><br>
2672   * </p>
2673   */
2674  @SearchParamDefinition(name="priority", path="CommunicationRequest.priority", description="Message urgency", type="token" )
2675  public static final String SP_PRIORITY = "priority";
2676 /**
2677   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
2678   * <p>
2679   * Description: <b>Message urgency</b><br>
2680   * Type: <b>token</b><br>
2681   * Path: <b>CommunicationRequest.priority</b><br>
2682   * </p>
2683   */
2684  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
2685
2686 /**
2687   * Search parameter: <b>group-identifier</b>
2688   * <p>
2689   * Description: <b>Composite request this is part of</b><br>
2690   * Type: <b>token</b><br>
2691   * Path: <b>CommunicationRequest.groupIdentifier</b><br>
2692   * </p>
2693   */
2694  @SearchParamDefinition(name="group-identifier", path="CommunicationRequest.groupIdentifier", description="Composite request this is part of", type="token" )
2695  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
2696 /**
2697   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
2698   * <p>
2699   * Description: <b>Composite request this is part of</b><br>
2700   * Type: <b>token</b><br>
2701   * Path: <b>CommunicationRequest.groupIdentifier</b><br>
2702   * </p>
2703   */
2704  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
2705
2706 /**
2707   * Search parameter: <b>based-on</b>
2708   * <p>
2709   * Description: <b>Fulfills plan or proposal</b><br>
2710   * Type: <b>reference</b><br>
2711   * Path: <b>CommunicationRequest.basedOn</b><br>
2712   * </p>
2713   */
2714  @SearchParamDefinition(name="based-on", path="CommunicationRequest.basedOn", description="Fulfills plan or proposal", type="reference" )
2715  public static final String SP_BASED_ON = "based-on";
2716 /**
2717   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2718   * <p>
2719   * Description: <b>Fulfills plan or proposal</b><br>
2720   * Type: <b>reference</b><br>
2721   * Path: <b>CommunicationRequest.basedOn</b><br>
2722   * </p>
2723   */
2724  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2725
2726/**
2727   * Constant for fluent queries to be used to add include statements. Specifies
2728   * the path value of "<b>CommunicationRequest:based-on</b>".
2729   */
2730  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("CommunicationRequest:based-on").toLocked();
2731
2732 /**
2733   * Search parameter: <b>sender</b>
2734   * <p>
2735   * Description: <b>Message sender</b><br>
2736   * Type: <b>reference</b><br>
2737   * Path: <b>CommunicationRequest.sender</b><br>
2738   * </p>
2739   */
2740  @SearchParamDefinition(name="sender", path="CommunicationRequest.sender", description="Message sender", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2741  public static final String SP_SENDER = "sender";
2742 /**
2743   * <b>Fluent Client</b> search parameter constant for <b>sender</b>
2744   * <p>
2745   * Description: <b>Message sender</b><br>
2746   * Type: <b>reference</b><br>
2747   * Path: <b>CommunicationRequest.sender</b><br>
2748   * </p>
2749   */
2750  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SENDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SENDER);
2751
2752/**
2753   * Constant for fluent queries to be used to add include statements. Specifies
2754   * the path value of "<b>CommunicationRequest:sender</b>".
2755   */
2756  public static final ca.uhn.fhir.model.api.Include INCLUDE_SENDER = new ca.uhn.fhir.model.api.Include("CommunicationRequest:sender").toLocked();
2757
2758 /**
2759   * Search parameter: <b>patient</b>
2760   * <p>
2761   * Description: <b>Focus of message</b><br>
2762   * Type: <b>reference</b><br>
2763   * Path: <b>CommunicationRequest.subject</b><br>
2764   * </p>
2765   */
2766  @SearchParamDefinition(name="patient", path="CommunicationRequest.subject", description="Focus of message", type="reference", target={Patient.class } )
2767  public static final String SP_PATIENT = "patient";
2768 /**
2769   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2770   * <p>
2771   * Description: <b>Focus of message</b><br>
2772   * Type: <b>reference</b><br>
2773   * Path: <b>CommunicationRequest.subject</b><br>
2774   * </p>
2775   */
2776  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2777
2778/**
2779   * Constant for fluent queries to be used to add include statements. Specifies
2780   * the path value of "<b>CommunicationRequest:patient</b>".
2781   */
2782  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CommunicationRequest:patient").toLocked();
2783
2784 /**
2785   * Search parameter: <b>recipient</b>
2786   * <p>
2787   * Description: <b>Message recipient</b><br>
2788   * Type: <b>reference</b><br>
2789   * Path: <b>CommunicationRequest.recipient</b><br>
2790   * </p>
2791   */
2792  @SearchParamDefinition(name="recipient", path="CommunicationRequest.recipient", description="Message recipient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={CareTeam.class, Device.class, Group.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2793  public static final String SP_RECIPIENT = "recipient";
2794 /**
2795   * <b>Fluent Client</b> search parameter constant for <b>recipient</b>
2796   * <p>
2797   * Description: <b>Message recipient</b><br>
2798   * Type: <b>reference</b><br>
2799   * Path: <b>CommunicationRequest.recipient</b><br>
2800   * </p>
2801   */
2802  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECIPIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECIPIENT);
2803
2804/**
2805   * Constant for fluent queries to be used to add include statements. Specifies
2806   * the path value of "<b>CommunicationRequest:recipient</b>".
2807   */
2808  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECIPIENT = new ca.uhn.fhir.model.api.Include("CommunicationRequest:recipient").toLocked();
2809
2810 /**
2811   * Search parameter: <b>context</b>
2812   * <p>
2813   * Description: <b>Encounter or episode leading to message</b><br>
2814   * Type: <b>reference</b><br>
2815   * Path: <b>CommunicationRequest.context</b><br>
2816   * </p>
2817   */
2818  @SearchParamDefinition(name="context", path="CommunicationRequest.context", description="Encounter or episode leading to message", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class, EpisodeOfCare.class } )
2819  public static final String SP_CONTEXT = "context";
2820 /**
2821   * <b>Fluent Client</b> search parameter constant for <b>context</b>
2822   * <p>
2823   * Description: <b>Encounter or episode leading to message</b><br>
2824   * Type: <b>reference</b><br>
2825   * Path: <b>CommunicationRequest.context</b><br>
2826   * </p>
2827   */
2828  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
2829
2830/**
2831   * Constant for fluent queries to be used to add include statements. Specifies
2832   * the path value of "<b>CommunicationRequest:context</b>".
2833   */
2834  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("CommunicationRequest:context").toLocked();
2835
2836 /**
2837   * Search parameter: <b>category</b>
2838   * <p>
2839   * Description: <b>Message category</b><br>
2840   * Type: <b>token</b><br>
2841   * Path: <b>CommunicationRequest.category</b><br>
2842   * </p>
2843   */
2844  @SearchParamDefinition(name="category", path="CommunicationRequest.category", description="Message category", type="token" )
2845  public static final String SP_CATEGORY = "category";
2846 /**
2847   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2848   * <p>
2849   * Description: <b>Message category</b><br>
2850   * Type: <b>token</b><br>
2851   * Path: <b>CommunicationRequest.category</b><br>
2852   * </p>
2853   */
2854  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2855
2856 /**
2857   * Search parameter: <b>status</b>
2858   * <p>
2859   * Description: <b>draft | active | suspended | cancelled | completed | entered-in-error | unknown</b><br>
2860   * Type: <b>token</b><br>
2861   * Path: <b>CommunicationRequest.status</b><br>
2862   * </p>
2863   */
2864  @SearchParamDefinition(name="status", path="CommunicationRequest.status", description="draft | active | suspended | cancelled | completed | entered-in-error | unknown", type="token" )
2865  public static final String SP_STATUS = "status";
2866 /**
2867   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2868   * <p>
2869   * Description: <b>draft | active | suspended | cancelled | completed | entered-in-error | unknown</b><br>
2870   * Type: <b>token</b><br>
2871   * Path: <b>CommunicationRequest.status</b><br>
2872   * </p>
2873   */
2874  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2875
2876
2877}