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