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