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