001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046import org.hl7.fhir.exceptions.FHIRFormatError;
047/**
048 * This resource provides processing status, errors and notes from the processing of a resource.
049 */
050@ResourceDef(name="ProcessResponse", profile="http://hl7.org/fhir/StructureDefinition/ProcessResponse")
051public class ProcessResponse extends DomainResource {
052
053    public enum ProcessResponseStatus {
054        /**
055         * The instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static ProcessResponseStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown ProcessResponseStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/fm-status";
102            case CANCELLED: return "http://hl7.org/fhir/fm-status";
103            case DRAFT: return "http://hl7.org/fhir/fm-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The instance is currently in-force.";
111            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered in Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ProcessResponseStatusEnumFactory implements EnumFactory<ProcessResponseStatus> {
129    public ProcessResponseStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return ProcessResponseStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return ProcessResponseStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return ProcessResponseStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return ProcessResponseStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown ProcessResponseStatus code '"+codeString+"'");
142        }
143        public Enumeration<ProcessResponseStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<ProcessResponseStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<ProcessResponseStatus>(this, ProcessResponseStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<ProcessResponseStatus>(this, ProcessResponseStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<ProcessResponseStatus>(this, ProcessResponseStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<ProcessResponseStatus>(this, ProcessResponseStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown ProcessResponseStatus code '"+codeString+"'");
160        }
161    public String toCode(ProcessResponseStatus code) {
162      if (code == ProcessResponseStatus.ACTIVE)
163        return "active";
164      if (code == ProcessResponseStatus.CANCELLED)
165        return "cancelled";
166      if (code == ProcessResponseStatus.DRAFT)
167        return "draft";
168      if (code == ProcessResponseStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(ProcessResponseStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    @Block()
178    public static class ProcessResponseProcessNoteComponent extends BackboneElement implements IBaseBackboneElement {
179        /**
180         * The note purpose: Print/Display.
181         */
182        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
183        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
184        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
185        protected CodeableConcept type;
186
187        /**
188         * The note text.
189         */
190        @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
191        @Description(shortDefinition="Comment on the processing", formalDefinition="The note text." )
192        protected StringType text;
193
194        private static final long serialVersionUID = 874830709L;
195
196    /**
197     * Constructor
198     */
199      public ProcessResponseProcessNoteComponent() {
200        super();
201      }
202
203        /**
204         * @return {@link #type} (The note purpose: Print/Display.)
205         */
206        public CodeableConcept getType() { 
207          if (this.type == null)
208            if (Configuration.errorOnAutoCreate())
209              throw new Error("Attempt to auto-create ProcessResponseProcessNoteComponent.type");
210            else if (Configuration.doAutoCreate())
211              this.type = new CodeableConcept(); // cc
212          return this.type;
213        }
214
215        public boolean hasType() { 
216          return this.type != null && !this.type.isEmpty();
217        }
218
219        /**
220         * @param value {@link #type} (The note purpose: Print/Display.)
221         */
222        public ProcessResponseProcessNoteComponent setType(CodeableConcept value)  { 
223          this.type = value;
224          return this;
225        }
226
227        /**
228         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
229         */
230        public StringType getTextElement() { 
231          if (this.text == null)
232            if (Configuration.errorOnAutoCreate())
233              throw new Error("Attempt to auto-create ProcessResponseProcessNoteComponent.text");
234            else if (Configuration.doAutoCreate())
235              this.text = new StringType(); // bb
236          return this.text;
237        }
238
239        public boolean hasTextElement() { 
240          return this.text != null && !this.text.isEmpty();
241        }
242
243        public boolean hasText() { 
244          return this.text != null && !this.text.isEmpty();
245        }
246
247        /**
248         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
249         */
250        public ProcessResponseProcessNoteComponent setTextElement(StringType value) { 
251          this.text = value;
252          return this;
253        }
254
255        /**
256         * @return The note text.
257         */
258        public String getText() { 
259          return this.text == null ? null : this.text.getValue();
260        }
261
262        /**
263         * @param value The note text.
264         */
265        public ProcessResponseProcessNoteComponent setText(String value) { 
266          if (Utilities.noString(value))
267            this.text = null;
268          else {
269            if (this.text == null)
270              this.text = new StringType();
271            this.text.setValue(value);
272          }
273          return this;
274        }
275
276        protected void listChildren(List<Property> children) {
277          super.listChildren(children);
278          children.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type));
279          children.add(new Property("text", "string", "The note text.", 0, 1, text));
280        }
281
282        @Override
283        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
284          switch (_hash) {
285          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type);
286          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
287          default: return super.getNamedProperty(_hash, _name, _checkValid);
288          }
289
290        }
291
292      @Override
293      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
294        switch (hash) {
295        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
296        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
297        default: return super.getProperty(hash, name, checkValid);
298        }
299
300      }
301
302      @Override
303      public Base setProperty(int hash, String name, Base value) throws FHIRException {
304        switch (hash) {
305        case 3575610: // type
306          this.type = castToCodeableConcept(value); // CodeableConcept
307          return value;
308        case 3556653: // text
309          this.text = castToString(value); // StringType
310          return value;
311        default: return super.setProperty(hash, name, value);
312        }
313
314      }
315
316      @Override
317      public Base setProperty(String name, Base value) throws FHIRException {
318        if (name.equals("type")) {
319          this.type = castToCodeableConcept(value); // CodeableConcept
320        } else if (name.equals("text")) {
321          this.text = castToString(value); // StringType
322        } else
323          return super.setProperty(name, value);
324        return value;
325      }
326
327      @Override
328      public Base makeProperty(int hash, String name) throws FHIRException {
329        switch (hash) {
330        case 3575610:  return getType(); 
331        case 3556653:  return getTextElement();
332        default: return super.makeProperty(hash, name);
333        }
334
335      }
336
337      @Override
338      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
339        switch (hash) {
340        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
341        case 3556653: /*text*/ return new String[] {"string"};
342        default: return super.getTypesForProperty(hash, name);
343        }
344
345      }
346
347      @Override
348      public Base addChild(String name) throws FHIRException {
349        if (name.equals("type")) {
350          this.type = new CodeableConcept();
351          return this.type;
352        }
353        else if (name.equals("text")) {
354          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.text");
355        }
356        else
357          return super.addChild(name);
358      }
359
360      public ProcessResponseProcessNoteComponent copy() {
361        ProcessResponseProcessNoteComponent dst = new ProcessResponseProcessNoteComponent();
362        copyValues(dst);
363        dst.type = type == null ? null : type.copy();
364        dst.text = text == null ? null : text.copy();
365        return dst;
366      }
367
368      @Override
369      public boolean equalsDeep(Base other_) {
370        if (!super.equalsDeep(other_))
371          return false;
372        if (!(other_ instanceof ProcessResponseProcessNoteComponent))
373          return false;
374        ProcessResponseProcessNoteComponent o = (ProcessResponseProcessNoteComponent) other_;
375        return compareDeep(type, o.type, true) && compareDeep(text, o.text, true);
376      }
377
378      @Override
379      public boolean equalsShallow(Base other_) {
380        if (!super.equalsShallow(other_))
381          return false;
382        if (!(other_ instanceof ProcessResponseProcessNoteComponent))
383          return false;
384        ProcessResponseProcessNoteComponent o = (ProcessResponseProcessNoteComponent) other_;
385        return compareValues(text, o.text, true);
386      }
387
388      public boolean isEmpty() {
389        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, text);
390      }
391
392  public String fhirType() {
393    return "ProcessResponse.processNote";
394
395  }
396
397  }
398
399    /**
400     * The Response business identifier.
401     */
402    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
403    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
404    protected List<Identifier> identifier;
405
406    /**
407     * The status of the resource instance.
408     */
409    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
410    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
411    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
412    protected Enumeration<ProcessResponseStatus> status;
413
414    /**
415     * The date when the enclosed suite of services were performed or completed.
416     */
417    @Child(name = "created", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
418    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
419    protected DateTimeType created;
420
421    /**
422     * The organization who produced this adjudicated response.
423     */
424    @Child(name = "organization", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
425    @Description(shortDefinition="Authoring Organization", formalDefinition="The organization who produced this adjudicated response." )
426    protected Reference organization;
427
428    /**
429     * The actual object that is the target of the reference (The organization who produced this adjudicated response.)
430     */
431    protected Organization organizationTarget;
432
433    /**
434     * Original request resource reference.
435     */
436    @Child(name = "request", type = {Reference.class}, order=4, min=0, max=1, modifier=false, summary=false)
437    @Description(shortDefinition="Request reference", formalDefinition="Original request resource reference." )
438    protected Reference request;
439
440    /**
441     * The actual object that is the target of the reference (Original request resource reference.)
442     */
443    protected Resource requestTarget;
444
445    /**
446     * Transaction status: error, complete, held.
447     */
448    @Child(name = "outcome", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
449    @Description(shortDefinition="Processing outcome", formalDefinition="Transaction status: error, complete, held." )
450    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/process-outcome")
451    protected CodeableConcept outcome;
452
453    /**
454     * A description of the status of the adjudication or processing.
455     */
456    @Child(name = "disposition", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
457    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication or processing." )
458    protected StringType disposition;
459
460    /**
461     * The practitioner who is responsible for the services rendered to the patient.
462     */
463    @Child(name = "requestProvider", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
464    @Description(shortDefinition="Responsible Practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
465    protected Reference requestProvider;
466
467    /**
468     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
469     */
470    protected Practitioner requestProviderTarget;
471
472    /**
473     * The organization which is responsible for the services rendered to the patient.
474     */
475    @Child(name = "requestOrganization", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
476    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
477    protected Reference requestOrganization;
478
479    /**
480     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
481     */
482    protected Organization requestOrganizationTarget;
483
484    /**
485     * The form to be used for printing the content.
486     */
487    @Child(name = "form", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
488    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
489    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
490    protected CodeableConcept form;
491
492    /**
493     * Suite of processing notes or additional requirements if the processing has been held.
494     */
495    @Child(name = "processNote", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
496    @Description(shortDefinition="Processing comments or additional requirements", formalDefinition="Suite of processing notes or additional requirements if the processing has been held." )
497    protected List<ProcessResponseProcessNoteComponent> processNote;
498
499    /**
500     * Processing errors.
501     */
502    @Child(name = "error", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
503    @Description(shortDefinition="Error code", formalDefinition="Processing errors." )
504    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-error")
505    protected List<CodeableConcept> error;
506
507    /**
508     * Request for additional supporting or authorizing information, such as: documents, images or resources.
509     */
510    @Child(name = "communicationRequest", type = {CommunicationRequest.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
511    @Description(shortDefinition="Request for additional information", formalDefinition="Request for additional supporting or authorizing information, such as: documents, images or resources." )
512    protected List<Reference> communicationRequest;
513    /**
514     * The actual objects that are the target of the reference (Request for additional supporting or authorizing information, such as: documents, images or resources.)
515     */
516    protected List<CommunicationRequest> communicationRequestTarget;
517
518
519    private static final long serialVersionUID = -2058462467L;
520
521  /**
522   * Constructor
523   */
524    public ProcessResponse() {
525      super();
526    }
527
528    /**
529     * @return {@link #identifier} (The Response business identifier.)
530     */
531    public List<Identifier> getIdentifier() { 
532      if (this.identifier == null)
533        this.identifier = new ArrayList<Identifier>();
534      return this.identifier;
535    }
536
537    /**
538     * @return Returns a reference to <code>this</code> for easy method chaining
539     */
540    public ProcessResponse setIdentifier(List<Identifier> theIdentifier) { 
541      this.identifier = theIdentifier;
542      return this;
543    }
544
545    public boolean hasIdentifier() { 
546      if (this.identifier == null)
547        return false;
548      for (Identifier item : this.identifier)
549        if (!item.isEmpty())
550          return true;
551      return false;
552    }
553
554    public Identifier addIdentifier() { //3
555      Identifier t = new Identifier();
556      if (this.identifier == null)
557        this.identifier = new ArrayList<Identifier>();
558      this.identifier.add(t);
559      return t;
560    }
561
562    public ProcessResponse addIdentifier(Identifier t) { //3
563      if (t == null)
564        return this;
565      if (this.identifier == null)
566        this.identifier = new ArrayList<Identifier>();
567      this.identifier.add(t);
568      return this;
569    }
570
571    /**
572     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
573     */
574    public Identifier getIdentifierFirstRep() { 
575      if (getIdentifier().isEmpty()) {
576        addIdentifier();
577      }
578      return getIdentifier().get(0);
579    }
580
581    /**
582     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
583     */
584    public Enumeration<ProcessResponseStatus> getStatusElement() { 
585      if (this.status == null)
586        if (Configuration.errorOnAutoCreate())
587          throw new Error("Attempt to auto-create ProcessResponse.status");
588        else if (Configuration.doAutoCreate())
589          this.status = new Enumeration<ProcessResponseStatus>(new ProcessResponseStatusEnumFactory()); // bb
590      return this.status;
591    }
592
593    public boolean hasStatusElement() { 
594      return this.status != null && !this.status.isEmpty();
595    }
596
597    public boolean hasStatus() { 
598      return this.status != null && !this.status.isEmpty();
599    }
600
601    /**
602     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
603     */
604    public ProcessResponse setStatusElement(Enumeration<ProcessResponseStatus> value) { 
605      this.status = value;
606      return this;
607    }
608
609    /**
610     * @return The status of the resource instance.
611     */
612    public ProcessResponseStatus getStatus() { 
613      return this.status == null ? null : this.status.getValue();
614    }
615
616    /**
617     * @param value The status of the resource instance.
618     */
619    public ProcessResponse setStatus(ProcessResponseStatus value) { 
620      if (value == null)
621        this.status = null;
622      else {
623        if (this.status == null)
624          this.status = new Enumeration<ProcessResponseStatus>(new ProcessResponseStatusEnumFactory());
625        this.status.setValue(value);
626      }
627      return this;
628    }
629
630    /**
631     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
632     */
633    public DateTimeType getCreatedElement() { 
634      if (this.created == null)
635        if (Configuration.errorOnAutoCreate())
636          throw new Error("Attempt to auto-create ProcessResponse.created");
637        else if (Configuration.doAutoCreate())
638          this.created = new DateTimeType(); // bb
639      return this.created;
640    }
641
642    public boolean hasCreatedElement() { 
643      return this.created != null && !this.created.isEmpty();
644    }
645
646    public boolean hasCreated() { 
647      return this.created != null && !this.created.isEmpty();
648    }
649
650    /**
651     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
652     */
653    public ProcessResponse setCreatedElement(DateTimeType value) { 
654      this.created = value;
655      return this;
656    }
657
658    /**
659     * @return The date when the enclosed suite of services were performed or completed.
660     */
661    public Date getCreated() { 
662      return this.created == null ? null : this.created.getValue();
663    }
664
665    /**
666     * @param value The date when the enclosed suite of services were performed or completed.
667     */
668    public ProcessResponse setCreated(Date value) { 
669      if (value == null)
670        this.created = null;
671      else {
672        if (this.created == null)
673          this.created = new DateTimeType();
674        this.created.setValue(value);
675      }
676      return this;
677    }
678
679    /**
680     * @return {@link #organization} (The organization who produced this adjudicated response.)
681     */
682    public Reference getOrganization() { 
683      if (this.organization == null)
684        if (Configuration.errorOnAutoCreate())
685          throw new Error("Attempt to auto-create ProcessResponse.organization");
686        else if (Configuration.doAutoCreate())
687          this.organization = new Reference(); // cc
688      return this.organization;
689    }
690
691    public boolean hasOrganization() { 
692      return this.organization != null && !this.organization.isEmpty();
693    }
694
695    /**
696     * @param value {@link #organization} (The organization who produced this adjudicated response.)
697     */
698    public ProcessResponse setOrganization(Reference value)  { 
699      this.organization = value;
700      return this;
701    }
702
703    /**
704     * @return {@link #organization} 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 who produced this adjudicated response.)
705     */
706    public Organization getOrganizationTarget() { 
707      if (this.organizationTarget == null)
708        if (Configuration.errorOnAutoCreate())
709          throw new Error("Attempt to auto-create ProcessResponse.organization");
710        else if (Configuration.doAutoCreate())
711          this.organizationTarget = new Organization(); // aa
712      return this.organizationTarget;
713    }
714
715    /**
716     * @param value {@link #organization} 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 who produced this adjudicated response.)
717     */
718    public ProcessResponse setOrganizationTarget(Organization value) { 
719      this.organizationTarget = value;
720      return this;
721    }
722
723    /**
724     * @return {@link #request} (Original request resource reference.)
725     */
726    public Reference getRequest() { 
727      if (this.request == null)
728        if (Configuration.errorOnAutoCreate())
729          throw new Error("Attempt to auto-create ProcessResponse.request");
730        else if (Configuration.doAutoCreate())
731          this.request = new Reference(); // cc
732      return this.request;
733    }
734
735    public boolean hasRequest() { 
736      return this.request != null && !this.request.isEmpty();
737    }
738
739    /**
740     * @param value {@link #request} (Original request resource reference.)
741     */
742    public ProcessResponse setRequest(Reference value)  { 
743      this.request = value;
744      return this;
745    }
746
747    /**
748     * @return {@link #request} 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. (Original request resource reference.)
749     */
750    public Resource getRequestTarget() { 
751      return this.requestTarget;
752    }
753
754    /**
755     * @param value {@link #request} 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. (Original request resource reference.)
756     */
757    public ProcessResponse setRequestTarget(Resource value) { 
758      this.requestTarget = value;
759      return this;
760    }
761
762    /**
763     * @return {@link #outcome} (Transaction status: error, complete, held.)
764     */
765    public CodeableConcept getOutcome() { 
766      if (this.outcome == null)
767        if (Configuration.errorOnAutoCreate())
768          throw new Error("Attempt to auto-create ProcessResponse.outcome");
769        else if (Configuration.doAutoCreate())
770          this.outcome = new CodeableConcept(); // cc
771      return this.outcome;
772    }
773
774    public boolean hasOutcome() { 
775      return this.outcome != null && !this.outcome.isEmpty();
776    }
777
778    /**
779     * @param value {@link #outcome} (Transaction status: error, complete, held.)
780     */
781    public ProcessResponse setOutcome(CodeableConcept value)  { 
782      this.outcome = value;
783      return this;
784    }
785
786    /**
787     * @return {@link #disposition} (A description of the status of the adjudication or processing.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
788     */
789    public StringType getDispositionElement() { 
790      if (this.disposition == null)
791        if (Configuration.errorOnAutoCreate())
792          throw new Error("Attempt to auto-create ProcessResponse.disposition");
793        else if (Configuration.doAutoCreate())
794          this.disposition = new StringType(); // bb
795      return this.disposition;
796    }
797
798    public boolean hasDispositionElement() { 
799      return this.disposition != null && !this.disposition.isEmpty();
800    }
801
802    public boolean hasDisposition() { 
803      return this.disposition != null && !this.disposition.isEmpty();
804    }
805
806    /**
807     * @param value {@link #disposition} (A description of the status of the adjudication or processing.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
808     */
809    public ProcessResponse setDispositionElement(StringType value) { 
810      this.disposition = value;
811      return this;
812    }
813
814    /**
815     * @return A description of the status of the adjudication or processing.
816     */
817    public String getDisposition() { 
818      return this.disposition == null ? null : this.disposition.getValue();
819    }
820
821    /**
822     * @param value A description of the status of the adjudication or processing.
823     */
824    public ProcessResponse setDisposition(String value) { 
825      if (Utilities.noString(value))
826        this.disposition = null;
827      else {
828        if (this.disposition == null)
829          this.disposition = new StringType();
830        this.disposition.setValue(value);
831      }
832      return this;
833    }
834
835    /**
836     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
837     */
838    public Reference getRequestProvider() { 
839      if (this.requestProvider == null)
840        if (Configuration.errorOnAutoCreate())
841          throw new Error("Attempt to auto-create ProcessResponse.requestProvider");
842        else if (Configuration.doAutoCreate())
843          this.requestProvider = new Reference(); // cc
844      return this.requestProvider;
845    }
846
847    public boolean hasRequestProvider() { 
848      return this.requestProvider != null && !this.requestProvider.isEmpty();
849    }
850
851    /**
852     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
853     */
854    public ProcessResponse setRequestProvider(Reference value)  { 
855      this.requestProvider = value;
856      return this;
857    }
858
859    /**
860     * @return {@link #requestProvider} 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 practitioner who is responsible for the services rendered to the patient.)
861     */
862    public Practitioner getRequestProviderTarget() { 
863      if (this.requestProviderTarget == null)
864        if (Configuration.errorOnAutoCreate())
865          throw new Error("Attempt to auto-create ProcessResponse.requestProvider");
866        else if (Configuration.doAutoCreate())
867          this.requestProviderTarget = new Practitioner(); // aa
868      return this.requestProviderTarget;
869    }
870
871    /**
872     * @param value {@link #requestProvider} 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 practitioner who is responsible for the services rendered to the patient.)
873     */
874    public ProcessResponse setRequestProviderTarget(Practitioner value) { 
875      this.requestProviderTarget = value;
876      return this;
877    }
878
879    /**
880     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
881     */
882    public Reference getRequestOrganization() { 
883      if (this.requestOrganization == null)
884        if (Configuration.errorOnAutoCreate())
885          throw new Error("Attempt to auto-create ProcessResponse.requestOrganization");
886        else if (Configuration.doAutoCreate())
887          this.requestOrganization = new Reference(); // cc
888      return this.requestOrganization;
889    }
890
891    public boolean hasRequestOrganization() { 
892      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
893    }
894
895    /**
896     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
897     */
898    public ProcessResponse setRequestOrganization(Reference value)  { 
899      this.requestOrganization = value;
900      return this;
901    }
902
903    /**
904     * @return {@link #requestOrganization} 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 which is responsible for the services rendered to the patient.)
905     */
906    public Organization getRequestOrganizationTarget() { 
907      if (this.requestOrganizationTarget == null)
908        if (Configuration.errorOnAutoCreate())
909          throw new Error("Attempt to auto-create ProcessResponse.requestOrganization");
910        else if (Configuration.doAutoCreate())
911          this.requestOrganizationTarget = new Organization(); // aa
912      return this.requestOrganizationTarget;
913    }
914
915    /**
916     * @param value {@link #requestOrganization} 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 which is responsible for the services rendered to the patient.)
917     */
918    public ProcessResponse setRequestOrganizationTarget(Organization value) { 
919      this.requestOrganizationTarget = value;
920      return this;
921    }
922
923    /**
924     * @return {@link #form} (The form to be used for printing the content.)
925     */
926    public CodeableConcept getForm() { 
927      if (this.form == null)
928        if (Configuration.errorOnAutoCreate())
929          throw new Error("Attempt to auto-create ProcessResponse.form");
930        else if (Configuration.doAutoCreate())
931          this.form = new CodeableConcept(); // cc
932      return this.form;
933    }
934
935    public boolean hasForm() { 
936      return this.form != null && !this.form.isEmpty();
937    }
938
939    /**
940     * @param value {@link #form} (The form to be used for printing the content.)
941     */
942    public ProcessResponse setForm(CodeableConcept value)  { 
943      this.form = value;
944      return this;
945    }
946
947    /**
948     * @return {@link #processNote} (Suite of processing notes or additional requirements if the processing has been held.)
949     */
950    public List<ProcessResponseProcessNoteComponent> getProcessNote() { 
951      if (this.processNote == null)
952        this.processNote = new ArrayList<ProcessResponseProcessNoteComponent>();
953      return this.processNote;
954    }
955
956    /**
957     * @return Returns a reference to <code>this</code> for easy method chaining
958     */
959    public ProcessResponse setProcessNote(List<ProcessResponseProcessNoteComponent> theProcessNote) { 
960      this.processNote = theProcessNote;
961      return this;
962    }
963
964    public boolean hasProcessNote() { 
965      if (this.processNote == null)
966        return false;
967      for (ProcessResponseProcessNoteComponent item : this.processNote)
968        if (!item.isEmpty())
969          return true;
970      return false;
971    }
972
973    public ProcessResponseProcessNoteComponent addProcessNote() { //3
974      ProcessResponseProcessNoteComponent t = new ProcessResponseProcessNoteComponent();
975      if (this.processNote == null)
976        this.processNote = new ArrayList<ProcessResponseProcessNoteComponent>();
977      this.processNote.add(t);
978      return t;
979    }
980
981    public ProcessResponse addProcessNote(ProcessResponseProcessNoteComponent t) { //3
982      if (t == null)
983        return this;
984      if (this.processNote == null)
985        this.processNote = new ArrayList<ProcessResponseProcessNoteComponent>();
986      this.processNote.add(t);
987      return this;
988    }
989
990    /**
991     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
992     */
993    public ProcessResponseProcessNoteComponent getProcessNoteFirstRep() { 
994      if (getProcessNote().isEmpty()) {
995        addProcessNote();
996      }
997      return getProcessNote().get(0);
998    }
999
1000    /**
1001     * @return {@link #error} (Processing errors.)
1002     */
1003    public List<CodeableConcept> getError() { 
1004      if (this.error == null)
1005        this.error = new ArrayList<CodeableConcept>();
1006      return this.error;
1007    }
1008
1009    /**
1010     * @return Returns a reference to <code>this</code> for easy method chaining
1011     */
1012    public ProcessResponse setError(List<CodeableConcept> theError) { 
1013      this.error = theError;
1014      return this;
1015    }
1016
1017    public boolean hasError() { 
1018      if (this.error == null)
1019        return false;
1020      for (CodeableConcept item : this.error)
1021        if (!item.isEmpty())
1022          return true;
1023      return false;
1024    }
1025
1026    public CodeableConcept addError() { //3
1027      CodeableConcept t = new CodeableConcept();
1028      if (this.error == null)
1029        this.error = new ArrayList<CodeableConcept>();
1030      this.error.add(t);
1031      return t;
1032    }
1033
1034    public ProcessResponse addError(CodeableConcept t) { //3
1035      if (t == null)
1036        return this;
1037      if (this.error == null)
1038        this.error = new ArrayList<CodeableConcept>();
1039      this.error.add(t);
1040      return this;
1041    }
1042
1043    /**
1044     * @return The first repetition of repeating field {@link #error}, creating it if it does not already exist
1045     */
1046    public CodeableConcept getErrorFirstRep() { 
1047      if (getError().isEmpty()) {
1048        addError();
1049      }
1050      return getError().get(0);
1051    }
1052
1053    /**
1054     * @return {@link #communicationRequest} (Request for additional supporting or authorizing information, such as: documents, images or resources.)
1055     */
1056    public List<Reference> getCommunicationRequest() { 
1057      if (this.communicationRequest == null)
1058        this.communicationRequest = new ArrayList<Reference>();
1059      return this.communicationRequest;
1060    }
1061
1062    /**
1063     * @return Returns a reference to <code>this</code> for easy method chaining
1064     */
1065    public ProcessResponse setCommunicationRequest(List<Reference> theCommunicationRequest) { 
1066      this.communicationRequest = theCommunicationRequest;
1067      return this;
1068    }
1069
1070    public boolean hasCommunicationRequest() { 
1071      if (this.communicationRequest == null)
1072        return false;
1073      for (Reference item : this.communicationRequest)
1074        if (!item.isEmpty())
1075          return true;
1076      return false;
1077    }
1078
1079    public Reference addCommunicationRequest() { //3
1080      Reference t = new Reference();
1081      if (this.communicationRequest == null)
1082        this.communicationRequest = new ArrayList<Reference>();
1083      this.communicationRequest.add(t);
1084      return t;
1085    }
1086
1087    public ProcessResponse addCommunicationRequest(Reference t) { //3
1088      if (t == null)
1089        return this;
1090      if (this.communicationRequest == null)
1091        this.communicationRequest = new ArrayList<Reference>();
1092      this.communicationRequest.add(t);
1093      return this;
1094    }
1095
1096    /**
1097     * @return The first repetition of repeating field {@link #communicationRequest}, creating it if it does not already exist
1098     */
1099    public Reference getCommunicationRequestFirstRep() { 
1100      if (getCommunicationRequest().isEmpty()) {
1101        addCommunicationRequest();
1102      }
1103      return getCommunicationRequest().get(0);
1104    }
1105
1106    /**
1107     * @deprecated Use Reference#setResource(IBaseResource) instead
1108     */
1109    @Deprecated
1110    public List<CommunicationRequest> getCommunicationRequestTarget() { 
1111      if (this.communicationRequestTarget == null)
1112        this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
1113      return this.communicationRequestTarget;
1114    }
1115
1116    /**
1117     * @deprecated Use Reference#setResource(IBaseResource) instead
1118     */
1119    @Deprecated
1120    public CommunicationRequest addCommunicationRequestTarget() { 
1121      CommunicationRequest r = new CommunicationRequest();
1122      if (this.communicationRequestTarget == null)
1123        this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
1124      this.communicationRequestTarget.add(r);
1125      return r;
1126    }
1127
1128      protected void listChildren(List<Property> children) {
1129        super.listChildren(children);
1130        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1131        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
1132        children.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created));
1133        children.add(new Property("organization", "Reference(Organization)", "The organization who produced this adjudicated response.", 0, 1, organization));
1134        children.add(new Property("request", "Reference(Any)", "Original request resource reference.", 0, 1, request));
1135        children.add(new Property("outcome", "CodeableConcept", "Transaction status: error, complete, held.", 0, 1, outcome));
1136        children.add(new Property("disposition", "string", "A description of the status of the adjudication or processing.", 0, 1, disposition));
1137        children.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider));
1138        children.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization));
1139        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
1140        children.add(new Property("processNote", "", "Suite of processing notes or additional requirements if the processing has been held.", 0, java.lang.Integer.MAX_VALUE, processNote));
1141        children.add(new Property("error", "CodeableConcept", "Processing errors.", 0, java.lang.Integer.MAX_VALUE, error));
1142        children.add(new Property("communicationRequest", "Reference(CommunicationRequest)", "Request for additional supporting or authorizing information, such as: documents, images or resources.", 0, java.lang.Integer.MAX_VALUE, communicationRequest));
1143      }
1144
1145      @Override
1146      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1147        switch (_hash) {
1148        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
1149        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
1150        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created);
1151        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The organization who produced this adjudicated response.", 0, 1, organization);
1152        case 1095692943: /*request*/  return new Property("request", "Reference(Any)", "Original request resource reference.", 0, 1, request);
1153        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Transaction status: error, complete, held.", 0, 1, outcome);
1154        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication or processing.", 0, 1, disposition);
1155        case 1601527200: /*requestProvider*/  return new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider);
1156        case 599053666: /*requestOrganization*/  return new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization);
1157        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
1158        case 202339073: /*processNote*/  return new Property("processNote", "", "Suite of processing notes or additional requirements if the processing has been held.", 0, java.lang.Integer.MAX_VALUE, processNote);
1159        case 96784904: /*error*/  return new Property("error", "CodeableConcept", "Processing errors.", 0, java.lang.Integer.MAX_VALUE, error);
1160        case -2071896615: /*communicationRequest*/  return new Property("communicationRequest", "Reference(CommunicationRequest)", "Request for additional supporting or authorizing information, such as: documents, images or resources.", 0, java.lang.Integer.MAX_VALUE, communicationRequest);
1161        default: return super.getNamedProperty(_hash, _name, _checkValid);
1162        }
1163
1164      }
1165
1166      @Override
1167      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1168        switch (hash) {
1169        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1170        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ProcessResponseStatus>
1171        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1172        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
1173        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
1174        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
1175        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
1176        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
1177        case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
1178        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
1179        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // ProcessResponseProcessNoteComponent
1180        case 96784904: /*error*/ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // CodeableConcept
1181        case -2071896615: /*communicationRequest*/ return this.communicationRequest == null ? new Base[0] : this.communicationRequest.toArray(new Base[this.communicationRequest.size()]); // Reference
1182        default: return super.getProperty(hash, name, checkValid);
1183        }
1184
1185      }
1186
1187      @Override
1188      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1189        switch (hash) {
1190        case -1618432855: // identifier
1191          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1192          return value;
1193        case -892481550: // status
1194          value = new ProcessResponseStatusEnumFactory().fromType(castToCode(value));
1195          this.status = (Enumeration) value; // Enumeration<ProcessResponseStatus>
1196          return value;
1197        case 1028554472: // created
1198          this.created = castToDateTime(value); // DateTimeType
1199          return value;
1200        case 1178922291: // organization
1201          this.organization = castToReference(value); // Reference
1202          return value;
1203        case 1095692943: // request
1204          this.request = castToReference(value); // Reference
1205          return value;
1206        case -1106507950: // outcome
1207          this.outcome = castToCodeableConcept(value); // CodeableConcept
1208          return value;
1209        case 583380919: // disposition
1210          this.disposition = castToString(value); // StringType
1211          return value;
1212        case 1601527200: // requestProvider
1213          this.requestProvider = castToReference(value); // Reference
1214          return value;
1215        case 599053666: // requestOrganization
1216          this.requestOrganization = castToReference(value); // Reference
1217          return value;
1218        case 3148996: // form
1219          this.form = castToCodeableConcept(value); // CodeableConcept
1220          return value;
1221        case 202339073: // processNote
1222          this.getProcessNote().add((ProcessResponseProcessNoteComponent) value); // ProcessResponseProcessNoteComponent
1223          return value;
1224        case 96784904: // error
1225          this.getError().add(castToCodeableConcept(value)); // CodeableConcept
1226          return value;
1227        case -2071896615: // communicationRequest
1228          this.getCommunicationRequest().add(castToReference(value)); // Reference
1229          return value;
1230        default: return super.setProperty(hash, name, value);
1231        }
1232
1233      }
1234
1235      @Override
1236      public Base setProperty(String name, Base value) throws FHIRException {
1237        if (name.equals("identifier")) {
1238          this.getIdentifier().add(castToIdentifier(value));
1239        } else if (name.equals("status")) {
1240          value = new ProcessResponseStatusEnumFactory().fromType(castToCode(value));
1241          this.status = (Enumeration) value; // Enumeration<ProcessResponseStatus>
1242        } else if (name.equals("created")) {
1243          this.created = castToDateTime(value); // DateTimeType
1244        } else if (name.equals("organization")) {
1245          this.organization = castToReference(value); // Reference
1246        } else if (name.equals("request")) {
1247          this.request = castToReference(value); // Reference
1248        } else if (name.equals("outcome")) {
1249          this.outcome = castToCodeableConcept(value); // CodeableConcept
1250        } else if (name.equals("disposition")) {
1251          this.disposition = castToString(value); // StringType
1252        } else if (name.equals("requestProvider")) {
1253          this.requestProvider = castToReference(value); // Reference
1254        } else if (name.equals("requestOrganization")) {
1255          this.requestOrganization = castToReference(value); // Reference
1256        } else if (name.equals("form")) {
1257          this.form = castToCodeableConcept(value); // CodeableConcept
1258        } else if (name.equals("processNote")) {
1259          this.getProcessNote().add((ProcessResponseProcessNoteComponent) value);
1260        } else if (name.equals("error")) {
1261          this.getError().add(castToCodeableConcept(value));
1262        } else if (name.equals("communicationRequest")) {
1263          this.getCommunicationRequest().add(castToReference(value));
1264        } else
1265          return super.setProperty(name, value);
1266        return value;
1267      }
1268
1269      @Override
1270      public Base makeProperty(int hash, String name) throws FHIRException {
1271        switch (hash) {
1272        case -1618432855:  return addIdentifier(); 
1273        case -892481550:  return getStatusElement();
1274        case 1028554472:  return getCreatedElement();
1275        case 1178922291:  return getOrganization(); 
1276        case 1095692943:  return getRequest(); 
1277        case -1106507950:  return getOutcome(); 
1278        case 583380919:  return getDispositionElement();
1279        case 1601527200:  return getRequestProvider(); 
1280        case 599053666:  return getRequestOrganization(); 
1281        case 3148996:  return getForm(); 
1282        case 202339073:  return addProcessNote(); 
1283        case 96784904:  return addError(); 
1284        case -2071896615:  return addCommunicationRequest(); 
1285        default: return super.makeProperty(hash, name);
1286        }
1287
1288      }
1289
1290      @Override
1291      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1292        switch (hash) {
1293        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1294        case -892481550: /*status*/ return new String[] {"code"};
1295        case 1028554472: /*created*/ return new String[] {"dateTime"};
1296        case 1178922291: /*organization*/ return new String[] {"Reference"};
1297        case 1095692943: /*request*/ return new String[] {"Reference"};
1298        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
1299        case 583380919: /*disposition*/ return new String[] {"string"};
1300        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
1301        case 599053666: /*requestOrganization*/ return new String[] {"Reference"};
1302        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
1303        case 202339073: /*processNote*/ return new String[] {};
1304        case 96784904: /*error*/ return new String[] {"CodeableConcept"};
1305        case -2071896615: /*communicationRequest*/ return new String[] {"Reference"};
1306        default: return super.getTypesForProperty(hash, name);
1307        }
1308
1309      }
1310
1311      @Override
1312      public Base addChild(String name) throws FHIRException {
1313        if (name.equals("identifier")) {
1314          return addIdentifier();
1315        }
1316        else if (name.equals("status")) {
1317          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.status");
1318        }
1319        else if (name.equals("created")) {
1320          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.created");
1321        }
1322        else if (name.equals("organization")) {
1323          this.organization = new Reference();
1324          return this.organization;
1325        }
1326        else if (name.equals("request")) {
1327          this.request = new Reference();
1328          return this.request;
1329        }
1330        else if (name.equals("outcome")) {
1331          this.outcome = new CodeableConcept();
1332          return this.outcome;
1333        }
1334        else if (name.equals("disposition")) {
1335          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.disposition");
1336        }
1337        else if (name.equals("requestProvider")) {
1338          this.requestProvider = new Reference();
1339          return this.requestProvider;
1340        }
1341        else if (name.equals("requestOrganization")) {
1342          this.requestOrganization = new Reference();
1343          return this.requestOrganization;
1344        }
1345        else if (name.equals("form")) {
1346          this.form = new CodeableConcept();
1347          return this.form;
1348        }
1349        else if (name.equals("processNote")) {
1350          return addProcessNote();
1351        }
1352        else if (name.equals("error")) {
1353          return addError();
1354        }
1355        else if (name.equals("communicationRequest")) {
1356          return addCommunicationRequest();
1357        }
1358        else
1359          return super.addChild(name);
1360      }
1361
1362  public String fhirType() {
1363    return "ProcessResponse";
1364
1365  }
1366
1367      public ProcessResponse copy() {
1368        ProcessResponse dst = new ProcessResponse();
1369        copyValues(dst);
1370        if (identifier != null) {
1371          dst.identifier = new ArrayList<Identifier>();
1372          for (Identifier i : identifier)
1373            dst.identifier.add(i.copy());
1374        };
1375        dst.status = status == null ? null : status.copy();
1376        dst.created = created == null ? null : created.copy();
1377        dst.organization = organization == null ? null : organization.copy();
1378        dst.request = request == null ? null : request.copy();
1379        dst.outcome = outcome == null ? null : outcome.copy();
1380        dst.disposition = disposition == null ? null : disposition.copy();
1381        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
1382        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
1383        dst.form = form == null ? null : form.copy();
1384        if (processNote != null) {
1385          dst.processNote = new ArrayList<ProcessResponseProcessNoteComponent>();
1386          for (ProcessResponseProcessNoteComponent i : processNote)
1387            dst.processNote.add(i.copy());
1388        };
1389        if (error != null) {
1390          dst.error = new ArrayList<CodeableConcept>();
1391          for (CodeableConcept i : error)
1392            dst.error.add(i.copy());
1393        };
1394        if (communicationRequest != null) {
1395          dst.communicationRequest = new ArrayList<Reference>();
1396          for (Reference i : communicationRequest)
1397            dst.communicationRequest.add(i.copy());
1398        };
1399        return dst;
1400      }
1401
1402      protected ProcessResponse typedCopy() {
1403        return copy();
1404      }
1405
1406      @Override
1407      public boolean equalsDeep(Base other_) {
1408        if (!super.equalsDeep(other_))
1409          return false;
1410        if (!(other_ instanceof ProcessResponse))
1411          return false;
1412        ProcessResponse o = (ProcessResponse) other_;
1413        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(created, o.created, true)
1414           && compareDeep(organization, o.organization, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
1415           && compareDeep(disposition, o.disposition, true) && compareDeep(requestProvider, o.requestProvider, true)
1416           && compareDeep(requestOrganization, o.requestOrganization, true) && compareDeep(form, o.form, true)
1417           && compareDeep(processNote, o.processNote, true) && compareDeep(error, o.error, true) && compareDeep(communicationRequest, o.communicationRequest, true)
1418          ;
1419      }
1420
1421      @Override
1422      public boolean equalsShallow(Base other_) {
1423        if (!super.equalsShallow(other_))
1424          return false;
1425        if (!(other_ instanceof ProcessResponse))
1426          return false;
1427        ProcessResponse o = (ProcessResponse) other_;
1428        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
1429          ;
1430      }
1431
1432      public boolean isEmpty() {
1433        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created
1434          , organization, request, outcome, disposition, requestProvider, requestOrganization
1435          , form, processNote, error, communicationRequest);
1436      }
1437
1438  @Override
1439  public ResourceType getResourceType() {
1440    return ResourceType.ProcessResponse;
1441   }
1442
1443 /**
1444   * Search parameter: <b>identifier</b>
1445   * <p>
1446   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
1447   * Type: <b>token</b><br>
1448   * Path: <b>ProcessResponse.identifier</b><br>
1449   * </p>
1450   */
1451  @SearchParamDefinition(name="identifier", path="ProcessResponse.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
1452  public static final String SP_IDENTIFIER = "identifier";
1453 /**
1454   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1455   * <p>
1456   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
1457   * Type: <b>token</b><br>
1458   * Path: <b>ProcessResponse.identifier</b><br>
1459   * </p>
1460   */
1461  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1462
1463 /**
1464   * Search parameter: <b>request</b>
1465   * <p>
1466   * Description: <b>The reference to the claim</b><br>
1467   * Type: <b>reference</b><br>
1468   * Path: <b>ProcessResponse.request</b><br>
1469   * </p>
1470   */
1471  @SearchParamDefinition(name="request", path="ProcessResponse.request", description="The reference to the claim", type="reference" )
1472  public static final String SP_REQUEST = "request";
1473 /**
1474   * <b>Fluent Client</b> search parameter constant for <b>request</b>
1475   * <p>
1476   * Description: <b>The reference to the claim</b><br>
1477   * Type: <b>reference</b><br>
1478   * Path: <b>ProcessResponse.request</b><br>
1479   * </p>
1480   */
1481  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
1482
1483/**
1484   * Constant for fluent queries to be used to add include statements. Specifies
1485   * the path value of "<b>ProcessResponse:request</b>".
1486   */
1487  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("ProcessResponse:request").toLocked();
1488
1489 /**
1490   * Search parameter: <b>organization</b>
1491   * <p>
1492   * Description: <b>The organization who generated this resource</b><br>
1493   * Type: <b>reference</b><br>
1494   * Path: <b>ProcessResponse.organization</b><br>
1495   * </p>
1496   */
1497  @SearchParamDefinition(name="organization", path="ProcessResponse.organization", description="The organization who generated this resource", type="reference", target={Organization.class } )
1498  public static final String SP_ORGANIZATION = "organization";
1499 /**
1500   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1501   * <p>
1502   * Description: <b>The organization who generated this resource</b><br>
1503   * Type: <b>reference</b><br>
1504   * Path: <b>ProcessResponse.organization</b><br>
1505   * </p>
1506   */
1507  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1508
1509/**
1510   * Constant for fluent queries to be used to add include statements. Specifies
1511   * the path value of "<b>ProcessResponse:organization</b>".
1512   */
1513  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ProcessResponse:organization").toLocked();
1514
1515 /**
1516   * Search parameter: <b>request-organization</b>
1517   * <p>
1518   * Description: <b>The Organization who is responsible the request transaction</b><br>
1519   * Type: <b>reference</b><br>
1520   * Path: <b>ProcessResponse.requestOrganization</b><br>
1521   * </p>
1522   */
1523  @SearchParamDefinition(name="request-organization", path="ProcessResponse.requestOrganization", description="The Organization who is responsible the request transaction", type="reference", target={Organization.class } )
1524  public static final String SP_REQUEST_ORGANIZATION = "request-organization";
1525 /**
1526   * <b>Fluent Client</b> search parameter constant for <b>request-organization</b>
1527   * <p>
1528   * Description: <b>The Organization who is responsible the request transaction</b><br>
1529   * Type: <b>reference</b><br>
1530   * Path: <b>ProcessResponse.requestOrganization</b><br>
1531   * </p>
1532   */
1533  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_ORGANIZATION);
1534
1535/**
1536   * Constant for fluent queries to be used to add include statements. Specifies
1537   * the path value of "<b>ProcessResponse:request-organization</b>".
1538   */
1539  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_ORGANIZATION = new ca.uhn.fhir.model.api.Include("ProcessResponse:request-organization").toLocked();
1540
1541 /**
1542   * Search parameter: <b>request-provider</b>
1543   * <p>
1544   * Description: <b>The Provider who is responsible the request transaction</b><br>
1545   * Type: <b>reference</b><br>
1546   * Path: <b>ProcessResponse.requestProvider</b><br>
1547   * </p>
1548   */
1549  @SearchParamDefinition(name="request-provider", path="ProcessResponse.requestProvider", description="The Provider who is responsible the request transaction", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
1550  public static final String SP_REQUEST_PROVIDER = "request-provider";
1551 /**
1552   * <b>Fluent Client</b> search parameter constant for <b>request-provider</b>
1553   * <p>
1554   * Description: <b>The Provider who is responsible the request transaction</b><br>
1555   * Type: <b>reference</b><br>
1556   * Path: <b>ProcessResponse.requestProvider</b><br>
1557   * </p>
1558   */
1559  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_PROVIDER);
1560
1561/**
1562   * Constant for fluent queries to be used to add include statements. Specifies
1563   * the path value of "<b>ProcessResponse:request-provider</b>".
1564   */
1565  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_PROVIDER = new ca.uhn.fhir.model.api.Include("ProcessResponse:request-provider").toLocked();
1566
1567
1568}
1569