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