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