001package org.hl7.fhir.dstu3.model;
002
003
004
005
006import java.math.BigDecimal;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036
037// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
038import java.util.ArrayList;
039import java.util.Date;
040import java.util.List;
041
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.exceptions.FHIRFormatError;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import org.hl7.fhir.utilities.Utilities;
046
047import ca.uhn.fhir.model.api.annotation.Block;
048import ca.uhn.fhir.model.api.annotation.Child;
049import ca.uhn.fhir.model.api.annotation.Description;
050import ca.uhn.fhir.model.api.annotation.ResourceDef;
051import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
052/**
053 * A formal agreement between parties regarding the conduct of business, exchange of information or other matters.
054 */
055@ResourceDef(name="Contract", profile="http://hl7.org/fhir/Profile/Contract")
056public class Contract extends DomainResource {
057
058    public enum ContractStatus {
059        /**
060         * Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.
061         */
062        AMENDED, 
063        /**
064         * Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.
065         */
066        APPENDED, 
067        /**
068         * Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.
069         */
070        CANCELLED, 
071        /**
072         * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.
073         */
074        DISPUTED, 
075        /**
076         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
077         */
078        ENTEREDINERROR, 
079        /**
080         * Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.
081         */
082        EXECUTABLE, 
083        /**
084         * Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.
085         */
086        EXECUTED, 
087        /**
088         * Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
089         */
090        NEGOTIABLE, 
091        /**
092         * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.
093         */
094        OFFERED, 
095        /**
096         * Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.
097         */
098        POLICY, 
099        /**
100         *  Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.
101         */
102        REJECTED, 
103        /**
104         * Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.
105         */
106        RENEWED, 
107        /**
108         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
109         */
110        REVOKED, 
111        /**
112         * Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.
113         */
114        RESOLVED, 
115        /**
116         * Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.
117         */
118        TERMINATED, 
119        /**
120         * added to help the parsers with the generic types
121         */
122        NULL;
123        public static ContractStatus fromCode(String codeString) throws FHIRException {
124            if (codeString == null || "".equals(codeString))
125                return null;
126        if ("amended".equals(codeString))
127          return AMENDED;
128        if ("appended".equals(codeString))
129          return APPENDED;
130        if ("cancelled".equals(codeString))
131          return CANCELLED;
132        if ("disputed".equals(codeString))
133          return DISPUTED;
134        if ("entered-in-error".equals(codeString))
135          return ENTEREDINERROR;
136        if ("executable".equals(codeString))
137          return EXECUTABLE;
138        if ("executed".equals(codeString))
139          return EXECUTED;
140        if ("negotiable".equals(codeString))
141          return NEGOTIABLE;
142        if ("offered".equals(codeString))
143          return OFFERED;
144        if ("policy".equals(codeString))
145          return POLICY;
146        if ("rejected".equals(codeString))
147          return REJECTED;
148        if ("renewed".equals(codeString))
149          return RENEWED;
150        if ("revoked".equals(codeString))
151          return REVOKED;
152        if ("resolved".equals(codeString))
153          return RESOLVED;
154        if ("terminated".equals(codeString))
155          return TERMINATED;
156        if (Configuration.isAcceptInvalidEnums())
157          return null;
158        else
159          throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
160        }
161        public String toCode() {
162          switch (this) {
163            case AMENDED: return "amended";
164            case APPENDED: return "appended";
165            case CANCELLED: return "cancelled";
166            case DISPUTED: return "disputed";
167            case ENTEREDINERROR: return "entered-in-error";
168            case EXECUTABLE: return "executable";
169            case EXECUTED: return "executed";
170            case NEGOTIABLE: return "negotiable";
171            case OFFERED: return "offered";
172            case POLICY: return "policy";
173            case REJECTED: return "rejected";
174            case RENEWED: return "renewed";
175            case REVOKED: return "revoked";
176            case RESOLVED: return "resolved";
177            case TERMINATED: return "terminated";
178            case NULL: return null;
179            default: return "?";
180          }
181        }
182        public String getSystem() {
183          switch (this) {
184            case AMENDED: return "http://hl7.org/fhir/contract-status";
185            case APPENDED: return "http://hl7.org/fhir/contract-status";
186            case CANCELLED: return "http://hl7.org/fhir/contract-status";
187            case DISPUTED: return "http://hl7.org/fhir/contract-status";
188            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
189            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
190            case EXECUTED: return "http://hl7.org/fhir/contract-status";
191            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
192            case OFFERED: return "http://hl7.org/fhir/contract-status";
193            case POLICY: return "http://hl7.org/fhir/contract-status";
194            case REJECTED: return "http://hl7.org/fhir/contract-status";
195            case RENEWED: return "http://hl7.org/fhir/contract-status";
196            case REVOKED: return "http://hl7.org/fhir/contract-status";
197            case RESOLVED: return "http://hl7.org/fhir/contract-status";
198            case TERMINATED: return "http://hl7.org/fhir/contract-status";
199            case NULL: return null;
200            default: return "?";
201          }
202        }
203        public String getDefinition() {
204          switch (this) {
205            case AMENDED: return "Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.";
206            case APPENDED: return "Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.";
207            case CANCELLED: return "Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.";
208            case DISPUTED: return "Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.";
209            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
210            case EXECUTABLE: return "Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.";
211            case EXECUTED: return "Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.";
212            case NEGOTIABLE: return "Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.";
213            case OFFERED: return "Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.";
214            case POLICY: return "Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.";
215            case REJECTED: return " Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.";
216            case RENEWED: return "Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.";
217            case REVOKED: return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
218            case RESOLVED: return "Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.";
219            case TERMINATED: return "Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
220            case NULL: return null;
221            default: return "?";
222          }
223        }
224        public String getDisplay() {
225          switch (this) {
226            case AMENDED: return "Amended";
227            case APPENDED: return "Appended";
228            case CANCELLED: return "Cancelled";
229            case DISPUTED: return "Disputed";
230            case ENTEREDINERROR: return "Entered in Error";
231            case EXECUTABLE: return "Executable";
232            case EXECUTED: return "Executed";
233            case NEGOTIABLE: return "Negotiable";
234            case OFFERED: return "Offered";
235            case POLICY: return "Policy";
236            case REJECTED: return "Rejected";
237            case RENEWED: return "Renewed";
238            case REVOKED: return "Revoked";
239            case RESOLVED: return "Resolved";
240            case TERMINATED: return "Terminated";
241            case NULL: return null;
242            default: return "?";
243          }
244        }
245    }
246
247  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
248    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
249      if (codeString == null || "".equals(codeString))
250            if (codeString == null || "".equals(codeString))
251                return null;
252        if ("amended".equals(codeString))
253          return ContractStatus.AMENDED;
254        if ("appended".equals(codeString))
255          return ContractStatus.APPENDED;
256        if ("cancelled".equals(codeString))
257          return ContractStatus.CANCELLED;
258        if ("disputed".equals(codeString))
259          return ContractStatus.DISPUTED;
260        if ("entered-in-error".equals(codeString))
261          return ContractStatus.ENTEREDINERROR;
262        if ("executable".equals(codeString))
263          return ContractStatus.EXECUTABLE;
264        if ("executed".equals(codeString))
265          return ContractStatus.EXECUTED;
266        if ("negotiable".equals(codeString))
267          return ContractStatus.NEGOTIABLE;
268        if ("offered".equals(codeString))
269          return ContractStatus.OFFERED;
270        if ("policy".equals(codeString))
271          return ContractStatus.POLICY;
272        if ("rejected".equals(codeString))
273          return ContractStatus.REJECTED;
274        if ("renewed".equals(codeString))
275          return ContractStatus.RENEWED;
276        if ("revoked".equals(codeString))
277          return ContractStatus.REVOKED;
278        if ("resolved".equals(codeString))
279          return ContractStatus.RESOLVED;
280        if ("terminated".equals(codeString))
281          return ContractStatus.TERMINATED;
282        throw new IllegalArgumentException("Unknown ContractStatus code '"+codeString+"'");
283        }
284        public Enumeration<ContractStatus> fromType(PrimitiveType<?> code) throws FHIRException {
285          if (code == null)
286            return null;
287          if (code.isEmpty())
288            return new Enumeration<ContractStatus>(this);
289          String codeString = code.asStringValue();
290          if (codeString == null || "".equals(codeString))
291            return null;
292        if ("amended".equals(codeString))
293          return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED);
294        if ("appended".equals(codeString))
295          return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED);
296        if ("cancelled".equals(codeString))
297          return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED);
298        if ("disputed".equals(codeString))
299          return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED);
300        if ("entered-in-error".equals(codeString))
301          return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR);
302        if ("executable".equals(codeString))
303          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE);
304        if ("executed".equals(codeString))
305          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED);
306        if ("negotiable".equals(codeString))
307          return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE);
308        if ("offered".equals(codeString))
309          return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED);
310        if ("policy".equals(codeString))
311          return new Enumeration<ContractStatus>(this, ContractStatus.POLICY);
312        if ("rejected".equals(codeString))
313          return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED);
314        if ("renewed".equals(codeString))
315          return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED);
316        if ("revoked".equals(codeString))
317          return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED);
318        if ("resolved".equals(codeString))
319          return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED);
320        if ("terminated".equals(codeString))
321          return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED);
322        throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
323        }
324    public String toCode(ContractStatus code) {
325       if (code == ContractStatus.NULL)
326           return null;
327       if (code == ContractStatus.AMENDED)
328        return "amended";
329      if (code == ContractStatus.APPENDED)
330        return "appended";
331      if (code == ContractStatus.CANCELLED)
332        return "cancelled";
333      if (code == ContractStatus.DISPUTED)
334        return "disputed";
335      if (code == ContractStatus.ENTEREDINERROR)
336        return "entered-in-error";
337      if (code == ContractStatus.EXECUTABLE)
338        return "executable";
339      if (code == ContractStatus.EXECUTED)
340        return "executed";
341      if (code == ContractStatus.NEGOTIABLE)
342        return "negotiable";
343      if (code == ContractStatus.OFFERED)
344        return "offered";
345      if (code == ContractStatus.POLICY)
346        return "policy";
347      if (code == ContractStatus.REJECTED)
348        return "rejected";
349      if (code == ContractStatus.RENEWED)
350        return "renewed";
351      if (code == ContractStatus.REVOKED)
352        return "revoked";
353      if (code == ContractStatus.RESOLVED)
354        return "resolved";
355      if (code == ContractStatus.TERMINATED)
356        return "terminated";
357      return "?";
358   }
359    public String toSystem(ContractStatus code) {
360      return code.getSystem();
361      }
362    }
363
364    @Block()
365    public static class AgentComponent extends BackboneElement implements IBaseBackboneElement {
366        /**
367         * Who or what parties are assigned roles in this Contract.
368         */
369        @Child(name = "actor", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
370        @Description(shortDefinition="Contract Agent Type", formalDefinition="Who or what parties are assigned roles in this Contract." )
371        protected Reference actor;
372
373        /**
374         * The actual object that is the target of the reference (Who or what parties are assigned roles in this Contract.)
375         */
376        protected Resource actorTarget;
377
378        /**
379         * Role type of agent assigned roles in this Contract.
380         */
381        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
382        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
383        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
384        protected List<CodeableConcept> role;
385
386        private static final long serialVersionUID = -454551165L;
387
388    /**
389     * Constructor
390     */
391      public AgentComponent() {
392        super();
393      }
394
395    /**
396     * Constructor
397     */
398      public AgentComponent(Reference actor) {
399        super();
400        this.actor = actor;
401      }
402
403        /**
404         * @return {@link #actor} (Who or what parties are assigned roles in this Contract.)
405         */
406        public Reference getActor() { 
407          if (this.actor == null)
408            if (Configuration.errorOnAutoCreate())
409              throw new Error("Attempt to auto-create AgentComponent.actor");
410            else if (Configuration.doAutoCreate())
411              this.actor = new Reference(); // cc
412          return this.actor;
413        }
414
415        public boolean hasActor() { 
416          return this.actor != null && !this.actor.isEmpty();
417        }
418
419        /**
420         * @param value {@link #actor} (Who or what parties are assigned roles in this Contract.)
421         */
422        public AgentComponent setActor(Reference value)  { 
423          this.actor = value;
424          return this;
425        }
426
427        /**
428         * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Who or what parties are assigned roles in this Contract.)
429         */
430        public Resource getActorTarget() { 
431          return this.actorTarget;
432        }
433
434        /**
435         * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Who or what parties are assigned roles in this Contract.)
436         */
437        public AgentComponent setActorTarget(Resource value) { 
438          this.actorTarget = value;
439          return this;
440        }
441
442        /**
443         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
444         */
445        public List<CodeableConcept> getRole() { 
446          if (this.role == null)
447            this.role = new ArrayList<CodeableConcept>();
448          return this.role;
449        }
450
451        /**
452         * @return Returns a reference to <code>this</code> for easy method chaining
453         */
454        public AgentComponent setRole(List<CodeableConcept> theRole) { 
455          this.role = theRole;
456          return this;
457        }
458
459        public boolean hasRole() { 
460          if (this.role == null)
461            return false;
462          for (CodeableConcept item : this.role)
463            if (!item.isEmpty())
464              return true;
465          return false;
466        }
467
468        public CodeableConcept addRole() { //3
469          CodeableConcept t = new CodeableConcept();
470          if (this.role == null)
471            this.role = new ArrayList<CodeableConcept>();
472          this.role.add(t);
473          return t;
474        }
475
476        public AgentComponent addRole(CodeableConcept t) { //3
477          if (t == null)
478            return this;
479          if (this.role == null)
480            this.role = new ArrayList<CodeableConcept>();
481          this.role.add(t);
482          return this;
483        }
484
485        /**
486         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
487         */
488        public CodeableConcept getRoleFirstRep() { 
489          if (getRole().isEmpty()) {
490            addRole();
491          }
492          return getRole().get(0);
493        }
494
495        protected void listChildren(List<Property> children) {
496          super.listChildren(children);
497          children.add(new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what parties are assigned roles in this Contract.", 0, 1, actor));
498          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role));
499        }
500
501        @Override
502        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
503          switch (_hash) {
504          case 92645877: /*actor*/  return new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what parties are assigned roles in this Contract.", 0, 1, actor);
505          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role);
506          default: return super.getNamedProperty(_hash, _name, _checkValid);
507          }
508
509        }
510
511      @Override
512      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
513        switch (hash) {
514        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
515        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
516        default: return super.getProperty(hash, name, checkValid);
517        }
518
519      }
520
521      @Override
522      public Base setProperty(int hash, String name, Base value) throws FHIRException {
523        switch (hash) {
524        case 92645877: // actor
525          this.actor = castToReference(value); // Reference
526          return value;
527        case 3506294: // role
528          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
529          return value;
530        default: return super.setProperty(hash, name, value);
531        }
532
533      }
534
535      @Override
536      public Base setProperty(String name, Base value) throws FHIRException {
537        if (name.equals("actor")) {
538          this.actor = castToReference(value); // Reference
539        } else if (name.equals("role")) {
540          this.getRole().add(castToCodeableConcept(value));
541        } else
542          return super.setProperty(name, value);
543        return value;
544      }
545
546      @Override
547      public Base makeProperty(int hash, String name) throws FHIRException {
548        switch (hash) {
549        case 92645877:  return getActor(); 
550        case 3506294:  return addRole(); 
551        default: return super.makeProperty(hash, name);
552        }
553
554      }
555
556      @Override
557      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
558        switch (hash) {
559        case 92645877: /*actor*/ return new String[] {"Reference"};
560        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
561        default: return super.getTypesForProperty(hash, name);
562        }
563
564      }
565
566      @Override
567      public Base addChild(String name) throws FHIRException {
568        if (name.equals("actor")) {
569          this.actor = new Reference();
570          return this.actor;
571        }
572        else if (name.equals("role")) {
573          return addRole();
574        }
575        else
576          return super.addChild(name);
577      }
578
579      public AgentComponent copy() {
580        AgentComponent dst = new AgentComponent();
581        copyValues(dst);
582        dst.actor = actor == null ? null : actor.copy();
583        if (role != null) {
584          dst.role = new ArrayList<CodeableConcept>();
585          for (CodeableConcept i : role)
586            dst.role.add(i.copy());
587        };
588        return dst;
589      }
590
591      @Override
592      public boolean equalsDeep(Base other_) {
593        if (!super.equalsDeep(other_))
594          return false;
595        if (!(other_ instanceof AgentComponent))
596          return false;
597        AgentComponent o = (AgentComponent) other_;
598        return compareDeep(actor, o.actor, true) && compareDeep(role, o.role, true);
599      }
600
601      @Override
602      public boolean equalsShallow(Base other_) {
603        if (!super.equalsShallow(other_))
604          return false;
605        if (!(other_ instanceof AgentComponent))
606          return false;
607        AgentComponent o = (AgentComponent) other_;
608        return true;
609      }
610
611      public boolean isEmpty() {
612        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actor, role);
613      }
614
615  public String fhirType() {
616    return "Contract.agent";
617
618  }
619
620  }
621
622    @Block()
623    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
624        /**
625         * Role of this Contract signer, e.g. notary, grantee.
626         */
627        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
628        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
629        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
630        protected Coding type;
631
632        /**
633         * Party which is a signator to this Contract.
634         */
635        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
636        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
637        protected Reference party;
638
639        /**
640         * The actual object that is the target of the reference (Party which is a signator to this Contract.)
641         */
642        protected Resource partyTarget;
643
644        /**
645         * Legally binding Contract DSIG signature contents in Base64.
646         */
647        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
648        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
649        protected List<Signature> signature;
650
651        private static final long serialVersionUID = 1948139228L;
652
653    /**
654     * Constructor
655     */
656      public SignatoryComponent() {
657        super();
658      }
659
660    /**
661     * Constructor
662     */
663      public SignatoryComponent(Coding type, Reference party) {
664        super();
665        this.type = type;
666        this.party = party;
667      }
668
669        /**
670         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
671         */
672        public Coding getType() { 
673          if (this.type == null)
674            if (Configuration.errorOnAutoCreate())
675              throw new Error("Attempt to auto-create SignatoryComponent.type");
676            else if (Configuration.doAutoCreate())
677              this.type = new Coding(); // cc
678          return this.type;
679        }
680
681        public boolean hasType() { 
682          return this.type != null && !this.type.isEmpty();
683        }
684
685        /**
686         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
687         */
688        public SignatoryComponent setType(Coding value)  { 
689          this.type = value;
690          return this;
691        }
692
693        /**
694         * @return {@link #party} (Party which is a signator to this Contract.)
695         */
696        public Reference getParty() { 
697          if (this.party == null)
698            if (Configuration.errorOnAutoCreate())
699              throw new Error("Attempt to auto-create SignatoryComponent.party");
700            else if (Configuration.doAutoCreate())
701              this.party = new Reference(); // cc
702          return this.party;
703        }
704
705        public boolean hasParty() { 
706          return this.party != null && !this.party.isEmpty();
707        }
708
709        /**
710         * @param value {@link #party} (Party which is a signator to this Contract.)
711         */
712        public SignatoryComponent setParty(Reference value)  { 
713          this.party = value;
714          return this;
715        }
716
717        /**
718         * @return {@link #party} 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. (Party which is a signator to this Contract.)
719         */
720        public Resource getPartyTarget() { 
721          return this.partyTarget;
722        }
723
724        /**
725         * @param value {@link #party} 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. (Party which is a signator to this Contract.)
726         */
727        public SignatoryComponent setPartyTarget(Resource value) { 
728          this.partyTarget = value;
729          return this;
730        }
731
732        /**
733         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
734         */
735        public List<Signature> getSignature() { 
736          if (this.signature == null)
737            this.signature = new ArrayList<Signature>();
738          return this.signature;
739        }
740
741        /**
742         * @return Returns a reference to <code>this</code> for easy method chaining
743         */
744        public SignatoryComponent setSignature(List<Signature> theSignature) { 
745          this.signature = theSignature;
746          return this;
747        }
748
749        public boolean hasSignature() { 
750          if (this.signature == null)
751            return false;
752          for (Signature item : this.signature)
753            if (!item.isEmpty())
754              return true;
755          return false;
756        }
757
758        public Signature addSignature() { //3
759          Signature t = new Signature();
760          if (this.signature == null)
761            this.signature = new ArrayList<Signature>();
762          this.signature.add(t);
763          return t;
764        }
765
766        public SignatoryComponent addSignature(Signature t) { //3
767          if (t == null)
768            return this;
769          if (this.signature == null)
770            this.signature = new ArrayList<Signature>();
771          this.signature.add(t);
772          return this;
773        }
774
775        /**
776         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist
777         */
778        public Signature getSignatureFirstRep() { 
779          if (getSignature().isEmpty()) {
780            addSignature();
781          }
782          return getSignature().get(0);
783        }
784
785        protected void listChildren(List<Property> children) {
786          super.listChildren(children);
787          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
788          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
789          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
790        }
791
792        @Override
793        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
794          switch (_hash) {
795          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
796          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
797          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
798          default: return super.getNamedProperty(_hash, _name, _checkValid);
799          }
800
801        }
802
803      @Override
804      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
805        switch (hash) {
806        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
807        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
808        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
809        default: return super.getProperty(hash, name, checkValid);
810        }
811
812      }
813
814      @Override
815      public Base setProperty(int hash, String name, Base value) throws FHIRException {
816        switch (hash) {
817        case 3575610: // type
818          this.type = castToCoding(value); // Coding
819          return value;
820        case 106437350: // party
821          this.party = castToReference(value); // Reference
822          return value;
823        case 1073584312: // signature
824          this.getSignature().add(castToSignature(value)); // Signature
825          return value;
826        default: return super.setProperty(hash, name, value);
827        }
828
829      }
830
831      @Override
832      public Base setProperty(String name, Base value) throws FHIRException {
833        if (name.equals("type")) {
834          this.type = castToCoding(value); // Coding
835        } else if (name.equals("party")) {
836          this.party = castToReference(value); // Reference
837        } else if (name.equals("signature")) {
838          this.getSignature().add(castToSignature(value));
839        } else
840          return super.setProperty(name, value);
841        return value;
842      }
843
844      @Override
845      public Base makeProperty(int hash, String name) throws FHIRException {
846        switch (hash) {
847        case 3575610:  return getType(); 
848        case 106437350:  return getParty(); 
849        case 1073584312:  return addSignature(); 
850        default: return super.makeProperty(hash, name);
851        }
852
853      }
854
855      @Override
856      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
857        switch (hash) {
858        case 3575610: /*type*/ return new String[] {"Coding"};
859        case 106437350: /*party*/ return new String[] {"Reference"};
860        case 1073584312: /*signature*/ return new String[] {"Signature"};
861        default: return super.getTypesForProperty(hash, name);
862        }
863
864      }
865
866      @Override
867      public Base addChild(String name) throws FHIRException {
868        if (name.equals("type")) {
869          this.type = new Coding();
870          return this.type;
871        }
872        else if (name.equals("party")) {
873          this.party = new Reference();
874          return this.party;
875        }
876        else if (name.equals("signature")) {
877          return addSignature();
878        }
879        else
880          return super.addChild(name);
881      }
882
883      public SignatoryComponent copy() {
884        SignatoryComponent dst = new SignatoryComponent();
885        copyValues(dst);
886        dst.type = type == null ? null : type.copy();
887        dst.party = party == null ? null : party.copy();
888        if (signature != null) {
889          dst.signature = new ArrayList<Signature>();
890          for (Signature i : signature)
891            dst.signature.add(i.copy());
892        };
893        return dst;
894      }
895
896      @Override
897      public boolean equalsDeep(Base other_) {
898        if (!super.equalsDeep(other_))
899          return false;
900        if (!(other_ instanceof SignatoryComponent))
901          return false;
902        SignatoryComponent o = (SignatoryComponent) other_;
903        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
904          ;
905      }
906
907      @Override
908      public boolean equalsShallow(Base other_) {
909        if (!super.equalsShallow(other_))
910          return false;
911        if (!(other_ instanceof SignatoryComponent))
912          return false;
913        SignatoryComponent o = (SignatoryComponent) other_;
914        return true;
915      }
916
917      public boolean isEmpty() {
918        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
919      }
920
921  public String fhirType() {
922    return "Contract.signer";
923
924  }
925
926  }
927
928    @Block()
929    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
930        /**
931         * Specific type of Contract Valued Item that may be priced.
932         */
933        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
934        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
935        protected Type entity;
936
937        /**
938         * Identifies a Contract Valued Item instance.
939         */
940        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
941        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
942        protected Identifier identifier;
943
944        /**
945         * Indicates the time during which this Contract ValuedItem information is effective.
946         */
947        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
948        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
949        protected DateTimeType effectiveTime;
950
951        /**
952         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
953         */
954        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
955        @Description(shortDefinition="Count of Contract Valued Items", formalDefinition="Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances." )
956        protected SimpleQuantity quantity;
957
958        /**
959         * A Contract Valued Item unit valuation measure.
960         */
961        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
962        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
963        protected Money unitPrice;
964
965        /**
966         * A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
967         */
968        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
969        @Description(shortDefinition="Contract Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
970        protected DecimalType factor;
971
972        /**
973         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
974         */
975        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
976        @Description(shortDefinition="Contract Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point." )
977        protected DecimalType points;
978
979        /**
980         * Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
981         */
982        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
983        @Description(shortDefinition="Total Contract Valued Item Value", formalDefinition="Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
984        protected Money net;
985
986        private static final long serialVersionUID = 1782449516L;
987
988    /**
989     * Constructor
990     */
991      public ValuedItemComponent() {
992        super();
993      }
994
995        /**
996         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
997         */
998        public Type getEntity() { 
999          return this.entity;
1000        }
1001
1002        /**
1003         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
1004         */
1005        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
1006          if (this.entity == null)
1007            return null;
1008          if (!(this.entity instanceof CodeableConcept))
1009            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
1010          return (CodeableConcept) this.entity;
1011        }
1012
1013        public boolean hasEntityCodeableConcept() {
1014          return this.entity instanceof CodeableConcept;
1015        }
1016
1017        /**
1018         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
1019         */
1020        public Reference getEntityReference() throws FHIRException { 
1021          if (this.entity == null)
1022            return null;
1023          if (!(this.entity instanceof Reference))
1024            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
1025          return (Reference) this.entity;
1026        }
1027
1028        public boolean hasEntityReference() {
1029          return this.entity instanceof Reference;
1030        }
1031
1032        public boolean hasEntity() { 
1033          return this.entity != null && !this.entity.isEmpty();
1034        }
1035
1036        /**
1037         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
1038         */
1039        public ValuedItemComponent setEntity(Type value) throws FHIRFormatError { 
1040          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1041            throw new FHIRFormatError("Not the right type for Contract.valuedItem.entity[x]: "+value.fhirType());
1042          this.entity = value;
1043          return this;
1044        }
1045
1046        /**
1047         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
1048         */
1049        public Identifier getIdentifier() { 
1050          if (this.identifier == null)
1051            if (Configuration.errorOnAutoCreate())
1052              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
1053            else if (Configuration.doAutoCreate())
1054              this.identifier = new Identifier(); // cc
1055          return this.identifier;
1056        }
1057
1058        public boolean hasIdentifier() { 
1059          return this.identifier != null && !this.identifier.isEmpty();
1060        }
1061
1062        /**
1063         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
1064         */
1065        public ValuedItemComponent setIdentifier(Identifier value)  { 
1066          this.identifier = value;
1067          return this;
1068        }
1069
1070        /**
1071         * @return {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
1072         */
1073        public DateTimeType getEffectiveTimeElement() { 
1074          if (this.effectiveTime == null)
1075            if (Configuration.errorOnAutoCreate())
1076              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
1077            else if (Configuration.doAutoCreate())
1078              this.effectiveTime = new DateTimeType(); // bb
1079          return this.effectiveTime;
1080        }
1081
1082        public boolean hasEffectiveTimeElement() { 
1083          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1084        }
1085
1086        public boolean hasEffectiveTime() { 
1087          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1088        }
1089
1090        /**
1091         * @param value {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
1092         */
1093        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
1094          this.effectiveTime = value;
1095          return this;
1096        }
1097
1098        /**
1099         * @return Indicates the time during which this Contract ValuedItem information is effective.
1100         */
1101        public Date getEffectiveTime() { 
1102          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
1103        }
1104
1105        /**
1106         * @param value Indicates the time during which this Contract ValuedItem information is effective.
1107         */
1108        public ValuedItemComponent setEffectiveTime(Date value) { 
1109          if (value == null)
1110            this.effectiveTime = null;
1111          else {
1112            if (this.effectiveTime == null)
1113              this.effectiveTime = new DateTimeType();
1114            this.effectiveTime.setValue(value);
1115          }
1116          return this;
1117        }
1118
1119        /**
1120         * @return {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
1121         */
1122        public SimpleQuantity getQuantity() { 
1123          if (this.quantity == null)
1124            if (Configuration.errorOnAutoCreate())
1125              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
1126            else if (Configuration.doAutoCreate())
1127              this.quantity = new SimpleQuantity(); // cc
1128          return this.quantity;
1129        }
1130
1131        public boolean hasQuantity() { 
1132          return this.quantity != null && !this.quantity.isEmpty();
1133        }
1134
1135        /**
1136         * @param value {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
1137         */
1138        public ValuedItemComponent setQuantity(SimpleQuantity value)  { 
1139          this.quantity = value;
1140          return this;
1141        }
1142
1143        /**
1144         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
1145         */
1146        public Money getUnitPrice() { 
1147          if (this.unitPrice == null)
1148            if (Configuration.errorOnAutoCreate())
1149              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
1150            else if (Configuration.doAutoCreate())
1151              this.unitPrice = new Money(); // cc
1152          return this.unitPrice;
1153        }
1154
1155        public boolean hasUnitPrice() { 
1156          return this.unitPrice != null && !this.unitPrice.isEmpty();
1157        }
1158
1159        /**
1160         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
1161         */
1162        public ValuedItemComponent setUnitPrice(Money value)  { 
1163          this.unitPrice = value;
1164          return this;
1165        }
1166
1167        /**
1168         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
1169         */
1170        public DecimalType getFactorElement() { 
1171          if (this.factor == null)
1172            if (Configuration.errorOnAutoCreate())
1173              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
1174            else if (Configuration.doAutoCreate())
1175              this.factor = new DecimalType(); // bb
1176          return this.factor;
1177        }
1178
1179        public boolean hasFactorElement() { 
1180          return this.factor != null && !this.factor.isEmpty();
1181        }
1182
1183        public boolean hasFactor() { 
1184          return this.factor != null && !this.factor.isEmpty();
1185        }
1186
1187        /**
1188         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
1189         */
1190        public ValuedItemComponent setFactorElement(DecimalType value) { 
1191          this.factor = value;
1192          return this;
1193        }
1194
1195        /**
1196         * @return A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1197         */
1198        public BigDecimal getFactor() { 
1199          return this.factor == null ? null : this.factor.getValue();
1200        }
1201
1202        /**
1203         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1204         */
1205        public ValuedItemComponent setFactor(BigDecimal value) { 
1206          if (value == null)
1207            this.factor = null;
1208          else {
1209            if (this.factor == null)
1210              this.factor = new DecimalType();
1211            this.factor.setValue(value);
1212          }
1213          return this;
1214        }
1215
1216        /**
1217         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1218         */
1219        public ValuedItemComponent setFactor(long value) { 
1220              this.factor = new DecimalType();
1221            this.factor.setValue(value);
1222          return this;
1223        }
1224
1225        /**
1226         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1227         */
1228        public ValuedItemComponent setFactor(double value) { 
1229              this.factor = new DecimalType();
1230            this.factor.setValue(value);
1231          return this;
1232        }
1233
1234        /**
1235         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1236         */
1237        public DecimalType getPointsElement() { 
1238          if (this.points == null)
1239            if (Configuration.errorOnAutoCreate())
1240              throw new Error("Attempt to auto-create ValuedItemComponent.points");
1241            else if (Configuration.doAutoCreate())
1242              this.points = new DecimalType(); // bb
1243          return this.points;
1244        }
1245
1246        public boolean hasPointsElement() { 
1247          return this.points != null && !this.points.isEmpty();
1248        }
1249
1250        public boolean hasPoints() { 
1251          return this.points != null && !this.points.isEmpty();
1252        }
1253
1254        /**
1255         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
1256         */
1257        public ValuedItemComponent setPointsElement(DecimalType value) { 
1258          this.points = value;
1259          return this;
1260        }
1261
1262        /**
1263         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1264         */
1265        public BigDecimal getPoints() { 
1266          return this.points == null ? null : this.points.getValue();
1267        }
1268
1269        /**
1270         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1271         */
1272        public ValuedItemComponent setPoints(BigDecimal value) { 
1273          if (value == null)
1274            this.points = null;
1275          else {
1276            if (this.points == null)
1277              this.points = new DecimalType();
1278            this.points.setValue(value);
1279          }
1280          return this;
1281        }
1282
1283        /**
1284         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1285         */
1286        public ValuedItemComponent setPoints(long value) { 
1287              this.points = new DecimalType();
1288            this.points.setValue(value);
1289          return this;
1290        }
1291
1292        /**
1293         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
1294         */
1295        public ValuedItemComponent setPoints(double value) { 
1296              this.points = new DecimalType();
1297            this.points.setValue(value);
1298          return this;
1299        }
1300
1301        /**
1302         * @return {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1303         */
1304        public Money getNet() { 
1305          if (this.net == null)
1306            if (Configuration.errorOnAutoCreate())
1307              throw new Error("Attempt to auto-create ValuedItemComponent.net");
1308            else if (Configuration.doAutoCreate())
1309              this.net = new Money(); // cc
1310          return this.net;
1311        }
1312
1313        public boolean hasNet() { 
1314          return this.net != null && !this.net.isEmpty();
1315        }
1316
1317        /**
1318         * @param value {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
1319         */
1320        public ValuedItemComponent setNet(Money value)  { 
1321          this.net = value;
1322          return this;
1323        }
1324
1325        protected void listChildren(List<Property> children) {
1326          super.listChildren(children);
1327          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
1328          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
1329          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
1330          children.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity));
1331          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
1332          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
1333          children.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.", 0, 1, points));
1334          children.add(new Property("net", "Money", "Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
1335        }
1336
1337        @Override
1338        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1339          switch (_hash) {
1340          case -740568643: /*entity[x]*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1341          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1342          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1343          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
1344          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
1345          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
1346          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity);
1347          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
1348          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
1349          case -982754077: /*points*/  return new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.", 0, 1, points);
1350          case 108957: /*net*/  return new Property("net", "Money", "Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
1351          default: return super.getNamedProperty(_hash, _name, _checkValid);
1352          }
1353
1354        }
1355
1356      @Override
1357      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1358        switch (hash) {
1359        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
1360        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1361        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
1362        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
1363        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
1364        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
1365        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
1366        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
1367        default: return super.getProperty(hash, name, checkValid);
1368        }
1369
1370      }
1371
1372      @Override
1373      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1374        switch (hash) {
1375        case -1298275357: // entity
1376          this.entity = castToType(value); // Type
1377          return value;
1378        case -1618432855: // identifier
1379          this.identifier = castToIdentifier(value); // Identifier
1380          return value;
1381        case -929905388: // effectiveTime
1382          this.effectiveTime = castToDateTime(value); // DateTimeType
1383          return value;
1384        case -1285004149: // quantity
1385          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1386          return value;
1387        case -486196699: // unitPrice
1388          this.unitPrice = castToMoney(value); // Money
1389          return value;
1390        case -1282148017: // factor
1391          this.factor = castToDecimal(value); // DecimalType
1392          return value;
1393        case -982754077: // points
1394          this.points = castToDecimal(value); // DecimalType
1395          return value;
1396        case 108957: // net
1397          this.net = castToMoney(value); // Money
1398          return value;
1399        default: return super.setProperty(hash, name, value);
1400        }
1401
1402      }
1403
1404      @Override
1405      public Base setProperty(String name, Base value) throws FHIRException {
1406        if (name.equals("entity[x]")) {
1407          this.entity = castToType(value); // Type
1408        } else if (name.equals("identifier")) {
1409          this.identifier = castToIdentifier(value); // Identifier
1410        } else if (name.equals("effectiveTime")) {
1411          this.effectiveTime = castToDateTime(value); // DateTimeType
1412        } else if (name.equals("quantity")) {
1413          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1414        } else if (name.equals("unitPrice")) {
1415          this.unitPrice = castToMoney(value); // Money
1416        } else if (name.equals("factor")) {
1417          this.factor = castToDecimal(value); // DecimalType
1418        } else if (name.equals("points")) {
1419          this.points = castToDecimal(value); // DecimalType
1420        } else if (name.equals("net")) {
1421          this.net = castToMoney(value); // Money
1422        } else
1423          return super.setProperty(name, value);
1424        return value;
1425      }
1426
1427      @Override
1428      public Base makeProperty(int hash, String name) throws FHIRException {
1429        switch (hash) {
1430        case -740568643:  return getEntity(); 
1431        case -1298275357:  return getEntity(); 
1432        case -1618432855:  return getIdentifier(); 
1433        case -929905388:  return getEffectiveTimeElement();
1434        case -1285004149:  return getQuantity(); 
1435        case -486196699:  return getUnitPrice(); 
1436        case -1282148017:  return getFactorElement();
1437        case -982754077:  return getPointsElement();
1438        case 108957:  return getNet(); 
1439        default: return super.makeProperty(hash, name);
1440        }
1441
1442      }
1443
1444      @Override
1445      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1446        switch (hash) {
1447        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
1448        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1449        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
1450        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
1451        case -486196699: /*unitPrice*/ return new String[] {"Money"};
1452        case -1282148017: /*factor*/ return new String[] {"decimal"};
1453        case -982754077: /*points*/ return new String[] {"decimal"};
1454        case 108957: /*net*/ return new String[] {"Money"};
1455        default: return super.getTypesForProperty(hash, name);
1456        }
1457
1458      }
1459
1460      @Override
1461      public Base addChild(String name) throws FHIRException {
1462        if (name.equals("entityCodeableConcept")) {
1463          this.entity = new CodeableConcept();
1464          return this.entity;
1465        }
1466        else if (name.equals("entityReference")) {
1467          this.entity = new Reference();
1468          return this.entity;
1469        }
1470        else if (name.equals("identifier")) {
1471          this.identifier = new Identifier();
1472          return this.identifier;
1473        }
1474        else if (name.equals("effectiveTime")) {
1475          throw new FHIRException("Cannot call addChild on a singleton property Contract.effectiveTime");
1476        }
1477        else if (name.equals("quantity")) {
1478          this.quantity = new SimpleQuantity();
1479          return this.quantity;
1480        }
1481        else if (name.equals("unitPrice")) {
1482          this.unitPrice = new Money();
1483          return this.unitPrice;
1484        }
1485        else if (name.equals("factor")) {
1486          throw new FHIRException("Cannot call addChild on a singleton property Contract.factor");
1487        }
1488        else if (name.equals("points")) {
1489          throw new FHIRException("Cannot call addChild on a singleton property Contract.points");
1490        }
1491        else if (name.equals("net")) {
1492          this.net = new Money();
1493          return this.net;
1494        }
1495        else
1496          return super.addChild(name);
1497      }
1498
1499      public ValuedItemComponent copy() {
1500        ValuedItemComponent dst = new ValuedItemComponent();
1501        copyValues(dst);
1502        dst.entity = entity == null ? null : entity.copy();
1503        dst.identifier = identifier == null ? null : identifier.copy();
1504        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
1505        dst.quantity = quantity == null ? null : quantity.copy();
1506        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
1507        dst.factor = factor == null ? null : factor.copy();
1508        dst.points = points == null ? null : points.copy();
1509        dst.net = net == null ? null : net.copy();
1510        return dst;
1511      }
1512
1513      @Override
1514      public boolean equalsDeep(Base other_) {
1515        if (!super.equalsDeep(other_))
1516          return false;
1517        if (!(other_ instanceof ValuedItemComponent))
1518          return false;
1519        ValuedItemComponent o = (ValuedItemComponent) other_;
1520        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
1521           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
1522           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
1523      }
1524
1525      @Override
1526      public boolean equalsShallow(Base other_) {
1527        if (!super.equalsShallow(other_))
1528          return false;
1529        if (!(other_ instanceof ValuedItemComponent))
1530          return false;
1531        ValuedItemComponent o = (ValuedItemComponent) other_;
1532        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
1533           && compareValues(points, o.points, true);
1534      }
1535
1536      public boolean isEmpty() {
1537        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
1538          , quantity, unitPrice, factor, points, net);
1539      }
1540
1541  public String fhirType() {
1542    return "Contract.valuedItem";
1543
1544  }
1545
1546  }
1547
1548    @Block()
1549    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1550        /**
1551         * Unique identifier for this particular Contract Provision.
1552         */
1553        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1554        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1555        protected Identifier identifier;
1556
1557        /**
1558         * When this Contract Provision was issued.
1559         */
1560        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1561        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1562        protected DateTimeType issued;
1563
1564        /**
1565         * Relevant time or time-period when this Contract Provision is applicable.
1566         */
1567        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1568        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1569        protected Period applies;
1570
1571        /**
1572         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
1573         */
1574        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1575        @Description(shortDefinition="Contract Term Type or Form", formalDefinition="Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit." )
1576        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1577        protected CodeableConcept type;
1578
1579        /**
1580         * Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.
1581         */
1582        @Child(name = "subType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1583        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment." )
1584        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1585        protected CodeableConcept subType;
1586
1587        /**
1588         * The matter of concern in the context of this provision of the agrement.
1589         */
1590        @Child(name = "topic", type = {Reference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1591        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1592        protected List<Reference> topic;
1593        /**
1594         * The actual objects that are the target of the reference (The matter of concern in the context of this provision of the agrement.)
1595         */
1596        protected List<Resource> topicTarget;
1597
1598
1599        /**
1600         * Action stipulated by this Contract Provision.
1601         */
1602        @Child(name = "action", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1603        @Description(shortDefinition="Contract Term Activity", formalDefinition="Action stipulated by this Contract Provision." )
1604        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
1605        protected List<CodeableConcept> action;
1606
1607        /**
1608         * Reason or purpose for the action stipulated by this Contract Provision.
1609         */
1610        @Child(name = "actionReason", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1611        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
1612        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
1613        protected List<CodeableConcept> actionReason;
1614
1615        /**
1616         * A set of security labels that define which terms are controlled by this condition.
1617         */
1618        @Child(name = "securityLabel", type = {Coding.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1619        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
1620        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
1621        protected List<Coding> securityLabel;
1622
1623        /**
1624         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1625         */
1626        @Child(name = "agent", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1627        @Description(shortDefinition="Contract Term Agent List", formalDefinition="An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place." )
1628        protected List<TermAgentComponent> agent;
1629
1630        /**
1631         * Human readable form of this Contract Provision.
1632         */
1633        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1634        @Description(shortDefinition="Human readable Contract term text", formalDefinition="Human readable form of this Contract Provision." )
1635        protected StringType text;
1636
1637        /**
1638         * Contract Provision Valued Item List.
1639         */
1640        @Child(name = "valuedItem", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1641        @Description(shortDefinition="Contract Term Valued Item List", formalDefinition="Contract Provision Valued Item List." )
1642        protected List<TermValuedItemComponent> valuedItem;
1643
1644        /**
1645         * Nested group of Contract Provisions.
1646         */
1647        @Child(name = "group", type = {TermComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1648        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1649        protected List<TermComponent> group;
1650
1651        private static final long serialVersionUID = 812661371L;
1652
1653    /**
1654     * Constructor
1655     */
1656      public TermComponent() {
1657        super();
1658      }
1659
1660        /**
1661         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1662         */
1663        public Identifier getIdentifier() { 
1664          if (this.identifier == null)
1665            if (Configuration.errorOnAutoCreate())
1666              throw new Error("Attempt to auto-create TermComponent.identifier");
1667            else if (Configuration.doAutoCreate())
1668              this.identifier = new Identifier(); // cc
1669          return this.identifier;
1670        }
1671
1672        public boolean hasIdentifier() { 
1673          return this.identifier != null && !this.identifier.isEmpty();
1674        }
1675
1676        /**
1677         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1678         */
1679        public TermComponent setIdentifier(Identifier value)  { 
1680          this.identifier = value;
1681          return this;
1682        }
1683
1684        /**
1685         * @return {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1686         */
1687        public DateTimeType getIssuedElement() { 
1688          if (this.issued == null)
1689            if (Configuration.errorOnAutoCreate())
1690              throw new Error("Attempt to auto-create TermComponent.issued");
1691            else if (Configuration.doAutoCreate())
1692              this.issued = new DateTimeType(); // bb
1693          return this.issued;
1694        }
1695
1696        public boolean hasIssuedElement() { 
1697          return this.issued != null && !this.issued.isEmpty();
1698        }
1699
1700        public boolean hasIssued() { 
1701          return this.issued != null && !this.issued.isEmpty();
1702        }
1703
1704        /**
1705         * @param value {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1706         */
1707        public TermComponent setIssuedElement(DateTimeType value) { 
1708          this.issued = value;
1709          return this;
1710        }
1711
1712        /**
1713         * @return When this Contract Provision was issued.
1714         */
1715        public Date getIssued() { 
1716          return this.issued == null ? null : this.issued.getValue();
1717        }
1718
1719        /**
1720         * @param value When this Contract Provision was issued.
1721         */
1722        public TermComponent setIssued(Date value) { 
1723          if (value == null)
1724            this.issued = null;
1725          else {
1726            if (this.issued == null)
1727              this.issued = new DateTimeType();
1728            this.issued.setValue(value);
1729          }
1730          return this;
1731        }
1732
1733        /**
1734         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1735         */
1736        public Period getApplies() { 
1737          if (this.applies == null)
1738            if (Configuration.errorOnAutoCreate())
1739              throw new Error("Attempt to auto-create TermComponent.applies");
1740            else if (Configuration.doAutoCreate())
1741              this.applies = new Period(); // cc
1742          return this.applies;
1743        }
1744
1745        public boolean hasApplies() { 
1746          return this.applies != null && !this.applies.isEmpty();
1747        }
1748
1749        /**
1750         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1751         */
1752        public TermComponent setApplies(Period value)  { 
1753          this.applies = value;
1754          return this;
1755        }
1756
1757        /**
1758         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1759         */
1760        public CodeableConcept getType() { 
1761          if (this.type == null)
1762            if (Configuration.errorOnAutoCreate())
1763              throw new Error("Attempt to auto-create TermComponent.type");
1764            else if (Configuration.doAutoCreate())
1765              this.type = new CodeableConcept(); // cc
1766          return this.type;
1767        }
1768
1769        public boolean hasType() { 
1770          return this.type != null && !this.type.isEmpty();
1771        }
1772
1773        /**
1774         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1775         */
1776        public TermComponent setType(CodeableConcept value)  { 
1777          this.type = value;
1778          return this;
1779        }
1780
1781        /**
1782         * @return {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1783         */
1784        public CodeableConcept getSubType() { 
1785          if (this.subType == null)
1786            if (Configuration.errorOnAutoCreate())
1787              throw new Error("Attempt to auto-create TermComponent.subType");
1788            else if (Configuration.doAutoCreate())
1789              this.subType = new CodeableConcept(); // cc
1790          return this.subType;
1791        }
1792
1793        public boolean hasSubType() { 
1794          return this.subType != null && !this.subType.isEmpty();
1795        }
1796
1797        /**
1798         * @param value {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1799         */
1800        public TermComponent setSubType(CodeableConcept value)  { 
1801          this.subType = value;
1802          return this;
1803        }
1804
1805        /**
1806         * @return {@link #topic} (The matter of concern in the context of this provision of the agrement.)
1807         */
1808        public List<Reference> getTopic() { 
1809          if (this.topic == null)
1810            this.topic = new ArrayList<Reference>();
1811          return this.topic;
1812        }
1813
1814        /**
1815         * @return Returns a reference to <code>this</code> for easy method chaining
1816         */
1817        public TermComponent setTopic(List<Reference> theTopic) { 
1818          this.topic = theTopic;
1819          return this;
1820        }
1821
1822        public boolean hasTopic() { 
1823          if (this.topic == null)
1824            return false;
1825          for (Reference item : this.topic)
1826            if (!item.isEmpty())
1827              return true;
1828          return false;
1829        }
1830
1831        public Reference addTopic() { //3
1832          Reference t = new Reference();
1833          if (this.topic == null)
1834            this.topic = new ArrayList<Reference>();
1835          this.topic.add(t);
1836          return t;
1837        }
1838
1839        public TermComponent addTopic(Reference t) { //3
1840          if (t == null)
1841            return this;
1842          if (this.topic == null)
1843            this.topic = new ArrayList<Reference>();
1844          this.topic.add(t);
1845          return this;
1846        }
1847
1848        /**
1849         * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
1850         */
1851        public Reference getTopicFirstRep() { 
1852          if (getTopic().isEmpty()) {
1853            addTopic();
1854          }
1855          return getTopic().get(0);
1856        }
1857
1858        /**
1859         * @return {@link #action} (Action stipulated by this Contract Provision.)
1860         */
1861        public List<CodeableConcept> getAction() { 
1862          if (this.action == null)
1863            this.action = new ArrayList<CodeableConcept>();
1864          return this.action;
1865        }
1866
1867        /**
1868         * @return Returns a reference to <code>this</code> for easy method chaining
1869         */
1870        public TermComponent setAction(List<CodeableConcept> theAction) { 
1871          this.action = theAction;
1872          return this;
1873        }
1874
1875        public boolean hasAction() { 
1876          if (this.action == null)
1877            return false;
1878          for (CodeableConcept item : this.action)
1879            if (!item.isEmpty())
1880              return true;
1881          return false;
1882        }
1883
1884        public CodeableConcept addAction() { //3
1885          CodeableConcept t = new CodeableConcept();
1886          if (this.action == null)
1887            this.action = new ArrayList<CodeableConcept>();
1888          this.action.add(t);
1889          return t;
1890        }
1891
1892        public TermComponent addAction(CodeableConcept t) { //3
1893          if (t == null)
1894            return this;
1895          if (this.action == null)
1896            this.action = new ArrayList<CodeableConcept>();
1897          this.action.add(t);
1898          return this;
1899        }
1900
1901        /**
1902         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
1903         */
1904        public CodeableConcept getActionFirstRep() { 
1905          if (getAction().isEmpty()) {
1906            addAction();
1907          }
1908          return getAction().get(0);
1909        }
1910
1911        /**
1912         * @return {@link #actionReason} (Reason or purpose for the action stipulated by this Contract Provision.)
1913         */
1914        public List<CodeableConcept> getActionReason() { 
1915          if (this.actionReason == null)
1916            this.actionReason = new ArrayList<CodeableConcept>();
1917          return this.actionReason;
1918        }
1919
1920        /**
1921         * @return Returns a reference to <code>this</code> for easy method chaining
1922         */
1923        public TermComponent setActionReason(List<CodeableConcept> theActionReason) { 
1924          this.actionReason = theActionReason;
1925          return this;
1926        }
1927
1928        public boolean hasActionReason() { 
1929          if (this.actionReason == null)
1930            return false;
1931          for (CodeableConcept item : this.actionReason)
1932            if (!item.isEmpty())
1933              return true;
1934          return false;
1935        }
1936
1937        public CodeableConcept addActionReason() { //3
1938          CodeableConcept t = new CodeableConcept();
1939          if (this.actionReason == null)
1940            this.actionReason = new ArrayList<CodeableConcept>();
1941          this.actionReason.add(t);
1942          return t;
1943        }
1944
1945        public TermComponent addActionReason(CodeableConcept t) { //3
1946          if (t == null)
1947            return this;
1948          if (this.actionReason == null)
1949            this.actionReason = new ArrayList<CodeableConcept>();
1950          this.actionReason.add(t);
1951          return this;
1952        }
1953
1954        /**
1955         * @return The first repetition of repeating field {@link #actionReason}, creating it if it does not already exist
1956         */
1957        public CodeableConcept getActionReasonFirstRep() { 
1958          if (getActionReason().isEmpty()) {
1959            addActionReason();
1960          }
1961          return getActionReason().get(0);
1962        }
1963
1964        /**
1965         * @return {@link #securityLabel} (A set of security labels that define which terms are controlled by this condition.)
1966         */
1967        public List<Coding> getSecurityLabel() { 
1968          if (this.securityLabel == null)
1969            this.securityLabel = new ArrayList<Coding>();
1970          return this.securityLabel;
1971        }
1972
1973        /**
1974         * @return Returns a reference to <code>this</code> for easy method chaining
1975         */
1976        public TermComponent setSecurityLabel(List<Coding> theSecurityLabel) { 
1977          this.securityLabel = theSecurityLabel;
1978          return this;
1979        }
1980
1981        public boolean hasSecurityLabel() { 
1982          if (this.securityLabel == null)
1983            return false;
1984          for (Coding item : this.securityLabel)
1985            if (!item.isEmpty())
1986              return true;
1987          return false;
1988        }
1989
1990        public Coding addSecurityLabel() { //3
1991          Coding t = new Coding();
1992          if (this.securityLabel == null)
1993            this.securityLabel = new ArrayList<Coding>();
1994          this.securityLabel.add(t);
1995          return t;
1996        }
1997
1998        public TermComponent addSecurityLabel(Coding t) { //3
1999          if (t == null)
2000            return this;
2001          if (this.securityLabel == null)
2002            this.securityLabel = new ArrayList<Coding>();
2003          this.securityLabel.add(t);
2004          return this;
2005        }
2006
2007        /**
2008         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
2009         */
2010        public Coding getSecurityLabelFirstRep() { 
2011          if (getSecurityLabel().isEmpty()) {
2012            addSecurityLabel();
2013          }
2014          return getSecurityLabel().get(0);
2015        }
2016
2017        /**
2018         * @return {@link #agent} (An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.)
2019         */
2020        public List<TermAgentComponent> getAgent() { 
2021          if (this.agent == null)
2022            this.agent = new ArrayList<TermAgentComponent>();
2023          return this.agent;
2024        }
2025
2026        /**
2027         * @return Returns a reference to <code>this</code> for easy method chaining
2028         */
2029        public TermComponent setAgent(List<TermAgentComponent> theAgent) { 
2030          this.agent = theAgent;
2031          return this;
2032        }
2033
2034        public boolean hasAgent() { 
2035          if (this.agent == null)
2036            return false;
2037          for (TermAgentComponent item : this.agent)
2038            if (!item.isEmpty())
2039              return true;
2040          return false;
2041        }
2042
2043        public TermAgentComponent addAgent() { //3
2044          TermAgentComponent t = new TermAgentComponent();
2045          if (this.agent == null)
2046            this.agent = new ArrayList<TermAgentComponent>();
2047          this.agent.add(t);
2048          return t;
2049        }
2050
2051        public TermComponent addAgent(TermAgentComponent t) { //3
2052          if (t == null)
2053            return this;
2054          if (this.agent == null)
2055            this.agent = new ArrayList<TermAgentComponent>();
2056          this.agent.add(t);
2057          return this;
2058        }
2059
2060        /**
2061         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
2062         */
2063        public TermAgentComponent getAgentFirstRep() { 
2064          if (getAgent().isEmpty()) {
2065            addAgent();
2066          }
2067          return getAgent().get(0);
2068        }
2069
2070        /**
2071         * @return {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2072         */
2073        public StringType getTextElement() { 
2074          if (this.text == null)
2075            if (Configuration.errorOnAutoCreate())
2076              throw new Error("Attempt to auto-create TermComponent.text");
2077            else if (Configuration.doAutoCreate())
2078              this.text = new StringType(); // bb
2079          return this.text;
2080        }
2081
2082        public boolean hasTextElement() { 
2083          return this.text != null && !this.text.isEmpty();
2084        }
2085
2086        public boolean hasText() { 
2087          return this.text != null && !this.text.isEmpty();
2088        }
2089
2090        /**
2091         * @param value {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2092         */
2093        public TermComponent setTextElement(StringType value) { 
2094          this.text = value;
2095          return this;
2096        }
2097
2098        /**
2099         * @return Human readable form of this Contract Provision.
2100         */
2101        public String getText() { 
2102          return this.text == null ? null : this.text.getValue();
2103        }
2104
2105        /**
2106         * @param value Human readable form of this Contract Provision.
2107         */
2108        public TermComponent setText(String value) { 
2109          if (Utilities.noString(value))
2110            this.text = null;
2111          else {
2112            if (this.text == null)
2113              this.text = new StringType();
2114            this.text.setValue(value);
2115          }
2116          return this;
2117        }
2118
2119        /**
2120         * @return {@link #valuedItem} (Contract Provision Valued Item List.)
2121         */
2122        public List<TermValuedItemComponent> getValuedItem() { 
2123          if (this.valuedItem == null)
2124            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2125          return this.valuedItem;
2126        }
2127
2128        /**
2129         * @return Returns a reference to <code>this</code> for easy method chaining
2130         */
2131        public TermComponent setValuedItem(List<TermValuedItemComponent> theValuedItem) { 
2132          this.valuedItem = theValuedItem;
2133          return this;
2134        }
2135
2136        public boolean hasValuedItem() { 
2137          if (this.valuedItem == null)
2138            return false;
2139          for (TermValuedItemComponent item : this.valuedItem)
2140            if (!item.isEmpty())
2141              return true;
2142          return false;
2143        }
2144
2145        public TermValuedItemComponent addValuedItem() { //3
2146          TermValuedItemComponent t = new TermValuedItemComponent();
2147          if (this.valuedItem == null)
2148            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2149          this.valuedItem.add(t);
2150          return t;
2151        }
2152
2153        public TermComponent addValuedItem(TermValuedItemComponent t) { //3
2154          if (t == null)
2155            return this;
2156          if (this.valuedItem == null)
2157            this.valuedItem = new ArrayList<TermValuedItemComponent>();
2158          this.valuedItem.add(t);
2159          return this;
2160        }
2161
2162        /**
2163         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
2164         */
2165        public TermValuedItemComponent getValuedItemFirstRep() { 
2166          if (getValuedItem().isEmpty()) {
2167            addValuedItem();
2168          }
2169          return getValuedItem().get(0);
2170        }
2171
2172        /**
2173         * @return {@link #group} (Nested group of Contract Provisions.)
2174         */
2175        public List<TermComponent> getGroup() { 
2176          if (this.group == null)
2177            this.group = new ArrayList<TermComponent>();
2178          return this.group;
2179        }
2180
2181        /**
2182         * @return Returns a reference to <code>this</code> for easy method chaining
2183         */
2184        public TermComponent setGroup(List<TermComponent> theGroup) { 
2185          this.group = theGroup;
2186          return this;
2187        }
2188
2189        public boolean hasGroup() { 
2190          if (this.group == null)
2191            return false;
2192          for (TermComponent item : this.group)
2193            if (!item.isEmpty())
2194              return true;
2195          return false;
2196        }
2197
2198        public TermComponent addGroup() { //3
2199          TermComponent t = new TermComponent();
2200          if (this.group == null)
2201            this.group = new ArrayList<TermComponent>();
2202          this.group.add(t);
2203          return t;
2204        }
2205
2206        public TermComponent addGroup(TermComponent t) { //3
2207          if (t == null)
2208            return this;
2209          if (this.group == null)
2210            this.group = new ArrayList<TermComponent>();
2211          this.group.add(t);
2212          return this;
2213        }
2214
2215        /**
2216         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
2217         */
2218        public TermComponent getGroupFirstRep() { 
2219          if (getGroup().isEmpty()) {
2220            addGroup();
2221          }
2222          return getGroup().get(0);
2223        }
2224
2225        protected void listChildren(List<Property> children) {
2226          super.listChildren(children);
2227          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
2228          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
2229          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
2230          children.add(new Property("type", "CodeableConcept", "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.", 0, 1, type));
2231          children.add(new Property("subType", "CodeableConcept", "Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.", 0, 1, subType));
2232          children.add(new Property("topic", "Reference(Any)", "The matter of concern in the context of this provision of the agrement.", 0, java.lang.Integer.MAX_VALUE, topic));
2233          children.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, action));
2234          children.add(new Property("actionReason", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actionReason));
2235          children.add(new Property("securityLabel", "Coding", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
2236          children.add(new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent));
2237          children.add(new Property("text", "string", "Human readable form of this Contract Provision.", 0, 1, text));
2238          children.add(new Property("valuedItem", "", "Contract Provision Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
2239          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
2240        }
2241
2242        @Override
2243        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2244          switch (_hash) {
2245          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
2246          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
2247          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
2248          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.", 0, 1, type);
2249          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.", 0, 1, subType);
2250          case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The matter of concern in the context of this provision of the agrement.", 0, java.lang.Integer.MAX_VALUE, topic);
2251          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, action);
2252          case 1465121818: /*actionReason*/  return new Property("actionReason", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actionReason);
2253          case -722296940: /*securityLabel*/  return new Property("securityLabel", "Coding", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
2254          case 92750597: /*agent*/  return new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent);
2255          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Provision.", 0, 1, text);
2256          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Provision Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
2257          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
2258          default: return super.getNamedProperty(_hash, _name, _checkValid);
2259          }
2260
2261        }
2262
2263      @Override
2264      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2265        switch (hash) {
2266        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2267        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
2268        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
2269        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2270        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
2271        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // Reference
2272        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // CodeableConcept
2273        case 1465121818: /*actionReason*/ return this.actionReason == null ? new Base[0] : this.actionReason.toArray(new Base[this.actionReason.size()]); // CodeableConcept
2274        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
2275        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // TermAgentComponent
2276        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
2277        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // TermValuedItemComponent
2278        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
2279        default: return super.getProperty(hash, name, checkValid);
2280        }
2281
2282      }
2283
2284      @Override
2285      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2286        switch (hash) {
2287        case -1618432855: // identifier
2288          this.identifier = castToIdentifier(value); // Identifier
2289          return value;
2290        case -1179159893: // issued
2291          this.issued = castToDateTime(value); // DateTimeType
2292          return value;
2293        case -793235316: // applies
2294          this.applies = castToPeriod(value); // Period
2295          return value;
2296        case 3575610: // type
2297          this.type = castToCodeableConcept(value); // CodeableConcept
2298          return value;
2299        case -1868521062: // subType
2300          this.subType = castToCodeableConcept(value); // CodeableConcept
2301          return value;
2302        case 110546223: // topic
2303          this.getTopic().add(castToReference(value)); // Reference
2304          return value;
2305        case -1422950858: // action
2306          this.getAction().add(castToCodeableConcept(value)); // CodeableConcept
2307          return value;
2308        case 1465121818: // actionReason
2309          this.getActionReason().add(castToCodeableConcept(value)); // CodeableConcept
2310          return value;
2311        case -722296940: // securityLabel
2312          this.getSecurityLabel().add(castToCoding(value)); // Coding
2313          return value;
2314        case 92750597: // agent
2315          this.getAgent().add((TermAgentComponent) value); // TermAgentComponent
2316          return value;
2317        case 3556653: // text
2318          this.text = castToString(value); // StringType
2319          return value;
2320        case 2046675654: // valuedItem
2321          this.getValuedItem().add((TermValuedItemComponent) value); // TermValuedItemComponent
2322          return value;
2323        case 98629247: // group
2324          this.getGroup().add((TermComponent) value); // TermComponent
2325          return value;
2326        default: return super.setProperty(hash, name, value);
2327        }
2328
2329      }
2330
2331      @Override
2332      public Base setProperty(String name, Base value) throws FHIRException {
2333        if (name.equals("identifier")) {
2334          this.identifier = castToIdentifier(value); // Identifier
2335        } else if (name.equals("issued")) {
2336          this.issued = castToDateTime(value); // DateTimeType
2337        } else if (name.equals("applies")) {
2338          this.applies = castToPeriod(value); // Period
2339        } else if (name.equals("type")) {
2340          this.type = castToCodeableConcept(value); // CodeableConcept
2341        } else if (name.equals("subType")) {
2342          this.subType = castToCodeableConcept(value); // CodeableConcept
2343        } else if (name.equals("topic")) {
2344          this.getTopic().add(castToReference(value));
2345        } else if (name.equals("action")) {
2346          this.getAction().add(castToCodeableConcept(value));
2347        } else if (name.equals("actionReason")) {
2348          this.getActionReason().add(castToCodeableConcept(value));
2349        } else if (name.equals("securityLabel")) {
2350          this.getSecurityLabel().add(castToCoding(value));
2351        } else if (name.equals("agent")) {
2352          this.getAgent().add((TermAgentComponent) value);
2353        } else if (name.equals("text")) {
2354          this.text = castToString(value); // StringType
2355        } else if (name.equals("valuedItem")) {
2356          this.getValuedItem().add((TermValuedItemComponent) value);
2357        } else if (name.equals("group")) {
2358          this.getGroup().add((TermComponent) value);
2359        } else
2360          return super.setProperty(name, value);
2361        return value;
2362      }
2363
2364      @Override
2365      public Base makeProperty(int hash, String name) throws FHIRException {
2366        switch (hash) {
2367        case -1618432855:  return getIdentifier(); 
2368        case -1179159893:  return getIssuedElement();
2369        case -793235316:  return getApplies(); 
2370        case 3575610:  return getType(); 
2371        case -1868521062:  return getSubType(); 
2372        case 110546223:  return addTopic(); 
2373        case -1422950858:  return addAction(); 
2374        case 1465121818:  return addActionReason(); 
2375        case -722296940:  return addSecurityLabel(); 
2376        case 92750597:  return addAgent(); 
2377        case 3556653:  return getTextElement();
2378        case 2046675654:  return addValuedItem(); 
2379        case 98629247:  return addGroup(); 
2380        default: return super.makeProperty(hash, name);
2381        }
2382
2383      }
2384
2385      @Override
2386      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2387        switch (hash) {
2388        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2389        case -1179159893: /*issued*/ return new String[] {"dateTime"};
2390        case -793235316: /*applies*/ return new String[] {"Period"};
2391        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2392        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
2393        case 110546223: /*topic*/ return new String[] {"Reference"};
2394        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
2395        case 1465121818: /*actionReason*/ return new String[] {"CodeableConcept"};
2396        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
2397        case 92750597: /*agent*/ return new String[] {};
2398        case 3556653: /*text*/ return new String[] {"string"};
2399        case 2046675654: /*valuedItem*/ return new String[] {};
2400        case 98629247: /*group*/ return new String[] {"@Contract.term"};
2401        default: return super.getTypesForProperty(hash, name);
2402        }
2403
2404      }
2405
2406      @Override
2407      public Base addChild(String name) throws FHIRException {
2408        if (name.equals("identifier")) {
2409          this.identifier = new Identifier();
2410          return this.identifier;
2411        }
2412        else if (name.equals("issued")) {
2413          throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
2414        }
2415        else if (name.equals("applies")) {
2416          this.applies = new Period();
2417          return this.applies;
2418        }
2419        else if (name.equals("type")) {
2420          this.type = new CodeableConcept();
2421          return this.type;
2422        }
2423        else if (name.equals("subType")) {
2424          this.subType = new CodeableConcept();
2425          return this.subType;
2426        }
2427        else if (name.equals("topic")) {
2428          return addTopic();
2429        }
2430        else if (name.equals("action")) {
2431          return addAction();
2432        }
2433        else if (name.equals("actionReason")) {
2434          return addActionReason();
2435        }
2436        else if (name.equals("securityLabel")) {
2437          return addSecurityLabel();
2438        }
2439        else if (name.equals("agent")) {
2440          return addAgent();
2441        }
2442        else if (name.equals("text")) {
2443          throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
2444        }
2445        else if (name.equals("valuedItem")) {
2446          return addValuedItem();
2447        }
2448        else if (name.equals("group")) {
2449          return addGroup();
2450        }
2451        else
2452          return super.addChild(name);
2453      }
2454
2455      public TermComponent copy() {
2456        TermComponent dst = new TermComponent();
2457        copyValues(dst);
2458        dst.identifier = identifier == null ? null : identifier.copy();
2459        dst.issued = issued == null ? null : issued.copy();
2460        dst.applies = applies == null ? null : applies.copy();
2461        dst.type = type == null ? null : type.copy();
2462        dst.subType = subType == null ? null : subType.copy();
2463        if (topic != null) {
2464          dst.topic = new ArrayList<Reference>();
2465          for (Reference i : topic)
2466            dst.topic.add(i.copy());
2467        };
2468        if (action != null) {
2469          dst.action = new ArrayList<CodeableConcept>();
2470          for (CodeableConcept i : action)
2471            dst.action.add(i.copy());
2472        };
2473        if (actionReason != null) {
2474          dst.actionReason = new ArrayList<CodeableConcept>();
2475          for (CodeableConcept i : actionReason)
2476            dst.actionReason.add(i.copy());
2477        };
2478        if (securityLabel != null) {
2479          dst.securityLabel = new ArrayList<Coding>();
2480          for (Coding i : securityLabel)
2481            dst.securityLabel.add(i.copy());
2482        };
2483        if (agent != null) {
2484          dst.agent = new ArrayList<TermAgentComponent>();
2485          for (TermAgentComponent i : agent)
2486            dst.agent.add(i.copy());
2487        };
2488        dst.text = text == null ? null : text.copy();
2489        if (valuedItem != null) {
2490          dst.valuedItem = new ArrayList<TermValuedItemComponent>();
2491          for (TermValuedItemComponent i : valuedItem)
2492            dst.valuedItem.add(i.copy());
2493        };
2494        if (group != null) {
2495          dst.group = new ArrayList<TermComponent>();
2496          for (TermComponent i : group)
2497            dst.group.add(i.copy());
2498        };
2499        return dst;
2500      }
2501
2502      @Override
2503      public boolean equalsDeep(Base other_) {
2504        if (!super.equalsDeep(other_))
2505          return false;
2506        if (!(other_ instanceof TermComponent))
2507          return false;
2508        TermComponent o = (TermComponent) other_;
2509        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
2510           && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(topic, o.topic, true)
2511           && compareDeep(action, o.action, true) && compareDeep(actionReason, o.actionReason, true) && compareDeep(securityLabel, o.securityLabel, true)
2512           && compareDeep(agent, o.agent, true) && compareDeep(text, o.text, true) && compareDeep(valuedItem, o.valuedItem, true)
2513           && compareDeep(group, o.group, true);
2514      }
2515
2516      @Override
2517      public boolean equalsShallow(Base other_) {
2518        if (!super.equalsShallow(other_))
2519          return false;
2520        if (!(other_ instanceof TermComponent))
2521          return false;
2522        TermComponent o = (TermComponent) other_;
2523        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2524      }
2525
2526      public boolean isEmpty() {
2527        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2528          , type, subType, topic, action, actionReason, securityLabel, agent, text, valuedItem
2529          , group);
2530      }
2531
2532  public String fhirType() {
2533    return "Contract.term";
2534
2535  }
2536
2537  }
2538
2539    @Block()
2540    public static class TermAgentComponent extends BackboneElement implements IBaseBackboneElement {
2541        /**
2542         * The agent assigned a role in this Contract Provision.
2543         */
2544        @Child(name = "actor", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
2545        @Description(shortDefinition="Contract Term Agent Subject", formalDefinition="The agent assigned a role in this Contract Provision." )
2546        protected Reference actor;
2547
2548        /**
2549         * The actual object that is the target of the reference (The agent assigned a role in this Contract Provision.)
2550         */
2551        protected Resource actorTarget;
2552
2553        /**
2554         * Role played by the agent assigned this role in the execution of this Contract Provision.
2555         */
2556        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2557        @Description(shortDefinition="Type of the Contract Term Agent", formalDefinition="Role played by the agent assigned this role in the execution of this Contract Provision." )
2558        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
2559        protected List<CodeableConcept> role;
2560
2561        private static final long serialVersionUID = -454551165L;
2562
2563    /**
2564     * Constructor
2565     */
2566      public TermAgentComponent() {
2567        super();
2568      }
2569
2570    /**
2571     * Constructor
2572     */
2573      public TermAgentComponent(Reference actor) {
2574        super();
2575        this.actor = actor;
2576      }
2577
2578        /**
2579         * @return {@link #actor} (The agent assigned a role in this Contract Provision.)
2580         */
2581        public Reference getActor() { 
2582          if (this.actor == null)
2583            if (Configuration.errorOnAutoCreate())
2584              throw new Error("Attempt to auto-create TermAgentComponent.actor");
2585            else if (Configuration.doAutoCreate())
2586              this.actor = new Reference(); // cc
2587          return this.actor;
2588        }
2589
2590        public boolean hasActor() { 
2591          return this.actor != null && !this.actor.isEmpty();
2592        }
2593
2594        /**
2595         * @param value {@link #actor} (The agent assigned a role in this Contract Provision.)
2596         */
2597        public TermAgentComponent setActor(Reference value)  { 
2598          this.actor = value;
2599          return this;
2600        }
2601
2602        /**
2603         * @return {@link #actor} 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 agent assigned a role in this Contract Provision.)
2604         */
2605        public Resource getActorTarget() { 
2606          return this.actorTarget;
2607        }
2608
2609        /**
2610         * @param value {@link #actor} 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 agent assigned a role in this Contract Provision.)
2611         */
2612        public TermAgentComponent setActorTarget(Resource value) { 
2613          this.actorTarget = value;
2614          return this;
2615        }
2616
2617        /**
2618         * @return {@link #role} (Role played by the agent assigned this role in the execution of this Contract Provision.)
2619         */
2620        public List<CodeableConcept> getRole() { 
2621          if (this.role == null)
2622            this.role = new ArrayList<CodeableConcept>();
2623          return this.role;
2624        }
2625
2626        /**
2627         * @return Returns a reference to <code>this</code> for easy method chaining
2628         */
2629        public TermAgentComponent setRole(List<CodeableConcept> theRole) { 
2630          this.role = theRole;
2631          return this;
2632        }
2633
2634        public boolean hasRole() { 
2635          if (this.role == null)
2636            return false;
2637          for (CodeableConcept item : this.role)
2638            if (!item.isEmpty())
2639              return true;
2640          return false;
2641        }
2642
2643        public CodeableConcept addRole() { //3
2644          CodeableConcept t = new CodeableConcept();
2645          if (this.role == null)
2646            this.role = new ArrayList<CodeableConcept>();
2647          this.role.add(t);
2648          return t;
2649        }
2650
2651        public TermAgentComponent addRole(CodeableConcept t) { //3
2652          if (t == null)
2653            return this;
2654          if (this.role == null)
2655            this.role = new ArrayList<CodeableConcept>();
2656          this.role.add(t);
2657          return this;
2658        }
2659
2660        /**
2661         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
2662         */
2663        public CodeableConcept getRoleFirstRep() { 
2664          if (getRole().isEmpty()) {
2665            addRole();
2666          }
2667          return getRole().get(0);
2668        }
2669
2670        protected void listChildren(List<Property> children) {
2671          super.listChildren(children);
2672          children.add(new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The agent assigned a role in this Contract Provision.", 0, 1, actor));
2673          children.add(new Property("role", "CodeableConcept", "Role played by the agent assigned this role in the execution of this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role));
2674        }
2675
2676        @Override
2677        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2678          switch (_hash) {
2679          case 92645877: /*actor*/  return new Property("actor", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The agent assigned a role in this Contract Provision.", 0, 1, actor);
2680          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role played by the agent assigned this role in the execution of this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role);
2681          default: return super.getNamedProperty(_hash, _name, _checkValid);
2682          }
2683
2684        }
2685
2686      @Override
2687      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2688        switch (hash) {
2689        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
2690        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
2691        default: return super.getProperty(hash, name, checkValid);
2692        }
2693
2694      }
2695
2696      @Override
2697      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2698        switch (hash) {
2699        case 92645877: // actor
2700          this.actor = castToReference(value); // Reference
2701          return value;
2702        case 3506294: // role
2703          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
2704          return value;
2705        default: return super.setProperty(hash, name, value);
2706        }
2707
2708      }
2709
2710      @Override
2711      public Base setProperty(String name, Base value) throws FHIRException {
2712        if (name.equals("actor")) {
2713          this.actor = castToReference(value); // Reference
2714        } else if (name.equals("role")) {
2715          this.getRole().add(castToCodeableConcept(value));
2716        } else
2717          return super.setProperty(name, value);
2718        return value;
2719      }
2720
2721      @Override
2722      public Base makeProperty(int hash, String name) throws FHIRException {
2723        switch (hash) {
2724        case 92645877:  return getActor(); 
2725        case 3506294:  return addRole(); 
2726        default: return super.makeProperty(hash, name);
2727        }
2728
2729      }
2730
2731      @Override
2732      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2733        switch (hash) {
2734        case 92645877: /*actor*/ return new String[] {"Reference"};
2735        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2736        default: return super.getTypesForProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public Base addChild(String name) throws FHIRException {
2743        if (name.equals("actor")) {
2744          this.actor = new Reference();
2745          return this.actor;
2746        }
2747        else if (name.equals("role")) {
2748          return addRole();
2749        }
2750        else
2751          return super.addChild(name);
2752      }
2753
2754      public TermAgentComponent copy() {
2755        TermAgentComponent dst = new TermAgentComponent();
2756        copyValues(dst);
2757        dst.actor = actor == null ? null : actor.copy();
2758        if (role != null) {
2759          dst.role = new ArrayList<CodeableConcept>();
2760          for (CodeableConcept i : role)
2761            dst.role.add(i.copy());
2762        };
2763        return dst;
2764      }
2765
2766      @Override
2767      public boolean equalsDeep(Base other_) {
2768        if (!super.equalsDeep(other_))
2769          return false;
2770        if (!(other_ instanceof TermAgentComponent))
2771          return false;
2772        TermAgentComponent o = (TermAgentComponent) other_;
2773        return compareDeep(actor, o.actor, true) && compareDeep(role, o.role, true);
2774      }
2775
2776      @Override
2777      public boolean equalsShallow(Base other_) {
2778        if (!super.equalsShallow(other_))
2779          return false;
2780        if (!(other_ instanceof TermAgentComponent))
2781          return false;
2782        TermAgentComponent o = (TermAgentComponent) other_;
2783        return true;
2784      }
2785
2786      public boolean isEmpty() {
2787        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actor, role);
2788      }
2789
2790  public String fhirType() {
2791    return "Contract.term.agent";
2792
2793  }
2794
2795  }
2796
2797    @Block()
2798    public static class TermValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
2799        /**
2800         * Specific type of Contract Provision Valued Item that may be priced.
2801         */
2802        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
2803        @Description(shortDefinition="Contract Term Valued Item Type", formalDefinition="Specific type of Contract Provision Valued Item that may be priced." )
2804        protected Type entity;
2805
2806        /**
2807         * Identifies a Contract Provision Valued Item instance.
2808         */
2809        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
2810        @Description(shortDefinition="Contract Term Valued Item Number", formalDefinition="Identifies a Contract Provision Valued Item instance." )
2811        protected Identifier identifier;
2812
2813        /**
2814         * Indicates the time during which this Contract Term ValuedItem information is effective.
2815         */
2816        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2817        @Description(shortDefinition="Contract Term Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract Term ValuedItem information is effective." )
2818        protected DateTimeType effectiveTime;
2819
2820        /**
2821         * Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.
2822         */
2823        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
2824        @Description(shortDefinition="Contract Term Valued Item Count", formalDefinition="Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances." )
2825        protected SimpleQuantity quantity;
2826
2827        /**
2828         * A Contract Provision Valued Item unit valuation measure.
2829         */
2830        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
2831        @Description(shortDefinition="Contract Term Valued Item fee, charge, or cost", formalDefinition="A Contract Provision Valued Item unit valuation measure." )
2832        protected Money unitPrice;
2833
2834        /**
2835         * A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2836         */
2837        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2838        @Description(shortDefinition="Contract Term Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
2839        protected DecimalType factor;
2840
2841        /**
2842         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
2843         */
2844        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
2845        @Description(shortDefinition="Contract Term Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point." )
2846        protected DecimalType points;
2847
2848        /**
2849         * Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
2850         */
2851        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
2852        @Description(shortDefinition="Total Contract Term Valued Item Value", formalDefinition="Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
2853        protected Money net;
2854
2855        private static final long serialVersionUID = 1782449516L;
2856
2857    /**
2858     * Constructor
2859     */
2860      public TermValuedItemComponent() {
2861        super();
2862      }
2863
2864        /**
2865         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2866         */
2867        public Type getEntity() { 
2868          return this.entity;
2869        }
2870
2871        /**
2872         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2873         */
2874        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
2875          if (this.entity == null)
2876            return null;
2877          if (!(this.entity instanceof CodeableConcept))
2878            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
2879          return (CodeableConcept) this.entity;
2880        }
2881
2882        public boolean hasEntityCodeableConcept() {
2883          return this.entity instanceof CodeableConcept;
2884        }
2885
2886        /**
2887         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2888         */
2889        public Reference getEntityReference() throws FHIRException { 
2890          if (this.entity == null)
2891            return null;
2892          if (!(this.entity instanceof Reference))
2893            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
2894          return (Reference) this.entity;
2895        }
2896
2897        public boolean hasEntityReference() {
2898          return this.entity instanceof Reference;
2899        }
2900
2901        public boolean hasEntity() { 
2902          return this.entity != null && !this.entity.isEmpty();
2903        }
2904
2905        /**
2906         * @param value {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
2907         */
2908        public TermValuedItemComponent setEntity(Type value) throws FHIRFormatError { 
2909          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2910            throw new FHIRFormatError("Not the right type for Contract.term.valuedItem.entity[x]: "+value.fhirType());
2911          this.entity = value;
2912          return this;
2913        }
2914
2915        /**
2916         * @return {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
2917         */
2918        public Identifier getIdentifier() { 
2919          if (this.identifier == null)
2920            if (Configuration.errorOnAutoCreate())
2921              throw new Error("Attempt to auto-create TermValuedItemComponent.identifier");
2922            else if (Configuration.doAutoCreate())
2923              this.identifier = new Identifier(); // cc
2924          return this.identifier;
2925        }
2926
2927        public boolean hasIdentifier() { 
2928          return this.identifier != null && !this.identifier.isEmpty();
2929        }
2930
2931        /**
2932         * @param value {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
2933         */
2934        public TermValuedItemComponent setIdentifier(Identifier value)  { 
2935          this.identifier = value;
2936          return this;
2937        }
2938
2939        /**
2940         * @return {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
2941         */
2942        public DateTimeType getEffectiveTimeElement() { 
2943          if (this.effectiveTime == null)
2944            if (Configuration.errorOnAutoCreate())
2945              throw new Error("Attempt to auto-create TermValuedItemComponent.effectiveTime");
2946            else if (Configuration.doAutoCreate())
2947              this.effectiveTime = new DateTimeType(); // bb
2948          return this.effectiveTime;
2949        }
2950
2951        public boolean hasEffectiveTimeElement() { 
2952          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
2953        }
2954
2955        public boolean hasEffectiveTime() { 
2956          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
2957        }
2958
2959        /**
2960         * @param value {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
2961         */
2962        public TermValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
2963          this.effectiveTime = value;
2964          return this;
2965        }
2966
2967        /**
2968         * @return Indicates the time during which this Contract Term ValuedItem information is effective.
2969         */
2970        public Date getEffectiveTime() { 
2971          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
2972        }
2973
2974        /**
2975         * @param value Indicates the time during which this Contract Term ValuedItem information is effective.
2976         */
2977        public TermValuedItemComponent setEffectiveTime(Date value) { 
2978          if (value == null)
2979            this.effectiveTime = null;
2980          else {
2981            if (this.effectiveTime == null)
2982              this.effectiveTime = new DateTimeType();
2983            this.effectiveTime.setValue(value);
2984          }
2985          return this;
2986        }
2987
2988        /**
2989         * @return {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
2990         */
2991        public SimpleQuantity getQuantity() { 
2992          if (this.quantity == null)
2993            if (Configuration.errorOnAutoCreate())
2994              throw new Error("Attempt to auto-create TermValuedItemComponent.quantity");
2995            else if (Configuration.doAutoCreate())
2996              this.quantity = new SimpleQuantity(); // cc
2997          return this.quantity;
2998        }
2999
3000        public boolean hasQuantity() { 
3001          return this.quantity != null && !this.quantity.isEmpty();
3002        }
3003
3004        /**
3005         * @param value {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
3006         */
3007        public TermValuedItemComponent setQuantity(SimpleQuantity value)  { 
3008          this.quantity = value;
3009          return this;
3010        }
3011
3012        /**
3013         * @return {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
3014         */
3015        public Money getUnitPrice() { 
3016          if (this.unitPrice == null)
3017            if (Configuration.errorOnAutoCreate())
3018              throw new Error("Attempt to auto-create TermValuedItemComponent.unitPrice");
3019            else if (Configuration.doAutoCreate())
3020              this.unitPrice = new Money(); // cc
3021          return this.unitPrice;
3022        }
3023
3024        public boolean hasUnitPrice() { 
3025          return this.unitPrice != null && !this.unitPrice.isEmpty();
3026        }
3027
3028        /**
3029         * @param value {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
3030         */
3031        public TermValuedItemComponent setUnitPrice(Money value)  { 
3032          this.unitPrice = value;
3033          return this;
3034        }
3035
3036        /**
3037         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3038         */
3039        public DecimalType getFactorElement() { 
3040          if (this.factor == null)
3041            if (Configuration.errorOnAutoCreate())
3042              throw new Error("Attempt to auto-create TermValuedItemComponent.factor");
3043            else if (Configuration.doAutoCreate())
3044              this.factor = new DecimalType(); // bb
3045          return this.factor;
3046        }
3047
3048        public boolean hasFactorElement() { 
3049          return this.factor != null && !this.factor.isEmpty();
3050        }
3051
3052        public boolean hasFactor() { 
3053          return this.factor != null && !this.factor.isEmpty();
3054        }
3055
3056        /**
3057         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3058         */
3059        public TermValuedItemComponent setFactorElement(DecimalType value) { 
3060          this.factor = value;
3061          return this;
3062        }
3063
3064        /**
3065         * @return A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3066         */
3067        public BigDecimal getFactor() { 
3068          return this.factor == null ? null : this.factor.getValue();
3069        }
3070
3071        /**
3072         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3073         */
3074        public TermValuedItemComponent setFactor(BigDecimal value) { 
3075          if (value == null)
3076            this.factor = null;
3077          else {
3078            if (this.factor == null)
3079              this.factor = new DecimalType();
3080            this.factor.setValue(value);
3081          }
3082          return this;
3083        }
3084
3085        /**
3086         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3087         */
3088        public TermValuedItemComponent setFactor(long value) { 
3089              this.factor = new DecimalType();
3090            this.factor.setValue(value);
3091          return this;
3092        }
3093
3094        /**
3095         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3096         */
3097        public TermValuedItemComponent setFactor(double value) { 
3098              this.factor = new DecimalType();
3099            this.factor.setValue(value);
3100          return this;
3101        }
3102
3103        /**
3104         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3105         */
3106        public DecimalType getPointsElement() { 
3107          if (this.points == null)
3108            if (Configuration.errorOnAutoCreate())
3109              throw new Error("Attempt to auto-create TermValuedItemComponent.points");
3110            else if (Configuration.doAutoCreate())
3111              this.points = new DecimalType(); // bb
3112          return this.points;
3113        }
3114
3115        public boolean hasPointsElement() { 
3116          return this.points != null && !this.points.isEmpty();
3117        }
3118
3119        public boolean hasPoints() { 
3120          return this.points != null && !this.points.isEmpty();
3121        }
3122
3123        /**
3124         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3125         */
3126        public TermValuedItemComponent setPointsElement(DecimalType value) { 
3127          this.points = value;
3128          return this;
3129        }
3130
3131        /**
3132         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3133         */
3134        public BigDecimal getPoints() { 
3135          return this.points == null ? null : this.points.getValue();
3136        }
3137
3138        /**
3139         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3140         */
3141        public TermValuedItemComponent setPoints(BigDecimal value) { 
3142          if (value == null)
3143            this.points = null;
3144          else {
3145            if (this.points == null)
3146              this.points = new DecimalType();
3147            this.points.setValue(value);
3148          }
3149          return this;
3150        }
3151
3152        /**
3153         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3154         */
3155        public TermValuedItemComponent setPoints(long value) { 
3156              this.points = new DecimalType();
3157            this.points.setValue(value);
3158          return this;
3159        }
3160
3161        /**
3162         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
3163         */
3164        public TermValuedItemComponent setPoints(double value) { 
3165              this.points = new DecimalType();
3166            this.points.setValue(value);
3167          return this;
3168        }
3169
3170        /**
3171         * @return {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3172         */
3173        public Money getNet() { 
3174          if (this.net == null)
3175            if (Configuration.errorOnAutoCreate())
3176              throw new Error("Attempt to auto-create TermValuedItemComponent.net");
3177            else if (Configuration.doAutoCreate())
3178              this.net = new Money(); // cc
3179          return this.net;
3180        }
3181
3182        public boolean hasNet() { 
3183          return this.net != null && !this.net.isEmpty();
3184        }
3185
3186        /**
3187         * @param value {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3188         */
3189        public TermValuedItemComponent setNet(Money value)  { 
3190          this.net = value;
3191          return this;
3192        }
3193
3194        protected void listChildren(List<Property> children) {
3195          super.listChildren(children);
3196          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity));
3197          children.add(new Property("identifier", "Identifier", "Identifies a Contract Provision Valued Item instance.", 0, 1, identifier));
3198          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract Term ValuedItem information is effective.", 0, 1, effectiveTime));
3199          children.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.", 0, 1, quantity));
3200          children.add(new Property("unitPrice", "Money", "A Contract Provision Valued Item unit valuation measure.", 0, 1, unitPrice));
3201          children.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor));
3202          children.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.", 0, 1, points));
3203          children.add(new Property("net", "Money", "Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
3204        }
3205
3206        @Override
3207        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3208          switch (_hash) {
3209          case -740568643: /*entity[x]*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3210          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3211          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3212          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, 1, entity);
3213          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Provision Valued Item instance.", 0, 1, identifier);
3214          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract Term ValuedItem information is effective.", 0, 1, effectiveTime);
3215          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.", 0, 1, quantity);
3216          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Provision Valued Item unit valuation measure.", 0, 1, unitPrice);
3217          case -1282148017: /*factor*/  return new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, 1, factor);
3218          case -982754077: /*points*/  return new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.", 0, 1, points);
3219          case 108957: /*net*/  return new Property("net", "Money", "Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
3220          default: return super.getNamedProperty(_hash, _name, _checkValid);
3221          }
3222
3223        }
3224
3225      @Override
3226      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3227        switch (hash) {
3228        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
3229        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3230        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
3231        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
3232        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
3233        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
3234        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
3235        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
3236        default: return super.getProperty(hash, name, checkValid);
3237        }
3238
3239      }
3240
3241      @Override
3242      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3243        switch (hash) {
3244        case -1298275357: // entity
3245          this.entity = castToType(value); // Type
3246          return value;
3247        case -1618432855: // identifier
3248          this.identifier = castToIdentifier(value); // Identifier
3249          return value;
3250        case -929905388: // effectiveTime
3251          this.effectiveTime = castToDateTime(value); // DateTimeType
3252          return value;
3253        case -1285004149: // quantity
3254          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3255          return value;
3256        case -486196699: // unitPrice
3257          this.unitPrice = castToMoney(value); // Money
3258          return value;
3259        case -1282148017: // factor
3260          this.factor = castToDecimal(value); // DecimalType
3261          return value;
3262        case -982754077: // points
3263          this.points = castToDecimal(value); // DecimalType
3264          return value;
3265        case 108957: // net
3266          this.net = castToMoney(value); // Money
3267          return value;
3268        default: return super.setProperty(hash, name, value);
3269        }
3270
3271      }
3272
3273      @Override
3274      public Base setProperty(String name, Base value) throws FHIRException {
3275        if (name.equals("entity[x]")) {
3276          this.entity = castToType(value); // Type
3277        } else if (name.equals("identifier")) {
3278          this.identifier = castToIdentifier(value); // Identifier
3279        } else if (name.equals("effectiveTime")) {
3280          this.effectiveTime = castToDateTime(value); // DateTimeType
3281        } else if (name.equals("quantity")) {
3282          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3283        } else if (name.equals("unitPrice")) {
3284          this.unitPrice = castToMoney(value); // Money
3285        } else if (name.equals("factor")) {
3286          this.factor = castToDecimal(value); // DecimalType
3287        } else if (name.equals("points")) {
3288          this.points = castToDecimal(value); // DecimalType
3289        } else if (name.equals("net")) {
3290          this.net = castToMoney(value); // Money
3291        } else
3292          return super.setProperty(name, value);
3293        return value;
3294      }
3295
3296      @Override
3297      public Base makeProperty(int hash, String name) throws FHIRException {
3298        switch (hash) {
3299        case -740568643:  return getEntity(); 
3300        case -1298275357:  return getEntity(); 
3301        case -1618432855:  return getIdentifier(); 
3302        case -929905388:  return getEffectiveTimeElement();
3303        case -1285004149:  return getQuantity(); 
3304        case -486196699:  return getUnitPrice(); 
3305        case -1282148017:  return getFactorElement();
3306        case -982754077:  return getPointsElement();
3307        case 108957:  return getNet(); 
3308        default: return super.makeProperty(hash, name);
3309        }
3310
3311      }
3312
3313      @Override
3314      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3315        switch (hash) {
3316        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
3317        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3318        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
3319        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
3320        case -486196699: /*unitPrice*/ return new String[] {"Money"};
3321        case -1282148017: /*factor*/ return new String[] {"decimal"};
3322        case -982754077: /*points*/ return new String[] {"decimal"};
3323        case 108957: /*net*/ return new String[] {"Money"};
3324        default: return super.getTypesForProperty(hash, name);
3325        }
3326
3327      }
3328
3329      @Override
3330      public Base addChild(String name) throws FHIRException {
3331        if (name.equals("entityCodeableConcept")) {
3332          this.entity = new CodeableConcept();
3333          return this.entity;
3334        }
3335        else if (name.equals("entityReference")) {
3336          this.entity = new Reference();
3337          return this.entity;
3338        }
3339        else if (name.equals("identifier")) {
3340          this.identifier = new Identifier();
3341          return this.identifier;
3342        }
3343        else if (name.equals("effectiveTime")) {
3344          throw new FHIRException("Cannot call addChild on a singleton property Contract.effectiveTime");
3345        }
3346        else if (name.equals("quantity")) {
3347          this.quantity = new SimpleQuantity();
3348          return this.quantity;
3349        }
3350        else if (name.equals("unitPrice")) {
3351          this.unitPrice = new Money();
3352          return this.unitPrice;
3353        }
3354        else if (name.equals("factor")) {
3355          throw new FHIRException("Cannot call addChild on a singleton property Contract.factor");
3356        }
3357        else if (name.equals("points")) {
3358          throw new FHIRException("Cannot call addChild on a singleton property Contract.points");
3359        }
3360        else if (name.equals("net")) {
3361          this.net = new Money();
3362          return this.net;
3363        }
3364        else
3365          return super.addChild(name);
3366      }
3367
3368      public TermValuedItemComponent copy() {
3369        TermValuedItemComponent dst = new TermValuedItemComponent();
3370        copyValues(dst);
3371        dst.entity = entity == null ? null : entity.copy();
3372        dst.identifier = identifier == null ? null : identifier.copy();
3373        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
3374        dst.quantity = quantity == null ? null : quantity.copy();
3375        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
3376        dst.factor = factor == null ? null : factor.copy();
3377        dst.points = points == null ? null : points.copy();
3378        dst.net = net == null ? null : net.copy();
3379        return dst;
3380      }
3381
3382      @Override
3383      public boolean equalsDeep(Base other_) {
3384        if (!super.equalsDeep(other_))
3385          return false;
3386        if (!(other_ instanceof TermValuedItemComponent))
3387          return false;
3388        TermValuedItemComponent o = (TermValuedItemComponent) other_;
3389        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
3390           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
3391           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
3392      }
3393
3394      @Override
3395      public boolean equalsShallow(Base other_) {
3396        if (!super.equalsShallow(other_))
3397          return false;
3398        if (!(other_ instanceof TermValuedItemComponent))
3399          return false;
3400        TermValuedItemComponent o = (TermValuedItemComponent) other_;
3401        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
3402           && compareValues(points, o.points, true);
3403      }
3404
3405      public boolean isEmpty() {
3406        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
3407          , quantity, unitPrice, factor, points, net);
3408      }
3409
3410  public String fhirType() {
3411    return "Contract.term.valuedItem";
3412
3413  }
3414
3415  }
3416
3417    @Block()
3418    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3419        /**
3420         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
3421         */
3422        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
3423        @Description(shortDefinition="Easily comprehended representation of this Contract", formalDefinition="Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability." )
3424        protected Type content;
3425
3426        private static final long serialVersionUID = -1763459053L;
3427
3428    /**
3429     * Constructor
3430     */
3431      public FriendlyLanguageComponent() {
3432        super();
3433      }
3434
3435    /**
3436     * Constructor
3437     */
3438      public FriendlyLanguageComponent(Type content) {
3439        super();
3440        this.content = content;
3441      }
3442
3443        /**
3444         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3445         */
3446        public Type getContent() { 
3447          return this.content;
3448        }
3449
3450        /**
3451         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3452         */
3453        public Attachment getContentAttachment() throws FHIRException { 
3454          if (this.content == null)
3455            return null;
3456          if (!(this.content instanceof Attachment))
3457            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3458          return (Attachment) this.content;
3459        }
3460
3461        public boolean hasContentAttachment() {
3462          return this.content instanceof Attachment;
3463        }
3464
3465        /**
3466         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3467         */
3468        public Reference getContentReference() throws FHIRException { 
3469          if (this.content == null)
3470            return null;
3471          if (!(this.content instanceof Reference))
3472            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3473          return (Reference) this.content;
3474        }
3475
3476        public boolean hasContentReference() {
3477          return this.content instanceof Reference;
3478        }
3479
3480        public boolean hasContent() { 
3481          return this.content != null && !this.content.isEmpty();
3482        }
3483
3484        /**
3485         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
3486         */
3487        public FriendlyLanguageComponent setContent(Type value) throws FHIRFormatError { 
3488          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3489            throw new FHIRFormatError("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
3490          this.content = value;
3491          return this;
3492        }
3493
3494        protected void listChildren(List<Property> children) {
3495          super.listChildren(children);
3496          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content));
3497        }
3498
3499        @Override
3500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3501          switch (_hash) {
3502          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3503          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3504          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3505          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
3506          default: return super.getNamedProperty(_hash, _name, _checkValid);
3507          }
3508
3509        }
3510
3511      @Override
3512      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3513        switch (hash) {
3514        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3515        default: return super.getProperty(hash, name, checkValid);
3516        }
3517
3518      }
3519
3520      @Override
3521      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3522        switch (hash) {
3523        case 951530617: // content
3524          this.content = castToType(value); // Type
3525          return value;
3526        default: return super.setProperty(hash, name, value);
3527        }
3528
3529      }
3530
3531      @Override
3532      public Base setProperty(String name, Base value) throws FHIRException {
3533        if (name.equals("content[x]")) {
3534          this.content = castToType(value); // Type
3535        } else
3536          return super.setProperty(name, value);
3537        return value;
3538      }
3539
3540      @Override
3541      public Base makeProperty(int hash, String name) throws FHIRException {
3542        switch (hash) {
3543        case 264548711:  return getContent(); 
3544        case 951530617:  return getContent(); 
3545        default: return super.makeProperty(hash, name);
3546        }
3547
3548      }
3549
3550      @Override
3551      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3552        switch (hash) {
3553        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3554        default: return super.getTypesForProperty(hash, name);
3555        }
3556
3557      }
3558
3559      @Override
3560      public Base addChild(String name) throws FHIRException {
3561        if (name.equals("contentAttachment")) {
3562          this.content = new Attachment();
3563          return this.content;
3564        }
3565        else if (name.equals("contentReference")) {
3566          this.content = new Reference();
3567          return this.content;
3568        }
3569        else
3570          return super.addChild(name);
3571      }
3572
3573      public FriendlyLanguageComponent copy() {
3574        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
3575        copyValues(dst);
3576        dst.content = content == null ? null : content.copy();
3577        return dst;
3578      }
3579
3580      @Override
3581      public boolean equalsDeep(Base other_) {
3582        if (!super.equalsDeep(other_))
3583          return false;
3584        if (!(other_ instanceof FriendlyLanguageComponent))
3585          return false;
3586        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
3587        return compareDeep(content, o.content, true);
3588      }
3589
3590      @Override
3591      public boolean equalsShallow(Base other_) {
3592        if (!super.equalsShallow(other_))
3593          return false;
3594        if (!(other_ instanceof FriendlyLanguageComponent))
3595          return false;
3596        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
3597        return true;
3598      }
3599
3600      public boolean isEmpty() {
3601        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3602      }
3603
3604  public String fhirType() {
3605    return "Contract.friendly";
3606
3607  }
3608
3609  }
3610
3611    @Block()
3612    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3613        /**
3614         * Contract legal text in human renderable form.
3615         */
3616        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
3617        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
3618        protected Type content;
3619
3620        private static final long serialVersionUID = -1763459053L;
3621
3622    /**
3623     * Constructor
3624     */
3625      public LegalLanguageComponent() {
3626        super();
3627      }
3628
3629    /**
3630     * Constructor
3631     */
3632      public LegalLanguageComponent(Type content) {
3633        super();
3634        this.content = content;
3635      }
3636
3637        /**
3638         * @return {@link #content} (Contract legal text in human renderable form.)
3639         */
3640        public Type getContent() { 
3641          return this.content;
3642        }
3643
3644        /**
3645         * @return {@link #content} (Contract legal text in human renderable form.)
3646         */
3647        public Attachment getContentAttachment() throws FHIRException { 
3648          if (this.content == null)
3649            return null;
3650          if (!(this.content instanceof Attachment))
3651            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3652          return (Attachment) this.content;
3653        }
3654
3655        public boolean hasContentAttachment() {
3656          return this.content instanceof Attachment;
3657        }
3658
3659        /**
3660         * @return {@link #content} (Contract legal text in human renderable form.)
3661         */
3662        public Reference getContentReference() throws FHIRException { 
3663          if (this.content == null)
3664            return null;
3665          if (!(this.content instanceof Reference))
3666            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3667          return (Reference) this.content;
3668        }
3669
3670        public boolean hasContentReference() {
3671          return this.content instanceof Reference;
3672        }
3673
3674        public boolean hasContent() { 
3675          return this.content != null && !this.content.isEmpty();
3676        }
3677
3678        /**
3679         * @param value {@link #content} (Contract legal text in human renderable form.)
3680         */
3681        public LegalLanguageComponent setContent(Type value) throws FHIRFormatError { 
3682          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3683            throw new FHIRFormatError("Not the right type for Contract.legal.content[x]: "+value.fhirType());
3684          this.content = value;
3685          return this;
3686        }
3687
3688        protected void listChildren(List<Property> children) {
3689          super.listChildren(children);
3690          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
3691        }
3692
3693        @Override
3694        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3695          switch (_hash) {
3696          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3697          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3698          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3699          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
3700          default: return super.getNamedProperty(_hash, _name, _checkValid);
3701          }
3702
3703        }
3704
3705      @Override
3706      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3707        switch (hash) {
3708        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3709        default: return super.getProperty(hash, name, checkValid);
3710        }
3711
3712      }
3713
3714      @Override
3715      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3716        switch (hash) {
3717        case 951530617: // content
3718          this.content = castToType(value); // Type
3719          return value;
3720        default: return super.setProperty(hash, name, value);
3721        }
3722
3723      }
3724
3725      @Override
3726      public Base setProperty(String name, Base value) throws FHIRException {
3727        if (name.equals("content[x]")) {
3728          this.content = castToType(value); // Type
3729        } else
3730          return super.setProperty(name, value);
3731        return value;
3732      }
3733
3734      @Override
3735      public Base makeProperty(int hash, String name) throws FHIRException {
3736        switch (hash) {
3737        case 264548711:  return getContent(); 
3738        case 951530617:  return getContent(); 
3739        default: return super.makeProperty(hash, name);
3740        }
3741
3742      }
3743
3744      @Override
3745      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3746        switch (hash) {
3747        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3748        default: return super.getTypesForProperty(hash, name);
3749        }
3750
3751      }
3752
3753      @Override
3754      public Base addChild(String name) throws FHIRException {
3755        if (name.equals("contentAttachment")) {
3756          this.content = new Attachment();
3757          return this.content;
3758        }
3759        else if (name.equals("contentReference")) {
3760          this.content = new Reference();
3761          return this.content;
3762        }
3763        else
3764          return super.addChild(name);
3765      }
3766
3767      public LegalLanguageComponent copy() {
3768        LegalLanguageComponent dst = new LegalLanguageComponent();
3769        copyValues(dst);
3770        dst.content = content == null ? null : content.copy();
3771        return dst;
3772      }
3773
3774      @Override
3775      public boolean equalsDeep(Base other_) {
3776        if (!super.equalsDeep(other_))
3777          return false;
3778        if (!(other_ instanceof LegalLanguageComponent))
3779          return false;
3780        LegalLanguageComponent o = (LegalLanguageComponent) other_;
3781        return compareDeep(content, o.content, true);
3782      }
3783
3784      @Override
3785      public boolean equalsShallow(Base other_) {
3786        if (!super.equalsShallow(other_))
3787          return false;
3788        if (!(other_ instanceof LegalLanguageComponent))
3789          return false;
3790        LegalLanguageComponent o = (LegalLanguageComponent) other_;
3791        return true;
3792      }
3793
3794      public boolean isEmpty() {
3795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3796      }
3797
3798  public String fhirType() {
3799    return "Contract.legal";
3800
3801  }
3802
3803  }
3804
3805    @Block()
3806    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
3807        /**
3808         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
3809         */
3810        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
3811        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
3812        protected Type content;
3813
3814        private static final long serialVersionUID = -1763459053L;
3815
3816    /**
3817     * Constructor
3818     */
3819      public ComputableLanguageComponent() {
3820        super();
3821      }
3822
3823    /**
3824     * Constructor
3825     */
3826      public ComputableLanguageComponent(Type content) {
3827        super();
3828        this.content = content;
3829      }
3830
3831        /**
3832         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3833         */
3834        public Type getContent() { 
3835          return this.content;
3836        }
3837
3838        /**
3839         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3840         */
3841        public Attachment getContentAttachment() throws FHIRException { 
3842          if (this.content == null)
3843            return null;
3844          if (!(this.content instanceof Attachment))
3845            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
3846          return (Attachment) this.content;
3847        }
3848
3849        public boolean hasContentAttachment() {
3850          return this.content instanceof Attachment;
3851        }
3852
3853        /**
3854         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3855         */
3856        public Reference getContentReference() throws FHIRException { 
3857          if (this.content == null)
3858            return null;
3859          if (!(this.content instanceof Reference))
3860            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
3861          return (Reference) this.content;
3862        }
3863
3864        public boolean hasContentReference() {
3865          return this.content instanceof Reference;
3866        }
3867
3868        public boolean hasContent() { 
3869          return this.content != null && !this.content.isEmpty();
3870        }
3871
3872        /**
3873         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
3874         */
3875        public ComputableLanguageComponent setContent(Type value) throws FHIRFormatError { 
3876          if (value != null && !(value instanceof Attachment || value instanceof Reference))
3877            throw new FHIRFormatError("Not the right type for Contract.rule.content[x]: "+value.fhirType());
3878          this.content = value;
3879          return this;
3880        }
3881
3882        protected void listChildren(List<Property> children) {
3883          super.listChildren(children);
3884          children.add(new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content));
3885        }
3886
3887        @Override
3888        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3889          switch (_hash) {
3890          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3891          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3892          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3893          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
3894          default: return super.getNamedProperty(_hash, _name, _checkValid);
3895          }
3896
3897        }
3898
3899      @Override
3900      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3901        switch (hash) {
3902        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
3903        default: return super.getProperty(hash, name, checkValid);
3904        }
3905
3906      }
3907
3908      @Override
3909      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3910        switch (hash) {
3911        case 951530617: // content
3912          this.content = castToType(value); // Type
3913          return value;
3914        default: return super.setProperty(hash, name, value);
3915        }
3916
3917      }
3918
3919      @Override
3920      public Base setProperty(String name, Base value) throws FHIRException {
3921        if (name.equals("content[x]")) {
3922          this.content = castToType(value); // Type
3923        } else
3924          return super.setProperty(name, value);
3925        return value;
3926      }
3927
3928      @Override
3929      public Base makeProperty(int hash, String name) throws FHIRException {
3930        switch (hash) {
3931        case 264548711:  return getContent(); 
3932        case 951530617:  return getContent(); 
3933        default: return super.makeProperty(hash, name);
3934        }
3935
3936      }
3937
3938      @Override
3939      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3940        switch (hash) {
3941        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
3942        default: return super.getTypesForProperty(hash, name);
3943        }
3944
3945      }
3946
3947      @Override
3948      public Base addChild(String name) throws FHIRException {
3949        if (name.equals("contentAttachment")) {
3950          this.content = new Attachment();
3951          return this.content;
3952        }
3953        else if (name.equals("contentReference")) {
3954          this.content = new Reference();
3955          return this.content;
3956        }
3957        else
3958          return super.addChild(name);
3959      }
3960
3961      public ComputableLanguageComponent copy() {
3962        ComputableLanguageComponent dst = new ComputableLanguageComponent();
3963        copyValues(dst);
3964        dst.content = content == null ? null : content.copy();
3965        return dst;
3966      }
3967
3968      @Override
3969      public boolean equalsDeep(Base other_) {
3970        if (!super.equalsDeep(other_))
3971          return false;
3972        if (!(other_ instanceof ComputableLanguageComponent))
3973          return false;
3974        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
3975        return compareDeep(content, o.content, true);
3976      }
3977
3978      @Override
3979      public boolean equalsShallow(Base other_) {
3980        if (!super.equalsShallow(other_))
3981          return false;
3982        if (!(other_ instanceof ComputableLanguageComponent))
3983          return false;
3984        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
3985        return true;
3986      }
3987
3988      public boolean isEmpty() {
3989        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
3990      }
3991
3992  public String fhirType() {
3993    return "Contract.rule";
3994
3995  }
3996
3997  }
3998
3999    /**
4000     * Unique identifier for this Contract.
4001     */
4002    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
4003    @Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract." )
4004    protected Identifier identifier;
4005
4006    /**
4007     * The status of the resource instance.
4008     */
4009    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
4010    @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition="The status of the resource instance." )
4011    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-status")
4012    protected Enumeration<ContractStatus> status;
4013
4014    /**
4015     * When this  Contract was issued.
4016     */
4017    @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4018    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
4019    protected DateTimeType issued;
4020
4021    /**
4022     * Relevant time or time-period when this Contract is applicable.
4023     */
4024    @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
4025    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
4026    protected Period applies;
4027
4028    /**
4029     * The target entity impacted by or of interest to parties to the agreement.
4030     */
4031    @Child(name = "subject", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4032    @Description(shortDefinition="Contract Target Entity", formalDefinition="The target entity impacted by or of interest to parties to the agreement." )
4033    protected List<Reference> subject;
4034    /**
4035     * The actual objects that are the target of the reference (The target entity impacted by or of interest to parties to the agreement.)
4036     */
4037    protected List<Resource> subjectTarget;
4038
4039
4040    /**
4041     * The matter of concern in the context of this agreement.
4042     */
4043    @Child(name = "topic", type = {Reference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4044    @Description(shortDefinition="Context of the Contract", formalDefinition="The matter of concern in the context of this agreement." )
4045    protected List<Reference> topic;
4046    /**
4047     * The actual objects that are the target of the reference (The matter of concern in the context of this agreement.)
4048     */
4049    protected List<Resource> topicTarget;
4050
4051
4052    /**
4053     * A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.
4054     */
4055    @Child(name = "authority", type = {Organization.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4056    @Description(shortDefinition="Authority under which this Contract has standing", formalDefinition="A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies." )
4057    protected List<Reference> authority;
4058    /**
4059     * The actual objects that are the target of the reference (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
4060     */
4061    protected List<Organization> authorityTarget;
4062
4063
4064    /**
4065     * Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.
4066     */
4067    @Child(name = "domain", type = {Location.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4068    @Description(shortDefinition="Domain in which this Contract applies", formalDefinition="Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources." )
4069    protected List<Reference> domain;
4070    /**
4071     * The actual objects that are the target of the reference (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
4072     */
4073    protected List<Location> domainTarget;
4074
4075
4076    /**
4077     * Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.
4078     */
4079    @Child(name = "type", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
4080    @Description(shortDefinition="Type or form", formalDefinition="Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc." )
4081    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-type")
4082    protected CodeableConcept type;
4083
4084    /**
4085     * More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.
4086     */
4087    @Child(name = "subType", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4088    @Description(shortDefinition="Subtype within the context of type", formalDefinition="More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent." )
4089    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-subtype")
4090    protected List<CodeableConcept> subType;
4091
4092    /**
4093     * Action stipulated by this Contract.
4094     */
4095    @Child(name = "action", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4096    @Description(shortDefinition="Action stipulated by this Contract", formalDefinition="Action stipulated by this Contract." )
4097    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
4098    protected List<CodeableConcept> action;
4099
4100    /**
4101     * Reason for action stipulated by this Contract.
4102     */
4103    @Child(name = "actionReason", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4104    @Description(shortDefinition="Rationale for the stiplulated action", formalDefinition="Reason for action stipulated by this Contract." )
4105    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
4106    protected List<CodeableConcept> actionReason;
4107
4108    /**
4109     * The type of decision made by a grantor with respect to an offer made by a grantee.
4110     */
4111    @Child(name = "decisionType", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
4112    @Description(shortDefinition="Decision by Grantor", formalDefinition="The type of decision made by a grantor with respect to an offer made by a grantee." )
4113    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActConsentDirective")
4114    protected CodeableConcept decisionType;
4115
4116    /**
4117     * The minimal content derived from the basal information source at a specific stage in its lifecycle.
4118     */
4119    @Child(name = "contentDerivative", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
4120    @Description(shortDefinition="Content derived from the basal information", formalDefinition="The minimal content derived from the basal information source at a specific stage in its lifecycle." )
4121    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-content-derivative")
4122    protected CodeableConcept contentDerivative;
4123
4124    /**
4125     * A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.
4126     */
4127    @Child(name = "securityLabel", type = {Coding.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4128    @Description(shortDefinition="Security Labels that define affected resources", formalDefinition="A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels." )
4129    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
4130    protected List<Coding> securityLabel;
4131
4132    /**
4133     * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
4134     */
4135    @Child(name = "agent", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4136    @Description(shortDefinition="Entity being ascribed responsibility", formalDefinition="An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place." )
4137    protected List<AgentComponent> agent;
4138
4139    /**
4140     * Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.
4141     */
4142    @Child(name = "signer", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4143    @Description(shortDefinition="Contract Signatory", formalDefinition="Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness." )
4144    protected List<SignatoryComponent> signer;
4145
4146    /**
4147     * Contract Valued Item List.
4148     */
4149    @Child(name = "valuedItem", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4150    @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
4151    protected List<ValuedItemComponent> valuedItem;
4152
4153    /**
4154     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
4155     */
4156    @Child(name = "term", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4157    @Description(shortDefinition="Contract Term List", formalDefinition="One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups." )
4158    protected List<TermComponent> term;
4159
4160    /**
4161     * Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.
4162     */
4163    @Child(name = "binding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=19, min=0, max=1, modifier=false, summary=false)
4164    @Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract." )
4165    protected Type binding;
4166
4167    /**
4168     * The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.
4169     */
4170    @Child(name = "friendly", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4171    @Description(shortDefinition="Contract Friendly Language", formalDefinition="The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement." )
4172    protected List<FriendlyLanguageComponent> friendly;
4173
4174    /**
4175     * List of Legal expressions or representations of this Contract.
4176     */
4177    @Child(name = "legal", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4178    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
4179    protected List<LegalLanguageComponent> legal;
4180
4181    /**
4182     * List of Computable Policy Rule Language Representations of this Contract.
4183     */
4184    @Child(name = "rule", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4185    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
4186    protected List<ComputableLanguageComponent> rule;
4187
4188    private static final long serialVersionUID = -254555038L;
4189
4190  /**
4191   * Constructor
4192   */
4193    public Contract() {
4194      super();
4195    }
4196
4197    /**
4198     * @return {@link #identifier} (Unique identifier for this Contract.)
4199     */
4200    public Identifier getIdentifier() { 
4201      if (this.identifier == null)
4202        if (Configuration.errorOnAutoCreate())
4203          throw new Error("Attempt to auto-create Contract.identifier");
4204        else if (Configuration.doAutoCreate())
4205          this.identifier = new Identifier(); // cc
4206      return this.identifier;
4207    }
4208
4209    public boolean hasIdentifier() { 
4210      return this.identifier != null && !this.identifier.isEmpty();
4211    }
4212
4213    /**
4214     * @param value {@link #identifier} (Unique identifier for this Contract.)
4215     */
4216    public Contract setIdentifier(Identifier value)  { 
4217      this.identifier = value;
4218      return this;
4219    }
4220
4221    /**
4222     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4223     */
4224    public Enumeration<ContractStatus> getStatusElement() { 
4225      if (this.status == null)
4226        if (Configuration.errorOnAutoCreate())
4227          throw new Error("Attempt to auto-create Contract.status");
4228        else if (Configuration.doAutoCreate())
4229          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
4230      return this.status;
4231    }
4232
4233    public boolean hasStatusElement() { 
4234      return this.status != null && !this.status.isEmpty();
4235    }
4236
4237    public boolean hasStatus() { 
4238      return this.status != null && !this.status.isEmpty();
4239    }
4240
4241    /**
4242     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4243     */
4244    public Contract setStatusElement(Enumeration<ContractStatus> value) { 
4245      this.status = value;
4246      return this;
4247    }
4248
4249    /**
4250     * @return The status of the resource instance.
4251     */
4252    public ContractStatus getStatus() { 
4253      return this.status == null ? null : this.status.getValue();
4254    }
4255
4256    /**
4257     * @param value The status of the resource instance.
4258     */
4259    public Contract setStatus(ContractStatus value) { 
4260      if (value == null)
4261        this.status = null;
4262      else {
4263        if (this.status == null)
4264          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
4265        this.status.setValue(value);
4266      }
4267      return this;
4268    }
4269
4270    /**
4271     * @return {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
4272     */
4273    public DateTimeType getIssuedElement() { 
4274      if (this.issued == null)
4275        if (Configuration.errorOnAutoCreate())
4276          throw new Error("Attempt to auto-create Contract.issued");
4277        else if (Configuration.doAutoCreate())
4278          this.issued = new DateTimeType(); // bb
4279      return this.issued;
4280    }
4281
4282    public boolean hasIssuedElement() { 
4283      return this.issued != null && !this.issued.isEmpty();
4284    }
4285
4286    public boolean hasIssued() { 
4287      return this.issued != null && !this.issued.isEmpty();
4288    }
4289
4290    /**
4291     * @param value {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
4292     */
4293    public Contract setIssuedElement(DateTimeType value) { 
4294      this.issued = value;
4295      return this;
4296    }
4297
4298    /**
4299     * @return When this  Contract was issued.
4300     */
4301    public Date getIssued() { 
4302      return this.issued == null ? null : this.issued.getValue();
4303    }
4304
4305    /**
4306     * @param value When this  Contract was issued.
4307     */
4308    public Contract setIssued(Date value) { 
4309      if (value == null)
4310        this.issued = null;
4311      else {
4312        if (this.issued == null)
4313          this.issued = new DateTimeType();
4314        this.issued.setValue(value);
4315      }
4316      return this;
4317    }
4318
4319    /**
4320     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
4321     */
4322    public Period getApplies() { 
4323      if (this.applies == null)
4324        if (Configuration.errorOnAutoCreate())
4325          throw new Error("Attempt to auto-create Contract.applies");
4326        else if (Configuration.doAutoCreate())
4327          this.applies = new Period(); // cc
4328      return this.applies;
4329    }
4330
4331    public boolean hasApplies() { 
4332      return this.applies != null && !this.applies.isEmpty();
4333    }
4334
4335    /**
4336     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
4337     */
4338    public Contract setApplies(Period value)  { 
4339      this.applies = value;
4340      return this;
4341    }
4342
4343    /**
4344     * @return {@link #subject} (The target entity impacted by or of interest to parties to the agreement.)
4345     */
4346    public List<Reference> getSubject() { 
4347      if (this.subject == null)
4348        this.subject = new ArrayList<Reference>();
4349      return this.subject;
4350    }
4351
4352    /**
4353     * @return Returns a reference to <code>this</code> for easy method chaining
4354     */
4355    public Contract setSubject(List<Reference> theSubject) { 
4356      this.subject = theSubject;
4357      return this;
4358    }
4359
4360    public boolean hasSubject() { 
4361      if (this.subject == null)
4362        return false;
4363      for (Reference item : this.subject)
4364        if (!item.isEmpty())
4365          return true;
4366      return false;
4367    }
4368
4369    public Reference addSubject() { //3
4370      Reference t = new Reference();
4371      if (this.subject == null)
4372        this.subject = new ArrayList<Reference>();
4373      this.subject.add(t);
4374      return t;
4375    }
4376
4377    public Contract addSubject(Reference t) { //3
4378      if (t == null)
4379        return this;
4380      if (this.subject == null)
4381        this.subject = new ArrayList<Reference>();
4382      this.subject.add(t);
4383      return this;
4384    }
4385
4386    /**
4387     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
4388     */
4389    public Reference getSubjectFirstRep() { 
4390      if (getSubject().isEmpty()) {
4391        addSubject();
4392      }
4393      return getSubject().get(0);
4394    }
4395
4396    /**
4397     * @return {@link #topic} (The matter of concern in the context of this agreement.)
4398     */
4399    public List<Reference> getTopic() { 
4400      if (this.topic == null)
4401        this.topic = new ArrayList<Reference>();
4402      return this.topic;
4403    }
4404
4405    /**
4406     * @return Returns a reference to <code>this</code> for easy method chaining
4407     */
4408    public Contract setTopic(List<Reference> theTopic) { 
4409      this.topic = theTopic;
4410      return this;
4411    }
4412
4413    public boolean hasTopic() { 
4414      if (this.topic == null)
4415        return false;
4416      for (Reference item : this.topic)
4417        if (!item.isEmpty())
4418          return true;
4419      return false;
4420    }
4421
4422    public Reference addTopic() { //3
4423      Reference t = new Reference();
4424      if (this.topic == null)
4425        this.topic = new ArrayList<Reference>();
4426      this.topic.add(t);
4427      return t;
4428    }
4429
4430    public Contract addTopic(Reference t) { //3
4431      if (t == null)
4432        return this;
4433      if (this.topic == null)
4434        this.topic = new ArrayList<Reference>();
4435      this.topic.add(t);
4436      return this;
4437    }
4438
4439    /**
4440     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
4441     */
4442    public Reference getTopicFirstRep() { 
4443      if (getTopic().isEmpty()) {
4444        addTopic();
4445      }
4446      return getTopic().get(0);
4447    }
4448
4449    /**
4450     * @return {@link #authority} (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
4451     */
4452    public List<Reference> getAuthority() { 
4453      if (this.authority == null)
4454        this.authority = new ArrayList<Reference>();
4455      return this.authority;
4456    }
4457
4458    /**
4459     * @return Returns a reference to <code>this</code> for easy method chaining
4460     */
4461    public Contract setAuthority(List<Reference> theAuthority) { 
4462      this.authority = theAuthority;
4463      return this;
4464    }
4465
4466    public boolean hasAuthority() { 
4467      if (this.authority == null)
4468        return false;
4469      for (Reference item : this.authority)
4470        if (!item.isEmpty())
4471          return true;
4472      return false;
4473    }
4474
4475    public Reference addAuthority() { //3
4476      Reference t = new Reference();
4477      if (this.authority == null)
4478        this.authority = new ArrayList<Reference>();
4479      this.authority.add(t);
4480      return t;
4481    }
4482
4483    public Contract addAuthority(Reference t) { //3
4484      if (t == null)
4485        return this;
4486      if (this.authority == null)
4487        this.authority = new ArrayList<Reference>();
4488      this.authority.add(t);
4489      return this;
4490    }
4491
4492    /**
4493     * @return The first repetition of repeating field {@link #authority}, creating it if it does not already exist
4494     */
4495    public Reference getAuthorityFirstRep() { 
4496      if (getAuthority().isEmpty()) {
4497        addAuthority();
4498      }
4499      return getAuthority().get(0);
4500    }
4501
4502    /**
4503     * @return {@link #domain} (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
4504     */
4505    public List<Reference> getDomain() { 
4506      if (this.domain == null)
4507        this.domain = new ArrayList<Reference>();
4508      return this.domain;
4509    }
4510
4511    /**
4512     * @return Returns a reference to <code>this</code> for easy method chaining
4513     */
4514    public Contract setDomain(List<Reference> theDomain) { 
4515      this.domain = theDomain;
4516      return this;
4517    }
4518
4519    public boolean hasDomain() { 
4520      if (this.domain == null)
4521        return false;
4522      for (Reference item : this.domain)
4523        if (!item.isEmpty())
4524          return true;
4525      return false;
4526    }
4527
4528    public Reference addDomain() { //3
4529      Reference t = new Reference();
4530      if (this.domain == null)
4531        this.domain = new ArrayList<Reference>();
4532      this.domain.add(t);
4533      return t;
4534    }
4535
4536    public Contract addDomain(Reference t) { //3
4537      if (t == null)
4538        return this;
4539      if (this.domain == null)
4540        this.domain = new ArrayList<Reference>();
4541      this.domain.add(t);
4542      return this;
4543    }
4544
4545    /**
4546     * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist
4547     */
4548    public Reference getDomainFirstRep() { 
4549      if (getDomain().isEmpty()) {
4550        addDomain();
4551      }
4552      return getDomain().get(0);
4553    }
4554
4555    /**
4556     * @return {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
4557     */
4558    public CodeableConcept getType() { 
4559      if (this.type == null)
4560        if (Configuration.errorOnAutoCreate())
4561          throw new Error("Attempt to auto-create Contract.type");
4562        else if (Configuration.doAutoCreate())
4563          this.type = new CodeableConcept(); // cc
4564      return this.type;
4565    }
4566
4567    public boolean hasType() { 
4568      return this.type != null && !this.type.isEmpty();
4569    }
4570
4571    /**
4572     * @param value {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
4573     */
4574    public Contract setType(CodeableConcept value)  { 
4575      this.type = value;
4576      return this;
4577    }
4578
4579    /**
4580     * @return {@link #subType} (More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.)
4581     */
4582    public List<CodeableConcept> getSubType() { 
4583      if (this.subType == null)
4584        this.subType = new ArrayList<CodeableConcept>();
4585      return this.subType;
4586    }
4587
4588    /**
4589     * @return Returns a reference to <code>this</code> for easy method chaining
4590     */
4591    public Contract setSubType(List<CodeableConcept> theSubType) { 
4592      this.subType = theSubType;
4593      return this;
4594    }
4595
4596    public boolean hasSubType() { 
4597      if (this.subType == null)
4598        return false;
4599      for (CodeableConcept item : this.subType)
4600        if (!item.isEmpty())
4601          return true;
4602      return false;
4603    }
4604
4605    public CodeableConcept addSubType() { //3
4606      CodeableConcept t = new CodeableConcept();
4607      if (this.subType == null)
4608        this.subType = new ArrayList<CodeableConcept>();
4609      this.subType.add(t);
4610      return t;
4611    }
4612
4613    public Contract addSubType(CodeableConcept t) { //3
4614      if (t == null)
4615        return this;
4616      if (this.subType == null)
4617        this.subType = new ArrayList<CodeableConcept>();
4618      this.subType.add(t);
4619      return this;
4620    }
4621
4622    /**
4623     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
4624     */
4625    public CodeableConcept getSubTypeFirstRep() { 
4626      if (getSubType().isEmpty()) {
4627        addSubType();
4628      }
4629      return getSubType().get(0);
4630    }
4631
4632    /**
4633     * @return {@link #action} (Action stipulated by this Contract.)
4634     */
4635    public List<CodeableConcept> getAction() { 
4636      if (this.action == null)
4637        this.action = new ArrayList<CodeableConcept>();
4638      return this.action;
4639    }
4640
4641    /**
4642     * @return Returns a reference to <code>this</code> for easy method chaining
4643     */
4644    public Contract setAction(List<CodeableConcept> theAction) { 
4645      this.action = theAction;
4646      return this;
4647    }
4648
4649    public boolean hasAction() { 
4650      if (this.action == null)
4651        return false;
4652      for (CodeableConcept item : this.action)
4653        if (!item.isEmpty())
4654          return true;
4655      return false;
4656    }
4657
4658    public CodeableConcept addAction() { //3
4659      CodeableConcept t = new CodeableConcept();
4660      if (this.action == null)
4661        this.action = new ArrayList<CodeableConcept>();
4662      this.action.add(t);
4663      return t;
4664    }
4665
4666    public Contract addAction(CodeableConcept t) { //3
4667      if (t == null)
4668        return this;
4669      if (this.action == null)
4670        this.action = new ArrayList<CodeableConcept>();
4671      this.action.add(t);
4672      return this;
4673    }
4674
4675    /**
4676     * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
4677     */
4678    public CodeableConcept getActionFirstRep() { 
4679      if (getAction().isEmpty()) {
4680        addAction();
4681      }
4682      return getAction().get(0);
4683    }
4684
4685    /**
4686     * @return {@link #actionReason} (Reason for action stipulated by this Contract.)
4687     */
4688    public List<CodeableConcept> getActionReason() { 
4689      if (this.actionReason == null)
4690        this.actionReason = new ArrayList<CodeableConcept>();
4691      return this.actionReason;
4692    }
4693
4694    /**
4695     * @return Returns a reference to <code>this</code> for easy method chaining
4696     */
4697    public Contract setActionReason(List<CodeableConcept> theActionReason) { 
4698      this.actionReason = theActionReason;
4699      return this;
4700    }
4701
4702    public boolean hasActionReason() { 
4703      if (this.actionReason == null)
4704        return false;
4705      for (CodeableConcept item : this.actionReason)
4706        if (!item.isEmpty())
4707          return true;
4708      return false;
4709    }
4710
4711    public CodeableConcept addActionReason() { //3
4712      CodeableConcept t = new CodeableConcept();
4713      if (this.actionReason == null)
4714        this.actionReason = new ArrayList<CodeableConcept>();
4715      this.actionReason.add(t);
4716      return t;
4717    }
4718
4719    public Contract addActionReason(CodeableConcept t) { //3
4720      if (t == null)
4721        return this;
4722      if (this.actionReason == null)
4723        this.actionReason = new ArrayList<CodeableConcept>();
4724      this.actionReason.add(t);
4725      return this;
4726    }
4727
4728    /**
4729     * @return The first repetition of repeating field {@link #actionReason}, creating it if it does not already exist
4730     */
4731    public CodeableConcept getActionReasonFirstRep() { 
4732      if (getActionReason().isEmpty()) {
4733        addActionReason();
4734      }
4735      return getActionReason().get(0);
4736    }
4737
4738    /**
4739     * @return {@link #decisionType} (The type of decision made by a grantor with respect to an offer made by a grantee.)
4740     */
4741    public CodeableConcept getDecisionType() { 
4742      if (this.decisionType == null)
4743        if (Configuration.errorOnAutoCreate())
4744          throw new Error("Attempt to auto-create Contract.decisionType");
4745        else if (Configuration.doAutoCreate())
4746          this.decisionType = new CodeableConcept(); // cc
4747      return this.decisionType;
4748    }
4749
4750    public boolean hasDecisionType() { 
4751      return this.decisionType != null && !this.decisionType.isEmpty();
4752    }
4753
4754    /**
4755     * @param value {@link #decisionType} (The type of decision made by a grantor with respect to an offer made by a grantee.)
4756     */
4757    public Contract setDecisionType(CodeableConcept value)  { 
4758      this.decisionType = value;
4759      return this;
4760    }
4761
4762    /**
4763     * @return {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
4764     */
4765    public CodeableConcept getContentDerivative() { 
4766      if (this.contentDerivative == null)
4767        if (Configuration.errorOnAutoCreate())
4768          throw new Error("Attempt to auto-create Contract.contentDerivative");
4769        else if (Configuration.doAutoCreate())
4770          this.contentDerivative = new CodeableConcept(); // cc
4771      return this.contentDerivative;
4772    }
4773
4774    public boolean hasContentDerivative() { 
4775      return this.contentDerivative != null && !this.contentDerivative.isEmpty();
4776    }
4777
4778    /**
4779     * @param value {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
4780     */
4781    public Contract setContentDerivative(CodeableConcept value)  { 
4782      this.contentDerivative = value;
4783      return this;
4784    }
4785
4786    /**
4787     * @return {@link #securityLabel} (A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.)
4788     */
4789    public List<Coding> getSecurityLabel() { 
4790      if (this.securityLabel == null)
4791        this.securityLabel = new ArrayList<Coding>();
4792      return this.securityLabel;
4793    }
4794
4795    /**
4796     * @return Returns a reference to <code>this</code> for easy method chaining
4797     */
4798    public Contract setSecurityLabel(List<Coding> theSecurityLabel) { 
4799      this.securityLabel = theSecurityLabel;
4800      return this;
4801    }
4802
4803    public boolean hasSecurityLabel() { 
4804      if (this.securityLabel == null)
4805        return false;
4806      for (Coding item : this.securityLabel)
4807        if (!item.isEmpty())
4808          return true;
4809      return false;
4810    }
4811
4812    public Coding addSecurityLabel() { //3
4813      Coding t = new Coding();
4814      if (this.securityLabel == null)
4815        this.securityLabel = new ArrayList<Coding>();
4816      this.securityLabel.add(t);
4817      return t;
4818    }
4819
4820    public Contract addSecurityLabel(Coding t) { //3
4821      if (t == null)
4822        return this;
4823      if (this.securityLabel == null)
4824        this.securityLabel = new ArrayList<Coding>();
4825      this.securityLabel.add(t);
4826      return this;
4827    }
4828
4829    /**
4830     * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
4831     */
4832    public Coding getSecurityLabelFirstRep() { 
4833      if (getSecurityLabel().isEmpty()) {
4834        addSecurityLabel();
4835      }
4836      return getSecurityLabel().get(0);
4837    }
4838
4839    /**
4840     * @return {@link #agent} (An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.)
4841     */
4842    public List<AgentComponent> getAgent() { 
4843      if (this.agent == null)
4844        this.agent = new ArrayList<AgentComponent>();
4845      return this.agent;
4846    }
4847
4848    /**
4849     * @return Returns a reference to <code>this</code> for easy method chaining
4850     */
4851    public Contract setAgent(List<AgentComponent> theAgent) { 
4852      this.agent = theAgent;
4853      return this;
4854    }
4855
4856    public boolean hasAgent() { 
4857      if (this.agent == null)
4858        return false;
4859      for (AgentComponent item : this.agent)
4860        if (!item.isEmpty())
4861          return true;
4862      return false;
4863    }
4864
4865    public AgentComponent addAgent() { //3
4866      AgentComponent t = new AgentComponent();
4867      if (this.agent == null)
4868        this.agent = new ArrayList<AgentComponent>();
4869      this.agent.add(t);
4870      return t;
4871    }
4872
4873    public Contract addAgent(AgentComponent t) { //3
4874      if (t == null)
4875        return this;
4876      if (this.agent == null)
4877        this.agent = new ArrayList<AgentComponent>();
4878      this.agent.add(t);
4879      return this;
4880    }
4881
4882    /**
4883     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
4884     */
4885    public AgentComponent getAgentFirstRep() { 
4886      if (getAgent().isEmpty()) {
4887        addAgent();
4888      }
4889      return getAgent().get(0);
4890    }
4891
4892    /**
4893     * @return {@link #signer} (Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.)
4894     */
4895    public List<SignatoryComponent> getSigner() { 
4896      if (this.signer == null)
4897        this.signer = new ArrayList<SignatoryComponent>();
4898      return this.signer;
4899    }
4900
4901    /**
4902     * @return Returns a reference to <code>this</code> for easy method chaining
4903     */
4904    public Contract setSigner(List<SignatoryComponent> theSigner) { 
4905      this.signer = theSigner;
4906      return this;
4907    }
4908
4909    public boolean hasSigner() { 
4910      if (this.signer == null)
4911        return false;
4912      for (SignatoryComponent item : this.signer)
4913        if (!item.isEmpty())
4914          return true;
4915      return false;
4916    }
4917
4918    public SignatoryComponent addSigner() { //3
4919      SignatoryComponent t = new SignatoryComponent();
4920      if (this.signer == null)
4921        this.signer = new ArrayList<SignatoryComponent>();
4922      this.signer.add(t);
4923      return t;
4924    }
4925
4926    public Contract addSigner(SignatoryComponent t) { //3
4927      if (t == null)
4928        return this;
4929      if (this.signer == null)
4930        this.signer = new ArrayList<SignatoryComponent>();
4931      this.signer.add(t);
4932      return this;
4933    }
4934
4935    /**
4936     * @return The first repetition of repeating field {@link #signer}, creating it if it does not already exist
4937     */
4938    public SignatoryComponent getSignerFirstRep() { 
4939      if (getSigner().isEmpty()) {
4940        addSigner();
4941      }
4942      return getSigner().get(0);
4943    }
4944
4945    /**
4946     * @return {@link #valuedItem} (Contract Valued Item List.)
4947     */
4948    public List<ValuedItemComponent> getValuedItem() { 
4949      if (this.valuedItem == null)
4950        this.valuedItem = new ArrayList<ValuedItemComponent>();
4951      return this.valuedItem;
4952    }
4953
4954    /**
4955     * @return Returns a reference to <code>this</code> for easy method chaining
4956     */
4957    public Contract setValuedItem(List<ValuedItemComponent> theValuedItem) { 
4958      this.valuedItem = theValuedItem;
4959      return this;
4960    }
4961
4962    public boolean hasValuedItem() { 
4963      if (this.valuedItem == null)
4964        return false;
4965      for (ValuedItemComponent item : this.valuedItem)
4966        if (!item.isEmpty())
4967          return true;
4968      return false;
4969    }
4970
4971    public ValuedItemComponent addValuedItem() { //3
4972      ValuedItemComponent t = new ValuedItemComponent();
4973      if (this.valuedItem == null)
4974        this.valuedItem = new ArrayList<ValuedItemComponent>();
4975      this.valuedItem.add(t);
4976      return t;
4977    }
4978
4979    public Contract addValuedItem(ValuedItemComponent t) { //3
4980      if (t == null)
4981        return this;
4982      if (this.valuedItem == null)
4983        this.valuedItem = new ArrayList<ValuedItemComponent>();
4984      this.valuedItem.add(t);
4985      return this;
4986    }
4987
4988    /**
4989     * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
4990     */
4991    public ValuedItemComponent getValuedItemFirstRep() { 
4992      if (getValuedItem().isEmpty()) {
4993        addValuedItem();
4994      }
4995      return getValuedItem().get(0);
4996    }
4997
4998    /**
4999     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
5000     */
5001    public List<TermComponent> getTerm() { 
5002      if (this.term == null)
5003        this.term = new ArrayList<TermComponent>();
5004      return this.term;
5005    }
5006
5007    /**
5008     * @return Returns a reference to <code>this</code> for easy method chaining
5009     */
5010    public Contract setTerm(List<TermComponent> theTerm) { 
5011      this.term = theTerm;
5012      return this;
5013    }
5014
5015    public boolean hasTerm() { 
5016      if (this.term == null)
5017        return false;
5018      for (TermComponent item : this.term)
5019        if (!item.isEmpty())
5020          return true;
5021      return false;
5022    }
5023
5024    public TermComponent addTerm() { //3
5025      TermComponent t = new TermComponent();
5026      if (this.term == null)
5027        this.term = new ArrayList<TermComponent>();
5028      this.term.add(t);
5029      return t;
5030    }
5031
5032    public Contract addTerm(TermComponent t) { //3
5033      if (t == null)
5034        return this;
5035      if (this.term == null)
5036        this.term = new ArrayList<TermComponent>();
5037      this.term.add(t);
5038      return this;
5039    }
5040
5041    /**
5042     * @return The first repetition of repeating field {@link #term}, creating it if it does not already exist
5043     */
5044    public TermComponent getTermFirstRep() { 
5045      if (getTerm().isEmpty()) {
5046        addTerm();
5047      }
5048      return getTerm().get(0);
5049    }
5050
5051    /**
5052     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5053     */
5054    public Type getBinding() { 
5055      return this.binding;
5056    }
5057
5058    /**
5059     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5060     */
5061    public Attachment getBindingAttachment() throws FHIRException { 
5062      if (this.binding == null)
5063        return null;
5064      if (!(this.binding instanceof Attachment))
5065        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.binding.getClass().getName()+" was encountered");
5066      return (Attachment) this.binding;
5067    }
5068
5069    public boolean hasBindingAttachment() {
5070      return this.binding instanceof Attachment;
5071    }
5072
5073    /**
5074     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5075     */
5076    public Reference getBindingReference() throws FHIRException { 
5077      if (this.binding == null)
5078        return null;
5079      if (!(this.binding instanceof Reference))
5080        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.binding.getClass().getName()+" was encountered");
5081      return (Reference) this.binding;
5082    }
5083
5084    public boolean hasBindingReference() {
5085      return this.binding instanceof Reference;
5086    }
5087
5088    public boolean hasBinding() { 
5089      return this.binding != null && !this.binding.isEmpty();
5090    }
5091
5092    /**
5093     * @param value {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
5094     */
5095    public Contract setBinding(Type value) throws FHIRFormatError { 
5096      if (value != null && !(value instanceof Attachment || value instanceof Reference))
5097        throw new FHIRFormatError("Not the right type for Contract.binding[x]: "+value.fhirType());
5098      this.binding = value;
5099      return this;
5100    }
5101
5102    /**
5103     * @return {@link #friendly} (The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.)
5104     */
5105    public List<FriendlyLanguageComponent> getFriendly() { 
5106      if (this.friendly == null)
5107        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5108      return this.friendly;
5109    }
5110
5111    /**
5112     * @return Returns a reference to <code>this</code> for easy method chaining
5113     */
5114    public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) { 
5115      this.friendly = theFriendly;
5116      return this;
5117    }
5118
5119    public boolean hasFriendly() { 
5120      if (this.friendly == null)
5121        return false;
5122      for (FriendlyLanguageComponent item : this.friendly)
5123        if (!item.isEmpty())
5124          return true;
5125      return false;
5126    }
5127
5128    public FriendlyLanguageComponent addFriendly() { //3
5129      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
5130      if (this.friendly == null)
5131        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5132      this.friendly.add(t);
5133      return t;
5134    }
5135
5136    public Contract addFriendly(FriendlyLanguageComponent t) { //3
5137      if (t == null)
5138        return this;
5139      if (this.friendly == null)
5140        this.friendly = new ArrayList<FriendlyLanguageComponent>();
5141      this.friendly.add(t);
5142      return this;
5143    }
5144
5145    /**
5146     * @return The first repetition of repeating field {@link #friendly}, creating it if it does not already exist
5147     */
5148    public FriendlyLanguageComponent getFriendlyFirstRep() { 
5149      if (getFriendly().isEmpty()) {
5150        addFriendly();
5151      }
5152      return getFriendly().get(0);
5153    }
5154
5155    /**
5156     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
5157     */
5158    public List<LegalLanguageComponent> getLegal() { 
5159      if (this.legal == null)
5160        this.legal = new ArrayList<LegalLanguageComponent>();
5161      return this.legal;
5162    }
5163
5164    /**
5165     * @return Returns a reference to <code>this</code> for easy method chaining
5166     */
5167    public Contract setLegal(List<LegalLanguageComponent> theLegal) { 
5168      this.legal = theLegal;
5169      return this;
5170    }
5171
5172    public boolean hasLegal() { 
5173      if (this.legal == null)
5174        return false;
5175      for (LegalLanguageComponent item : this.legal)
5176        if (!item.isEmpty())
5177          return true;
5178      return false;
5179    }
5180
5181    public LegalLanguageComponent addLegal() { //3
5182      LegalLanguageComponent t = new LegalLanguageComponent();
5183      if (this.legal == null)
5184        this.legal = new ArrayList<LegalLanguageComponent>();
5185      this.legal.add(t);
5186      return t;
5187    }
5188
5189    public Contract addLegal(LegalLanguageComponent t) { //3
5190      if (t == null)
5191        return this;
5192      if (this.legal == null)
5193        this.legal = new ArrayList<LegalLanguageComponent>();
5194      this.legal.add(t);
5195      return this;
5196    }
5197
5198    /**
5199     * @return The first repetition of repeating field {@link #legal}, creating it if it does not already exist
5200     */
5201    public LegalLanguageComponent getLegalFirstRep() { 
5202      if (getLegal().isEmpty()) {
5203        addLegal();
5204      }
5205      return getLegal().get(0);
5206    }
5207
5208    /**
5209     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
5210     */
5211    public List<ComputableLanguageComponent> getRule() { 
5212      if (this.rule == null)
5213        this.rule = new ArrayList<ComputableLanguageComponent>();
5214      return this.rule;
5215    }
5216
5217    /**
5218     * @return Returns a reference to <code>this</code> for easy method chaining
5219     */
5220    public Contract setRule(List<ComputableLanguageComponent> theRule) { 
5221      this.rule = theRule;
5222      return this;
5223    }
5224
5225    public boolean hasRule() { 
5226      if (this.rule == null)
5227        return false;
5228      for (ComputableLanguageComponent item : this.rule)
5229        if (!item.isEmpty())
5230          return true;
5231      return false;
5232    }
5233
5234    public ComputableLanguageComponent addRule() { //3
5235      ComputableLanguageComponent t = new ComputableLanguageComponent();
5236      if (this.rule == null)
5237        this.rule = new ArrayList<ComputableLanguageComponent>();
5238      this.rule.add(t);
5239      return t;
5240    }
5241
5242    public Contract addRule(ComputableLanguageComponent t) { //3
5243      if (t == null)
5244        return this;
5245      if (this.rule == null)
5246        this.rule = new ArrayList<ComputableLanguageComponent>();
5247      this.rule.add(t);
5248      return this;
5249    }
5250
5251    /**
5252     * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
5253     */
5254    public ComputableLanguageComponent getRuleFirstRep() { 
5255      if (getRule().isEmpty()) {
5256        addRule();
5257      }
5258      return getRule().get(0);
5259    }
5260
5261      protected void listChildren(List<Property> children) {
5262        super.listChildren(children);
5263        children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract.", 0, 1, identifier));
5264        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
5265        children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
5266        children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies));
5267        children.add(new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject));
5268        children.add(new Property("topic", "Reference(Any)", "The matter of concern in the context of this agreement.", 0, java.lang.Integer.MAX_VALUE, topic));
5269        children.add(new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority));
5270        children.add(new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain));
5271        children.add(new Property("type", "CodeableConcept", "Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.", 0, 1, type));
5272        children.add(new Property("subType", "CodeableConcept", "More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.", 0, java.lang.Integer.MAX_VALUE, subType));
5273        children.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, action));
5274        children.add(new Property("actionReason", "CodeableConcept", "Reason for action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, actionReason));
5275        children.add(new Property("decisionType", "CodeableConcept", "The type of decision made by a grantor with respect to an offer made by a grantee.", 0, 1, decisionType));
5276        children.add(new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative));
5277        children.add(new Property("securityLabel", "Coding", "A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
5278        children.add(new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent));
5279        children.add(new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer));
5280        children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
5281        children.add(new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term));
5282        children.add(new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding));
5283        children.add(new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly));
5284        children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
5285        children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
5286      }
5287
5288      @Override
5289      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5290        switch (_hash) {
5291        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this Contract.", 0, 1, identifier);
5292        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
5293        case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
5294        case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
5295        case -1867885268: /*subject*/  return new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject);
5296        case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The matter of concern in the context of this agreement.", 0, java.lang.Integer.MAX_VALUE, topic);
5297        case 1475610435: /*authority*/  return new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority);
5298        case -1326197564: /*domain*/  return new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain);
5299        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.", 0, 1, type);
5300        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.", 0, java.lang.Integer.MAX_VALUE, subType);
5301        case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, action);
5302        case 1465121818: /*actionReason*/  return new Property("actionReason", "CodeableConcept", "Reason for action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, actionReason);
5303        case 676128054: /*decisionType*/  return new Property("decisionType", "CodeableConcept", "The type of decision made by a grantor with respect to an offer made by a grantee.", 0, 1, decisionType);
5304        case -92412192: /*contentDerivative*/  return new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative);
5305        case -722296940: /*securityLabel*/  return new Property("securityLabel", "Coding", "A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
5306        case 92750597: /*agent*/  return new Property("agent", "", "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent);
5307        case -902467798: /*signer*/  return new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer);
5308        case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
5309        case 3556460: /*term*/  return new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term);
5310        case 1514826715: /*binding[x]*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5311        case -108220795: /*binding*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5312        case 1218789768: /*bindingAttachment*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5313        case 424425030: /*bindingReference*/  return new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, binding);
5314        case -1423054677: /*friendly*/  return new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly);
5315        case 102851257: /*legal*/  return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal);
5316        case 3512060: /*rule*/  return new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule);
5317        default: return super.getNamedProperty(_hash, _name, _checkValid);
5318        }
5319
5320      }
5321
5322      @Override
5323      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5324        switch (hash) {
5325        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
5326        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractStatus>
5327        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
5328        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
5329        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
5330        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // Reference
5331        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : this.authority.toArray(new Base[this.authority.size()]); // Reference
5332        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
5333        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
5334        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
5335        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // CodeableConcept
5336        case 1465121818: /*actionReason*/ return this.actionReason == null ? new Base[0] : this.actionReason.toArray(new Base[this.actionReason.size()]); // CodeableConcept
5337        case 676128054: /*decisionType*/ return this.decisionType == null ? new Base[0] : new Base[] {this.decisionType}; // CodeableConcept
5338        case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
5339        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
5340        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // AgentComponent
5341        case -902467798: /*signer*/ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
5342        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
5343        case 3556460: /*term*/ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
5344        case -108220795: /*binding*/ return this.binding == null ? new Base[0] : new Base[] {this.binding}; // Type
5345        case -1423054677: /*friendly*/ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
5346        case 102851257: /*legal*/ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
5347        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
5348        default: return super.getProperty(hash, name, checkValid);
5349        }
5350
5351      }
5352
5353      @Override
5354      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5355        switch (hash) {
5356        case -1618432855: // identifier
5357          this.identifier = castToIdentifier(value); // Identifier
5358          return value;
5359        case -892481550: // status
5360          value = new ContractStatusEnumFactory().fromType(castToCode(value));
5361          this.status = (Enumeration) value; // Enumeration<ContractStatus>
5362          return value;
5363        case -1179159893: // issued
5364          this.issued = castToDateTime(value); // DateTimeType
5365          return value;
5366        case -793235316: // applies
5367          this.applies = castToPeriod(value); // Period
5368          return value;
5369        case -1867885268: // subject
5370          this.getSubject().add(castToReference(value)); // Reference
5371          return value;
5372        case 110546223: // topic
5373          this.getTopic().add(castToReference(value)); // Reference
5374          return value;
5375        case 1475610435: // authority
5376          this.getAuthority().add(castToReference(value)); // Reference
5377          return value;
5378        case -1326197564: // domain
5379          this.getDomain().add(castToReference(value)); // Reference
5380          return value;
5381        case 3575610: // type
5382          this.type = castToCodeableConcept(value); // CodeableConcept
5383          return value;
5384        case -1868521062: // subType
5385          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
5386          return value;
5387        case -1422950858: // action
5388          this.getAction().add(castToCodeableConcept(value)); // CodeableConcept
5389          return value;
5390        case 1465121818: // actionReason
5391          this.getActionReason().add(castToCodeableConcept(value)); // CodeableConcept
5392          return value;
5393        case 676128054: // decisionType
5394          this.decisionType = castToCodeableConcept(value); // CodeableConcept
5395          return value;
5396        case -92412192: // contentDerivative
5397          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
5398          return value;
5399        case -722296940: // securityLabel
5400          this.getSecurityLabel().add(castToCoding(value)); // Coding
5401          return value;
5402        case 92750597: // agent
5403          this.getAgent().add((AgentComponent) value); // AgentComponent
5404          return value;
5405        case -902467798: // signer
5406          this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
5407          return value;
5408        case 2046675654: // valuedItem
5409          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
5410          return value;
5411        case 3556460: // term
5412          this.getTerm().add((TermComponent) value); // TermComponent
5413          return value;
5414        case -108220795: // binding
5415          this.binding = castToType(value); // Type
5416          return value;
5417        case -1423054677: // friendly
5418          this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
5419          return value;
5420        case 102851257: // legal
5421          this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
5422          return value;
5423        case 3512060: // rule
5424          this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
5425          return value;
5426        default: return super.setProperty(hash, name, value);
5427        }
5428
5429      }
5430
5431      @Override
5432      public Base setProperty(String name, Base value) throws FHIRException {
5433        if (name.equals("identifier")) {
5434          this.identifier = castToIdentifier(value); // Identifier
5435        } else if (name.equals("status")) {
5436          value = new ContractStatusEnumFactory().fromType(castToCode(value));
5437          this.status = (Enumeration) value; // Enumeration<ContractStatus>
5438        } else if (name.equals("issued")) {
5439          this.issued = castToDateTime(value); // DateTimeType
5440        } else if (name.equals("applies")) {
5441          this.applies = castToPeriod(value); // Period
5442        } else if (name.equals("subject")) {
5443          this.getSubject().add(castToReference(value));
5444        } else if (name.equals("topic")) {
5445          this.getTopic().add(castToReference(value));
5446        } else if (name.equals("authority")) {
5447          this.getAuthority().add(castToReference(value));
5448        } else if (name.equals("domain")) {
5449          this.getDomain().add(castToReference(value));
5450        } else if (name.equals("type")) {
5451          this.type = castToCodeableConcept(value); // CodeableConcept
5452        } else if (name.equals("subType")) {
5453          this.getSubType().add(castToCodeableConcept(value));
5454        } else if (name.equals("action")) {
5455          this.getAction().add(castToCodeableConcept(value));
5456        } else if (name.equals("actionReason")) {
5457          this.getActionReason().add(castToCodeableConcept(value));
5458        } else if (name.equals("decisionType")) {
5459          this.decisionType = castToCodeableConcept(value); // CodeableConcept
5460        } else if (name.equals("contentDerivative")) {
5461          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
5462        } else if (name.equals("securityLabel")) {
5463          this.getSecurityLabel().add(castToCoding(value));
5464        } else if (name.equals("agent")) {
5465          this.getAgent().add((AgentComponent) value);
5466        } else if (name.equals("signer")) {
5467          this.getSigner().add((SignatoryComponent) value);
5468        } else if (name.equals("valuedItem")) {
5469          this.getValuedItem().add((ValuedItemComponent) value);
5470        } else if (name.equals("term")) {
5471          this.getTerm().add((TermComponent) value);
5472        } else if (name.equals("binding[x]")) {
5473          this.binding = castToType(value); // Type
5474        } else if (name.equals("friendly")) {
5475          this.getFriendly().add((FriendlyLanguageComponent) value);
5476        } else if (name.equals("legal")) {
5477          this.getLegal().add((LegalLanguageComponent) value);
5478        } else if (name.equals("rule")) {
5479          this.getRule().add((ComputableLanguageComponent) value);
5480        } else
5481          return super.setProperty(name, value);
5482        return value;
5483      }
5484
5485      @Override
5486      public Base makeProperty(int hash, String name) throws FHIRException {
5487        switch (hash) {
5488        case -1618432855:  return getIdentifier(); 
5489        case -892481550:  return getStatusElement();
5490        case -1179159893:  return getIssuedElement();
5491        case -793235316:  return getApplies(); 
5492        case -1867885268:  return addSubject(); 
5493        case 110546223:  return addTopic(); 
5494        case 1475610435:  return addAuthority(); 
5495        case -1326197564:  return addDomain(); 
5496        case 3575610:  return getType(); 
5497        case -1868521062:  return addSubType(); 
5498        case -1422950858:  return addAction(); 
5499        case 1465121818:  return addActionReason(); 
5500        case 676128054:  return getDecisionType(); 
5501        case -92412192:  return getContentDerivative(); 
5502        case -722296940:  return addSecurityLabel(); 
5503        case 92750597:  return addAgent(); 
5504        case -902467798:  return addSigner(); 
5505        case 2046675654:  return addValuedItem(); 
5506        case 3556460:  return addTerm(); 
5507        case 1514826715:  return getBinding(); 
5508        case -108220795:  return getBinding(); 
5509        case -1423054677:  return addFriendly(); 
5510        case 102851257:  return addLegal(); 
5511        case 3512060:  return addRule(); 
5512        default: return super.makeProperty(hash, name);
5513        }
5514
5515      }
5516
5517      @Override
5518      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5519        switch (hash) {
5520        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5521        case -892481550: /*status*/ return new String[] {"code"};
5522        case -1179159893: /*issued*/ return new String[] {"dateTime"};
5523        case -793235316: /*applies*/ return new String[] {"Period"};
5524        case -1867885268: /*subject*/ return new String[] {"Reference"};
5525        case 110546223: /*topic*/ return new String[] {"Reference"};
5526        case 1475610435: /*authority*/ return new String[] {"Reference"};
5527        case -1326197564: /*domain*/ return new String[] {"Reference"};
5528        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
5529        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
5530        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
5531        case 1465121818: /*actionReason*/ return new String[] {"CodeableConcept"};
5532        case 676128054: /*decisionType*/ return new String[] {"CodeableConcept"};
5533        case -92412192: /*contentDerivative*/ return new String[] {"CodeableConcept"};
5534        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
5535        case 92750597: /*agent*/ return new String[] {};
5536        case -902467798: /*signer*/ return new String[] {};
5537        case 2046675654: /*valuedItem*/ return new String[] {};
5538        case 3556460: /*term*/ return new String[] {};
5539        case -108220795: /*binding*/ return new String[] {"Attachment", "Reference"};
5540        case -1423054677: /*friendly*/ return new String[] {};
5541        case 102851257: /*legal*/ return new String[] {};
5542        case 3512060: /*rule*/ return new String[] {};
5543        default: return super.getTypesForProperty(hash, name);
5544        }
5545
5546      }
5547
5548      @Override
5549      public Base addChild(String name) throws FHIRException {
5550        if (name.equals("identifier")) {
5551          this.identifier = new Identifier();
5552          return this.identifier;
5553        }
5554        else if (name.equals("status")) {
5555          throw new FHIRException("Cannot call addChild on a singleton property Contract.status");
5556        }
5557        else if (name.equals("issued")) {
5558          throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
5559        }
5560        else if (name.equals("applies")) {
5561          this.applies = new Period();
5562          return this.applies;
5563        }
5564        else if (name.equals("subject")) {
5565          return addSubject();
5566        }
5567        else if (name.equals("topic")) {
5568          return addTopic();
5569        }
5570        else if (name.equals("authority")) {
5571          return addAuthority();
5572        }
5573        else if (name.equals("domain")) {
5574          return addDomain();
5575        }
5576        else if (name.equals("type")) {
5577          this.type = new CodeableConcept();
5578          return this.type;
5579        }
5580        else if (name.equals("subType")) {
5581          return addSubType();
5582        }
5583        else if (name.equals("action")) {
5584          return addAction();
5585        }
5586        else if (name.equals("actionReason")) {
5587          return addActionReason();
5588        }
5589        else if (name.equals("decisionType")) {
5590          this.decisionType = new CodeableConcept();
5591          return this.decisionType;
5592        }
5593        else if (name.equals("contentDerivative")) {
5594          this.contentDerivative = new CodeableConcept();
5595          return this.contentDerivative;
5596        }
5597        else if (name.equals("securityLabel")) {
5598          return addSecurityLabel();
5599        }
5600        else if (name.equals("agent")) {
5601          return addAgent();
5602        }
5603        else if (name.equals("signer")) {
5604          return addSigner();
5605        }
5606        else if (name.equals("valuedItem")) {
5607          return addValuedItem();
5608        }
5609        else if (name.equals("term")) {
5610          return addTerm();
5611        }
5612        else if (name.equals("bindingAttachment")) {
5613          this.binding = new Attachment();
5614          return this.binding;
5615        }
5616        else if (name.equals("bindingReference")) {
5617          this.binding = new Reference();
5618          return this.binding;
5619        }
5620        else if (name.equals("friendly")) {
5621          return addFriendly();
5622        }
5623        else if (name.equals("legal")) {
5624          return addLegal();
5625        }
5626        else if (name.equals("rule")) {
5627          return addRule();
5628        }
5629        else
5630          return super.addChild(name);
5631      }
5632
5633  public String fhirType() {
5634    return "Contract";
5635
5636  }
5637
5638      public Contract copy() {
5639        Contract dst = new Contract();
5640        copyValues(dst);
5641        dst.identifier = identifier == null ? null : identifier.copy();
5642        dst.status = status == null ? null : status.copy();
5643        dst.issued = issued == null ? null : issued.copy();
5644        dst.applies = applies == null ? null : applies.copy();
5645        if (subject != null) {
5646          dst.subject = new ArrayList<Reference>();
5647          for (Reference i : subject)
5648            dst.subject.add(i.copy());
5649        };
5650        if (topic != null) {
5651          dst.topic = new ArrayList<Reference>();
5652          for (Reference i : topic)
5653            dst.topic.add(i.copy());
5654        };
5655        if (authority != null) {
5656          dst.authority = new ArrayList<Reference>();
5657          for (Reference i : authority)
5658            dst.authority.add(i.copy());
5659        };
5660        if (domain != null) {
5661          dst.domain = new ArrayList<Reference>();
5662          for (Reference i : domain)
5663            dst.domain.add(i.copy());
5664        };
5665        dst.type = type == null ? null : type.copy();
5666        if (subType != null) {
5667          dst.subType = new ArrayList<CodeableConcept>();
5668          for (CodeableConcept i : subType)
5669            dst.subType.add(i.copy());
5670        };
5671        if (action != null) {
5672          dst.action = new ArrayList<CodeableConcept>();
5673          for (CodeableConcept i : action)
5674            dst.action.add(i.copy());
5675        };
5676        if (actionReason != null) {
5677          dst.actionReason = new ArrayList<CodeableConcept>();
5678          for (CodeableConcept i : actionReason)
5679            dst.actionReason.add(i.copy());
5680        };
5681        dst.decisionType = decisionType == null ? null : decisionType.copy();
5682        dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
5683        if (securityLabel != null) {
5684          dst.securityLabel = new ArrayList<Coding>();
5685          for (Coding i : securityLabel)
5686            dst.securityLabel.add(i.copy());
5687        };
5688        if (agent != null) {
5689          dst.agent = new ArrayList<AgentComponent>();
5690          for (AgentComponent i : agent)
5691            dst.agent.add(i.copy());
5692        };
5693        if (signer != null) {
5694          dst.signer = new ArrayList<SignatoryComponent>();
5695          for (SignatoryComponent i : signer)
5696            dst.signer.add(i.copy());
5697        };
5698        if (valuedItem != null) {
5699          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5700          for (ValuedItemComponent i : valuedItem)
5701            dst.valuedItem.add(i.copy());
5702        };
5703        if (term != null) {
5704          dst.term = new ArrayList<TermComponent>();
5705          for (TermComponent i : term)
5706            dst.term.add(i.copy());
5707        };
5708        dst.binding = binding == null ? null : binding.copy();
5709        if (friendly != null) {
5710          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
5711          for (FriendlyLanguageComponent i : friendly)
5712            dst.friendly.add(i.copy());
5713        };
5714        if (legal != null) {
5715          dst.legal = new ArrayList<LegalLanguageComponent>();
5716          for (LegalLanguageComponent i : legal)
5717            dst.legal.add(i.copy());
5718        };
5719        if (rule != null) {
5720          dst.rule = new ArrayList<ComputableLanguageComponent>();
5721          for (ComputableLanguageComponent i : rule)
5722            dst.rule.add(i.copy());
5723        };
5724        return dst;
5725      }
5726
5727      protected Contract typedCopy() {
5728        return copy();
5729      }
5730
5731      @Override
5732      public boolean equalsDeep(Base other_) {
5733        if (!super.equalsDeep(other_))
5734          return false;
5735        if (!(other_ instanceof Contract))
5736          return false;
5737        Contract o = (Contract) other_;
5738        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(issued, o.issued, true)
5739           && compareDeep(applies, o.applies, true) && compareDeep(subject, o.subject, true) && compareDeep(topic, o.topic, true)
5740           && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true) && compareDeep(type, o.type, true)
5741           && compareDeep(subType, o.subType, true) && compareDeep(action, o.action, true) && compareDeep(actionReason, o.actionReason, true)
5742           && compareDeep(decisionType, o.decisionType, true) && compareDeep(contentDerivative, o.contentDerivative, true)
5743           && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(agent, o.agent, true) && compareDeep(signer, o.signer, true)
5744           && compareDeep(valuedItem, o.valuedItem, true) && compareDeep(term, o.term, true) && compareDeep(binding, o.binding, true)
5745           && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true) && compareDeep(rule, o.rule, true)
5746          ;
5747      }
5748
5749      @Override
5750      public boolean equalsShallow(Base other_) {
5751        if (!super.equalsShallow(other_))
5752          return false;
5753        if (!(other_ instanceof Contract))
5754          return false;
5755        Contract o = (Contract) other_;
5756        return compareValues(status, o.status, true) && compareValues(issued, o.issued, true);
5757      }
5758
5759      public boolean isEmpty() {
5760        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, issued
5761          , applies, subject, topic, authority, domain, type, subType, action, actionReason
5762          , decisionType, contentDerivative, securityLabel, agent, signer, valuedItem, term
5763          , binding, friendly, legal, rule);
5764      }
5765
5766  @Override
5767  public ResourceType getResourceType() {
5768    return ResourceType.Contract;
5769   }
5770
5771 /**
5772   * Search parameter: <b>identifier</b>
5773   * <p>
5774   * Description: <b>The identity of the contract</b><br>
5775   * Type: <b>token</b><br>
5776   * Path: <b>Contract.identifier</b><br>
5777   * </p>
5778   */
5779  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
5780  public static final String SP_IDENTIFIER = "identifier";
5781 /**
5782   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5783   * <p>
5784   * Description: <b>The identity of the contract</b><br>
5785   * Type: <b>token</b><br>
5786   * Path: <b>Contract.identifier</b><br>
5787   * </p>
5788   */
5789  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5790
5791 /**
5792   * Search parameter: <b>agent</b>
5793   * <p>
5794   * Description: <b>Agent to the Contact</b><br>
5795   * Type: <b>reference</b><br>
5796   * Path: <b>Contract.agent.actor</b><br>
5797   * </p>
5798   */
5799  @SearchParamDefinition(name="agent", path="Contract.agent.actor", description="Agent to the Contact", type="reference", target={Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class } )
5800  public static final String SP_AGENT = "agent";
5801 /**
5802   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
5803   * <p>
5804   * Description: <b>Agent to the Contact</b><br>
5805   * Type: <b>reference</b><br>
5806   * Path: <b>Contract.agent.actor</b><br>
5807   * </p>
5808   */
5809  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
5810
5811/**
5812   * Constant for fluent queries to be used to add include statements. Specifies
5813   * the path value of "<b>Contract:agent</b>".
5814   */
5815  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("Contract:agent").toLocked();
5816
5817 /**
5818   * Search parameter: <b>patient</b>
5819   * <p>
5820   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
5821   * Type: <b>reference</b><br>
5822   * Path: <b>Contract.subject</b><br>
5823   * </p>
5824   */
5825  @SearchParamDefinition(name="patient", path="Contract.subject", description="The identity of the subject of the contract (if a patient)", type="reference", target={Patient.class } )
5826  public static final String SP_PATIENT = "patient";
5827 /**
5828   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5829   * <p>
5830   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
5831   * Type: <b>reference</b><br>
5832   * Path: <b>Contract.subject</b><br>
5833   * </p>
5834   */
5835  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
5836
5837/**
5838   * Constant for fluent queries to be used to add include statements. Specifies
5839   * the path value of "<b>Contract:patient</b>".
5840   */
5841  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Contract:patient").toLocked();
5842
5843 /**
5844   * Search parameter: <b>subject</b>
5845   * <p>
5846   * Description: <b>The identity of the subject of the contract</b><br>
5847   * Type: <b>reference</b><br>
5848   * Path: <b>Contract.subject</b><br>
5849   * </p>
5850   */
5851  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the subject of the contract", type="reference" )
5852  public static final String SP_SUBJECT = "subject";
5853 /**
5854   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
5855   * <p>
5856   * Description: <b>The identity of the subject of the contract</b><br>
5857   * Type: <b>reference</b><br>
5858   * Path: <b>Contract.subject</b><br>
5859   * </p>
5860   */
5861  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
5862
5863/**
5864   * Constant for fluent queries to be used to add include statements. Specifies
5865   * the path value of "<b>Contract:subject</b>".
5866   */
5867  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Contract:subject").toLocked();
5868
5869 /**
5870   * Search parameter: <b>authority</b>
5871   * <p>
5872   * Description: <b>The authority of the contract</b><br>
5873   * Type: <b>reference</b><br>
5874   * Path: <b>Contract.authority</b><br>
5875   * </p>
5876   */
5877  @SearchParamDefinition(name="authority", path="Contract.authority", description="The authority of the contract", type="reference", target={Organization.class } )
5878  public static final String SP_AUTHORITY = "authority";
5879 /**
5880   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
5881   * <p>
5882   * Description: <b>The authority of the contract</b><br>
5883   * Type: <b>reference</b><br>
5884   * Path: <b>Contract.authority</b><br>
5885   * </p>
5886   */
5887  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHORITY);
5888
5889/**
5890   * Constant for fluent queries to be used to add include statements. Specifies
5891   * the path value of "<b>Contract:authority</b>".
5892   */
5893  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include("Contract:authority").toLocked();
5894
5895 /**
5896   * Search parameter: <b>domain</b>
5897   * <p>
5898   * Description: <b>The domain of the contract</b><br>
5899   * Type: <b>reference</b><br>
5900   * Path: <b>Contract.domain</b><br>
5901   * </p>
5902   */
5903  @SearchParamDefinition(name="domain", path="Contract.domain", description="The domain of the contract", type="reference", target={Location.class } )
5904  public static final String SP_DOMAIN = "domain";
5905 /**
5906   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
5907   * <p>
5908   * Description: <b>The domain of the contract</b><br>
5909   * Type: <b>reference</b><br>
5910   * Path: <b>Contract.domain</b><br>
5911   * </p>
5912   */
5913  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DOMAIN);
5914
5915/**
5916   * Constant for fluent queries to be used to add include statements. Specifies
5917   * the path value of "<b>Contract:domain</b>".
5918   */
5919  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include("Contract:domain").toLocked();
5920
5921 /**
5922   * Search parameter: <b>term-topic</b>
5923   * <p>
5924   * Description: <b>The identity of the topic of the contract terms</b><br>
5925   * Type: <b>reference</b><br>
5926   * Path: <b>Contract.term.topic</b><br>
5927   * </p>
5928   */
5929  @SearchParamDefinition(name="term-topic", path="Contract.term.topic", description="The identity of the topic of the contract terms", type="reference" )
5930  public static final String SP_TERM_TOPIC = "term-topic";
5931 /**
5932   * <b>Fluent Client</b> search parameter constant for <b>term-topic</b>
5933   * <p>
5934   * Description: <b>The identity of the topic of the contract terms</b><br>
5935   * Type: <b>reference</b><br>
5936   * Path: <b>Contract.term.topic</b><br>
5937   * </p>
5938   */
5939  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TERM_TOPIC = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TERM_TOPIC);
5940
5941/**
5942   * Constant for fluent queries to be used to add include statements. Specifies
5943   * the path value of "<b>Contract:term-topic</b>".
5944   */
5945  public static final ca.uhn.fhir.model.api.Include INCLUDE_TERM_TOPIC = new ca.uhn.fhir.model.api.Include("Contract:term-topic").toLocked();
5946
5947 /**
5948   * Search parameter: <b>issued</b>
5949   * <p>
5950   * Description: <b>The date/time the contract was issued</b><br>
5951   * Type: <b>date</b><br>
5952   * Path: <b>Contract.issued</b><br>
5953   * </p>
5954   */
5955  @SearchParamDefinition(name="issued", path="Contract.issued", description="The date/time the contract was issued", type="date" )
5956  public static final String SP_ISSUED = "issued";
5957 /**
5958   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
5959   * <p>
5960   * Description: <b>The date/time the contract was issued</b><br>
5961   * Type: <b>date</b><br>
5962   * Path: <b>Contract.issued</b><br>
5963   * </p>
5964   */
5965  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
5966
5967 /**
5968   * Search parameter: <b>signer</b>
5969   * <p>
5970   * Description: <b>Contract Signatory Party</b><br>
5971   * Type: <b>reference</b><br>
5972   * Path: <b>Contract.signer.party</b><br>
5973   * </p>
5974   */
5975  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference", target={Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
5976  public static final String SP_SIGNER = "signer";
5977 /**
5978   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
5979   * <p>
5980   * Description: <b>Contract Signatory Party</b><br>
5981   * Type: <b>reference</b><br>
5982   * Path: <b>Contract.signer.party</b><br>
5983   * </p>
5984   */
5985  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SIGNER);
5986
5987/**
5988   * Constant for fluent queries to be used to add include statements. Specifies
5989   * the path value of "<b>Contract:signer</b>".
5990   */
5991  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include("Contract:signer").toLocked();
5992
5993
5994}