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.utilities.Utilities;
037
038import ca.uhn.fhir.model.api.annotation.*;
039/**
040 * A response to an order.
041 */
042@ResourceDef(name="OrderResponse", profile="http://hl7.org/fhir/Profile/OrderResponse")
043public class OrderResponse extends DomainResource {
044
045    public enum OrderStatus {
046        /**
047         * The order is known, but no processing has occurred at this time
048         */
049        PENDING, 
050        /**
051         * The order is undergoing initial processing to determine whether it will be accepted (usually this involves human review)
052         */
053        REVIEW, 
054        /**
055         * The order was rejected because of a workflow/business logic reason
056         */
057        REJECTED, 
058        /**
059         * The order was unable to be processed because of a technical error (i.e. unexpected error)
060         */
061        ERROR, 
062        /**
063         * The order has been accepted, and work is in progress.
064         */
065        ACCEPTED, 
066        /**
067         * Processing the order was halted at the initiators request.
068         */
069        CANCELLED, 
070        /**
071         * The order has been cancelled and replaced by another.
072         */
073        REPLACED, 
074        /**
075         * Processing the order was stopped because of some workflow/business logic reason.
076         */
077        ABORTED, 
078        /**
079         * The order has been completed.
080         */
081        COMPLETED, 
082        /**
083         * added to help the parsers
084         */
085        NULL;
086        public static OrderStatus fromCode(String codeString) throws FHIRException {
087            if (codeString == null || "".equals(codeString))
088                return null;
089        if ("pending".equals(codeString))
090          return PENDING;
091        if ("review".equals(codeString))
092          return REVIEW;
093        if ("rejected".equals(codeString))
094          return REJECTED;
095        if ("error".equals(codeString))
096          return ERROR;
097        if ("accepted".equals(codeString))
098          return ACCEPTED;
099        if ("cancelled".equals(codeString))
100          return CANCELLED;
101        if ("replaced".equals(codeString))
102          return REPLACED;
103        if ("aborted".equals(codeString))
104          return ABORTED;
105        if ("completed".equals(codeString))
106          return COMPLETED;
107        throw new FHIRException("Unknown OrderStatus code '"+codeString+"'");
108        }
109        public String toCode() {
110          switch (this) {
111            case PENDING: return "pending";
112            case REVIEW: return "review";
113            case REJECTED: return "rejected";
114            case ERROR: return "error";
115            case ACCEPTED: return "accepted";
116            case CANCELLED: return "cancelled";
117            case REPLACED: return "replaced";
118            case ABORTED: return "aborted";
119            case COMPLETED: return "completed";
120            default: return "?";
121          }
122        }
123        public String getSystem() {
124          switch (this) {
125            case PENDING: return "http://hl7.org/fhir/order-status";
126            case REVIEW: return "http://hl7.org/fhir/order-status";
127            case REJECTED: return "http://hl7.org/fhir/order-status";
128            case ERROR: return "http://hl7.org/fhir/order-status";
129            case ACCEPTED: return "http://hl7.org/fhir/order-status";
130            case CANCELLED: return "http://hl7.org/fhir/order-status";
131            case REPLACED: return "http://hl7.org/fhir/order-status";
132            case ABORTED: return "http://hl7.org/fhir/order-status";
133            case COMPLETED: return "http://hl7.org/fhir/order-status";
134            default: return "?";
135          }
136        }
137        public String getDefinition() {
138          switch (this) {
139            case PENDING: return "The order is known, but no processing has occurred at this time";
140            case REVIEW: return "The order is undergoing initial processing to determine whether it will be accepted (usually this involves human review)";
141            case REJECTED: return "The order was rejected because of a workflow/business logic reason";
142            case ERROR: return "The order was unable to be processed because of a technical error (i.e. unexpected error)";
143            case ACCEPTED: return "The order has been accepted, and work is in progress.";
144            case CANCELLED: return "Processing the order was halted at the initiators request.";
145            case REPLACED: return "The order has been cancelled and replaced by another.";
146            case ABORTED: return "Processing the order was stopped because of some workflow/business logic reason.";
147            case COMPLETED: return "The order has been completed.";
148            default: return "?";
149          }
150        }
151        public String getDisplay() {
152          switch (this) {
153            case PENDING: return "Pending";
154            case REVIEW: return "Review";
155            case REJECTED: return "Rejected";
156            case ERROR: return "Error";
157            case ACCEPTED: return "Accepted";
158            case CANCELLED: return "Cancelled";
159            case REPLACED: return "Replaced";
160            case ABORTED: return "Aborted";
161            case COMPLETED: return "Completed";
162            default: return "?";
163          }
164        }
165    }
166
167  public static class OrderStatusEnumFactory implements EnumFactory<OrderStatus> {
168    public OrderStatus fromCode(String codeString) throws IllegalArgumentException {
169      if (codeString == null || "".equals(codeString))
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("pending".equals(codeString))
173          return OrderStatus.PENDING;
174        if ("review".equals(codeString))
175          return OrderStatus.REVIEW;
176        if ("rejected".equals(codeString))
177          return OrderStatus.REJECTED;
178        if ("error".equals(codeString))
179          return OrderStatus.ERROR;
180        if ("accepted".equals(codeString))
181          return OrderStatus.ACCEPTED;
182        if ("cancelled".equals(codeString))
183          return OrderStatus.CANCELLED;
184        if ("replaced".equals(codeString))
185          return OrderStatus.REPLACED;
186        if ("aborted".equals(codeString))
187          return OrderStatus.ABORTED;
188        if ("completed".equals(codeString))
189          return OrderStatus.COMPLETED;
190        throw new IllegalArgumentException("Unknown OrderStatus code '"+codeString+"'");
191        }
192        public Enumeration<OrderStatus> fromType(Base code) throws FHIRException {
193          if (code == null || code.isEmpty())
194            return null;
195          String codeString = ((PrimitiveType) code).asStringValue();
196          if (codeString == null || "".equals(codeString))
197            return null;
198        if ("pending".equals(codeString))
199          return new Enumeration<OrderStatus>(this, OrderStatus.PENDING);
200        if ("review".equals(codeString))
201          return new Enumeration<OrderStatus>(this, OrderStatus.REVIEW);
202        if ("rejected".equals(codeString))
203          return new Enumeration<OrderStatus>(this, OrderStatus.REJECTED);
204        if ("error".equals(codeString))
205          return new Enumeration<OrderStatus>(this, OrderStatus.ERROR);
206        if ("accepted".equals(codeString))
207          return new Enumeration<OrderStatus>(this, OrderStatus.ACCEPTED);
208        if ("cancelled".equals(codeString))
209          return new Enumeration<OrderStatus>(this, OrderStatus.CANCELLED);
210        if ("replaced".equals(codeString))
211          return new Enumeration<OrderStatus>(this, OrderStatus.REPLACED);
212        if ("aborted".equals(codeString))
213          return new Enumeration<OrderStatus>(this, OrderStatus.ABORTED);
214        if ("completed".equals(codeString))
215          return new Enumeration<OrderStatus>(this, OrderStatus.COMPLETED);
216        throw new FHIRException("Unknown OrderStatus code '"+codeString+"'");
217        }
218    public String toCode(OrderStatus code) {
219      if (code == OrderStatus.PENDING)
220        return "pending";
221      if (code == OrderStatus.REVIEW)
222        return "review";
223      if (code == OrderStatus.REJECTED)
224        return "rejected";
225      if (code == OrderStatus.ERROR)
226        return "error";
227      if (code == OrderStatus.ACCEPTED)
228        return "accepted";
229      if (code == OrderStatus.CANCELLED)
230        return "cancelled";
231      if (code == OrderStatus.REPLACED)
232        return "replaced";
233      if (code == OrderStatus.ABORTED)
234        return "aborted";
235      if (code == OrderStatus.COMPLETED)
236        return "completed";
237      return "?";
238      }
239    }
240
241    /**
242     * Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.
243     */
244    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
245    @Description(shortDefinition="Identifiers assigned to this order by the orderer or by the receiver", formalDefinition="Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems." )
246    protected List<Identifier> identifier;
247
248    /**
249     * A reference to the order that this is in response to.
250     */
251    @Child(name = "request", type = {Order.class}, order=1, min=1, max=1, modifier=false, summary=true)
252    @Description(shortDefinition="The order that this is a response to", formalDefinition="A reference to the order that this is in response to." )
253    protected Reference request;
254
255    /**
256     * The actual object that is the target of the reference (A reference to the order that this is in response to.)
257     */
258    protected Order requestTarget;
259
260    /**
261     * The date and time at which this order response was made (created/posted).
262     */
263    @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
264    @Description(shortDefinition="When the response was made", formalDefinition="The date and time at which this order response was made (created/posted)." )
265    protected DateTimeType date;
266
267    /**
268     * The person, organization, or device credited with making the response.
269     */
270    @Child(name = "who", type = {Practitioner.class, Organization.class, Device.class}, order=3, min=0, max=1, modifier=false, summary=true)
271    @Description(shortDefinition="Who made the response", formalDefinition="The person, organization, or device credited with making the response." )
272    protected Reference who;
273
274    /**
275     * The actual object that is the target of the reference (The person, organization, or device credited with making the response.)
276     */
277    protected Resource whoTarget;
278
279    /**
280     * What this response says about the status of the original order.
281     */
282    @Child(name = "orderStatus", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
283    @Description(shortDefinition="pending | review | rejected | error | accepted | cancelled | replaced | aborted | completed", formalDefinition="What this response says about the status of the original order." )
284    protected Enumeration<OrderStatus> orderStatus;
285
286    /**
287     * Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.
288     */
289    @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
290    @Description(shortDefinition="Additional description of the response", formalDefinition="Additional description about the response - e.g. a text description provided by a human user when making decisions about the order." )
291    protected StringType description;
292
293    /**
294     * Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.
295     */
296    @Child(name = "fulfillment", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
297    @Description(shortDefinition="Details of the outcome of performing the order", formalDefinition="Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order." )
298    protected List<Reference> fulfillment;
299    /**
300     * The actual objects that are the target of the reference (Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.)
301     */
302    protected List<Resource> fulfillmentTarget;
303
304
305    private static final long serialVersionUID = -856633109L;
306
307  /*
308   * Constructor
309   */
310    public OrderResponse() {
311      super();
312    }
313
314  /*
315   * Constructor
316   */
317    public OrderResponse(Reference request, Enumeration<OrderStatus> orderStatus) {
318      super();
319      this.request = request;
320      this.orderStatus = orderStatus;
321    }
322
323    /**
324     * @return {@link #identifier} (Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.)
325     */
326    public List<Identifier> getIdentifier() { 
327      if (this.identifier == null)
328        this.identifier = new ArrayList<Identifier>();
329      return this.identifier;
330    }
331
332    public boolean hasIdentifier() { 
333      if (this.identifier == null)
334        return false;
335      for (Identifier item : this.identifier)
336        if (!item.isEmpty())
337          return true;
338      return false;
339    }
340
341    /**
342     * @return {@link #identifier} (Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.)
343     */
344    // syntactic sugar
345    public Identifier addIdentifier() { //3
346      Identifier t = new Identifier();
347      if (this.identifier == null)
348        this.identifier = new ArrayList<Identifier>();
349      this.identifier.add(t);
350      return t;
351    }
352
353    // syntactic sugar
354    public OrderResponse addIdentifier(Identifier t) { //3
355      if (t == null)
356        return this;
357      if (this.identifier == null)
358        this.identifier = new ArrayList<Identifier>();
359      this.identifier.add(t);
360      return this;
361    }
362
363    /**
364     * @return {@link #request} (A reference to the order that this is in response to.)
365     */
366    public Reference getRequest() { 
367      if (this.request == null)
368        if (Configuration.errorOnAutoCreate())
369          throw new Error("Attempt to auto-create OrderResponse.request");
370        else if (Configuration.doAutoCreate())
371          this.request = new Reference(); // cc
372      return this.request;
373    }
374
375    public boolean hasRequest() { 
376      return this.request != null && !this.request.isEmpty();
377    }
378
379    /**
380     * @param value {@link #request} (A reference to the order that this is in response to.)
381     */
382    public OrderResponse setRequest(Reference value) { 
383      this.request = value;
384      return this;
385    }
386
387    /**
388     * @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. (A reference to the order that this is in response to.)
389     */
390    public Order getRequestTarget() { 
391      if (this.requestTarget == null)
392        if (Configuration.errorOnAutoCreate())
393          throw new Error("Attempt to auto-create OrderResponse.request");
394        else if (Configuration.doAutoCreate())
395          this.requestTarget = new Order(); // aa
396      return this.requestTarget;
397    }
398
399    /**
400     * @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. (A reference to the order that this is in response to.)
401     */
402    public OrderResponse setRequestTarget(Order value) { 
403      this.requestTarget = value;
404      return this;
405    }
406
407    /**
408     * @return {@link #date} (The date and time at which this order response was made (created/posted).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
409     */
410    public DateTimeType getDateElement() { 
411      if (this.date == null)
412        if (Configuration.errorOnAutoCreate())
413          throw new Error("Attempt to auto-create OrderResponse.date");
414        else if (Configuration.doAutoCreate())
415          this.date = new DateTimeType(); // bb
416      return this.date;
417    }
418
419    public boolean hasDateElement() { 
420      return this.date != null && !this.date.isEmpty();
421    }
422
423    public boolean hasDate() { 
424      return this.date != null && !this.date.isEmpty();
425    }
426
427    /**
428     * @param value {@link #date} (The date and time at which this order response was made (created/posted).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
429     */
430    public OrderResponse setDateElement(DateTimeType value) { 
431      this.date = value;
432      return this;
433    }
434
435    /**
436     * @return The date and time at which this order response was made (created/posted).
437     */
438    public Date getDate() { 
439      return this.date == null ? null : this.date.getValue();
440    }
441
442    /**
443     * @param value The date and time at which this order response was made (created/posted).
444     */
445    public OrderResponse setDate(Date value) { 
446      if (value == null)
447        this.date = null;
448      else {
449        if (this.date == null)
450          this.date = new DateTimeType();
451        this.date.setValue(value);
452      }
453      return this;
454    }
455
456    /**
457     * @return {@link #who} (The person, organization, or device credited with making the response.)
458     */
459    public Reference getWho() { 
460      if (this.who == null)
461        if (Configuration.errorOnAutoCreate())
462          throw new Error("Attempt to auto-create OrderResponse.who");
463        else if (Configuration.doAutoCreate())
464          this.who = new Reference(); // cc
465      return this.who;
466    }
467
468    public boolean hasWho() { 
469      return this.who != null && !this.who.isEmpty();
470    }
471
472    /**
473     * @param value {@link #who} (The person, organization, or device credited with making the response.)
474     */
475    public OrderResponse setWho(Reference value) { 
476      this.who = value;
477      return this;
478    }
479
480    /**
481     * @return {@link #who} 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 person, organization, or device credited with making the response.)
482     */
483    public Resource getWhoTarget() { 
484      return this.whoTarget;
485    }
486
487    /**
488     * @param value {@link #who} 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 person, organization, or device credited with making the response.)
489     */
490    public OrderResponse setWhoTarget(Resource value) { 
491      this.whoTarget = value;
492      return this;
493    }
494
495    /**
496     * @return {@link #orderStatus} (What this response says about the status of the original order.). This is the underlying object with id, value and extensions. The accessor "getOrderStatus" gives direct access to the value
497     */
498    public Enumeration<OrderStatus> getOrderStatusElement() { 
499      if (this.orderStatus == null)
500        if (Configuration.errorOnAutoCreate())
501          throw new Error("Attempt to auto-create OrderResponse.orderStatus");
502        else if (Configuration.doAutoCreate())
503          this.orderStatus = new Enumeration<OrderStatus>(new OrderStatusEnumFactory()); // bb
504      return this.orderStatus;
505    }
506
507    public boolean hasOrderStatusElement() { 
508      return this.orderStatus != null && !this.orderStatus.isEmpty();
509    }
510
511    public boolean hasOrderStatus() { 
512      return this.orderStatus != null && !this.orderStatus.isEmpty();
513    }
514
515    /**
516     * @param value {@link #orderStatus} (What this response says about the status of the original order.). This is the underlying object with id, value and extensions. The accessor "getOrderStatus" gives direct access to the value
517     */
518    public OrderResponse setOrderStatusElement(Enumeration<OrderStatus> value) { 
519      this.orderStatus = value;
520      return this;
521    }
522
523    /**
524     * @return What this response says about the status of the original order.
525     */
526    public OrderStatus getOrderStatus() { 
527      return this.orderStatus == null ? null : this.orderStatus.getValue();
528    }
529
530    /**
531     * @param value What this response says about the status of the original order.
532     */
533    public OrderResponse setOrderStatus(OrderStatus value) { 
534        if (this.orderStatus == null)
535          this.orderStatus = new Enumeration<OrderStatus>(new OrderStatusEnumFactory());
536        this.orderStatus.setValue(value);
537      return this;
538    }
539
540    /**
541     * @return {@link #description} (Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
542     */
543    public StringType getDescriptionElement() { 
544      if (this.description == null)
545        if (Configuration.errorOnAutoCreate())
546          throw new Error("Attempt to auto-create OrderResponse.description");
547        else if (Configuration.doAutoCreate())
548          this.description = new StringType(); // bb
549      return this.description;
550    }
551
552    public boolean hasDescriptionElement() { 
553      return this.description != null && !this.description.isEmpty();
554    }
555
556    public boolean hasDescription() { 
557      return this.description != null && !this.description.isEmpty();
558    }
559
560    /**
561     * @param value {@link #description} (Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
562     */
563    public OrderResponse setDescriptionElement(StringType value) { 
564      this.description = value;
565      return this;
566    }
567
568    /**
569     * @return Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.
570     */
571    public String getDescription() { 
572      return this.description == null ? null : this.description.getValue();
573    }
574
575    /**
576     * @param value Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.
577     */
578    public OrderResponse setDescription(String value) { 
579      if (Utilities.noString(value))
580        this.description = null;
581      else {
582        if (this.description == null)
583          this.description = new StringType();
584        this.description.setValue(value);
585      }
586      return this;
587    }
588
589    /**
590     * @return {@link #fulfillment} (Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.)
591     */
592    public List<Reference> getFulfillment() { 
593      if (this.fulfillment == null)
594        this.fulfillment = new ArrayList<Reference>();
595      return this.fulfillment;
596    }
597
598    public boolean hasFulfillment() { 
599      if (this.fulfillment == null)
600        return false;
601      for (Reference item : this.fulfillment)
602        if (!item.isEmpty())
603          return true;
604      return false;
605    }
606
607    /**
608     * @return {@link #fulfillment} (Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.)
609     */
610    // syntactic sugar
611    public Reference addFulfillment() { //3
612      Reference t = new Reference();
613      if (this.fulfillment == null)
614        this.fulfillment = new ArrayList<Reference>();
615      this.fulfillment.add(t);
616      return t;
617    }
618
619    // syntactic sugar
620    public OrderResponse addFulfillment(Reference t) { //3
621      if (t == null)
622        return this;
623      if (this.fulfillment == null)
624        this.fulfillment = new ArrayList<Reference>();
625      this.fulfillment.add(t);
626      return this;
627    }
628
629    /**
630     * @return {@link #fulfillment} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.)
631     */
632    public List<Resource> getFulfillmentTarget() { 
633      if (this.fulfillmentTarget == null)
634        this.fulfillmentTarget = new ArrayList<Resource>();
635      return this.fulfillmentTarget;
636    }
637
638      protected void listChildren(List<Property> childrenList) {
639        super.listChildren(childrenList);
640        childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.", 0, java.lang.Integer.MAX_VALUE, identifier));
641        childrenList.add(new Property("request", "Reference(Order)", "A reference to the order that this is in response to.", 0, java.lang.Integer.MAX_VALUE, request));
642        childrenList.add(new Property("date", "dateTime", "The date and time at which this order response was made (created/posted).", 0, java.lang.Integer.MAX_VALUE, date));
643        childrenList.add(new Property("who", "Reference(Practitioner|Organization|Device)", "The person, organization, or device credited with making the response.", 0, java.lang.Integer.MAX_VALUE, who));
644        childrenList.add(new Property("orderStatus", "code", "What this response says about the status of the original order.", 0, java.lang.Integer.MAX_VALUE, orderStatus));
645        childrenList.add(new Property("description", "string", "Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.", 0, java.lang.Integer.MAX_VALUE, description));
646        childrenList.add(new Property("fulfillment", "Reference(Any)", "Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.", 0, java.lang.Integer.MAX_VALUE, fulfillment));
647      }
648
649      @Override
650      public void setProperty(String name, Base value) throws FHIRException {
651        if (name.equals("identifier"))
652          this.getIdentifier().add(castToIdentifier(value));
653        else if (name.equals("request"))
654          this.request = castToReference(value); // Reference
655        else if (name.equals("date"))
656          this.date = castToDateTime(value); // DateTimeType
657        else if (name.equals("who"))
658          this.who = castToReference(value); // Reference
659        else if (name.equals("orderStatus"))
660          this.orderStatus = new OrderStatusEnumFactory().fromType(value); // Enumeration<OrderStatus>
661        else if (name.equals("description"))
662          this.description = castToString(value); // StringType
663        else if (name.equals("fulfillment"))
664          this.getFulfillment().add(castToReference(value));
665        else
666          super.setProperty(name, value);
667      }
668
669      @Override
670      public Base addChild(String name) throws FHIRException {
671        if (name.equals("identifier")) {
672          return addIdentifier();
673        }
674        else if (name.equals("request")) {
675          this.request = new Reference();
676          return this.request;
677        }
678        else if (name.equals("date")) {
679          throw new FHIRException("Cannot call addChild on a primitive type OrderResponse.date");
680        }
681        else if (name.equals("who")) {
682          this.who = new Reference();
683          return this.who;
684        }
685        else if (name.equals("orderStatus")) {
686          throw new FHIRException("Cannot call addChild on a primitive type OrderResponse.orderStatus");
687        }
688        else if (name.equals("description")) {
689          throw new FHIRException("Cannot call addChild on a primitive type OrderResponse.description");
690        }
691        else if (name.equals("fulfillment")) {
692          return addFulfillment();
693        }
694        else
695          return super.addChild(name);
696      }
697
698  public String fhirType() {
699    return "OrderResponse";
700
701  }
702
703      public OrderResponse copy() {
704        OrderResponse dst = new OrderResponse();
705        copyValues(dst);
706        if (identifier != null) {
707          dst.identifier = new ArrayList<Identifier>();
708          for (Identifier i : identifier)
709            dst.identifier.add(i.copy());
710        };
711        dst.request = request == null ? null : request.copy();
712        dst.date = date == null ? null : date.copy();
713        dst.who = who == null ? null : who.copy();
714        dst.orderStatus = orderStatus == null ? null : orderStatus.copy();
715        dst.description = description == null ? null : description.copy();
716        if (fulfillment != null) {
717          dst.fulfillment = new ArrayList<Reference>();
718          for (Reference i : fulfillment)
719            dst.fulfillment.add(i.copy());
720        };
721        return dst;
722      }
723
724      protected OrderResponse typedCopy() {
725        return copy();
726      }
727
728      @Override
729      public boolean equalsDeep(Base other) {
730        if (!super.equalsDeep(other))
731          return false;
732        if (!(other instanceof OrderResponse))
733          return false;
734        OrderResponse o = (OrderResponse) other;
735        return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(date, o.date, true)
736           && compareDeep(who, o.who, true) && compareDeep(orderStatus, o.orderStatus, true) && compareDeep(description, o.description, true)
737           && compareDeep(fulfillment, o.fulfillment, true);
738      }
739
740      @Override
741      public boolean equalsShallow(Base other) {
742        if (!super.equalsShallow(other))
743          return false;
744        if (!(other instanceof OrderResponse))
745          return false;
746        OrderResponse o = (OrderResponse) other;
747        return compareValues(date, o.date, true) && compareValues(orderStatus, o.orderStatus, true) && compareValues(description, o.description, true)
748          ;
749      }
750
751      public boolean isEmpty() {
752        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
753           && (date == null || date.isEmpty()) && (who == null || who.isEmpty()) && (orderStatus == null || orderStatus.isEmpty())
754           && (description == null || description.isEmpty()) && (fulfillment == null || fulfillment.isEmpty())
755          ;
756      }
757
758  @Override
759  public ResourceType getResourceType() {
760    return ResourceType.OrderResponse;
761   }
762
763  @SearchParamDefinition(name="date", path="OrderResponse.date", description="When the response was made", type="date" )
764  public static final String SP_DATE = "date";
765  @SearchParamDefinition(name="request", path="OrderResponse.request", description="The order that this is a response to", type="reference" )
766  public static final String SP_REQUEST = "request";
767  @SearchParamDefinition(name="identifier", path="OrderResponse.identifier", description="Identifiers assigned to this order by the orderer or by the receiver", type="token" )
768  public static final String SP_IDENTIFIER = "identifier";
769  @SearchParamDefinition(name="code", path="OrderResponse.orderStatus", description="pending | review | rejected | error | accepted | cancelled | replaced | aborted | completed", type="token" )
770  public static final String SP_CODE = "code";
771  @SearchParamDefinition(name="fulfillment", path="OrderResponse.fulfillment", description="Details of the outcome of performing the order", type="reference" )
772  public static final String SP_FULFILLMENT = "fulfillment";
773  @SearchParamDefinition(name="who", path="OrderResponse.who", description="Who made the response", type="reference" )
774  public static final String SP_WHO = "who";
775
776}
777