001package org.hl7.fhir.instance.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * This resource provides processing status, errors and notes from the processing of a resource.
042 */
043@ResourceDef(name="ProcessResponse", profile="http://hl7.org/fhir/Profile/ProcessResponse")
044public class ProcessResponse extends DomainResource {
045
046    @Block()
047    public static class ProcessResponseNotesComponent extends BackboneElement implements IBaseBackboneElement {
048        /**
049         * The note purpose: Print/Display.
050         */
051        @Child(name = "type", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
052        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
053        protected Coding type;
054
055        /**
056         * The note text.
057         */
058        @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
059        @Description(shortDefinition="Notes text", formalDefinition="The note text." )
060        protected StringType text;
061
062        private static final long serialVersionUID = 129959202L;
063
064    /*
065     * Constructor
066     */
067      public ProcessResponseNotesComponent() {
068        super();
069      }
070
071        /**
072         * @return {@link #type} (The note purpose: Print/Display.)
073         */
074        public Coding getType() { 
075          if (this.type == null)
076            if (Configuration.errorOnAutoCreate())
077              throw new Error("Attempt to auto-create ProcessResponseNotesComponent.type");
078            else if (Configuration.doAutoCreate())
079              this.type = new Coding(); // cc
080          return this.type;
081        }
082
083        public boolean hasType() { 
084          return this.type != null && !this.type.isEmpty();
085        }
086
087        /**
088         * @param value {@link #type} (The note purpose: Print/Display.)
089         */
090        public ProcessResponseNotesComponent setType(Coding value) { 
091          this.type = value;
092          return this;
093        }
094
095        /**
096         * @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
097         */
098        public StringType getTextElement() { 
099          if (this.text == null)
100            if (Configuration.errorOnAutoCreate())
101              throw new Error("Attempt to auto-create ProcessResponseNotesComponent.text");
102            else if (Configuration.doAutoCreate())
103              this.text = new StringType(); // bb
104          return this.text;
105        }
106
107        public boolean hasTextElement() { 
108          return this.text != null && !this.text.isEmpty();
109        }
110
111        public boolean hasText() { 
112          return this.text != null && !this.text.isEmpty();
113        }
114
115        /**
116         * @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
117         */
118        public ProcessResponseNotesComponent setTextElement(StringType value) { 
119          this.text = value;
120          return this;
121        }
122
123        /**
124         * @return The note text.
125         */
126        public String getText() { 
127          return this.text == null ? null : this.text.getValue();
128        }
129
130        /**
131         * @param value The note text.
132         */
133        public ProcessResponseNotesComponent setText(String value) { 
134          if (Utilities.noString(value))
135            this.text = null;
136          else {
137            if (this.text == null)
138              this.text = new StringType();
139            this.text.setValue(value);
140          }
141          return this;
142        }
143
144        protected void listChildren(List<Property> childrenList) {
145          super.listChildren(childrenList);
146          childrenList.add(new Property("type", "Coding", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
147          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
148        }
149
150      @Override
151      public void setProperty(String name, Base value) throws FHIRException {
152        if (name.equals("type"))
153          this.type = castToCoding(value); // Coding
154        else if (name.equals("text"))
155          this.text = castToString(value); // StringType
156        else
157          super.setProperty(name, value);
158      }
159
160      @Override
161      public Base addChild(String name) throws FHIRException {
162        if (name.equals("type")) {
163          this.type = new Coding();
164          return this.type;
165        }
166        else if (name.equals("text")) {
167          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.text");
168        }
169        else
170          return super.addChild(name);
171      }
172
173      public ProcessResponseNotesComponent copy() {
174        ProcessResponseNotesComponent dst = new ProcessResponseNotesComponent();
175        copyValues(dst);
176        dst.type = type == null ? null : type.copy();
177        dst.text = text == null ? null : text.copy();
178        return dst;
179      }
180
181      @Override
182      public boolean equalsDeep(Base other) {
183        if (!super.equalsDeep(other))
184          return false;
185        if (!(other instanceof ProcessResponseNotesComponent))
186          return false;
187        ProcessResponseNotesComponent o = (ProcessResponseNotesComponent) other;
188        return compareDeep(type, o.type, true) && compareDeep(text, o.text, true);
189      }
190
191      @Override
192      public boolean equalsShallow(Base other) {
193        if (!super.equalsShallow(other))
194          return false;
195        if (!(other instanceof ProcessResponseNotesComponent))
196          return false;
197        ProcessResponseNotesComponent o = (ProcessResponseNotesComponent) other;
198        return compareValues(text, o.text, true);
199      }
200
201      public boolean isEmpty() {
202        return super.isEmpty() && (type == null || type.isEmpty()) && (text == null || text.isEmpty())
203          ;
204      }
205
206  public String fhirType() {
207    return "ProcessResponse.notes";
208
209  }
210
211  }
212
213    /**
214     * The Response business identifier.
215     */
216    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
217    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
218    protected List<Identifier> identifier;
219
220    /**
221     * Original request resource reference.
222     */
223    @Child(name = "request", type = {}, order=1, min=0, max=1, modifier=false, summary=true)
224    @Description(shortDefinition="Request reference", formalDefinition="Original request resource reference." )
225    protected Reference request;
226
227    /**
228     * The actual object that is the target of the reference (Original request resource reference.)
229     */
230    protected Resource requestTarget;
231
232    /**
233     * Transaction status: error, complete, held.
234     */
235    @Child(name = "outcome", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
236    @Description(shortDefinition="Processing outcome", formalDefinition="Transaction status: error, complete, held." )
237    protected Coding outcome;
238
239    /**
240     * A description of the status of the adjudication or processing.
241     */
242    @Child(name = "disposition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
243    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication or processing." )
244    protected StringType disposition;
245
246    /**
247     * The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
248     */
249    @Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
250    @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
251    protected Coding ruleset;
252
253    /**
254     * The style (standard) and version of the original material which was converted into this resource.
255     */
256    @Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
257    @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
258    protected Coding originalRuleset;
259
260    /**
261     * The date when the enclosed suite of services were performed or completed.
262     */
263    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
264    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
265    protected DateTimeType created;
266
267    /**
268     * The organization who produced this adjudicated response.
269     */
270    @Child(name = "organization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
271    @Description(shortDefinition="Authoring Organization", formalDefinition="The organization who produced this adjudicated response." )
272    protected Reference organization;
273
274    /**
275     * The actual object that is the target of the reference (The organization who produced this adjudicated response.)
276     */
277    protected Organization organizationTarget;
278
279    /**
280     * The practitioner who is responsible for the services rendered to the patient.
281     */
282    @Child(name = "requestProvider", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=true)
283    @Description(shortDefinition="Responsible Practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
284    protected Reference requestProvider;
285
286    /**
287     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
288     */
289    protected Practitioner requestProviderTarget;
290
291    /**
292     * The organization which is responsible for the services rendered to the patient.
293     */
294    @Child(name = "requestOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
295    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
296    protected Reference requestOrganization;
297
298    /**
299     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
300     */
301    protected Organization requestOrganizationTarget;
302
303    /**
304     * The form to be used for printing the content.
305     */
306    @Child(name = "form", type = {Coding.class}, order=10, min=0, max=1, modifier=false, summary=true)
307    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
308    protected Coding form;
309
310    /**
311     * Suite of processing note or additional requirements is the processing has been held.
312     */
313    @Child(name = "notes", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
314    @Description(shortDefinition="Notes", formalDefinition="Suite of processing note or additional requirements is the processing has been held." )
315    protected List<ProcessResponseNotesComponent> notes;
316
317    /**
318     * Processing errors.
319     */
320    @Child(name = "error", type = {Coding.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
321    @Description(shortDefinition="Error code", formalDefinition="Processing errors." )
322    protected List<Coding> error;
323
324    private static final long serialVersionUID = -1668062545L;
325
326  /*
327   * Constructor
328   */
329    public ProcessResponse() {
330      super();
331    }
332
333    /**
334     * @return {@link #identifier} (The Response business identifier.)
335     */
336    public List<Identifier> getIdentifier() { 
337      if (this.identifier == null)
338        this.identifier = new ArrayList<Identifier>();
339      return this.identifier;
340    }
341
342    public boolean hasIdentifier() { 
343      if (this.identifier == null)
344        return false;
345      for (Identifier item : this.identifier)
346        if (!item.isEmpty())
347          return true;
348      return false;
349    }
350
351    /**
352     * @return {@link #identifier} (The Response business identifier.)
353     */
354    // syntactic sugar
355    public Identifier addIdentifier() { //3
356      Identifier t = new Identifier();
357      if (this.identifier == null)
358        this.identifier = new ArrayList<Identifier>();
359      this.identifier.add(t);
360      return t;
361    }
362
363    // syntactic sugar
364    public ProcessResponse addIdentifier(Identifier t) { //3
365      if (t == null)
366        return this;
367      if (this.identifier == null)
368        this.identifier = new ArrayList<Identifier>();
369      this.identifier.add(t);
370      return this;
371    }
372
373    /**
374     * @return {@link #request} (Original request resource reference.)
375     */
376    public Reference getRequest() { 
377      if (this.request == null)
378        if (Configuration.errorOnAutoCreate())
379          throw new Error("Attempt to auto-create ProcessResponse.request");
380        else if (Configuration.doAutoCreate())
381          this.request = new Reference(); // cc
382      return this.request;
383    }
384
385    public boolean hasRequest() { 
386      return this.request != null && !this.request.isEmpty();
387    }
388
389    /**
390     * @param value {@link #request} (Original request resource reference.)
391     */
392    public ProcessResponse setRequest(Reference value) { 
393      this.request = value;
394      return this;
395    }
396
397    /**
398     * @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.)
399     */
400    public Resource getRequestTarget() { 
401      return this.requestTarget;
402    }
403
404    /**
405     * @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.)
406     */
407    public ProcessResponse setRequestTarget(Resource value) { 
408      this.requestTarget = value;
409      return this;
410    }
411
412    /**
413     * @return {@link #outcome} (Transaction status: error, complete, held.)
414     */
415    public Coding getOutcome() { 
416      if (this.outcome == null)
417        if (Configuration.errorOnAutoCreate())
418          throw new Error("Attempt to auto-create ProcessResponse.outcome");
419        else if (Configuration.doAutoCreate())
420          this.outcome = new Coding(); // cc
421      return this.outcome;
422    }
423
424    public boolean hasOutcome() { 
425      return this.outcome != null && !this.outcome.isEmpty();
426    }
427
428    /**
429     * @param value {@link #outcome} (Transaction status: error, complete, held.)
430     */
431    public ProcessResponse setOutcome(Coding value) { 
432      this.outcome = value;
433      return this;
434    }
435
436    /**
437     * @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
438     */
439    public StringType getDispositionElement() { 
440      if (this.disposition == null)
441        if (Configuration.errorOnAutoCreate())
442          throw new Error("Attempt to auto-create ProcessResponse.disposition");
443        else if (Configuration.doAutoCreate())
444          this.disposition = new StringType(); // bb
445      return this.disposition;
446    }
447
448    public boolean hasDispositionElement() { 
449      return this.disposition != null && !this.disposition.isEmpty();
450    }
451
452    public boolean hasDisposition() { 
453      return this.disposition != null && !this.disposition.isEmpty();
454    }
455
456    /**
457     * @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
458     */
459    public ProcessResponse setDispositionElement(StringType value) { 
460      this.disposition = value;
461      return this;
462    }
463
464    /**
465     * @return A description of the status of the adjudication or processing.
466     */
467    public String getDisposition() { 
468      return this.disposition == null ? null : this.disposition.getValue();
469    }
470
471    /**
472     * @param value A description of the status of the adjudication or processing.
473     */
474    public ProcessResponse setDisposition(String value) { 
475      if (Utilities.noString(value))
476        this.disposition = null;
477      else {
478        if (this.disposition == null)
479          this.disposition = new StringType();
480        this.disposition.setValue(value);
481      }
482      return this;
483    }
484
485    /**
486     * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
487     */
488    public Coding getRuleset() { 
489      if (this.ruleset == null)
490        if (Configuration.errorOnAutoCreate())
491          throw new Error("Attempt to auto-create ProcessResponse.ruleset");
492        else if (Configuration.doAutoCreate())
493          this.ruleset = new Coding(); // cc
494      return this.ruleset;
495    }
496
497    public boolean hasRuleset() { 
498      return this.ruleset != null && !this.ruleset.isEmpty();
499    }
500
501    /**
502     * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
503     */
504    public ProcessResponse setRuleset(Coding value) { 
505      this.ruleset = value;
506      return this;
507    }
508
509    /**
510     * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
511     */
512    public Coding getOriginalRuleset() { 
513      if (this.originalRuleset == null)
514        if (Configuration.errorOnAutoCreate())
515          throw new Error("Attempt to auto-create ProcessResponse.originalRuleset");
516        else if (Configuration.doAutoCreate())
517          this.originalRuleset = new Coding(); // cc
518      return this.originalRuleset;
519    }
520
521    public boolean hasOriginalRuleset() { 
522      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
523    }
524
525    /**
526     * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
527     */
528    public ProcessResponse setOriginalRuleset(Coding value) { 
529      this.originalRuleset = value;
530      return this;
531    }
532
533    /**
534     * @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
535     */
536    public DateTimeType getCreatedElement() { 
537      if (this.created == null)
538        if (Configuration.errorOnAutoCreate())
539          throw new Error("Attempt to auto-create ProcessResponse.created");
540        else if (Configuration.doAutoCreate())
541          this.created = new DateTimeType(); // bb
542      return this.created;
543    }
544
545    public boolean hasCreatedElement() { 
546      return this.created != null && !this.created.isEmpty();
547    }
548
549    public boolean hasCreated() { 
550      return this.created != null && !this.created.isEmpty();
551    }
552
553    /**
554     * @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
555     */
556    public ProcessResponse setCreatedElement(DateTimeType value) { 
557      this.created = value;
558      return this;
559    }
560
561    /**
562     * @return The date when the enclosed suite of services were performed or completed.
563     */
564    public Date getCreated() { 
565      return this.created == null ? null : this.created.getValue();
566    }
567
568    /**
569     * @param value The date when the enclosed suite of services were performed or completed.
570     */
571    public ProcessResponse setCreated(Date value) { 
572      if (value == null)
573        this.created = null;
574      else {
575        if (this.created == null)
576          this.created = new DateTimeType();
577        this.created.setValue(value);
578      }
579      return this;
580    }
581
582    /**
583     * @return {@link #organization} (The organization who produced this adjudicated response.)
584     */
585    public Reference getOrganization() { 
586      if (this.organization == null)
587        if (Configuration.errorOnAutoCreate())
588          throw new Error("Attempt to auto-create ProcessResponse.organization");
589        else if (Configuration.doAutoCreate())
590          this.organization = new Reference(); // cc
591      return this.organization;
592    }
593
594    public boolean hasOrganization() { 
595      return this.organization != null && !this.organization.isEmpty();
596    }
597
598    /**
599     * @param value {@link #organization} (The organization who produced this adjudicated response.)
600     */
601    public ProcessResponse setOrganization(Reference value) { 
602      this.organization = value;
603      return this;
604    }
605
606    /**
607     * @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.)
608     */
609    public Organization getOrganizationTarget() { 
610      if (this.organizationTarget == null)
611        if (Configuration.errorOnAutoCreate())
612          throw new Error("Attempt to auto-create ProcessResponse.organization");
613        else if (Configuration.doAutoCreate())
614          this.organizationTarget = new Organization(); // aa
615      return this.organizationTarget;
616    }
617
618    /**
619     * @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.)
620     */
621    public ProcessResponse setOrganizationTarget(Organization value) { 
622      this.organizationTarget = value;
623      return this;
624    }
625
626    /**
627     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
628     */
629    public Reference getRequestProvider() { 
630      if (this.requestProvider == null)
631        if (Configuration.errorOnAutoCreate())
632          throw new Error("Attempt to auto-create ProcessResponse.requestProvider");
633        else if (Configuration.doAutoCreate())
634          this.requestProvider = new Reference(); // cc
635      return this.requestProvider;
636    }
637
638    public boolean hasRequestProvider() { 
639      return this.requestProvider != null && !this.requestProvider.isEmpty();
640    }
641
642    /**
643     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
644     */
645    public ProcessResponse setRequestProvider(Reference value) { 
646      this.requestProvider = value;
647      return this;
648    }
649
650    /**
651     * @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.)
652     */
653    public Practitioner getRequestProviderTarget() { 
654      if (this.requestProviderTarget == null)
655        if (Configuration.errorOnAutoCreate())
656          throw new Error("Attempt to auto-create ProcessResponse.requestProvider");
657        else if (Configuration.doAutoCreate())
658          this.requestProviderTarget = new Practitioner(); // aa
659      return this.requestProviderTarget;
660    }
661
662    /**
663     * @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.)
664     */
665    public ProcessResponse setRequestProviderTarget(Practitioner value) { 
666      this.requestProviderTarget = value;
667      return this;
668    }
669
670    /**
671     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
672     */
673    public Reference getRequestOrganization() { 
674      if (this.requestOrganization == null)
675        if (Configuration.errorOnAutoCreate())
676          throw new Error("Attempt to auto-create ProcessResponse.requestOrganization");
677        else if (Configuration.doAutoCreate())
678          this.requestOrganization = new Reference(); // cc
679      return this.requestOrganization;
680    }
681
682    public boolean hasRequestOrganization() { 
683      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
684    }
685
686    /**
687     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
688     */
689    public ProcessResponse setRequestOrganization(Reference value) { 
690      this.requestOrganization = value;
691      return this;
692    }
693
694    /**
695     * @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.)
696     */
697    public Organization getRequestOrganizationTarget() { 
698      if (this.requestOrganizationTarget == null)
699        if (Configuration.errorOnAutoCreate())
700          throw new Error("Attempt to auto-create ProcessResponse.requestOrganization");
701        else if (Configuration.doAutoCreate())
702          this.requestOrganizationTarget = new Organization(); // aa
703      return this.requestOrganizationTarget;
704    }
705
706    /**
707     * @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.)
708     */
709    public ProcessResponse setRequestOrganizationTarget(Organization value) { 
710      this.requestOrganizationTarget = value;
711      return this;
712    }
713
714    /**
715     * @return {@link #form} (The form to be used for printing the content.)
716     */
717    public Coding getForm() { 
718      if (this.form == null)
719        if (Configuration.errorOnAutoCreate())
720          throw new Error("Attempt to auto-create ProcessResponse.form");
721        else if (Configuration.doAutoCreate())
722          this.form = new Coding(); // cc
723      return this.form;
724    }
725
726    public boolean hasForm() { 
727      return this.form != null && !this.form.isEmpty();
728    }
729
730    /**
731     * @param value {@link #form} (The form to be used for printing the content.)
732     */
733    public ProcessResponse setForm(Coding value) { 
734      this.form = value;
735      return this;
736    }
737
738    /**
739     * @return {@link #notes} (Suite of processing note or additional requirements is the processing has been held.)
740     */
741    public List<ProcessResponseNotesComponent> getNotes() { 
742      if (this.notes == null)
743        this.notes = new ArrayList<ProcessResponseNotesComponent>();
744      return this.notes;
745    }
746
747    public boolean hasNotes() { 
748      if (this.notes == null)
749        return false;
750      for (ProcessResponseNotesComponent item : this.notes)
751        if (!item.isEmpty())
752          return true;
753      return false;
754    }
755
756    /**
757     * @return {@link #notes} (Suite of processing note or additional requirements is the processing has been held.)
758     */
759    // syntactic sugar
760    public ProcessResponseNotesComponent addNotes() { //3
761      ProcessResponseNotesComponent t = new ProcessResponseNotesComponent();
762      if (this.notes == null)
763        this.notes = new ArrayList<ProcessResponseNotesComponent>();
764      this.notes.add(t);
765      return t;
766    }
767
768    // syntactic sugar
769    public ProcessResponse addNotes(ProcessResponseNotesComponent t) { //3
770      if (t == null)
771        return this;
772      if (this.notes == null)
773        this.notes = new ArrayList<ProcessResponseNotesComponent>();
774      this.notes.add(t);
775      return this;
776    }
777
778    /**
779     * @return {@link #error} (Processing errors.)
780     */
781    public List<Coding> getError() { 
782      if (this.error == null)
783        this.error = new ArrayList<Coding>();
784      return this.error;
785    }
786
787    public boolean hasError() { 
788      if (this.error == null)
789        return false;
790      for (Coding item : this.error)
791        if (!item.isEmpty())
792          return true;
793      return false;
794    }
795
796    /**
797     * @return {@link #error} (Processing errors.)
798     */
799    // syntactic sugar
800    public Coding addError() { //3
801      Coding t = new Coding();
802      if (this.error == null)
803        this.error = new ArrayList<Coding>();
804      this.error.add(t);
805      return t;
806    }
807
808    // syntactic sugar
809    public ProcessResponse addError(Coding t) { //3
810      if (t == null)
811        return this;
812      if (this.error == null)
813        this.error = new ArrayList<Coding>();
814      this.error.add(t);
815      return this;
816    }
817
818      protected void listChildren(List<Property> childrenList) {
819        super.listChildren(childrenList);
820        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
821        childrenList.add(new Property("request", "Reference(Any)", "Original request resource reference.", 0, java.lang.Integer.MAX_VALUE, request));
822        childrenList.add(new Property("outcome", "Coding", "Transaction status: error, complete, held.", 0, java.lang.Integer.MAX_VALUE, outcome));
823        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication or processing.", 0, java.lang.Integer.MAX_VALUE, disposition));
824        childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
825        childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
826        childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
827        childrenList.add(new Property("organization", "Reference(Organization)", "The organization who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
828        childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
829        childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
830        childrenList.add(new Property("form", "Coding", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
831        childrenList.add(new Property("notes", "", "Suite of processing note or additional requirements is the processing has been held.", 0, java.lang.Integer.MAX_VALUE, notes));
832        childrenList.add(new Property("error", "Coding", "Processing errors.", 0, java.lang.Integer.MAX_VALUE, error));
833      }
834
835      @Override
836      public void setProperty(String name, Base value) throws FHIRException {
837        if (name.equals("identifier"))
838          this.getIdentifier().add(castToIdentifier(value));
839        else if (name.equals("request"))
840          this.request = castToReference(value); // Reference
841        else if (name.equals("outcome"))
842          this.outcome = castToCoding(value); // Coding
843        else if (name.equals("disposition"))
844          this.disposition = castToString(value); // StringType
845        else if (name.equals("ruleset"))
846          this.ruleset = castToCoding(value); // Coding
847        else if (name.equals("originalRuleset"))
848          this.originalRuleset = castToCoding(value); // Coding
849        else if (name.equals("created"))
850          this.created = castToDateTime(value); // DateTimeType
851        else if (name.equals("organization"))
852          this.organization = castToReference(value); // Reference
853        else if (name.equals("requestProvider"))
854          this.requestProvider = castToReference(value); // Reference
855        else if (name.equals("requestOrganization"))
856          this.requestOrganization = castToReference(value); // Reference
857        else if (name.equals("form"))
858          this.form = castToCoding(value); // Coding
859        else if (name.equals("notes"))
860          this.getNotes().add((ProcessResponseNotesComponent) value);
861        else if (name.equals("error"))
862          this.getError().add(castToCoding(value));
863        else
864          super.setProperty(name, value);
865      }
866
867      @Override
868      public Base addChild(String name) throws FHIRException {
869        if (name.equals("identifier")) {
870          return addIdentifier();
871        }
872        else if (name.equals("request")) {
873          this.request = new Reference();
874          return this.request;
875        }
876        else if (name.equals("outcome")) {
877          this.outcome = new Coding();
878          return this.outcome;
879        }
880        else if (name.equals("disposition")) {
881          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.disposition");
882        }
883        else if (name.equals("ruleset")) {
884          this.ruleset = new Coding();
885          return this.ruleset;
886        }
887        else if (name.equals("originalRuleset")) {
888          this.originalRuleset = new Coding();
889          return this.originalRuleset;
890        }
891        else if (name.equals("created")) {
892          throw new FHIRException("Cannot call addChild on a primitive type ProcessResponse.created");
893        }
894        else if (name.equals("organization")) {
895          this.organization = new Reference();
896          return this.organization;
897        }
898        else if (name.equals("requestProvider")) {
899          this.requestProvider = new Reference();
900          return this.requestProvider;
901        }
902        else if (name.equals("requestOrganization")) {
903          this.requestOrganization = new Reference();
904          return this.requestOrganization;
905        }
906        else if (name.equals("form")) {
907          this.form = new Coding();
908          return this.form;
909        }
910        else if (name.equals("notes")) {
911          return addNotes();
912        }
913        else if (name.equals("error")) {
914          return addError();
915        }
916        else
917          return super.addChild(name);
918      }
919
920  public String fhirType() {
921    return "ProcessResponse";
922
923  }
924
925      public ProcessResponse copy() {
926        ProcessResponse dst = new ProcessResponse();
927        copyValues(dst);
928        if (identifier != null) {
929          dst.identifier = new ArrayList<Identifier>();
930          for (Identifier i : identifier)
931            dst.identifier.add(i.copy());
932        };
933        dst.request = request == null ? null : request.copy();
934        dst.outcome = outcome == null ? null : outcome.copy();
935        dst.disposition = disposition == null ? null : disposition.copy();
936        dst.ruleset = ruleset == null ? null : ruleset.copy();
937        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
938        dst.created = created == null ? null : created.copy();
939        dst.organization = organization == null ? null : organization.copy();
940        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
941        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
942        dst.form = form == null ? null : form.copy();
943        if (notes != null) {
944          dst.notes = new ArrayList<ProcessResponseNotesComponent>();
945          for (ProcessResponseNotesComponent i : notes)
946            dst.notes.add(i.copy());
947        };
948        if (error != null) {
949          dst.error = new ArrayList<Coding>();
950          for (Coding i : error)
951            dst.error.add(i.copy());
952        };
953        return dst;
954      }
955
956      protected ProcessResponse typedCopy() {
957        return copy();
958      }
959
960      @Override
961      public boolean equalsDeep(Base other) {
962        if (!super.equalsDeep(other))
963          return false;
964        if (!(other instanceof ProcessResponse))
965          return false;
966        ProcessResponse o = (ProcessResponse) other;
967        return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
968           && compareDeep(disposition, o.disposition, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
969           && compareDeep(created, o.created, true) && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
970           && compareDeep(requestOrganization, o.requestOrganization, true) && compareDeep(form, o.form, true)
971           && compareDeep(notes, o.notes, true) && compareDeep(error, o.error, true);
972      }
973
974      @Override
975      public boolean equalsShallow(Base other) {
976        if (!super.equalsShallow(other))
977          return false;
978        if (!(other instanceof ProcessResponse))
979          return false;
980        ProcessResponse o = (ProcessResponse) other;
981        return compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true);
982      }
983
984      public boolean isEmpty() {
985        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
986           && (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
987           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
988           && (created == null || created.isEmpty()) && (organization == null || organization.isEmpty())
989           && (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
990           && (form == null || form.isEmpty()) && (notes == null || notes.isEmpty()) && (error == null || error.isEmpty())
991          ;
992      }
993
994  @Override
995  public ResourceType getResourceType() {
996    return ResourceType.ProcessResponse;
997   }
998
999  @SearchParamDefinition(name="identifier", path="ProcessResponse.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
1000  public static final String SP_IDENTIFIER = "identifier";
1001  @SearchParamDefinition(name="request", path="ProcessResponse.request", description="The reference to the claim", type="reference" )
1002  public static final String SP_REQUEST = "request";
1003  @SearchParamDefinition(name="organization", path="ProcessResponse.organization", description="The organization who generated this resource", type="reference" )
1004  public static final String SP_ORGANIZATION = "organization";
1005  @SearchParamDefinition(name="requestprovider", path="ProcessResponse.requestProvider", description="The Provider who is responsible the request transaction", type="reference" )
1006  public static final String SP_REQUESTPROVIDER = "requestprovider";
1007  @SearchParamDefinition(name="requestorganization", path="ProcessResponse.requestOrganization", description="The Organization who is responsible the request transaction", type="reference" )
1008  public static final String SP_REQUESTORGANIZATION = "requestorganization";
1009
1010}
1011