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