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