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