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