001package org.hl7.fhir.dstu3.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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.exceptions.FHIRFormatError;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * A record of a request for a medication, substance or device used in the healthcare setting.
051 */
052@ResourceDef(name="SupplyRequest", profile="http://hl7.org/fhir/Profile/SupplyRequest")
053public class SupplyRequest extends DomainResource {
054
055    public enum SupplyRequestStatus {
056        /**
057         * The request has been created but is not yet complete or ready for action
058         */
059        DRAFT, 
060        /**
061         * The request is ready to be acted upon
062         */
063        ACTIVE, 
064        /**
065         * The authorization/request to act has been temporarily withdrawn but is expected to resume in the future
066         */
067        SUSPENDED, 
068        /**
069         * The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.
070         */
071        CANCELLED, 
072        /**
073         * Activity against the request has been sufficiently completed to the satisfaction of the requester
074         */
075        COMPLETED, 
076        /**
077         * This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
078         */
079        ENTEREDINERROR, 
080        /**
081         * The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
082         */
083        UNKNOWN, 
084        /**
085         * added to help the parsers with the generic types
086         */
087        NULL;
088        public static SupplyRequestStatus fromCode(String codeString) throws FHIRException {
089            if (codeString == null || "".equals(codeString))
090                return null;
091        if ("draft".equals(codeString))
092          return DRAFT;
093        if ("active".equals(codeString))
094          return ACTIVE;
095        if ("suspended".equals(codeString))
096          return SUSPENDED;
097        if ("cancelled".equals(codeString))
098          return CANCELLED;
099        if ("completed".equals(codeString))
100          return COMPLETED;
101        if ("entered-in-error".equals(codeString))
102          return ENTEREDINERROR;
103        if ("unknown".equals(codeString))
104          return UNKNOWN;
105        if (Configuration.isAcceptInvalidEnums())
106          return null;
107        else
108          throw new FHIRException("Unknown SupplyRequestStatus code '"+codeString+"'");
109        }
110        public String toCode() {
111          switch (this) {
112            case DRAFT: return "draft";
113            case ACTIVE: return "active";
114            case SUSPENDED: return "suspended";
115            case CANCELLED: return "cancelled";
116            case COMPLETED: return "completed";
117            case ENTEREDINERROR: return "entered-in-error";
118            case UNKNOWN: return "unknown";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123        public String getSystem() {
124          switch (this) {
125            case DRAFT: return "http://hl7.org/fhir/supplyrequest-status";
126            case ACTIVE: return "http://hl7.org/fhir/supplyrequest-status";
127            case SUSPENDED: return "http://hl7.org/fhir/supplyrequest-status";
128            case CANCELLED: return "http://hl7.org/fhir/supplyrequest-status";
129            case COMPLETED: return "http://hl7.org/fhir/supplyrequest-status";
130            case ENTEREDINERROR: return "http://hl7.org/fhir/supplyrequest-status";
131            case UNKNOWN: return "http://hl7.org/fhir/supplyrequest-status";
132            case NULL: return null;
133            default: return "?";
134          }
135        }
136        public String getDefinition() {
137          switch (this) {
138            case DRAFT: return "The request has been created but is not yet complete or ready for action";
139            case ACTIVE: return "The request is ready to be acted upon";
140            case SUSPENDED: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future";
141            case CANCELLED: return "The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.";
142            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester";
143            case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
144            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
145            case NULL: return null;
146            default: return "?";
147          }
148        }
149        public String getDisplay() {
150          switch (this) {
151            case DRAFT: return "Draft";
152            case ACTIVE: return "Active";
153            case SUSPENDED: return "Suspended";
154            case CANCELLED: return "Cancelled";
155            case COMPLETED: return "Completed";
156            case ENTEREDINERROR: return "Entered in Error";
157            case UNKNOWN: return "Unknown";
158            case NULL: return null;
159            default: return "?";
160          }
161        }
162    }
163
164  public static class SupplyRequestStatusEnumFactory implements EnumFactory<SupplyRequestStatus> {
165    public SupplyRequestStatus fromCode(String codeString) throws IllegalArgumentException {
166      if (codeString == null || "".equals(codeString))
167            if (codeString == null || "".equals(codeString))
168                return null;
169        if ("draft".equals(codeString))
170          return SupplyRequestStatus.DRAFT;
171        if ("active".equals(codeString))
172          return SupplyRequestStatus.ACTIVE;
173        if ("suspended".equals(codeString))
174          return SupplyRequestStatus.SUSPENDED;
175        if ("cancelled".equals(codeString))
176          return SupplyRequestStatus.CANCELLED;
177        if ("completed".equals(codeString))
178          return SupplyRequestStatus.COMPLETED;
179        if ("entered-in-error".equals(codeString))
180          return SupplyRequestStatus.ENTEREDINERROR;
181        if ("unknown".equals(codeString))
182          return SupplyRequestStatus.UNKNOWN;
183        throw new IllegalArgumentException("Unknown SupplyRequestStatus code '"+codeString+"'");
184        }
185        public Enumeration<SupplyRequestStatus> fromType(PrimitiveType<?> code) throws FHIRException {
186          if (code == null)
187            return null;
188          if (code.isEmpty())
189            return new Enumeration<SupplyRequestStatus>(this);
190          String codeString = code.asStringValue();
191          if (codeString == null || "".equals(codeString))
192            return null;
193        if ("draft".equals(codeString))
194          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.DRAFT);
195        if ("active".equals(codeString))
196          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ACTIVE);
197        if ("suspended".equals(codeString))
198          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.SUSPENDED);
199        if ("cancelled".equals(codeString))
200          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.CANCELLED);
201        if ("completed".equals(codeString))
202          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.COMPLETED);
203        if ("entered-in-error".equals(codeString))
204          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ENTEREDINERROR);
205        if ("unknown".equals(codeString))
206          return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.UNKNOWN);
207        throw new FHIRException("Unknown SupplyRequestStatus code '"+codeString+"'");
208        }
209    public String toCode(SupplyRequestStatus code) {
210      if (code == SupplyRequestStatus.DRAFT)
211        return "draft";
212      if (code == SupplyRequestStatus.ACTIVE)
213        return "active";
214      if (code == SupplyRequestStatus.SUSPENDED)
215        return "suspended";
216      if (code == SupplyRequestStatus.CANCELLED)
217        return "cancelled";
218      if (code == SupplyRequestStatus.COMPLETED)
219        return "completed";
220      if (code == SupplyRequestStatus.ENTEREDINERROR)
221        return "entered-in-error";
222      if (code == SupplyRequestStatus.UNKNOWN)
223        return "unknown";
224      return "?";
225      }
226    public String toSystem(SupplyRequestStatus code) {
227      return code.getSystem();
228      }
229    }
230
231    public enum RequestPriority {
232        /**
233         * The request has normal priority
234         */
235        ROUTINE, 
236        /**
237         * The request should be actioned promptly - higher priority than routine
238         */
239        URGENT, 
240        /**
241         * The request should be actioned as soon as possible - higher priority than urgent
242         */
243        ASAP, 
244        /**
245         * The request should be actioned immediately - highest possible priority.  E.g. an emergency
246         */
247        STAT, 
248        /**
249         * added to help the parsers with the generic types
250         */
251        NULL;
252        public static RequestPriority fromCode(String codeString) throws FHIRException {
253            if (codeString == null || "".equals(codeString))
254                return null;
255        if ("routine".equals(codeString))
256          return ROUTINE;
257        if ("urgent".equals(codeString))
258          return URGENT;
259        if ("asap".equals(codeString))
260          return ASAP;
261        if ("stat".equals(codeString))
262          return STAT;
263        if (Configuration.isAcceptInvalidEnums())
264          return null;
265        else
266          throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
267        }
268        public String toCode() {
269          switch (this) {
270            case ROUTINE: return "routine";
271            case URGENT: return "urgent";
272            case ASAP: return "asap";
273            case STAT: return "stat";
274            case NULL: return null;
275            default: return "?";
276          }
277        }
278        public String getSystem() {
279          switch (this) {
280            case ROUTINE: return "http://hl7.org/fhir/request-priority";
281            case URGENT: return "http://hl7.org/fhir/request-priority";
282            case ASAP: return "http://hl7.org/fhir/request-priority";
283            case STAT: return "http://hl7.org/fhir/request-priority";
284            case NULL: return null;
285            default: return "?";
286          }
287        }
288        public String getDefinition() {
289          switch (this) {
290            case ROUTINE: return "The request has normal priority";
291            case URGENT: return "The request should be actioned promptly - higher priority than routine";
292            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent";
293            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency";
294            case NULL: return null;
295            default: return "?";
296          }
297        }
298        public String getDisplay() {
299          switch (this) {
300            case ROUTINE: return "Routine";
301            case URGENT: return "Urgent";
302            case ASAP: return "ASAP";
303            case STAT: return "STAT";
304            case NULL: return null;
305            default: return "?";
306          }
307        }
308    }
309
310  public static class RequestPriorityEnumFactory implements EnumFactory<RequestPriority> {
311    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
312      if (codeString == null || "".equals(codeString))
313            if (codeString == null || "".equals(codeString))
314                return null;
315        if ("routine".equals(codeString))
316          return RequestPriority.ROUTINE;
317        if ("urgent".equals(codeString))
318          return RequestPriority.URGENT;
319        if ("asap".equals(codeString))
320          return RequestPriority.ASAP;
321        if ("stat".equals(codeString))
322          return RequestPriority.STAT;
323        throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
324        }
325        public Enumeration<RequestPriority> fromType(PrimitiveType<?> code) throws FHIRException {
326          if (code == null)
327            return null;
328          if (code.isEmpty())
329            return new Enumeration<RequestPriority>(this);
330          String codeString = code.asStringValue();
331          if (codeString == null || "".equals(codeString))
332            return null;
333        if ("routine".equals(codeString))
334          return new Enumeration<RequestPriority>(this, RequestPriority.ROUTINE);
335        if ("urgent".equals(codeString))
336          return new Enumeration<RequestPriority>(this, RequestPriority.URGENT);
337        if ("asap".equals(codeString))
338          return new Enumeration<RequestPriority>(this, RequestPriority.ASAP);
339        if ("stat".equals(codeString))
340          return new Enumeration<RequestPriority>(this, RequestPriority.STAT);
341        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
342        }
343    public String toCode(RequestPriority code) {
344      if (code == RequestPriority.ROUTINE)
345        return "routine";
346      if (code == RequestPriority.URGENT)
347        return "urgent";
348      if (code == RequestPriority.ASAP)
349        return "asap";
350      if (code == RequestPriority.STAT)
351        return "stat";
352      return "?";
353      }
354    public String toSystem(RequestPriority code) {
355      return code.getSystem();
356      }
357    }
358
359    @Block()
360    public static class SupplyRequestOrderedItemComponent extends BackboneElement implements IBaseBackboneElement {
361        /**
362         * The amount that is being ordered of the indicated item.
363         */
364        @Child(name = "quantity", type = {Quantity.class}, order=1, min=1, max=1, modifier=false, summary=true)
365        @Description(shortDefinition="The requested amount of the item indicated", formalDefinition="The amount that is being ordered of the indicated item." )
366        protected Quantity quantity;
367
368        /**
369         * The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.
370         */
371        @Child(name = "item", type = {CodeableConcept.class, Medication.class, Substance.class, Device.class}, order=2, min=0, max=1, modifier=false, summary=true)
372        @Description(shortDefinition="Medication, Substance, or Device requested to be supplied", formalDefinition="The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list." )
373        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supply-item")
374        protected Type item;
375
376        private static final long serialVersionUID = 1628109307L;
377
378    /**
379     * Constructor
380     */
381      public SupplyRequestOrderedItemComponent() {
382        super();
383      }
384
385    /**
386     * Constructor
387     */
388      public SupplyRequestOrderedItemComponent(Quantity quantity) {
389        super();
390        this.quantity = quantity;
391      }
392
393        /**
394         * @return {@link #quantity} (The amount that is being ordered of the indicated item.)
395         */
396        public Quantity getQuantity() { 
397          if (this.quantity == null)
398            if (Configuration.errorOnAutoCreate())
399              throw new Error("Attempt to auto-create SupplyRequestOrderedItemComponent.quantity");
400            else if (Configuration.doAutoCreate())
401              this.quantity = new Quantity(); // cc
402          return this.quantity;
403        }
404
405        public boolean hasQuantity() { 
406          return this.quantity != null && !this.quantity.isEmpty();
407        }
408
409        /**
410         * @param value {@link #quantity} (The amount that is being ordered of the indicated item.)
411         */
412        public SupplyRequestOrderedItemComponent setQuantity(Quantity value)  { 
413          this.quantity = value;
414          return this;
415        }
416
417        /**
418         * @return {@link #item} (The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.)
419         */
420        public Type getItem() { 
421          return this.item;
422        }
423
424        /**
425         * @return {@link #item} (The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.)
426         */
427        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
428          if (this.item == null)
429            return null;
430          if (!(this.item instanceof CodeableConcept))
431            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
432          return (CodeableConcept) this.item;
433        }
434
435        public boolean hasItemCodeableConcept() { 
436          return this != null && this.item instanceof CodeableConcept;
437        }
438
439        /**
440         * @return {@link #item} (The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.)
441         */
442        public Reference getItemReference() throws FHIRException { 
443          if (this.item == null)
444            return null;
445          if (!(this.item instanceof Reference))
446            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
447          return (Reference) this.item;
448        }
449
450        public boolean hasItemReference() { 
451          return this != null && this.item instanceof Reference;
452        }
453
454        public boolean hasItem() { 
455          return this.item != null && !this.item.isEmpty();
456        }
457
458        /**
459         * @param value {@link #item} (The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.)
460         */
461        public SupplyRequestOrderedItemComponent setItem(Type value) throws FHIRFormatError { 
462          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
463            throw new FHIRFormatError("Not the right type for SupplyRequest.orderedItem.item[x]: "+value.fhirType());
464          this.item = value;
465          return this;
466        }
467
468        protected void listChildren(List<Property> children) {
469          super.listChildren(children);
470          children.add(new Property("quantity", "Quantity", "The amount that is being ordered of the indicated item.", 0, 1, quantity));
471          children.add(new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item));
472        }
473
474        @Override
475        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
476          switch (_hash) {
477          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount that is being ordered of the indicated item.", 0, 1, quantity);
478          case 2116201613: /*item[x]*/  return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item);
479          case 3242771: /*item*/  return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item);
480          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item);
481          case 1376364920: /*itemReference*/  return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item);
482          default: return super.getNamedProperty(_hash, _name, _checkValid);
483          }
484
485        }
486
487      @Override
488      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
489        switch (hash) {
490        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
491        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type
492        default: return super.getProperty(hash, name, checkValid);
493        }
494
495      }
496
497      @Override
498      public Base setProperty(int hash, String name, Base value) throws FHIRException {
499        switch (hash) {
500        case -1285004149: // quantity
501          this.quantity = castToQuantity(value); // Quantity
502          return value;
503        case 3242771: // item
504          this.item = castToType(value); // Type
505          return value;
506        default: return super.setProperty(hash, name, value);
507        }
508
509      }
510
511      @Override
512      public Base setProperty(String name, Base value) throws FHIRException {
513        if (name.equals("quantity")) {
514          this.quantity = castToQuantity(value); // Quantity
515        } else if (name.equals("item[x]")) {
516          this.item = castToType(value); // Type
517        } else
518          return super.setProperty(name, value);
519        return value;
520      }
521
522      @Override
523      public Base makeProperty(int hash, String name) throws FHIRException {
524        switch (hash) {
525        case -1285004149:  return getQuantity(); 
526        case 2116201613:  return getItem(); 
527        case 3242771:  return getItem(); 
528        default: return super.makeProperty(hash, name);
529        }
530
531      }
532
533      @Override
534      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
535        switch (hash) {
536        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
537        case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"};
538        default: return super.getTypesForProperty(hash, name);
539        }
540
541      }
542
543      @Override
544      public Base addChild(String name) throws FHIRException {
545        if (name.equals("quantity")) {
546          this.quantity = new Quantity();
547          return this.quantity;
548        }
549        else if (name.equals("itemCodeableConcept")) {
550          this.item = new CodeableConcept();
551          return this.item;
552        }
553        else if (name.equals("itemReference")) {
554          this.item = new Reference();
555          return this.item;
556        }
557        else
558          return super.addChild(name);
559      }
560
561      public SupplyRequestOrderedItemComponent copy() {
562        SupplyRequestOrderedItemComponent dst = new SupplyRequestOrderedItemComponent();
563        copyValues(dst);
564        dst.quantity = quantity == null ? null : quantity.copy();
565        dst.item = item == null ? null : item.copy();
566        return dst;
567      }
568
569      @Override
570      public boolean equalsDeep(Base other_) {
571        if (!super.equalsDeep(other_))
572          return false;
573        if (!(other_ instanceof SupplyRequestOrderedItemComponent))
574          return false;
575        SupplyRequestOrderedItemComponent o = (SupplyRequestOrderedItemComponent) other_;
576        return compareDeep(quantity, o.quantity, true) && compareDeep(item, o.item, true);
577      }
578
579      @Override
580      public boolean equalsShallow(Base other_) {
581        if (!super.equalsShallow(other_))
582          return false;
583        if (!(other_ instanceof SupplyRequestOrderedItemComponent))
584          return false;
585        SupplyRequestOrderedItemComponent o = (SupplyRequestOrderedItemComponent) other_;
586        return true;
587      }
588
589      public boolean isEmpty() {
590        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, item);
591      }
592
593  public String fhirType() {
594    return "SupplyRequest.orderedItem";
595
596  }
597
598  }
599
600    @Block()
601    public static class SupplyRequestRequesterComponent extends BackboneElement implements IBaseBackboneElement {
602        /**
603         * The device, practitioner, etc. who initiated the request.
604         */
605        @Child(name = "agent", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
606        @Description(shortDefinition="Individual making the request", formalDefinition="The device, practitioner, etc. who initiated the request." )
607        protected Reference agent;
608
609        /**
610         * The actual object that is the target of the reference (The device, practitioner, etc. who initiated the request.)
611         */
612        protected Resource agentTarget;
613
614        /**
615         * The organization the device or practitioner was acting on behalf of.
616         */
617        @Child(name = "onBehalfOf", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
618        @Description(shortDefinition="Organization agent is acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." )
619        protected Reference onBehalfOf;
620
621        /**
622         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.)
623         */
624        protected Organization onBehalfOfTarget;
625
626        private static final long serialVersionUID = -71453027L;
627
628    /**
629     * Constructor
630     */
631      public SupplyRequestRequesterComponent() {
632        super();
633      }
634
635    /**
636     * Constructor
637     */
638      public SupplyRequestRequesterComponent(Reference agent) {
639        super();
640        this.agent = agent;
641      }
642
643        /**
644         * @return {@link #agent} (The device, practitioner, etc. who initiated the request.)
645         */
646        public Reference getAgent() { 
647          if (this.agent == null)
648            if (Configuration.errorOnAutoCreate())
649              throw new Error("Attempt to auto-create SupplyRequestRequesterComponent.agent");
650            else if (Configuration.doAutoCreate())
651              this.agent = new Reference(); // cc
652          return this.agent;
653        }
654
655        public boolean hasAgent() { 
656          return this.agent != null && !this.agent.isEmpty();
657        }
658
659        /**
660         * @param value {@link #agent} (The device, practitioner, etc. who initiated the request.)
661         */
662        public SupplyRequestRequesterComponent setAgent(Reference value)  { 
663          this.agent = value;
664          return this;
665        }
666
667        /**
668         * @return {@link #agent} 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 device, practitioner, etc. who initiated the request.)
669         */
670        public Resource getAgentTarget() { 
671          return this.agentTarget;
672        }
673
674        /**
675         * @param value {@link #agent} 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 device, practitioner, etc. who initiated the request.)
676         */
677        public SupplyRequestRequesterComponent setAgentTarget(Resource value) { 
678          this.agentTarget = value;
679          return this;
680        }
681
682        /**
683         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
684         */
685        public Reference getOnBehalfOf() { 
686          if (this.onBehalfOf == null)
687            if (Configuration.errorOnAutoCreate())
688              throw new Error("Attempt to auto-create SupplyRequestRequesterComponent.onBehalfOf");
689            else if (Configuration.doAutoCreate())
690              this.onBehalfOf = new Reference(); // cc
691          return this.onBehalfOf;
692        }
693
694        public boolean hasOnBehalfOf() { 
695          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
696        }
697
698        /**
699         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
700         */
701        public SupplyRequestRequesterComponent setOnBehalfOf(Reference value)  { 
702          this.onBehalfOf = value;
703          return this;
704        }
705
706        /**
707         * @return {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of.)
708         */
709        public Organization getOnBehalfOfTarget() { 
710          if (this.onBehalfOfTarget == null)
711            if (Configuration.errorOnAutoCreate())
712              throw new Error("Attempt to auto-create SupplyRequestRequesterComponent.onBehalfOf");
713            else if (Configuration.doAutoCreate())
714              this.onBehalfOfTarget = new Organization(); // aa
715          return this.onBehalfOfTarget;
716        }
717
718        /**
719         * @param value {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of.)
720         */
721        public SupplyRequestRequesterComponent setOnBehalfOfTarget(Organization value) { 
722          this.onBehalfOfTarget = value;
723          return this;
724        }
725
726        protected void listChildren(List<Property> children) {
727          super.listChildren(children);
728          children.add(new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The device, practitioner, etc. who initiated the request.", 0, 1, agent));
729          children.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf));
730        }
731
732        @Override
733        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
734          switch (_hash) {
735          case 92750597: /*agent*/  return new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The device, practitioner, etc. who initiated the request.", 0, 1, agent);
736          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf);
737          default: return super.getNamedProperty(_hash, _name, _checkValid);
738          }
739
740        }
741
742      @Override
743      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
744        switch (hash) {
745        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : new Base[] {this.agent}; // Reference
746        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
747        default: return super.getProperty(hash, name, checkValid);
748        }
749
750      }
751
752      @Override
753      public Base setProperty(int hash, String name, Base value) throws FHIRException {
754        switch (hash) {
755        case 92750597: // agent
756          this.agent = castToReference(value); // Reference
757          return value;
758        case -14402964: // onBehalfOf
759          this.onBehalfOf = castToReference(value); // Reference
760          return value;
761        default: return super.setProperty(hash, name, value);
762        }
763
764      }
765
766      @Override
767      public Base setProperty(String name, Base value) throws FHIRException {
768        if (name.equals("agent")) {
769          this.agent = castToReference(value); // Reference
770        } else if (name.equals("onBehalfOf")) {
771          this.onBehalfOf = castToReference(value); // Reference
772        } else
773          return super.setProperty(name, value);
774        return value;
775      }
776
777      @Override
778      public Base makeProperty(int hash, String name) throws FHIRException {
779        switch (hash) {
780        case 92750597:  return getAgent(); 
781        case -14402964:  return getOnBehalfOf(); 
782        default: return super.makeProperty(hash, name);
783        }
784
785      }
786
787      @Override
788      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
789        switch (hash) {
790        case 92750597: /*agent*/ return new String[] {"Reference"};
791        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
792        default: return super.getTypesForProperty(hash, name);
793        }
794
795      }
796
797      @Override
798      public Base addChild(String name) throws FHIRException {
799        if (name.equals("agent")) {
800          this.agent = new Reference();
801          return this.agent;
802        }
803        else if (name.equals("onBehalfOf")) {
804          this.onBehalfOf = new Reference();
805          return this.onBehalfOf;
806        }
807        else
808          return super.addChild(name);
809      }
810
811      public SupplyRequestRequesterComponent copy() {
812        SupplyRequestRequesterComponent dst = new SupplyRequestRequesterComponent();
813        copyValues(dst);
814        dst.agent = agent == null ? null : agent.copy();
815        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
816        return dst;
817      }
818
819      @Override
820      public boolean equalsDeep(Base other_) {
821        if (!super.equalsDeep(other_))
822          return false;
823        if (!(other_ instanceof SupplyRequestRequesterComponent))
824          return false;
825        SupplyRequestRequesterComponent o = (SupplyRequestRequesterComponent) other_;
826        return compareDeep(agent, o.agent, true) && compareDeep(onBehalfOf, o.onBehalfOf, true);
827      }
828
829      @Override
830      public boolean equalsShallow(Base other_) {
831        if (!super.equalsShallow(other_))
832          return false;
833        if (!(other_ instanceof SupplyRequestRequesterComponent))
834          return false;
835        SupplyRequestRequesterComponent o = (SupplyRequestRequesterComponent) other_;
836        return true;
837      }
838
839      public boolean isEmpty() {
840        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(agent, onBehalfOf);
841      }
842
843  public String fhirType() {
844    return "SupplyRequest.requester";
845
846  }
847
848  }
849
850    /**
851     * Unique identifier for this supply request.
852     */
853    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
854    @Description(shortDefinition="Unique identifier", formalDefinition="Unique identifier for this supply request." )
855    protected Identifier identifier;
856
857    /**
858     * Status of the supply request.
859     */
860    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
861    @Description(shortDefinition="draft | active | suspended +", formalDefinition="Status of the supply request." )
862    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplyrequest-status")
863    protected Enumeration<SupplyRequestStatus> status;
864
865    /**
866     * Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.
867     */
868    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
869    @Description(shortDefinition="The kind of supply (central, non-stock, etc.)", formalDefinition="Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process." )
870    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplyrequest-kind")
871    protected CodeableConcept category;
872
873    /**
874     * Indicates how quickly this SupplyRequest should be addressed with respect to other requests.
875     */
876    @Child(name = "priority", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
877    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly this SupplyRequest should be addressed with respect to other requests." )
878    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
879    protected Enumeration<RequestPriority> priority;
880
881    /**
882     * The item being requested.
883     */
884    @Child(name = "orderedItem", type = {}, order=4, min=0, max=1, modifier=false, summary=true)
885    @Description(shortDefinition="The item being requested", formalDefinition="The item being requested." )
886    protected SupplyRequestOrderedItemComponent orderedItem;
887
888    /**
889     * When the request should be fulfilled.
890     */
891    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=5, min=0, max=1, modifier=false, summary=true)
892    @Description(shortDefinition="When the request should be fulfilled", formalDefinition="When the request should be fulfilled." )
893    protected Type occurrence;
894
895    /**
896     * When the request was made.
897     */
898    @Child(name = "authoredOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
899    @Description(shortDefinition="When the request was made", formalDefinition="When the request was made." )
900    protected DateTimeType authoredOn;
901
902    /**
903     * The individual who initiated the request and has responsibility for its activation.
904     */
905    @Child(name = "requester", type = {}, order=7, min=0, max=1, modifier=false, summary=true)
906    @Description(shortDefinition="Who/what is requesting service", formalDefinition="The individual who initiated the request and has responsibility for its activation." )
907    protected SupplyRequestRequesterComponent requester;
908
909    /**
910     * Who is intended to fulfill the request.
911     */
912    @Child(name = "supplier", type = {Organization.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
913    @Description(shortDefinition="Who is intended to fulfill the request", formalDefinition="Who is intended to fulfill the request." )
914    protected List<Reference> supplier;
915    /**
916     * The actual objects that are the target of the reference (Who is intended to fulfill the request.)
917     */
918    protected List<Organization> supplierTarget;
919
920
921    /**
922     * Why the supply item was requested.
923     */
924    @Child(name = "reason", type = {CodeableConcept.class, Reference.class}, order=9, min=0, max=1, modifier=false, summary=false)
925    @Description(shortDefinition="Why the supply item was requested", formalDefinition="Why the supply item was requested." )
926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplyrequest-reason")
927    protected Type reason;
928
929    /**
930     * Where the supply is expected to come from.
931     */
932    @Child(name = "deliverFrom", type = {Organization.class, Location.class}, order=10, min=0, max=1, modifier=false, summary=false)
933    @Description(shortDefinition="The origin of the supply", formalDefinition="Where the supply is expected to come from." )
934    protected Reference deliverFrom;
935
936    /**
937     * The actual object that is the target of the reference (Where the supply is expected to come from.)
938     */
939    protected Resource deliverFromTarget;
940
941    /**
942     * Where the supply is destined to go.
943     */
944    @Child(name = "deliverTo", type = {Organization.class, Location.class, Patient.class}, order=11, min=0, max=1, modifier=false, summary=false)
945    @Description(shortDefinition="The destination of the supply", formalDefinition="Where the supply is destined to go." )
946    protected Reference deliverTo;
947
948    /**
949     * The actual object that is the target of the reference (Where the supply is destined to go.)
950     */
951    protected Resource deliverToTarget;
952
953    private static final long serialVersionUID = 43957782L;
954
955  /**
956   * Constructor
957   */
958    public SupplyRequest() {
959      super();
960    }
961
962    /**
963     * @return {@link #identifier} (Unique identifier for this supply request.)
964     */
965    public Identifier getIdentifier() { 
966      if (this.identifier == null)
967        if (Configuration.errorOnAutoCreate())
968          throw new Error("Attempt to auto-create SupplyRequest.identifier");
969        else if (Configuration.doAutoCreate())
970          this.identifier = new Identifier(); // cc
971      return this.identifier;
972    }
973
974    public boolean hasIdentifier() { 
975      return this.identifier != null && !this.identifier.isEmpty();
976    }
977
978    /**
979     * @param value {@link #identifier} (Unique identifier for this supply request.)
980     */
981    public SupplyRequest setIdentifier(Identifier value)  { 
982      this.identifier = value;
983      return this;
984    }
985
986    /**
987     * @return {@link #status} (Status of the supply request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
988     */
989    public Enumeration<SupplyRequestStatus> getStatusElement() { 
990      if (this.status == null)
991        if (Configuration.errorOnAutoCreate())
992          throw new Error("Attempt to auto-create SupplyRequest.status");
993        else if (Configuration.doAutoCreate())
994          this.status = new Enumeration<SupplyRequestStatus>(new SupplyRequestStatusEnumFactory()); // bb
995      return this.status;
996    }
997
998    public boolean hasStatusElement() { 
999      return this.status != null && !this.status.isEmpty();
1000    }
1001
1002    public boolean hasStatus() { 
1003      return this.status != null && !this.status.isEmpty();
1004    }
1005
1006    /**
1007     * @param value {@link #status} (Status of the supply request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1008     */
1009    public SupplyRequest setStatusElement(Enumeration<SupplyRequestStatus> value) { 
1010      this.status = value;
1011      return this;
1012    }
1013
1014    /**
1015     * @return Status of the supply request.
1016     */
1017    public SupplyRequestStatus getStatus() { 
1018      return this.status == null ? null : this.status.getValue();
1019    }
1020
1021    /**
1022     * @param value Status of the supply request.
1023     */
1024    public SupplyRequest setStatus(SupplyRequestStatus value) { 
1025      if (value == null)
1026        this.status = null;
1027      else {
1028        if (this.status == null)
1029          this.status = new Enumeration<SupplyRequestStatus>(new SupplyRequestStatusEnumFactory());
1030        this.status.setValue(value);
1031      }
1032      return this;
1033    }
1034
1035    /**
1036     * @return {@link #category} (Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.)
1037     */
1038    public CodeableConcept getCategory() { 
1039      if (this.category == null)
1040        if (Configuration.errorOnAutoCreate())
1041          throw new Error("Attempt to auto-create SupplyRequest.category");
1042        else if (Configuration.doAutoCreate())
1043          this.category = new CodeableConcept(); // cc
1044      return this.category;
1045    }
1046
1047    public boolean hasCategory() { 
1048      return this.category != null && !this.category.isEmpty();
1049    }
1050
1051    /**
1052     * @param value {@link #category} (Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.)
1053     */
1054    public SupplyRequest setCategory(CodeableConcept value)  { 
1055      this.category = value;
1056      return this;
1057    }
1058
1059    /**
1060     * @return {@link #priority} (Indicates how quickly this SupplyRequest should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1061     */
1062    public Enumeration<RequestPriority> getPriorityElement() { 
1063      if (this.priority == null)
1064        if (Configuration.errorOnAutoCreate())
1065          throw new Error("Attempt to auto-create SupplyRequest.priority");
1066        else if (Configuration.doAutoCreate())
1067          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
1068      return this.priority;
1069    }
1070
1071    public boolean hasPriorityElement() { 
1072      return this.priority != null && !this.priority.isEmpty();
1073    }
1074
1075    public boolean hasPriority() { 
1076      return this.priority != null && !this.priority.isEmpty();
1077    }
1078
1079    /**
1080     * @param value {@link #priority} (Indicates how quickly this SupplyRequest should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1081     */
1082    public SupplyRequest setPriorityElement(Enumeration<RequestPriority> value) { 
1083      this.priority = value;
1084      return this;
1085    }
1086
1087    /**
1088     * @return Indicates how quickly this SupplyRequest should be addressed with respect to other requests.
1089     */
1090    public RequestPriority getPriority() { 
1091      return this.priority == null ? null : this.priority.getValue();
1092    }
1093
1094    /**
1095     * @param value Indicates how quickly this SupplyRequest should be addressed with respect to other requests.
1096     */
1097    public SupplyRequest setPriority(RequestPriority value) { 
1098      if (value == null)
1099        this.priority = null;
1100      else {
1101        if (this.priority == null)
1102          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
1103        this.priority.setValue(value);
1104      }
1105      return this;
1106    }
1107
1108    /**
1109     * @return {@link #orderedItem} (The item being requested.)
1110     */
1111    public SupplyRequestOrderedItemComponent getOrderedItem() { 
1112      if (this.orderedItem == null)
1113        if (Configuration.errorOnAutoCreate())
1114          throw new Error("Attempt to auto-create SupplyRequest.orderedItem");
1115        else if (Configuration.doAutoCreate())
1116          this.orderedItem = new SupplyRequestOrderedItemComponent(); // cc
1117      return this.orderedItem;
1118    }
1119
1120    public boolean hasOrderedItem() { 
1121      return this.orderedItem != null && !this.orderedItem.isEmpty();
1122    }
1123
1124    /**
1125     * @param value {@link #orderedItem} (The item being requested.)
1126     */
1127    public SupplyRequest setOrderedItem(SupplyRequestOrderedItemComponent value)  { 
1128      this.orderedItem = value;
1129      return this;
1130    }
1131
1132    /**
1133     * @return {@link #occurrence} (When the request should be fulfilled.)
1134     */
1135    public Type getOccurrence() { 
1136      return this.occurrence;
1137    }
1138
1139    /**
1140     * @return {@link #occurrence} (When the request should be fulfilled.)
1141     */
1142    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1143      if (this.occurrence == null)
1144        return null;
1145      if (!(this.occurrence instanceof DateTimeType))
1146        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1147      return (DateTimeType) this.occurrence;
1148    }
1149
1150    public boolean hasOccurrenceDateTimeType() { 
1151      return this != null && this.occurrence instanceof DateTimeType;
1152    }
1153
1154    /**
1155     * @return {@link #occurrence} (When the request should be fulfilled.)
1156     */
1157    public Period getOccurrencePeriod() throws FHIRException { 
1158      if (this.occurrence == null)
1159        return null;
1160      if (!(this.occurrence instanceof Period))
1161        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1162      return (Period) this.occurrence;
1163    }
1164
1165    public boolean hasOccurrencePeriod() { 
1166      return this != null && this.occurrence instanceof Period;
1167    }
1168
1169    /**
1170     * @return {@link #occurrence} (When the request should be fulfilled.)
1171     */
1172    public Timing getOccurrenceTiming() throws FHIRException { 
1173      if (this.occurrence == null)
1174        return null;
1175      if (!(this.occurrence instanceof Timing))
1176        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1177      return (Timing) this.occurrence;
1178    }
1179
1180    public boolean hasOccurrenceTiming() { 
1181      return this != null && this.occurrence instanceof Timing;
1182    }
1183
1184    public boolean hasOccurrence() { 
1185      return this.occurrence != null && !this.occurrence.isEmpty();
1186    }
1187
1188    /**
1189     * @param value {@link #occurrence} (When the request should be fulfilled.)
1190     */
1191    public SupplyRequest setOccurrence(Type value) throws FHIRFormatError { 
1192      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
1193        throw new FHIRFormatError("Not the right type for SupplyRequest.occurrence[x]: "+value.fhirType());
1194      this.occurrence = value;
1195      return this;
1196    }
1197
1198    /**
1199     * @return {@link #authoredOn} (When the request was made.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1200     */
1201    public DateTimeType getAuthoredOnElement() { 
1202      if (this.authoredOn == null)
1203        if (Configuration.errorOnAutoCreate())
1204          throw new Error("Attempt to auto-create SupplyRequest.authoredOn");
1205        else if (Configuration.doAutoCreate())
1206          this.authoredOn = new DateTimeType(); // bb
1207      return this.authoredOn;
1208    }
1209
1210    public boolean hasAuthoredOnElement() { 
1211      return this.authoredOn != null && !this.authoredOn.isEmpty();
1212    }
1213
1214    public boolean hasAuthoredOn() { 
1215      return this.authoredOn != null && !this.authoredOn.isEmpty();
1216    }
1217
1218    /**
1219     * @param value {@link #authoredOn} (When the request was made.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1220     */
1221    public SupplyRequest setAuthoredOnElement(DateTimeType value) { 
1222      this.authoredOn = value;
1223      return this;
1224    }
1225
1226    /**
1227     * @return When the request was made.
1228     */
1229    public Date getAuthoredOn() { 
1230      return this.authoredOn == null ? null : this.authoredOn.getValue();
1231    }
1232
1233    /**
1234     * @param value When the request was made.
1235     */
1236    public SupplyRequest setAuthoredOn(Date value) { 
1237      if (value == null)
1238        this.authoredOn = null;
1239      else {
1240        if (this.authoredOn == null)
1241          this.authoredOn = new DateTimeType();
1242        this.authoredOn.setValue(value);
1243      }
1244      return this;
1245    }
1246
1247    /**
1248     * @return {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1249     */
1250    public SupplyRequestRequesterComponent getRequester() { 
1251      if (this.requester == null)
1252        if (Configuration.errorOnAutoCreate())
1253          throw new Error("Attempt to auto-create SupplyRequest.requester");
1254        else if (Configuration.doAutoCreate())
1255          this.requester = new SupplyRequestRequesterComponent(); // cc
1256      return this.requester;
1257    }
1258
1259    public boolean hasRequester() { 
1260      return this.requester != null && !this.requester.isEmpty();
1261    }
1262
1263    /**
1264     * @param value {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1265     */
1266    public SupplyRequest setRequester(SupplyRequestRequesterComponent value)  { 
1267      this.requester = value;
1268      return this;
1269    }
1270
1271    /**
1272     * @return {@link #supplier} (Who is intended to fulfill the request.)
1273     */
1274    public List<Reference> getSupplier() { 
1275      if (this.supplier == null)
1276        this.supplier = new ArrayList<Reference>();
1277      return this.supplier;
1278    }
1279
1280    /**
1281     * @return Returns a reference to <code>this</code> for easy method chaining
1282     */
1283    public SupplyRequest setSupplier(List<Reference> theSupplier) { 
1284      this.supplier = theSupplier;
1285      return this;
1286    }
1287
1288    public boolean hasSupplier() { 
1289      if (this.supplier == null)
1290        return false;
1291      for (Reference item : this.supplier)
1292        if (!item.isEmpty())
1293          return true;
1294      return false;
1295    }
1296
1297    public Reference addSupplier() { //3
1298      Reference t = new Reference();
1299      if (this.supplier == null)
1300        this.supplier = new ArrayList<Reference>();
1301      this.supplier.add(t);
1302      return t;
1303    }
1304
1305    public SupplyRequest addSupplier(Reference t) { //3
1306      if (t == null)
1307        return this;
1308      if (this.supplier == null)
1309        this.supplier = new ArrayList<Reference>();
1310      this.supplier.add(t);
1311      return this;
1312    }
1313
1314    /**
1315     * @return The first repetition of repeating field {@link #supplier}, creating it if it does not already exist
1316     */
1317    public Reference getSupplierFirstRep() { 
1318      if (getSupplier().isEmpty()) {
1319        addSupplier();
1320      }
1321      return getSupplier().get(0);
1322    }
1323
1324    /**
1325     * @deprecated Use Reference#setResource(IBaseResource) instead
1326     */
1327    @Deprecated
1328    public List<Organization> getSupplierTarget() { 
1329      if (this.supplierTarget == null)
1330        this.supplierTarget = new ArrayList<Organization>();
1331      return this.supplierTarget;
1332    }
1333
1334    /**
1335     * @deprecated Use Reference#setResource(IBaseResource) instead
1336     */
1337    @Deprecated
1338    public Organization addSupplierTarget() { 
1339      Organization r = new Organization();
1340      if (this.supplierTarget == null)
1341        this.supplierTarget = new ArrayList<Organization>();
1342      this.supplierTarget.add(r);
1343      return r;
1344    }
1345
1346    /**
1347     * @return {@link #reason} (Why the supply item was requested.)
1348     */
1349    public Type getReason() { 
1350      return this.reason;
1351    }
1352
1353    /**
1354     * @return {@link #reason} (Why the supply item was requested.)
1355     */
1356    public CodeableConcept getReasonCodeableConcept() throws FHIRException { 
1357      if (this.reason == null)
1358        return null;
1359      if (!(this.reason instanceof CodeableConcept))
1360        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered");
1361      return (CodeableConcept) this.reason;
1362    }
1363
1364    public boolean hasReasonCodeableConcept() { 
1365      return this != null && this.reason instanceof CodeableConcept;
1366    }
1367
1368    /**
1369     * @return {@link #reason} (Why the supply item was requested.)
1370     */
1371    public Reference getReasonReference() throws FHIRException { 
1372      if (this.reason == null)
1373        return null;
1374      if (!(this.reason instanceof Reference))
1375        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered");
1376      return (Reference) this.reason;
1377    }
1378
1379    public boolean hasReasonReference() { 
1380      return this != null && this.reason instanceof Reference;
1381    }
1382
1383    public boolean hasReason() { 
1384      return this.reason != null && !this.reason.isEmpty();
1385    }
1386
1387    /**
1388     * @param value {@link #reason} (Why the supply item was requested.)
1389     */
1390    public SupplyRequest setReason(Type value) throws FHIRFormatError { 
1391      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1392        throw new FHIRFormatError("Not the right type for SupplyRequest.reason[x]: "+value.fhirType());
1393      this.reason = value;
1394      return this;
1395    }
1396
1397    /**
1398     * @return {@link #deliverFrom} (Where the supply is expected to come from.)
1399     */
1400    public Reference getDeliverFrom() { 
1401      if (this.deliverFrom == null)
1402        if (Configuration.errorOnAutoCreate())
1403          throw new Error("Attempt to auto-create SupplyRequest.deliverFrom");
1404        else if (Configuration.doAutoCreate())
1405          this.deliverFrom = new Reference(); // cc
1406      return this.deliverFrom;
1407    }
1408
1409    public boolean hasDeliverFrom() { 
1410      return this.deliverFrom != null && !this.deliverFrom.isEmpty();
1411    }
1412
1413    /**
1414     * @param value {@link #deliverFrom} (Where the supply is expected to come from.)
1415     */
1416    public SupplyRequest setDeliverFrom(Reference value)  { 
1417      this.deliverFrom = value;
1418      return this;
1419    }
1420
1421    /**
1422     * @return {@link #deliverFrom} 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. (Where the supply is expected to come from.)
1423     */
1424    public Resource getDeliverFromTarget() { 
1425      return this.deliverFromTarget;
1426    }
1427
1428    /**
1429     * @param value {@link #deliverFrom} 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. (Where the supply is expected to come from.)
1430     */
1431    public SupplyRequest setDeliverFromTarget(Resource value) { 
1432      this.deliverFromTarget = value;
1433      return this;
1434    }
1435
1436    /**
1437     * @return {@link #deliverTo} (Where the supply is destined to go.)
1438     */
1439    public Reference getDeliverTo() { 
1440      if (this.deliverTo == null)
1441        if (Configuration.errorOnAutoCreate())
1442          throw new Error("Attempt to auto-create SupplyRequest.deliverTo");
1443        else if (Configuration.doAutoCreate())
1444          this.deliverTo = new Reference(); // cc
1445      return this.deliverTo;
1446    }
1447
1448    public boolean hasDeliverTo() { 
1449      return this.deliverTo != null && !this.deliverTo.isEmpty();
1450    }
1451
1452    /**
1453     * @param value {@link #deliverTo} (Where the supply is destined to go.)
1454     */
1455    public SupplyRequest setDeliverTo(Reference value)  { 
1456      this.deliverTo = value;
1457      return this;
1458    }
1459
1460    /**
1461     * @return {@link #deliverTo} 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. (Where the supply is destined to go.)
1462     */
1463    public Resource getDeliverToTarget() { 
1464      return this.deliverToTarget;
1465    }
1466
1467    /**
1468     * @param value {@link #deliverTo} 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. (Where the supply is destined to go.)
1469     */
1470    public SupplyRequest setDeliverToTarget(Resource value) { 
1471      this.deliverToTarget = value;
1472      return this;
1473    }
1474
1475      protected void listChildren(List<Property> children) {
1476        super.listChildren(children);
1477        children.add(new Property("identifier", "Identifier", "Unique identifier for this supply request.", 0, 1, identifier));
1478        children.add(new Property("status", "code", "Status of the supply request.", 0, 1, status));
1479        children.add(new Property("category", "CodeableConcept", "Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.", 0, 1, category));
1480        children.add(new Property("priority", "code", "Indicates how quickly this SupplyRequest should be addressed with respect to other requests.", 0, 1, priority));
1481        children.add(new Property("orderedItem", "", "The item being requested.", 0, 1, orderedItem));
1482        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence));
1483        children.add(new Property("authoredOn", "dateTime", "When the request was made.", 0, 1, authoredOn));
1484        children.add(new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester));
1485        children.add(new Property("supplier", "Reference(Organization)", "Who is intended to fulfill the request.", 0, java.lang.Integer.MAX_VALUE, supplier));
1486        children.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "Why the supply item was requested.", 0, 1, reason));
1487        children.add(new Property("deliverFrom", "Reference(Organization|Location)", "Where the supply is expected to come from.", 0, 1, deliverFrom));
1488        children.add(new Property("deliverTo", "Reference(Organization|Location|Patient)", "Where the supply is destined to go.", 0, 1, deliverTo));
1489      }
1490
1491      @Override
1492      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1493        switch (_hash) {
1494        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this supply request.", 0, 1, identifier);
1495        case -892481550: /*status*/  return new Property("status", "code", "Status of the supply request.", 0, 1, status);
1496        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.", 0, 1, category);
1497        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly this SupplyRequest should be addressed with respect to other requests.", 0, 1, priority);
1498        case 2129914144: /*orderedItem*/  return new Property("orderedItem", "", "The item being requested.", 0, 1, orderedItem);
1499        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence);
1500        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence);
1501        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence);
1502        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence);
1503        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When the request should be fulfilled.", 0, 1, occurrence);
1504        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "When the request was made.", 0, 1, authoredOn);
1505        case 693933948: /*requester*/  return new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
1506        case -1663305268: /*supplier*/  return new Property("supplier", "Reference(Organization)", "Who is intended to fulfill the request.", 0, java.lang.Integer.MAX_VALUE, supplier);
1507        case -669418564: /*reason[x]*/  return new Property("reason[x]", "CodeableConcept|Reference(Any)", "Why the supply item was requested.", 0, 1, reason);
1508        case -934964668: /*reason*/  return new Property("reason[x]", "CodeableConcept|Reference(Any)", "Why the supply item was requested.", 0, 1, reason);
1509        case -610155331: /*reasonCodeableConcept*/  return new Property("reason[x]", "CodeableConcept|Reference(Any)", "Why the supply item was requested.", 0, 1, reason);
1510        case -1146218137: /*reasonReference*/  return new Property("reason[x]", "CodeableConcept|Reference(Any)", "Why the supply item was requested.", 0, 1, reason);
1511        case -949323153: /*deliverFrom*/  return new Property("deliverFrom", "Reference(Organization|Location)", "Where the supply is expected to come from.", 0, 1, deliverFrom);
1512        case -242327936: /*deliverTo*/  return new Property("deliverTo", "Reference(Organization|Location|Patient)", "Where the supply is destined to go.", 0, 1, deliverTo);
1513        default: return super.getNamedProperty(_hash, _name, _checkValid);
1514        }
1515
1516      }
1517
1518      @Override
1519      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1520        switch (hash) {
1521        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1522        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SupplyRequestStatus>
1523        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1524        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
1525        case 2129914144: /*orderedItem*/ return this.orderedItem == null ? new Base[0] : new Base[] {this.orderedItem}; // SupplyRequestOrderedItemComponent
1526        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
1527        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
1528        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // SupplyRequestRequesterComponent
1529        case -1663305268: /*supplier*/ return this.supplier == null ? new Base[0] : this.supplier.toArray(new Base[this.supplier.size()]); // Reference
1530        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Type
1531        case -949323153: /*deliverFrom*/ return this.deliverFrom == null ? new Base[0] : new Base[] {this.deliverFrom}; // Reference
1532        case -242327936: /*deliverTo*/ return this.deliverTo == null ? new Base[0] : new Base[] {this.deliverTo}; // Reference
1533        default: return super.getProperty(hash, name, checkValid);
1534        }
1535
1536      }
1537
1538      @Override
1539      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1540        switch (hash) {
1541        case -1618432855: // identifier
1542          this.identifier = castToIdentifier(value); // Identifier
1543          return value;
1544        case -892481550: // status
1545          value = new SupplyRequestStatusEnumFactory().fromType(castToCode(value));
1546          this.status = (Enumeration) value; // Enumeration<SupplyRequestStatus>
1547          return value;
1548        case 50511102: // category
1549          this.category = castToCodeableConcept(value); // CodeableConcept
1550          return value;
1551        case -1165461084: // priority
1552          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
1553          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
1554          return value;
1555        case 2129914144: // orderedItem
1556          this.orderedItem = (SupplyRequestOrderedItemComponent) value; // SupplyRequestOrderedItemComponent
1557          return value;
1558        case 1687874001: // occurrence
1559          this.occurrence = castToType(value); // Type
1560          return value;
1561        case -1500852503: // authoredOn
1562          this.authoredOn = castToDateTime(value); // DateTimeType
1563          return value;
1564        case 693933948: // requester
1565          this.requester = (SupplyRequestRequesterComponent) value; // SupplyRequestRequesterComponent
1566          return value;
1567        case -1663305268: // supplier
1568          this.getSupplier().add(castToReference(value)); // Reference
1569          return value;
1570        case -934964668: // reason
1571          this.reason = castToType(value); // Type
1572          return value;
1573        case -949323153: // deliverFrom
1574          this.deliverFrom = castToReference(value); // Reference
1575          return value;
1576        case -242327936: // deliverTo
1577          this.deliverTo = castToReference(value); // Reference
1578          return value;
1579        default: return super.setProperty(hash, name, value);
1580        }
1581
1582      }
1583
1584      @Override
1585      public Base setProperty(String name, Base value) throws FHIRException {
1586        if (name.equals("identifier")) {
1587          this.identifier = castToIdentifier(value); // Identifier
1588        } else if (name.equals("status")) {
1589          value = new SupplyRequestStatusEnumFactory().fromType(castToCode(value));
1590          this.status = (Enumeration) value; // Enumeration<SupplyRequestStatus>
1591        } else if (name.equals("category")) {
1592          this.category = castToCodeableConcept(value); // CodeableConcept
1593        } else if (name.equals("priority")) {
1594          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
1595          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
1596        } else if (name.equals("orderedItem")) {
1597          this.orderedItem = (SupplyRequestOrderedItemComponent) value; // SupplyRequestOrderedItemComponent
1598        } else if (name.equals("occurrence[x]")) {
1599          this.occurrence = castToType(value); // Type
1600        } else if (name.equals("authoredOn")) {
1601          this.authoredOn = castToDateTime(value); // DateTimeType
1602        } else if (name.equals("requester")) {
1603          this.requester = (SupplyRequestRequesterComponent) value; // SupplyRequestRequesterComponent
1604        } else if (name.equals("supplier")) {
1605          this.getSupplier().add(castToReference(value));
1606        } else if (name.equals("reason[x]")) {
1607          this.reason = castToType(value); // Type
1608        } else if (name.equals("deliverFrom")) {
1609          this.deliverFrom = castToReference(value); // Reference
1610        } else if (name.equals("deliverTo")) {
1611          this.deliverTo = castToReference(value); // Reference
1612        } else
1613          return super.setProperty(name, value);
1614        return value;
1615      }
1616
1617      @Override
1618      public Base makeProperty(int hash, String name) throws FHIRException {
1619        switch (hash) {
1620        case -1618432855:  return getIdentifier(); 
1621        case -892481550:  return getStatusElement();
1622        case 50511102:  return getCategory(); 
1623        case -1165461084:  return getPriorityElement();
1624        case 2129914144:  return getOrderedItem(); 
1625        case -2022646513:  return getOccurrence(); 
1626        case 1687874001:  return getOccurrence(); 
1627        case -1500852503:  return getAuthoredOnElement();
1628        case 693933948:  return getRequester(); 
1629        case -1663305268:  return addSupplier(); 
1630        case -669418564:  return getReason(); 
1631        case -934964668:  return getReason(); 
1632        case -949323153:  return getDeliverFrom(); 
1633        case -242327936:  return getDeliverTo(); 
1634        default: return super.makeProperty(hash, name);
1635        }
1636
1637      }
1638
1639      @Override
1640      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1641        switch (hash) {
1642        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1643        case -892481550: /*status*/ return new String[] {"code"};
1644        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1645        case -1165461084: /*priority*/ return new String[] {"code"};
1646        case 2129914144: /*orderedItem*/ return new String[] {};
1647        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
1648        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
1649        case 693933948: /*requester*/ return new String[] {};
1650        case -1663305268: /*supplier*/ return new String[] {"Reference"};
1651        case -934964668: /*reason*/ return new String[] {"CodeableConcept", "Reference"};
1652        case -949323153: /*deliverFrom*/ return new String[] {"Reference"};
1653        case -242327936: /*deliverTo*/ return new String[] {"Reference"};
1654        default: return super.getTypesForProperty(hash, name);
1655        }
1656
1657      }
1658
1659      @Override
1660      public Base addChild(String name) throws FHIRException {
1661        if (name.equals("identifier")) {
1662          this.identifier = new Identifier();
1663          return this.identifier;
1664        }
1665        else if (name.equals("status")) {
1666          throw new FHIRException("Cannot call addChild on a singleton property SupplyRequest.status");
1667        }
1668        else if (name.equals("category")) {
1669          this.category = new CodeableConcept();
1670          return this.category;
1671        }
1672        else if (name.equals("priority")) {
1673          throw new FHIRException("Cannot call addChild on a singleton property SupplyRequest.priority");
1674        }
1675        else if (name.equals("orderedItem")) {
1676          this.orderedItem = new SupplyRequestOrderedItemComponent();
1677          return this.orderedItem;
1678        }
1679        else if (name.equals("occurrenceDateTime")) {
1680          this.occurrence = new DateTimeType();
1681          return this.occurrence;
1682        }
1683        else if (name.equals("occurrencePeriod")) {
1684          this.occurrence = new Period();
1685          return this.occurrence;
1686        }
1687        else if (name.equals("occurrenceTiming")) {
1688          this.occurrence = new Timing();
1689          return this.occurrence;
1690        }
1691        else if (name.equals("authoredOn")) {
1692          throw new FHIRException("Cannot call addChild on a singleton property SupplyRequest.authoredOn");
1693        }
1694        else if (name.equals("requester")) {
1695          this.requester = new SupplyRequestRequesterComponent();
1696          return this.requester;
1697        }
1698        else if (name.equals("supplier")) {
1699          return addSupplier();
1700        }
1701        else if (name.equals("reasonCodeableConcept")) {
1702          this.reason = new CodeableConcept();
1703          return this.reason;
1704        }
1705        else if (name.equals("reasonReference")) {
1706          this.reason = new Reference();
1707          return this.reason;
1708        }
1709        else if (name.equals("deliverFrom")) {
1710          this.deliverFrom = new Reference();
1711          return this.deliverFrom;
1712        }
1713        else if (name.equals("deliverTo")) {
1714          this.deliverTo = new Reference();
1715          return this.deliverTo;
1716        }
1717        else
1718          return super.addChild(name);
1719      }
1720
1721  public String fhirType() {
1722    return "SupplyRequest";
1723
1724  }
1725
1726      public SupplyRequest copy() {
1727        SupplyRequest dst = new SupplyRequest();
1728        copyValues(dst);
1729        dst.identifier = identifier == null ? null : identifier.copy();
1730        dst.status = status == null ? null : status.copy();
1731        dst.category = category == null ? null : category.copy();
1732        dst.priority = priority == null ? null : priority.copy();
1733        dst.orderedItem = orderedItem == null ? null : orderedItem.copy();
1734        dst.occurrence = occurrence == null ? null : occurrence.copy();
1735        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
1736        dst.requester = requester == null ? null : requester.copy();
1737        if (supplier != null) {
1738          dst.supplier = new ArrayList<Reference>();
1739          for (Reference i : supplier)
1740            dst.supplier.add(i.copy());
1741        };
1742        dst.reason = reason == null ? null : reason.copy();
1743        dst.deliverFrom = deliverFrom == null ? null : deliverFrom.copy();
1744        dst.deliverTo = deliverTo == null ? null : deliverTo.copy();
1745        return dst;
1746      }
1747
1748      protected SupplyRequest typedCopy() {
1749        return copy();
1750      }
1751
1752      @Override
1753      public boolean equalsDeep(Base other_) {
1754        if (!super.equalsDeep(other_))
1755          return false;
1756        if (!(other_ instanceof SupplyRequest))
1757          return false;
1758        SupplyRequest o = (SupplyRequest) other_;
1759        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1760           && compareDeep(priority, o.priority, true) && compareDeep(orderedItem, o.orderedItem, true) && compareDeep(occurrence, o.occurrence, true)
1761           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true) && compareDeep(supplier, o.supplier, true)
1762           && compareDeep(reason, o.reason, true) && compareDeep(deliverFrom, o.deliverFrom, true) && compareDeep(deliverTo, o.deliverTo, true)
1763          ;
1764      }
1765
1766      @Override
1767      public boolean equalsShallow(Base other_) {
1768        if (!super.equalsShallow(other_))
1769          return false;
1770        if (!(other_ instanceof SupplyRequest))
1771          return false;
1772        SupplyRequest o = (SupplyRequest) other_;
1773        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(authoredOn, o.authoredOn, true)
1774          ;
1775      }
1776
1777      public boolean isEmpty() {
1778        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
1779          , priority, orderedItem, occurrence, authoredOn, requester, supplier, reason, deliverFrom
1780          , deliverTo);
1781      }
1782
1783  @Override
1784  public ResourceType getResourceType() {
1785    return ResourceType.SupplyRequest;
1786   }
1787
1788 /**
1789   * Search parameter: <b>requester</b>
1790   * <p>
1791   * Description: <b>Individual making the request</b><br>
1792   * Type: <b>reference</b><br>
1793   * Path: <b>SupplyRequest.requester.agent</b><br>
1794   * </p>
1795   */
1796  @SearchParamDefinition(name="requester", path="SupplyRequest.requester.agent", description="Individual making the request", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
1797  public static final String SP_REQUESTER = "requester";
1798 /**
1799   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
1800   * <p>
1801   * Description: <b>Individual making the request</b><br>
1802   * Type: <b>reference</b><br>
1803   * Path: <b>SupplyRequest.requester.agent</b><br>
1804   * </p>
1805   */
1806  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
1807
1808/**
1809   * Constant for fluent queries to be used to add include statements. Specifies
1810   * the path value of "<b>SupplyRequest:requester</b>".
1811   */
1812  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("SupplyRequest:requester").toLocked();
1813
1814 /**
1815   * Search parameter: <b>date</b>
1816   * <p>
1817   * Description: <b>When the request was made</b><br>
1818   * Type: <b>date</b><br>
1819   * Path: <b>SupplyRequest.authoredOn</b><br>
1820   * </p>
1821   */
1822  @SearchParamDefinition(name="date", path="SupplyRequest.authoredOn", description="When the request was made", type="date" )
1823  public static final String SP_DATE = "date";
1824 /**
1825   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1826   * <p>
1827   * Description: <b>When the request was made</b><br>
1828   * Type: <b>date</b><br>
1829   * Path: <b>SupplyRequest.authoredOn</b><br>
1830   * </p>
1831   */
1832  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1833
1834 /**
1835   * Search parameter: <b>identifier</b>
1836   * <p>
1837   * Description: <b>Unique identifier</b><br>
1838   * Type: <b>token</b><br>
1839   * Path: <b>SupplyRequest.identifier</b><br>
1840   * </p>
1841   */
1842  @SearchParamDefinition(name="identifier", path="SupplyRequest.identifier", description="Unique identifier", type="token" )
1843  public static final String SP_IDENTIFIER = "identifier";
1844 /**
1845   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1846   * <p>
1847   * Description: <b>Unique identifier</b><br>
1848   * Type: <b>token</b><br>
1849   * Path: <b>SupplyRequest.identifier</b><br>
1850   * </p>
1851   */
1852  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1853
1854 /**
1855   * Search parameter: <b>supplier</b>
1856   * <p>
1857   * Description: <b>Who is intended to fulfill the request</b><br>
1858   * Type: <b>reference</b><br>
1859   * Path: <b>SupplyRequest.supplier</b><br>
1860   * </p>
1861   */
1862  @SearchParamDefinition(name="supplier", path="SupplyRequest.supplier", description="Who is intended to fulfill the request", type="reference", target={Organization.class } )
1863  public static final String SP_SUPPLIER = "supplier";
1864 /**
1865   * <b>Fluent Client</b> search parameter constant for <b>supplier</b>
1866   * <p>
1867   * Description: <b>Who is intended to fulfill the request</b><br>
1868   * Type: <b>reference</b><br>
1869   * Path: <b>SupplyRequest.supplier</b><br>
1870   * </p>
1871   */
1872  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPLIER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPLIER);
1873
1874/**
1875   * Constant for fluent queries to be used to add include statements. Specifies
1876   * the path value of "<b>SupplyRequest:supplier</b>".
1877   */
1878  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPLIER = new ca.uhn.fhir.model.api.Include("SupplyRequest:supplier").toLocked();
1879
1880 /**
1881   * Search parameter: <b>category</b>
1882   * <p>
1883   * Description: <b>The kind of supply (central, non-stock, etc.)</b><br>
1884   * Type: <b>token</b><br>
1885   * Path: <b>SupplyRequest.category</b><br>
1886   * </p>
1887   */
1888  @SearchParamDefinition(name="category", path="SupplyRequest.category", description="The kind of supply (central, non-stock, etc.)", type="token" )
1889  public static final String SP_CATEGORY = "category";
1890 /**
1891   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1892   * <p>
1893   * Description: <b>The kind of supply (central, non-stock, etc.)</b><br>
1894   * Type: <b>token</b><br>
1895   * Path: <b>SupplyRequest.category</b><br>
1896   * </p>
1897   */
1898  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1899
1900 /**
1901   * Search parameter: <b>status</b>
1902   * <p>
1903   * Description: <b>draft | active | suspended +</b><br>
1904   * Type: <b>token</b><br>
1905   * Path: <b>SupplyRequest.status</b><br>
1906   * </p>
1907   */
1908  @SearchParamDefinition(name="status", path="SupplyRequest.status", description="draft | active | suspended +", type="token" )
1909  public static final String SP_STATUS = "status";
1910 /**
1911   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1912   * <p>
1913   * Description: <b>draft | active | suspended +</b><br>
1914   * Type: <b>token</b><br>
1915   * Path: <b>SupplyRequest.status</b><br>
1916   * </p>
1917   */
1918  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1919
1920
1921}