001package org.hl7.fhir.dstu2.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Block;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.exceptions.FHIRException;
044
045/**
046 * An occurrence of information being transmitted; e.g. an alert that was sent
047 * to a responsible provider, a public health agency was notified about a
048 * reportable condition.
049 */
050@ResourceDef(name = "Communication", profile = "http://hl7.org/fhir/Profile/Communication")
051public class Communication extends DomainResource {
052
053  public enum CommunicationStatus {
054    /**
055     * The communication transmission is ongoing.
056     */
057    INPROGRESS,
058    /**
059     * The message transmission is complete, i.e., delivered to the recipient's
060     * destination.
061     */
062    COMPLETED,
063    /**
064     * The communication transmission has been held by originating system/user
065     * request.
066     */
067    SUSPENDED,
068    /**
069     * The receiving system has declined to accept the message.
070     */
071    REJECTED,
072    /**
073     * There was a failure in transmitting the message out.
074     */
075    FAILED,
076    /**
077     * added to help the parsers
078     */
079    NULL;
080
081    public static CommunicationStatus fromCode(String codeString) throws FHIRException {
082      if (codeString == null || "".equals(codeString))
083        return null;
084      if ("in-progress".equals(codeString))
085        return INPROGRESS;
086      if ("completed".equals(codeString))
087        return COMPLETED;
088      if ("suspended".equals(codeString))
089        return SUSPENDED;
090      if ("rejected".equals(codeString))
091        return REJECTED;
092      if ("failed".equals(codeString))
093        return FAILED;
094      throw new FHIRException("Unknown CommunicationStatus code '" + codeString + "'");
095    }
096
097    public String toCode() {
098      switch (this) {
099      case INPROGRESS:
100        return "in-progress";
101      case COMPLETED:
102        return "completed";
103      case SUSPENDED:
104        return "suspended";
105      case REJECTED:
106        return "rejected";
107      case FAILED:
108        return "failed";
109      case NULL:
110        return null;
111      default:
112        return "?";
113      }
114    }
115
116    public String getSystem() {
117      switch (this) {
118      case INPROGRESS:
119        return "http://hl7.org/fhir/communication-status";
120      case COMPLETED:
121        return "http://hl7.org/fhir/communication-status";
122      case SUSPENDED:
123        return "http://hl7.org/fhir/communication-status";
124      case REJECTED:
125        return "http://hl7.org/fhir/communication-status";
126      case FAILED:
127        return "http://hl7.org/fhir/communication-status";
128      case NULL:
129        return null;
130      default:
131        return "?";
132      }
133    }
134
135    public String getDefinition() {
136      switch (this) {
137      case INPROGRESS:
138        return "The communication transmission is ongoing.";
139      case COMPLETED:
140        return "The message transmission is complete, i.e., delivered to the recipient's destination.";
141      case SUSPENDED:
142        return "The communication transmission has been held by originating system/user request.";
143      case REJECTED:
144        return "The receiving system has declined to accept the message.";
145      case FAILED:
146        return "There was a failure in transmitting the message out.";
147      case NULL:
148        return null;
149      default:
150        return "?";
151      }
152    }
153
154    public String getDisplay() {
155      switch (this) {
156      case INPROGRESS:
157        return "In Progress";
158      case COMPLETED:
159        return "Completed";
160      case SUSPENDED:
161        return "Suspended";
162      case REJECTED:
163        return "Rejected";
164      case FAILED:
165        return "Failed";
166      case NULL:
167        return null;
168      default:
169        return "?";
170      }
171    }
172  }
173
174  public static class CommunicationStatusEnumFactory implements EnumFactory<CommunicationStatus> {
175    public CommunicationStatus fromCode(String codeString) throws IllegalArgumentException {
176      if (codeString == null || "".equals(codeString))
177        if (codeString == null || "".equals(codeString))
178          return null;
179      if ("in-progress".equals(codeString))
180        return CommunicationStatus.INPROGRESS;
181      if ("completed".equals(codeString))
182        return CommunicationStatus.COMPLETED;
183      if ("suspended".equals(codeString))
184        return CommunicationStatus.SUSPENDED;
185      if ("rejected".equals(codeString))
186        return CommunicationStatus.REJECTED;
187      if ("failed".equals(codeString))
188        return CommunicationStatus.FAILED;
189      throw new IllegalArgumentException("Unknown CommunicationStatus code '" + codeString + "'");
190    }
191
192    public Enumeration<CommunicationStatus> fromType(Base code) throws FHIRException {
193      if (code == null || code.isEmpty())
194        return null;
195      String codeString = ((PrimitiveType) code).asStringValue();
196      if (codeString == null || "".equals(codeString))
197        return null;
198      if ("in-progress".equals(codeString))
199        return new Enumeration<CommunicationStatus>(this, CommunicationStatus.INPROGRESS);
200      if ("completed".equals(codeString))
201        return new Enumeration<CommunicationStatus>(this, CommunicationStatus.COMPLETED);
202      if ("suspended".equals(codeString))
203        return new Enumeration<CommunicationStatus>(this, CommunicationStatus.SUSPENDED);
204      if ("rejected".equals(codeString))
205        return new Enumeration<CommunicationStatus>(this, CommunicationStatus.REJECTED);
206      if ("failed".equals(codeString))
207        return new Enumeration<CommunicationStatus>(this, CommunicationStatus.FAILED);
208      throw new FHIRException("Unknown CommunicationStatus code '" + codeString + "'");
209    }
210
211    public String toCode(CommunicationStatus code) {
212      if (code == CommunicationStatus.INPROGRESS)
213        return "in-progress";
214      if (code == CommunicationStatus.COMPLETED)
215        return "completed";
216      if (code == CommunicationStatus.SUSPENDED)
217        return "suspended";
218      if (code == CommunicationStatus.REJECTED)
219        return "rejected";
220      if (code == CommunicationStatus.FAILED)
221        return "failed";
222      return "?";
223    }
224  }
225
226  @Block()
227  public static class CommunicationPayloadComponent extends BackboneElement implements IBaseBackboneElement {
228    /**
229     * A communicated content (or for multi-part communications, one portion of the
230     * communication).
231     */
232    @Child(name = "content", type = { StringType.class,
233        Attachment.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
234    @Description(shortDefinition = "Message part content", formalDefinition = "A communicated content (or for multi-part communications, one portion of the communication).")
235    protected Type content;
236
237    private static final long serialVersionUID = -1763459053L;
238
239    /*
240     * Constructor
241     */
242    public CommunicationPayloadComponent() {
243      super();
244    }
245
246    /*
247     * Constructor
248     */
249    public CommunicationPayloadComponent(Type content) {
250      super();
251      this.content = content;
252    }
253
254    /**
255     * @return {@link #content} (A communicated content (or for multi-part
256     *         communications, one portion of the communication).)
257     */
258    public Type getContent() {
259      return this.content;
260    }
261
262    /**
263     * @return {@link #content} (A communicated content (or for multi-part
264     *         communications, one portion of the communication).)
265     */
266    public StringType getContentStringType() throws FHIRException {
267      if (!(this.content instanceof StringType))
268        throw new FHIRException("Type mismatch: the type StringType was expected, but "
269            + this.content.getClass().getName() + " was encountered");
270      return (StringType) this.content;
271    }
272
273    public boolean hasContentStringType() {
274      return this.content instanceof StringType;
275    }
276
277    /**
278     * @return {@link #content} (A communicated content (or for multi-part
279     *         communications, one portion of the communication).)
280     */
281    public Attachment getContentAttachment() throws FHIRException {
282      if (!(this.content instanceof Attachment))
283        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
284            + this.content.getClass().getName() + " was encountered");
285      return (Attachment) this.content;
286    }
287
288    public boolean hasContentAttachment() {
289      return this.content instanceof Attachment;
290    }
291
292    /**
293     * @return {@link #content} (A communicated content (or for multi-part
294     *         communications, one portion of the communication).)
295     */
296    public Reference getContentReference() throws FHIRException {
297      if (!(this.content instanceof Reference))
298        throw new FHIRException("Type mismatch: the type Reference was expected, but "
299            + this.content.getClass().getName() + " was encountered");
300      return (Reference) this.content;
301    }
302
303    public boolean hasContentReference() {
304      return this.content instanceof Reference;
305    }
306
307    public boolean hasContent() {
308      return this.content != null && !this.content.isEmpty();
309    }
310
311    /**
312     * @param value {@link #content} (A communicated content (or for multi-part
313     *              communications, one portion of the communication).)
314     */
315    public CommunicationPayloadComponent setContent(Type value) {
316      this.content = value;
317      return this;
318    }
319
320    protected void listChildren(List<Property> childrenList) {
321      super.listChildren(childrenList);
322      childrenList.add(new Property("content[x]", "string|Attachment|Reference(Any)",
323          "A communicated content (or for multi-part communications, one portion of the communication).", 0,
324          java.lang.Integer.MAX_VALUE, content));
325    }
326
327    @Override
328    public void setProperty(String name, Base value) throws FHIRException {
329      if (name.equals("content[x]"))
330        this.content = (Type) value; // Type
331      else
332        super.setProperty(name, value);
333    }
334
335    @Override
336    public Base addChild(String name) throws FHIRException {
337      if (name.equals("contentString")) {
338        this.content = new StringType();
339        return this.content;
340      } else if (name.equals("contentAttachment")) {
341        this.content = new Attachment();
342        return this.content;
343      } else if (name.equals("contentReference")) {
344        this.content = new Reference();
345        return this.content;
346      } else
347        return super.addChild(name);
348    }
349
350    public CommunicationPayloadComponent copy() {
351      CommunicationPayloadComponent dst = new CommunicationPayloadComponent();
352      copyValues(dst);
353      dst.content = content == null ? null : content.copy();
354      return dst;
355    }
356
357    @Override
358    public boolean equalsDeep(Base other) {
359      if (!super.equalsDeep(other))
360        return false;
361      if (!(other instanceof CommunicationPayloadComponent))
362        return false;
363      CommunicationPayloadComponent o = (CommunicationPayloadComponent) other;
364      return compareDeep(content, o.content, true);
365    }
366
367    @Override
368    public boolean equalsShallow(Base other) {
369      if (!super.equalsShallow(other))
370        return false;
371      if (!(other instanceof CommunicationPayloadComponent))
372        return false;
373      CommunicationPayloadComponent o = (CommunicationPayloadComponent) other;
374      return true;
375    }
376
377    public boolean isEmpty() {
378      return super.isEmpty() && (content == null || content.isEmpty());
379    }
380
381    public String fhirType() {
382      return "Communication.payload";
383
384    }
385
386  }
387
388  /**
389   * Identifiers associated with this Communication that are defined by business
390   * processes and/ or used to refer to it when a direct URL reference to the
391   * resource itself is not appropriate (e.g. in CDA documents, or in written /
392   * printed documentation).
393   */
394  @Child(name = "identifier", type = {
395      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
396  @Description(shortDefinition = "Unique identifier", formalDefinition = "Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).")
397  protected List<Identifier> identifier;
398
399  /**
400   * The type of message conveyed such as alert, notification, reminder,
401   * instruction, etc.
402   */
403  @Child(name = "category", type = {
404      CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
405  @Description(shortDefinition = "Message category", formalDefinition = "The type of message conveyed such as alert, notification, reminder, instruction, etc.")
406  protected CodeableConcept category;
407
408  /**
409   * The entity (e.g. person, organization, clinical information system, or
410   * device) which was the source of the communication.
411   */
412  @Child(name = "sender", type = { Device.class, Organization.class, Patient.class, Practitioner.class,
413      RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
414  @Description(shortDefinition = "Message sender", formalDefinition = "The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.")
415  protected Reference sender;
416
417  /**
418   * The actual object that is the target of the reference (The entity (e.g.
419   * person, organization, clinical information system, or device) which was the
420   * source of the communication.)
421   */
422  protected Resource senderTarget;
423
424  /**
425   * The entity (e.g. person, organization, clinical information system, or
426   * device) which was the target of the communication. If receipts need to be
427   * tracked by individual, a separate resource instance will need to be created
428   * for each recipient.  Multiple recipient communications are intended where
429   * either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in
430   * aggregate (all emails confirmed received by a particular time).
431   */
432  @Child(name = "recipient", type = { Device.class, Organization.class, Patient.class, Practitioner.class,
433      RelatedPerson.class,
434      Group.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
435  @Description(shortDefinition = "Message recipient", formalDefinition = "The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient.  Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).")
436  protected List<Reference> recipient;
437  /**
438   * The actual objects that are the target of the reference (The entity (e.g.
439   * person, organization, clinical information system, or device) which was the
440   * target of the communication. If receipts need to be tracked by individual, a
441   * separate resource instance will need to be created for each recipient.
442   *  Multiple recipient communications are intended where either a receipt(s) is
443   * not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails
444   * confirmed received by a particular time).)
445   */
446  protected List<Resource> recipientTarget;
447
448  /**
449   * Text, attachment(s), or resource(s) that was communicated to the recipient.
450   */
451  @Child(name = "payload", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
452  @Description(shortDefinition = "Message payload", formalDefinition = "Text, attachment(s), or resource(s) that was communicated to the recipient.")
453  protected List<CommunicationPayloadComponent> payload;
454
455  /**
456   * A channel that was used for this communication (e.g. email, fax).
457   */
458  @Child(name = "medium", type = {
459      CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
460  @Description(shortDefinition = "A channel of communication", formalDefinition = "A channel that was used for this communication (e.g. email, fax).")
461  protected List<CodeableConcept> medium;
462
463  /**
464   * The status of the transmission.
465   */
466  @Child(name = "status", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = true, summary = true)
467  @Description(shortDefinition = "in-progress | completed | suspended | rejected | failed", formalDefinition = "The status of the transmission.")
468  protected Enumeration<CommunicationStatus> status;
469
470  /**
471   * The encounter within which the communication was sent.
472   */
473  @Child(name = "encounter", type = { Encounter.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
474  @Description(shortDefinition = "Encounter leading to message", formalDefinition = "The encounter within which the communication was sent.")
475  protected Reference encounter;
476
477  /**
478   * The actual object that is the target of the reference (The encounter within
479   * which the communication was sent.)
480   */
481  protected Encounter encounterTarget;
482
483  /**
484   * The time when this communication was sent.
485   */
486  @Child(name = "sent", type = { DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
487  @Description(shortDefinition = "When sent", formalDefinition = "The time when this communication was sent.")
488  protected DateTimeType sent;
489
490  /**
491   * The time when this communication arrived at the destination.
492   */
493  @Child(name = "received", type = {
494      DateTimeType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
495  @Description(shortDefinition = "When received", formalDefinition = "The time when this communication arrived at the destination.")
496  protected DateTimeType received;
497
498  /**
499   * The reason or justification for the communication.
500   */
501  @Child(name = "reason", type = {
502      CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
503  @Description(shortDefinition = "Indication for message", formalDefinition = "The reason or justification for the communication.")
504  protected List<CodeableConcept> reason;
505
506  /**
507   * The patient who was the focus of this communication.
508   */
509  @Child(name = "subject", type = { Patient.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
510  @Description(shortDefinition = "Focus of message", formalDefinition = "The patient who was the focus of this communication.")
511  protected Reference subject;
512
513  /**
514   * The actual object that is the target of the reference (The patient who was
515   * the focus of this communication.)
516   */
517  protected Patient subjectTarget;
518
519  /**
520   * The communication request that was responsible for producing this
521   * communication.
522   */
523  @Child(name = "requestDetail", type = {
524      CommunicationRequest.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
525  @Description(shortDefinition = "CommunicationRequest producing this message", formalDefinition = "The communication request that was responsible for producing this communication.")
526  protected Reference requestDetail;
527
528  /**
529   * The actual object that is the target of the reference (The communication
530   * request that was responsible for producing this communication.)
531   */
532  protected CommunicationRequest requestDetailTarget;
533
534  private static final long serialVersionUID = -1654449146L;
535
536  /*
537   * Constructor
538   */
539  public Communication() {
540    super();
541  }
542
543  /**
544   * @return {@link #identifier} (Identifiers associated with this Communication
545   *         that are defined by business processes and/ or used to refer to it
546   *         when a direct URL reference to the resource itself is not appropriate
547   *         (e.g. in CDA documents, or in written / printed documentation).)
548   */
549  public List<Identifier> getIdentifier() {
550    if (this.identifier == null)
551      this.identifier = new ArrayList<Identifier>();
552    return this.identifier;
553  }
554
555  public boolean hasIdentifier() {
556    if (this.identifier == null)
557      return false;
558    for (Identifier item : this.identifier)
559      if (!item.isEmpty())
560        return true;
561    return false;
562  }
563
564  /**
565   * @return {@link #identifier} (Identifiers associated with this Communication
566   *         that are defined by business processes and/ or used to refer to it
567   *         when a direct URL reference to the resource itself is not appropriate
568   *         (e.g. in CDA documents, or in written / printed documentation).)
569   */
570  // syntactic sugar
571  public Identifier addIdentifier() { // 3
572    Identifier t = new Identifier();
573    if (this.identifier == null)
574      this.identifier = new ArrayList<Identifier>();
575    this.identifier.add(t);
576    return t;
577  }
578
579  // syntactic sugar
580  public Communication addIdentifier(Identifier t) { // 3
581    if (t == null)
582      return this;
583    if (this.identifier == null)
584      this.identifier = new ArrayList<Identifier>();
585    this.identifier.add(t);
586    return this;
587  }
588
589  /**
590   * @return {@link #category} (The type of message conveyed such as alert,
591   *         notification, reminder, instruction, etc.)
592   */
593  public CodeableConcept getCategory() {
594    if (this.category == null)
595      if (Configuration.errorOnAutoCreate())
596        throw new Error("Attempt to auto-create Communication.category");
597      else if (Configuration.doAutoCreate())
598        this.category = new CodeableConcept(); // cc
599    return this.category;
600  }
601
602  public boolean hasCategory() {
603    return this.category != null && !this.category.isEmpty();
604  }
605
606  /**
607   * @param value {@link #category} (The type of message conveyed such as alert,
608   *              notification, reminder, instruction, etc.)
609   */
610  public Communication setCategory(CodeableConcept value) {
611    this.category = value;
612    return this;
613  }
614
615  /**
616   * @return {@link #sender} (The entity (e.g. person, organization, clinical
617   *         information system, or device) which was the source of the
618   *         communication.)
619   */
620  public Reference getSender() {
621    if (this.sender == null)
622      if (Configuration.errorOnAutoCreate())
623        throw new Error("Attempt to auto-create Communication.sender");
624      else if (Configuration.doAutoCreate())
625        this.sender = new Reference(); // cc
626    return this.sender;
627  }
628
629  public boolean hasSender() {
630    return this.sender != null && !this.sender.isEmpty();
631  }
632
633  /**
634   * @param value {@link #sender} (The entity (e.g. person, organization, clinical
635   *              information system, or device) which was the source of the
636   *              communication.)
637   */
638  public Communication setSender(Reference value) {
639    this.sender = value;
640    return this;
641  }
642
643  /**
644   * @return {@link #sender} The actual object that is the target of the
645   *         reference. The reference library doesn't populate this, but you can
646   *         use it to hold the resource if you resolve it. (The entity (e.g.
647   *         person, organization, clinical information system, or device) which
648   *         was the source of the communication.)
649   */
650  public Resource getSenderTarget() {
651    return this.senderTarget;
652  }
653
654  /**
655   * @param value {@link #sender} The actual object that is the target of the
656   *              reference. The reference library doesn't use these, but you can
657   *              use it to hold the resource if you resolve it. (The entity (e.g.
658   *              person, organization, clinical information system, or device)
659   *              which was the source of the communication.)
660   */
661  public Communication setSenderTarget(Resource value) {
662    this.senderTarget = value;
663    return this;
664  }
665
666  /**
667   * @return {@link #recipient} (The entity (e.g. person, organization, clinical
668   *         information system, or device) which was the target of the
669   *         communication. If receipts need to be tracked by individual, a
670   *         separate resource instance will need to be created for each
671   *         recipient.  Multiple recipient communications are intended where
672   *         either a receipt(s) is not tracked (e.g. a mass mail-out) or is
673   *         captured in aggregate (all emails confirmed received by a particular
674   *         time).)
675   */
676  public List<Reference> getRecipient() {
677    if (this.recipient == null)
678      this.recipient = new ArrayList<Reference>();
679    return this.recipient;
680  }
681
682  public boolean hasRecipient() {
683    if (this.recipient == null)
684      return false;
685    for (Reference item : this.recipient)
686      if (!item.isEmpty())
687        return true;
688    return false;
689  }
690
691  /**
692   * @return {@link #recipient} (The entity (e.g. person, organization, clinical
693   *         information system, or device) which was the target of the
694   *         communication. If receipts need to be tracked by individual, a
695   *         separate resource instance will need to be created for each
696   *         recipient.  Multiple recipient communications are intended where
697   *         either a receipt(s) is not tracked (e.g. a mass mail-out) or is
698   *         captured in aggregate (all emails confirmed received by a particular
699   *         time).)
700   */
701  // syntactic sugar
702  public Reference addRecipient() { // 3
703    Reference t = new Reference();
704    if (this.recipient == null)
705      this.recipient = new ArrayList<Reference>();
706    this.recipient.add(t);
707    return t;
708  }
709
710  // syntactic sugar
711  public Communication addRecipient(Reference t) { // 3
712    if (t == null)
713      return this;
714    if (this.recipient == null)
715      this.recipient = new ArrayList<Reference>();
716    this.recipient.add(t);
717    return this;
718  }
719
720  /**
721   * @return {@link #recipient} (The actual objects that are the target of the
722   *         reference. The reference library doesn't populate this, but you can
723   *         use this to hold the resources if you resolvethemt. The entity (e.g.
724   *         person, organization, clinical information system, or device) which
725   *         was the target of the communication. If receipts need to be tracked
726   *         by individual, a separate resource instance will need to be created
727   *         for each recipient.  Multiple recipient communications are intended
728   *         where either a receipt(s) is not tracked (e.g. a mass mail-out) or is
729   *         captured in aggregate (all emails confirmed received by a particular
730   *         time).)
731   */
732  public List<Resource> getRecipientTarget() {
733    if (this.recipientTarget == null)
734      this.recipientTarget = new ArrayList<Resource>();
735    return this.recipientTarget;
736  }
737
738  /**
739   * @return {@link #payload} (Text, attachment(s), or resource(s) that was
740   *         communicated to the recipient.)
741   */
742  public List<CommunicationPayloadComponent> getPayload() {
743    if (this.payload == null)
744      this.payload = new ArrayList<CommunicationPayloadComponent>();
745    return this.payload;
746  }
747
748  public boolean hasPayload() {
749    if (this.payload == null)
750      return false;
751    for (CommunicationPayloadComponent item : this.payload)
752      if (!item.isEmpty())
753        return true;
754    return false;
755  }
756
757  /**
758   * @return {@link #payload} (Text, attachment(s), or resource(s) that was
759   *         communicated to the recipient.)
760   */
761  // syntactic sugar
762  public CommunicationPayloadComponent addPayload() { // 3
763    CommunicationPayloadComponent t = new CommunicationPayloadComponent();
764    if (this.payload == null)
765      this.payload = new ArrayList<CommunicationPayloadComponent>();
766    this.payload.add(t);
767    return t;
768  }
769
770  // syntactic sugar
771  public Communication addPayload(CommunicationPayloadComponent t) { // 3
772    if (t == null)
773      return this;
774    if (this.payload == null)
775      this.payload = new ArrayList<CommunicationPayloadComponent>();
776    this.payload.add(t);
777    return this;
778  }
779
780  /**
781   * @return {@link #medium} (A channel that was used for this communication (e.g.
782   *         email, fax).)
783   */
784  public List<CodeableConcept> getMedium() {
785    if (this.medium == null)
786      this.medium = new ArrayList<CodeableConcept>();
787    return this.medium;
788  }
789
790  public boolean hasMedium() {
791    if (this.medium == null)
792      return false;
793    for (CodeableConcept item : this.medium)
794      if (!item.isEmpty())
795        return true;
796    return false;
797  }
798
799  /**
800   * @return {@link #medium} (A channel that was used for this communication (e.g.
801   *         email, fax).)
802   */
803  // syntactic sugar
804  public CodeableConcept addMedium() { // 3
805    CodeableConcept t = new CodeableConcept();
806    if (this.medium == null)
807      this.medium = new ArrayList<CodeableConcept>();
808    this.medium.add(t);
809    return t;
810  }
811
812  // syntactic sugar
813  public Communication addMedium(CodeableConcept t) { // 3
814    if (t == null)
815      return this;
816    if (this.medium == null)
817      this.medium = new ArrayList<CodeableConcept>();
818    this.medium.add(t);
819    return this;
820  }
821
822  /**
823   * @return {@link #status} (The status of the transmission.). This is the
824   *         underlying object with id, value and extensions. The accessor
825   *         "getStatus" gives direct access to the value
826   */
827  public Enumeration<CommunicationStatus> getStatusElement() {
828    if (this.status == null)
829      if (Configuration.errorOnAutoCreate())
830        throw new Error("Attempt to auto-create Communication.status");
831      else if (Configuration.doAutoCreate())
832        this.status = new Enumeration<CommunicationStatus>(new CommunicationStatusEnumFactory()); // bb
833    return this.status;
834  }
835
836  public boolean hasStatusElement() {
837    return this.status != null && !this.status.isEmpty();
838  }
839
840  public boolean hasStatus() {
841    return this.status != null && !this.status.isEmpty();
842  }
843
844  /**
845   * @param value {@link #status} (The status of the transmission.). This is the
846   *              underlying object with id, value and extensions. The accessor
847   *              "getStatus" gives direct access to the value
848   */
849  public Communication setStatusElement(Enumeration<CommunicationStatus> value) {
850    this.status = value;
851    return this;
852  }
853
854  /**
855   * @return The status of the transmission.
856   */
857  public CommunicationStatus getStatus() {
858    return this.status == null ? null : this.status.getValue();
859  }
860
861  /**
862   * @param value The status of the transmission.
863   */
864  public Communication setStatus(CommunicationStatus value) {
865    if (value == null)
866      this.status = null;
867    else {
868      if (this.status == null)
869        this.status = new Enumeration<CommunicationStatus>(new CommunicationStatusEnumFactory());
870      this.status.setValue(value);
871    }
872    return this;
873  }
874
875  /**
876   * @return {@link #encounter} (The encounter within which the communication was
877   *         sent.)
878   */
879  public Reference getEncounter() {
880    if (this.encounter == null)
881      if (Configuration.errorOnAutoCreate())
882        throw new Error("Attempt to auto-create Communication.encounter");
883      else if (Configuration.doAutoCreate())
884        this.encounter = new Reference(); // cc
885    return this.encounter;
886  }
887
888  public boolean hasEncounter() {
889    return this.encounter != null && !this.encounter.isEmpty();
890  }
891
892  /**
893   * @param value {@link #encounter} (The encounter within which the communication
894   *              was sent.)
895   */
896  public Communication setEncounter(Reference value) {
897    this.encounter = value;
898    return this;
899  }
900
901  /**
902   * @return {@link #encounter} The actual object that is the target of the
903   *         reference. The reference library doesn't populate this, but you can
904   *         use it to hold the resource if you resolve it. (The encounter within
905   *         which the communication was sent.)
906   */
907  public Encounter getEncounterTarget() {
908    if (this.encounterTarget == null)
909      if (Configuration.errorOnAutoCreate())
910        throw new Error("Attempt to auto-create Communication.encounter");
911      else if (Configuration.doAutoCreate())
912        this.encounterTarget = new Encounter(); // aa
913    return this.encounterTarget;
914  }
915
916  /**
917   * @param value {@link #encounter} The actual object that is the target of the
918   *              reference. The reference library doesn't use these, but you can
919   *              use it to hold the resource if you resolve it. (The encounter
920   *              within which the communication was sent.)
921   */
922  public Communication setEncounterTarget(Encounter value) {
923    this.encounterTarget = value;
924    return this;
925  }
926
927  /**
928   * @return {@link #sent} (The time when this communication was sent.). This is
929   *         the underlying object with id, value and extensions. The accessor
930   *         "getSent" gives direct access to the value
931   */
932  public DateTimeType getSentElement() {
933    if (this.sent == null)
934      if (Configuration.errorOnAutoCreate())
935        throw new Error("Attempt to auto-create Communication.sent");
936      else if (Configuration.doAutoCreate())
937        this.sent = new DateTimeType(); // bb
938    return this.sent;
939  }
940
941  public boolean hasSentElement() {
942    return this.sent != null && !this.sent.isEmpty();
943  }
944
945  public boolean hasSent() {
946    return this.sent != null && !this.sent.isEmpty();
947  }
948
949  /**
950   * @param value {@link #sent} (The time when this communication was sent.). This
951   *              is the underlying object with id, value and extensions. The
952   *              accessor "getSent" gives direct access to the value
953   */
954  public Communication setSentElement(DateTimeType value) {
955    this.sent = value;
956    return this;
957  }
958
959  /**
960   * @return The time when this communication was sent.
961   */
962  public Date getSent() {
963    return this.sent == null ? null : this.sent.getValue();
964  }
965
966  /**
967   * @param value The time when this communication was sent.
968   */
969  public Communication setSent(Date value) {
970    if (value == null)
971      this.sent = null;
972    else {
973      if (this.sent == null)
974        this.sent = new DateTimeType();
975      this.sent.setValue(value);
976    }
977    return this;
978  }
979
980  /**
981   * @return {@link #received} (The time when this communication arrived at the
982   *         destination.). This is the underlying object with id, value and
983   *         extensions. The accessor "getReceived" gives direct access to the
984   *         value
985   */
986  public DateTimeType getReceivedElement() {
987    if (this.received == null)
988      if (Configuration.errorOnAutoCreate())
989        throw new Error("Attempt to auto-create Communication.received");
990      else if (Configuration.doAutoCreate())
991        this.received = new DateTimeType(); // bb
992    return this.received;
993  }
994
995  public boolean hasReceivedElement() {
996    return this.received != null && !this.received.isEmpty();
997  }
998
999  public boolean hasReceived() {
1000    return this.received != null && !this.received.isEmpty();
1001  }
1002
1003  /**
1004   * @param value {@link #received} (The time when this communication arrived at
1005   *              the destination.). This is the underlying object with id, value
1006   *              and extensions. The accessor "getReceived" gives direct access
1007   *              to the value
1008   */
1009  public Communication setReceivedElement(DateTimeType value) {
1010    this.received = value;
1011    return this;
1012  }
1013
1014  /**
1015   * @return The time when this communication arrived at the destination.
1016   */
1017  public Date getReceived() {
1018    return this.received == null ? null : this.received.getValue();
1019  }
1020
1021  /**
1022   * @param value The time when this communication arrived at the destination.
1023   */
1024  public Communication setReceived(Date value) {
1025    if (value == null)
1026      this.received = null;
1027    else {
1028      if (this.received == null)
1029        this.received = new DateTimeType();
1030      this.received.setValue(value);
1031    }
1032    return this;
1033  }
1034
1035  /**
1036   * @return {@link #reason} (The reason or justification for the communication.)
1037   */
1038  public List<CodeableConcept> getReason() {
1039    if (this.reason == null)
1040      this.reason = new ArrayList<CodeableConcept>();
1041    return this.reason;
1042  }
1043
1044  public boolean hasReason() {
1045    if (this.reason == null)
1046      return false;
1047    for (CodeableConcept item : this.reason)
1048      if (!item.isEmpty())
1049        return true;
1050    return false;
1051  }
1052
1053  /**
1054   * @return {@link #reason} (The reason or justification for the communication.)
1055   */
1056  // syntactic sugar
1057  public CodeableConcept addReason() { // 3
1058    CodeableConcept t = new CodeableConcept();
1059    if (this.reason == null)
1060      this.reason = new ArrayList<CodeableConcept>();
1061    this.reason.add(t);
1062    return t;
1063  }
1064
1065  // syntactic sugar
1066  public Communication addReason(CodeableConcept t) { // 3
1067    if (t == null)
1068      return this;
1069    if (this.reason == null)
1070      this.reason = new ArrayList<CodeableConcept>();
1071    this.reason.add(t);
1072    return this;
1073  }
1074
1075  /**
1076   * @return {@link #subject} (The patient who was the focus of this
1077   *         communication.)
1078   */
1079  public Reference getSubject() {
1080    if (this.subject == null)
1081      if (Configuration.errorOnAutoCreate())
1082        throw new Error("Attempt to auto-create Communication.subject");
1083      else if (Configuration.doAutoCreate())
1084        this.subject = new Reference(); // cc
1085    return this.subject;
1086  }
1087
1088  public boolean hasSubject() {
1089    return this.subject != null && !this.subject.isEmpty();
1090  }
1091
1092  /**
1093   * @param value {@link #subject} (The patient who was the focus of this
1094   *              communication.)
1095   */
1096  public Communication setSubject(Reference value) {
1097    this.subject = value;
1098    return this;
1099  }
1100
1101  /**
1102   * @return {@link #subject} The actual object that is the target of the
1103   *         reference. The reference library doesn't populate this, but you can
1104   *         use it to hold the resource if you resolve it. (The patient who was
1105   *         the focus of this communication.)
1106   */
1107  public Patient getSubjectTarget() {
1108    if (this.subjectTarget == null)
1109      if (Configuration.errorOnAutoCreate())
1110        throw new Error("Attempt to auto-create Communication.subject");
1111      else if (Configuration.doAutoCreate())
1112        this.subjectTarget = new Patient(); // aa
1113    return this.subjectTarget;
1114  }
1115
1116  /**
1117   * @param value {@link #subject} The actual object that is the target of the
1118   *              reference. The reference library doesn't use these, but you can
1119   *              use it to hold the resource if you resolve it. (The patient who
1120   *              was the focus of this communication.)
1121   */
1122  public Communication setSubjectTarget(Patient value) {
1123    this.subjectTarget = value;
1124    return this;
1125  }
1126
1127  /**
1128   * @return {@link #requestDetail} (The communication request that was
1129   *         responsible for producing this communication.)
1130   */
1131  public Reference getRequestDetail() {
1132    if (this.requestDetail == null)
1133      if (Configuration.errorOnAutoCreate())
1134        throw new Error("Attempt to auto-create Communication.requestDetail");
1135      else if (Configuration.doAutoCreate())
1136        this.requestDetail = new Reference(); // cc
1137    return this.requestDetail;
1138  }
1139
1140  public boolean hasRequestDetail() {
1141    return this.requestDetail != null && !this.requestDetail.isEmpty();
1142  }
1143
1144  /**
1145   * @param value {@link #requestDetail} (The communication request that was
1146   *              responsible for producing this communication.)
1147   */
1148  public Communication setRequestDetail(Reference value) {
1149    this.requestDetail = value;
1150    return this;
1151  }
1152
1153  /**
1154   * @return {@link #requestDetail} The actual object that is the target of the
1155   *         reference. The reference library doesn't populate this, but you can
1156   *         use it to hold the resource if you resolve it. (The communication
1157   *         request that was responsible for producing this communication.)
1158   */
1159  public CommunicationRequest getRequestDetailTarget() {
1160    if (this.requestDetailTarget == null)
1161      if (Configuration.errorOnAutoCreate())
1162        throw new Error("Attempt to auto-create Communication.requestDetail");
1163      else if (Configuration.doAutoCreate())
1164        this.requestDetailTarget = new CommunicationRequest(); // aa
1165    return this.requestDetailTarget;
1166  }
1167
1168  /**
1169   * @param value {@link #requestDetail} The actual object that is the target of
1170   *              the reference. The reference library doesn't use these, but you
1171   *              can use it to hold the resource if you resolve it. (The
1172   *              communication request that was responsible for producing this
1173   *              communication.)
1174   */
1175  public Communication setRequestDetailTarget(CommunicationRequest value) {
1176    this.requestDetailTarget = value;
1177    return this;
1178  }
1179
1180  protected void listChildren(List<Property> childrenList) {
1181    super.listChildren(childrenList);
1182    childrenList.add(new Property("identifier", "Identifier",
1183        "Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).",
1184        0, java.lang.Integer.MAX_VALUE, identifier));
1185    childrenList.add(new Property("category", "CodeableConcept",
1186        "The type of message conveyed such as alert, notification, reminder, instruction, etc.", 0,
1187        java.lang.Integer.MAX_VALUE, category));
1188    childrenList.add(new Property("sender", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)",
1189        "The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.",
1190        0, java.lang.Integer.MAX_VALUE, sender));
1191    childrenList.add(new Property("recipient",
1192        "Reference(Device|Organization|Patient|Practitioner|RelatedPerson|Group)",
1193        "The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient.  Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).",
1194        0, java.lang.Integer.MAX_VALUE, recipient));
1195    childrenList
1196        .add(new Property("payload", "", "Text, attachment(s), or resource(s) that was communicated to the recipient.",
1197            0, java.lang.Integer.MAX_VALUE, payload));
1198    childrenList.add(new Property("medium", "CodeableConcept",
1199        "A channel that was used for this communication (e.g. email, fax).", 0, java.lang.Integer.MAX_VALUE, medium));
1200    childrenList
1201        .add(new Property("status", "code", "The status of the transmission.", 0, java.lang.Integer.MAX_VALUE, status));
1202    childrenList.add(new Property("encounter", "Reference(Encounter)",
1203        "The encounter within which the communication was sent.", 0, java.lang.Integer.MAX_VALUE, encounter));
1204    childrenList.add(new Property("sent", "dateTime", "The time when this communication was sent.", 0,
1205        java.lang.Integer.MAX_VALUE, sent));
1206    childrenList.add(new Property("received", "dateTime",
1207        "The time when this communication arrived at the destination.", 0, java.lang.Integer.MAX_VALUE, received));
1208    childrenList.add(new Property("reason", "CodeableConcept", "The reason or justification for the communication.", 0,
1209        java.lang.Integer.MAX_VALUE, reason));
1210    childrenList.add(new Property("subject", "Reference(Patient)",
1211        "The patient who was the focus of this communication.", 0, java.lang.Integer.MAX_VALUE, subject));
1212    childrenList.add(new Property("requestDetail", "Reference(CommunicationRequest)",
1213        "The communication request that was responsible for producing this communication.", 0,
1214        java.lang.Integer.MAX_VALUE, requestDetail));
1215  }
1216
1217  @Override
1218  public void setProperty(String name, Base value) throws FHIRException {
1219    if (name.equals("identifier"))
1220      this.getIdentifier().add(castToIdentifier(value));
1221    else if (name.equals("category"))
1222      this.category = castToCodeableConcept(value); // CodeableConcept
1223    else if (name.equals("sender"))
1224      this.sender = castToReference(value); // Reference
1225    else if (name.equals("recipient"))
1226      this.getRecipient().add(castToReference(value));
1227    else if (name.equals("payload"))
1228      this.getPayload().add((CommunicationPayloadComponent) value);
1229    else if (name.equals("medium"))
1230      this.getMedium().add(castToCodeableConcept(value));
1231    else if (name.equals("status"))
1232      this.status = new CommunicationStatusEnumFactory().fromType(value); // Enumeration<CommunicationStatus>
1233    else if (name.equals("encounter"))
1234      this.encounter = castToReference(value); // Reference
1235    else if (name.equals("sent"))
1236      this.sent = castToDateTime(value); // DateTimeType
1237    else if (name.equals("received"))
1238      this.received = castToDateTime(value); // DateTimeType
1239    else if (name.equals("reason"))
1240      this.getReason().add(castToCodeableConcept(value));
1241    else if (name.equals("subject"))
1242      this.subject = castToReference(value); // Reference
1243    else if (name.equals("requestDetail"))
1244      this.requestDetail = castToReference(value); // Reference
1245    else
1246      super.setProperty(name, value);
1247  }
1248
1249  @Override
1250  public Base addChild(String name) throws FHIRException {
1251    if (name.equals("identifier")) {
1252      return addIdentifier();
1253    } else if (name.equals("category")) {
1254      this.category = new CodeableConcept();
1255      return this.category;
1256    } else if (name.equals("sender")) {
1257      this.sender = new Reference();
1258      return this.sender;
1259    } else if (name.equals("recipient")) {
1260      return addRecipient();
1261    } else if (name.equals("payload")) {
1262      return addPayload();
1263    } else if (name.equals("medium")) {
1264      return addMedium();
1265    } else if (name.equals("status")) {
1266      throw new FHIRException("Cannot call addChild on a singleton property Communication.status");
1267    } else if (name.equals("encounter")) {
1268      this.encounter = new Reference();
1269      return this.encounter;
1270    } else if (name.equals("sent")) {
1271      throw new FHIRException("Cannot call addChild on a singleton property Communication.sent");
1272    } else if (name.equals("received")) {
1273      throw new FHIRException("Cannot call addChild on a singleton property Communication.received");
1274    } else if (name.equals("reason")) {
1275      return addReason();
1276    } else if (name.equals("subject")) {
1277      this.subject = new Reference();
1278      return this.subject;
1279    } else if (name.equals("requestDetail")) {
1280      this.requestDetail = new Reference();
1281      return this.requestDetail;
1282    } else
1283      return super.addChild(name);
1284  }
1285
1286  public String fhirType() {
1287    return "Communication";
1288
1289  }
1290
1291  public Communication copy() {
1292    Communication dst = new Communication();
1293    copyValues(dst);
1294    if (identifier != null) {
1295      dst.identifier = new ArrayList<Identifier>();
1296      for (Identifier i : identifier)
1297        dst.identifier.add(i.copy());
1298    }
1299    ;
1300    dst.category = category == null ? null : category.copy();
1301    dst.sender = sender == null ? null : sender.copy();
1302    if (recipient != null) {
1303      dst.recipient = new ArrayList<Reference>();
1304      for (Reference i : recipient)
1305        dst.recipient.add(i.copy());
1306    }
1307    ;
1308    if (payload != null) {
1309      dst.payload = new ArrayList<CommunicationPayloadComponent>();
1310      for (CommunicationPayloadComponent i : payload)
1311        dst.payload.add(i.copy());
1312    }
1313    ;
1314    if (medium != null) {
1315      dst.medium = new ArrayList<CodeableConcept>();
1316      for (CodeableConcept i : medium)
1317        dst.medium.add(i.copy());
1318    }
1319    ;
1320    dst.status = status == null ? null : status.copy();
1321    dst.encounter = encounter == null ? null : encounter.copy();
1322    dst.sent = sent == null ? null : sent.copy();
1323    dst.received = received == null ? null : received.copy();
1324    if (reason != null) {
1325      dst.reason = new ArrayList<CodeableConcept>();
1326      for (CodeableConcept i : reason)
1327        dst.reason.add(i.copy());
1328    }
1329    ;
1330    dst.subject = subject == null ? null : subject.copy();
1331    dst.requestDetail = requestDetail == null ? null : requestDetail.copy();
1332    return dst;
1333  }
1334
1335  protected Communication typedCopy() {
1336    return copy();
1337  }
1338
1339  @Override
1340  public boolean equalsDeep(Base other) {
1341    if (!super.equalsDeep(other))
1342      return false;
1343    if (!(other instanceof Communication))
1344      return false;
1345    Communication o = (Communication) other;
1346    return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true)
1347        && compareDeep(sender, o.sender, true) && compareDeep(recipient, o.recipient, true)
1348        && compareDeep(payload, o.payload, true) && compareDeep(medium, o.medium, true)
1349        && compareDeep(status, o.status, true) && compareDeep(encounter, o.encounter, true)
1350        && compareDeep(sent, o.sent, true) && compareDeep(received, o.received, true)
1351        && compareDeep(reason, o.reason, true) && compareDeep(subject, o.subject, true)
1352        && compareDeep(requestDetail, o.requestDetail, true);
1353  }
1354
1355  @Override
1356  public boolean equalsShallow(Base other) {
1357    if (!super.equalsShallow(other))
1358      return false;
1359    if (!(other instanceof Communication))
1360      return false;
1361    Communication o = (Communication) other;
1362    return compareValues(status, o.status, true) && compareValues(sent, o.sent, true)
1363        && compareValues(received, o.received, true);
1364  }
1365
1366  public boolean isEmpty() {
1367    return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty())
1368        && (sender == null || sender.isEmpty()) && (recipient == null || recipient.isEmpty())
1369        && (payload == null || payload.isEmpty()) && (medium == null || medium.isEmpty())
1370        && (status == null || status.isEmpty()) && (encounter == null || encounter.isEmpty())
1371        && (sent == null || sent.isEmpty()) && (received == null || received.isEmpty())
1372        && (reason == null || reason.isEmpty()) && (subject == null || subject.isEmpty())
1373        && (requestDetail == null || requestDetail.isEmpty());
1374  }
1375
1376  @Override
1377  public ResourceType getResourceType() {
1378    return ResourceType.Communication;
1379  }
1380
1381  @SearchParamDefinition(name = "identifier", path = "Communication.identifier", description = "Unique identifier", type = "token")
1382  public static final String SP_IDENTIFIER = "identifier";
1383  @SearchParamDefinition(name = "request", path = "Communication.requestDetail", description = "CommunicationRequest producing this message", type = "reference")
1384  public static final String SP_REQUEST = "request";
1385  @SearchParamDefinition(name = "sender", path = "Communication.sender", description = "Message sender", type = "reference")
1386  public static final String SP_SENDER = "sender";
1387  @SearchParamDefinition(name = "subject", path = "Communication.subject", description = "Focus of message", type = "reference")
1388  public static final String SP_SUBJECT = "subject";
1389  @SearchParamDefinition(name = "patient", path = "Communication.subject", description = "Focus of message", type = "reference")
1390  public static final String SP_PATIENT = "patient";
1391  @SearchParamDefinition(name = "recipient", path = "Communication.recipient", description = "Message recipient", type = "reference")
1392  public static final String SP_RECIPIENT = "recipient";
1393  @SearchParamDefinition(name = "received", path = "Communication.received", description = "When received", type = "date")
1394  public static final String SP_RECEIVED = "received";
1395  @SearchParamDefinition(name = "medium", path = "Communication.medium", description = "A channel of communication", type = "token")
1396  public static final String SP_MEDIUM = "medium";
1397  @SearchParamDefinition(name = "encounter", path = "Communication.encounter", description = "Encounter leading to message", type = "reference")
1398  public static final String SP_ENCOUNTER = "encounter";
1399  @SearchParamDefinition(name = "category", path = "Communication.category", description = "Message category", type = "token")
1400  public static final String SP_CATEGORY = "category";
1401  @SearchParamDefinition(name = "sent", path = "Communication.sent", description = "When sent", type = "date")
1402  public static final String SP_SENT = "sent";
1403  @SearchParamDefinition(name = "status", path = "Communication.status", description = "in-progress | completed | suspended | rejected | failed", type = "token")
1404  public static final String SP_STATUS = "status";
1405
1406}