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