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