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.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import org.hl7.fhir.exceptions.FHIRException;
047/**
048 * A request to perform an action.
049 */
050@ResourceDef(name="Order", profile="http://hl7.org/fhir/Profile/Order")
051public class Order extends DomainResource {
052
053    @Block()
054    public static class OrderWhenComponent extends BackboneElement implements IBaseBackboneElement {
055        /**
056         * Code specifies when request should be done. The code may simply be a priority code.
057         */
058        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
059        @Description(shortDefinition="Code specifies when request should be done. The code may simply be a priority code", formalDefinition="Code specifies when request should be done. The code may simply be a priority code." )
060        protected CodeableConcept code;
061
062        /**
063         * A formal schedule.
064         */
065        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=1, modifier=false, summary=true)
066        @Description(shortDefinition="A formal schedule", formalDefinition="A formal schedule." )
067        protected Timing schedule;
068
069        private static final long serialVersionUID = 307115287L;
070
071    /*
072     * Constructor
073     */
074      public OrderWhenComponent() {
075        super();
076      }
077
078        /**
079         * @return {@link #code} (Code specifies when request should be done. The code may simply be a priority code.)
080         */
081        public CodeableConcept getCode() { 
082          if (this.code == null)
083            if (Configuration.errorOnAutoCreate())
084              throw new Error("Attempt to auto-create OrderWhenComponent.code");
085            else if (Configuration.doAutoCreate())
086              this.code = new CodeableConcept(); // cc
087          return this.code;
088        }
089
090        public boolean hasCode() { 
091          return this.code != null && !this.code.isEmpty();
092        }
093
094        /**
095         * @param value {@link #code} (Code specifies when request should be done. The code may simply be a priority code.)
096         */
097        public OrderWhenComponent setCode(CodeableConcept value) { 
098          this.code = value;
099          return this;
100        }
101
102        /**
103         * @return {@link #schedule} (A formal schedule.)
104         */
105        public Timing getSchedule() { 
106          if (this.schedule == null)
107            if (Configuration.errorOnAutoCreate())
108              throw new Error("Attempt to auto-create OrderWhenComponent.schedule");
109            else if (Configuration.doAutoCreate())
110              this.schedule = new Timing(); // cc
111          return this.schedule;
112        }
113
114        public boolean hasSchedule() { 
115          return this.schedule != null && !this.schedule.isEmpty();
116        }
117
118        /**
119         * @param value {@link #schedule} (A formal schedule.)
120         */
121        public OrderWhenComponent setSchedule(Timing value) { 
122          this.schedule = value;
123          return this;
124        }
125
126        protected void listChildren(List<Property> childrenList) {
127          super.listChildren(childrenList);
128          childrenList.add(new Property("code", "CodeableConcept", "Code specifies when request should be done. The code may simply be a priority code.", 0, java.lang.Integer.MAX_VALUE, code));
129          childrenList.add(new Property("schedule", "Timing", "A formal schedule.", 0, java.lang.Integer.MAX_VALUE, schedule));
130        }
131
132      @Override
133      public void setProperty(String name, Base value) throws FHIRException {
134        if (name.equals("code"))
135          this.code = castToCodeableConcept(value); // CodeableConcept
136        else if (name.equals("schedule"))
137          this.schedule = castToTiming(value); // Timing
138        else
139          super.setProperty(name, value);
140      }
141
142      @Override
143      public Base addChild(String name) throws FHIRException {
144        if (name.equals("code")) {
145          this.code = new CodeableConcept();
146          return this.code;
147        }
148        else if (name.equals("schedule")) {
149          this.schedule = new Timing();
150          return this.schedule;
151        }
152        else
153          return super.addChild(name);
154      }
155
156      public OrderWhenComponent copy() {
157        OrderWhenComponent dst = new OrderWhenComponent();
158        copyValues(dst);
159        dst.code = code == null ? null : code.copy();
160        dst.schedule = schedule == null ? null : schedule.copy();
161        return dst;
162      }
163
164      @Override
165      public boolean equalsDeep(Base other) {
166        if (!super.equalsDeep(other))
167          return false;
168        if (!(other instanceof OrderWhenComponent))
169          return false;
170        OrderWhenComponent o = (OrderWhenComponent) other;
171        return compareDeep(code, o.code, true) && compareDeep(schedule, o.schedule, true);
172      }
173
174      @Override
175      public boolean equalsShallow(Base other) {
176        if (!super.equalsShallow(other))
177          return false;
178        if (!(other instanceof OrderWhenComponent))
179          return false;
180        OrderWhenComponent o = (OrderWhenComponent) other;
181        return true;
182      }
183
184      public boolean isEmpty() {
185        return super.isEmpty() && (code == null || code.isEmpty()) && (schedule == null || schedule.isEmpty())
186          ;
187      }
188
189  public String fhirType() {
190    return "Order.when";
191
192  }
193
194  }
195
196    /**
197     * Identifiers assigned to this order by the orderer or by the receiver.
198     */
199    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
200    @Description(shortDefinition="Identifiers assigned to this order by the orderer or by the receiver", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." )
201    protected List<Identifier> identifier;
202
203    /**
204     * When the order was made.
205     */
206    @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
207    @Description(shortDefinition="When the order was made", formalDefinition="When the order was made." )
208    protected DateTimeType date;
209
210    /**
211     * Patient this order is about.
212     */
213    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=2, min=0, max=1, modifier=false, summary=true)
214    @Description(shortDefinition="Patient this order is about", formalDefinition="Patient this order is about." )
215    protected Reference subject;
216
217    /**
218     * The actual object that is the target of the reference (Patient this order is about.)
219     */
220    protected Resource subjectTarget;
221
222    /**
223     * Who initiated the order.
224     */
225    @Child(name = "source", type = {Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
226    @Description(shortDefinition="Who initiated the order", formalDefinition="Who initiated the order." )
227    protected Reference source;
228
229    /**
230     * The actual object that is the target of the reference (Who initiated the order.)
231     */
232    protected Resource sourceTarget;
233
234    /**
235     * Who is intended to fulfill the order.
236     */
237    @Child(name = "target", type = {Organization.class, Device.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true)
238    @Description(shortDefinition="Who is intended to fulfill the order", formalDefinition="Who is intended to fulfill the order." )
239    protected Reference target;
240
241    /**
242     * The actual object that is the target of the reference (Who is intended to fulfill the order.)
243     */
244    protected Resource targetTarget;
245
246    /**
247     * Text - why the order was made.
248     */
249    @Child(name = "reason", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
250    @Description(shortDefinition="Text - why the order was made", formalDefinition="Text - why the order was made." )
251    protected Type reason;
252
253    /**
254     * When order should be fulfilled.
255     */
256    @Child(name = "when", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
257    @Description(shortDefinition="When order should be fulfilled", formalDefinition="When order should be fulfilled." )
258    protected OrderWhenComponent when;
259
260    /**
261     * What action is being ordered.
262     */
263    @Child(name = "detail", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
264    @Description(shortDefinition="What action is being ordered", formalDefinition="What action is being ordered." )
265    protected List<Reference> detail;
266    /**
267     * The actual objects that are the target of the reference (What action is being ordered.)
268     */
269    protected List<Resource> detailTarget;
270
271
272    private static final long serialVersionUID = -1392311096L;
273
274  /*
275   * Constructor
276   */
277    public Order() {
278      super();
279    }
280
281    /**
282     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
283     */
284    public List<Identifier> getIdentifier() { 
285      if (this.identifier == null)
286        this.identifier = new ArrayList<Identifier>();
287      return this.identifier;
288    }
289
290    public boolean hasIdentifier() { 
291      if (this.identifier == null)
292        return false;
293      for (Identifier item : this.identifier)
294        if (!item.isEmpty())
295          return true;
296      return false;
297    }
298
299    /**
300     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
301     */
302    // syntactic sugar
303    public Identifier addIdentifier() { //3
304      Identifier t = new Identifier();
305      if (this.identifier == null)
306        this.identifier = new ArrayList<Identifier>();
307      this.identifier.add(t);
308      return t;
309    }
310
311    // syntactic sugar
312    public Order addIdentifier(Identifier t) { //3
313      if (t == null)
314        return this;
315      if (this.identifier == null)
316        this.identifier = new ArrayList<Identifier>();
317      this.identifier.add(t);
318      return this;
319    }
320
321    /**
322     * @return {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
323     */
324    public DateTimeType getDateElement() { 
325      if (this.date == null)
326        if (Configuration.errorOnAutoCreate())
327          throw new Error("Attempt to auto-create Order.date");
328        else if (Configuration.doAutoCreate())
329          this.date = new DateTimeType(); // bb
330      return this.date;
331    }
332
333    public boolean hasDateElement() { 
334      return this.date != null && !this.date.isEmpty();
335    }
336
337    public boolean hasDate() { 
338      return this.date != null && !this.date.isEmpty();
339    }
340
341    /**
342     * @param value {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
343     */
344    public Order setDateElement(DateTimeType value) { 
345      this.date = value;
346      return this;
347    }
348
349    /**
350     * @return When the order was made.
351     */
352    public Date getDate() { 
353      return this.date == null ? null : this.date.getValue();
354    }
355
356    /**
357     * @param value When the order was made.
358     */
359    public Order setDate(Date value) { 
360      if (value == null)
361        this.date = null;
362      else {
363        if (this.date == null)
364          this.date = new DateTimeType();
365        this.date.setValue(value);
366      }
367      return this;
368    }
369
370    /**
371     * @return {@link #subject} (Patient this order is about.)
372     */
373    public Reference getSubject() { 
374      if (this.subject == null)
375        if (Configuration.errorOnAutoCreate())
376          throw new Error("Attempt to auto-create Order.subject");
377        else if (Configuration.doAutoCreate())
378          this.subject = new Reference(); // cc
379      return this.subject;
380    }
381
382    public boolean hasSubject() { 
383      return this.subject != null && !this.subject.isEmpty();
384    }
385
386    /**
387     * @param value {@link #subject} (Patient this order is about.)
388     */
389    public Order setSubject(Reference value) { 
390      this.subject = value;
391      return this;
392    }
393
394    /**
395     * @return {@link #subject} 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. (Patient this order is about.)
396     */
397    public Resource getSubjectTarget() { 
398      return this.subjectTarget;
399    }
400
401    /**
402     * @param value {@link #subject} 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. (Patient this order is about.)
403     */
404    public Order setSubjectTarget(Resource value) { 
405      this.subjectTarget = value;
406      return this;
407    }
408
409    /**
410     * @return {@link #source} (Who initiated the order.)
411     */
412    public Reference getSource() { 
413      if (this.source == null)
414        if (Configuration.errorOnAutoCreate())
415          throw new Error("Attempt to auto-create Order.source");
416        else if (Configuration.doAutoCreate())
417          this.source = new Reference(); // cc
418      return this.source;
419    }
420
421    public boolean hasSource() { 
422      return this.source != null && !this.source.isEmpty();
423    }
424
425    /**
426     * @param value {@link #source} (Who initiated the order.)
427     */
428    public Order setSource(Reference value) { 
429      this.source = value;
430      return this;
431    }
432
433    /**
434     * @return {@link #source} 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. (Who initiated the order.)
435     */
436    public Resource getSourceTarget() { 
437      return this.sourceTarget;
438    }
439
440    /**
441     * @param value {@link #source} 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. (Who initiated the order.)
442     */
443    public Order setSourceTarget(Resource value) { 
444      this.sourceTarget = value;
445      return this;
446    }
447
448    /**
449     * @return {@link #target} (Who is intended to fulfill the order.)
450     */
451    public Reference getTarget() { 
452      if (this.target == null)
453        if (Configuration.errorOnAutoCreate())
454          throw new Error("Attempt to auto-create Order.target");
455        else if (Configuration.doAutoCreate())
456          this.target = new Reference(); // cc
457      return this.target;
458    }
459
460    public boolean hasTarget() { 
461      return this.target != null && !this.target.isEmpty();
462    }
463
464    /**
465     * @param value {@link #target} (Who is intended to fulfill the order.)
466     */
467    public Order setTarget(Reference value) { 
468      this.target = value;
469      return this;
470    }
471
472    /**
473     * @return {@link #target} 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. (Who is intended to fulfill the order.)
474     */
475    public Resource getTargetTarget() { 
476      return this.targetTarget;
477    }
478
479    /**
480     * @param value {@link #target} 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. (Who is intended to fulfill the order.)
481     */
482    public Order setTargetTarget(Resource value) { 
483      this.targetTarget = value;
484      return this;
485    }
486
487    /**
488     * @return {@link #reason} (Text - why the order was made.)
489     */
490    public Type getReason() { 
491      return this.reason;
492    }
493
494    /**
495     * @return {@link #reason} (Text - why the order was made.)
496     */
497    public CodeableConcept getReasonCodeableConcept() throws FHIRException { 
498      if (!(this.reason instanceof CodeableConcept))
499        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered");
500      return (CodeableConcept) this.reason;
501    }
502
503    public boolean hasReasonCodeableConcept() { 
504      return this.reason instanceof CodeableConcept;
505    }
506
507    /**
508     * @return {@link #reason} (Text - why the order was made.)
509     */
510    public Reference getReasonReference() throws FHIRException { 
511      if (!(this.reason instanceof Reference))
512        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered");
513      return (Reference) this.reason;
514    }
515
516    public boolean hasReasonReference() { 
517      return this.reason instanceof Reference;
518    }
519
520    public boolean hasReason() { 
521      return this.reason != null && !this.reason.isEmpty();
522    }
523
524    /**
525     * @param value {@link #reason} (Text - why the order was made.)
526     */
527    public Order setReason(Type value) { 
528      this.reason = value;
529      return this;
530    }
531
532    /**
533     * @return {@link #when} (When order should be fulfilled.)
534     */
535    public OrderWhenComponent getWhen() { 
536      if (this.when == null)
537        if (Configuration.errorOnAutoCreate())
538          throw new Error("Attempt to auto-create Order.when");
539        else if (Configuration.doAutoCreate())
540          this.when = new OrderWhenComponent(); // cc
541      return this.when;
542    }
543
544    public boolean hasWhen() { 
545      return this.when != null && !this.when.isEmpty();
546    }
547
548    /**
549     * @param value {@link #when} (When order should be fulfilled.)
550     */
551    public Order setWhen(OrderWhenComponent value) { 
552      this.when = value;
553      return this;
554    }
555
556    /**
557     * @return {@link #detail} (What action is being ordered.)
558     */
559    public List<Reference> getDetail() { 
560      if (this.detail == null)
561        this.detail = new ArrayList<Reference>();
562      return this.detail;
563    }
564
565    public boolean hasDetail() { 
566      if (this.detail == null)
567        return false;
568      for (Reference item : this.detail)
569        if (!item.isEmpty())
570          return true;
571      return false;
572    }
573
574    /**
575     * @return {@link #detail} (What action is being ordered.)
576     */
577    // syntactic sugar
578    public Reference addDetail() { //3
579      Reference t = new Reference();
580      if (this.detail == null)
581        this.detail = new ArrayList<Reference>();
582      this.detail.add(t);
583      return t;
584    }
585
586    // syntactic sugar
587    public Order addDetail(Reference t) { //3
588      if (t == null)
589        return this;
590      if (this.detail == null)
591        this.detail = new ArrayList<Reference>();
592      this.detail.add(t);
593      return this;
594    }
595
596    /**
597     * @return {@link #detail} (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. What action is being ordered.)
598     */
599    public List<Resource> getDetailTarget() { 
600      if (this.detailTarget == null)
601        this.detailTarget = new ArrayList<Resource>();
602      return this.detailTarget;
603    }
604
605      protected void listChildren(List<Property> childrenList) {
606        super.listChildren(childrenList);
607        childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
608        childrenList.add(new Property("date", "dateTime", "When the order was made.", 0, java.lang.Integer.MAX_VALUE, date));
609        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Patient this order is about.", 0, java.lang.Integer.MAX_VALUE, subject));
610        childrenList.add(new Property("source", "Reference(Practitioner|Organization)", "Who initiated the order.", 0, java.lang.Integer.MAX_VALUE, source));
611        childrenList.add(new Property("target", "Reference(Organization|Device|Practitioner)", "Who is intended to fulfill the order.", 0, java.lang.Integer.MAX_VALUE, target));
612        childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "Text - why the order was made.", 0, java.lang.Integer.MAX_VALUE, reason));
613        childrenList.add(new Property("when", "", "When order should be fulfilled.", 0, java.lang.Integer.MAX_VALUE, when));
614        childrenList.add(new Property("detail", "Reference(Any)", "What action is being ordered.", 0, java.lang.Integer.MAX_VALUE, detail));
615      }
616
617      @Override
618      public void setProperty(String name, Base value) throws FHIRException {
619        if (name.equals("identifier"))
620          this.getIdentifier().add(castToIdentifier(value));
621        else if (name.equals("date"))
622          this.date = castToDateTime(value); // DateTimeType
623        else if (name.equals("subject"))
624          this.subject = castToReference(value); // Reference
625        else if (name.equals("source"))
626          this.source = castToReference(value); // Reference
627        else if (name.equals("target"))
628          this.target = castToReference(value); // Reference
629        else if (name.equals("reason[x]"))
630          this.reason = (Type) value; // Type
631        else if (name.equals("when"))
632          this.when = (OrderWhenComponent) value; // OrderWhenComponent
633        else if (name.equals("detail"))
634          this.getDetail().add(castToReference(value));
635        else
636          super.setProperty(name, value);
637      }
638
639      @Override
640      public Base addChild(String name) throws FHIRException {
641        if (name.equals("identifier")) {
642          return addIdentifier();
643        }
644        else if (name.equals("date")) {
645          throw new FHIRException("Cannot call addChild on a primitive type Order.date");
646        }
647        else if (name.equals("subject")) {
648          this.subject = new Reference();
649          return this.subject;
650        }
651        else if (name.equals("source")) {
652          this.source = new Reference();
653          return this.source;
654        }
655        else if (name.equals("target")) {
656          this.target = new Reference();
657          return this.target;
658        }
659        else if (name.equals("reasonCodeableConcept")) {
660          this.reason = new CodeableConcept();
661          return this.reason;
662        }
663        else if (name.equals("reasonReference")) {
664          this.reason = new Reference();
665          return this.reason;
666        }
667        else if (name.equals("when")) {
668          this.when = new OrderWhenComponent();
669          return this.when;
670        }
671        else if (name.equals("detail")) {
672          return addDetail();
673        }
674        else
675          return super.addChild(name);
676      }
677
678  public String fhirType() {
679    return "Order";
680
681  }
682
683      public Order copy() {
684        Order dst = new Order();
685        copyValues(dst);
686        if (identifier != null) {
687          dst.identifier = new ArrayList<Identifier>();
688          for (Identifier i : identifier)
689            dst.identifier.add(i.copy());
690        };
691        dst.date = date == null ? null : date.copy();
692        dst.subject = subject == null ? null : subject.copy();
693        dst.source = source == null ? null : source.copy();
694        dst.target = target == null ? null : target.copy();
695        dst.reason = reason == null ? null : reason.copy();
696        dst.when = when == null ? null : when.copy();
697        if (detail != null) {
698          dst.detail = new ArrayList<Reference>();
699          for (Reference i : detail)
700            dst.detail.add(i.copy());
701        };
702        return dst;
703      }
704
705      protected Order typedCopy() {
706        return copy();
707      }
708
709      @Override
710      public boolean equalsDeep(Base other) {
711        if (!super.equalsDeep(other))
712          return false;
713        if (!(other instanceof Order))
714          return false;
715        Order o = (Order) other;
716        return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) && compareDeep(subject, o.subject, true)
717           && compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(reason, o.reason, true)
718           && compareDeep(when, o.when, true) && compareDeep(detail, o.detail, true);
719      }
720
721      @Override
722      public boolean equalsShallow(Base other) {
723        if (!super.equalsShallow(other))
724          return false;
725        if (!(other instanceof Order))
726          return false;
727        Order o = (Order) other;
728        return compareValues(date, o.date, true);
729      }
730
731      public boolean isEmpty() {
732        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty())
733           && (subject == null || subject.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty())
734           && (reason == null || reason.isEmpty()) && (when == null || when.isEmpty()) && (detail == null || detail.isEmpty())
735          ;
736      }
737
738  @Override
739  public ResourceType getResourceType() {
740    return ResourceType.Order;
741   }
742
743  @SearchParamDefinition(name="date", path="Order.date", description="When the order was made", type="date" )
744  public static final String SP_DATE = "date";
745  @SearchParamDefinition(name="identifier", path="Order.identifier", description="Instance id from source, target, and/or  others", type="token" )
746  public static final String SP_IDENTIFIER = "identifier";
747  @SearchParamDefinition(name="subject", path="Order.subject", description="Patient this order is about", type="reference" )
748  public static final String SP_SUBJECT = "subject";
749  @SearchParamDefinition(name="patient", path="Order.subject", description="Patient this order is about", type="reference" )
750  public static final String SP_PATIENT = "patient";
751  @SearchParamDefinition(name="source", path="Order.source", description="Who initiated the order", type="reference" )
752  public static final String SP_SOURCE = "source";
753  @SearchParamDefinition(name="detail", path="Order.detail", description="What action is being ordered", type="reference" )
754  public static final String SP_DETAIL = "detail";
755  @SearchParamDefinition(name="when", path="Order.when.schedule", description="A formal schedule", type="date" )
756  public static final String SP_WHEN = "when";
757  @SearchParamDefinition(name="target", path="Order.target", description="Who is intended to fulfill the order", type="reference" )
758  public static final String SP_TARGET = "target";
759  @SearchParamDefinition(name="when_code", path="Order.when.code", description="Code specifies when request should be done. The code may simply be a priority code", type="token" )
760  public static final String SP_WHENCODE = "when_code";
761
762}