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