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