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