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