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