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