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