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