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