001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import java.math.*;
040import org.hl7.fhir.utilities.Utilities;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.
051 */
052@ResourceDef(name="Contract", profile="http://hl7.org/fhir/StructureDefinition/Contract")
053public class Contract extends DomainResource {
054
055    public enum ContractStatus {
056        /**
057         * 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.
058         */
059        AMENDED, 
060        /**
061         * 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.
062         */
063        APPENDED, 
064        /**
065         * 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.
066         */
067        CANCELLED, 
068        /**
069         * 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.
070         */
071        DISPUTED, 
072        /**
073         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
074         */
075        ENTEREDINERROR, 
076        /**
077         * 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.
078         */
079        EXECUTABLE, 
080        /**
081         * 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.
082         */
083        EXECUTED, 
084        /**
085         * 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.
086         */
087        NEGOTIABLE, 
088        /**
089         * 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.
090         */
091        OFFERED, 
092        /**
093         * 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.
094         */
095        POLICY, 
096        /**
097         *  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.
098         */
099        REJECTED, 
100        /**
101         * 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.
102         */
103        RENEWED, 
104        /**
105         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
106         */
107        REVOKED, 
108        /**
109         * 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.
110         */
111        RESOLVED, 
112        /**
113         * Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.
114         */
115        TERMINATED, 
116        /**
117         * added to help the parsers with the generic types
118         */
119        NULL;
120        public static ContractStatus fromCode(String codeString) throws FHIRException {
121            if (codeString == null || "".equals(codeString))
122                return null;
123        if ("amended".equals(codeString))
124          return AMENDED;
125        if ("appended".equals(codeString))
126          return APPENDED;
127        if ("cancelled".equals(codeString))
128          return CANCELLED;
129        if ("disputed".equals(codeString))
130          return DISPUTED;
131        if ("entered-in-error".equals(codeString))
132          return ENTEREDINERROR;
133        if ("executable".equals(codeString))
134          return EXECUTABLE;
135        if ("executed".equals(codeString))
136          return EXECUTED;
137        if ("negotiable".equals(codeString))
138          return NEGOTIABLE;
139        if ("offered".equals(codeString))
140          return OFFERED;
141        if ("policy".equals(codeString))
142          return POLICY;
143        if ("rejected".equals(codeString))
144          return REJECTED;
145        if ("renewed".equals(codeString))
146          return RENEWED;
147        if ("revoked".equals(codeString))
148          return REVOKED;
149        if ("resolved".equals(codeString))
150          return RESOLVED;
151        if ("terminated".equals(codeString))
152          return TERMINATED;
153        if (Configuration.isAcceptInvalidEnums())
154          return null;
155        else
156          throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
157        }
158        public String toCode() {
159          switch (this) {
160            case AMENDED: return "amended";
161            case APPENDED: return "appended";
162            case CANCELLED: return "cancelled";
163            case DISPUTED: return "disputed";
164            case ENTEREDINERROR: return "entered-in-error";
165            case EXECUTABLE: return "executable";
166            case EXECUTED: return "executed";
167            case NEGOTIABLE: return "negotiable";
168            case OFFERED: return "offered";
169            case POLICY: return "policy";
170            case REJECTED: return "rejected";
171            case RENEWED: return "renewed";
172            case REVOKED: return "revoked";
173            case RESOLVED: return "resolved";
174            case TERMINATED: return "terminated";
175            case NULL: return null;
176            default: return "?";
177          }
178        }
179        public String getSystem() {
180          switch (this) {
181            case AMENDED: return "http://hl7.org/fhir/contract-status";
182            case APPENDED: return "http://hl7.org/fhir/contract-status";
183            case CANCELLED: return "http://hl7.org/fhir/contract-status";
184            case DISPUTED: return "http://hl7.org/fhir/contract-status";
185            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
186            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
187            case EXECUTED: return "http://hl7.org/fhir/contract-status";
188            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
189            case OFFERED: return "http://hl7.org/fhir/contract-status";
190            case POLICY: return "http://hl7.org/fhir/contract-status";
191            case REJECTED: return "http://hl7.org/fhir/contract-status";
192            case RENEWED: return "http://hl7.org/fhir/contract-status";
193            case REVOKED: return "http://hl7.org/fhir/contract-status";
194            case RESOLVED: return "http://hl7.org/fhir/contract-status";
195            case TERMINATED: return "http://hl7.org/fhir/contract-status";
196            case NULL: return null;
197            default: return "?";
198          }
199        }
200        public String getDefinition() {
201          switch (this) {
202            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.";
203            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.";
204            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.";
205            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.";
206            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
207            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.";
208            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.";
209            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.";
210            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.";
211            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.";
212            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.";
213            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.";
214            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.";
215            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.";
216            case TERMINATED: return "Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
217            case NULL: return null;
218            default: return "?";
219          }
220        }
221        public String getDisplay() {
222          switch (this) {
223            case AMENDED: return "Amended";
224            case APPENDED: return "Appended";
225            case CANCELLED: return "Cancelled";
226            case DISPUTED: return "Disputed";
227            case ENTEREDINERROR: return "Entered in Error";
228            case EXECUTABLE: return "Executable";
229            case EXECUTED: return "Executed";
230            case NEGOTIABLE: return "Negotiable";
231            case OFFERED: return "Offered";
232            case POLICY: return "Policy";
233            case REJECTED: return "Rejected";
234            case RENEWED: return "Renewed";
235            case REVOKED: return "Revoked";
236            case RESOLVED: return "Resolved";
237            case TERMINATED: return "Terminated";
238            case NULL: return null;
239            default: return "?";
240          }
241        }
242    }
243
244  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
245    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
246      if (codeString == null || "".equals(codeString))
247            if (codeString == null || "".equals(codeString))
248                return null;
249        if ("amended".equals(codeString))
250          return ContractStatus.AMENDED;
251        if ("appended".equals(codeString))
252          return ContractStatus.APPENDED;
253        if ("cancelled".equals(codeString))
254          return ContractStatus.CANCELLED;
255        if ("disputed".equals(codeString))
256          return ContractStatus.DISPUTED;
257        if ("entered-in-error".equals(codeString))
258          return ContractStatus.ENTEREDINERROR;
259        if ("executable".equals(codeString))
260          return ContractStatus.EXECUTABLE;
261        if ("executed".equals(codeString))
262          return ContractStatus.EXECUTED;
263        if ("negotiable".equals(codeString))
264          return ContractStatus.NEGOTIABLE;
265        if ("offered".equals(codeString))
266          return ContractStatus.OFFERED;
267        if ("policy".equals(codeString))
268          return ContractStatus.POLICY;
269        if ("rejected".equals(codeString))
270          return ContractStatus.REJECTED;
271        if ("renewed".equals(codeString))
272          return ContractStatus.RENEWED;
273        if ("revoked".equals(codeString))
274          return ContractStatus.REVOKED;
275        if ("resolved".equals(codeString))
276          return ContractStatus.RESOLVED;
277        if ("terminated".equals(codeString))
278          return ContractStatus.TERMINATED;
279        throw new IllegalArgumentException("Unknown ContractStatus code '"+codeString+"'");
280        }
281        public Enumeration<ContractStatus> fromType(Base code) throws FHIRException {
282          if (code == null)
283            return null;
284          if (code.isEmpty())
285            return new Enumeration<ContractStatus>(this);
286          String codeString = ((PrimitiveType) code).asStringValue();
287          if (codeString == null || "".equals(codeString))
288            return null;
289        if ("amended".equals(codeString))
290          return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED);
291        if ("appended".equals(codeString))
292          return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED);
293        if ("cancelled".equals(codeString))
294          return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED);
295        if ("disputed".equals(codeString))
296          return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED);
297        if ("entered-in-error".equals(codeString))
298          return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR);
299        if ("executable".equals(codeString))
300          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE);
301        if ("executed".equals(codeString))
302          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED);
303        if ("negotiable".equals(codeString))
304          return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE);
305        if ("offered".equals(codeString))
306          return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED);
307        if ("policy".equals(codeString))
308          return new Enumeration<ContractStatus>(this, ContractStatus.POLICY);
309        if ("rejected".equals(codeString))
310          return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED);
311        if ("renewed".equals(codeString))
312          return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED);
313        if ("revoked".equals(codeString))
314          return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED);
315        if ("resolved".equals(codeString))
316          return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED);
317        if ("terminated".equals(codeString))
318          return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED);
319        throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
320        }
321    public String toCode(ContractStatus code) {
322      if (code == ContractStatus.AMENDED)
323        return "amended";
324      if (code == ContractStatus.APPENDED)
325        return "appended";
326      if (code == ContractStatus.CANCELLED)
327        return "cancelled";
328      if (code == ContractStatus.DISPUTED)
329        return "disputed";
330      if (code == ContractStatus.ENTEREDINERROR)
331        return "entered-in-error";
332      if (code == ContractStatus.EXECUTABLE)
333        return "executable";
334      if (code == ContractStatus.EXECUTED)
335        return "executed";
336      if (code == ContractStatus.NEGOTIABLE)
337        return "negotiable";
338      if (code == ContractStatus.OFFERED)
339        return "offered";
340      if (code == ContractStatus.POLICY)
341        return "policy";
342      if (code == ContractStatus.REJECTED)
343        return "rejected";
344      if (code == ContractStatus.RENEWED)
345        return "renewed";
346      if (code == ContractStatus.REVOKED)
347        return "revoked";
348      if (code == ContractStatus.RESOLVED)
349        return "resolved";
350      if (code == ContractStatus.TERMINATED)
351        return "terminated";
352      return "?";
353      }
354    public String toSystem(ContractStatus code) {
355      return code.getSystem();
356      }
357    }
358
359    public enum ContractPublicationStatus {
360        /**
361         * 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.
362         */
363        AMENDED, 
364        /**
365         * 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.
366         */
367        APPENDED, 
368        /**
369         * 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.
370         */
371        CANCELLED, 
372        /**
373         * 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.
374         */
375        DISPUTED, 
376        /**
377         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
378         */
379        ENTEREDINERROR, 
380        /**
381         * 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.
382         */
383        EXECUTABLE, 
384        /**
385         * 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.
386         */
387        EXECUTED, 
388        /**
389         * 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.
390         */
391        NEGOTIABLE, 
392        /**
393         * 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.
394         */
395        OFFERED, 
396        /**
397         * 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.
398         */
399        POLICY, 
400        /**
401         *  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.
402         */
403        REJECTED, 
404        /**
405         * 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.
406         */
407        RENEWED, 
408        /**
409         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
410         */
411        REVOKED, 
412        /**
413         * 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.
414         */
415        RESOLVED, 
416        /**
417         * Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.
418         */
419        TERMINATED, 
420        /**
421         * added to help the parsers with the generic types
422         */
423        NULL;
424        public static ContractPublicationStatus fromCode(String codeString) throws FHIRException {
425            if (codeString == null || "".equals(codeString))
426                return null;
427        if ("amended".equals(codeString))
428          return AMENDED;
429        if ("appended".equals(codeString))
430          return APPENDED;
431        if ("cancelled".equals(codeString))
432          return CANCELLED;
433        if ("disputed".equals(codeString))
434          return DISPUTED;
435        if ("entered-in-error".equals(codeString))
436          return ENTEREDINERROR;
437        if ("executable".equals(codeString))
438          return EXECUTABLE;
439        if ("executed".equals(codeString))
440          return EXECUTED;
441        if ("negotiable".equals(codeString))
442          return NEGOTIABLE;
443        if ("offered".equals(codeString))
444          return OFFERED;
445        if ("policy".equals(codeString))
446          return POLICY;
447        if ("rejected".equals(codeString))
448          return REJECTED;
449        if ("renewed".equals(codeString))
450          return RENEWED;
451        if ("revoked".equals(codeString))
452          return REVOKED;
453        if ("resolved".equals(codeString))
454          return RESOLVED;
455        if ("terminated".equals(codeString))
456          return TERMINATED;
457        if (Configuration.isAcceptInvalidEnums())
458          return null;
459        else
460          throw new FHIRException("Unknown ContractPublicationStatus code '"+codeString+"'");
461        }
462        public String toCode() {
463          switch (this) {
464            case AMENDED: return "amended";
465            case APPENDED: return "appended";
466            case CANCELLED: return "cancelled";
467            case DISPUTED: return "disputed";
468            case ENTEREDINERROR: return "entered-in-error";
469            case EXECUTABLE: return "executable";
470            case EXECUTED: return "executed";
471            case NEGOTIABLE: return "negotiable";
472            case OFFERED: return "offered";
473            case POLICY: return "policy";
474            case REJECTED: return "rejected";
475            case RENEWED: return "renewed";
476            case REVOKED: return "revoked";
477            case RESOLVED: return "resolved";
478            case TERMINATED: return "terminated";
479            case NULL: return null;
480            default: return "?";
481          }
482        }
483        public String getSystem() {
484          switch (this) {
485            case AMENDED: return "http://hl7.org/fhir/contract-publicationstatus";
486            case APPENDED: return "http://hl7.org/fhir/contract-publicationstatus";
487            case CANCELLED: return "http://hl7.org/fhir/contract-publicationstatus";
488            case DISPUTED: return "http://hl7.org/fhir/contract-publicationstatus";
489            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-publicationstatus";
490            case EXECUTABLE: return "http://hl7.org/fhir/contract-publicationstatus";
491            case EXECUTED: return "http://hl7.org/fhir/contract-publicationstatus";
492            case NEGOTIABLE: return "http://hl7.org/fhir/contract-publicationstatus";
493            case OFFERED: return "http://hl7.org/fhir/contract-publicationstatus";
494            case POLICY: return "http://hl7.org/fhir/contract-publicationstatus";
495            case REJECTED: return "http://hl7.org/fhir/contract-publicationstatus";
496            case RENEWED: return "http://hl7.org/fhir/contract-publicationstatus";
497            case REVOKED: return "http://hl7.org/fhir/contract-publicationstatus";
498            case RESOLVED: return "http://hl7.org/fhir/contract-publicationstatus";
499            case TERMINATED: return "http://hl7.org/fhir/contract-publicationstatus";
500            case NULL: return null;
501            default: return "?";
502          }
503        }
504        public String getDefinition() {
505          switch (this) {
506            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.";
507            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.";
508            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.";
509            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.";
510            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
511            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.";
512            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.";
513            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.";
514            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.";
515            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.";
516            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.";
517            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.";
518            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.";
519            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.";
520            case TERMINATED: return "Contract reaches its expiry date. It might or might not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
521            case NULL: return null;
522            default: return "?";
523          }
524        }
525        public String getDisplay() {
526          switch (this) {
527            case AMENDED: return "Amended";
528            case APPENDED: return "Appended";
529            case CANCELLED: return "Cancelled";
530            case DISPUTED: return "Disputed";
531            case ENTEREDINERROR: return "Entered in Error";
532            case EXECUTABLE: return "Executable";
533            case EXECUTED: return "Executed";
534            case NEGOTIABLE: return "Negotiable";
535            case OFFERED: return "Offered";
536            case POLICY: return "Policy";
537            case REJECTED: return "Rejected";
538            case RENEWED: return "Renewed";
539            case REVOKED: return "Revoked";
540            case RESOLVED: return "Resolved";
541            case TERMINATED: return "Terminated";
542            case NULL: return null;
543            default: return "?";
544          }
545        }
546    }
547
548  public static class ContractPublicationStatusEnumFactory implements EnumFactory<ContractPublicationStatus> {
549    public ContractPublicationStatus fromCode(String codeString) throws IllegalArgumentException {
550      if (codeString == null || "".equals(codeString))
551            if (codeString == null || "".equals(codeString))
552                return null;
553        if ("amended".equals(codeString))
554          return ContractPublicationStatus.AMENDED;
555        if ("appended".equals(codeString))
556          return ContractPublicationStatus.APPENDED;
557        if ("cancelled".equals(codeString))
558          return ContractPublicationStatus.CANCELLED;
559        if ("disputed".equals(codeString))
560          return ContractPublicationStatus.DISPUTED;
561        if ("entered-in-error".equals(codeString))
562          return ContractPublicationStatus.ENTEREDINERROR;
563        if ("executable".equals(codeString))
564          return ContractPublicationStatus.EXECUTABLE;
565        if ("executed".equals(codeString))
566          return ContractPublicationStatus.EXECUTED;
567        if ("negotiable".equals(codeString))
568          return ContractPublicationStatus.NEGOTIABLE;
569        if ("offered".equals(codeString))
570          return ContractPublicationStatus.OFFERED;
571        if ("policy".equals(codeString))
572          return ContractPublicationStatus.POLICY;
573        if ("rejected".equals(codeString))
574          return ContractPublicationStatus.REJECTED;
575        if ("renewed".equals(codeString))
576          return ContractPublicationStatus.RENEWED;
577        if ("revoked".equals(codeString))
578          return ContractPublicationStatus.REVOKED;
579        if ("resolved".equals(codeString))
580          return ContractPublicationStatus.RESOLVED;
581        if ("terminated".equals(codeString))
582          return ContractPublicationStatus.TERMINATED;
583        throw new IllegalArgumentException("Unknown ContractPublicationStatus code '"+codeString+"'");
584        }
585        public Enumeration<ContractPublicationStatus> fromType(Base code) throws FHIRException {
586          if (code == null)
587            return null;
588          if (code.isEmpty())
589            return new Enumeration<ContractPublicationStatus>(this);
590          String codeString = ((PrimitiveType) code).asStringValue();
591          if (codeString == null || "".equals(codeString))
592            return null;
593        if ("amended".equals(codeString))
594          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.AMENDED);
595        if ("appended".equals(codeString))
596          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.APPENDED);
597        if ("cancelled".equals(codeString))
598          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.CANCELLED);
599        if ("disputed".equals(codeString))
600          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.DISPUTED);
601        if ("entered-in-error".equals(codeString))
602          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.ENTEREDINERROR);
603        if ("executable".equals(codeString))
604          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTABLE);
605        if ("executed".equals(codeString))
606          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTED);
607        if ("negotiable".equals(codeString))
608          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NEGOTIABLE);
609        if ("offered".equals(codeString))
610          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.OFFERED);
611        if ("policy".equals(codeString))
612          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.POLICY);
613        if ("rejected".equals(codeString))
614          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REJECTED);
615        if ("renewed".equals(codeString))
616          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RENEWED);
617        if ("revoked".equals(codeString))
618          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REVOKED);
619        if ("resolved".equals(codeString))
620          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RESOLVED);
621        if ("terminated".equals(codeString))
622          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.TERMINATED);
623        throw new FHIRException("Unknown ContractPublicationStatus code '"+codeString+"'");
624        }
625    public String toCode(ContractPublicationStatus code) {
626      if (code == ContractPublicationStatus.AMENDED)
627        return "amended";
628      if (code == ContractPublicationStatus.APPENDED)
629        return "appended";
630      if (code == ContractPublicationStatus.CANCELLED)
631        return "cancelled";
632      if (code == ContractPublicationStatus.DISPUTED)
633        return "disputed";
634      if (code == ContractPublicationStatus.ENTEREDINERROR)
635        return "entered-in-error";
636      if (code == ContractPublicationStatus.EXECUTABLE)
637        return "executable";
638      if (code == ContractPublicationStatus.EXECUTED)
639        return "executed";
640      if (code == ContractPublicationStatus.NEGOTIABLE)
641        return "negotiable";
642      if (code == ContractPublicationStatus.OFFERED)
643        return "offered";
644      if (code == ContractPublicationStatus.POLICY)
645        return "policy";
646      if (code == ContractPublicationStatus.REJECTED)
647        return "rejected";
648      if (code == ContractPublicationStatus.RENEWED)
649        return "renewed";
650      if (code == ContractPublicationStatus.REVOKED)
651        return "revoked";
652      if (code == ContractPublicationStatus.RESOLVED)
653        return "resolved";
654      if (code == ContractPublicationStatus.TERMINATED)
655        return "terminated";
656      return "?";
657      }
658    public String toSystem(ContractPublicationStatus code) {
659      return code.getSystem();
660      }
661    }
662
663    @Block()
664    public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
665        /**
666         * Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.
667         */
668        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
669        @Description(shortDefinition="Content structure and use", formalDefinition="Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation." )
670        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-type")
671        protected CodeableConcept type;
672
673        /**
674         * Detailed Precusory content type.
675         */
676        @Child(name = "subType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
677        @Description(shortDefinition="Detailed Content Type Definition", formalDefinition="Detailed Precusory content type." )
678        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-subtype")
679        protected CodeableConcept subType;
680
681        /**
682         * The  individual or organization that published the Contract precursor content.
683         */
684        @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
685        @Description(shortDefinition="Publisher Entity", formalDefinition="The  individual or organization that published the Contract precursor content." )
686        protected Reference publisher;
687
688        /**
689         * The actual object that is the target of the reference (The  individual or organization that published the Contract precursor content.)
690         */
691        protected Resource publisherTarget;
692
693        /**
694         * The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.
695         */
696        @Child(name = "publicationDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
697        @Description(shortDefinition="When published", formalDefinition="The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes." )
698        protected DateTimeType publicationDate;
699
700        /**
701         * amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.
702         */
703        @Child(name = "publicationStatus", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=false)
704        @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition="amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated." )
705        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-publicationstatus")
706        protected Enumeration<ContractPublicationStatus> publicationStatus;
707
708        /**
709         * A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
710         */
711        @Child(name = "copyright", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=false)
712        @Description(shortDefinition="Publication Ownership", formalDefinition="A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content." )
713        protected MarkdownType copyright;
714
715        private static final long serialVersionUID = -699592864L;
716
717    /**
718     * Constructor
719     */
720      public ContentDefinitionComponent() {
721        super();
722      }
723
724    /**
725     * Constructor
726     */
727      public ContentDefinitionComponent(CodeableConcept type, Enumeration<ContractPublicationStatus> publicationStatus) {
728        super();
729        this.type = type;
730        this.publicationStatus = publicationStatus;
731      }
732
733        /**
734         * @return {@link #type} (Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.)
735         */
736        public CodeableConcept getType() { 
737          if (this.type == null)
738            if (Configuration.errorOnAutoCreate())
739              throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
740            else if (Configuration.doAutoCreate())
741              this.type = new CodeableConcept(); // cc
742          return this.type;
743        }
744
745        public boolean hasType() { 
746          return this.type != null && !this.type.isEmpty();
747        }
748
749        /**
750         * @param value {@link #type} (Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.)
751         */
752        public ContentDefinitionComponent setType(CodeableConcept value) { 
753          this.type = value;
754          return this;
755        }
756
757        /**
758         * @return {@link #subType} (Detailed Precusory content type.)
759         */
760        public CodeableConcept getSubType() { 
761          if (this.subType == null)
762            if (Configuration.errorOnAutoCreate())
763              throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
764            else if (Configuration.doAutoCreate())
765              this.subType = new CodeableConcept(); // cc
766          return this.subType;
767        }
768
769        public boolean hasSubType() { 
770          return this.subType != null && !this.subType.isEmpty();
771        }
772
773        /**
774         * @param value {@link #subType} (Detailed Precusory content type.)
775         */
776        public ContentDefinitionComponent setSubType(CodeableConcept value) { 
777          this.subType = value;
778          return this;
779        }
780
781        /**
782         * @return {@link #publisher} (The  individual or organization that published the Contract precursor content.)
783         */
784        public Reference getPublisher() { 
785          if (this.publisher == null)
786            if (Configuration.errorOnAutoCreate())
787              throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
788            else if (Configuration.doAutoCreate())
789              this.publisher = new Reference(); // cc
790          return this.publisher;
791        }
792
793        public boolean hasPublisher() { 
794          return this.publisher != null && !this.publisher.isEmpty();
795        }
796
797        /**
798         * @param value {@link #publisher} (The  individual or organization that published the Contract precursor content.)
799         */
800        public ContentDefinitionComponent setPublisher(Reference value) { 
801          this.publisher = value;
802          return this;
803        }
804
805        /**
806         * @return {@link #publisher} 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  individual or organization that published the Contract precursor content.)
807         */
808        public Resource getPublisherTarget() { 
809          return this.publisherTarget;
810        }
811
812        /**
813         * @param value {@link #publisher} 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  individual or organization that published the Contract precursor content.)
814         */
815        public ContentDefinitionComponent setPublisherTarget(Resource value) { 
816          this.publisherTarget = value;
817          return this;
818        }
819
820        /**
821         * @return {@link #publicationDate} (The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
822         */
823        public DateTimeType getPublicationDateElement() { 
824          if (this.publicationDate == null)
825            if (Configuration.errorOnAutoCreate())
826              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
827            else if (Configuration.doAutoCreate())
828              this.publicationDate = new DateTimeType(); // bb
829          return this.publicationDate;
830        }
831
832        public boolean hasPublicationDateElement() { 
833          return this.publicationDate != null && !this.publicationDate.isEmpty();
834        }
835
836        public boolean hasPublicationDate() { 
837          return this.publicationDate != null && !this.publicationDate.isEmpty();
838        }
839
840        /**
841         * @param value {@link #publicationDate} (The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
842         */
843        public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) { 
844          this.publicationDate = value;
845          return this;
846        }
847
848        /**
849         * @return The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.
850         */
851        public Date getPublicationDate() { 
852          return this.publicationDate == null ? null : this.publicationDate.getValue();
853        }
854
855        /**
856         * @param value The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.
857         */
858        public ContentDefinitionComponent setPublicationDate(Date value) { 
859          if (value == null)
860            this.publicationDate = null;
861          else {
862            if (this.publicationDate == null)
863              this.publicationDate = new DateTimeType();
864            this.publicationDate.setValue(value);
865          }
866          return this;
867        }
868
869        /**
870         * @return {@link #publicationStatus} (amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
871         */
872        public Enumeration<ContractPublicationStatus> getPublicationStatusElement() { 
873          if (this.publicationStatus == null)
874            if (Configuration.errorOnAutoCreate())
875              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
876            else if (Configuration.doAutoCreate())
877              this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory()); // bb
878          return this.publicationStatus;
879        }
880
881        public boolean hasPublicationStatusElement() { 
882          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
883        }
884
885        public boolean hasPublicationStatus() { 
886          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
887        }
888
889        /**
890         * @param value {@link #publicationStatus} (amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
891         */
892        public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractPublicationStatus> value) { 
893          this.publicationStatus = value;
894          return this;
895        }
896
897        /**
898         * @return amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.
899         */
900        public ContractPublicationStatus getPublicationStatus() { 
901          return this.publicationStatus == null ? null : this.publicationStatus.getValue();
902        }
903
904        /**
905         * @param value amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.
906         */
907        public ContentDefinitionComponent setPublicationStatus(ContractPublicationStatus value) { 
908            if (this.publicationStatus == null)
909              this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory());
910            this.publicationStatus.setValue(value);
911          return this;
912        }
913
914        /**
915         * @return {@link #copyright} (A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
916         */
917        public MarkdownType getCopyrightElement() { 
918          if (this.copyright == null)
919            if (Configuration.errorOnAutoCreate())
920              throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
921            else if (Configuration.doAutoCreate())
922              this.copyright = new MarkdownType(); // bb
923          return this.copyright;
924        }
925
926        public boolean hasCopyrightElement() { 
927          return this.copyright != null && !this.copyright.isEmpty();
928        }
929
930        public boolean hasCopyright() { 
931          return this.copyright != null && !this.copyright.isEmpty();
932        }
933
934        /**
935         * @param value {@link #copyright} (A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
936         */
937        public ContentDefinitionComponent setCopyrightElement(MarkdownType value) { 
938          this.copyright = value;
939          return this;
940        }
941
942        /**
943         * @return A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
944         */
945        public String getCopyright() { 
946          return this.copyright == null ? null : this.copyright.getValue();
947        }
948
949        /**
950         * @param value A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
951         */
952        public ContentDefinitionComponent setCopyright(String value) { 
953          if (value == null)
954            this.copyright = null;
955          else {
956            if (this.copyright == null)
957              this.copyright = new MarkdownType();
958            this.copyright.setValue(value);
959          }
960          return this;
961        }
962
963        protected void listChildren(List<Property> children) {
964          super.listChildren(children);
965          children.add(new Property("type", "CodeableConcept", "Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.", 0, 1, type));
966          children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
967          children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
968          children.add(new Property("publicationDate", "dateTime", "The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.", 0, 1, publicationDate));
969          children.add(new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.", 0, 1, publicationStatus));
970          children.add(new Property("copyright", "markdown", "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.", 0, 1, copyright));
971        }
972
973        @Override
974        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
975          switch (_hash) {
976          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.", 0, 1, type);
977          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType);
978          case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
979          case 1470566394: /*publicationDate*/  return new Property("publicationDate", "dateTime", "The date (and optionally time) when the contract was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the contract changes.", 0, 1, publicationDate);
980          case 616500542: /*publicationStatus*/  return new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.", 0, 1, publicationStatus);
981          case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.", 0, 1, copyright);
982          default: return super.getNamedProperty(_hash, _name, _checkValid);
983          }
984
985        }
986
987      @Override
988      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
989        switch (hash) {
990        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
991        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
992        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
993        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateTimeType
994        case 616500542: /*publicationStatus*/ return this.publicationStatus == null ? new Base[0] : new Base[] {this.publicationStatus}; // Enumeration<ContractPublicationStatus>
995        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
996        default: return super.getProperty(hash, name, checkValid);
997        }
998
999      }
1000
1001      @Override
1002      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1003        switch (hash) {
1004        case 3575610: // type
1005          this.type = castToCodeableConcept(value); // CodeableConcept
1006          return value;
1007        case -1868521062: // subType
1008          this.subType = castToCodeableConcept(value); // CodeableConcept
1009          return value;
1010        case 1447404028: // publisher
1011          this.publisher = castToReference(value); // Reference
1012          return value;
1013        case 1470566394: // publicationDate
1014          this.publicationDate = castToDateTime(value); // DateTimeType
1015          return value;
1016        case 616500542: // publicationStatus
1017          value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1018          this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1019          return value;
1020        case 1522889671: // copyright
1021          this.copyright = castToMarkdown(value); // MarkdownType
1022          return value;
1023        default: return super.setProperty(hash, name, value);
1024        }
1025
1026      }
1027
1028      @Override
1029      public Base setProperty(String name, Base value) throws FHIRException {
1030        if (name.equals("type")) {
1031          this.type = castToCodeableConcept(value); // CodeableConcept
1032        } else if (name.equals("subType")) {
1033          this.subType = castToCodeableConcept(value); // CodeableConcept
1034        } else if (name.equals("publisher")) {
1035          this.publisher = castToReference(value); // Reference
1036        } else if (name.equals("publicationDate")) {
1037          this.publicationDate = castToDateTime(value); // DateTimeType
1038        } else if (name.equals("publicationStatus")) {
1039          value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1040          this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1041        } else if (name.equals("copyright")) {
1042          this.copyright = castToMarkdown(value); // MarkdownType
1043        } else
1044          return super.setProperty(name, value);
1045        return value;
1046      }
1047
1048      @Override
1049      public Base makeProperty(int hash, String name) throws FHIRException {
1050        switch (hash) {
1051        case 3575610:  return getType(); 
1052        case -1868521062:  return getSubType(); 
1053        case 1447404028:  return getPublisher(); 
1054        case 1470566394:  return getPublicationDateElement();
1055        case 616500542:  return getPublicationStatusElement();
1056        case 1522889671:  return getCopyrightElement();
1057        default: return super.makeProperty(hash, name);
1058        }
1059
1060      }
1061
1062      @Override
1063      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1064        switch (hash) {
1065        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1066        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1067        case 1447404028: /*publisher*/ return new String[] {"Reference"};
1068        case 1470566394: /*publicationDate*/ return new String[] {"dateTime"};
1069        case 616500542: /*publicationStatus*/ return new String[] {"code"};
1070        case 1522889671: /*copyright*/ return new String[] {"markdown"};
1071        default: return super.getTypesForProperty(hash, name);
1072        }
1073
1074      }
1075
1076      @Override
1077      public Base addChild(String name) throws FHIRException {
1078        if (name.equals("type")) {
1079          this.type = new CodeableConcept();
1080          return this.type;
1081        }
1082        else if (name.equals("subType")) {
1083          this.subType = new CodeableConcept();
1084          return this.subType;
1085        }
1086        else if (name.equals("publisher")) {
1087          this.publisher = new Reference();
1088          return this.publisher;
1089        }
1090        else if (name.equals("publicationDate")) {
1091          throw new FHIRException("Cannot call addChild on a primitive type Contract.publicationDate");
1092        }
1093        else if (name.equals("publicationStatus")) {
1094          throw new FHIRException("Cannot call addChild on a primitive type Contract.publicationStatus");
1095        }
1096        else if (name.equals("copyright")) {
1097          throw new FHIRException("Cannot call addChild on a primitive type Contract.copyright");
1098        }
1099        else
1100          return super.addChild(name);
1101      }
1102
1103      public ContentDefinitionComponent copy() {
1104        ContentDefinitionComponent dst = new ContentDefinitionComponent();
1105        copyValues(dst);
1106        return dst;
1107      }
1108
1109      public void copyValues(ContentDefinitionComponent dst) {
1110        super.copyValues(dst);
1111        dst.type = type == null ? null : type.copy();
1112        dst.subType = subType == null ? null : subType.copy();
1113        dst.publisher = publisher == null ? null : publisher.copy();
1114        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1115        dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1116        dst.copyright = copyright == null ? null : copyright.copy();
1117      }
1118
1119      @Override
1120      public boolean equalsDeep(Base other_) {
1121        if (!super.equalsDeep(other_))
1122          return false;
1123        if (!(other_ instanceof ContentDefinitionComponent))
1124          return false;
1125        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1126        return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(publisher, o.publisher, true)
1127           && compareDeep(publicationDate, o.publicationDate, true) && compareDeep(publicationStatus, o.publicationStatus, true)
1128           && compareDeep(copyright, o.copyright, true);
1129      }
1130
1131      @Override
1132      public boolean equalsShallow(Base other_) {
1133        if (!super.equalsShallow(other_))
1134          return false;
1135        if (!(other_ instanceof ContentDefinitionComponent))
1136          return false;
1137        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1138        return compareValues(publicationDate, o.publicationDate, true) && compareValues(publicationStatus, o.publicationStatus, true)
1139           && compareValues(copyright, o.copyright, true);
1140      }
1141
1142      public boolean isEmpty() {
1143        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher
1144          , publicationDate, publicationStatus, copyright);
1145      }
1146
1147  public String fhirType() {
1148    return "Contract.contentDefinition";
1149
1150  }
1151
1152  }
1153
1154    @Block()
1155    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1156        /**
1157         * Unique identifier for this particular Contract Provision.
1158         */
1159        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1160        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1161        protected Identifier identifier;
1162
1163        /**
1164         * When this Contract Provision was issued.
1165         */
1166        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1167        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1168        protected DateTimeType issued;
1169
1170        /**
1171         * Relevant time or time-period when this Contract Provision is applicable.
1172         */
1173        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1174        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1175        protected Period applies;
1176
1177        /**
1178         * The entity that the term applies to.
1179         */
1180        @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=4, min=0, max=1, modifier=false, summary=false)
1181        @Description(shortDefinition="Term Concern", formalDefinition="The entity that the term applies to." )
1182        protected Type topic;
1183
1184        /**
1185         * A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.
1186         */
1187        @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1188        @Description(shortDefinition="Contract Term Type or Form", formalDefinition="A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time." )
1189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1190        protected CodeableConcept type;
1191
1192        /**
1193         * A specialized legal clause or condition based on overarching contract type.
1194         */
1195        @Child(name = "subType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1196        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="A specialized legal clause or condition based on overarching contract type." )
1197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1198        protected CodeableConcept subType;
1199
1200        /**
1201         * Statement of a provision in a policy or a contract.
1202         */
1203        @Child(name = "text", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1204        @Description(shortDefinition="Term Statement", formalDefinition="Statement of a provision in a policy or a contract." )
1205        protected StringType text;
1206
1207        /**
1208         * Security labels that protect the handling of information about the term and its elements, which may be specifically identified..
1209         */
1210        @Child(name = "securityLabel", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1211        @Description(shortDefinition="Protection for the Term", formalDefinition="Security labels that protect the handling of information about the term and its elements, which may be specifically identified.." )
1212        protected List<SecurityLabelComponent> securityLabel;
1213
1214        /**
1215         * The matter of concern in the context of this provision of the agrement.
1216         */
1217        @Child(name = "offer", type = {}, order=9, min=1, max=1, modifier=false, summary=false)
1218        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1219        protected ContractOfferComponent offer;
1220
1221        /**
1222         * Contract Term Asset List.
1223         */
1224        @Child(name = "asset", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1225        @Description(shortDefinition="Contract Term Asset List", formalDefinition="Contract Term Asset List." )
1226        protected List<ContractAssetComponent> asset;
1227
1228        /**
1229         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1230         */
1231        @Child(name = "action", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1232        @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." )
1233        protected List<ActionComponent> action;
1234
1235        /**
1236         * Nested group of Contract Provisions.
1237         */
1238        @Child(name = "group", type = {TermComponent.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1239        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1240        protected List<TermComponent> group;
1241
1242        private static final long serialVersionUID = -460907186L;
1243
1244    /**
1245     * Constructor
1246     */
1247      public TermComponent() {
1248        super();
1249      }
1250
1251    /**
1252     * Constructor
1253     */
1254      public TermComponent(ContractOfferComponent offer) {
1255        super();
1256        this.offer = offer;
1257      }
1258
1259        /**
1260         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1261         */
1262        public Identifier getIdentifier() { 
1263          if (this.identifier == null)
1264            if (Configuration.errorOnAutoCreate())
1265              throw new Error("Attempt to auto-create TermComponent.identifier");
1266            else if (Configuration.doAutoCreate())
1267              this.identifier = new Identifier(); // cc
1268          return this.identifier;
1269        }
1270
1271        public boolean hasIdentifier() { 
1272          return this.identifier != null && !this.identifier.isEmpty();
1273        }
1274
1275        /**
1276         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1277         */
1278        public TermComponent setIdentifier(Identifier value) { 
1279          this.identifier = value;
1280          return this;
1281        }
1282
1283        /**
1284         * @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
1285         */
1286        public DateTimeType getIssuedElement() { 
1287          if (this.issued == null)
1288            if (Configuration.errorOnAutoCreate())
1289              throw new Error("Attempt to auto-create TermComponent.issued");
1290            else if (Configuration.doAutoCreate())
1291              this.issued = new DateTimeType(); // bb
1292          return this.issued;
1293        }
1294
1295        public boolean hasIssuedElement() { 
1296          return this.issued != null && !this.issued.isEmpty();
1297        }
1298
1299        public boolean hasIssued() { 
1300          return this.issued != null && !this.issued.isEmpty();
1301        }
1302
1303        /**
1304         * @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
1305         */
1306        public TermComponent setIssuedElement(DateTimeType value) { 
1307          this.issued = value;
1308          return this;
1309        }
1310
1311        /**
1312         * @return When this Contract Provision was issued.
1313         */
1314        public Date getIssued() { 
1315          return this.issued == null ? null : this.issued.getValue();
1316        }
1317
1318        /**
1319         * @param value When this Contract Provision was issued.
1320         */
1321        public TermComponent setIssued(Date value) { 
1322          if (value == null)
1323            this.issued = null;
1324          else {
1325            if (this.issued == null)
1326              this.issued = new DateTimeType();
1327            this.issued.setValue(value);
1328          }
1329          return this;
1330        }
1331
1332        /**
1333         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1334         */
1335        public Period getApplies() { 
1336          if (this.applies == null)
1337            if (Configuration.errorOnAutoCreate())
1338              throw new Error("Attempt to auto-create TermComponent.applies");
1339            else if (Configuration.doAutoCreate())
1340              this.applies = new Period(); // cc
1341          return this.applies;
1342        }
1343
1344        public boolean hasApplies() { 
1345          return this.applies != null && !this.applies.isEmpty();
1346        }
1347
1348        /**
1349         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1350         */
1351        public TermComponent setApplies(Period value) { 
1352          this.applies = value;
1353          return this;
1354        }
1355
1356        /**
1357         * @return {@link #topic} (The entity that the term applies to.)
1358         */
1359        public Type getTopic() { 
1360          return this.topic;
1361        }
1362
1363        /**
1364         * @return {@link #topic} (The entity that the term applies to.)
1365         */
1366        public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
1367          if (this.topic == null)
1368            this.topic = new CodeableConcept();
1369          if (!(this.topic instanceof CodeableConcept))
1370            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
1371          return (CodeableConcept) this.topic;
1372        }
1373
1374        public boolean hasTopicCodeableConcept() { 
1375          return this != null && this.topic instanceof CodeableConcept;
1376        }
1377
1378        /**
1379         * @return {@link #topic} (The entity that the term applies to.)
1380         */
1381        public Reference getTopicReference() throws FHIRException { 
1382          if (this.topic == null)
1383            this.topic = new Reference();
1384          if (!(this.topic instanceof Reference))
1385            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
1386          return (Reference) this.topic;
1387        }
1388
1389        public boolean hasTopicReference() { 
1390          return this != null && this.topic instanceof Reference;
1391        }
1392
1393        public boolean hasTopic() { 
1394          return this.topic != null && !this.topic.isEmpty();
1395        }
1396
1397        /**
1398         * @param value {@link #topic} (The entity that the term applies to.)
1399         */
1400        public TermComponent setTopic(Type value) { 
1401          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1402            throw new Error("Not the right type for Contract.term.topic[x]: "+value.fhirType());
1403          this.topic = value;
1404          return this;
1405        }
1406
1407        /**
1408         * @return {@link #type} (A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.)
1409         */
1410        public CodeableConcept getType() { 
1411          if (this.type == null)
1412            if (Configuration.errorOnAutoCreate())
1413              throw new Error("Attempt to auto-create TermComponent.type");
1414            else if (Configuration.doAutoCreate())
1415              this.type = new CodeableConcept(); // cc
1416          return this.type;
1417        }
1418
1419        public boolean hasType() { 
1420          return this.type != null && !this.type.isEmpty();
1421        }
1422
1423        /**
1424         * @param value {@link #type} (A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.)
1425         */
1426        public TermComponent setType(CodeableConcept value) { 
1427          this.type = value;
1428          return this;
1429        }
1430
1431        /**
1432         * @return {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1433         */
1434        public CodeableConcept getSubType() { 
1435          if (this.subType == null)
1436            if (Configuration.errorOnAutoCreate())
1437              throw new Error("Attempt to auto-create TermComponent.subType");
1438            else if (Configuration.doAutoCreate())
1439              this.subType = new CodeableConcept(); // cc
1440          return this.subType;
1441        }
1442
1443        public boolean hasSubType() { 
1444          return this.subType != null && !this.subType.isEmpty();
1445        }
1446
1447        /**
1448         * @param value {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1449         */
1450        public TermComponent setSubType(CodeableConcept value) { 
1451          this.subType = value;
1452          return this;
1453        }
1454
1455        /**
1456         * @return {@link #text} (Statement of a provision in a policy or a contract.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1457         */
1458        public StringType getTextElement() { 
1459          if (this.text == null)
1460            if (Configuration.errorOnAutoCreate())
1461              throw new Error("Attempt to auto-create TermComponent.text");
1462            else if (Configuration.doAutoCreate())
1463              this.text = new StringType(); // bb
1464          return this.text;
1465        }
1466
1467        public boolean hasTextElement() { 
1468          return this.text != null && !this.text.isEmpty();
1469        }
1470
1471        public boolean hasText() { 
1472          return this.text != null && !this.text.isEmpty();
1473        }
1474
1475        /**
1476         * @param value {@link #text} (Statement of a provision in a policy or a contract.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1477         */
1478        public TermComponent setTextElement(StringType value) { 
1479          this.text = value;
1480          return this;
1481        }
1482
1483        /**
1484         * @return Statement of a provision in a policy or a contract.
1485         */
1486        public String getText() { 
1487          return this.text == null ? null : this.text.getValue();
1488        }
1489
1490        /**
1491         * @param value Statement of a provision in a policy or a contract.
1492         */
1493        public TermComponent setText(String value) { 
1494          if (Utilities.noString(value))
1495            this.text = null;
1496          else {
1497            if (this.text == null)
1498              this.text = new StringType();
1499            this.text.setValue(value);
1500          }
1501          return this;
1502        }
1503
1504        /**
1505         * @return {@link #securityLabel} (Security labels that protect the handling of information about the term and its elements, which may be specifically identified..)
1506         */
1507        public List<SecurityLabelComponent> getSecurityLabel() { 
1508          if (this.securityLabel == null)
1509            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1510          return this.securityLabel;
1511        }
1512
1513        /**
1514         * @return Returns a reference to <code>this</code> for easy method chaining
1515         */
1516        public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) { 
1517          this.securityLabel = theSecurityLabel;
1518          return this;
1519        }
1520
1521        public boolean hasSecurityLabel() { 
1522          if (this.securityLabel == null)
1523            return false;
1524          for (SecurityLabelComponent item : this.securityLabel)
1525            if (!item.isEmpty())
1526              return true;
1527          return false;
1528        }
1529
1530        public SecurityLabelComponent addSecurityLabel() { //3
1531          SecurityLabelComponent t = new SecurityLabelComponent();
1532          if (this.securityLabel == null)
1533            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1534          this.securityLabel.add(t);
1535          return t;
1536        }
1537
1538        public TermComponent addSecurityLabel(SecurityLabelComponent t) { //3
1539          if (t == null)
1540            return this;
1541          if (this.securityLabel == null)
1542            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1543          this.securityLabel.add(t);
1544          return this;
1545        }
1546
1547        /**
1548         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
1549         */
1550        public SecurityLabelComponent getSecurityLabelFirstRep() { 
1551          if (getSecurityLabel().isEmpty()) {
1552            addSecurityLabel();
1553          }
1554          return getSecurityLabel().get(0);
1555        }
1556
1557        /**
1558         * @return {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1559         */
1560        public ContractOfferComponent getOffer() { 
1561          if (this.offer == null)
1562            if (Configuration.errorOnAutoCreate())
1563              throw new Error("Attempt to auto-create TermComponent.offer");
1564            else if (Configuration.doAutoCreate())
1565              this.offer = new ContractOfferComponent(); // cc
1566          return this.offer;
1567        }
1568
1569        public boolean hasOffer() { 
1570          return this.offer != null && !this.offer.isEmpty();
1571        }
1572
1573        /**
1574         * @param value {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1575         */
1576        public TermComponent setOffer(ContractOfferComponent value) { 
1577          this.offer = value;
1578          return this;
1579        }
1580
1581        /**
1582         * @return {@link #asset} (Contract Term Asset List.)
1583         */
1584        public List<ContractAssetComponent> getAsset() { 
1585          if (this.asset == null)
1586            this.asset = new ArrayList<ContractAssetComponent>();
1587          return this.asset;
1588        }
1589
1590        /**
1591         * @return Returns a reference to <code>this</code> for easy method chaining
1592         */
1593        public TermComponent setAsset(List<ContractAssetComponent> theAsset) { 
1594          this.asset = theAsset;
1595          return this;
1596        }
1597
1598        public boolean hasAsset() { 
1599          if (this.asset == null)
1600            return false;
1601          for (ContractAssetComponent item : this.asset)
1602            if (!item.isEmpty())
1603              return true;
1604          return false;
1605        }
1606
1607        public ContractAssetComponent addAsset() { //3
1608          ContractAssetComponent t = new ContractAssetComponent();
1609          if (this.asset == null)
1610            this.asset = new ArrayList<ContractAssetComponent>();
1611          this.asset.add(t);
1612          return t;
1613        }
1614
1615        public TermComponent addAsset(ContractAssetComponent t) { //3
1616          if (t == null)
1617            return this;
1618          if (this.asset == null)
1619            this.asset = new ArrayList<ContractAssetComponent>();
1620          this.asset.add(t);
1621          return this;
1622        }
1623
1624        /**
1625         * @return The first repetition of repeating field {@link #asset}, creating it if it does not already exist
1626         */
1627        public ContractAssetComponent getAssetFirstRep() { 
1628          if (getAsset().isEmpty()) {
1629            addAsset();
1630          }
1631          return getAsset().get(0);
1632        }
1633
1634        /**
1635         * @return {@link #action} (An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.)
1636         */
1637        public List<ActionComponent> getAction() { 
1638          if (this.action == null)
1639            this.action = new ArrayList<ActionComponent>();
1640          return this.action;
1641        }
1642
1643        /**
1644         * @return Returns a reference to <code>this</code> for easy method chaining
1645         */
1646        public TermComponent setAction(List<ActionComponent> theAction) { 
1647          this.action = theAction;
1648          return this;
1649        }
1650
1651        public boolean hasAction() { 
1652          if (this.action == null)
1653            return false;
1654          for (ActionComponent item : this.action)
1655            if (!item.isEmpty())
1656              return true;
1657          return false;
1658        }
1659
1660        public ActionComponent addAction() { //3
1661          ActionComponent t = new ActionComponent();
1662          if (this.action == null)
1663            this.action = new ArrayList<ActionComponent>();
1664          this.action.add(t);
1665          return t;
1666        }
1667
1668        public TermComponent addAction(ActionComponent t) { //3
1669          if (t == null)
1670            return this;
1671          if (this.action == null)
1672            this.action = new ArrayList<ActionComponent>();
1673          this.action.add(t);
1674          return this;
1675        }
1676
1677        /**
1678         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
1679         */
1680        public ActionComponent getActionFirstRep() { 
1681          if (getAction().isEmpty()) {
1682            addAction();
1683          }
1684          return getAction().get(0);
1685        }
1686
1687        /**
1688         * @return {@link #group} (Nested group of Contract Provisions.)
1689         */
1690        public List<TermComponent> getGroup() { 
1691          if (this.group == null)
1692            this.group = new ArrayList<TermComponent>();
1693          return this.group;
1694        }
1695
1696        /**
1697         * @return Returns a reference to <code>this</code> for easy method chaining
1698         */
1699        public TermComponent setGroup(List<TermComponent> theGroup) { 
1700          this.group = theGroup;
1701          return this;
1702        }
1703
1704        public boolean hasGroup() { 
1705          if (this.group == null)
1706            return false;
1707          for (TermComponent item : this.group)
1708            if (!item.isEmpty())
1709              return true;
1710          return false;
1711        }
1712
1713        public TermComponent addGroup() { //3
1714          TermComponent t = new TermComponent();
1715          if (this.group == null)
1716            this.group = new ArrayList<TermComponent>();
1717          this.group.add(t);
1718          return t;
1719        }
1720
1721        public TermComponent addGroup(TermComponent t) { //3
1722          if (t == null)
1723            return this;
1724          if (this.group == null)
1725            this.group = new ArrayList<TermComponent>();
1726          this.group.add(t);
1727          return this;
1728        }
1729
1730        /**
1731         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
1732         */
1733        public TermComponent getGroupFirstRep() { 
1734          if (getGroup().isEmpty()) {
1735            addGroup();
1736          }
1737          return getGroup().get(0);
1738        }
1739
1740        protected void listChildren(List<Property> children) {
1741          super.listChildren(children);
1742          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
1743          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
1744          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
1745          children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic));
1746          children.add(new Property("type", "CodeableConcept", "A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.", 0, 1, type));
1747          children.add(new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
1748          children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
1749          children.add(new Property("securityLabel", "", "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..", 0, java.lang.Integer.MAX_VALUE, securityLabel));
1750          children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer));
1751          children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
1752          children.add(new Property("action", "", "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, action));
1753          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
1754        }
1755
1756        @Override
1757        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1758          switch (_hash) {
1759          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
1760          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
1761          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
1762          case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1763          case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1764          case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1765          case -343345444: /*topicReference*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1766          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.", 0, 1, type);
1767          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
1768          case 3556653: /*text*/  return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text);
1769          case -722296940: /*securityLabel*/  return new Property("securityLabel", "", "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..", 0, java.lang.Integer.MAX_VALUE, securityLabel);
1770          case 105650780: /*offer*/  return new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
1771          case 93121264: /*asset*/  return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset);
1772          case -1422950858: /*action*/  return new Property("action", "", "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, action);
1773          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
1774          default: return super.getNamedProperty(_hash, _name, _checkValid);
1775          }
1776
1777        }
1778
1779      @Override
1780      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1781        switch (hash) {
1782        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1783        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
1784        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
1785        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Type
1786        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1787        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
1788        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1789        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
1790        case 105650780: /*offer*/ return this.offer == null ? new Base[0] : new Base[] {this.offer}; // ContractOfferComponent
1791        case 93121264: /*asset*/ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
1792        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
1793        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
1794        default: return super.getProperty(hash, name, checkValid);
1795        }
1796
1797      }
1798
1799      @Override
1800      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1801        switch (hash) {
1802        case -1618432855: // identifier
1803          this.identifier = castToIdentifier(value); // Identifier
1804          return value;
1805        case -1179159893: // issued
1806          this.issued = castToDateTime(value); // DateTimeType
1807          return value;
1808        case -793235316: // applies
1809          this.applies = castToPeriod(value); // Period
1810          return value;
1811        case 110546223: // topic
1812          this.topic = castToType(value); // Type
1813          return value;
1814        case 3575610: // type
1815          this.type = castToCodeableConcept(value); // CodeableConcept
1816          return value;
1817        case -1868521062: // subType
1818          this.subType = castToCodeableConcept(value); // CodeableConcept
1819          return value;
1820        case 3556653: // text
1821          this.text = castToString(value); // StringType
1822          return value;
1823        case -722296940: // securityLabel
1824          this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
1825          return value;
1826        case 105650780: // offer
1827          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1828          return value;
1829        case 93121264: // asset
1830          this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
1831          return value;
1832        case -1422950858: // action
1833          this.getAction().add((ActionComponent) value); // ActionComponent
1834          return value;
1835        case 98629247: // group
1836          this.getGroup().add((TermComponent) value); // TermComponent
1837          return value;
1838        default: return super.setProperty(hash, name, value);
1839        }
1840
1841      }
1842
1843      @Override
1844      public Base setProperty(String name, Base value) throws FHIRException {
1845        if (name.equals("identifier")) {
1846          this.identifier = castToIdentifier(value); // Identifier
1847        } else if (name.equals("issued")) {
1848          this.issued = castToDateTime(value); // DateTimeType
1849        } else if (name.equals("applies")) {
1850          this.applies = castToPeriod(value); // Period
1851        } else if (name.equals("topic[x]")) {
1852          this.topic = castToType(value); // Type
1853        } else if (name.equals("type")) {
1854          this.type = castToCodeableConcept(value); // CodeableConcept
1855        } else if (name.equals("subType")) {
1856          this.subType = castToCodeableConcept(value); // CodeableConcept
1857        } else if (name.equals("text")) {
1858          this.text = castToString(value); // StringType
1859        } else if (name.equals("securityLabel")) {
1860          this.getSecurityLabel().add((SecurityLabelComponent) value);
1861        } else if (name.equals("offer")) {
1862          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1863        } else if (name.equals("asset")) {
1864          this.getAsset().add((ContractAssetComponent) value);
1865        } else if (name.equals("action")) {
1866          this.getAction().add((ActionComponent) value);
1867        } else if (name.equals("group")) {
1868          this.getGroup().add((TermComponent) value);
1869        } else
1870          return super.setProperty(name, value);
1871        return value;
1872      }
1873
1874      @Override
1875      public Base makeProperty(int hash, String name) throws FHIRException {
1876        switch (hash) {
1877        case -1618432855:  return getIdentifier(); 
1878        case -1179159893:  return getIssuedElement();
1879        case -793235316:  return getApplies(); 
1880        case -957295375:  return getTopic(); 
1881        case 110546223:  return getTopic(); 
1882        case 3575610:  return getType(); 
1883        case -1868521062:  return getSubType(); 
1884        case 3556653:  return getTextElement();
1885        case -722296940:  return addSecurityLabel(); 
1886        case 105650780:  return getOffer(); 
1887        case 93121264:  return addAsset(); 
1888        case -1422950858:  return addAction(); 
1889        case 98629247:  return addGroup(); 
1890        default: return super.makeProperty(hash, name);
1891        }
1892
1893      }
1894
1895      @Override
1896      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1897        switch (hash) {
1898        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1899        case -1179159893: /*issued*/ return new String[] {"dateTime"};
1900        case -793235316: /*applies*/ return new String[] {"Period"};
1901        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
1902        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1903        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1904        case 3556653: /*text*/ return new String[] {"string"};
1905        case -722296940: /*securityLabel*/ return new String[] {};
1906        case 105650780: /*offer*/ return new String[] {};
1907        case 93121264: /*asset*/ return new String[] {};
1908        case -1422950858: /*action*/ return new String[] {};
1909        case 98629247: /*group*/ return new String[] {"@Contract.term"};
1910        default: return super.getTypesForProperty(hash, name);
1911        }
1912
1913      }
1914
1915      @Override
1916      public Base addChild(String name) throws FHIRException {
1917        if (name.equals("identifier")) {
1918          this.identifier = new Identifier();
1919          return this.identifier;
1920        }
1921        else if (name.equals("issued")) {
1922          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
1923        }
1924        else if (name.equals("applies")) {
1925          this.applies = new Period();
1926          return this.applies;
1927        }
1928        else if (name.equals("topicCodeableConcept")) {
1929          this.topic = new CodeableConcept();
1930          return this.topic;
1931        }
1932        else if (name.equals("topicReference")) {
1933          this.topic = new Reference();
1934          return this.topic;
1935        }
1936        else if (name.equals("type")) {
1937          this.type = new CodeableConcept();
1938          return this.type;
1939        }
1940        else if (name.equals("subType")) {
1941          this.subType = new CodeableConcept();
1942          return this.subType;
1943        }
1944        else if (name.equals("text")) {
1945          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
1946        }
1947        else if (name.equals("securityLabel")) {
1948          return addSecurityLabel();
1949        }
1950        else if (name.equals("offer")) {
1951          this.offer = new ContractOfferComponent();
1952          return this.offer;
1953        }
1954        else if (name.equals("asset")) {
1955          return addAsset();
1956        }
1957        else if (name.equals("action")) {
1958          return addAction();
1959        }
1960        else if (name.equals("group")) {
1961          return addGroup();
1962        }
1963        else
1964          return super.addChild(name);
1965      }
1966
1967      public TermComponent copy() {
1968        TermComponent dst = new TermComponent();
1969        copyValues(dst);
1970        return dst;
1971      }
1972
1973      public void copyValues(TermComponent dst) {
1974        super.copyValues(dst);
1975        dst.identifier = identifier == null ? null : identifier.copy();
1976        dst.issued = issued == null ? null : issued.copy();
1977        dst.applies = applies == null ? null : applies.copy();
1978        dst.topic = topic == null ? null : topic.copy();
1979        dst.type = type == null ? null : type.copy();
1980        dst.subType = subType == null ? null : subType.copy();
1981        dst.text = text == null ? null : text.copy();
1982        if (securityLabel != null) {
1983          dst.securityLabel = new ArrayList<SecurityLabelComponent>();
1984          for (SecurityLabelComponent i : securityLabel)
1985            dst.securityLabel.add(i.copy());
1986        };
1987        dst.offer = offer == null ? null : offer.copy();
1988        if (asset != null) {
1989          dst.asset = new ArrayList<ContractAssetComponent>();
1990          for (ContractAssetComponent i : asset)
1991            dst.asset.add(i.copy());
1992        };
1993        if (action != null) {
1994          dst.action = new ArrayList<ActionComponent>();
1995          for (ActionComponent i : action)
1996            dst.action.add(i.copy());
1997        };
1998        if (group != null) {
1999          dst.group = new ArrayList<TermComponent>();
2000          for (TermComponent i : group)
2001            dst.group.add(i.copy());
2002        };
2003      }
2004
2005      @Override
2006      public boolean equalsDeep(Base other_) {
2007        if (!super.equalsDeep(other_))
2008          return false;
2009        if (!(other_ instanceof TermComponent))
2010          return false;
2011        TermComponent o = (TermComponent) other_;
2012        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
2013           && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
2014           && compareDeep(text, o.text, true) && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
2015           && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true) && compareDeep(group, o.group, true)
2016          ;
2017      }
2018
2019      @Override
2020      public boolean equalsShallow(Base other_) {
2021        if (!super.equalsShallow(other_))
2022          return false;
2023        if (!(other_ instanceof TermComponent))
2024          return false;
2025        TermComponent o = (TermComponent) other_;
2026        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2027      }
2028
2029      public boolean isEmpty() {
2030        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2031          , topic, type, subType, text, securityLabel, offer, asset, action, group);
2032      }
2033
2034  public String fhirType() {
2035    return "Contract.term";
2036
2037  }
2038
2039  }
2040
2041    @Block()
2042    public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2043        /**
2044         * Number used to link this term or term element to the applicable Security Label.
2045         */
2046        @Child(name = "number", type = {UnsignedIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2047        @Description(shortDefinition="Link to Security Labels", formalDefinition="Number used to link this term or term element to the applicable Security Label." )
2048        protected List<UnsignedIntType> number;
2049
2050        /**
2051         * Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.
2052         */
2053        @Child(name = "classification", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=false)
2054        @Description(shortDefinition="Confidentiality Protection", formalDefinition="Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements." )
2055        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-classification")
2056        protected Coding classification;
2057
2058        /**
2059         * Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.
2060         */
2061        @Child(name = "category", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2062        @Description(shortDefinition="Applicable Policy", formalDefinition="Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements." )
2063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-category")
2064        protected List<Coding> category;
2065
2066        /**
2067         * Security label privacy tag that species the manner in which term and/or term elements are to be protected.
2068         */
2069        @Child(name = "control", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2070        @Description(shortDefinition="Handling Instructions", formalDefinition="Security label privacy tag that species the manner in which term and/or term elements are to be protected." )
2071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-control")
2072        protected List<Coding> control;
2073
2074        private static final long serialVersionUID = 788281758L;
2075
2076    /**
2077     * Constructor
2078     */
2079      public SecurityLabelComponent() {
2080        super();
2081      }
2082
2083    /**
2084     * Constructor
2085     */
2086      public SecurityLabelComponent(Coding classification) {
2087        super();
2088        this.classification = classification;
2089      }
2090
2091        /**
2092         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2093         */
2094        public List<UnsignedIntType> getNumber() { 
2095          if (this.number == null)
2096            this.number = new ArrayList<UnsignedIntType>();
2097          return this.number;
2098        }
2099
2100        /**
2101         * @return Returns a reference to <code>this</code> for easy method chaining
2102         */
2103        public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) { 
2104          this.number = theNumber;
2105          return this;
2106        }
2107
2108        public boolean hasNumber() { 
2109          if (this.number == null)
2110            return false;
2111          for (UnsignedIntType item : this.number)
2112            if (!item.isEmpty())
2113              return true;
2114          return false;
2115        }
2116
2117        /**
2118         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2119         */
2120        public UnsignedIntType addNumberElement() {//2 
2121          UnsignedIntType t = new UnsignedIntType();
2122          if (this.number == null)
2123            this.number = new ArrayList<UnsignedIntType>();
2124          this.number.add(t);
2125          return t;
2126        }
2127
2128        /**
2129         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2130         */
2131        public SecurityLabelComponent addNumber(int value) { //1
2132          UnsignedIntType t = new UnsignedIntType();
2133          t.setValue(value);
2134          if (this.number == null)
2135            this.number = new ArrayList<UnsignedIntType>();
2136          this.number.add(t);
2137          return this;
2138        }
2139
2140        /**
2141         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2142         */
2143        public boolean hasNumber(int value) { 
2144          if (this.number == null)
2145            return false;
2146          for (UnsignedIntType v : this.number)
2147            if (v.getValue().equals(value)) // unsignedInt
2148              return true;
2149          return false;
2150        }
2151
2152        /**
2153         * @return {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2154         */
2155        public Coding getClassification() { 
2156          if (this.classification == null)
2157            if (Configuration.errorOnAutoCreate())
2158              throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2159            else if (Configuration.doAutoCreate())
2160              this.classification = new Coding(); // cc
2161          return this.classification;
2162        }
2163
2164        public boolean hasClassification() { 
2165          return this.classification != null && !this.classification.isEmpty();
2166        }
2167
2168        /**
2169         * @param value {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2170         */
2171        public SecurityLabelComponent setClassification(Coding value) { 
2172          this.classification = value;
2173          return this;
2174        }
2175
2176        /**
2177         * @return {@link #category} (Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.)
2178         */
2179        public List<Coding> getCategory() { 
2180          if (this.category == null)
2181            this.category = new ArrayList<Coding>();
2182          return this.category;
2183        }
2184
2185        /**
2186         * @return Returns a reference to <code>this</code> for easy method chaining
2187         */
2188        public SecurityLabelComponent setCategory(List<Coding> theCategory) { 
2189          this.category = theCategory;
2190          return this;
2191        }
2192
2193        public boolean hasCategory() { 
2194          if (this.category == null)
2195            return false;
2196          for (Coding item : this.category)
2197            if (!item.isEmpty())
2198              return true;
2199          return false;
2200        }
2201
2202        public Coding addCategory() { //3
2203          Coding t = new Coding();
2204          if (this.category == null)
2205            this.category = new ArrayList<Coding>();
2206          this.category.add(t);
2207          return t;
2208        }
2209
2210        public SecurityLabelComponent addCategory(Coding t) { //3
2211          if (t == null)
2212            return this;
2213          if (this.category == null)
2214            this.category = new ArrayList<Coding>();
2215          this.category.add(t);
2216          return this;
2217        }
2218
2219        /**
2220         * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
2221         */
2222        public Coding getCategoryFirstRep() { 
2223          if (getCategory().isEmpty()) {
2224            addCategory();
2225          }
2226          return getCategory().get(0);
2227        }
2228
2229        /**
2230         * @return {@link #control} (Security label privacy tag that species the manner in which term and/or term elements are to be protected.)
2231         */
2232        public List<Coding> getControl() { 
2233          if (this.control == null)
2234            this.control = new ArrayList<Coding>();
2235          return this.control;
2236        }
2237
2238        /**
2239         * @return Returns a reference to <code>this</code> for easy method chaining
2240         */
2241        public SecurityLabelComponent setControl(List<Coding> theControl) { 
2242          this.control = theControl;
2243          return this;
2244        }
2245
2246        public boolean hasControl() { 
2247          if (this.control == null)
2248            return false;
2249          for (Coding item : this.control)
2250            if (!item.isEmpty())
2251              return true;
2252          return false;
2253        }
2254
2255        public Coding addControl() { //3
2256          Coding t = new Coding();
2257          if (this.control == null)
2258            this.control = new ArrayList<Coding>();
2259          this.control.add(t);
2260          return t;
2261        }
2262
2263        public SecurityLabelComponent addControl(Coding t) { //3
2264          if (t == null)
2265            return this;
2266          if (this.control == null)
2267            this.control = new ArrayList<Coding>();
2268          this.control.add(t);
2269          return this;
2270        }
2271
2272        /**
2273         * @return The first repetition of repeating field {@link #control}, creating it if it does not already exist
2274         */
2275        public Coding getControlFirstRep() { 
2276          if (getControl().isEmpty()) {
2277            addControl();
2278          }
2279          return getControl().get(0);
2280        }
2281
2282        protected void listChildren(List<Property> children) {
2283          super.listChildren(children);
2284          children.add(new Property("number", "unsignedInt", "Number used to link this term or term element to the applicable Security Label.", 0, java.lang.Integer.MAX_VALUE, number));
2285          children.add(new Property("classification", "Coding", "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.", 0, 1, classification));
2286          children.add(new Property("category", "Coding", "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.", 0, java.lang.Integer.MAX_VALUE, category));
2287          children.add(new Property("control", "Coding", "Security label privacy tag that species the manner in which term and/or term elements are to be protected.", 0, java.lang.Integer.MAX_VALUE, control));
2288        }
2289
2290        @Override
2291        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2292          switch (_hash) {
2293          case -1034364087: /*number*/  return new Property("number", "unsignedInt", "Number used to link this term or term element to the applicable Security Label.", 0, java.lang.Integer.MAX_VALUE, number);
2294          case 382350310: /*classification*/  return new Property("classification", "Coding", "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.", 0, 1, classification);
2295          case 50511102: /*category*/  return new Property("category", "Coding", "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.", 0, java.lang.Integer.MAX_VALUE, category);
2296          case 951543133: /*control*/  return new Property("control", "Coding", "Security label privacy tag that species the manner in which term and/or term elements are to be protected.", 0, java.lang.Integer.MAX_VALUE, control);
2297          default: return super.getNamedProperty(_hash, _name, _checkValid);
2298          }
2299
2300        }
2301
2302      @Override
2303      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2304        switch (hash) {
2305        case -1034364087: /*number*/ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2306        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // Coding
2307        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // Coding
2308        case 951543133: /*control*/ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2309        default: return super.getProperty(hash, name, checkValid);
2310        }
2311
2312      }
2313
2314      @Override
2315      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2316        switch (hash) {
2317        case -1034364087: // number
2318          this.getNumber().add(castToUnsignedInt(value)); // UnsignedIntType
2319          return value;
2320        case 382350310: // classification
2321          this.classification = castToCoding(value); // Coding
2322          return value;
2323        case 50511102: // category
2324          this.getCategory().add(castToCoding(value)); // Coding
2325          return value;
2326        case 951543133: // control
2327          this.getControl().add(castToCoding(value)); // Coding
2328          return value;
2329        default: return super.setProperty(hash, name, value);
2330        }
2331
2332      }
2333
2334      @Override
2335      public Base setProperty(String name, Base value) throws FHIRException {
2336        if (name.equals("number")) {
2337          this.getNumber().add(castToUnsignedInt(value));
2338        } else if (name.equals("classification")) {
2339          this.classification = castToCoding(value); // Coding
2340        } else if (name.equals("category")) {
2341          this.getCategory().add(castToCoding(value));
2342        } else if (name.equals("control")) {
2343          this.getControl().add(castToCoding(value));
2344        } else
2345          return super.setProperty(name, value);
2346        return value;
2347      }
2348
2349      @Override
2350      public Base makeProperty(int hash, String name) throws FHIRException {
2351        switch (hash) {
2352        case -1034364087:  return addNumberElement();
2353        case 382350310:  return getClassification(); 
2354        case 50511102:  return addCategory(); 
2355        case 951543133:  return addControl(); 
2356        default: return super.makeProperty(hash, name);
2357        }
2358
2359      }
2360
2361      @Override
2362      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2363        switch (hash) {
2364        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
2365        case 382350310: /*classification*/ return new String[] {"Coding"};
2366        case 50511102: /*category*/ return new String[] {"Coding"};
2367        case 951543133: /*control*/ return new String[] {"Coding"};
2368        default: return super.getTypesForProperty(hash, name);
2369        }
2370
2371      }
2372
2373      @Override
2374      public Base addChild(String name) throws FHIRException {
2375        if (name.equals("number")) {
2376          throw new FHIRException("Cannot call addChild on a primitive type Contract.number");
2377        }
2378        else if (name.equals("classification")) {
2379          this.classification = new Coding();
2380          return this.classification;
2381        }
2382        else if (name.equals("category")) {
2383          return addCategory();
2384        }
2385        else if (name.equals("control")) {
2386          return addControl();
2387        }
2388        else
2389          return super.addChild(name);
2390      }
2391
2392      public SecurityLabelComponent copy() {
2393        SecurityLabelComponent dst = new SecurityLabelComponent();
2394        copyValues(dst);
2395        return dst;
2396      }
2397
2398      public void copyValues(SecurityLabelComponent dst) {
2399        super.copyValues(dst);
2400        if (number != null) {
2401          dst.number = new ArrayList<UnsignedIntType>();
2402          for (UnsignedIntType i : number)
2403            dst.number.add(i.copy());
2404        };
2405        dst.classification = classification == null ? null : classification.copy();
2406        if (category != null) {
2407          dst.category = new ArrayList<Coding>();
2408          for (Coding i : category)
2409            dst.category.add(i.copy());
2410        };
2411        if (control != null) {
2412          dst.control = new ArrayList<Coding>();
2413          for (Coding i : control)
2414            dst.control.add(i.copy());
2415        };
2416      }
2417
2418      @Override
2419      public boolean equalsDeep(Base other_) {
2420        if (!super.equalsDeep(other_))
2421          return false;
2422        if (!(other_ instanceof SecurityLabelComponent))
2423          return false;
2424        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2425        return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
2426           && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
2427      }
2428
2429      @Override
2430      public boolean equalsShallow(Base other_) {
2431        if (!super.equalsShallow(other_))
2432          return false;
2433        if (!(other_ instanceof SecurityLabelComponent))
2434          return false;
2435        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2436        return compareValues(number, o.number, true);
2437      }
2438
2439      public boolean isEmpty() {
2440        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category
2441          , control);
2442      }
2443
2444  public String fhirType() {
2445    return "Contract.term.securityLabel";
2446
2447  }
2448
2449  }
2450
2451    @Block()
2452    public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
2453        /**
2454         * Unique identifier for this particular Contract Provision.
2455         */
2456        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2457        @Description(shortDefinition="Offer business ID", formalDefinition="Unique identifier for this particular Contract Provision." )
2458        protected List<Identifier> identifier;
2459
2460        /**
2461         * Offer Recipient.
2462         */
2463        @Child(name = "party", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2464        @Description(shortDefinition="Offer Recipient", formalDefinition="Offer Recipient." )
2465        protected List<ContractPartyComponent> party;
2466
2467        /**
2468         * The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).
2469         */
2470        @Child(name = "topic", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=true)
2471        @Description(shortDefinition="Negotiable offer asset", formalDefinition="The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30)." )
2472        protected Reference topic;
2473
2474        /**
2475         * The actual object that is the target of the reference (The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).)
2476         */
2477        protected Resource topicTarget;
2478
2479        /**
2480         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
2481         */
2482        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
2483        @Description(shortDefinition="Contract Offer Type or Form", formalDefinition="Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit." )
2484        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
2485        protected CodeableConcept type;
2486
2487        /**
2488         * Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.
2489         */
2490        @Child(name = "decision", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
2491        @Description(shortDefinition="Accepting party choice", formalDefinition="Type of choice made by accepting party with respect to an offer made by an offeror/ grantee." )
2492        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
2493        protected CodeableConcept decision;
2494
2495        /**
2496         * How the decision about a Contract was conveyed.
2497         */
2498        @Child(name = "decisionMode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2499        @Description(shortDefinition="How decision is conveyed", formalDefinition="How the decision about a Contract was conveyed." )
2500        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-decision-mode")
2501        protected List<CodeableConcept> decisionMode;
2502
2503        /**
2504         * Response to offer text.
2505         */
2506        @Child(name = "answer", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2507        @Description(shortDefinition="Response to offer text", formalDefinition="Response to offer text." )
2508        protected List<AnswerComponent> answer;
2509
2510        /**
2511         * Human readable form of this Contract Offer.
2512         */
2513        @Child(name = "text", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2514        @Description(shortDefinition="Human readable offer text", formalDefinition="Human readable form of this Contract Offer." )
2515        protected StringType text;
2516
2517        /**
2518         * The id of the clause or question text of the offer in the referenced questionnaire/response.
2519         */
2520        @Child(name = "linkId", type = {StringType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2521        @Description(shortDefinition="Pointer to text", formalDefinition="The id of the clause or question text of the offer in the referenced questionnaire/response." )
2522        protected List<StringType> linkId;
2523
2524        /**
2525         * Security labels that protects the offer.
2526         */
2527        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2528        @Description(shortDefinition="Offer restriction numbers", formalDefinition="Security labels that protects the offer." )
2529        protected List<UnsignedIntType> securityLabelNumber;
2530
2531        private static final long serialVersionUID = -395674449L;
2532
2533    /**
2534     * Constructor
2535     */
2536      public ContractOfferComponent() {
2537        super();
2538      }
2539
2540        /**
2541         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
2542         */
2543        public List<Identifier> getIdentifier() { 
2544          if (this.identifier == null)
2545            this.identifier = new ArrayList<Identifier>();
2546          return this.identifier;
2547        }
2548
2549        /**
2550         * @return Returns a reference to <code>this</code> for easy method chaining
2551         */
2552        public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) { 
2553          this.identifier = theIdentifier;
2554          return this;
2555        }
2556
2557        public boolean hasIdentifier() { 
2558          if (this.identifier == null)
2559            return false;
2560          for (Identifier item : this.identifier)
2561            if (!item.isEmpty())
2562              return true;
2563          return false;
2564        }
2565
2566        public Identifier addIdentifier() { //3
2567          Identifier t = new Identifier();
2568          if (this.identifier == null)
2569            this.identifier = new ArrayList<Identifier>();
2570          this.identifier.add(t);
2571          return t;
2572        }
2573
2574        public ContractOfferComponent addIdentifier(Identifier t) { //3
2575          if (t == null)
2576            return this;
2577          if (this.identifier == null)
2578            this.identifier = new ArrayList<Identifier>();
2579          this.identifier.add(t);
2580          return this;
2581        }
2582
2583        /**
2584         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2585         */
2586        public Identifier getIdentifierFirstRep() { 
2587          if (getIdentifier().isEmpty()) {
2588            addIdentifier();
2589          }
2590          return getIdentifier().get(0);
2591        }
2592
2593        /**
2594         * @return {@link #party} (Offer Recipient.)
2595         */
2596        public List<ContractPartyComponent> getParty() { 
2597          if (this.party == null)
2598            this.party = new ArrayList<ContractPartyComponent>();
2599          return this.party;
2600        }
2601
2602        /**
2603         * @return Returns a reference to <code>this</code> for easy method chaining
2604         */
2605        public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) { 
2606          this.party = theParty;
2607          return this;
2608        }
2609
2610        public boolean hasParty() { 
2611          if (this.party == null)
2612            return false;
2613          for (ContractPartyComponent item : this.party)
2614            if (!item.isEmpty())
2615              return true;
2616          return false;
2617        }
2618
2619        public ContractPartyComponent addParty() { //3
2620          ContractPartyComponent t = new ContractPartyComponent();
2621          if (this.party == null)
2622            this.party = new ArrayList<ContractPartyComponent>();
2623          this.party.add(t);
2624          return t;
2625        }
2626
2627        public ContractOfferComponent addParty(ContractPartyComponent t) { //3
2628          if (t == null)
2629            return this;
2630          if (this.party == null)
2631            this.party = new ArrayList<ContractPartyComponent>();
2632          this.party.add(t);
2633          return this;
2634        }
2635
2636        /**
2637         * @return The first repetition of repeating field {@link #party}, creating it if it does not already exist
2638         */
2639        public ContractPartyComponent getPartyFirstRep() { 
2640          if (getParty().isEmpty()) {
2641            addParty();
2642          }
2643          return getParty().get(0);
2644        }
2645
2646        /**
2647         * @return {@link #topic} (The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).)
2648         */
2649        public Reference getTopic() { 
2650          if (this.topic == null)
2651            if (Configuration.errorOnAutoCreate())
2652              throw new Error("Attempt to auto-create ContractOfferComponent.topic");
2653            else if (Configuration.doAutoCreate())
2654              this.topic = new Reference(); // cc
2655          return this.topic;
2656        }
2657
2658        public boolean hasTopic() { 
2659          return this.topic != null && !this.topic.isEmpty();
2660        }
2661
2662        /**
2663         * @param value {@link #topic} (The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).)
2664         */
2665        public ContractOfferComponent setTopic(Reference value) { 
2666          this.topic = value;
2667          return this;
2668        }
2669
2670        /**
2671         * @return {@link #topic} 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 owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).)
2672         */
2673        public Resource getTopicTarget() { 
2674          return this.topicTarget;
2675        }
2676
2677        /**
2678         * @param value {@link #topic} 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 owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).)
2679         */
2680        public ContractOfferComponent setTopicTarget(Resource value) { 
2681          this.topicTarget = value;
2682          return this;
2683        }
2684
2685        /**
2686         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2687         */
2688        public CodeableConcept getType() { 
2689          if (this.type == null)
2690            if (Configuration.errorOnAutoCreate())
2691              throw new Error("Attempt to auto-create ContractOfferComponent.type");
2692            else if (Configuration.doAutoCreate())
2693              this.type = new CodeableConcept(); // cc
2694          return this.type;
2695        }
2696
2697        public boolean hasType() { 
2698          return this.type != null && !this.type.isEmpty();
2699        }
2700
2701        /**
2702         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2703         */
2704        public ContractOfferComponent setType(CodeableConcept value) { 
2705          this.type = value;
2706          return this;
2707        }
2708
2709        /**
2710         * @return {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2711         */
2712        public CodeableConcept getDecision() { 
2713          if (this.decision == null)
2714            if (Configuration.errorOnAutoCreate())
2715              throw new Error("Attempt to auto-create ContractOfferComponent.decision");
2716            else if (Configuration.doAutoCreate())
2717              this.decision = new CodeableConcept(); // cc
2718          return this.decision;
2719        }
2720
2721        public boolean hasDecision() { 
2722          return this.decision != null && !this.decision.isEmpty();
2723        }
2724
2725        /**
2726         * @param value {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2727         */
2728        public ContractOfferComponent setDecision(CodeableConcept value) { 
2729          this.decision = value;
2730          return this;
2731        }
2732
2733        /**
2734         * @return {@link #decisionMode} (How the decision about a Contract was conveyed.)
2735         */
2736        public List<CodeableConcept> getDecisionMode() { 
2737          if (this.decisionMode == null)
2738            this.decisionMode = new ArrayList<CodeableConcept>();
2739          return this.decisionMode;
2740        }
2741
2742        /**
2743         * @return Returns a reference to <code>this</code> for easy method chaining
2744         */
2745        public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) { 
2746          this.decisionMode = theDecisionMode;
2747          return this;
2748        }
2749
2750        public boolean hasDecisionMode() { 
2751          if (this.decisionMode == null)
2752            return false;
2753          for (CodeableConcept item : this.decisionMode)
2754            if (!item.isEmpty())
2755              return true;
2756          return false;
2757        }
2758
2759        public CodeableConcept addDecisionMode() { //3
2760          CodeableConcept t = new CodeableConcept();
2761          if (this.decisionMode == null)
2762            this.decisionMode = new ArrayList<CodeableConcept>();
2763          this.decisionMode.add(t);
2764          return t;
2765        }
2766
2767        public ContractOfferComponent addDecisionMode(CodeableConcept t) { //3
2768          if (t == null)
2769            return this;
2770          if (this.decisionMode == null)
2771            this.decisionMode = new ArrayList<CodeableConcept>();
2772          this.decisionMode.add(t);
2773          return this;
2774        }
2775
2776        /**
2777         * @return The first repetition of repeating field {@link #decisionMode}, creating it if it does not already exist
2778         */
2779        public CodeableConcept getDecisionModeFirstRep() { 
2780          if (getDecisionMode().isEmpty()) {
2781            addDecisionMode();
2782          }
2783          return getDecisionMode().get(0);
2784        }
2785
2786        /**
2787         * @return {@link #answer} (Response to offer text.)
2788         */
2789        public List<AnswerComponent> getAnswer() { 
2790          if (this.answer == null)
2791            this.answer = new ArrayList<AnswerComponent>();
2792          return this.answer;
2793        }
2794
2795        /**
2796         * @return Returns a reference to <code>this</code> for easy method chaining
2797         */
2798        public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) { 
2799          this.answer = theAnswer;
2800          return this;
2801        }
2802
2803        public boolean hasAnswer() { 
2804          if (this.answer == null)
2805            return false;
2806          for (AnswerComponent item : this.answer)
2807            if (!item.isEmpty())
2808              return true;
2809          return false;
2810        }
2811
2812        public AnswerComponent addAnswer() { //3
2813          AnswerComponent t = new AnswerComponent();
2814          if (this.answer == null)
2815            this.answer = new ArrayList<AnswerComponent>();
2816          this.answer.add(t);
2817          return t;
2818        }
2819
2820        public ContractOfferComponent addAnswer(AnswerComponent t) { //3
2821          if (t == null)
2822            return this;
2823          if (this.answer == null)
2824            this.answer = new ArrayList<AnswerComponent>();
2825          this.answer.add(t);
2826          return this;
2827        }
2828
2829        /**
2830         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist
2831         */
2832        public AnswerComponent getAnswerFirstRep() { 
2833          if (getAnswer().isEmpty()) {
2834            addAnswer();
2835          }
2836          return getAnswer().get(0);
2837        }
2838
2839        /**
2840         * @return {@link #text} (Human readable form of this Contract Offer.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2841         */
2842        public StringType getTextElement() { 
2843          if (this.text == null)
2844            if (Configuration.errorOnAutoCreate())
2845              throw new Error("Attempt to auto-create ContractOfferComponent.text");
2846            else if (Configuration.doAutoCreate())
2847              this.text = new StringType(); // bb
2848          return this.text;
2849        }
2850
2851        public boolean hasTextElement() { 
2852          return this.text != null && !this.text.isEmpty();
2853        }
2854
2855        public boolean hasText() { 
2856          return this.text != null && !this.text.isEmpty();
2857        }
2858
2859        /**
2860         * @param value {@link #text} (Human readable form of this Contract Offer.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2861         */
2862        public ContractOfferComponent setTextElement(StringType value) { 
2863          this.text = value;
2864          return this;
2865        }
2866
2867        /**
2868         * @return Human readable form of this Contract Offer.
2869         */
2870        public String getText() { 
2871          return this.text == null ? null : this.text.getValue();
2872        }
2873
2874        /**
2875         * @param value Human readable form of this Contract Offer.
2876         */
2877        public ContractOfferComponent setText(String value) { 
2878          if (Utilities.noString(value))
2879            this.text = null;
2880          else {
2881            if (this.text == null)
2882              this.text = new StringType();
2883            this.text.setValue(value);
2884          }
2885          return this;
2886        }
2887
2888        /**
2889         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2890         */
2891        public List<StringType> getLinkId() { 
2892          if (this.linkId == null)
2893            this.linkId = new ArrayList<StringType>();
2894          return this.linkId;
2895        }
2896
2897        /**
2898         * @return Returns a reference to <code>this</code> for easy method chaining
2899         */
2900        public ContractOfferComponent setLinkId(List<StringType> theLinkId) { 
2901          this.linkId = theLinkId;
2902          return this;
2903        }
2904
2905        public boolean hasLinkId() { 
2906          if (this.linkId == null)
2907            return false;
2908          for (StringType item : this.linkId)
2909            if (!item.isEmpty())
2910              return true;
2911          return false;
2912        }
2913
2914        /**
2915         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2916         */
2917        public StringType addLinkIdElement() {//2 
2918          StringType t = new StringType();
2919          if (this.linkId == null)
2920            this.linkId = new ArrayList<StringType>();
2921          this.linkId.add(t);
2922          return t;
2923        }
2924
2925        /**
2926         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2927         */
2928        public ContractOfferComponent addLinkId(String value) { //1
2929          StringType t = new StringType();
2930          t.setValue(value);
2931          if (this.linkId == null)
2932            this.linkId = new ArrayList<StringType>();
2933          this.linkId.add(t);
2934          return this;
2935        }
2936
2937        /**
2938         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2939         */
2940        public boolean hasLinkId(String value) { 
2941          if (this.linkId == null)
2942            return false;
2943          for (StringType v : this.linkId)
2944            if (v.getValue().equals(value)) // string
2945              return true;
2946          return false;
2947        }
2948
2949        /**
2950         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2951         */
2952        public List<UnsignedIntType> getSecurityLabelNumber() { 
2953          if (this.securityLabelNumber == null)
2954            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2955          return this.securityLabelNumber;
2956        }
2957
2958        /**
2959         * @return Returns a reference to <code>this</code> for easy method chaining
2960         */
2961        public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
2962          this.securityLabelNumber = theSecurityLabelNumber;
2963          return this;
2964        }
2965
2966        public boolean hasSecurityLabelNumber() { 
2967          if (this.securityLabelNumber == null)
2968            return false;
2969          for (UnsignedIntType item : this.securityLabelNumber)
2970            if (!item.isEmpty())
2971              return true;
2972          return false;
2973        }
2974
2975        /**
2976         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2977         */
2978        public UnsignedIntType addSecurityLabelNumberElement() {//2 
2979          UnsignedIntType t = new UnsignedIntType();
2980          if (this.securityLabelNumber == null)
2981            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2982          this.securityLabelNumber.add(t);
2983          return t;
2984        }
2985
2986        /**
2987         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2988         */
2989        public ContractOfferComponent addSecurityLabelNumber(int value) { //1
2990          UnsignedIntType t = new UnsignedIntType();
2991          t.setValue(value);
2992          if (this.securityLabelNumber == null)
2993            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2994          this.securityLabelNumber.add(t);
2995          return this;
2996        }
2997
2998        /**
2999         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
3000         */
3001        public boolean hasSecurityLabelNumber(int value) { 
3002          if (this.securityLabelNumber == null)
3003            return false;
3004          for (UnsignedIntType v : this.securityLabelNumber)
3005            if (v.getValue().equals(value)) // unsignedInt
3006              return true;
3007          return false;
3008        }
3009
3010        protected void listChildren(List<Property> children) {
3011          super.listChildren(children);
3012          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier));
3013          children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
3014          children.add(new Property("topic", "Reference(Any)", "The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).", 0, 1, topic));
3015          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));
3016          children.add(new Property("decision", "CodeableConcept", "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1, decision));
3017          children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode));
3018          children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
3019          children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
3020          children.add(new Property("linkId", "string", "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0, java.lang.Integer.MAX_VALUE, linkId));
3021          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
3022        }
3023
3024        @Override
3025        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3026          switch (_hash) {
3027          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
3028          case 106437350: /*party*/  return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
3029          case 110546223: /*topic*/  return new Property("topic", "Reference(Any)", "The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).", 0, 1, topic);
3030          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);
3031          case 565719004: /*decision*/  return new Property("decision", "CodeableConcept", "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1, decision);
3032          case 675909535: /*decisionMode*/  return new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
3033          case -1412808770: /*answer*/  return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer);
3034          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
3035          case -1102667083: /*linkId*/  return new Property("linkId", "string", "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0, java.lang.Integer.MAX_VALUE, linkId);
3036          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
3037          default: return super.getNamedProperty(_hash, _name, _checkValid);
3038          }
3039
3040        }
3041
3042      @Override
3043      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3044        switch (hash) {
3045        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3046        case 106437350: /*party*/ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3047        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Reference
3048        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3049        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
3050        case 675909535: /*decisionMode*/ return this.decisionMode == null ? new Base[0] : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3051        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3052        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
3053        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3054        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3055        default: return super.getProperty(hash, name, checkValid);
3056        }
3057
3058      }
3059
3060      @Override
3061      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3062        switch (hash) {
3063        case -1618432855: // identifier
3064          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3065          return value;
3066        case 106437350: // party
3067          this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3068          return value;
3069        case 110546223: // topic
3070          this.topic = castToReference(value); // Reference
3071          return value;
3072        case 3575610: // type
3073          this.type = castToCodeableConcept(value); // CodeableConcept
3074          return value;
3075        case 565719004: // decision
3076          this.decision = castToCodeableConcept(value); // CodeableConcept
3077          return value;
3078        case 675909535: // decisionMode
3079          this.getDecisionMode().add(castToCodeableConcept(value)); // CodeableConcept
3080          return value;
3081        case -1412808770: // answer
3082          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3083          return value;
3084        case 3556653: // text
3085          this.text = castToString(value); // StringType
3086          return value;
3087        case -1102667083: // linkId
3088          this.getLinkId().add(castToString(value)); // StringType
3089          return value;
3090        case -149460995: // securityLabelNumber
3091          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
3092          return value;
3093        default: return super.setProperty(hash, name, value);
3094        }
3095
3096      }
3097
3098      @Override
3099      public Base setProperty(String name, Base value) throws FHIRException {
3100        if (name.equals("identifier")) {
3101          this.getIdentifier().add(castToIdentifier(value));
3102        } else if (name.equals("party")) {
3103          this.getParty().add((ContractPartyComponent) value);
3104        } else if (name.equals("topic")) {
3105          this.topic = castToReference(value); // Reference
3106        } else if (name.equals("type")) {
3107          this.type = castToCodeableConcept(value); // CodeableConcept
3108        } else if (name.equals("decision")) {
3109          this.decision = castToCodeableConcept(value); // CodeableConcept
3110        } else if (name.equals("decisionMode")) {
3111          this.getDecisionMode().add(castToCodeableConcept(value));
3112        } else if (name.equals("answer")) {
3113          this.getAnswer().add((AnswerComponent) value);
3114        } else if (name.equals("text")) {
3115          this.text = castToString(value); // StringType
3116        } else if (name.equals("linkId")) {
3117          this.getLinkId().add(castToString(value));
3118        } else if (name.equals("securityLabelNumber")) {
3119          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
3120        } else
3121          return super.setProperty(name, value);
3122        return value;
3123      }
3124
3125      @Override
3126      public Base makeProperty(int hash, String name) throws FHIRException {
3127        switch (hash) {
3128        case -1618432855:  return addIdentifier(); 
3129        case 106437350:  return addParty(); 
3130        case 110546223:  return getTopic(); 
3131        case 3575610:  return getType(); 
3132        case 565719004:  return getDecision(); 
3133        case 675909535:  return addDecisionMode(); 
3134        case -1412808770:  return addAnswer(); 
3135        case 3556653:  return getTextElement();
3136        case -1102667083:  return addLinkIdElement();
3137        case -149460995:  return addSecurityLabelNumberElement();
3138        default: return super.makeProperty(hash, name);
3139        }
3140
3141      }
3142
3143      @Override
3144      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3145        switch (hash) {
3146        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3147        case 106437350: /*party*/ return new String[] {};
3148        case 110546223: /*topic*/ return new String[] {"Reference"};
3149        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3150        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
3151        case 675909535: /*decisionMode*/ return new String[] {"CodeableConcept"};
3152        case -1412808770: /*answer*/ return new String[] {};
3153        case 3556653: /*text*/ return new String[] {"string"};
3154        case -1102667083: /*linkId*/ return new String[] {"string"};
3155        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
3156        default: return super.getTypesForProperty(hash, name);
3157        }
3158
3159      }
3160
3161      @Override
3162      public Base addChild(String name) throws FHIRException {
3163        if (name.equals("identifier")) {
3164          return addIdentifier();
3165        }
3166        else if (name.equals("party")) {
3167          return addParty();
3168        }
3169        else if (name.equals("topic")) {
3170          this.topic = new Reference();
3171          return this.topic;
3172        }
3173        else if (name.equals("type")) {
3174          this.type = new CodeableConcept();
3175          return this.type;
3176        }
3177        else if (name.equals("decision")) {
3178          this.decision = new CodeableConcept();
3179          return this.decision;
3180        }
3181        else if (name.equals("decisionMode")) {
3182          return addDecisionMode();
3183        }
3184        else if (name.equals("answer")) {
3185          return addAnswer();
3186        }
3187        else if (name.equals("text")) {
3188          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
3189        }
3190        else if (name.equals("linkId")) {
3191          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
3192        }
3193        else if (name.equals("securityLabelNumber")) {
3194          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
3195        }
3196        else
3197          return super.addChild(name);
3198      }
3199
3200      public ContractOfferComponent copy() {
3201        ContractOfferComponent dst = new ContractOfferComponent();
3202        copyValues(dst);
3203        return dst;
3204      }
3205
3206      public void copyValues(ContractOfferComponent dst) {
3207        super.copyValues(dst);
3208        if (identifier != null) {
3209          dst.identifier = new ArrayList<Identifier>();
3210          for (Identifier i : identifier)
3211            dst.identifier.add(i.copy());
3212        };
3213        if (party != null) {
3214          dst.party = new ArrayList<ContractPartyComponent>();
3215          for (ContractPartyComponent i : party)
3216            dst.party.add(i.copy());
3217        };
3218        dst.topic = topic == null ? null : topic.copy();
3219        dst.type = type == null ? null : type.copy();
3220        dst.decision = decision == null ? null : decision.copy();
3221        if (decisionMode != null) {
3222          dst.decisionMode = new ArrayList<CodeableConcept>();
3223          for (CodeableConcept i : decisionMode)
3224            dst.decisionMode.add(i.copy());
3225        };
3226        if (answer != null) {
3227          dst.answer = new ArrayList<AnswerComponent>();
3228          for (AnswerComponent i : answer)
3229            dst.answer.add(i.copy());
3230        };
3231        dst.text = text == null ? null : text.copy();
3232        if (linkId != null) {
3233          dst.linkId = new ArrayList<StringType>();
3234          for (StringType i : linkId)
3235            dst.linkId.add(i.copy());
3236        };
3237        if (securityLabelNumber != null) {
3238          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
3239          for (UnsignedIntType i : securityLabelNumber)
3240            dst.securityLabelNumber.add(i.copy());
3241        };
3242      }
3243
3244      @Override
3245      public boolean equalsDeep(Base other_) {
3246        if (!super.equalsDeep(other_))
3247          return false;
3248        if (!(other_ instanceof ContractOfferComponent))
3249          return false;
3250        ContractOfferComponent o = (ContractOfferComponent) other_;
3251        return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true) && compareDeep(topic, o.topic, true)
3252           && compareDeep(type, o.type, true) && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
3253           && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
3254           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
3255      }
3256
3257      @Override
3258      public boolean equalsShallow(Base other_) {
3259        if (!super.equalsShallow(other_))
3260          return false;
3261        if (!(other_ instanceof ContractOfferComponent))
3262          return false;
3263        ContractOfferComponent o = (ContractOfferComponent) other_;
3264        return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
3265          ;
3266      }
3267
3268      public boolean isEmpty() {
3269        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic
3270          , type, decision, decisionMode, answer, text, linkId, securityLabelNumber);
3271      }
3272
3273  public String fhirType() {
3274    return "Contract.term.offer";
3275
3276  }
3277
3278  }
3279
3280    @Block()
3281    public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
3282        /**
3283         * Participant in the offer.
3284         */
3285        @Child(name = "reference", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class, Device.class, Group.class, Organization.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3286        @Description(shortDefinition="Referenced entity", formalDefinition="Participant in the offer." )
3287        protected List<Reference> reference;
3288        /**
3289         * The actual objects that are the target of the reference (Participant in the offer.)
3290         */
3291        protected List<Resource> referenceTarget;
3292
3293
3294        /**
3295         * How the party participates in the offer.
3296         */
3297        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
3298        @Description(shortDefinition="Participant engagement type", formalDefinition="How the party participates in the offer." )
3299        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-party-role")
3300        protected CodeableConcept role;
3301
3302        private static final long serialVersionUID = 128949255L;
3303
3304    /**
3305     * Constructor
3306     */
3307      public ContractPartyComponent() {
3308        super();
3309      }
3310
3311    /**
3312     * Constructor
3313     */
3314      public ContractPartyComponent(CodeableConcept role) {
3315        super();
3316        this.role = role;
3317      }
3318
3319        /**
3320         * @return {@link #reference} (Participant in the offer.)
3321         */
3322        public List<Reference> getReference() { 
3323          if (this.reference == null)
3324            this.reference = new ArrayList<Reference>();
3325          return this.reference;
3326        }
3327
3328        /**
3329         * @return Returns a reference to <code>this</code> for easy method chaining
3330         */
3331        public ContractPartyComponent setReference(List<Reference> theReference) { 
3332          this.reference = theReference;
3333          return this;
3334        }
3335
3336        public boolean hasReference() { 
3337          if (this.reference == null)
3338            return false;
3339          for (Reference item : this.reference)
3340            if (!item.isEmpty())
3341              return true;
3342          return false;
3343        }
3344
3345        public Reference addReference() { //3
3346          Reference t = new Reference();
3347          if (this.reference == null)
3348            this.reference = new ArrayList<Reference>();
3349          this.reference.add(t);
3350          return t;
3351        }
3352
3353        public ContractPartyComponent addReference(Reference t) { //3
3354          if (t == null)
3355            return this;
3356          if (this.reference == null)
3357            this.reference = new ArrayList<Reference>();
3358          this.reference.add(t);
3359          return this;
3360        }
3361
3362        /**
3363         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist
3364         */
3365        public Reference getReferenceFirstRep() { 
3366          if (getReference().isEmpty()) {
3367            addReference();
3368          }
3369          return getReference().get(0);
3370        }
3371
3372        /**
3373         * @deprecated Use Reference#setResource(IBaseResource) instead
3374         */
3375        @Deprecated
3376        public List<Resource> getReferenceTarget() { 
3377          if (this.referenceTarget == null)
3378            this.referenceTarget = new ArrayList<Resource>();
3379          return this.referenceTarget;
3380        }
3381
3382        /**
3383         * @return {@link #role} (How the party participates in the offer.)
3384         */
3385        public CodeableConcept getRole() { 
3386          if (this.role == null)
3387            if (Configuration.errorOnAutoCreate())
3388              throw new Error("Attempt to auto-create ContractPartyComponent.role");
3389            else if (Configuration.doAutoCreate())
3390              this.role = new CodeableConcept(); // cc
3391          return this.role;
3392        }
3393
3394        public boolean hasRole() { 
3395          return this.role != null && !this.role.isEmpty();
3396        }
3397
3398        /**
3399         * @param value {@link #role} (How the party participates in the offer.)
3400         */
3401        public ContractPartyComponent setRole(CodeableConcept value) { 
3402          this.role = value;
3403          return this;
3404        }
3405
3406        protected void listChildren(List<Property> children) {
3407          super.listChildren(children);
3408          children.add(new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
3409          children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
3410        }
3411
3412        @Override
3413        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3414          switch (_hash) {
3415          case -925155509: /*reference*/  return new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference);
3416          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role);
3417          default: return super.getNamedProperty(_hash, _name, _checkValid);
3418          }
3419
3420        }
3421
3422      @Override
3423      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3424        switch (hash) {
3425        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
3426        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
3427        default: return super.getProperty(hash, name, checkValid);
3428        }
3429
3430      }
3431
3432      @Override
3433      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3434        switch (hash) {
3435        case -925155509: // reference
3436          this.getReference().add(castToReference(value)); // Reference
3437          return value;
3438        case 3506294: // role
3439          this.role = castToCodeableConcept(value); // CodeableConcept
3440          return value;
3441        default: return super.setProperty(hash, name, value);
3442        }
3443
3444      }
3445
3446      @Override
3447      public Base setProperty(String name, Base value) throws FHIRException {
3448        if (name.equals("reference")) {
3449          this.getReference().add(castToReference(value));
3450        } else if (name.equals("role")) {
3451          this.role = castToCodeableConcept(value); // CodeableConcept
3452        } else
3453          return super.setProperty(name, value);
3454        return value;
3455      }
3456
3457      @Override
3458      public Base makeProperty(int hash, String name) throws FHIRException {
3459        switch (hash) {
3460        case -925155509:  return addReference(); 
3461        case 3506294:  return getRole(); 
3462        default: return super.makeProperty(hash, name);
3463        }
3464
3465      }
3466
3467      @Override
3468      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3469        switch (hash) {
3470        case -925155509: /*reference*/ return new String[] {"Reference"};
3471        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
3472        default: return super.getTypesForProperty(hash, name);
3473        }
3474
3475      }
3476
3477      @Override
3478      public Base addChild(String name) throws FHIRException {
3479        if (name.equals("reference")) {
3480          return addReference();
3481        }
3482        else if (name.equals("role")) {
3483          this.role = new CodeableConcept();
3484          return this.role;
3485        }
3486        else
3487          return super.addChild(name);
3488      }
3489
3490      public ContractPartyComponent copy() {
3491        ContractPartyComponent dst = new ContractPartyComponent();
3492        copyValues(dst);
3493        return dst;
3494      }
3495
3496      public void copyValues(ContractPartyComponent dst) {
3497        super.copyValues(dst);
3498        if (reference != null) {
3499          dst.reference = new ArrayList<Reference>();
3500          for (Reference i : reference)
3501            dst.reference.add(i.copy());
3502        };
3503        dst.role = role == null ? null : role.copy();
3504      }
3505
3506      @Override
3507      public boolean equalsDeep(Base other_) {
3508        if (!super.equalsDeep(other_))
3509          return false;
3510        if (!(other_ instanceof ContractPartyComponent))
3511          return false;
3512        ContractPartyComponent o = (ContractPartyComponent) other_;
3513        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
3514      }
3515
3516      @Override
3517      public boolean equalsShallow(Base other_) {
3518        if (!super.equalsShallow(other_))
3519          return false;
3520        if (!(other_ instanceof ContractPartyComponent))
3521          return false;
3522        ContractPartyComponent o = (ContractPartyComponent) other_;
3523        return true;
3524      }
3525
3526      public boolean isEmpty() {
3527        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
3528      }
3529
3530  public String fhirType() {
3531    return "Contract.term.offer.party";
3532
3533  }
3534
3535  }
3536
3537    @Block()
3538    public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
3539        /**
3540         * Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.
3541         */
3542        @Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
3543        @Description(shortDefinition="The actual answer response", formalDefinition="Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research." )
3544        protected Type value;
3545
3546        private static final long serialVersionUID = -732981989L;
3547
3548    /**
3549     * Constructor
3550     */
3551      public AnswerComponent() {
3552        super();
3553      }
3554
3555    /**
3556     * Constructor
3557     */
3558      public AnswerComponent(Type value) {
3559        super();
3560        this.value = value;
3561      }
3562
3563        /**
3564         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3565         */
3566        public Type getValue() { 
3567          return this.value;
3568        }
3569
3570        /**
3571         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3572         */
3573        public BooleanType getValueBooleanType() throws FHIRException { 
3574          if (this.value == null)
3575            this.value = new BooleanType();
3576          if (!(this.value instanceof BooleanType))
3577            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3578          return (BooleanType) this.value;
3579        }
3580
3581        public boolean hasValueBooleanType() { 
3582          return this != null && this.value instanceof BooleanType;
3583        }
3584
3585        /**
3586         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3587         */
3588        public DecimalType getValueDecimalType() throws FHIRException { 
3589          if (this.value == null)
3590            this.value = new DecimalType();
3591          if (!(this.value instanceof DecimalType))
3592            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
3593          return (DecimalType) this.value;
3594        }
3595
3596        public boolean hasValueDecimalType() { 
3597          return this != null && this.value instanceof DecimalType;
3598        }
3599
3600        /**
3601         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3602         */
3603        public IntegerType getValueIntegerType() throws FHIRException { 
3604          if (this.value == null)
3605            this.value = new IntegerType();
3606          if (!(this.value instanceof IntegerType))
3607            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3608          return (IntegerType) this.value;
3609        }
3610
3611        public boolean hasValueIntegerType() { 
3612          return this != null && this.value instanceof IntegerType;
3613        }
3614
3615        /**
3616         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3617         */
3618        public DateType getValueDateType() throws FHIRException { 
3619          if (this.value == null)
3620            this.value = new DateType();
3621          if (!(this.value instanceof DateType))
3622            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
3623          return (DateType) this.value;
3624        }
3625
3626        public boolean hasValueDateType() { 
3627          return this != null && this.value instanceof DateType;
3628        }
3629
3630        /**
3631         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3632         */
3633        public DateTimeType getValueDateTimeType() throws FHIRException { 
3634          if (this.value == null)
3635            this.value = new DateTimeType();
3636          if (!(this.value instanceof DateTimeType))
3637            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3638          return (DateTimeType) this.value;
3639        }
3640
3641        public boolean hasValueDateTimeType() { 
3642          return this != null && this.value instanceof DateTimeType;
3643        }
3644
3645        /**
3646         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3647         */
3648        public TimeType getValueTimeType() throws FHIRException { 
3649          if (this.value == null)
3650            this.value = new TimeType();
3651          if (!(this.value instanceof TimeType))
3652            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3653          return (TimeType) this.value;
3654        }
3655
3656        public boolean hasValueTimeType() { 
3657          return this != null && this.value instanceof TimeType;
3658        }
3659
3660        /**
3661         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3662         */
3663        public StringType getValueStringType() throws FHIRException { 
3664          if (this.value == null)
3665            this.value = new StringType();
3666          if (!(this.value instanceof StringType))
3667            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3668          return (StringType) this.value;
3669        }
3670
3671        public boolean hasValueStringType() { 
3672          return this != null && this.value instanceof StringType;
3673        }
3674
3675        /**
3676         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3677         */
3678        public UriType getValueUriType() throws FHIRException { 
3679          if (this.value == null)
3680            this.value = new UriType();
3681          if (!(this.value instanceof UriType))
3682            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3683          return (UriType) this.value;
3684        }
3685
3686        public boolean hasValueUriType() { 
3687          return this != null && this.value instanceof UriType;
3688        }
3689
3690        /**
3691         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3692         */
3693        public Attachment getValueAttachment() throws FHIRException { 
3694          if (this.value == null)
3695            this.value = new Attachment();
3696          if (!(this.value instanceof Attachment))
3697            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3698          return (Attachment) this.value;
3699        }
3700
3701        public boolean hasValueAttachment() { 
3702          return this != null && this.value instanceof Attachment;
3703        }
3704
3705        /**
3706         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3707         */
3708        public Coding getValueCoding() throws FHIRException { 
3709          if (this.value == null)
3710            this.value = new Coding();
3711          if (!(this.value instanceof Coding))
3712            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3713          return (Coding) this.value;
3714        }
3715
3716        public boolean hasValueCoding() { 
3717          return this != null && this.value instanceof Coding;
3718        }
3719
3720        /**
3721         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3722         */
3723        public Quantity getValueQuantity() throws FHIRException { 
3724          if (this.value == null)
3725            this.value = new Quantity();
3726          if (!(this.value instanceof Quantity))
3727            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3728          return (Quantity) this.value;
3729        }
3730
3731        public boolean hasValueQuantity() { 
3732          return this != null && this.value instanceof Quantity;
3733        }
3734
3735        /**
3736         * @return {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3737         */
3738        public Reference getValueReference() throws FHIRException { 
3739          if (this.value == null)
3740            this.value = new Reference();
3741          if (!(this.value instanceof Reference))
3742            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3743          return (Reference) this.value;
3744        }
3745
3746        public boolean hasValueReference() { 
3747          return this != null && this.value instanceof Reference;
3748        }
3749
3750        public boolean hasValue() { 
3751          return this.value != null && !this.value.isEmpty();
3752        }
3753
3754        /**
3755         * @param value {@link #value} (Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.)
3756         */
3757        public AnswerComponent setValue(Type value) { 
3758          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof UriType || value instanceof Attachment || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
3759            throw new Error("Not the right type for Contract.term.offer.answer.value[x]: "+value.fhirType());
3760          this.value = value;
3761          return this;
3762        }
3763
3764        protected void listChildren(List<Property> children) {
3765          super.listChildren(children);
3766          children.add(new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value));
3767        }
3768
3769        @Override
3770        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3771          switch (_hash) {
3772          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3773          case 111972721: /*value*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3774          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3775          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3776          case -1668204915: /*valueInteger*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3777          case -766192449: /*valueDate*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3778          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3779          case -765708322: /*valueTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3780          case -1424603934: /*valueString*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3781          case -1410172357: /*valueUri*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3782          case -475566732: /*valueAttachment*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3783          case -1887705029: /*valueCoding*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3784          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3785          case 1755241690: /*valueReference*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3786          default: return super.getNamedProperty(_hash, _name, _checkValid);
3787          }
3788
3789        }
3790
3791      @Override
3792      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3793        switch (hash) {
3794        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
3795        default: return super.getProperty(hash, name, checkValid);
3796        }
3797
3798      }
3799
3800      @Override
3801      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3802        switch (hash) {
3803        case 111972721: // value
3804          this.value = castToType(value); // Type
3805          return value;
3806        default: return super.setProperty(hash, name, value);
3807        }
3808
3809      }
3810
3811      @Override
3812      public Base setProperty(String name, Base value) throws FHIRException {
3813        if (name.equals("value[x]")) {
3814          this.value = castToType(value); // Type
3815        } else
3816          return super.setProperty(name, value);
3817        return value;
3818      }
3819
3820      @Override
3821      public Base makeProperty(int hash, String name) throws FHIRException {
3822        switch (hash) {
3823        case -1410166417:  return getValue(); 
3824        case 111972721:  return getValue(); 
3825        default: return super.makeProperty(hash, name);
3826        }
3827
3828      }
3829
3830      @Override
3831      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3832        switch (hash) {
3833        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3834        default: return super.getTypesForProperty(hash, name);
3835        }
3836
3837      }
3838
3839      @Override
3840      public Base addChild(String name) throws FHIRException {
3841        if (name.equals("valueBoolean")) {
3842          this.value = new BooleanType();
3843          return this.value;
3844        }
3845        else if (name.equals("valueDecimal")) {
3846          this.value = new DecimalType();
3847          return this.value;
3848        }
3849        else if (name.equals("valueInteger")) {
3850          this.value = new IntegerType();
3851          return this.value;
3852        }
3853        else if (name.equals("valueDate")) {
3854          this.value = new DateType();
3855          return this.value;
3856        }
3857        else if (name.equals("valueDateTime")) {
3858          this.value = new DateTimeType();
3859          return this.value;
3860        }
3861        else if (name.equals("valueTime")) {
3862          this.value = new TimeType();
3863          return this.value;
3864        }
3865        else if (name.equals("valueString")) {
3866          this.value = new StringType();
3867          return this.value;
3868        }
3869        else if (name.equals("valueUri")) {
3870          this.value = new UriType();
3871          return this.value;
3872        }
3873        else if (name.equals("valueAttachment")) {
3874          this.value = new Attachment();
3875          return this.value;
3876        }
3877        else if (name.equals("valueCoding")) {
3878          this.value = new Coding();
3879          return this.value;
3880        }
3881        else if (name.equals("valueQuantity")) {
3882          this.value = new Quantity();
3883          return this.value;
3884        }
3885        else if (name.equals("valueReference")) {
3886          this.value = new Reference();
3887          return this.value;
3888        }
3889        else
3890          return super.addChild(name);
3891      }
3892
3893      public AnswerComponent copy() {
3894        AnswerComponent dst = new AnswerComponent();
3895        copyValues(dst);
3896        return dst;
3897      }
3898
3899      public void copyValues(AnswerComponent dst) {
3900        super.copyValues(dst);
3901        dst.value = value == null ? null : value.copy();
3902      }
3903
3904      @Override
3905      public boolean equalsDeep(Base other_) {
3906        if (!super.equalsDeep(other_))
3907          return false;
3908        if (!(other_ instanceof AnswerComponent))
3909          return false;
3910        AnswerComponent o = (AnswerComponent) other_;
3911        return compareDeep(value, o.value, true);
3912      }
3913
3914      @Override
3915      public boolean equalsShallow(Base other_) {
3916        if (!super.equalsShallow(other_))
3917          return false;
3918        if (!(other_ instanceof AnswerComponent))
3919          return false;
3920        AnswerComponent o = (AnswerComponent) other_;
3921        return true;
3922      }
3923
3924      public boolean isEmpty() {
3925        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3926      }
3927
3928  public String fhirType() {
3929    return "Contract.term.offer.answer";
3930
3931  }
3932
3933  }
3934
3935    @Block()
3936    public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
3937        /**
3938         * Differentiates the kind of the asset .
3939         */
3940        @Child(name = "scope", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3941        @Description(shortDefinition="Range of asset", formalDefinition="Differentiates the kind of the asset ." )
3942        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetscope")
3943        protected CodeableConcept scope;
3944
3945        /**
3946         * Target entity type about which the term may be concerned.
3947         */
3948        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3949        @Description(shortDefinition="Asset category", formalDefinition="Target entity type about which the term may be concerned." )
3950        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assettype")
3951        protected List<CodeableConcept> type;
3952
3953        /**
3954         * Associated entities.
3955         */
3956        @Child(name = "typeReference", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3957        @Description(shortDefinition="Associated entities", formalDefinition="Associated entities." )
3958        protected List<Reference> typeReference;
3959        /**
3960         * The actual objects that are the target of the reference (Associated entities.)
3961         */
3962        protected List<Resource> typeReferenceTarget;
3963
3964
3965        /**
3966         * May be a subtype or part of an offered asset.
3967         */
3968        @Child(name = "subtype", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3969        @Description(shortDefinition="Asset sub-category", formalDefinition="May be a subtype or part of an offered asset." )
3970        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetsubtype")
3971        protected List<CodeableConcept> subtype;
3972
3973        /**
3974         * Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.
3975         */
3976        @Child(name = "relationship", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=false)
3977        @Description(shortDefinition="Kinship of the asset", formalDefinition="Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree." )
3978        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-class")
3979        protected Coding relationship;
3980
3981        /**
3982         * Circumstance of the asset.
3983         */
3984        @Child(name = "context", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3985        @Description(shortDefinition="Circumstance of the asset", formalDefinition="Circumstance of the asset." )
3986        protected List<AssetContextComponent> context;
3987
3988        /**
3989         * Description of the quality and completeness of the asset that imay be a factor in its valuation.
3990         */
3991        @Child(name = "condition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3992        @Description(shortDefinition="Quality desctiption of asset", formalDefinition="Description of the quality and completeness of the asset that imay be a factor in its valuation." )
3993        protected StringType condition;
3994
3995        /**
3996         * Type of Asset availability for use or ownership.
3997         */
3998        @Child(name = "periodType", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3999        @Description(shortDefinition="Asset availability types", formalDefinition="Type of Asset availability for use or ownership." )
4000        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/asset-availability")
4001        protected List<CodeableConcept> periodType;
4002
4003        /**
4004         * Asset relevant contractual time period.
4005         */
4006        @Child(name = "period", type = {Period.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4007        @Description(shortDefinition="Time period of the asset", formalDefinition="Asset relevant contractual time period." )
4008        protected List<Period> period;
4009
4010        /**
4011         * Time period of asset use.
4012         */
4013        @Child(name = "usePeriod", type = {Period.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4014        @Description(shortDefinition="Time period", formalDefinition="Time period of asset use." )
4015        protected List<Period> usePeriod;
4016
4017        /**
4018         * Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
4019         */
4020        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
4021        @Description(shortDefinition="Asset clause or question text", formalDefinition="Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract." )
4022        protected StringType text;
4023
4024        /**
4025         * Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.
4026         */
4027        @Child(name = "linkId", type = {StringType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4028        @Description(shortDefinition="Pointer to asset text", formalDefinition="Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse." )
4029        protected List<StringType> linkId;
4030
4031        /**
4032         * Response to assets.
4033         */
4034        @Child(name = "answer", type = {AnswerComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4035        @Description(shortDefinition="Response to assets", formalDefinition="Response to assets." )
4036        protected List<AnswerComponent> answer;
4037
4038        /**
4039         * Security labels that protects the asset.
4040         */
4041        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4042        @Description(shortDefinition="Asset restriction numbers", formalDefinition="Security labels that protects the asset." )
4043        protected List<UnsignedIntType> securityLabelNumber;
4044
4045        /**
4046         * Contract Valued Item List.
4047         */
4048        @Child(name = "valuedItem", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4049        @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
4050        protected List<ValuedItemComponent> valuedItem;
4051
4052        private static final long serialVersionUID = -1080398792L;
4053
4054    /**
4055     * Constructor
4056     */
4057      public ContractAssetComponent() {
4058        super();
4059      }
4060
4061        /**
4062         * @return {@link #scope} (Differentiates the kind of the asset .)
4063         */
4064        public CodeableConcept getScope() { 
4065          if (this.scope == null)
4066            if (Configuration.errorOnAutoCreate())
4067              throw new Error("Attempt to auto-create ContractAssetComponent.scope");
4068            else if (Configuration.doAutoCreate())
4069              this.scope = new CodeableConcept(); // cc
4070          return this.scope;
4071        }
4072
4073        public boolean hasScope() { 
4074          return this.scope != null && !this.scope.isEmpty();
4075        }
4076
4077        /**
4078         * @param value {@link #scope} (Differentiates the kind of the asset .)
4079         */
4080        public ContractAssetComponent setScope(CodeableConcept value) { 
4081          this.scope = value;
4082          return this;
4083        }
4084
4085        /**
4086         * @return {@link #type} (Target entity type about which the term may be concerned.)
4087         */
4088        public List<CodeableConcept> getType() { 
4089          if (this.type == null)
4090            this.type = new ArrayList<CodeableConcept>();
4091          return this.type;
4092        }
4093
4094        /**
4095         * @return Returns a reference to <code>this</code> for easy method chaining
4096         */
4097        public ContractAssetComponent setType(List<CodeableConcept> theType) { 
4098          this.type = theType;
4099          return this;
4100        }
4101
4102        public boolean hasType() { 
4103          if (this.type == null)
4104            return false;
4105          for (CodeableConcept item : this.type)
4106            if (!item.isEmpty())
4107              return true;
4108          return false;
4109        }
4110
4111        public CodeableConcept addType() { //3
4112          CodeableConcept t = new CodeableConcept();
4113          if (this.type == null)
4114            this.type = new ArrayList<CodeableConcept>();
4115          this.type.add(t);
4116          return t;
4117        }
4118
4119        public ContractAssetComponent addType(CodeableConcept t) { //3
4120          if (t == null)
4121            return this;
4122          if (this.type == null)
4123            this.type = new ArrayList<CodeableConcept>();
4124          this.type.add(t);
4125          return this;
4126        }
4127
4128        /**
4129         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
4130         */
4131        public CodeableConcept getTypeFirstRep() { 
4132          if (getType().isEmpty()) {
4133            addType();
4134          }
4135          return getType().get(0);
4136        }
4137
4138        /**
4139         * @return {@link #typeReference} (Associated entities.)
4140         */
4141        public List<Reference> getTypeReference() { 
4142          if (this.typeReference == null)
4143            this.typeReference = new ArrayList<Reference>();
4144          return this.typeReference;
4145        }
4146
4147        /**
4148         * @return Returns a reference to <code>this</code> for easy method chaining
4149         */
4150        public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) { 
4151          this.typeReference = theTypeReference;
4152          return this;
4153        }
4154
4155        public boolean hasTypeReference() { 
4156          if (this.typeReference == null)
4157            return false;
4158          for (Reference item : this.typeReference)
4159            if (!item.isEmpty())
4160              return true;
4161          return false;
4162        }
4163
4164        public Reference addTypeReference() { //3
4165          Reference t = new Reference();
4166          if (this.typeReference == null)
4167            this.typeReference = new ArrayList<Reference>();
4168          this.typeReference.add(t);
4169          return t;
4170        }
4171
4172        public ContractAssetComponent addTypeReference(Reference t) { //3
4173          if (t == null)
4174            return this;
4175          if (this.typeReference == null)
4176            this.typeReference = new ArrayList<Reference>();
4177          this.typeReference.add(t);
4178          return this;
4179        }
4180
4181        /**
4182         * @return The first repetition of repeating field {@link #typeReference}, creating it if it does not already exist
4183         */
4184        public Reference getTypeReferenceFirstRep() { 
4185          if (getTypeReference().isEmpty()) {
4186            addTypeReference();
4187          }
4188          return getTypeReference().get(0);
4189        }
4190
4191        /**
4192         * @deprecated Use Reference#setResource(IBaseResource) instead
4193         */
4194        @Deprecated
4195        public List<Resource> getTypeReferenceTarget() { 
4196          if (this.typeReferenceTarget == null)
4197            this.typeReferenceTarget = new ArrayList<Resource>();
4198          return this.typeReferenceTarget;
4199        }
4200
4201        /**
4202         * @return {@link #subtype} (May be a subtype or part of an offered asset.)
4203         */
4204        public List<CodeableConcept> getSubtype() { 
4205          if (this.subtype == null)
4206            this.subtype = new ArrayList<CodeableConcept>();
4207          return this.subtype;
4208        }
4209
4210        /**
4211         * @return Returns a reference to <code>this</code> for easy method chaining
4212         */
4213        public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) { 
4214          this.subtype = theSubtype;
4215          return this;
4216        }
4217
4218        public boolean hasSubtype() { 
4219          if (this.subtype == null)
4220            return false;
4221          for (CodeableConcept item : this.subtype)
4222            if (!item.isEmpty())
4223              return true;
4224          return false;
4225        }
4226
4227        public CodeableConcept addSubtype() { //3
4228          CodeableConcept t = new CodeableConcept();
4229          if (this.subtype == null)
4230            this.subtype = new ArrayList<CodeableConcept>();
4231          this.subtype.add(t);
4232          return t;
4233        }
4234
4235        public ContractAssetComponent addSubtype(CodeableConcept t) { //3
4236          if (t == null)
4237            return this;
4238          if (this.subtype == null)
4239            this.subtype = new ArrayList<CodeableConcept>();
4240          this.subtype.add(t);
4241          return this;
4242        }
4243
4244        /**
4245         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist
4246         */
4247        public CodeableConcept getSubtypeFirstRep() { 
4248          if (getSubtype().isEmpty()) {
4249            addSubtype();
4250          }
4251          return getSubtype().get(0);
4252        }
4253
4254        /**
4255         * @return {@link #relationship} (Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.)
4256         */
4257        public Coding getRelationship() { 
4258          if (this.relationship == null)
4259            if (Configuration.errorOnAutoCreate())
4260              throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
4261            else if (Configuration.doAutoCreate())
4262              this.relationship = new Coding(); // cc
4263          return this.relationship;
4264        }
4265
4266        public boolean hasRelationship() { 
4267          return this.relationship != null && !this.relationship.isEmpty();
4268        }
4269
4270        /**
4271         * @param value {@link #relationship} (Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.)
4272         */
4273        public ContractAssetComponent setRelationship(Coding value) { 
4274          this.relationship = value;
4275          return this;
4276        }
4277
4278        /**
4279         * @return {@link #context} (Circumstance of the asset.)
4280         */
4281        public List<AssetContextComponent> getContext() { 
4282          if (this.context == null)
4283            this.context = new ArrayList<AssetContextComponent>();
4284          return this.context;
4285        }
4286
4287        /**
4288         * @return Returns a reference to <code>this</code> for easy method chaining
4289         */
4290        public ContractAssetComponent setContext(List<AssetContextComponent> theContext) { 
4291          this.context = theContext;
4292          return this;
4293        }
4294
4295        public boolean hasContext() { 
4296          if (this.context == null)
4297            return false;
4298          for (AssetContextComponent item : this.context)
4299            if (!item.isEmpty())
4300              return true;
4301          return false;
4302        }
4303
4304        public AssetContextComponent addContext() { //3
4305          AssetContextComponent t = new AssetContextComponent();
4306          if (this.context == null)
4307            this.context = new ArrayList<AssetContextComponent>();
4308          this.context.add(t);
4309          return t;
4310        }
4311
4312        public ContractAssetComponent addContext(AssetContextComponent t) { //3
4313          if (t == null)
4314            return this;
4315          if (this.context == null)
4316            this.context = new ArrayList<AssetContextComponent>();
4317          this.context.add(t);
4318          return this;
4319        }
4320
4321        /**
4322         * @return The first repetition of repeating field {@link #context}, creating it if it does not already exist
4323         */
4324        public AssetContextComponent getContextFirstRep() { 
4325          if (getContext().isEmpty()) {
4326            addContext();
4327          }
4328          return getContext().get(0);
4329        }
4330
4331        /**
4332         * @return {@link #condition} (Description of the quality and completeness of the asset that imay be a factor in its valuation.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
4333         */
4334        public StringType getConditionElement() { 
4335          if (this.condition == null)
4336            if (Configuration.errorOnAutoCreate())
4337              throw new Error("Attempt to auto-create ContractAssetComponent.condition");
4338            else if (Configuration.doAutoCreate())
4339              this.condition = new StringType(); // bb
4340          return this.condition;
4341        }
4342
4343        public boolean hasConditionElement() { 
4344          return this.condition != null && !this.condition.isEmpty();
4345        }
4346
4347        public boolean hasCondition() { 
4348          return this.condition != null && !this.condition.isEmpty();
4349        }
4350
4351        /**
4352         * @param value {@link #condition} (Description of the quality and completeness of the asset that imay be a factor in its valuation.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
4353         */
4354        public ContractAssetComponent setConditionElement(StringType value) { 
4355          this.condition = value;
4356          return this;
4357        }
4358
4359        /**
4360         * @return Description of the quality and completeness of the asset that imay be a factor in its valuation.
4361         */
4362        public String getCondition() { 
4363          return this.condition == null ? null : this.condition.getValue();
4364        }
4365
4366        /**
4367         * @param value Description of the quality and completeness of the asset that imay be a factor in its valuation.
4368         */
4369        public ContractAssetComponent setCondition(String value) { 
4370          if (Utilities.noString(value))
4371            this.condition = null;
4372          else {
4373            if (this.condition == null)
4374              this.condition = new StringType();
4375            this.condition.setValue(value);
4376          }
4377          return this;
4378        }
4379
4380        /**
4381         * @return {@link #periodType} (Type of Asset availability for use or ownership.)
4382         */
4383        public List<CodeableConcept> getPeriodType() { 
4384          if (this.periodType == null)
4385            this.periodType = new ArrayList<CodeableConcept>();
4386          return this.periodType;
4387        }
4388
4389        /**
4390         * @return Returns a reference to <code>this</code> for easy method chaining
4391         */
4392        public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) { 
4393          this.periodType = thePeriodType;
4394          return this;
4395        }
4396
4397        public boolean hasPeriodType() { 
4398          if (this.periodType == null)
4399            return false;
4400          for (CodeableConcept item : this.periodType)
4401            if (!item.isEmpty())
4402              return true;
4403          return false;
4404        }
4405
4406        public CodeableConcept addPeriodType() { //3
4407          CodeableConcept t = new CodeableConcept();
4408          if (this.periodType == null)
4409            this.periodType = new ArrayList<CodeableConcept>();
4410          this.periodType.add(t);
4411          return t;
4412        }
4413
4414        public ContractAssetComponent addPeriodType(CodeableConcept t) { //3
4415          if (t == null)
4416            return this;
4417          if (this.periodType == null)
4418            this.periodType = new ArrayList<CodeableConcept>();
4419          this.periodType.add(t);
4420          return this;
4421        }
4422
4423        /**
4424         * @return The first repetition of repeating field {@link #periodType}, creating it if it does not already exist
4425         */
4426        public CodeableConcept getPeriodTypeFirstRep() { 
4427          if (getPeriodType().isEmpty()) {
4428            addPeriodType();
4429          }
4430          return getPeriodType().get(0);
4431        }
4432
4433        /**
4434         * @return {@link #period} (Asset relevant contractual time period.)
4435         */
4436        public List<Period> getPeriod() { 
4437          if (this.period == null)
4438            this.period = new ArrayList<Period>();
4439          return this.period;
4440        }
4441
4442        /**
4443         * @return Returns a reference to <code>this</code> for easy method chaining
4444         */
4445        public ContractAssetComponent setPeriod(List<Period> thePeriod) { 
4446          this.period = thePeriod;
4447          return this;
4448        }
4449
4450        public boolean hasPeriod() { 
4451          if (this.period == null)
4452            return false;
4453          for (Period item : this.period)
4454            if (!item.isEmpty())
4455              return true;
4456          return false;
4457        }
4458
4459        public Period addPeriod() { //3
4460          Period t = new Period();
4461          if (this.period == null)
4462            this.period = new ArrayList<Period>();
4463          this.period.add(t);
4464          return t;
4465        }
4466
4467        public ContractAssetComponent addPeriod(Period t) { //3
4468          if (t == null)
4469            return this;
4470          if (this.period == null)
4471            this.period = new ArrayList<Period>();
4472          this.period.add(t);
4473          return this;
4474        }
4475
4476        /**
4477         * @return The first repetition of repeating field {@link #period}, creating it if it does not already exist
4478         */
4479        public Period getPeriodFirstRep() { 
4480          if (getPeriod().isEmpty()) {
4481            addPeriod();
4482          }
4483          return getPeriod().get(0);
4484        }
4485
4486        /**
4487         * @return {@link #usePeriod} (Time period of asset use.)
4488         */
4489        public List<Period> getUsePeriod() { 
4490          if (this.usePeriod == null)
4491            this.usePeriod = new ArrayList<Period>();
4492          return this.usePeriod;
4493        }
4494
4495        /**
4496         * @return Returns a reference to <code>this</code> for easy method chaining
4497         */
4498        public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) { 
4499          this.usePeriod = theUsePeriod;
4500          return this;
4501        }
4502
4503        public boolean hasUsePeriod() { 
4504          if (this.usePeriod == null)
4505            return false;
4506          for (Period item : this.usePeriod)
4507            if (!item.isEmpty())
4508              return true;
4509          return false;
4510        }
4511
4512        public Period addUsePeriod() { //3
4513          Period t = new Period();
4514          if (this.usePeriod == null)
4515            this.usePeriod = new ArrayList<Period>();
4516          this.usePeriod.add(t);
4517          return t;
4518        }
4519
4520        public ContractAssetComponent addUsePeriod(Period t) { //3
4521          if (t == null)
4522            return this;
4523          if (this.usePeriod == null)
4524            this.usePeriod = new ArrayList<Period>();
4525          this.usePeriod.add(t);
4526          return this;
4527        }
4528
4529        /**
4530         * @return The first repetition of repeating field {@link #usePeriod}, creating it if it does not already exist
4531         */
4532        public Period getUsePeriodFirstRep() { 
4533          if (getUsePeriod().isEmpty()) {
4534            addUsePeriod();
4535          }
4536          return getUsePeriod().get(0);
4537        }
4538
4539        /**
4540         * @return {@link #text} (Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
4541         */
4542        public StringType getTextElement() { 
4543          if (this.text == null)
4544            if (Configuration.errorOnAutoCreate())
4545              throw new Error("Attempt to auto-create ContractAssetComponent.text");
4546            else if (Configuration.doAutoCreate())
4547              this.text = new StringType(); // bb
4548          return this.text;
4549        }
4550
4551        public boolean hasTextElement() { 
4552          return this.text != null && !this.text.isEmpty();
4553        }
4554
4555        public boolean hasText() { 
4556          return this.text != null && !this.text.isEmpty();
4557        }
4558
4559        /**
4560         * @param value {@link #text} (Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
4561         */
4562        public ContractAssetComponent setTextElement(StringType value) { 
4563          this.text = value;
4564          return this;
4565        }
4566
4567        /**
4568         * @return Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
4569         */
4570        public String getText() { 
4571          return this.text == null ? null : this.text.getValue();
4572        }
4573
4574        /**
4575         * @param value Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
4576         */
4577        public ContractAssetComponent setText(String value) { 
4578          if (Utilities.noString(value))
4579            this.text = null;
4580          else {
4581            if (this.text == null)
4582              this.text = new StringType();
4583            this.text.setValue(value);
4584          }
4585          return this;
4586        }
4587
4588        /**
4589         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4590         */
4591        public List<StringType> getLinkId() { 
4592          if (this.linkId == null)
4593            this.linkId = new ArrayList<StringType>();
4594          return this.linkId;
4595        }
4596
4597        /**
4598         * @return Returns a reference to <code>this</code> for easy method chaining
4599         */
4600        public ContractAssetComponent setLinkId(List<StringType> theLinkId) { 
4601          this.linkId = theLinkId;
4602          return this;
4603        }
4604
4605        public boolean hasLinkId() { 
4606          if (this.linkId == null)
4607            return false;
4608          for (StringType item : this.linkId)
4609            if (!item.isEmpty())
4610              return true;
4611          return false;
4612        }
4613
4614        /**
4615         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4616         */
4617        public StringType addLinkIdElement() {//2 
4618          StringType t = new StringType();
4619          if (this.linkId == null)
4620            this.linkId = new ArrayList<StringType>();
4621          this.linkId.add(t);
4622          return t;
4623        }
4624
4625        /**
4626         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4627         */
4628        public ContractAssetComponent addLinkId(String value) { //1
4629          StringType t = new StringType();
4630          t.setValue(value);
4631          if (this.linkId == null)
4632            this.linkId = new ArrayList<StringType>();
4633          this.linkId.add(t);
4634          return this;
4635        }
4636
4637        /**
4638         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4639         */
4640        public boolean hasLinkId(String value) { 
4641          if (this.linkId == null)
4642            return false;
4643          for (StringType v : this.linkId)
4644            if (v.getValue().equals(value)) // string
4645              return true;
4646          return false;
4647        }
4648
4649        /**
4650         * @return {@link #answer} (Response to assets.)
4651         */
4652        public List<AnswerComponent> getAnswer() { 
4653          if (this.answer == null)
4654            this.answer = new ArrayList<AnswerComponent>();
4655          return this.answer;
4656        }
4657
4658        /**
4659         * @return Returns a reference to <code>this</code> for easy method chaining
4660         */
4661        public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) { 
4662          this.answer = theAnswer;
4663          return this;
4664        }
4665
4666        public boolean hasAnswer() { 
4667          if (this.answer == null)
4668            return false;
4669          for (AnswerComponent item : this.answer)
4670            if (!item.isEmpty())
4671              return true;
4672          return false;
4673        }
4674
4675        public AnswerComponent addAnswer() { //3
4676          AnswerComponent t = new AnswerComponent();
4677          if (this.answer == null)
4678            this.answer = new ArrayList<AnswerComponent>();
4679          this.answer.add(t);
4680          return t;
4681        }
4682
4683        public ContractAssetComponent addAnswer(AnswerComponent t) { //3
4684          if (t == null)
4685            return this;
4686          if (this.answer == null)
4687            this.answer = new ArrayList<AnswerComponent>();
4688          this.answer.add(t);
4689          return this;
4690        }
4691
4692        /**
4693         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist
4694         */
4695        public AnswerComponent getAnswerFirstRep() { 
4696          if (getAnswer().isEmpty()) {
4697            addAnswer();
4698          }
4699          return getAnswer().get(0);
4700        }
4701
4702        /**
4703         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4704         */
4705        public List<UnsignedIntType> getSecurityLabelNumber() { 
4706          if (this.securityLabelNumber == null)
4707            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4708          return this.securityLabelNumber;
4709        }
4710
4711        /**
4712         * @return Returns a reference to <code>this</code> for easy method chaining
4713         */
4714        public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
4715          this.securityLabelNumber = theSecurityLabelNumber;
4716          return this;
4717        }
4718
4719        public boolean hasSecurityLabelNumber() { 
4720          if (this.securityLabelNumber == null)
4721            return false;
4722          for (UnsignedIntType item : this.securityLabelNumber)
4723            if (!item.isEmpty())
4724              return true;
4725          return false;
4726        }
4727
4728        /**
4729         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4730         */
4731        public UnsignedIntType addSecurityLabelNumberElement() {//2 
4732          UnsignedIntType t = new UnsignedIntType();
4733          if (this.securityLabelNumber == null)
4734            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4735          this.securityLabelNumber.add(t);
4736          return t;
4737        }
4738
4739        /**
4740         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4741         */
4742        public ContractAssetComponent addSecurityLabelNumber(int value) { //1
4743          UnsignedIntType t = new UnsignedIntType();
4744          t.setValue(value);
4745          if (this.securityLabelNumber == null)
4746            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4747          this.securityLabelNumber.add(t);
4748          return this;
4749        }
4750
4751        /**
4752         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4753         */
4754        public boolean hasSecurityLabelNumber(int value) { 
4755          if (this.securityLabelNumber == null)
4756            return false;
4757          for (UnsignedIntType v : this.securityLabelNumber)
4758            if (v.getValue().equals(value)) // unsignedInt
4759              return true;
4760          return false;
4761        }
4762
4763        /**
4764         * @return {@link #valuedItem} (Contract Valued Item List.)
4765         */
4766        public List<ValuedItemComponent> getValuedItem() { 
4767          if (this.valuedItem == null)
4768            this.valuedItem = new ArrayList<ValuedItemComponent>();
4769          return this.valuedItem;
4770        }
4771
4772        /**
4773         * @return Returns a reference to <code>this</code> for easy method chaining
4774         */
4775        public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) { 
4776          this.valuedItem = theValuedItem;
4777          return this;
4778        }
4779
4780        public boolean hasValuedItem() { 
4781          if (this.valuedItem == null)
4782            return false;
4783          for (ValuedItemComponent item : this.valuedItem)
4784            if (!item.isEmpty())
4785              return true;
4786          return false;
4787        }
4788
4789        public ValuedItemComponent addValuedItem() { //3
4790          ValuedItemComponent t = new ValuedItemComponent();
4791          if (this.valuedItem == null)
4792            this.valuedItem = new ArrayList<ValuedItemComponent>();
4793          this.valuedItem.add(t);
4794          return t;
4795        }
4796
4797        public ContractAssetComponent addValuedItem(ValuedItemComponent t) { //3
4798          if (t == null)
4799            return this;
4800          if (this.valuedItem == null)
4801            this.valuedItem = new ArrayList<ValuedItemComponent>();
4802          this.valuedItem.add(t);
4803          return this;
4804        }
4805
4806        /**
4807         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
4808         */
4809        public ValuedItemComponent getValuedItemFirstRep() { 
4810          if (getValuedItem().isEmpty()) {
4811            addValuedItem();
4812          }
4813          return getValuedItem().get(0);
4814        }
4815
4816        protected void listChildren(List<Property> children) {
4817          super.listChildren(children);
4818          children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
4819          children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type));
4820          children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference));
4821          children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0, java.lang.Integer.MAX_VALUE, subtype));
4822          children.add(new Property("relationship", "Coding", "Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.", 0, 1, relationship));
4823          children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
4824          children.add(new Property("condition", "string", "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1, condition));
4825          children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType));
4826          children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period));
4827          children.add(new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
4828          children.add(new Property("text", "string", "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.", 0, 1, text));
4829          children.add(new Property("linkId", "string", "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId));
4830          children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer));
4831          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
4832          children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
4833        }
4834
4835        @Override
4836        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4837          switch (_hash) {
4838          case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope);
4839          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type);
4840          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference);
4841          case -1867567750: /*subtype*/  return new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0, java.lang.Integer.MAX_VALUE, subtype);
4842          case -261851592: /*relationship*/  return new Property("relationship", "Coding", "Specifies the applicability of the term to an asset resource instance, and instances it refers to orinstances that refer to it, and/or are owned by the offeree.", 0, 1, relationship);
4843          case 951530927: /*context*/  return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context);
4844          case -861311717: /*condition*/  return new Property("condition", "string", "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1, condition);
4845          case 384348315: /*periodType*/  return new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
4846          case -991726143: /*period*/  return new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period);
4847          case -628382168: /*usePeriod*/  return new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod);
4848          case 3556653: /*text*/  return new Property("text", "string", "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.", 0, 1, text);
4849          case -1102667083: /*linkId*/  return new Property("linkId", "string", "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId);
4850          case -1412808770: /*answer*/  return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer);
4851          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
4852          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
4853          default: return super.getNamedProperty(_hash, _name, _checkValid);
4854          }
4855
4856        }
4857
4858      @Override
4859      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4860        switch (hash) {
4861        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
4862        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4863        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
4864        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
4865        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
4866        case 951530927: /*context*/ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
4867        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
4868        case 384348315: /*periodType*/ return this.periodType == null ? new Base[0] : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
4869        case -991726143: /*period*/ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
4870        case -628382168: /*usePeriod*/ return this.usePeriod == null ? new Base[0] : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
4871        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
4872        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
4873        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
4874        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
4875        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
4876        default: return super.getProperty(hash, name, checkValid);
4877        }
4878
4879      }
4880
4881      @Override
4882      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4883        switch (hash) {
4884        case 109264468: // scope
4885          this.scope = castToCodeableConcept(value); // CodeableConcept
4886          return value;
4887        case 3575610: // type
4888          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
4889          return value;
4890        case 2074825009: // typeReference
4891          this.getTypeReference().add(castToReference(value)); // Reference
4892          return value;
4893        case -1867567750: // subtype
4894          this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
4895          return value;
4896        case -261851592: // relationship
4897          this.relationship = castToCoding(value); // Coding
4898          return value;
4899        case 951530927: // context
4900          this.getContext().add((AssetContextComponent) value); // AssetContextComponent
4901          return value;
4902        case -861311717: // condition
4903          this.condition = castToString(value); // StringType
4904          return value;
4905        case 384348315: // periodType
4906          this.getPeriodType().add(castToCodeableConcept(value)); // CodeableConcept
4907          return value;
4908        case -991726143: // period
4909          this.getPeriod().add(castToPeriod(value)); // Period
4910          return value;
4911        case -628382168: // usePeriod
4912          this.getUsePeriod().add(castToPeriod(value)); // Period
4913          return value;
4914        case 3556653: // text
4915          this.text = castToString(value); // StringType
4916          return value;
4917        case -1102667083: // linkId
4918          this.getLinkId().add(castToString(value)); // StringType
4919          return value;
4920        case -1412808770: // answer
4921          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
4922          return value;
4923        case -149460995: // securityLabelNumber
4924          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
4925          return value;
4926        case 2046675654: // valuedItem
4927          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
4928          return value;
4929        default: return super.setProperty(hash, name, value);
4930        }
4931
4932      }
4933
4934      @Override
4935      public Base setProperty(String name, Base value) throws FHIRException {
4936        if (name.equals("scope")) {
4937          this.scope = castToCodeableConcept(value); // CodeableConcept
4938        } else if (name.equals("type")) {
4939          this.getType().add(castToCodeableConcept(value));
4940        } else if (name.equals("typeReference")) {
4941          this.getTypeReference().add(castToReference(value));
4942        } else if (name.equals("subtype")) {
4943          this.getSubtype().add(castToCodeableConcept(value));
4944        } else if (name.equals("relationship")) {
4945          this.relationship = castToCoding(value); // Coding
4946        } else if (name.equals("context")) {
4947          this.getContext().add((AssetContextComponent) value);
4948        } else if (name.equals("condition")) {
4949          this.condition = castToString(value); // StringType
4950        } else if (name.equals("periodType")) {
4951          this.getPeriodType().add(castToCodeableConcept(value));
4952        } else if (name.equals("period")) {
4953          this.getPeriod().add(castToPeriod(value));
4954        } else if (name.equals("usePeriod")) {
4955          this.getUsePeriod().add(castToPeriod(value));
4956        } else if (name.equals("text")) {
4957          this.text = castToString(value); // StringType
4958        } else if (name.equals("linkId")) {
4959          this.getLinkId().add(castToString(value));
4960        } else if (name.equals("answer")) {
4961          this.getAnswer().add((AnswerComponent) value);
4962        } else if (name.equals("securityLabelNumber")) {
4963          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
4964        } else if (name.equals("valuedItem")) {
4965          this.getValuedItem().add((ValuedItemComponent) value);
4966        } else
4967          return super.setProperty(name, value);
4968        return value;
4969      }
4970
4971      @Override
4972      public Base makeProperty(int hash, String name) throws FHIRException {
4973        switch (hash) {
4974        case 109264468:  return getScope(); 
4975        case 3575610:  return addType(); 
4976        case 2074825009:  return addTypeReference(); 
4977        case -1867567750:  return addSubtype(); 
4978        case -261851592:  return getRelationship(); 
4979        case 951530927:  return addContext(); 
4980        case -861311717:  return getConditionElement();
4981        case 384348315:  return addPeriodType(); 
4982        case -991726143:  return addPeriod(); 
4983        case -628382168:  return addUsePeriod(); 
4984        case 3556653:  return getTextElement();
4985        case -1102667083:  return addLinkIdElement();
4986        case -1412808770:  return addAnswer(); 
4987        case -149460995:  return addSecurityLabelNumberElement();
4988        case 2046675654:  return addValuedItem(); 
4989        default: return super.makeProperty(hash, name);
4990        }
4991
4992      }
4993
4994      @Override
4995      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4996        switch (hash) {
4997        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
4998        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4999        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
5000        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
5001        case -261851592: /*relationship*/ return new String[] {"Coding"};
5002        case 951530927: /*context*/ return new String[] {};
5003        case -861311717: /*condition*/ return new String[] {"string"};
5004        case 384348315: /*periodType*/ return new String[] {"CodeableConcept"};
5005        case -991726143: /*period*/ return new String[] {"Period"};
5006        case -628382168: /*usePeriod*/ return new String[] {"Period"};
5007        case 3556653: /*text*/ return new String[] {"string"};
5008        case -1102667083: /*linkId*/ return new String[] {"string"};
5009        case -1412808770: /*answer*/ return new String[] {"@Contract.term.offer.answer"};
5010        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
5011        case 2046675654: /*valuedItem*/ return new String[] {};
5012        default: return super.getTypesForProperty(hash, name);
5013        }
5014
5015      }
5016
5017      @Override
5018      public Base addChild(String name) throws FHIRException {
5019        if (name.equals("scope")) {
5020          this.scope = new CodeableConcept();
5021          return this.scope;
5022        }
5023        else if (name.equals("type")) {
5024          return addType();
5025        }
5026        else if (name.equals("typeReference")) {
5027          return addTypeReference();
5028        }
5029        else if (name.equals("subtype")) {
5030          return addSubtype();
5031        }
5032        else if (name.equals("relationship")) {
5033          this.relationship = new Coding();
5034          return this.relationship;
5035        }
5036        else if (name.equals("context")) {
5037          return addContext();
5038        }
5039        else if (name.equals("condition")) {
5040          throw new FHIRException("Cannot call addChild on a primitive type Contract.condition");
5041        }
5042        else if (name.equals("periodType")) {
5043          return addPeriodType();
5044        }
5045        else if (name.equals("period")) {
5046          return addPeriod();
5047        }
5048        else if (name.equals("usePeriod")) {
5049          return addUsePeriod();
5050        }
5051        else if (name.equals("text")) {
5052          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
5053        }
5054        else if (name.equals("linkId")) {
5055          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
5056        }
5057        else if (name.equals("answer")) {
5058          return addAnswer();
5059        }
5060        else if (name.equals("securityLabelNumber")) {
5061          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
5062        }
5063        else if (name.equals("valuedItem")) {
5064          return addValuedItem();
5065        }
5066        else
5067          return super.addChild(name);
5068      }
5069
5070      public ContractAssetComponent copy() {
5071        ContractAssetComponent dst = new ContractAssetComponent();
5072        copyValues(dst);
5073        return dst;
5074      }
5075
5076      public void copyValues(ContractAssetComponent dst) {
5077        super.copyValues(dst);
5078        dst.scope = scope == null ? null : scope.copy();
5079        if (type != null) {
5080          dst.type = new ArrayList<CodeableConcept>();
5081          for (CodeableConcept i : type)
5082            dst.type.add(i.copy());
5083        };
5084        if (typeReference != null) {
5085          dst.typeReference = new ArrayList<Reference>();
5086          for (Reference i : typeReference)
5087            dst.typeReference.add(i.copy());
5088        };
5089        if (subtype != null) {
5090          dst.subtype = new ArrayList<CodeableConcept>();
5091          for (CodeableConcept i : subtype)
5092            dst.subtype.add(i.copy());
5093        };
5094        dst.relationship = relationship == null ? null : relationship.copy();
5095        if (context != null) {
5096          dst.context = new ArrayList<AssetContextComponent>();
5097          for (AssetContextComponent i : context)
5098            dst.context.add(i.copy());
5099        };
5100        dst.condition = condition == null ? null : condition.copy();
5101        if (periodType != null) {
5102          dst.periodType = new ArrayList<CodeableConcept>();
5103          for (CodeableConcept i : periodType)
5104            dst.periodType.add(i.copy());
5105        };
5106        if (period != null) {
5107          dst.period = new ArrayList<Period>();
5108          for (Period i : period)
5109            dst.period.add(i.copy());
5110        };
5111        if (usePeriod != null) {
5112          dst.usePeriod = new ArrayList<Period>();
5113          for (Period i : usePeriod)
5114            dst.usePeriod.add(i.copy());
5115        };
5116        dst.text = text == null ? null : text.copy();
5117        if (linkId != null) {
5118          dst.linkId = new ArrayList<StringType>();
5119          for (StringType i : linkId)
5120            dst.linkId.add(i.copy());
5121        };
5122        if (answer != null) {
5123          dst.answer = new ArrayList<AnswerComponent>();
5124          for (AnswerComponent i : answer)
5125            dst.answer.add(i.copy());
5126        };
5127        if (securityLabelNumber != null) {
5128          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
5129          for (UnsignedIntType i : securityLabelNumber)
5130            dst.securityLabelNumber.add(i.copy());
5131        };
5132        if (valuedItem != null) {
5133          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5134          for (ValuedItemComponent i : valuedItem)
5135            dst.valuedItem.add(i.copy());
5136        };
5137      }
5138
5139      @Override
5140      public boolean equalsDeep(Base other_) {
5141        if (!super.equalsDeep(other_))
5142          return false;
5143        if (!(other_ instanceof ContractAssetComponent))
5144          return false;
5145        ContractAssetComponent o = (ContractAssetComponent) other_;
5146        return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true) && compareDeep(typeReference, o.typeReference, true)
5147           && compareDeep(subtype, o.subtype, true) && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
5148           && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true) && compareDeep(period, o.period, true)
5149           && compareDeep(usePeriod, o.usePeriod, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
5150           && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
5151           && compareDeep(valuedItem, o.valuedItem, true);
5152      }
5153
5154      @Override
5155      public boolean equalsShallow(Base other_) {
5156        if (!super.equalsShallow(other_))
5157          return false;
5158        if (!(other_ instanceof ContractAssetComponent))
5159          return false;
5160        ContractAssetComponent o = (ContractAssetComponent) other_;
5161        return compareValues(condition, o.condition, true) && compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
5162           && compareValues(securityLabelNumber, o.securityLabelNumber, true);
5163      }
5164
5165      public boolean isEmpty() {
5166        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference
5167          , subtype, relationship, context, condition, periodType, period, usePeriod, text
5168          , linkId, answer, securityLabelNumber, valuedItem);
5169      }
5170
5171  public String fhirType() {
5172    return "Contract.term.asset";
5173
5174  }
5175
5176  }
5177
5178    @Block()
5179    public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
5180        /**
5181         * Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.
5182         */
5183        @Child(name = "reference", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5184        @Description(shortDefinition="Creator,custodian or owner", formalDefinition="Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction." )
5185        protected Reference reference;
5186
5187        /**
5188         * The actual object that is the target of the reference (Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.)
5189         */
5190        protected Resource referenceTarget;
5191
5192        /**
5193         * Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.
5194         */
5195        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5196        @Description(shortDefinition="Codeable asset context", formalDefinition="Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location." )
5197        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetcontext")
5198        protected List<CodeableConcept> code;
5199
5200        /**
5201         * Context description.
5202         */
5203        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5204        @Description(shortDefinition="Context description", formalDefinition="Context description." )
5205        protected StringType text;
5206
5207        private static final long serialVersionUID = -634115628L;
5208
5209    /**
5210     * Constructor
5211     */
5212      public AssetContextComponent() {
5213        super();
5214      }
5215
5216        /**
5217         * @return {@link #reference} (Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.)
5218         */
5219        public Reference getReference() { 
5220          if (this.reference == null)
5221            if (Configuration.errorOnAutoCreate())
5222              throw new Error("Attempt to auto-create AssetContextComponent.reference");
5223            else if (Configuration.doAutoCreate())
5224              this.reference = new Reference(); // cc
5225          return this.reference;
5226        }
5227
5228        public boolean hasReference() { 
5229          return this.reference != null && !this.reference.isEmpty();
5230        }
5231
5232        /**
5233         * @param value {@link #reference} (Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.)
5234         */
5235        public AssetContextComponent setReference(Reference value) { 
5236          this.reference = value;
5237          return this;
5238        }
5239
5240        /**
5241         * @return {@link #reference} 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. (Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.)
5242         */
5243        public Resource getReferenceTarget() { 
5244          return this.referenceTarget;
5245        }
5246
5247        /**
5248         * @param value {@link #reference} 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. (Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.)
5249         */
5250        public AssetContextComponent setReferenceTarget(Resource value) { 
5251          this.referenceTarget = value;
5252          return this;
5253        }
5254
5255        /**
5256         * @return {@link #code} (Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.)
5257         */
5258        public List<CodeableConcept> getCode() { 
5259          if (this.code == null)
5260            this.code = new ArrayList<CodeableConcept>();
5261          return this.code;
5262        }
5263
5264        /**
5265         * @return Returns a reference to <code>this</code> for easy method chaining
5266         */
5267        public AssetContextComponent setCode(List<CodeableConcept> theCode) { 
5268          this.code = theCode;
5269          return this;
5270        }
5271
5272        public boolean hasCode() { 
5273          if (this.code == null)
5274            return false;
5275          for (CodeableConcept item : this.code)
5276            if (!item.isEmpty())
5277              return true;
5278          return false;
5279        }
5280
5281        public CodeableConcept addCode() { //3
5282          CodeableConcept t = new CodeableConcept();
5283          if (this.code == null)
5284            this.code = new ArrayList<CodeableConcept>();
5285          this.code.add(t);
5286          return t;
5287        }
5288
5289        public AssetContextComponent addCode(CodeableConcept t) { //3
5290          if (t == null)
5291            return this;
5292          if (this.code == null)
5293            this.code = new ArrayList<CodeableConcept>();
5294          this.code.add(t);
5295          return this;
5296        }
5297
5298        /**
5299         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
5300         */
5301        public CodeableConcept getCodeFirstRep() { 
5302          if (getCode().isEmpty()) {
5303            addCode();
5304          }
5305          return getCode().get(0);
5306        }
5307
5308        /**
5309         * @return {@link #text} (Context description.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
5310         */
5311        public StringType getTextElement() { 
5312          if (this.text == null)
5313            if (Configuration.errorOnAutoCreate())
5314              throw new Error("Attempt to auto-create AssetContextComponent.text");
5315            else if (Configuration.doAutoCreate())
5316              this.text = new StringType(); // bb
5317          return this.text;
5318        }
5319
5320        public boolean hasTextElement() { 
5321          return this.text != null && !this.text.isEmpty();
5322        }
5323
5324        public boolean hasText() { 
5325          return this.text != null && !this.text.isEmpty();
5326        }
5327
5328        /**
5329         * @param value {@link #text} (Context description.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
5330         */
5331        public AssetContextComponent setTextElement(StringType value) { 
5332          this.text = value;
5333          return this;
5334        }
5335
5336        /**
5337         * @return Context description.
5338         */
5339        public String getText() { 
5340          return this.text == null ? null : this.text.getValue();
5341        }
5342
5343        /**
5344         * @param value Context description.
5345         */
5346        public AssetContextComponent setText(String value) { 
5347          if (Utilities.noString(value))
5348            this.text = null;
5349          else {
5350            if (this.text == null)
5351              this.text = new StringType();
5352            this.text.setValue(value);
5353          }
5354          return this;
5355        }
5356
5357        protected void listChildren(List<Property> children) {
5358          super.listChildren(children);
5359          children.add(new Property("reference", "Reference(Any)", "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.", 0, 1, reference));
5360          children.add(new Property("code", "CodeableConcept", "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.", 0, java.lang.Integer.MAX_VALUE, code));
5361          children.add(new Property("text", "string", "Context description.", 0, 1, text));
5362        }
5363
5364        @Override
5365        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5366          switch (_hash) {
5367          case -925155509: /*reference*/  return new Property("reference", "Reference(Any)", "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.", 0, 1, reference);
5368          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.", 0, java.lang.Integer.MAX_VALUE, code);
5369          case 3556653: /*text*/  return new Property("text", "string", "Context description.", 0, 1, text);
5370          default: return super.getNamedProperty(_hash, _name, _checkValid);
5371          }
5372
5373        }
5374
5375      @Override
5376      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5377        switch (hash) {
5378        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
5379        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
5380        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
5381        default: return super.getProperty(hash, name, checkValid);
5382        }
5383
5384      }
5385
5386      @Override
5387      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5388        switch (hash) {
5389        case -925155509: // reference
5390          this.reference = castToReference(value); // Reference
5391          return value;
5392        case 3059181: // code
5393          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
5394          return value;
5395        case 3556653: // text
5396          this.text = castToString(value); // StringType
5397          return value;
5398        default: return super.setProperty(hash, name, value);
5399        }
5400
5401      }
5402
5403      @Override
5404      public Base setProperty(String name, Base value) throws FHIRException {
5405        if (name.equals("reference")) {
5406          this.reference = castToReference(value); // Reference
5407        } else if (name.equals("code")) {
5408          this.getCode().add(castToCodeableConcept(value));
5409        } else if (name.equals("text")) {
5410          this.text = castToString(value); // StringType
5411        } else
5412          return super.setProperty(name, value);
5413        return value;
5414      }
5415
5416      @Override
5417      public Base makeProperty(int hash, String name) throws FHIRException {
5418        switch (hash) {
5419        case -925155509:  return getReference(); 
5420        case 3059181:  return addCode(); 
5421        case 3556653:  return getTextElement();
5422        default: return super.makeProperty(hash, name);
5423        }
5424
5425      }
5426
5427      @Override
5428      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5429        switch (hash) {
5430        case -925155509: /*reference*/ return new String[] {"Reference"};
5431        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
5432        case 3556653: /*text*/ return new String[] {"string"};
5433        default: return super.getTypesForProperty(hash, name);
5434        }
5435
5436      }
5437
5438      @Override
5439      public Base addChild(String name) throws FHIRException {
5440        if (name.equals("reference")) {
5441          this.reference = new Reference();
5442          return this.reference;
5443        }
5444        else if (name.equals("code")) {
5445          return addCode();
5446        }
5447        else if (name.equals("text")) {
5448          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
5449        }
5450        else
5451          return super.addChild(name);
5452      }
5453
5454      public AssetContextComponent copy() {
5455        AssetContextComponent dst = new AssetContextComponent();
5456        copyValues(dst);
5457        return dst;
5458      }
5459
5460      public void copyValues(AssetContextComponent dst) {
5461        super.copyValues(dst);
5462        dst.reference = reference == null ? null : reference.copy();
5463        if (code != null) {
5464          dst.code = new ArrayList<CodeableConcept>();
5465          for (CodeableConcept i : code)
5466            dst.code.add(i.copy());
5467        };
5468        dst.text = text == null ? null : text.copy();
5469      }
5470
5471      @Override
5472      public boolean equalsDeep(Base other_) {
5473        if (!super.equalsDeep(other_))
5474          return false;
5475        if (!(other_ instanceof AssetContextComponent))
5476          return false;
5477        AssetContextComponent o = (AssetContextComponent) other_;
5478        return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
5479          ;
5480      }
5481
5482      @Override
5483      public boolean equalsShallow(Base other_) {
5484        if (!super.equalsShallow(other_))
5485          return false;
5486        if (!(other_ instanceof AssetContextComponent))
5487          return false;
5488        AssetContextComponent o = (AssetContextComponent) other_;
5489        return compareValues(text, o.text, true);
5490      }
5491
5492      public boolean isEmpty() {
5493        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
5494      }
5495
5496  public String fhirType() {
5497    return "Contract.term.asset.context";
5498
5499  }
5500
5501  }
5502
5503    @Block()
5504    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
5505        /**
5506         * Specific type of Contract Valued Item that may be priced.
5507         */
5508        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5509        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
5510        protected Type entity;
5511
5512        /**
5513         * Identifies a Contract Valued Item instance.
5514         */
5515        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
5516        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
5517        protected Identifier identifier;
5518
5519        /**
5520         * Indicates the time during which this Contract ValuedItem information is effective.
5521         */
5522        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5523        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
5524        protected DateTimeType effectiveTime;
5525
5526        /**
5527         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
5528         */
5529        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
5530        @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." )
5531        protected Quantity quantity;
5532
5533        /**
5534         * A Contract Valued Item unit valuation measure.
5535         */
5536        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
5537        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
5538        protected Money unitPrice;
5539
5540        /**
5541         * 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.
5542         */
5543        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5544        @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." )
5545        protected DecimalType factor;
5546
5547        /**
5548         * 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.
5549         */
5550        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5551        @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." )
5552        protected DecimalType points;
5553
5554        /**
5555         * 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.
5556         */
5557        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5558        @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." )
5559        protected Money net;
5560
5561        /**
5562         * Terms of valuation.
5563         */
5564        @Child(name = "payment", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5565        @Description(shortDefinition="Terms of valuation", formalDefinition="Terms of valuation." )
5566        protected StringType payment;
5567
5568        /**
5569         * When payment is due.
5570         */
5571        @Child(name = "paymentDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5572        @Description(shortDefinition="When payment is due", formalDefinition="When payment is due." )
5573        protected DateTimeType paymentDate;
5574
5575        /**
5576         * Who will make payment.
5577         */
5578        @Child(name = "responsible", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=false)
5579        @Description(shortDefinition="Who will make payment", formalDefinition="Who will make payment." )
5580        protected Reference responsible;
5581
5582        /**
5583         * The actual object that is the target of the reference (Who will make payment.)
5584         */
5585        protected Resource responsibleTarget;
5586
5587        /**
5588         * Who will receive payment.
5589         */
5590        @Child(name = "recipient", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=12, min=0, max=1, modifier=false, summary=false)
5591        @Description(shortDefinition="Who will receive payment", formalDefinition="Who will receive payment." )
5592        protected Reference recipient;
5593
5594        /**
5595         * The actual object that is the target of the reference (Who will receive payment.)
5596         */
5597        protected Resource recipientTarget;
5598
5599        /**
5600         * Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.
5601         */
5602        @Child(name = "linkId", type = {StringType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5603        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse." )
5604        protected List<StringType> linkId;
5605
5606        /**
5607         * A set of security labels that define which terms are controlled by this condition.
5608         */
5609        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5610        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
5611        protected List<UnsignedIntType> securityLabelNumber;
5612
5613        private static final long serialVersionUID = 1894951601L;
5614
5615    /**
5616     * Constructor
5617     */
5618      public ValuedItemComponent() {
5619        super();
5620      }
5621
5622        /**
5623         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5624         */
5625        public Type getEntity() { 
5626          return this.entity;
5627        }
5628
5629        /**
5630         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5631         */
5632        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
5633          if (this.entity == null)
5634            this.entity = new CodeableConcept();
5635          if (!(this.entity instanceof CodeableConcept))
5636            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
5637          return (CodeableConcept) this.entity;
5638        }
5639
5640        public boolean hasEntityCodeableConcept() { 
5641          return this != null && this.entity instanceof CodeableConcept;
5642        }
5643
5644        /**
5645         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5646         */
5647        public Reference getEntityReference() throws FHIRException { 
5648          if (this.entity == null)
5649            this.entity = new Reference();
5650          if (!(this.entity instanceof Reference))
5651            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
5652          return (Reference) this.entity;
5653        }
5654
5655        public boolean hasEntityReference() { 
5656          return this != null && this.entity instanceof Reference;
5657        }
5658
5659        public boolean hasEntity() { 
5660          return this.entity != null && !this.entity.isEmpty();
5661        }
5662
5663        /**
5664         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5665         */
5666        public ValuedItemComponent setEntity(Type value) { 
5667          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
5668            throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: "+value.fhirType());
5669          this.entity = value;
5670          return this;
5671        }
5672
5673        /**
5674         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
5675         */
5676        public Identifier getIdentifier() { 
5677          if (this.identifier == null)
5678            if (Configuration.errorOnAutoCreate())
5679              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
5680            else if (Configuration.doAutoCreate())
5681              this.identifier = new Identifier(); // cc
5682          return this.identifier;
5683        }
5684
5685        public boolean hasIdentifier() { 
5686          return this.identifier != null && !this.identifier.isEmpty();
5687        }
5688
5689        /**
5690         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
5691         */
5692        public ValuedItemComponent setIdentifier(Identifier value) { 
5693          this.identifier = value;
5694          return this;
5695        }
5696
5697        /**
5698         * @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
5699         */
5700        public DateTimeType getEffectiveTimeElement() { 
5701          if (this.effectiveTime == null)
5702            if (Configuration.errorOnAutoCreate())
5703              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
5704            else if (Configuration.doAutoCreate())
5705              this.effectiveTime = new DateTimeType(); // bb
5706          return this.effectiveTime;
5707        }
5708
5709        public boolean hasEffectiveTimeElement() { 
5710          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5711        }
5712
5713        public boolean hasEffectiveTime() { 
5714          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5715        }
5716
5717        /**
5718         * @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
5719         */
5720        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
5721          this.effectiveTime = value;
5722          return this;
5723        }
5724
5725        /**
5726         * @return Indicates the time during which this Contract ValuedItem information is effective.
5727         */
5728        public Date getEffectiveTime() { 
5729          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
5730        }
5731
5732        /**
5733         * @param value Indicates the time during which this Contract ValuedItem information is effective.
5734         */
5735        public ValuedItemComponent setEffectiveTime(Date value) { 
5736          if (value == null)
5737            this.effectiveTime = null;
5738          else {
5739            if (this.effectiveTime == null)
5740              this.effectiveTime = new DateTimeType();
5741            this.effectiveTime.setValue(value);
5742          }
5743          return this;
5744        }
5745
5746        /**
5747         * @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.)
5748         */
5749        public Quantity getQuantity() { 
5750          if (this.quantity == null)
5751            if (Configuration.errorOnAutoCreate())
5752              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
5753            else if (Configuration.doAutoCreate())
5754              this.quantity = new Quantity(); // cc
5755          return this.quantity;
5756        }
5757
5758        public boolean hasQuantity() { 
5759          return this.quantity != null && !this.quantity.isEmpty();
5760        }
5761
5762        /**
5763         * @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.)
5764         */
5765        public ValuedItemComponent setQuantity(Quantity value) { 
5766          this.quantity = value;
5767          return this;
5768        }
5769
5770        /**
5771         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5772         */
5773        public Money getUnitPrice() { 
5774          if (this.unitPrice == null)
5775            if (Configuration.errorOnAutoCreate())
5776              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
5777            else if (Configuration.doAutoCreate())
5778              this.unitPrice = new Money(); // cc
5779          return this.unitPrice;
5780        }
5781
5782        public boolean hasUnitPrice() { 
5783          return this.unitPrice != null && !this.unitPrice.isEmpty();
5784        }
5785
5786        /**
5787         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5788         */
5789        public ValuedItemComponent setUnitPrice(Money value) { 
5790          this.unitPrice = value;
5791          return this;
5792        }
5793
5794        /**
5795         * @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
5796         */
5797        public DecimalType getFactorElement() { 
5798          if (this.factor == null)
5799            if (Configuration.errorOnAutoCreate())
5800              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
5801            else if (Configuration.doAutoCreate())
5802              this.factor = new DecimalType(); // bb
5803          return this.factor;
5804        }
5805
5806        public boolean hasFactorElement() { 
5807          return this.factor != null && !this.factor.isEmpty();
5808        }
5809
5810        public boolean hasFactor() { 
5811          return this.factor != null && !this.factor.isEmpty();
5812        }
5813
5814        /**
5815         * @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
5816         */
5817        public ValuedItemComponent setFactorElement(DecimalType value) { 
5818          this.factor = value;
5819          return this;
5820        }
5821
5822        /**
5823         * @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.
5824         */
5825        public BigDecimal getFactor() { 
5826          return this.factor == null ? null : this.factor.getValue();
5827        }
5828
5829        /**
5830         * @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.
5831         */
5832        public ValuedItemComponent setFactor(BigDecimal value) { 
5833          if (value == null)
5834            this.factor = null;
5835          else {
5836            if (this.factor == null)
5837              this.factor = new DecimalType();
5838            this.factor.setValue(value);
5839          }
5840          return this;
5841        }
5842
5843        /**
5844         * @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.
5845         */
5846        public ValuedItemComponent setFactor(long value) { 
5847              this.factor = new DecimalType();
5848            this.factor.setValue(value);
5849          return this;
5850        }
5851
5852        /**
5853         * @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.
5854         */
5855        public ValuedItemComponent setFactor(double value) { 
5856              this.factor = new DecimalType();
5857            this.factor.setValue(value);
5858          return this;
5859        }
5860
5861        /**
5862         * @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
5863         */
5864        public DecimalType getPointsElement() { 
5865          if (this.points == null)
5866            if (Configuration.errorOnAutoCreate())
5867              throw new Error("Attempt to auto-create ValuedItemComponent.points");
5868            else if (Configuration.doAutoCreate())
5869              this.points = new DecimalType(); // bb
5870          return this.points;
5871        }
5872
5873        public boolean hasPointsElement() { 
5874          return this.points != null && !this.points.isEmpty();
5875        }
5876
5877        public boolean hasPoints() { 
5878          return this.points != null && !this.points.isEmpty();
5879        }
5880
5881        /**
5882         * @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
5883         */
5884        public ValuedItemComponent setPointsElement(DecimalType value) { 
5885          this.points = value;
5886          return this;
5887        }
5888
5889        /**
5890         * @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.
5891         */
5892        public BigDecimal getPoints() { 
5893          return this.points == null ? null : this.points.getValue();
5894        }
5895
5896        /**
5897         * @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.
5898         */
5899        public ValuedItemComponent setPoints(BigDecimal value) { 
5900          if (value == null)
5901            this.points = null;
5902          else {
5903            if (this.points == null)
5904              this.points = new DecimalType();
5905            this.points.setValue(value);
5906          }
5907          return this;
5908        }
5909
5910        /**
5911         * @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.
5912         */
5913        public ValuedItemComponent setPoints(long value) { 
5914              this.points = new DecimalType();
5915            this.points.setValue(value);
5916          return this;
5917        }
5918
5919        /**
5920         * @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.
5921         */
5922        public ValuedItemComponent setPoints(double value) { 
5923              this.points = new DecimalType();
5924            this.points.setValue(value);
5925          return this;
5926        }
5927
5928        /**
5929         * @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.)
5930         */
5931        public Money getNet() { 
5932          if (this.net == null)
5933            if (Configuration.errorOnAutoCreate())
5934              throw new Error("Attempt to auto-create ValuedItemComponent.net");
5935            else if (Configuration.doAutoCreate())
5936              this.net = new Money(); // cc
5937          return this.net;
5938        }
5939
5940        public boolean hasNet() { 
5941          return this.net != null && !this.net.isEmpty();
5942        }
5943
5944        /**
5945         * @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.)
5946         */
5947        public ValuedItemComponent setNet(Money value) { 
5948          this.net = value;
5949          return this;
5950        }
5951
5952        /**
5953         * @return {@link #payment} (Terms of valuation.). This is the underlying object with id, value and extensions. The accessor "getPayment" gives direct access to the value
5954         */
5955        public StringType getPaymentElement() { 
5956          if (this.payment == null)
5957            if (Configuration.errorOnAutoCreate())
5958              throw new Error("Attempt to auto-create ValuedItemComponent.payment");
5959            else if (Configuration.doAutoCreate())
5960              this.payment = new StringType(); // bb
5961          return this.payment;
5962        }
5963
5964        public boolean hasPaymentElement() { 
5965          return this.payment != null && !this.payment.isEmpty();
5966        }
5967
5968        public boolean hasPayment() { 
5969          return this.payment != null && !this.payment.isEmpty();
5970        }
5971
5972        /**
5973         * @param value {@link #payment} (Terms of valuation.). This is the underlying object with id, value and extensions. The accessor "getPayment" gives direct access to the value
5974         */
5975        public ValuedItemComponent setPaymentElement(StringType value) { 
5976          this.payment = value;
5977          return this;
5978        }
5979
5980        /**
5981         * @return Terms of valuation.
5982         */
5983        public String getPayment() { 
5984          return this.payment == null ? null : this.payment.getValue();
5985        }
5986
5987        /**
5988         * @param value Terms of valuation.
5989         */
5990        public ValuedItemComponent setPayment(String value) { 
5991          if (Utilities.noString(value))
5992            this.payment = null;
5993          else {
5994            if (this.payment == null)
5995              this.payment = new StringType();
5996            this.payment.setValue(value);
5997          }
5998          return this;
5999        }
6000
6001        /**
6002         * @return {@link #paymentDate} (When payment is due.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
6003         */
6004        public DateTimeType getPaymentDateElement() { 
6005          if (this.paymentDate == null)
6006            if (Configuration.errorOnAutoCreate())
6007              throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
6008            else if (Configuration.doAutoCreate())
6009              this.paymentDate = new DateTimeType(); // bb
6010          return this.paymentDate;
6011        }
6012
6013        public boolean hasPaymentDateElement() { 
6014          return this.paymentDate != null && !this.paymentDate.isEmpty();
6015        }
6016
6017        public boolean hasPaymentDate() { 
6018          return this.paymentDate != null && !this.paymentDate.isEmpty();
6019        }
6020
6021        /**
6022         * @param value {@link #paymentDate} (When payment is due.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
6023         */
6024        public ValuedItemComponent setPaymentDateElement(DateTimeType value) { 
6025          this.paymentDate = value;
6026          return this;
6027        }
6028
6029        /**
6030         * @return When payment is due.
6031         */
6032        public Date getPaymentDate() { 
6033          return this.paymentDate == null ? null : this.paymentDate.getValue();
6034        }
6035
6036        /**
6037         * @param value When payment is due.
6038         */
6039        public ValuedItemComponent setPaymentDate(Date value) { 
6040          if (value == null)
6041            this.paymentDate = null;
6042          else {
6043            if (this.paymentDate == null)
6044              this.paymentDate = new DateTimeType();
6045            this.paymentDate.setValue(value);
6046          }
6047          return this;
6048        }
6049
6050        /**
6051         * @return {@link #responsible} (Who will make payment.)
6052         */
6053        public Reference getResponsible() { 
6054          if (this.responsible == null)
6055            if (Configuration.errorOnAutoCreate())
6056              throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
6057            else if (Configuration.doAutoCreate())
6058              this.responsible = new Reference(); // cc
6059          return this.responsible;
6060        }
6061
6062        public boolean hasResponsible() { 
6063          return this.responsible != null && !this.responsible.isEmpty();
6064        }
6065
6066        /**
6067         * @param value {@link #responsible} (Who will make payment.)
6068         */
6069        public ValuedItemComponent setResponsible(Reference value) { 
6070          this.responsible = value;
6071          return this;
6072        }
6073
6074        /**
6075         * @return {@link #responsible} 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 will make payment.)
6076         */
6077        public Resource getResponsibleTarget() { 
6078          return this.responsibleTarget;
6079        }
6080
6081        /**
6082         * @param value {@link #responsible} 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 will make payment.)
6083         */
6084        public ValuedItemComponent setResponsibleTarget(Resource value) { 
6085          this.responsibleTarget = value;
6086          return this;
6087        }
6088
6089        /**
6090         * @return {@link #recipient} (Who will receive payment.)
6091         */
6092        public Reference getRecipient() { 
6093          if (this.recipient == null)
6094            if (Configuration.errorOnAutoCreate())
6095              throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
6096            else if (Configuration.doAutoCreate())
6097              this.recipient = new Reference(); // cc
6098          return this.recipient;
6099        }
6100
6101        public boolean hasRecipient() { 
6102          return this.recipient != null && !this.recipient.isEmpty();
6103        }
6104
6105        /**
6106         * @param value {@link #recipient} (Who will receive payment.)
6107         */
6108        public ValuedItemComponent setRecipient(Reference value) { 
6109          this.recipient = value;
6110          return this;
6111        }
6112
6113        /**
6114         * @return {@link #recipient} 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 will receive payment.)
6115         */
6116        public Resource getRecipientTarget() { 
6117          return this.recipientTarget;
6118        }
6119
6120        /**
6121         * @param value {@link #recipient} 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 will receive payment.)
6122         */
6123        public ValuedItemComponent setRecipientTarget(Resource value) { 
6124          this.recipientTarget = value;
6125          return this;
6126        }
6127
6128        /**
6129         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6130         */
6131        public List<StringType> getLinkId() { 
6132          if (this.linkId == null)
6133            this.linkId = new ArrayList<StringType>();
6134          return this.linkId;
6135        }
6136
6137        /**
6138         * @return Returns a reference to <code>this</code> for easy method chaining
6139         */
6140        public ValuedItemComponent setLinkId(List<StringType> theLinkId) { 
6141          this.linkId = theLinkId;
6142          return this;
6143        }
6144
6145        public boolean hasLinkId() { 
6146          if (this.linkId == null)
6147            return false;
6148          for (StringType item : this.linkId)
6149            if (!item.isEmpty())
6150              return true;
6151          return false;
6152        }
6153
6154        /**
6155         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6156         */
6157        public StringType addLinkIdElement() {//2 
6158          StringType t = new StringType();
6159          if (this.linkId == null)
6160            this.linkId = new ArrayList<StringType>();
6161          this.linkId.add(t);
6162          return t;
6163        }
6164
6165        /**
6166         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6167         */
6168        public ValuedItemComponent addLinkId(String value) { //1
6169          StringType t = new StringType();
6170          t.setValue(value);
6171          if (this.linkId == null)
6172            this.linkId = new ArrayList<StringType>();
6173          this.linkId.add(t);
6174          return this;
6175        }
6176
6177        /**
6178         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6179         */
6180        public boolean hasLinkId(String value) { 
6181          if (this.linkId == null)
6182            return false;
6183          for (StringType v : this.linkId)
6184            if (v.getValue().equals(value)) // string
6185              return true;
6186          return false;
6187        }
6188
6189        /**
6190         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6191         */
6192        public List<UnsignedIntType> getSecurityLabelNumber() { 
6193          if (this.securityLabelNumber == null)
6194            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6195          return this.securityLabelNumber;
6196        }
6197
6198        /**
6199         * @return Returns a reference to <code>this</code> for easy method chaining
6200         */
6201        public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
6202          this.securityLabelNumber = theSecurityLabelNumber;
6203          return this;
6204        }
6205
6206        public boolean hasSecurityLabelNumber() { 
6207          if (this.securityLabelNumber == null)
6208            return false;
6209          for (UnsignedIntType item : this.securityLabelNumber)
6210            if (!item.isEmpty())
6211              return true;
6212          return false;
6213        }
6214
6215        /**
6216         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6217         */
6218        public UnsignedIntType addSecurityLabelNumberElement() {//2 
6219          UnsignedIntType t = new UnsignedIntType();
6220          if (this.securityLabelNumber == null)
6221            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6222          this.securityLabelNumber.add(t);
6223          return t;
6224        }
6225
6226        /**
6227         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6228         */
6229        public ValuedItemComponent addSecurityLabelNumber(int value) { //1
6230          UnsignedIntType t = new UnsignedIntType();
6231          t.setValue(value);
6232          if (this.securityLabelNumber == null)
6233            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6234          this.securityLabelNumber.add(t);
6235          return this;
6236        }
6237
6238        /**
6239         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6240         */
6241        public boolean hasSecurityLabelNumber(int value) { 
6242          if (this.securityLabelNumber == null)
6243            return false;
6244          for (UnsignedIntType v : this.securityLabelNumber)
6245            if (v.getValue().equals(value)) // unsignedInt
6246              return true;
6247          return false;
6248        }
6249
6250        protected void listChildren(List<Property> children) {
6251          super.listChildren(children);
6252          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
6253          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
6254          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
6255          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));
6256          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
6257          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));
6258          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));
6259          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));
6260          children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
6261          children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
6262          children.add(new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible));
6263          children.add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient));
6264          children.add(new Property("linkId", "string", "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId));
6265          children.add(new Property("securityLabelNumber", "unsignedInt", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
6266        }
6267
6268        @Override
6269        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6270          switch (_hash) {
6271          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);
6272          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6273          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6274          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6275          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
6276          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
6277          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);
6278          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
6279          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);
6280          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);
6281          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);
6282          case -786681338: /*payment*/  return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
6283          case -1540873516: /*paymentDate*/  return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
6284          case 1847674614: /*responsible*/  return new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible);
6285          case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient);
6286          case -1102667083: /*linkId*/  return new Property("linkId", "string", "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId);
6287          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "A set of security labels that define which terms are controlled by this condition.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
6288          default: return super.getNamedProperty(_hash, _name, _checkValid);
6289          }
6290
6291        }
6292
6293      @Override
6294      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6295        switch (hash) {
6296        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
6297        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
6298        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
6299        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6300        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6301        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6302        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
6303        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6304        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // StringType
6305        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateTimeType
6306        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // Reference
6307        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
6308        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
6309        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
6310        default: return super.getProperty(hash, name, checkValid);
6311        }
6312
6313      }
6314
6315      @Override
6316      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6317        switch (hash) {
6318        case -1298275357: // entity
6319          this.entity = castToType(value); // Type
6320          return value;
6321        case -1618432855: // identifier
6322          this.identifier = castToIdentifier(value); // Identifier
6323          return value;
6324        case -929905388: // effectiveTime
6325          this.effectiveTime = castToDateTime(value); // DateTimeType
6326          return value;
6327        case -1285004149: // quantity
6328          this.quantity = castToQuantity(value); // Quantity
6329          return value;
6330        case -486196699: // unitPrice
6331          this.unitPrice = castToMoney(value); // Money
6332          return value;
6333        case -1282148017: // factor
6334          this.factor = castToDecimal(value); // DecimalType
6335          return value;
6336        case -982754077: // points
6337          this.points = castToDecimal(value); // DecimalType
6338          return value;
6339        case 108957: // net
6340          this.net = castToMoney(value); // Money
6341          return value;
6342        case -786681338: // payment
6343          this.payment = castToString(value); // StringType
6344          return value;
6345        case -1540873516: // paymentDate
6346          this.paymentDate = castToDateTime(value); // DateTimeType
6347          return value;
6348        case 1847674614: // responsible
6349          this.responsible = castToReference(value); // Reference
6350          return value;
6351        case 820081177: // recipient
6352          this.recipient = castToReference(value); // Reference
6353          return value;
6354        case -1102667083: // linkId
6355          this.getLinkId().add(castToString(value)); // StringType
6356          return value;
6357        case -149460995: // securityLabelNumber
6358          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
6359          return value;
6360        default: return super.setProperty(hash, name, value);
6361        }
6362
6363      }
6364
6365      @Override
6366      public Base setProperty(String name, Base value) throws FHIRException {
6367        if (name.equals("entity[x]")) {
6368          this.entity = castToType(value); // Type
6369        } else if (name.equals("identifier")) {
6370          this.identifier = castToIdentifier(value); // Identifier
6371        } else if (name.equals("effectiveTime")) {
6372          this.effectiveTime = castToDateTime(value); // DateTimeType
6373        } else if (name.equals("quantity")) {
6374          this.quantity = castToQuantity(value); // Quantity
6375        } else if (name.equals("unitPrice")) {
6376          this.unitPrice = castToMoney(value); // Money
6377        } else if (name.equals("factor")) {
6378          this.factor = castToDecimal(value); // DecimalType
6379        } else if (name.equals("points")) {
6380          this.points = castToDecimal(value); // DecimalType
6381        } else if (name.equals("net")) {
6382          this.net = castToMoney(value); // Money
6383        } else if (name.equals("payment")) {
6384          this.payment = castToString(value); // StringType
6385        } else if (name.equals("paymentDate")) {
6386          this.paymentDate = castToDateTime(value); // DateTimeType
6387        } else if (name.equals("responsible")) {
6388          this.responsible = castToReference(value); // Reference
6389        } else if (name.equals("recipient")) {
6390          this.recipient = castToReference(value); // Reference
6391        } else if (name.equals("linkId")) {
6392          this.getLinkId().add(castToString(value));
6393        } else if (name.equals("securityLabelNumber")) {
6394          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
6395        } else
6396          return super.setProperty(name, value);
6397        return value;
6398      }
6399
6400      @Override
6401      public Base makeProperty(int hash, String name) throws FHIRException {
6402        switch (hash) {
6403        case -740568643:  return getEntity(); 
6404        case -1298275357:  return getEntity(); 
6405        case -1618432855:  return getIdentifier(); 
6406        case -929905388:  return getEffectiveTimeElement();
6407        case -1285004149:  return getQuantity(); 
6408        case -486196699:  return getUnitPrice(); 
6409        case -1282148017:  return getFactorElement();
6410        case -982754077:  return getPointsElement();
6411        case 108957:  return getNet(); 
6412        case -786681338:  return getPaymentElement();
6413        case -1540873516:  return getPaymentDateElement();
6414        case 1847674614:  return getResponsible(); 
6415        case 820081177:  return getRecipient(); 
6416        case -1102667083:  return addLinkIdElement();
6417        case -149460995:  return addSecurityLabelNumberElement();
6418        default: return super.makeProperty(hash, name);
6419        }
6420
6421      }
6422
6423      @Override
6424      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6425        switch (hash) {
6426        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
6427        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6428        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
6429        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6430        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6431        case -1282148017: /*factor*/ return new String[] {"decimal"};
6432        case -982754077: /*points*/ return new String[] {"decimal"};
6433        case 108957: /*net*/ return new String[] {"Money"};
6434        case -786681338: /*payment*/ return new String[] {"string"};
6435        case -1540873516: /*paymentDate*/ return new String[] {"dateTime"};
6436        case 1847674614: /*responsible*/ return new String[] {"Reference"};
6437        case 820081177: /*recipient*/ return new String[] {"Reference"};
6438        case -1102667083: /*linkId*/ return new String[] {"string"};
6439        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
6440        default: return super.getTypesForProperty(hash, name);
6441        }
6442
6443      }
6444
6445      @Override
6446      public Base addChild(String name) throws FHIRException {
6447        if (name.equals("entityCodeableConcept")) {
6448          this.entity = new CodeableConcept();
6449          return this.entity;
6450        }
6451        else if (name.equals("entityReference")) {
6452          this.entity = new Reference();
6453          return this.entity;
6454        }
6455        else if (name.equals("identifier")) {
6456          this.identifier = new Identifier();
6457          return this.identifier;
6458        }
6459        else if (name.equals("effectiveTime")) {
6460          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
6461        }
6462        else if (name.equals("quantity")) {
6463          this.quantity = new Quantity();
6464          return this.quantity;
6465        }
6466        else if (name.equals("unitPrice")) {
6467          this.unitPrice = new Money();
6468          return this.unitPrice;
6469        }
6470        else if (name.equals("factor")) {
6471          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
6472        }
6473        else if (name.equals("points")) {
6474          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
6475        }
6476        else if (name.equals("net")) {
6477          this.net = new Money();
6478          return this.net;
6479        }
6480        else if (name.equals("payment")) {
6481          throw new FHIRException("Cannot call addChild on a primitive type Contract.payment");
6482        }
6483        else if (name.equals("paymentDate")) {
6484          throw new FHIRException("Cannot call addChild on a primitive type Contract.paymentDate");
6485        }
6486        else if (name.equals("responsible")) {
6487          this.responsible = new Reference();
6488          return this.responsible;
6489        }
6490        else if (name.equals("recipient")) {
6491          this.recipient = new Reference();
6492          return this.recipient;
6493        }
6494        else if (name.equals("linkId")) {
6495          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
6496        }
6497        else if (name.equals("securityLabelNumber")) {
6498          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
6499        }
6500        else
6501          return super.addChild(name);
6502      }
6503
6504      public ValuedItemComponent copy() {
6505        ValuedItemComponent dst = new ValuedItemComponent();
6506        copyValues(dst);
6507        return dst;
6508      }
6509
6510      public void copyValues(ValuedItemComponent dst) {
6511        super.copyValues(dst);
6512        dst.entity = entity == null ? null : entity.copy();
6513        dst.identifier = identifier == null ? null : identifier.copy();
6514        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
6515        dst.quantity = quantity == null ? null : quantity.copy();
6516        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6517        dst.factor = factor == null ? null : factor.copy();
6518        dst.points = points == null ? null : points.copy();
6519        dst.net = net == null ? null : net.copy();
6520        dst.payment = payment == null ? null : payment.copy();
6521        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
6522        dst.responsible = responsible == null ? null : responsible.copy();
6523        dst.recipient = recipient == null ? null : recipient.copy();
6524        if (linkId != null) {
6525          dst.linkId = new ArrayList<StringType>();
6526          for (StringType i : linkId)
6527            dst.linkId.add(i.copy());
6528        };
6529        if (securityLabelNumber != null) {
6530          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6531          for (UnsignedIntType i : securityLabelNumber)
6532            dst.securityLabelNumber.add(i.copy());
6533        };
6534      }
6535
6536      @Override
6537      public boolean equalsDeep(Base other_) {
6538        if (!super.equalsDeep(other_))
6539          return false;
6540        if (!(other_ instanceof ValuedItemComponent))
6541          return false;
6542        ValuedItemComponent o = (ValuedItemComponent) other_;
6543        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
6544           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6545           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(payment, o.payment, true)
6546           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(responsible, o.responsible, true)
6547           && compareDeep(recipient, o.recipient, true) && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6548          ;
6549      }
6550
6551      @Override
6552      public boolean equalsShallow(Base other_) {
6553        if (!super.equalsShallow(other_))
6554          return false;
6555        if (!(other_ instanceof ValuedItemComponent))
6556          return false;
6557        ValuedItemComponent o = (ValuedItemComponent) other_;
6558        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
6559           && compareValues(points, o.points, true) && compareValues(payment, o.payment, true) && compareValues(paymentDate, o.paymentDate, true)
6560           && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
6561          ;
6562      }
6563
6564      public boolean isEmpty() {
6565        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
6566          , quantity, unitPrice, factor, points, net, payment, paymentDate, responsible
6567          , recipient, linkId, securityLabelNumber);
6568      }
6569
6570  public String fhirType() {
6571    return "Contract.term.asset.valuedItem";
6572
6573  }
6574
6575  }
6576
6577    @Block()
6578    public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
6579        /**
6580         * True if the term prohibits the  action.
6581         */
6582        @Child(name = "doNotPerform", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=false)
6583        @Description(shortDefinition="True if the term prohibits the  action", formalDefinition="True if the term prohibits the  action." )
6584        protected BooleanType doNotPerform;
6585
6586        /**
6587         * Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.
6588         */
6589        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6590        @Description(shortDefinition="Type or form of the action", formalDefinition="Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term." )
6591        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
6592        protected CodeableConcept type;
6593
6594        /**
6595         * Entity of the action.
6596         */
6597        @Child(name = "subject", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6598        @Description(shortDefinition="Entity of the action", formalDefinition="Entity of the action." )
6599        protected List<ActionSubjectComponent> subject;
6600
6601        /**
6602         * Reason or purpose for the action stipulated by this Contract Provision.
6603         */
6604        @Child(name = "intent", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6605        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
6606        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6607        protected CodeableConcept intent;
6608
6609        /**
6610         * Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.
6611         */
6612        @Child(name = "linkId", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6613        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse." )
6614        protected List<StringType> linkId;
6615
6616        /**
6617         * Current state of the term action.
6618         */
6619        @Child(name = "status", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=false, summary=false)
6620        @Description(shortDefinition="State of the action", formalDefinition="Current state of the term action." )
6621        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actionstatus")
6622        protected CodeableConcept status;
6623
6624        /**
6625         * Encounter or Episode with primary association to specified term activity.
6626         */
6627        @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=false)
6628        @Description(shortDefinition="Episode associated with action", formalDefinition="Encounter or Episode with primary association to specified term activity." )
6629        protected Reference context;
6630
6631        /**
6632         * The actual object that is the target of the reference (Encounter or Episode with primary association to specified term activity.)
6633         */
6634        protected Resource contextTarget;
6635
6636        /**
6637         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6638         */
6639        @Child(name = "contextLinkId", type = {StringType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6640        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse." )
6641        protected List<StringType> contextLinkId;
6642
6643        /**
6644         * When action happens.
6645         */
6646        @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=9, min=0, max=1, modifier=false, summary=false)
6647        @Description(shortDefinition="When action happens", formalDefinition="When action happens." )
6648        protected Type occurrence;
6649
6650        /**
6651         * Who or what initiated the action and has responsibility for its activation.
6652         */
6653        @Child(name = "requester", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class, Device.class, Group.class, Organization.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6654        @Description(shortDefinition="Who asked for action", formalDefinition="Who or what initiated the action and has responsibility for its activation." )
6655        protected List<Reference> requester;
6656        /**
6657         * The actual objects that are the target of the reference (Who or what initiated the action and has responsibility for its activation.)
6658         */
6659        protected List<Resource> requesterTarget;
6660
6661
6662        /**
6663         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6664         */
6665        @Child(name = "requesterLinkId", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6666        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse." )
6667        protected List<StringType> requesterLinkId;
6668
6669        /**
6670         * The type of individual that is desired or required to perform or not perform the action.
6671         */
6672        @Child(name = "performerType", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6673        @Description(shortDefinition="Kind of service performer", formalDefinition="The type of individual that is desired or required to perform or not perform the action." )
6674        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-type")
6675        protected List<CodeableConcept> performerType;
6676
6677        /**
6678         * The type of role or competency of an individual desired or required to perform or not perform the action.
6679         */
6680        @Child(name = "performerRole", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
6681        @Description(shortDefinition="Competency of the performer", formalDefinition="The type of role or competency of an individual desired or required to perform or not perform the action." )
6682        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-role")
6683        protected CodeableConcept performerRole;
6684
6685        /**
6686         * Indicates who or what is being asked to perform (or not perform) the ction.
6687         */
6688        @Child(name = "performer", type = {RelatedPerson.class, Patient.class, Practitioner.class, PractitionerRole.class, CareTeam.class, Device.class, Substance.class, Organization.class, Location.class}, order=14, min=0, max=1, modifier=false, summary=false)
6689        @Description(shortDefinition="Actor that wil execute (or not) the action", formalDefinition="Indicates who or what is being asked to perform (or not perform) the ction." )
6690        protected Reference performer;
6691
6692        /**
6693         * The actual object that is the target of the reference (Indicates who or what is being asked to perform (or not perform) the ction.)
6694         */
6695        protected Resource performerTarget;
6696
6697        /**
6698         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6699         */
6700        @Child(name = "performerLinkId", type = {StringType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6701        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse." )
6702        protected List<StringType> performerLinkId;
6703
6704        /**
6705         * Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.
6706         */
6707        @Child(name = "reasonCode", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6708        @Description(shortDefinition="Why is action (not) needed?", formalDefinition="Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited." )
6709        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6710        protected List<CodeableConcept> reasonCode;
6711
6712        /**
6713         * Indicates another resource whose existence justifies permitting or not permitting this action.
6714         */
6715        @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class, Questionnaire.class, QuestionnaireResponse.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6716        @Description(shortDefinition="Why is action (not) needed?", formalDefinition="Indicates another resource whose existence justifies permitting or not permitting this action." )
6717        protected List<Reference> reasonReference;
6718        /**
6719         * The actual objects that are the target of the reference (Indicates another resource whose existence justifies permitting or not permitting this action.)
6720         */
6721        protected List<Resource> reasonReferenceTarget;
6722
6723
6724        /**
6725         * Describes why the action is to be performed or not performed in textual form.
6726         */
6727        @Child(name = "reason", type = {StringType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6728        @Description(shortDefinition="Why action is to be performed", formalDefinition="Describes why the action is to be performed or not performed in textual form." )
6729        protected List<StringType> reason;
6730
6731        /**
6732         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6733         */
6734        @Child(name = "reasonLinkId", type = {StringType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6735        @Description(shortDefinition="Pointer to specific item", formalDefinition="Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse." )
6736        protected List<StringType> reasonLinkId;
6737
6738        /**
6739         * Comments made about the term action made by the requester, performer, subject or other participants.
6740         */
6741        @Child(name = "note", type = {Annotation.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6742        @Description(shortDefinition="Comments about the action", formalDefinition="Comments made about the term action made by the requester, performer, subject or other participants." )
6743        protected List<Annotation> note;
6744
6745        /**
6746         * Security labels that protects the action.
6747         */
6748        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6749        @Description(shortDefinition="Action restriction numbers", formalDefinition="Security labels that protects the action." )
6750        protected List<UnsignedIntType> securityLabelNumber;
6751
6752        private static final long serialVersionUID = -178728180L;
6753
6754    /**
6755     * Constructor
6756     */
6757      public ActionComponent() {
6758        super();
6759      }
6760
6761    /**
6762     * Constructor
6763     */
6764      public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
6765        super();
6766        this.type = type;
6767        this.intent = intent;
6768        this.status = status;
6769      }
6770
6771        /**
6772         * @return {@link #doNotPerform} (True if the term prohibits the  action.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
6773         */
6774        public BooleanType getDoNotPerformElement() { 
6775          if (this.doNotPerform == null)
6776            if (Configuration.errorOnAutoCreate())
6777              throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
6778            else if (Configuration.doAutoCreate())
6779              this.doNotPerform = new BooleanType(); // bb
6780          return this.doNotPerform;
6781        }
6782
6783        public boolean hasDoNotPerformElement() { 
6784          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6785        }
6786
6787        public boolean hasDoNotPerform() { 
6788          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6789        }
6790
6791        /**
6792         * @param value {@link #doNotPerform} (True if the term prohibits the  action.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
6793         */
6794        public ActionComponent setDoNotPerformElement(BooleanType value) { 
6795          this.doNotPerform = value;
6796          return this;
6797        }
6798
6799        /**
6800         * @return True if the term prohibits the  action.
6801         */
6802        public boolean getDoNotPerform() { 
6803          return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
6804        }
6805
6806        /**
6807         * @param value True if the term prohibits the  action.
6808         */
6809        public ActionComponent setDoNotPerform(boolean value) { 
6810            if (this.doNotPerform == null)
6811              this.doNotPerform = new BooleanType();
6812            this.doNotPerform.setValue(value);
6813          return this;
6814        }
6815
6816        /**
6817         * @return {@link #type} (Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.)
6818         */
6819        public CodeableConcept getType() { 
6820          if (this.type == null)
6821            if (Configuration.errorOnAutoCreate())
6822              throw new Error("Attempt to auto-create ActionComponent.type");
6823            else if (Configuration.doAutoCreate())
6824              this.type = new CodeableConcept(); // cc
6825          return this.type;
6826        }
6827
6828        public boolean hasType() { 
6829          return this.type != null && !this.type.isEmpty();
6830        }
6831
6832        /**
6833         * @param value {@link #type} (Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.)
6834         */
6835        public ActionComponent setType(CodeableConcept value) { 
6836          this.type = value;
6837          return this;
6838        }
6839
6840        /**
6841         * @return {@link #subject} (Entity of the action.)
6842         */
6843        public List<ActionSubjectComponent> getSubject() { 
6844          if (this.subject == null)
6845            this.subject = new ArrayList<ActionSubjectComponent>();
6846          return this.subject;
6847        }
6848
6849        /**
6850         * @return Returns a reference to <code>this</code> for easy method chaining
6851         */
6852        public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) { 
6853          this.subject = theSubject;
6854          return this;
6855        }
6856
6857        public boolean hasSubject() { 
6858          if (this.subject == null)
6859            return false;
6860          for (ActionSubjectComponent item : this.subject)
6861            if (!item.isEmpty())
6862              return true;
6863          return false;
6864        }
6865
6866        public ActionSubjectComponent addSubject() { //3
6867          ActionSubjectComponent t = new ActionSubjectComponent();
6868          if (this.subject == null)
6869            this.subject = new ArrayList<ActionSubjectComponent>();
6870          this.subject.add(t);
6871          return t;
6872        }
6873
6874        public ActionComponent addSubject(ActionSubjectComponent t) { //3
6875          if (t == null)
6876            return this;
6877          if (this.subject == null)
6878            this.subject = new ArrayList<ActionSubjectComponent>();
6879          this.subject.add(t);
6880          return this;
6881        }
6882
6883        /**
6884         * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
6885         */
6886        public ActionSubjectComponent getSubjectFirstRep() { 
6887          if (getSubject().isEmpty()) {
6888            addSubject();
6889          }
6890          return getSubject().get(0);
6891        }
6892
6893        /**
6894         * @return {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6895         */
6896        public CodeableConcept getIntent() { 
6897          if (this.intent == null)
6898            if (Configuration.errorOnAutoCreate())
6899              throw new Error("Attempt to auto-create ActionComponent.intent");
6900            else if (Configuration.doAutoCreate())
6901              this.intent = new CodeableConcept(); // cc
6902          return this.intent;
6903        }
6904
6905        public boolean hasIntent() { 
6906          return this.intent != null && !this.intent.isEmpty();
6907        }
6908
6909        /**
6910         * @param value {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6911         */
6912        public ActionComponent setIntent(CodeableConcept value) { 
6913          this.intent = value;
6914          return this;
6915        }
6916
6917        /**
6918         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6919         */
6920        public List<StringType> getLinkId() { 
6921          if (this.linkId == null)
6922            this.linkId = new ArrayList<StringType>();
6923          return this.linkId;
6924        }
6925
6926        /**
6927         * @return Returns a reference to <code>this</code> for easy method chaining
6928         */
6929        public ActionComponent setLinkId(List<StringType> theLinkId) { 
6930          this.linkId = theLinkId;
6931          return this;
6932        }
6933
6934        public boolean hasLinkId() { 
6935          if (this.linkId == null)
6936            return false;
6937          for (StringType item : this.linkId)
6938            if (!item.isEmpty())
6939              return true;
6940          return false;
6941        }
6942
6943        /**
6944         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6945         */
6946        public StringType addLinkIdElement() {//2 
6947          StringType t = new StringType();
6948          if (this.linkId == null)
6949            this.linkId = new ArrayList<StringType>();
6950          this.linkId.add(t);
6951          return t;
6952        }
6953
6954        /**
6955         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6956         */
6957        public ActionComponent addLinkId(String value) { //1
6958          StringType t = new StringType();
6959          t.setValue(value);
6960          if (this.linkId == null)
6961            this.linkId = new ArrayList<StringType>();
6962          this.linkId.add(t);
6963          return this;
6964        }
6965
6966        /**
6967         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6968         */
6969        public boolean hasLinkId(String value) { 
6970          if (this.linkId == null)
6971            return false;
6972          for (StringType v : this.linkId)
6973            if (v.getValue().equals(value)) // string
6974              return true;
6975          return false;
6976        }
6977
6978        /**
6979         * @return {@link #status} (Current state of the term action.)
6980         */
6981        public CodeableConcept getStatus() { 
6982          if (this.status == null)
6983            if (Configuration.errorOnAutoCreate())
6984              throw new Error("Attempt to auto-create ActionComponent.status");
6985            else if (Configuration.doAutoCreate())
6986              this.status = new CodeableConcept(); // cc
6987          return this.status;
6988        }
6989
6990        public boolean hasStatus() { 
6991          return this.status != null && !this.status.isEmpty();
6992        }
6993
6994        /**
6995         * @param value {@link #status} (Current state of the term action.)
6996         */
6997        public ActionComponent setStatus(CodeableConcept value) { 
6998          this.status = value;
6999          return this;
7000        }
7001
7002        /**
7003         * @return {@link #context} (Encounter or Episode with primary association to specified term activity.)
7004         */
7005        public Reference getContext() { 
7006          if (this.context == null)
7007            if (Configuration.errorOnAutoCreate())
7008              throw new Error("Attempt to auto-create ActionComponent.context");
7009            else if (Configuration.doAutoCreate())
7010              this.context = new Reference(); // cc
7011          return this.context;
7012        }
7013
7014        public boolean hasContext() { 
7015          return this.context != null && !this.context.isEmpty();
7016        }
7017
7018        /**
7019         * @param value {@link #context} (Encounter or Episode with primary association to specified term activity.)
7020         */
7021        public ActionComponent setContext(Reference value) { 
7022          this.context = value;
7023          return this;
7024        }
7025
7026        /**
7027         * @return {@link #context} 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. (Encounter or Episode with primary association to specified term activity.)
7028         */
7029        public Resource getContextTarget() { 
7030          return this.contextTarget;
7031        }
7032
7033        /**
7034         * @param value {@link #context} 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. (Encounter or Episode with primary association to specified term activity.)
7035         */
7036        public ActionComponent setContextTarget(Resource value) { 
7037          this.contextTarget = value;
7038          return this;
7039        }
7040
7041        /**
7042         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7043         */
7044        public List<StringType> getContextLinkId() { 
7045          if (this.contextLinkId == null)
7046            this.contextLinkId = new ArrayList<StringType>();
7047          return this.contextLinkId;
7048        }
7049
7050        /**
7051         * @return Returns a reference to <code>this</code> for easy method chaining
7052         */
7053        public ActionComponent setContextLinkId(List<StringType> theContextLinkId) { 
7054          this.contextLinkId = theContextLinkId;
7055          return this;
7056        }
7057
7058        public boolean hasContextLinkId() { 
7059          if (this.contextLinkId == null)
7060            return false;
7061          for (StringType item : this.contextLinkId)
7062            if (!item.isEmpty())
7063              return true;
7064          return false;
7065        }
7066
7067        /**
7068         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7069         */
7070        public StringType addContextLinkIdElement() {//2 
7071          StringType t = new StringType();
7072          if (this.contextLinkId == null)
7073            this.contextLinkId = new ArrayList<StringType>();
7074          this.contextLinkId.add(t);
7075          return t;
7076        }
7077
7078        /**
7079         * @param value {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7080         */
7081        public ActionComponent addContextLinkId(String value) { //1
7082          StringType t = new StringType();
7083          t.setValue(value);
7084          if (this.contextLinkId == null)
7085            this.contextLinkId = new ArrayList<StringType>();
7086          this.contextLinkId.add(t);
7087          return this;
7088        }
7089
7090        /**
7091         * @param value {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7092         */
7093        public boolean hasContextLinkId(String value) { 
7094          if (this.contextLinkId == null)
7095            return false;
7096          for (StringType v : this.contextLinkId)
7097            if (v.getValue().equals(value)) // string
7098              return true;
7099          return false;
7100        }
7101
7102        /**
7103         * @return {@link #occurrence} (When action happens.)
7104         */
7105        public Type getOccurrence() { 
7106          return this.occurrence;
7107        }
7108
7109        /**
7110         * @return {@link #occurrence} (When action happens.)
7111         */
7112        public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
7113          if (this.occurrence == null)
7114            this.occurrence = new DateTimeType();
7115          if (!(this.occurrence instanceof DateTimeType))
7116            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
7117          return (DateTimeType) this.occurrence;
7118        }
7119
7120        public boolean hasOccurrenceDateTimeType() { 
7121          return this != null && this.occurrence instanceof DateTimeType;
7122        }
7123
7124        /**
7125         * @return {@link #occurrence} (When action happens.)
7126         */
7127        public Period getOccurrencePeriod() throws FHIRException { 
7128          if (this.occurrence == null)
7129            this.occurrence = new Period();
7130          if (!(this.occurrence instanceof Period))
7131            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
7132          return (Period) this.occurrence;
7133        }
7134
7135        public boolean hasOccurrencePeriod() { 
7136          return this != null && this.occurrence instanceof Period;
7137        }
7138
7139        /**
7140         * @return {@link #occurrence} (When action happens.)
7141         */
7142        public Timing getOccurrenceTiming() throws FHIRException { 
7143          if (this.occurrence == null)
7144            this.occurrence = new Timing();
7145          if (!(this.occurrence instanceof Timing))
7146            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
7147          return (Timing) this.occurrence;
7148        }
7149
7150        public boolean hasOccurrenceTiming() { 
7151          return this != null && this.occurrence instanceof Timing;
7152        }
7153
7154        public boolean hasOccurrence() { 
7155          return this.occurrence != null && !this.occurrence.isEmpty();
7156        }
7157
7158        /**
7159         * @param value {@link #occurrence} (When action happens.)
7160         */
7161        public ActionComponent setOccurrence(Type value) { 
7162          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
7163            throw new Error("Not the right type for Contract.term.action.occurrence[x]: "+value.fhirType());
7164          this.occurrence = value;
7165          return this;
7166        }
7167
7168        /**
7169         * @return {@link #requester} (Who or what initiated the action and has responsibility for its activation.)
7170         */
7171        public List<Reference> getRequester() { 
7172          if (this.requester == null)
7173            this.requester = new ArrayList<Reference>();
7174          return this.requester;
7175        }
7176
7177        /**
7178         * @return Returns a reference to <code>this</code> for easy method chaining
7179         */
7180        public ActionComponent setRequester(List<Reference> theRequester) { 
7181          this.requester = theRequester;
7182          return this;
7183        }
7184
7185        public boolean hasRequester() { 
7186          if (this.requester == null)
7187            return false;
7188          for (Reference item : this.requester)
7189            if (!item.isEmpty())
7190              return true;
7191          return false;
7192        }
7193
7194        public Reference addRequester() { //3
7195          Reference t = new Reference();
7196          if (this.requester == null)
7197            this.requester = new ArrayList<Reference>();
7198          this.requester.add(t);
7199          return t;
7200        }
7201
7202        public ActionComponent addRequester(Reference t) { //3
7203          if (t == null)
7204            return this;
7205          if (this.requester == null)
7206            this.requester = new ArrayList<Reference>();
7207          this.requester.add(t);
7208          return this;
7209        }
7210
7211        /**
7212         * @return The first repetition of repeating field {@link #requester}, creating it if it does not already exist
7213         */
7214        public Reference getRequesterFirstRep() { 
7215          if (getRequester().isEmpty()) {
7216            addRequester();
7217          }
7218          return getRequester().get(0);
7219        }
7220
7221        /**
7222         * @deprecated Use Reference#setResource(IBaseResource) instead
7223         */
7224        @Deprecated
7225        public List<Resource> getRequesterTarget() { 
7226          if (this.requesterTarget == null)
7227            this.requesterTarget = new ArrayList<Resource>();
7228          return this.requesterTarget;
7229        }
7230
7231        /**
7232         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7233         */
7234        public List<StringType> getRequesterLinkId() { 
7235          if (this.requesterLinkId == null)
7236            this.requesterLinkId = new ArrayList<StringType>();
7237          return this.requesterLinkId;
7238        }
7239
7240        /**
7241         * @return Returns a reference to <code>this</code> for easy method chaining
7242         */
7243        public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) { 
7244          this.requesterLinkId = theRequesterLinkId;
7245          return this;
7246        }
7247
7248        public boolean hasRequesterLinkId() { 
7249          if (this.requesterLinkId == null)
7250            return false;
7251          for (StringType item : this.requesterLinkId)
7252            if (!item.isEmpty())
7253              return true;
7254          return false;
7255        }
7256
7257        /**
7258         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7259         */
7260        public StringType addRequesterLinkIdElement() {//2 
7261          StringType t = new StringType();
7262          if (this.requesterLinkId == null)
7263            this.requesterLinkId = new ArrayList<StringType>();
7264          this.requesterLinkId.add(t);
7265          return t;
7266        }
7267
7268        /**
7269         * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7270         */
7271        public ActionComponent addRequesterLinkId(String value) { //1
7272          StringType t = new StringType();
7273          t.setValue(value);
7274          if (this.requesterLinkId == null)
7275            this.requesterLinkId = new ArrayList<StringType>();
7276          this.requesterLinkId.add(t);
7277          return this;
7278        }
7279
7280        /**
7281         * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7282         */
7283        public boolean hasRequesterLinkId(String value) { 
7284          if (this.requesterLinkId == null)
7285            return false;
7286          for (StringType v : this.requesterLinkId)
7287            if (v.getValue().equals(value)) // string
7288              return true;
7289          return false;
7290        }
7291
7292        /**
7293         * @return {@link #performerType} (The type of individual that is desired or required to perform or not perform the action.)
7294         */
7295        public List<CodeableConcept> getPerformerType() { 
7296          if (this.performerType == null)
7297            this.performerType = new ArrayList<CodeableConcept>();
7298          return this.performerType;
7299        }
7300
7301        /**
7302         * @return Returns a reference to <code>this</code> for easy method chaining
7303         */
7304        public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) { 
7305          this.performerType = thePerformerType;
7306          return this;
7307        }
7308
7309        public boolean hasPerformerType() { 
7310          if (this.performerType == null)
7311            return false;
7312          for (CodeableConcept item : this.performerType)
7313            if (!item.isEmpty())
7314              return true;
7315          return false;
7316        }
7317
7318        public CodeableConcept addPerformerType() { //3
7319          CodeableConcept t = new CodeableConcept();
7320          if (this.performerType == null)
7321            this.performerType = new ArrayList<CodeableConcept>();
7322          this.performerType.add(t);
7323          return t;
7324        }
7325
7326        public ActionComponent addPerformerType(CodeableConcept t) { //3
7327          if (t == null)
7328            return this;
7329          if (this.performerType == null)
7330            this.performerType = new ArrayList<CodeableConcept>();
7331          this.performerType.add(t);
7332          return this;
7333        }
7334
7335        /**
7336         * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist
7337         */
7338        public CodeableConcept getPerformerTypeFirstRep() { 
7339          if (getPerformerType().isEmpty()) {
7340            addPerformerType();
7341          }
7342          return getPerformerType().get(0);
7343        }
7344
7345        /**
7346         * @return {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7347         */
7348        public CodeableConcept getPerformerRole() { 
7349          if (this.performerRole == null)
7350            if (Configuration.errorOnAutoCreate())
7351              throw new Error("Attempt to auto-create ActionComponent.performerRole");
7352            else if (Configuration.doAutoCreate())
7353              this.performerRole = new CodeableConcept(); // cc
7354          return this.performerRole;
7355        }
7356
7357        public boolean hasPerformerRole() { 
7358          return this.performerRole != null && !this.performerRole.isEmpty();
7359        }
7360
7361        /**
7362         * @param value {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7363         */
7364        public ActionComponent setPerformerRole(CodeableConcept value) { 
7365          this.performerRole = value;
7366          return this;
7367        }
7368
7369        /**
7370         * @return {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7371         */
7372        public Reference getPerformer() { 
7373          if (this.performer == null)
7374            if (Configuration.errorOnAutoCreate())
7375              throw new Error("Attempt to auto-create ActionComponent.performer");
7376            else if (Configuration.doAutoCreate())
7377              this.performer = new Reference(); // cc
7378          return this.performer;
7379        }
7380
7381        public boolean hasPerformer() { 
7382          return this.performer != null && !this.performer.isEmpty();
7383        }
7384
7385        /**
7386         * @param value {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7387         */
7388        public ActionComponent setPerformer(Reference value) { 
7389          this.performer = value;
7390          return this;
7391        }
7392
7393        /**
7394         * @return {@link #performer} 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. (Indicates who or what is being asked to perform (or not perform) the ction.)
7395         */
7396        public Resource getPerformerTarget() { 
7397          return this.performerTarget;
7398        }
7399
7400        /**
7401         * @param value {@link #performer} 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. (Indicates who or what is being asked to perform (or not perform) the ction.)
7402         */
7403        public ActionComponent setPerformerTarget(Resource value) { 
7404          this.performerTarget = value;
7405          return this;
7406        }
7407
7408        /**
7409         * @return {@link #performerLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7410         */
7411        public List<StringType> getPerformerLinkId() { 
7412          if (this.performerLinkId == null)
7413            this.performerLinkId = new ArrayList<StringType>();
7414          return this.performerLinkId;
7415        }
7416
7417        /**
7418         * @return Returns a reference to <code>this</code> for easy method chaining
7419         */
7420        public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) { 
7421          this.performerLinkId = thePerformerLinkId;
7422          return this;
7423        }
7424
7425        public boolean hasPerformerLinkId() { 
7426          if (this.performerLinkId == null)
7427            return false;
7428          for (StringType item : this.performerLinkId)
7429            if (!item.isEmpty())
7430              return true;
7431          return false;
7432        }
7433
7434        /**
7435         * @return {@link #performerLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7436         */
7437        public StringType addPerformerLinkIdElement() {//2 
7438          StringType t = new StringType();
7439          if (this.performerLinkId == null)
7440            this.performerLinkId = new ArrayList<StringType>();
7441          this.performerLinkId.add(t);
7442          return t;
7443        }
7444
7445        /**
7446         * @param value {@link #performerLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7447         */
7448        public ActionComponent addPerformerLinkId(String value) { //1
7449          StringType t = new StringType();
7450          t.setValue(value);
7451          if (this.performerLinkId == null)
7452            this.performerLinkId = new ArrayList<StringType>();
7453          this.performerLinkId.add(t);
7454          return this;
7455        }
7456
7457        /**
7458         * @param value {@link #performerLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7459         */
7460        public boolean hasPerformerLinkId(String value) { 
7461          if (this.performerLinkId == null)
7462            return false;
7463          for (StringType v : this.performerLinkId)
7464            if (v.getValue().equals(value)) // string
7465              return true;
7466          return false;
7467        }
7468
7469        /**
7470         * @return {@link #reasonCode} (Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.)
7471         */
7472        public List<CodeableConcept> getReasonCode() { 
7473          if (this.reasonCode == null)
7474            this.reasonCode = new ArrayList<CodeableConcept>();
7475          return this.reasonCode;
7476        }
7477
7478        /**
7479         * @return Returns a reference to <code>this</code> for easy method chaining
7480         */
7481        public ActionComponent setReasonCode(List<CodeableConcept> theReasonCode) { 
7482          this.reasonCode = theReasonCode;
7483          return this;
7484        }
7485
7486        public boolean hasReasonCode() { 
7487          if (this.reasonCode == null)
7488            return false;
7489          for (CodeableConcept item : this.reasonCode)
7490            if (!item.isEmpty())
7491              return true;
7492          return false;
7493        }
7494
7495        public CodeableConcept addReasonCode() { //3
7496          CodeableConcept t = new CodeableConcept();
7497          if (this.reasonCode == null)
7498            this.reasonCode = new ArrayList<CodeableConcept>();
7499          this.reasonCode.add(t);
7500          return t;
7501        }
7502
7503        public ActionComponent addReasonCode(CodeableConcept t) { //3
7504          if (t == null)
7505            return this;
7506          if (this.reasonCode == null)
7507            this.reasonCode = new ArrayList<CodeableConcept>();
7508          this.reasonCode.add(t);
7509          return this;
7510        }
7511
7512        /**
7513         * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
7514         */
7515        public CodeableConcept getReasonCodeFirstRep() { 
7516          if (getReasonCode().isEmpty()) {
7517            addReasonCode();
7518          }
7519          return getReasonCode().get(0);
7520        }
7521
7522        /**
7523         * @return {@link #reasonReference} (Indicates another resource whose existence justifies permitting or not permitting this action.)
7524         */
7525        public List<Reference> getReasonReference() { 
7526          if (this.reasonReference == null)
7527            this.reasonReference = new ArrayList<Reference>();
7528          return this.reasonReference;
7529        }
7530
7531        /**
7532         * @return Returns a reference to <code>this</code> for easy method chaining
7533         */
7534        public ActionComponent setReasonReference(List<Reference> theReasonReference) { 
7535          this.reasonReference = theReasonReference;
7536          return this;
7537        }
7538
7539        public boolean hasReasonReference() { 
7540          if (this.reasonReference == null)
7541            return false;
7542          for (Reference item : this.reasonReference)
7543            if (!item.isEmpty())
7544              return true;
7545          return false;
7546        }
7547
7548        public Reference addReasonReference() { //3
7549          Reference t = new Reference();
7550          if (this.reasonReference == null)
7551            this.reasonReference = new ArrayList<Reference>();
7552          this.reasonReference.add(t);
7553          return t;
7554        }
7555
7556        public ActionComponent addReasonReference(Reference t) { //3
7557          if (t == null)
7558            return this;
7559          if (this.reasonReference == null)
7560            this.reasonReference = new ArrayList<Reference>();
7561          this.reasonReference.add(t);
7562          return this;
7563        }
7564
7565        /**
7566         * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
7567         */
7568        public Reference getReasonReferenceFirstRep() { 
7569          if (getReasonReference().isEmpty()) {
7570            addReasonReference();
7571          }
7572          return getReasonReference().get(0);
7573        }
7574
7575        /**
7576         * @deprecated Use Reference#setResource(IBaseResource) instead
7577         */
7578        @Deprecated
7579        public List<Resource> getReasonReferenceTarget() { 
7580          if (this.reasonReferenceTarget == null)
7581            this.reasonReferenceTarget = new ArrayList<Resource>();
7582          return this.reasonReferenceTarget;
7583        }
7584
7585        /**
7586         * @return {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7587         */
7588        public List<StringType> getReason() { 
7589          if (this.reason == null)
7590            this.reason = new ArrayList<StringType>();
7591          return this.reason;
7592        }
7593
7594        /**
7595         * @return Returns a reference to <code>this</code> for easy method chaining
7596         */
7597        public ActionComponent setReason(List<StringType> theReason) { 
7598          this.reason = theReason;
7599          return this;
7600        }
7601
7602        public boolean hasReason() { 
7603          if (this.reason == null)
7604            return false;
7605          for (StringType item : this.reason)
7606            if (!item.isEmpty())
7607              return true;
7608          return false;
7609        }
7610
7611        /**
7612         * @return {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7613         */
7614        public StringType addReasonElement() {//2 
7615          StringType t = new StringType();
7616          if (this.reason == null)
7617            this.reason = new ArrayList<StringType>();
7618          this.reason.add(t);
7619          return t;
7620        }
7621
7622        /**
7623         * @param value {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7624         */
7625        public ActionComponent addReason(String value) { //1
7626          StringType t = new StringType();
7627          t.setValue(value);
7628          if (this.reason == null)
7629            this.reason = new ArrayList<StringType>();
7630          this.reason.add(t);
7631          return this;
7632        }
7633
7634        /**
7635         * @param value {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7636         */
7637        public boolean hasReason(String value) { 
7638          if (this.reason == null)
7639            return false;
7640          for (StringType v : this.reason)
7641            if (v.getValue().equals(value)) // string
7642              return true;
7643          return false;
7644        }
7645
7646        /**
7647         * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7648         */
7649        public List<StringType> getReasonLinkId() { 
7650          if (this.reasonLinkId == null)
7651            this.reasonLinkId = new ArrayList<StringType>();
7652          return this.reasonLinkId;
7653        }
7654
7655        /**
7656         * @return Returns a reference to <code>this</code> for easy method chaining
7657         */
7658        public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) { 
7659          this.reasonLinkId = theReasonLinkId;
7660          return this;
7661        }
7662
7663        public boolean hasReasonLinkId() { 
7664          if (this.reasonLinkId == null)
7665            return false;
7666          for (StringType item : this.reasonLinkId)
7667            if (!item.isEmpty())
7668              return true;
7669          return false;
7670        }
7671
7672        /**
7673         * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7674         */
7675        public StringType addReasonLinkIdElement() {//2 
7676          StringType t = new StringType();
7677          if (this.reasonLinkId == null)
7678            this.reasonLinkId = new ArrayList<StringType>();
7679          this.reasonLinkId.add(t);
7680          return t;
7681        }
7682
7683        /**
7684         * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7685         */
7686        public ActionComponent addReasonLinkId(String value) { //1
7687          StringType t = new StringType();
7688          t.setValue(value);
7689          if (this.reasonLinkId == null)
7690            this.reasonLinkId = new ArrayList<StringType>();
7691          this.reasonLinkId.add(t);
7692          return this;
7693        }
7694
7695        /**
7696         * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.)
7697         */
7698        public boolean hasReasonLinkId(String value) { 
7699          if (this.reasonLinkId == null)
7700            return false;
7701          for (StringType v : this.reasonLinkId)
7702            if (v.getValue().equals(value)) // string
7703              return true;
7704          return false;
7705        }
7706
7707        /**
7708         * @return {@link #note} (Comments made about the term action made by the requester, performer, subject or other participants.)
7709         */
7710        public List<Annotation> getNote() { 
7711          if (this.note == null)
7712            this.note = new ArrayList<Annotation>();
7713          return this.note;
7714        }
7715
7716        /**
7717         * @return Returns a reference to <code>this</code> for easy method chaining
7718         */
7719        public ActionComponent setNote(List<Annotation> theNote) { 
7720          this.note = theNote;
7721          return this;
7722        }
7723
7724        public boolean hasNote() { 
7725          if (this.note == null)
7726            return false;
7727          for (Annotation item : this.note)
7728            if (!item.isEmpty())
7729              return true;
7730          return false;
7731        }
7732
7733        public Annotation addNote() { //3
7734          Annotation t = new Annotation();
7735          if (this.note == null)
7736            this.note = new ArrayList<Annotation>();
7737          this.note.add(t);
7738          return t;
7739        }
7740
7741        public ActionComponent addNote(Annotation t) { //3
7742          if (t == null)
7743            return this;
7744          if (this.note == null)
7745            this.note = new ArrayList<Annotation>();
7746          this.note.add(t);
7747          return this;
7748        }
7749
7750        /**
7751         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
7752         */
7753        public Annotation getNoteFirstRep() { 
7754          if (getNote().isEmpty()) {
7755            addNote();
7756          }
7757          return getNote().get(0);
7758        }
7759
7760        /**
7761         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7762         */
7763        public List<UnsignedIntType> getSecurityLabelNumber() { 
7764          if (this.securityLabelNumber == null)
7765            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7766          return this.securityLabelNumber;
7767        }
7768
7769        /**
7770         * @return Returns a reference to <code>this</code> for easy method chaining
7771         */
7772        public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
7773          this.securityLabelNumber = theSecurityLabelNumber;
7774          return this;
7775        }
7776
7777        public boolean hasSecurityLabelNumber() { 
7778          if (this.securityLabelNumber == null)
7779            return false;
7780          for (UnsignedIntType item : this.securityLabelNumber)
7781            if (!item.isEmpty())
7782              return true;
7783          return false;
7784        }
7785
7786        /**
7787         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7788         */
7789        public UnsignedIntType addSecurityLabelNumberElement() {//2 
7790          UnsignedIntType t = new UnsignedIntType();
7791          if (this.securityLabelNumber == null)
7792            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7793          this.securityLabelNumber.add(t);
7794          return t;
7795        }
7796
7797        /**
7798         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7799         */
7800        public ActionComponent addSecurityLabelNumber(int value) { //1
7801          UnsignedIntType t = new UnsignedIntType();
7802          t.setValue(value);
7803          if (this.securityLabelNumber == null)
7804            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7805          this.securityLabelNumber.add(t);
7806          return this;
7807        }
7808
7809        /**
7810         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7811         */
7812        public boolean hasSecurityLabelNumber(int value) { 
7813          if (this.securityLabelNumber == null)
7814            return false;
7815          for (UnsignedIntType v : this.securityLabelNumber)
7816            if (v.getValue().equals(value)) // unsignedInt
7817              return true;
7818          return false;
7819        }
7820
7821        protected void listChildren(List<Property> children) {
7822          super.listChildren(children);
7823          children.add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
7824          children.add(new Property("type", "CodeableConcept", "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.", 0, 1, type));
7825          children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
7826          children.add(new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
7827          children.add(new Property("linkId", "string", "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId));
7828          children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
7829          children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
7830          children.add(new Property("contextLinkId", "string", "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, contextLinkId));
7831          children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
7832          children.add(new Property("requester", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Who or what initiated the action and has responsibility for its activation.", 0, java.lang.Integer.MAX_VALUE, requester));
7833          children.add(new Property("requesterLinkId", "string", "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, requesterLinkId));
7834          children.add(new Property("performerType", "CodeableConcept", "The type of individual that is desired or required to perform or not perform the action.", 0, java.lang.Integer.MAX_VALUE, performerType));
7835          children.add(new Property("performerRole", "CodeableConcept", "The type of role or competency of an individual desired or required to perform or not perform the action.", 0, 1, performerRole));
7836          children.add(new Property("performer", "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)", "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer));
7837          children.add(new Property("performerLinkId", "string", "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, performerLinkId));
7838          children.add(new Property("reasonCode", "CodeableConcept", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
7839          children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Indicates another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
7840          children.add(new Property("reason", "string", "Describes why the action is to be performed or not performed in textual form.", 0, java.lang.Integer.MAX_VALUE, reason));
7841          children.add(new Property("reasonLinkId", "string", "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, reasonLinkId));
7842          children.add(new Property("note", "Annotation", "Comments made about the term action made by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
7843          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
7844        }
7845
7846        @Override
7847        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7848          switch (_hash) {
7849          case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform);
7850          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.", 0, 1, type);
7851          case -1867885268: /*subject*/  return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject);
7852          case -1183762788: /*intent*/  return new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
7853          case -1102667083: /*linkId*/  return new Property("linkId", "string", "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, linkId);
7854          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status);
7855          case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
7856          case -288783036: /*contextLinkId*/  return new Property("contextLinkId", "string", "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, contextLinkId);
7857          case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7858          case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7859          case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7860          case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7861          case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7862          case 693933948: /*requester*/  return new Property("requester", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Who or what initiated the action and has responsibility for its activation.", 0, java.lang.Integer.MAX_VALUE, requester);
7863          case -1468032687: /*requesterLinkId*/  return new Property("requesterLinkId", "string", "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, requesterLinkId);
7864          case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "The type of individual that is desired or required to perform or not perform the action.", 0, java.lang.Integer.MAX_VALUE, performerType);
7865          case -901513884: /*performerRole*/  return new Property("performerRole", "CodeableConcept", "The type of role or competency of an individual desired or required to perform or not perform the action.", 0, 1, performerRole);
7866          case 481140686: /*performer*/  return new Property("performer", "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)", "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer);
7867          case 1051302947: /*performerLinkId*/  return new Property("performerLinkId", "string", "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, performerLinkId);
7868          case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
7869          case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Indicates another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
7870          case -934964668: /*reason*/  return new Property("reason", "string", "Describes why the action is to be performed or not performed in textual form.", 0, java.lang.Integer.MAX_VALUE, reason);
7871          case -1557963239: /*reasonLinkId*/  return new Property("reasonLinkId", "string", "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, reasonLinkId);
7872          case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the term action made by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
7873          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
7874          default: return super.getNamedProperty(_hash, _name, _checkValid);
7875          }
7876
7877        }
7878
7879      @Override
7880      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7881        switch (hash) {
7882        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
7883        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
7884        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
7885        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // CodeableConcept
7886        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7887        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
7888        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
7889        case -288783036: /*contextLinkId*/ return this.contextLinkId == null ? new Base[0] : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
7890        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
7891        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : this.requester.toArray(new Base[this.requester.size()]); // Reference
7892        case -1468032687: /*requesterLinkId*/ return this.requesterLinkId == null ? new Base[0] : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
7893        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
7894        case -901513884: /*performerRole*/ return this.performerRole == null ? new Base[0] : new Base[] {this.performerRole}; // CodeableConcept
7895        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
7896        case 1051302947: /*performerLinkId*/ return this.performerLinkId == null ? new Base[0] : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
7897        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
7898        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
7899        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // StringType
7900        case -1557963239: /*reasonLinkId*/ return this.reasonLinkId == null ? new Base[0] : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
7901        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
7902        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7903        default: return super.getProperty(hash, name, checkValid);
7904        }
7905
7906      }
7907
7908      @Override
7909      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7910        switch (hash) {
7911        case -1788508167: // doNotPerform
7912          this.doNotPerform = castToBoolean(value); // BooleanType
7913          return value;
7914        case 3575610: // type
7915          this.type = castToCodeableConcept(value); // CodeableConcept
7916          return value;
7917        case -1867885268: // subject
7918          this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
7919          return value;
7920        case -1183762788: // intent
7921          this.intent = castToCodeableConcept(value); // CodeableConcept
7922          return value;
7923        case -1102667083: // linkId
7924          this.getLinkId().add(castToString(value)); // StringType
7925          return value;
7926        case -892481550: // status
7927          this.status = castToCodeableConcept(value); // CodeableConcept
7928          return value;
7929        case 951530927: // context
7930          this.context = castToReference(value); // Reference
7931          return value;
7932        case -288783036: // contextLinkId
7933          this.getContextLinkId().add(castToString(value)); // StringType
7934          return value;
7935        case 1687874001: // occurrence
7936          this.occurrence = castToType(value); // Type
7937          return value;
7938        case 693933948: // requester
7939          this.getRequester().add(castToReference(value)); // Reference
7940          return value;
7941        case -1468032687: // requesterLinkId
7942          this.getRequesterLinkId().add(castToString(value)); // StringType
7943          return value;
7944        case -901444568: // performerType
7945          this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
7946          return value;
7947        case -901513884: // performerRole
7948          this.performerRole = castToCodeableConcept(value); // CodeableConcept
7949          return value;
7950        case 481140686: // performer
7951          this.performer = castToReference(value); // Reference
7952          return value;
7953        case 1051302947: // performerLinkId
7954          this.getPerformerLinkId().add(castToString(value)); // StringType
7955          return value;
7956        case 722137681: // reasonCode
7957          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
7958          return value;
7959        case -1146218137: // reasonReference
7960          this.getReasonReference().add(castToReference(value)); // Reference
7961          return value;
7962        case -934964668: // reason
7963          this.getReason().add(castToString(value)); // StringType
7964          return value;
7965        case -1557963239: // reasonLinkId
7966          this.getReasonLinkId().add(castToString(value)); // StringType
7967          return value;
7968        case 3387378: // note
7969          this.getNote().add(castToAnnotation(value)); // Annotation
7970          return value;
7971        case -149460995: // securityLabelNumber
7972          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
7973          return value;
7974        default: return super.setProperty(hash, name, value);
7975        }
7976
7977      }
7978
7979      @Override
7980      public Base setProperty(String name, Base value) throws FHIRException {
7981        if (name.equals("doNotPerform")) {
7982          this.doNotPerform = castToBoolean(value); // BooleanType
7983        } else if (name.equals("type")) {
7984          this.type = castToCodeableConcept(value); // CodeableConcept
7985        } else if (name.equals("subject")) {
7986          this.getSubject().add((ActionSubjectComponent) value);
7987        } else if (name.equals("intent")) {
7988          this.intent = castToCodeableConcept(value); // CodeableConcept
7989        } else if (name.equals("linkId")) {
7990          this.getLinkId().add(castToString(value));
7991        } else if (name.equals("status")) {
7992          this.status = castToCodeableConcept(value); // CodeableConcept
7993        } else if (name.equals("context")) {
7994          this.context = castToReference(value); // Reference
7995        } else if (name.equals("contextLinkId")) {
7996          this.getContextLinkId().add(castToString(value));
7997        } else if (name.equals("occurrence[x]")) {
7998          this.occurrence = castToType(value); // Type
7999        } else if (name.equals("requester")) {
8000          this.getRequester().add(castToReference(value));
8001        } else if (name.equals("requesterLinkId")) {
8002          this.getRequesterLinkId().add(castToString(value));
8003        } else if (name.equals("performerType")) {
8004          this.getPerformerType().add(castToCodeableConcept(value));
8005        } else if (name.equals("performerRole")) {
8006          this.performerRole = castToCodeableConcept(value); // CodeableConcept
8007        } else if (name.equals("performer")) {
8008          this.performer = castToReference(value); // Reference
8009        } else if (name.equals("performerLinkId")) {
8010          this.getPerformerLinkId().add(castToString(value));
8011        } else if (name.equals("reasonCode")) {
8012          this.getReasonCode().add(castToCodeableConcept(value));
8013        } else if (name.equals("reasonReference")) {
8014          this.getReasonReference().add(castToReference(value));
8015        } else if (name.equals("reason")) {
8016          this.getReason().add(castToString(value));
8017        } else if (name.equals("reasonLinkId")) {
8018          this.getReasonLinkId().add(castToString(value));
8019        } else if (name.equals("note")) {
8020          this.getNote().add(castToAnnotation(value));
8021        } else if (name.equals("securityLabelNumber")) {
8022          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
8023        } else
8024          return super.setProperty(name, value);
8025        return value;
8026      }
8027
8028      @Override
8029      public Base makeProperty(int hash, String name) throws FHIRException {
8030        switch (hash) {
8031        case -1788508167:  return getDoNotPerformElement();
8032        case 3575610:  return getType(); 
8033        case -1867885268:  return addSubject(); 
8034        case -1183762788:  return getIntent(); 
8035        case -1102667083:  return addLinkIdElement();
8036        case -892481550:  return getStatus(); 
8037        case 951530927:  return getContext(); 
8038        case -288783036:  return addContextLinkIdElement();
8039        case -2022646513:  return getOccurrence(); 
8040        case 1687874001:  return getOccurrence(); 
8041        case 693933948:  return addRequester(); 
8042        case -1468032687:  return addRequesterLinkIdElement();
8043        case -901444568:  return addPerformerType(); 
8044        case -901513884:  return getPerformerRole(); 
8045        case 481140686:  return getPerformer(); 
8046        case 1051302947:  return addPerformerLinkIdElement();
8047        case 722137681:  return addReasonCode(); 
8048        case -1146218137:  return addReasonReference(); 
8049        case -934964668:  return addReasonElement();
8050        case -1557963239:  return addReasonLinkIdElement();
8051        case 3387378:  return addNote(); 
8052        case -149460995:  return addSecurityLabelNumberElement();
8053        default: return super.makeProperty(hash, name);
8054        }
8055
8056      }
8057
8058      @Override
8059      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8060        switch (hash) {
8061        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
8062        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8063        case -1867885268: /*subject*/ return new String[] {};
8064        case -1183762788: /*intent*/ return new String[] {"CodeableConcept"};
8065        case -1102667083: /*linkId*/ return new String[] {"string"};
8066        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
8067        case 951530927: /*context*/ return new String[] {"Reference"};
8068        case -288783036: /*contextLinkId*/ return new String[] {"string"};
8069        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
8070        case 693933948: /*requester*/ return new String[] {"Reference"};
8071        case -1468032687: /*requesterLinkId*/ return new String[] {"string"};
8072        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
8073        case -901513884: /*performerRole*/ return new String[] {"CodeableConcept"};
8074        case 481140686: /*performer*/ return new String[] {"Reference"};
8075        case 1051302947: /*performerLinkId*/ return new String[] {"string"};
8076        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
8077        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
8078        case -934964668: /*reason*/ return new String[] {"string"};
8079        case -1557963239: /*reasonLinkId*/ return new String[] {"string"};
8080        case 3387378: /*note*/ return new String[] {"Annotation"};
8081        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
8082        default: return super.getTypesForProperty(hash, name);
8083        }
8084
8085      }
8086
8087      @Override
8088      public Base addChild(String name) throws FHIRException {
8089        if (name.equals("doNotPerform")) {
8090          throw new FHIRException("Cannot call addChild on a primitive type Contract.doNotPerform");
8091        }
8092        else if (name.equals("type")) {
8093          this.type = new CodeableConcept();
8094          return this.type;
8095        }
8096        else if (name.equals("subject")) {
8097          return addSubject();
8098        }
8099        else if (name.equals("intent")) {
8100          this.intent = new CodeableConcept();
8101          return this.intent;
8102        }
8103        else if (name.equals("linkId")) {
8104          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
8105        }
8106        else if (name.equals("status")) {
8107          this.status = new CodeableConcept();
8108          return this.status;
8109        }
8110        else if (name.equals("context")) {
8111          this.context = new Reference();
8112          return this.context;
8113        }
8114        else if (name.equals("contextLinkId")) {
8115          throw new FHIRException("Cannot call addChild on a primitive type Contract.contextLinkId");
8116        }
8117        else if (name.equals("occurrenceDateTime")) {
8118          this.occurrence = new DateTimeType();
8119          return this.occurrence;
8120        }
8121        else if (name.equals("occurrencePeriod")) {
8122          this.occurrence = new Period();
8123          return this.occurrence;
8124        }
8125        else if (name.equals("occurrenceTiming")) {
8126          this.occurrence = new Timing();
8127          return this.occurrence;
8128        }
8129        else if (name.equals("requester")) {
8130          return addRequester();
8131        }
8132        else if (name.equals("requesterLinkId")) {
8133          throw new FHIRException("Cannot call addChild on a primitive type Contract.requesterLinkId");
8134        }
8135        else if (name.equals("performerType")) {
8136          return addPerformerType();
8137        }
8138        else if (name.equals("performerRole")) {
8139          this.performerRole = new CodeableConcept();
8140          return this.performerRole;
8141        }
8142        else if (name.equals("performer")) {
8143          this.performer = new Reference();
8144          return this.performer;
8145        }
8146        else if (name.equals("performerLinkId")) {
8147          throw new FHIRException("Cannot call addChild on a primitive type Contract.performerLinkId");
8148        }
8149        else if (name.equals("reasonCode")) {
8150          return addReasonCode();
8151        }
8152        else if (name.equals("reasonReference")) {
8153          return addReasonReference();
8154        }
8155        else if (name.equals("reason")) {
8156          throw new FHIRException("Cannot call addChild on a primitive type Contract.reason");
8157        }
8158        else if (name.equals("reasonLinkId")) {
8159          throw new FHIRException("Cannot call addChild on a primitive type Contract.reasonLinkId");
8160        }
8161        else if (name.equals("note")) {
8162          return addNote();
8163        }
8164        else if (name.equals("securityLabelNumber")) {
8165          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
8166        }
8167        else
8168          return super.addChild(name);
8169      }
8170
8171      public ActionComponent copy() {
8172        ActionComponent dst = new ActionComponent();
8173        copyValues(dst);
8174        return dst;
8175      }
8176
8177      public void copyValues(ActionComponent dst) {
8178        super.copyValues(dst);
8179        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
8180        dst.type = type == null ? null : type.copy();
8181        if (subject != null) {
8182          dst.subject = new ArrayList<ActionSubjectComponent>();
8183          for (ActionSubjectComponent i : subject)
8184            dst.subject.add(i.copy());
8185        };
8186        dst.intent = intent == null ? null : intent.copy();
8187        if (linkId != null) {
8188          dst.linkId = new ArrayList<StringType>();
8189          for (StringType i : linkId)
8190            dst.linkId.add(i.copy());
8191        };
8192        dst.status = status == null ? null : status.copy();
8193        dst.context = context == null ? null : context.copy();
8194        if (contextLinkId != null) {
8195          dst.contextLinkId = new ArrayList<StringType>();
8196          for (StringType i : contextLinkId)
8197            dst.contextLinkId.add(i.copy());
8198        };
8199        dst.occurrence = occurrence == null ? null : occurrence.copy();
8200        if (requester != null) {
8201          dst.requester = new ArrayList<Reference>();
8202          for (Reference i : requester)
8203            dst.requester.add(i.copy());
8204        };
8205        if (requesterLinkId != null) {
8206          dst.requesterLinkId = new ArrayList<StringType>();
8207          for (StringType i : requesterLinkId)
8208            dst.requesterLinkId.add(i.copy());
8209        };
8210        if (performerType != null) {
8211          dst.performerType = new ArrayList<CodeableConcept>();
8212          for (CodeableConcept i : performerType)
8213            dst.performerType.add(i.copy());
8214        };
8215        dst.performerRole = performerRole == null ? null : performerRole.copy();
8216        dst.performer = performer == null ? null : performer.copy();
8217        if (performerLinkId != null) {
8218          dst.performerLinkId = new ArrayList<StringType>();
8219          for (StringType i : performerLinkId)
8220            dst.performerLinkId.add(i.copy());
8221        };
8222        if (reasonCode != null) {
8223          dst.reasonCode = new ArrayList<CodeableConcept>();
8224          for (CodeableConcept i : reasonCode)
8225            dst.reasonCode.add(i.copy());
8226        };
8227        if (reasonReference != null) {
8228          dst.reasonReference = new ArrayList<Reference>();
8229          for (Reference i : reasonReference)
8230            dst.reasonReference.add(i.copy());
8231        };
8232        if (reason != null) {
8233          dst.reason = new ArrayList<StringType>();
8234          for (StringType i : reason)
8235            dst.reason.add(i.copy());
8236        };
8237        if (reasonLinkId != null) {
8238          dst.reasonLinkId = new ArrayList<StringType>();
8239          for (StringType i : reasonLinkId)
8240            dst.reasonLinkId.add(i.copy());
8241        };
8242        if (note != null) {
8243          dst.note = new ArrayList<Annotation>();
8244          for (Annotation i : note)
8245            dst.note.add(i.copy());
8246        };
8247        if (securityLabelNumber != null) {
8248          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
8249          for (UnsignedIntType i : securityLabelNumber)
8250            dst.securityLabelNumber.add(i.copy());
8251        };
8252      }
8253
8254      @Override
8255      public boolean equalsDeep(Base other_) {
8256        if (!super.equalsDeep(other_))
8257          return false;
8258        if (!(other_ instanceof ActionComponent))
8259          return false;
8260        ActionComponent o = (ActionComponent) other_;
8261        return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
8262           && compareDeep(intent, o.intent, true) && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
8263           && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true) && compareDeep(occurrence, o.occurrence, true)
8264           && compareDeep(requester, o.requester, true) && compareDeep(requesterLinkId, o.requesterLinkId, true)
8265           && compareDeep(performerType, o.performerType, true) && compareDeep(performerRole, o.performerRole, true)
8266           && compareDeep(performer, o.performer, true) && compareDeep(performerLinkId, o.performerLinkId, true)
8267           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
8268           && compareDeep(reason, o.reason, true) && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
8269           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
8270      }
8271
8272      @Override
8273      public boolean equalsShallow(Base other_) {
8274        if (!super.equalsShallow(other_))
8275          return false;
8276        if (!(other_ instanceof ActionComponent))
8277          return false;
8278        ActionComponent o = (ActionComponent) other_;
8279        return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true) && compareValues(contextLinkId, o.contextLinkId, true)
8280           && compareValues(requesterLinkId, o.requesterLinkId, true) && compareValues(performerLinkId, o.performerLinkId, true)
8281           && compareValues(reason, o.reason, true) && compareValues(reasonLinkId, o.reasonLinkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
8282          ;
8283      }
8284
8285      public boolean isEmpty() {
8286        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject
8287          , intent, linkId, status, context, contextLinkId, occurrence, requester, requesterLinkId
8288          , performerType, performerRole, performer, performerLinkId, reasonCode, reasonReference
8289          , reason, reasonLinkId, note, securityLabelNumber);
8290      }
8291
8292  public String fhirType() {
8293    return "Contract.term.action";
8294
8295  }
8296
8297  }
8298
8299    @Block()
8300    public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
8301        /**
8302         * The entity the action is performed or not performed on or for.
8303         */
8304        @Child(name = "reference", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class, Device.class, Group.class, Organization.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8305        @Description(shortDefinition="Entity of the action", formalDefinition="The entity the action is performed or not performed on or for." )
8306        protected List<Reference> reference;
8307        /**
8308         * The actual objects that are the target of the reference (The entity the action is performed or not performed on or for.)
8309         */
8310        protected List<Resource> referenceTarget;
8311
8312
8313        /**
8314         * Role type of agent assigned roles in this Contract.
8315         */
8316        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8317        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
8318        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
8319        protected CodeableConcept role;
8320
8321        private static final long serialVersionUID = 128949255L;
8322
8323    /**
8324     * Constructor
8325     */
8326      public ActionSubjectComponent() {
8327        super();
8328      }
8329
8330        /**
8331         * @return {@link #reference} (The entity the action is performed or not performed on or for.)
8332         */
8333        public List<Reference> getReference() { 
8334          if (this.reference == null)
8335            this.reference = new ArrayList<Reference>();
8336          return this.reference;
8337        }
8338
8339        /**
8340         * @return Returns a reference to <code>this</code> for easy method chaining
8341         */
8342        public ActionSubjectComponent setReference(List<Reference> theReference) { 
8343          this.reference = theReference;
8344          return this;
8345        }
8346
8347        public boolean hasReference() { 
8348          if (this.reference == null)
8349            return false;
8350          for (Reference item : this.reference)
8351            if (!item.isEmpty())
8352              return true;
8353          return false;
8354        }
8355
8356        public Reference addReference() { //3
8357          Reference t = new Reference();
8358          if (this.reference == null)
8359            this.reference = new ArrayList<Reference>();
8360          this.reference.add(t);
8361          return t;
8362        }
8363
8364        public ActionSubjectComponent addReference(Reference t) { //3
8365          if (t == null)
8366            return this;
8367          if (this.reference == null)
8368            this.reference = new ArrayList<Reference>();
8369          this.reference.add(t);
8370          return this;
8371        }
8372
8373        /**
8374         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist
8375         */
8376        public Reference getReferenceFirstRep() { 
8377          if (getReference().isEmpty()) {
8378            addReference();
8379          }
8380          return getReference().get(0);
8381        }
8382
8383        /**
8384         * @deprecated Use Reference#setResource(IBaseResource) instead
8385         */
8386        @Deprecated
8387        public List<Resource> getReferenceTarget() { 
8388          if (this.referenceTarget == null)
8389            this.referenceTarget = new ArrayList<Resource>();
8390          return this.referenceTarget;
8391        }
8392
8393        /**
8394         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
8395         */
8396        public CodeableConcept getRole() { 
8397          if (this.role == null)
8398            if (Configuration.errorOnAutoCreate())
8399              throw new Error("Attempt to auto-create ActionSubjectComponent.role");
8400            else if (Configuration.doAutoCreate())
8401              this.role = new CodeableConcept(); // cc
8402          return this.role;
8403        }
8404
8405        public boolean hasRole() { 
8406          return this.role != null && !this.role.isEmpty();
8407        }
8408
8409        /**
8410         * @param value {@link #role} (Role type of agent assigned roles in this Contract.)
8411         */
8412        public ActionSubjectComponent setRole(CodeableConcept value) { 
8413          this.role = value;
8414          return this;
8415        }
8416
8417        protected void listChildren(List<Property> children) {
8418          super.listChildren(children);
8419          children.add(new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE, reference));
8420          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
8421        }
8422
8423        @Override
8424        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8425          switch (_hash) {
8426          case -925155509: /*reference*/  return new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE, reference);
8427          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role);
8428          default: return super.getNamedProperty(_hash, _name, _checkValid);
8429          }
8430
8431        }
8432
8433      @Override
8434      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8435        switch (hash) {
8436        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
8437        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
8438        default: return super.getProperty(hash, name, checkValid);
8439        }
8440
8441      }
8442
8443      @Override
8444      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8445        switch (hash) {
8446        case -925155509: // reference
8447          this.getReference().add(castToReference(value)); // Reference
8448          return value;
8449        case 3506294: // role
8450          this.role = castToCodeableConcept(value); // CodeableConcept
8451          return value;
8452        default: return super.setProperty(hash, name, value);
8453        }
8454
8455      }
8456
8457      @Override
8458      public Base setProperty(String name, Base value) throws FHIRException {
8459        if (name.equals("reference")) {
8460          this.getReference().add(castToReference(value));
8461        } else if (name.equals("role")) {
8462          this.role = castToCodeableConcept(value); // CodeableConcept
8463        } else
8464          return super.setProperty(name, value);
8465        return value;
8466      }
8467
8468      @Override
8469      public Base makeProperty(int hash, String name) throws FHIRException {
8470        switch (hash) {
8471        case -925155509:  return addReference(); 
8472        case 3506294:  return getRole(); 
8473        default: return super.makeProperty(hash, name);
8474        }
8475
8476      }
8477
8478      @Override
8479      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8480        switch (hash) {
8481        case -925155509: /*reference*/ return new String[] {"Reference"};
8482        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
8483        default: return super.getTypesForProperty(hash, name);
8484        }
8485
8486      }
8487
8488      @Override
8489      public Base addChild(String name) throws FHIRException {
8490        if (name.equals("reference")) {
8491          return addReference();
8492        }
8493        else if (name.equals("role")) {
8494          this.role = new CodeableConcept();
8495          return this.role;
8496        }
8497        else
8498          return super.addChild(name);
8499      }
8500
8501      public ActionSubjectComponent copy() {
8502        ActionSubjectComponent dst = new ActionSubjectComponent();
8503        copyValues(dst);
8504        return dst;
8505      }
8506
8507      public void copyValues(ActionSubjectComponent dst) {
8508        super.copyValues(dst);
8509        if (reference != null) {
8510          dst.reference = new ArrayList<Reference>();
8511          for (Reference i : reference)
8512            dst.reference.add(i.copy());
8513        };
8514        dst.role = role == null ? null : role.copy();
8515      }
8516
8517      @Override
8518      public boolean equalsDeep(Base other_) {
8519        if (!super.equalsDeep(other_))
8520          return false;
8521        if (!(other_ instanceof ActionSubjectComponent))
8522          return false;
8523        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8524        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
8525      }
8526
8527      @Override
8528      public boolean equalsShallow(Base other_) {
8529        if (!super.equalsShallow(other_))
8530          return false;
8531        if (!(other_ instanceof ActionSubjectComponent))
8532          return false;
8533        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8534        return true;
8535      }
8536
8537      public boolean isEmpty() {
8538        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
8539      }
8540
8541  public String fhirType() {
8542    return "Contract.term.action.subject";
8543
8544  }
8545
8546  }
8547
8548    @Block()
8549    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
8550        /**
8551         * Role of this Contract signer, e.g. notary, grantee.
8552         */
8553        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
8554        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
8555        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
8556        protected Coding type;
8557
8558        /**
8559         * Party which is a signator to this Contract.
8560         */
8561        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
8562        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
8563        protected Reference party;
8564
8565        /**
8566         * The actual object that is the target of the reference (Party which is a signator to this Contract.)
8567         */
8568        protected Resource partyTarget;
8569
8570        /**
8571         * Legally binding Contract DSIG signature contents in Base64.
8572         */
8573        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8574        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
8575        protected List<Signature> signature;
8576
8577        private static final long serialVersionUID = 1948139228L;
8578
8579    /**
8580     * Constructor
8581     */
8582      public SignatoryComponent() {
8583        super();
8584      }
8585
8586    /**
8587     * Constructor
8588     */
8589      public SignatoryComponent(Coding type, Reference party) {
8590        super();
8591        this.type = type;
8592        this.party = party;
8593      }
8594
8595        /**
8596         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8597         */
8598        public Coding getType() { 
8599          if (this.type == null)
8600            if (Configuration.errorOnAutoCreate())
8601              throw new Error("Attempt to auto-create SignatoryComponent.type");
8602            else if (Configuration.doAutoCreate())
8603              this.type = new Coding(); // cc
8604          return this.type;
8605        }
8606
8607        public boolean hasType() { 
8608          return this.type != null && !this.type.isEmpty();
8609        }
8610
8611        /**
8612         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8613         */
8614        public SignatoryComponent setType(Coding value) { 
8615          this.type = value;
8616          return this;
8617        }
8618
8619        /**
8620         * @return {@link #party} (Party which is a signator to this Contract.)
8621         */
8622        public Reference getParty() { 
8623          if (this.party == null)
8624            if (Configuration.errorOnAutoCreate())
8625              throw new Error("Attempt to auto-create SignatoryComponent.party");
8626            else if (Configuration.doAutoCreate())
8627              this.party = new Reference(); // cc
8628          return this.party;
8629        }
8630
8631        public boolean hasParty() { 
8632          return this.party != null && !this.party.isEmpty();
8633        }
8634
8635        /**
8636         * @param value {@link #party} (Party which is a signator to this Contract.)
8637         */
8638        public SignatoryComponent setParty(Reference value) { 
8639          this.party = value;
8640          return this;
8641        }
8642
8643        /**
8644         * @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.)
8645         */
8646        public Resource getPartyTarget() { 
8647          return this.partyTarget;
8648        }
8649
8650        /**
8651         * @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.)
8652         */
8653        public SignatoryComponent setPartyTarget(Resource value) { 
8654          this.partyTarget = value;
8655          return this;
8656        }
8657
8658        /**
8659         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
8660         */
8661        public List<Signature> getSignature() { 
8662          if (this.signature == null)
8663            this.signature = new ArrayList<Signature>();
8664          return this.signature;
8665        }
8666
8667        /**
8668         * @return Returns a reference to <code>this</code> for easy method chaining
8669         */
8670        public SignatoryComponent setSignature(List<Signature> theSignature) { 
8671          this.signature = theSignature;
8672          return this;
8673        }
8674
8675        public boolean hasSignature() { 
8676          if (this.signature == null)
8677            return false;
8678          for (Signature item : this.signature)
8679            if (!item.isEmpty())
8680              return true;
8681          return false;
8682        }
8683
8684        public Signature addSignature() { //3
8685          Signature t = new Signature();
8686          if (this.signature == null)
8687            this.signature = new ArrayList<Signature>();
8688          this.signature.add(t);
8689          return t;
8690        }
8691
8692        public SignatoryComponent addSignature(Signature t) { //3
8693          if (t == null)
8694            return this;
8695          if (this.signature == null)
8696            this.signature = new ArrayList<Signature>();
8697          this.signature.add(t);
8698          return this;
8699        }
8700
8701        /**
8702         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist
8703         */
8704        public Signature getSignatureFirstRep() { 
8705          if (getSignature().isEmpty()) {
8706            addSignature();
8707          }
8708          return getSignature().get(0);
8709        }
8710
8711        protected void listChildren(List<Property> children) {
8712          super.listChildren(children);
8713          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
8714          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
8715          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
8716        }
8717
8718        @Override
8719        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8720          switch (_hash) {
8721          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
8722          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
8723          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
8724          default: return super.getNamedProperty(_hash, _name, _checkValid);
8725          }
8726
8727        }
8728
8729      @Override
8730      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8731        switch (hash) {
8732        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8733        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
8734        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
8735        default: return super.getProperty(hash, name, checkValid);
8736        }
8737
8738      }
8739
8740      @Override
8741      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8742        switch (hash) {
8743        case 3575610: // type
8744          this.type = castToCoding(value); // Coding
8745          return value;
8746        case 106437350: // party
8747          this.party = castToReference(value); // Reference
8748          return value;
8749        case 1073584312: // signature
8750          this.getSignature().add(castToSignature(value)); // Signature
8751          return value;
8752        default: return super.setProperty(hash, name, value);
8753        }
8754
8755      }
8756
8757      @Override
8758      public Base setProperty(String name, Base value) throws FHIRException {
8759        if (name.equals("type")) {
8760          this.type = castToCoding(value); // Coding
8761        } else if (name.equals("party")) {
8762          this.party = castToReference(value); // Reference
8763        } else if (name.equals("signature")) {
8764          this.getSignature().add(castToSignature(value));
8765        } else
8766          return super.setProperty(name, value);
8767        return value;
8768      }
8769
8770      @Override
8771      public Base makeProperty(int hash, String name) throws FHIRException {
8772        switch (hash) {
8773        case 3575610:  return getType(); 
8774        case 106437350:  return getParty(); 
8775        case 1073584312:  return addSignature(); 
8776        default: return super.makeProperty(hash, name);
8777        }
8778
8779      }
8780
8781      @Override
8782      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8783        switch (hash) {
8784        case 3575610: /*type*/ return new String[] {"Coding"};
8785        case 106437350: /*party*/ return new String[] {"Reference"};
8786        case 1073584312: /*signature*/ return new String[] {"Signature"};
8787        default: return super.getTypesForProperty(hash, name);
8788        }
8789
8790      }
8791
8792      @Override
8793      public Base addChild(String name) throws FHIRException {
8794        if (name.equals("type")) {
8795          this.type = new Coding();
8796          return this.type;
8797        }
8798        else if (name.equals("party")) {
8799          this.party = new Reference();
8800          return this.party;
8801        }
8802        else if (name.equals("signature")) {
8803          return addSignature();
8804        }
8805        else
8806          return super.addChild(name);
8807      }
8808
8809      public SignatoryComponent copy() {
8810        SignatoryComponent dst = new SignatoryComponent();
8811        copyValues(dst);
8812        return dst;
8813      }
8814
8815      public void copyValues(SignatoryComponent dst) {
8816        super.copyValues(dst);
8817        dst.type = type == null ? null : type.copy();
8818        dst.party = party == null ? null : party.copy();
8819        if (signature != null) {
8820          dst.signature = new ArrayList<Signature>();
8821          for (Signature i : signature)
8822            dst.signature.add(i.copy());
8823        };
8824      }
8825
8826      @Override
8827      public boolean equalsDeep(Base other_) {
8828        if (!super.equalsDeep(other_))
8829          return false;
8830        if (!(other_ instanceof SignatoryComponent))
8831          return false;
8832        SignatoryComponent o = (SignatoryComponent) other_;
8833        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
8834          ;
8835      }
8836
8837      @Override
8838      public boolean equalsShallow(Base other_) {
8839        if (!super.equalsShallow(other_))
8840          return false;
8841        if (!(other_ instanceof SignatoryComponent))
8842          return false;
8843        SignatoryComponent o = (SignatoryComponent) other_;
8844        return true;
8845      }
8846
8847      public boolean isEmpty() {
8848        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
8849      }
8850
8851  public String fhirType() {
8852    return "Contract.signer";
8853
8854  }
8855
8856  }
8857
8858    @Block()
8859    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8860        /**
8861         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
8862         */
8863        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8864        @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." )
8865        protected Type content;
8866
8867        private static final long serialVersionUID = -1763459053L;
8868
8869    /**
8870     * Constructor
8871     */
8872      public FriendlyLanguageComponent() {
8873        super();
8874      }
8875
8876    /**
8877     * Constructor
8878     */
8879      public FriendlyLanguageComponent(Type content) {
8880        super();
8881        this.content = content;
8882      }
8883
8884        /**
8885         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8886         */
8887        public Type getContent() { 
8888          return this.content;
8889        }
8890
8891        /**
8892         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8893         */
8894        public Attachment getContentAttachment() throws FHIRException { 
8895          if (this.content == null)
8896            this.content = new Attachment();
8897          if (!(this.content instanceof Attachment))
8898            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8899          return (Attachment) this.content;
8900        }
8901
8902        public boolean hasContentAttachment() { 
8903          return this != null && this.content instanceof Attachment;
8904        }
8905
8906        /**
8907         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8908         */
8909        public Reference getContentReference() throws FHIRException { 
8910          if (this.content == null)
8911            this.content = new Reference();
8912          if (!(this.content instanceof Reference))
8913            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8914          return (Reference) this.content;
8915        }
8916
8917        public boolean hasContentReference() { 
8918          return this != null && this.content instanceof Reference;
8919        }
8920
8921        public boolean hasContent() { 
8922          return this.content != null && !this.content.isEmpty();
8923        }
8924
8925        /**
8926         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8927         */
8928        public FriendlyLanguageComponent setContent(Type value) { 
8929          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8930            throw new Error("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
8931          this.content = value;
8932          return this;
8933        }
8934
8935        protected void listChildren(List<Property> children) {
8936          super.listChildren(children);
8937          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));
8938        }
8939
8940        @Override
8941        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8942          switch (_hash) {
8943          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);
8944          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);
8945          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);
8946          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);
8947          default: return super.getNamedProperty(_hash, _name, _checkValid);
8948          }
8949
8950        }
8951
8952      @Override
8953      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8954        switch (hash) {
8955        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
8956        default: return super.getProperty(hash, name, checkValid);
8957        }
8958
8959      }
8960
8961      @Override
8962      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8963        switch (hash) {
8964        case 951530617: // content
8965          this.content = castToType(value); // Type
8966          return value;
8967        default: return super.setProperty(hash, name, value);
8968        }
8969
8970      }
8971
8972      @Override
8973      public Base setProperty(String name, Base value) throws FHIRException {
8974        if (name.equals("content[x]")) {
8975          this.content = castToType(value); // Type
8976        } else
8977          return super.setProperty(name, value);
8978        return value;
8979      }
8980
8981      @Override
8982      public Base makeProperty(int hash, String name) throws FHIRException {
8983        switch (hash) {
8984        case 264548711:  return getContent(); 
8985        case 951530617:  return getContent(); 
8986        default: return super.makeProperty(hash, name);
8987        }
8988
8989      }
8990
8991      @Override
8992      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8993        switch (hash) {
8994        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8995        default: return super.getTypesForProperty(hash, name);
8996        }
8997
8998      }
8999
9000      @Override
9001      public Base addChild(String name) throws FHIRException {
9002        if (name.equals("contentAttachment")) {
9003          this.content = new Attachment();
9004          return this.content;
9005        }
9006        else if (name.equals("contentReference")) {
9007          this.content = new Reference();
9008          return this.content;
9009        }
9010        else
9011          return super.addChild(name);
9012      }
9013
9014      public FriendlyLanguageComponent copy() {
9015        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
9016        copyValues(dst);
9017        return dst;
9018      }
9019
9020      public void copyValues(FriendlyLanguageComponent dst) {
9021        super.copyValues(dst);
9022        dst.content = content == null ? null : content.copy();
9023      }
9024
9025      @Override
9026      public boolean equalsDeep(Base other_) {
9027        if (!super.equalsDeep(other_))
9028          return false;
9029        if (!(other_ instanceof FriendlyLanguageComponent))
9030          return false;
9031        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
9032        return compareDeep(content, o.content, true);
9033      }
9034
9035      @Override
9036      public boolean equalsShallow(Base other_) {
9037        if (!super.equalsShallow(other_))
9038          return false;
9039        if (!(other_ instanceof FriendlyLanguageComponent))
9040          return false;
9041        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
9042        return true;
9043      }
9044
9045      public boolean isEmpty() {
9046        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9047      }
9048
9049  public String fhirType() {
9050    return "Contract.friendly";
9051
9052  }
9053
9054  }
9055
9056    @Block()
9057    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
9058        /**
9059         * Contract legal text in human renderable form.
9060         */
9061        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
9062        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
9063        protected Type content;
9064
9065        private static final long serialVersionUID = -1763459053L;
9066
9067    /**
9068     * Constructor
9069     */
9070      public LegalLanguageComponent() {
9071        super();
9072      }
9073
9074    /**
9075     * Constructor
9076     */
9077      public LegalLanguageComponent(Type content) {
9078        super();
9079        this.content = content;
9080      }
9081
9082        /**
9083         * @return {@link #content} (Contract legal text in human renderable form.)
9084         */
9085        public Type getContent() { 
9086          return this.content;
9087        }
9088
9089        /**
9090         * @return {@link #content} (Contract legal text in human renderable form.)
9091         */
9092        public Attachment getContentAttachment() throws FHIRException { 
9093          if (this.content == null)
9094            this.content = new Attachment();
9095          if (!(this.content instanceof Attachment))
9096            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
9097          return (Attachment) this.content;
9098        }
9099
9100        public boolean hasContentAttachment() { 
9101          return this != null && this.content instanceof Attachment;
9102        }
9103
9104        /**
9105         * @return {@link #content} (Contract legal text in human renderable form.)
9106         */
9107        public Reference getContentReference() throws FHIRException { 
9108          if (this.content == null)
9109            this.content = new Reference();
9110          if (!(this.content instanceof Reference))
9111            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
9112          return (Reference) this.content;
9113        }
9114
9115        public boolean hasContentReference() { 
9116          return this != null && this.content instanceof Reference;
9117        }
9118
9119        public boolean hasContent() { 
9120          return this.content != null && !this.content.isEmpty();
9121        }
9122
9123        /**
9124         * @param value {@link #content} (Contract legal text in human renderable form.)
9125         */
9126        public LegalLanguageComponent setContent(Type value) { 
9127          if (value != null && !(value instanceof Attachment || value instanceof Reference))
9128            throw new Error("Not the right type for Contract.legal.content[x]: "+value.fhirType());
9129          this.content = value;
9130          return this;
9131        }
9132
9133        protected void listChildren(List<Property> children) {
9134          super.listChildren(children);
9135          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
9136        }
9137
9138        @Override
9139        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9140          switch (_hash) {
9141          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
9142          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
9143          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
9144          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
9145          default: return super.getNamedProperty(_hash, _name, _checkValid);
9146          }
9147
9148        }
9149
9150      @Override
9151      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9152        switch (hash) {
9153        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
9154        default: return super.getProperty(hash, name, checkValid);
9155        }
9156
9157      }
9158
9159      @Override
9160      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9161        switch (hash) {
9162        case 951530617: // content
9163          this.content = castToType(value); // Type
9164          return value;
9165        default: return super.setProperty(hash, name, value);
9166        }
9167
9168      }
9169
9170      @Override
9171      public Base setProperty(String name, Base value) throws FHIRException {
9172        if (name.equals("content[x]")) {
9173          this.content = castToType(value); // Type
9174        } else
9175          return super.setProperty(name, value);
9176        return value;
9177      }
9178
9179      @Override
9180      public Base makeProperty(int hash, String name) throws FHIRException {
9181        switch (hash) {
9182        case 264548711:  return getContent(); 
9183        case 951530617:  return getContent(); 
9184        default: return super.makeProperty(hash, name);
9185        }
9186
9187      }
9188
9189      @Override
9190      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9191        switch (hash) {
9192        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
9193        default: return super.getTypesForProperty(hash, name);
9194        }
9195
9196      }
9197
9198      @Override
9199      public Base addChild(String name) throws FHIRException {
9200        if (name.equals("contentAttachment")) {
9201          this.content = new Attachment();
9202          return this.content;
9203        }
9204        else if (name.equals("contentReference")) {
9205          this.content = new Reference();
9206          return this.content;
9207        }
9208        else
9209          return super.addChild(name);
9210      }
9211
9212      public LegalLanguageComponent copy() {
9213        LegalLanguageComponent dst = new LegalLanguageComponent();
9214        copyValues(dst);
9215        return dst;
9216      }
9217
9218      public void copyValues(LegalLanguageComponent dst) {
9219        super.copyValues(dst);
9220        dst.content = content == null ? null : content.copy();
9221      }
9222
9223      @Override
9224      public boolean equalsDeep(Base other_) {
9225        if (!super.equalsDeep(other_))
9226          return false;
9227        if (!(other_ instanceof LegalLanguageComponent))
9228          return false;
9229        LegalLanguageComponent o = (LegalLanguageComponent) other_;
9230        return compareDeep(content, o.content, true);
9231      }
9232
9233      @Override
9234      public boolean equalsShallow(Base other_) {
9235        if (!super.equalsShallow(other_))
9236          return false;
9237        if (!(other_ instanceof LegalLanguageComponent))
9238          return false;
9239        LegalLanguageComponent o = (LegalLanguageComponent) other_;
9240        return true;
9241      }
9242
9243      public boolean isEmpty() {
9244        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9245      }
9246
9247  public String fhirType() {
9248    return "Contract.legal";
9249
9250  }
9251
9252  }
9253
9254    @Block()
9255    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
9256        /**
9257         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
9258         */
9259        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
9260        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
9261        protected Type content;
9262
9263        private static final long serialVersionUID = -1763459053L;
9264
9265    /**
9266     * Constructor
9267     */
9268      public ComputableLanguageComponent() {
9269        super();
9270      }
9271
9272    /**
9273     * Constructor
9274     */
9275      public ComputableLanguageComponent(Type content) {
9276        super();
9277        this.content = content;
9278      }
9279
9280        /**
9281         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9282         */
9283        public Type getContent() { 
9284          return this.content;
9285        }
9286
9287        /**
9288         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9289         */
9290        public Attachment getContentAttachment() throws FHIRException { 
9291          if (this.content == null)
9292            this.content = new Attachment();
9293          if (!(this.content instanceof Attachment))
9294            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
9295          return (Attachment) this.content;
9296        }
9297
9298        public boolean hasContentAttachment() { 
9299          return this != null && this.content instanceof Attachment;
9300        }
9301
9302        /**
9303         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9304         */
9305        public Reference getContentReference() throws FHIRException { 
9306          if (this.content == null)
9307            this.content = new Reference();
9308          if (!(this.content instanceof Reference))
9309            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
9310          return (Reference) this.content;
9311        }
9312
9313        public boolean hasContentReference() { 
9314          return this != null && this.content instanceof Reference;
9315        }
9316
9317        public boolean hasContent() { 
9318          return this.content != null && !this.content.isEmpty();
9319        }
9320
9321        /**
9322         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9323         */
9324        public ComputableLanguageComponent setContent(Type value) { 
9325          if (value != null && !(value instanceof Attachment || value instanceof Reference))
9326            throw new Error("Not the right type for Contract.rule.content[x]: "+value.fhirType());
9327          this.content = value;
9328          return this;
9329        }
9330
9331        protected void listChildren(List<Property> children) {
9332          super.listChildren(children);
9333          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));
9334        }
9335
9336        @Override
9337        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9338          switch (_hash) {
9339          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);
9340          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);
9341          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);
9342          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);
9343          default: return super.getNamedProperty(_hash, _name, _checkValid);
9344          }
9345
9346        }
9347
9348      @Override
9349      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9350        switch (hash) {
9351        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
9352        default: return super.getProperty(hash, name, checkValid);
9353        }
9354
9355      }
9356
9357      @Override
9358      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9359        switch (hash) {
9360        case 951530617: // content
9361          this.content = castToType(value); // Type
9362          return value;
9363        default: return super.setProperty(hash, name, value);
9364        }
9365
9366      }
9367
9368      @Override
9369      public Base setProperty(String name, Base value) throws FHIRException {
9370        if (name.equals("content[x]")) {
9371          this.content = castToType(value); // Type
9372        } else
9373          return super.setProperty(name, value);
9374        return value;
9375      }
9376
9377      @Override
9378      public Base makeProperty(int hash, String name) throws FHIRException {
9379        switch (hash) {
9380        case 264548711:  return getContent(); 
9381        case 951530617:  return getContent(); 
9382        default: return super.makeProperty(hash, name);
9383        }
9384
9385      }
9386
9387      @Override
9388      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9389        switch (hash) {
9390        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
9391        default: return super.getTypesForProperty(hash, name);
9392        }
9393
9394      }
9395
9396      @Override
9397      public Base addChild(String name) throws FHIRException {
9398        if (name.equals("contentAttachment")) {
9399          this.content = new Attachment();
9400          return this.content;
9401        }
9402        else if (name.equals("contentReference")) {
9403          this.content = new Reference();
9404          return this.content;
9405        }
9406        else
9407          return super.addChild(name);
9408      }
9409
9410      public ComputableLanguageComponent copy() {
9411        ComputableLanguageComponent dst = new ComputableLanguageComponent();
9412        copyValues(dst);
9413        return dst;
9414      }
9415
9416      public void copyValues(ComputableLanguageComponent dst) {
9417        super.copyValues(dst);
9418        dst.content = content == null ? null : content.copy();
9419      }
9420
9421      @Override
9422      public boolean equalsDeep(Base other_) {
9423        if (!super.equalsDeep(other_))
9424          return false;
9425        if (!(other_ instanceof ComputableLanguageComponent))
9426          return false;
9427        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9428        return compareDeep(content, o.content, true);
9429      }
9430
9431      @Override
9432      public boolean equalsShallow(Base other_) {
9433        if (!super.equalsShallow(other_))
9434          return false;
9435        if (!(other_ instanceof ComputableLanguageComponent))
9436          return false;
9437        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9438        return true;
9439      }
9440
9441      public boolean isEmpty() {
9442        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9443      }
9444
9445  public String fhirType() {
9446    return "Contract.rule";
9447
9448  }
9449
9450  }
9451
9452    /**
9453     * Unique identifier for this Contract or a derivative that references a Source Contract.
9454     */
9455    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9456    @Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract or a derivative that references a Source Contract." )
9457    protected List<Identifier> identifier;
9458
9459    /**
9460     * Canonical identifier for this contract, represented as a URI (globally unique).
9461     */
9462    @Child(name = "url", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
9463    @Description(shortDefinition="Basal definition", formalDefinition="Canonical identifier for this contract, represented as a URI (globally unique)." )
9464    protected UriType url;
9465
9466    /**
9467     * An edition identifier used for business purposes to label business significant variants.
9468     */
9469    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
9470    @Description(shortDefinition="Business edition", formalDefinition="An edition identifier used for business purposes to label business significant variants." )
9471    protected StringType version;
9472
9473    /**
9474     * The status of the resource instance.
9475     */
9476    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
9477    @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." )
9478    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-status")
9479    protected Enumeration<ContractStatus> status;
9480
9481    /**
9482     * Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.
9483     */
9484    @Child(name = "legalState", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
9485    @Description(shortDefinition="Negotiation status", formalDefinition="Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement." )
9486    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-legalstate")
9487    protected CodeableConcept legalState;
9488
9489    /**
9490     * The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.
9491     */
9492    @Child(name = "instantiatesCanonical", type = {Contract.class}, order=5, min=0, max=1, modifier=false, summary=false)
9493    @Description(shortDefinition="Source Contract Definition", formalDefinition="The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract." )
9494    protected Reference instantiatesCanonical;
9495
9496    /**
9497     * The actual object that is the target of the reference (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9498     */
9499    protected Contract instantiatesCanonicalTarget;
9500
9501    /**
9502     * The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9503     */
9504    @Child(name = "instantiatesUri", type = {UriType.class}, order=6, min=0, max=1, modifier=false, summary=false)
9505    @Description(shortDefinition="External Contract Definition", formalDefinition="The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract." )
9506    protected UriType instantiatesUri;
9507
9508    /**
9509     * The minimal content derived from the basal information source at a specific stage in its lifecycle.
9510     */
9511    @Child(name = "contentDerivative", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9512    @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." )
9513    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-content-derivative")
9514    protected CodeableConcept contentDerivative;
9515
9516    /**
9517     * When this  Contract was issued.
9518     */
9519    @Child(name = "issued", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
9520    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
9521    protected DateTimeType issued;
9522
9523    /**
9524     * Relevant time or time-period when this Contract is applicable.
9525     */
9526    @Child(name = "applies", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
9527    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
9528    protected Period applies;
9529
9530    /**
9531     * Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.
9532     */
9533    @Child(name = "expirationType", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false)
9534    @Description(shortDefinition="Contract cessation cause", formalDefinition="Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract." )
9535    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-expiration-type")
9536    protected CodeableConcept expirationType;
9537
9538    /**
9539     * The target entity impacted by or of interest to parties to the agreement.
9540     */
9541    @Child(name = "subject", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9542    @Description(shortDefinition="Contract Target Entity", formalDefinition="The target entity impacted by or of interest to parties to the agreement." )
9543    protected List<Reference> subject;
9544    /**
9545     * The actual objects that are the target of the reference (The target entity impacted by or of interest to parties to the agreement.)
9546     */
9547    protected List<Resource> subjectTarget;
9548
9549
9550    /**
9551     * 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.
9552     */
9553    @Child(name = "authority", type = {Organization.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9554    @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." )
9555    protected List<Reference> authority;
9556    /**
9557     * 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.)
9558     */
9559    protected List<Organization> authorityTarget;
9560
9561
9562    /**
9563     * 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.
9564     */
9565    @Child(name = "domain", type = {Location.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9566    @Description(shortDefinition="A sphere of control governed by an authoritative jurisdiction, organization, or person", 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." )
9567    protected List<Reference> domain;
9568    /**
9569     * 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.)
9570     */
9571    protected List<Location> domainTarget;
9572
9573
9574    /**
9575     * Sites in which the contract is complied with,  exercised, or in force.
9576     */
9577    @Child(name = "site", type = {Location.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9578    @Description(shortDefinition="Specific Location", formalDefinition="Sites in which the contract is complied with,  exercised, or in force." )
9579    protected List<Reference> site;
9580    /**
9581     * The actual objects that are the target of the reference (Sites in which the contract is complied with,  exercised, or in force.)
9582     */
9583    protected List<Location> siteTarget;
9584
9585
9586    /**
9587     * A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
9588     */
9589    @Child(name = "name", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
9590    @Description(shortDefinition="Computer friendly designation", formalDefinition="A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
9591    protected StringType name;
9592
9593    /**
9594     * A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
9595     */
9596    @Child(name = "title", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=true)
9597    @Description(shortDefinition="Human Friendly name", formalDefinition="A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content." )
9598    protected StringType title;
9599
9600    /**
9601     * An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
9602     */
9603    @Child(name = "subtitle", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
9604    @Description(shortDefinition="Subordinate Friendly name", formalDefinition="An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content." )
9605    protected StringType subtitle;
9606
9607    /**
9608     * Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.
9609     */
9610    @Child(name = "alias", type = {StringType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9611    @Description(shortDefinition="Acronym or short name", formalDefinition="Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation." )
9612    protected List<StringType> alias;
9613
9614    /**
9615     * The individual or organization that authored the Contract definition, derivative, or instance in any legal state.
9616     */
9617    @Child(name = "author", type = {Patient.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
9618    @Description(shortDefinition="Source of Contract", formalDefinition="The individual or organization that authored the Contract definition, derivative, or instance in any legal state." )
9619    protected Reference author;
9620
9621    /**
9622     * The actual object that is the target of the reference (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
9623     */
9624    protected Resource authorTarget;
9625
9626    /**
9627     * A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.
9628     */
9629    @Child(name = "scope", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
9630    @Description(shortDefinition="Range of Legal Concerns", formalDefinition="A selector of legal concerns for this Contract definition, derivative, or instance in any legal state." )
9631    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-scope")
9632    protected CodeableConcept scope;
9633
9634    /**
9635     * Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.
9636     */
9637    @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=21, min=0, max=1, modifier=false, summary=false)
9638    @Description(shortDefinition="Focus of contract interest", formalDefinition="Narrows the range of legal concerns to focus on the achievement of specific contractual objectives." )
9639    protected Type topic;
9640
9641    /**
9642     * A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.
9643     */
9644    @Child(name = "type", type = {CodeableConcept.class}, order=22, min=0, max=1, modifier=false, summary=true)
9645    @Description(shortDefinition="Legal instrument category", formalDefinition="A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract." )
9646    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-type")
9647    protected CodeableConcept type;
9648
9649    /**
9650     * Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.
9651     */
9652    @Child(name = "subType", type = {CodeableConcept.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9653    @Description(shortDefinition="Subtype within the context of type", formalDefinition="Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope." )
9654    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-subtype")
9655    protected List<CodeableConcept> subType;
9656
9657    /**
9658     * Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.
9659     */
9660    @Child(name = "contentDefinition", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
9661    @Description(shortDefinition="Contract precursor content", formalDefinition="Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract." )
9662    protected ContentDefinitionComponent contentDefinition;
9663
9664    /**
9665     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
9666     */
9667    @Child(name = "term", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9668    @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." )
9669    protected List<TermComponent> term;
9670
9671    /**
9672     * Information that may be needed by/relevant to the performer in their execution of this term action.
9673     */
9674    @Child(name = "supportingInfo", type = {Reference.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9675    @Description(shortDefinition="Extra Information", formalDefinition="Information that may be needed by/relevant to the performer in their execution of this term action." )
9676    protected List<Reference> supportingInfo;
9677    /**
9678     * The actual objects that are the target of the reference (Information that may be needed by/relevant to the performer in their execution of this term action.)
9679     */
9680    protected List<Resource> supportingInfoTarget;
9681
9682
9683    /**
9684     * Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.
9685     */
9686    @Child(name = "relevantHistory", type = {Provenance.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9687    @Description(shortDefinition="Key event in Contract History", formalDefinition="Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity." )
9688    protected List<Reference> relevantHistory;
9689    /**
9690     * The actual objects that are the target of the reference (Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
9691     */
9692    protected List<Provenance> relevantHistoryTarget;
9693
9694
9695    /**
9696     * 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.
9697     */
9698    @Child(name = "signer", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9699    @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." )
9700    protected List<SignatoryComponent> signer;
9701
9702    /**
9703     * 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.
9704     */
9705    @Child(name = "friendly", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9706    @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." )
9707    protected List<FriendlyLanguageComponent> friendly;
9708
9709    /**
9710     * List of Legal expressions or representations of this Contract.
9711     */
9712    @Child(name = "legal", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9713    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
9714    protected List<LegalLanguageComponent> legal;
9715
9716    /**
9717     * List of Computable Policy Rule Language Representations of this Contract.
9718     */
9719    @Child(name = "rule", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9720    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
9721    protected List<ComputableLanguageComponent> rule;
9722
9723    /**
9724     * 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.
9725     */
9726    @Child(name = "legallyBinding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class, Contract.class}, order=32, min=0, max=1, modifier=false, summary=false)
9727    @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." )
9728    protected Type legallyBinding;
9729
9730    private static final long serialVersionUID = -1388892487L;
9731
9732  /**
9733   * Constructor
9734   */
9735    public Contract() {
9736      super();
9737    }
9738
9739    /**
9740     * @return {@link #identifier} (Unique identifier for this Contract or a derivative that references a Source Contract.)
9741     */
9742    public List<Identifier> getIdentifier() { 
9743      if (this.identifier == null)
9744        this.identifier = new ArrayList<Identifier>();
9745      return this.identifier;
9746    }
9747
9748    /**
9749     * @return Returns a reference to <code>this</code> for easy method chaining
9750     */
9751    public Contract setIdentifier(List<Identifier> theIdentifier) { 
9752      this.identifier = theIdentifier;
9753      return this;
9754    }
9755
9756    public boolean hasIdentifier() { 
9757      if (this.identifier == null)
9758        return false;
9759      for (Identifier item : this.identifier)
9760        if (!item.isEmpty())
9761          return true;
9762      return false;
9763    }
9764
9765    public Identifier addIdentifier() { //3
9766      Identifier t = new Identifier();
9767      if (this.identifier == null)
9768        this.identifier = new ArrayList<Identifier>();
9769      this.identifier.add(t);
9770      return t;
9771    }
9772
9773    public Contract addIdentifier(Identifier t) { //3
9774      if (t == null)
9775        return this;
9776      if (this.identifier == null)
9777        this.identifier = new ArrayList<Identifier>();
9778      this.identifier.add(t);
9779      return this;
9780    }
9781
9782    /**
9783     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
9784     */
9785    public Identifier getIdentifierFirstRep() { 
9786      if (getIdentifier().isEmpty()) {
9787        addIdentifier();
9788      }
9789      return getIdentifier().get(0);
9790    }
9791
9792    /**
9793     * @return {@link #url} (Canonical identifier for this contract, represented as a URI (globally unique).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
9794     */
9795    public UriType getUrlElement() { 
9796      if (this.url == null)
9797        if (Configuration.errorOnAutoCreate())
9798          throw new Error("Attempt to auto-create Contract.url");
9799        else if (Configuration.doAutoCreate())
9800          this.url = new UriType(); // bb
9801      return this.url;
9802    }
9803
9804    public boolean hasUrlElement() { 
9805      return this.url != null && !this.url.isEmpty();
9806    }
9807
9808    public boolean hasUrl() { 
9809      return this.url != null && !this.url.isEmpty();
9810    }
9811
9812    /**
9813     * @param value {@link #url} (Canonical identifier for this contract, represented as a URI (globally unique).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
9814     */
9815    public Contract setUrlElement(UriType value) { 
9816      this.url = value;
9817      return this;
9818    }
9819
9820    /**
9821     * @return Canonical identifier for this contract, represented as a URI (globally unique).
9822     */
9823    public String getUrl() { 
9824      return this.url == null ? null : this.url.getValue();
9825    }
9826
9827    /**
9828     * @param value Canonical identifier for this contract, represented as a URI (globally unique).
9829     */
9830    public Contract setUrl(String value) { 
9831      if (Utilities.noString(value))
9832        this.url = null;
9833      else {
9834        if (this.url == null)
9835          this.url = new UriType();
9836        this.url.setValue(value);
9837      }
9838      return this;
9839    }
9840
9841    /**
9842     * @return {@link #version} (An edition identifier used for business purposes to label business significant variants.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
9843     */
9844    public StringType getVersionElement() { 
9845      if (this.version == null)
9846        if (Configuration.errorOnAutoCreate())
9847          throw new Error("Attempt to auto-create Contract.version");
9848        else if (Configuration.doAutoCreate())
9849          this.version = new StringType(); // bb
9850      return this.version;
9851    }
9852
9853    public boolean hasVersionElement() { 
9854      return this.version != null && !this.version.isEmpty();
9855    }
9856
9857    public boolean hasVersion() { 
9858      return this.version != null && !this.version.isEmpty();
9859    }
9860
9861    /**
9862     * @param value {@link #version} (An edition identifier used for business purposes to label business significant variants.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
9863     */
9864    public Contract setVersionElement(StringType value) { 
9865      this.version = value;
9866      return this;
9867    }
9868
9869    /**
9870     * @return An edition identifier used for business purposes to label business significant variants.
9871     */
9872    public String getVersion() { 
9873      return this.version == null ? null : this.version.getValue();
9874    }
9875
9876    /**
9877     * @param value An edition identifier used for business purposes to label business significant variants.
9878     */
9879    public Contract setVersion(String value) { 
9880      if (Utilities.noString(value))
9881        this.version = null;
9882      else {
9883        if (this.version == null)
9884          this.version = new StringType();
9885        this.version.setValue(value);
9886      }
9887      return this;
9888    }
9889
9890    /**
9891     * @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
9892     */
9893    public Enumeration<ContractStatus> getStatusElement() { 
9894      if (this.status == null)
9895        if (Configuration.errorOnAutoCreate())
9896          throw new Error("Attempt to auto-create Contract.status");
9897        else if (Configuration.doAutoCreate())
9898          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
9899      return this.status;
9900    }
9901
9902    public boolean hasStatusElement() { 
9903      return this.status != null && !this.status.isEmpty();
9904    }
9905
9906    public boolean hasStatus() { 
9907      return this.status != null && !this.status.isEmpty();
9908    }
9909
9910    /**
9911     * @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
9912     */
9913    public Contract setStatusElement(Enumeration<ContractStatus> value) { 
9914      this.status = value;
9915      return this;
9916    }
9917
9918    /**
9919     * @return The status of the resource instance.
9920     */
9921    public ContractStatus getStatus() { 
9922      return this.status == null ? null : this.status.getValue();
9923    }
9924
9925    /**
9926     * @param value The status of the resource instance.
9927     */
9928    public Contract setStatus(ContractStatus value) { 
9929      if (value == null)
9930        this.status = null;
9931      else {
9932        if (this.status == null)
9933          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
9934        this.status.setValue(value);
9935      }
9936      return this;
9937    }
9938
9939    /**
9940     * @return {@link #legalState} (Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.)
9941     */
9942    public CodeableConcept getLegalState() { 
9943      if (this.legalState == null)
9944        if (Configuration.errorOnAutoCreate())
9945          throw new Error("Attempt to auto-create Contract.legalState");
9946        else if (Configuration.doAutoCreate())
9947          this.legalState = new CodeableConcept(); // cc
9948      return this.legalState;
9949    }
9950
9951    public boolean hasLegalState() { 
9952      return this.legalState != null && !this.legalState.isEmpty();
9953    }
9954
9955    /**
9956     * @param value {@link #legalState} (Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.)
9957     */
9958    public Contract setLegalState(CodeableConcept value) { 
9959      this.legalState = value;
9960      return this;
9961    }
9962
9963    /**
9964     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9965     */
9966    public Reference getInstantiatesCanonical() { 
9967      if (this.instantiatesCanonical == null)
9968        if (Configuration.errorOnAutoCreate())
9969          throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
9970        else if (Configuration.doAutoCreate())
9971          this.instantiatesCanonical = new Reference(); // cc
9972      return this.instantiatesCanonical;
9973    }
9974
9975    public boolean hasInstantiatesCanonical() { 
9976      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
9977    }
9978
9979    /**
9980     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9981     */
9982    public Contract setInstantiatesCanonical(Reference value) { 
9983      this.instantiatesCanonical = value;
9984      return this;
9985    }
9986
9987    /**
9988     * @return {@link #instantiatesCanonical} 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 URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9989     */
9990    public Contract getInstantiatesCanonicalTarget() { 
9991      if (this.instantiatesCanonicalTarget == null)
9992        if (Configuration.errorOnAutoCreate())
9993          throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
9994        else if (Configuration.doAutoCreate())
9995          this.instantiatesCanonicalTarget = new Contract(); // aa
9996      return this.instantiatesCanonicalTarget;
9997    }
9998
9999    /**
10000     * @param value {@link #instantiatesCanonical} 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 URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
10001     */
10002    public Contract setInstantiatesCanonicalTarget(Contract value) { 
10003      this.instantiatesCanonicalTarget = value;
10004      return this;
10005    }
10006
10007    /**
10008     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
10009     */
10010    public UriType getInstantiatesUriElement() { 
10011      if (this.instantiatesUri == null)
10012        if (Configuration.errorOnAutoCreate())
10013          throw new Error("Attempt to auto-create Contract.instantiatesUri");
10014        else if (Configuration.doAutoCreate())
10015          this.instantiatesUri = new UriType(); // bb
10016      return this.instantiatesUri;
10017    }
10018
10019    public boolean hasInstantiatesUriElement() { 
10020      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
10021    }
10022
10023    public boolean hasInstantiatesUri() { 
10024      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
10025    }
10026
10027    /**
10028     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
10029     */
10030    public Contract setInstantiatesUriElement(UriType value) { 
10031      this.instantiatesUri = value;
10032      return this;
10033    }
10034
10035    /**
10036     * @return The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
10037     */
10038    public String getInstantiatesUri() { 
10039      return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
10040    }
10041
10042    /**
10043     * @param value The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
10044     */
10045    public Contract setInstantiatesUri(String value) { 
10046      if (Utilities.noString(value))
10047        this.instantiatesUri = null;
10048      else {
10049        if (this.instantiatesUri == null)
10050          this.instantiatesUri = new UriType();
10051        this.instantiatesUri.setValue(value);
10052      }
10053      return this;
10054    }
10055
10056    /**
10057     * @return {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
10058     */
10059    public CodeableConcept getContentDerivative() { 
10060      if (this.contentDerivative == null)
10061        if (Configuration.errorOnAutoCreate())
10062          throw new Error("Attempt to auto-create Contract.contentDerivative");
10063        else if (Configuration.doAutoCreate())
10064          this.contentDerivative = new CodeableConcept(); // cc
10065      return this.contentDerivative;
10066    }
10067
10068    public boolean hasContentDerivative() { 
10069      return this.contentDerivative != null && !this.contentDerivative.isEmpty();
10070    }
10071
10072    /**
10073     * @param value {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
10074     */
10075    public Contract setContentDerivative(CodeableConcept value) { 
10076      this.contentDerivative = value;
10077      return this;
10078    }
10079
10080    /**
10081     * @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
10082     */
10083    public DateTimeType getIssuedElement() { 
10084      if (this.issued == null)
10085        if (Configuration.errorOnAutoCreate())
10086          throw new Error("Attempt to auto-create Contract.issued");
10087        else if (Configuration.doAutoCreate())
10088          this.issued = new DateTimeType(); // bb
10089      return this.issued;
10090    }
10091
10092    public boolean hasIssuedElement() { 
10093      return this.issued != null && !this.issued.isEmpty();
10094    }
10095
10096    public boolean hasIssued() { 
10097      return this.issued != null && !this.issued.isEmpty();
10098    }
10099
10100    /**
10101     * @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
10102     */
10103    public Contract setIssuedElement(DateTimeType value) { 
10104      this.issued = value;
10105      return this;
10106    }
10107
10108    /**
10109     * @return When this  Contract was issued.
10110     */
10111    public Date getIssued() { 
10112      return this.issued == null ? null : this.issued.getValue();
10113    }
10114
10115    /**
10116     * @param value When this  Contract was issued.
10117     */
10118    public Contract setIssued(Date value) { 
10119      if (value == null)
10120        this.issued = null;
10121      else {
10122        if (this.issued == null)
10123          this.issued = new DateTimeType();
10124        this.issued.setValue(value);
10125      }
10126      return this;
10127    }
10128
10129    /**
10130     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
10131     */
10132    public Period getApplies() { 
10133      if (this.applies == null)
10134        if (Configuration.errorOnAutoCreate())
10135          throw new Error("Attempt to auto-create Contract.applies");
10136        else if (Configuration.doAutoCreate())
10137          this.applies = new Period(); // cc
10138      return this.applies;
10139    }
10140
10141    public boolean hasApplies() { 
10142      return this.applies != null && !this.applies.isEmpty();
10143    }
10144
10145    /**
10146     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
10147     */
10148    public Contract setApplies(Period value) { 
10149      this.applies = value;
10150      return this;
10151    }
10152
10153    /**
10154     * @return {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
10155     */
10156    public CodeableConcept getExpirationType() { 
10157      if (this.expirationType == null)
10158        if (Configuration.errorOnAutoCreate())
10159          throw new Error("Attempt to auto-create Contract.expirationType");
10160        else if (Configuration.doAutoCreate())
10161          this.expirationType = new CodeableConcept(); // cc
10162      return this.expirationType;
10163    }
10164
10165    public boolean hasExpirationType() { 
10166      return this.expirationType != null && !this.expirationType.isEmpty();
10167    }
10168
10169    /**
10170     * @param value {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
10171     */
10172    public Contract setExpirationType(CodeableConcept value) { 
10173      this.expirationType = value;
10174      return this;
10175    }
10176
10177    /**
10178     * @return {@link #subject} (The target entity impacted by or of interest to parties to the agreement.)
10179     */
10180    public List<Reference> getSubject() { 
10181      if (this.subject == null)
10182        this.subject = new ArrayList<Reference>();
10183      return this.subject;
10184    }
10185
10186    /**
10187     * @return Returns a reference to <code>this</code> for easy method chaining
10188     */
10189    public Contract setSubject(List<Reference> theSubject) { 
10190      this.subject = theSubject;
10191      return this;
10192    }
10193
10194    public boolean hasSubject() { 
10195      if (this.subject == null)
10196        return false;
10197      for (Reference item : this.subject)
10198        if (!item.isEmpty())
10199          return true;
10200      return false;
10201    }
10202
10203    public Reference addSubject() { //3
10204      Reference t = new Reference();
10205      if (this.subject == null)
10206        this.subject = new ArrayList<Reference>();
10207      this.subject.add(t);
10208      return t;
10209    }
10210
10211    public Contract addSubject(Reference t) { //3
10212      if (t == null)
10213        return this;
10214      if (this.subject == null)
10215        this.subject = new ArrayList<Reference>();
10216      this.subject.add(t);
10217      return this;
10218    }
10219
10220    /**
10221     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
10222     */
10223    public Reference getSubjectFirstRep() { 
10224      if (getSubject().isEmpty()) {
10225        addSubject();
10226      }
10227      return getSubject().get(0);
10228    }
10229
10230    /**
10231     * @deprecated Use Reference#setResource(IBaseResource) instead
10232     */
10233    @Deprecated
10234    public List<Resource> getSubjectTarget() { 
10235      if (this.subjectTarget == null)
10236        this.subjectTarget = new ArrayList<Resource>();
10237      return this.subjectTarget;
10238    }
10239
10240    /**
10241     * @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.)
10242     */
10243    public List<Reference> getAuthority() { 
10244      if (this.authority == null)
10245        this.authority = new ArrayList<Reference>();
10246      return this.authority;
10247    }
10248
10249    /**
10250     * @return Returns a reference to <code>this</code> for easy method chaining
10251     */
10252    public Contract setAuthority(List<Reference> theAuthority) { 
10253      this.authority = theAuthority;
10254      return this;
10255    }
10256
10257    public boolean hasAuthority() { 
10258      if (this.authority == null)
10259        return false;
10260      for (Reference item : this.authority)
10261        if (!item.isEmpty())
10262          return true;
10263      return false;
10264    }
10265
10266    public Reference addAuthority() { //3
10267      Reference t = new Reference();
10268      if (this.authority == null)
10269        this.authority = new ArrayList<Reference>();
10270      this.authority.add(t);
10271      return t;
10272    }
10273
10274    public Contract addAuthority(Reference t) { //3
10275      if (t == null)
10276        return this;
10277      if (this.authority == null)
10278        this.authority = new ArrayList<Reference>();
10279      this.authority.add(t);
10280      return this;
10281    }
10282
10283    /**
10284     * @return The first repetition of repeating field {@link #authority}, creating it if it does not already exist
10285     */
10286    public Reference getAuthorityFirstRep() { 
10287      if (getAuthority().isEmpty()) {
10288        addAuthority();
10289      }
10290      return getAuthority().get(0);
10291    }
10292
10293    /**
10294     * @deprecated Use Reference#setResource(IBaseResource) instead
10295     */
10296    @Deprecated
10297    public List<Organization> getAuthorityTarget() { 
10298      if (this.authorityTarget == null)
10299        this.authorityTarget = new ArrayList<Organization>();
10300      return this.authorityTarget;
10301    }
10302
10303    /**
10304     * @deprecated Use Reference#setResource(IBaseResource) instead
10305     */
10306    @Deprecated
10307    public Organization addAuthorityTarget() { 
10308      Organization r = new Organization();
10309      if (this.authorityTarget == null)
10310        this.authorityTarget = new ArrayList<Organization>();
10311      this.authorityTarget.add(r);
10312      return r;
10313    }
10314
10315    /**
10316     * @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.)
10317     */
10318    public List<Reference> getDomain() { 
10319      if (this.domain == null)
10320        this.domain = new ArrayList<Reference>();
10321      return this.domain;
10322    }
10323
10324    /**
10325     * @return Returns a reference to <code>this</code> for easy method chaining
10326     */
10327    public Contract setDomain(List<Reference> theDomain) { 
10328      this.domain = theDomain;
10329      return this;
10330    }
10331
10332    public boolean hasDomain() { 
10333      if (this.domain == null)
10334        return false;
10335      for (Reference item : this.domain)
10336        if (!item.isEmpty())
10337          return true;
10338      return false;
10339    }
10340
10341    public Reference addDomain() { //3
10342      Reference t = new Reference();
10343      if (this.domain == null)
10344        this.domain = new ArrayList<Reference>();
10345      this.domain.add(t);
10346      return t;
10347    }
10348
10349    public Contract addDomain(Reference t) { //3
10350      if (t == null)
10351        return this;
10352      if (this.domain == null)
10353        this.domain = new ArrayList<Reference>();
10354      this.domain.add(t);
10355      return this;
10356    }
10357
10358    /**
10359     * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist
10360     */
10361    public Reference getDomainFirstRep() { 
10362      if (getDomain().isEmpty()) {
10363        addDomain();
10364      }
10365      return getDomain().get(0);
10366    }
10367
10368    /**
10369     * @deprecated Use Reference#setResource(IBaseResource) instead
10370     */
10371    @Deprecated
10372    public List<Location> getDomainTarget() { 
10373      if (this.domainTarget == null)
10374        this.domainTarget = new ArrayList<Location>();
10375      return this.domainTarget;
10376    }
10377
10378    /**
10379     * @deprecated Use Reference#setResource(IBaseResource) instead
10380     */
10381    @Deprecated
10382    public Location addDomainTarget() { 
10383      Location r = new Location();
10384      if (this.domainTarget == null)
10385        this.domainTarget = new ArrayList<Location>();
10386      this.domainTarget.add(r);
10387      return r;
10388    }
10389
10390    /**
10391     * @return {@link #site} (Sites in which the contract is complied with,  exercised, or in force.)
10392     */
10393    public List<Reference> getSite() { 
10394      if (this.site == null)
10395        this.site = new ArrayList<Reference>();
10396      return this.site;
10397    }
10398
10399    /**
10400     * @return Returns a reference to <code>this</code> for easy method chaining
10401     */
10402    public Contract setSite(List<Reference> theSite) { 
10403      this.site = theSite;
10404      return this;
10405    }
10406
10407    public boolean hasSite() { 
10408      if (this.site == null)
10409        return false;
10410      for (Reference item : this.site)
10411        if (!item.isEmpty())
10412          return true;
10413      return false;
10414    }
10415
10416    public Reference addSite() { //3
10417      Reference t = new Reference();
10418      if (this.site == null)
10419        this.site = new ArrayList<Reference>();
10420      this.site.add(t);
10421      return t;
10422    }
10423
10424    public Contract addSite(Reference t) { //3
10425      if (t == null)
10426        return this;
10427      if (this.site == null)
10428        this.site = new ArrayList<Reference>();
10429      this.site.add(t);
10430      return this;
10431    }
10432
10433    /**
10434     * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist
10435     */
10436    public Reference getSiteFirstRep() { 
10437      if (getSite().isEmpty()) {
10438        addSite();
10439      }
10440      return getSite().get(0);
10441    }
10442
10443    /**
10444     * @deprecated Use Reference#setResource(IBaseResource) instead
10445     */
10446    @Deprecated
10447    public List<Location> getSiteTarget() { 
10448      if (this.siteTarget == null)
10449        this.siteTarget = new ArrayList<Location>();
10450      return this.siteTarget;
10451    }
10452
10453    /**
10454     * @deprecated Use Reference#setResource(IBaseResource) instead
10455     */
10456    @Deprecated
10457    public Location addSiteTarget() { 
10458      Location r = new Location();
10459      if (this.siteTarget == null)
10460        this.siteTarget = new ArrayList<Location>();
10461      this.siteTarget.add(r);
10462      return r;
10463    }
10464
10465    /**
10466     * @return {@link #name} (A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
10467     */
10468    public StringType getNameElement() { 
10469      if (this.name == null)
10470        if (Configuration.errorOnAutoCreate())
10471          throw new Error("Attempt to auto-create Contract.name");
10472        else if (Configuration.doAutoCreate())
10473          this.name = new StringType(); // bb
10474      return this.name;
10475    }
10476
10477    public boolean hasNameElement() { 
10478      return this.name != null && !this.name.isEmpty();
10479    }
10480
10481    public boolean hasName() { 
10482      return this.name != null && !this.name.isEmpty();
10483    }
10484
10485    /**
10486     * @param value {@link #name} (A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
10487     */
10488    public Contract setNameElement(StringType value) { 
10489      this.name = value;
10490      return this;
10491    }
10492
10493    /**
10494     * @return A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
10495     */
10496    public String getName() { 
10497      return this.name == null ? null : this.name.getValue();
10498    }
10499
10500    /**
10501     * @param value A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
10502     */
10503    public Contract setName(String value) { 
10504      if (Utilities.noString(value))
10505        this.name = null;
10506      else {
10507        if (this.name == null)
10508          this.name = new StringType();
10509        this.name.setValue(value);
10510      }
10511      return this;
10512    }
10513
10514    /**
10515     * @return {@link #title} (A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
10516     */
10517    public StringType getTitleElement() { 
10518      if (this.title == null)
10519        if (Configuration.errorOnAutoCreate())
10520          throw new Error("Attempt to auto-create Contract.title");
10521        else if (Configuration.doAutoCreate())
10522          this.title = new StringType(); // bb
10523      return this.title;
10524    }
10525
10526    public boolean hasTitleElement() { 
10527      return this.title != null && !this.title.isEmpty();
10528    }
10529
10530    public boolean hasTitle() { 
10531      return this.title != null && !this.title.isEmpty();
10532    }
10533
10534    /**
10535     * @param value {@link #title} (A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
10536     */
10537    public Contract setTitleElement(StringType value) { 
10538      this.title = value;
10539      return this;
10540    }
10541
10542    /**
10543     * @return A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10544     */
10545    public String getTitle() { 
10546      return this.title == null ? null : this.title.getValue();
10547    }
10548
10549    /**
10550     * @param value A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10551     */
10552    public Contract setTitle(String value) { 
10553      if (Utilities.noString(value))
10554        this.title = null;
10555      else {
10556        if (this.title == null)
10557          this.title = new StringType();
10558        this.title.setValue(value);
10559      }
10560      return this;
10561    }
10562
10563    /**
10564     * @return {@link #subtitle} (An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
10565     */
10566    public StringType getSubtitleElement() { 
10567      if (this.subtitle == null)
10568        if (Configuration.errorOnAutoCreate())
10569          throw new Error("Attempt to auto-create Contract.subtitle");
10570        else if (Configuration.doAutoCreate())
10571          this.subtitle = new StringType(); // bb
10572      return this.subtitle;
10573    }
10574
10575    public boolean hasSubtitleElement() { 
10576      return this.subtitle != null && !this.subtitle.isEmpty();
10577    }
10578
10579    public boolean hasSubtitle() { 
10580      return this.subtitle != null && !this.subtitle.isEmpty();
10581    }
10582
10583    /**
10584     * @param value {@link #subtitle} (An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
10585     */
10586    public Contract setSubtitleElement(StringType value) { 
10587      this.subtitle = value;
10588      return this;
10589    }
10590
10591    /**
10592     * @return An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10593     */
10594    public String getSubtitle() { 
10595      return this.subtitle == null ? null : this.subtitle.getValue();
10596    }
10597
10598    /**
10599     * @param value An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10600     */
10601    public Contract setSubtitle(String value) { 
10602      if (Utilities.noString(value))
10603        this.subtitle = null;
10604      else {
10605        if (this.subtitle == null)
10606          this.subtitle = new StringType();
10607        this.subtitle.setValue(value);
10608      }
10609      return this;
10610    }
10611
10612    /**
10613     * @return {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10614     */
10615    public List<StringType> getAlias() { 
10616      if (this.alias == null)
10617        this.alias = new ArrayList<StringType>();
10618      return this.alias;
10619    }
10620
10621    /**
10622     * @return Returns a reference to <code>this</code> for easy method chaining
10623     */
10624    public Contract setAlias(List<StringType> theAlias) { 
10625      this.alias = theAlias;
10626      return this;
10627    }
10628
10629    public boolean hasAlias() { 
10630      if (this.alias == null)
10631        return false;
10632      for (StringType item : this.alias)
10633        if (!item.isEmpty())
10634          return true;
10635      return false;
10636    }
10637
10638    /**
10639     * @return {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10640     */
10641    public StringType addAliasElement() {//2 
10642      StringType t = new StringType();
10643      if (this.alias == null)
10644        this.alias = new ArrayList<StringType>();
10645      this.alias.add(t);
10646      return t;
10647    }
10648
10649    /**
10650     * @param value {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10651     */
10652    public Contract addAlias(String value) { //1
10653      StringType t = new StringType();
10654      t.setValue(value);
10655      if (this.alias == null)
10656        this.alias = new ArrayList<StringType>();
10657      this.alias.add(t);
10658      return this;
10659    }
10660
10661    /**
10662     * @param value {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10663     */
10664    public boolean hasAlias(String value) { 
10665      if (this.alias == null)
10666        return false;
10667      for (StringType v : this.alias)
10668        if (v.getValue().equals(value)) // string
10669          return true;
10670      return false;
10671    }
10672
10673    /**
10674     * @return {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10675     */
10676    public Reference getAuthor() { 
10677      if (this.author == null)
10678        if (Configuration.errorOnAutoCreate())
10679          throw new Error("Attempt to auto-create Contract.author");
10680        else if (Configuration.doAutoCreate())
10681          this.author = new Reference(); // cc
10682      return this.author;
10683    }
10684
10685    public boolean hasAuthor() { 
10686      return this.author != null && !this.author.isEmpty();
10687    }
10688
10689    /**
10690     * @param value {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10691     */
10692    public Contract setAuthor(Reference value) { 
10693      this.author = value;
10694      return this;
10695    }
10696
10697    /**
10698     * @return {@link #author} 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 individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10699     */
10700    public Resource getAuthorTarget() { 
10701      return this.authorTarget;
10702    }
10703
10704    /**
10705     * @param value {@link #author} 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 individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10706     */
10707    public Contract setAuthorTarget(Resource value) { 
10708      this.authorTarget = value;
10709      return this;
10710    }
10711
10712    /**
10713     * @return {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10714     */
10715    public CodeableConcept getScope() { 
10716      if (this.scope == null)
10717        if (Configuration.errorOnAutoCreate())
10718          throw new Error("Attempt to auto-create Contract.scope");
10719        else if (Configuration.doAutoCreate())
10720          this.scope = new CodeableConcept(); // cc
10721      return this.scope;
10722    }
10723
10724    public boolean hasScope() { 
10725      return this.scope != null && !this.scope.isEmpty();
10726    }
10727
10728    /**
10729     * @param value {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10730     */
10731    public Contract setScope(CodeableConcept value) { 
10732      this.scope = value;
10733      return this;
10734    }
10735
10736    /**
10737     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10738     */
10739    public Type getTopic() { 
10740      return this.topic;
10741    }
10742
10743    /**
10744     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10745     */
10746    public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
10747      if (this.topic == null)
10748        this.topic = new CodeableConcept();
10749      if (!(this.topic instanceof CodeableConcept))
10750        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
10751      return (CodeableConcept) this.topic;
10752    }
10753
10754    public boolean hasTopicCodeableConcept() { 
10755      return this != null && this.topic instanceof CodeableConcept;
10756    }
10757
10758    /**
10759     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10760     */
10761    public Reference getTopicReference() throws FHIRException { 
10762      if (this.topic == null)
10763        this.topic = new Reference();
10764      if (!(this.topic instanceof Reference))
10765        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
10766      return (Reference) this.topic;
10767    }
10768
10769    public boolean hasTopicReference() { 
10770      return this != null && this.topic instanceof Reference;
10771    }
10772
10773    public boolean hasTopic() { 
10774      return this.topic != null && !this.topic.isEmpty();
10775    }
10776
10777    /**
10778     * @param value {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10779     */
10780    public Contract setTopic(Type value) { 
10781      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
10782        throw new Error("Not the right type for Contract.topic[x]: "+value.fhirType());
10783      this.topic = value;
10784      return this;
10785    }
10786
10787    /**
10788     * @return {@link #type} (A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.)
10789     */
10790    public CodeableConcept getType() { 
10791      if (this.type == null)
10792        if (Configuration.errorOnAutoCreate())
10793          throw new Error("Attempt to auto-create Contract.type");
10794        else if (Configuration.doAutoCreate())
10795          this.type = new CodeableConcept(); // cc
10796      return this.type;
10797    }
10798
10799    public boolean hasType() { 
10800      return this.type != null && !this.type.isEmpty();
10801    }
10802
10803    /**
10804     * @param value {@link #type} (A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.)
10805     */
10806    public Contract setType(CodeableConcept value) { 
10807      this.type = value;
10808      return this;
10809    }
10810
10811    /**
10812     * @return {@link #subType} (Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.)
10813     */
10814    public List<CodeableConcept> getSubType() { 
10815      if (this.subType == null)
10816        this.subType = new ArrayList<CodeableConcept>();
10817      return this.subType;
10818    }
10819
10820    /**
10821     * @return Returns a reference to <code>this</code> for easy method chaining
10822     */
10823    public Contract setSubType(List<CodeableConcept> theSubType) { 
10824      this.subType = theSubType;
10825      return this;
10826    }
10827
10828    public boolean hasSubType() { 
10829      if (this.subType == null)
10830        return false;
10831      for (CodeableConcept item : this.subType)
10832        if (!item.isEmpty())
10833          return true;
10834      return false;
10835    }
10836
10837    public CodeableConcept addSubType() { //3
10838      CodeableConcept t = new CodeableConcept();
10839      if (this.subType == null)
10840        this.subType = new ArrayList<CodeableConcept>();
10841      this.subType.add(t);
10842      return t;
10843    }
10844
10845    public Contract addSubType(CodeableConcept t) { //3
10846      if (t == null)
10847        return this;
10848      if (this.subType == null)
10849        this.subType = new ArrayList<CodeableConcept>();
10850      this.subType.add(t);
10851      return this;
10852    }
10853
10854    /**
10855     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10856     */
10857    public CodeableConcept getSubTypeFirstRep() { 
10858      if (getSubType().isEmpty()) {
10859        addSubType();
10860      }
10861      return getSubType().get(0);
10862    }
10863
10864    /**
10865     * @return {@link #contentDefinition} (Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.)
10866     */
10867    public ContentDefinitionComponent getContentDefinition() { 
10868      if (this.contentDefinition == null)
10869        if (Configuration.errorOnAutoCreate())
10870          throw new Error("Attempt to auto-create Contract.contentDefinition");
10871        else if (Configuration.doAutoCreate())
10872          this.contentDefinition = new ContentDefinitionComponent(); // cc
10873      return this.contentDefinition;
10874    }
10875
10876    public boolean hasContentDefinition() { 
10877      return this.contentDefinition != null && !this.contentDefinition.isEmpty();
10878    }
10879
10880    /**
10881     * @param value {@link #contentDefinition} (Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.)
10882     */
10883    public Contract setContentDefinition(ContentDefinitionComponent value) { 
10884      this.contentDefinition = value;
10885      return this;
10886    }
10887
10888    /**
10889     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
10890     */
10891    public List<TermComponent> getTerm() { 
10892      if (this.term == null)
10893        this.term = new ArrayList<TermComponent>();
10894      return this.term;
10895    }
10896
10897    /**
10898     * @return Returns a reference to <code>this</code> for easy method chaining
10899     */
10900    public Contract setTerm(List<TermComponent> theTerm) { 
10901      this.term = theTerm;
10902      return this;
10903    }
10904
10905    public boolean hasTerm() { 
10906      if (this.term == null)
10907        return false;
10908      for (TermComponent item : this.term)
10909        if (!item.isEmpty())
10910          return true;
10911      return false;
10912    }
10913
10914    public TermComponent addTerm() { //3
10915      TermComponent t = new TermComponent();
10916      if (this.term == null)
10917        this.term = new ArrayList<TermComponent>();
10918      this.term.add(t);
10919      return t;
10920    }
10921
10922    public Contract addTerm(TermComponent t) { //3
10923      if (t == null)
10924        return this;
10925      if (this.term == null)
10926        this.term = new ArrayList<TermComponent>();
10927      this.term.add(t);
10928      return this;
10929    }
10930
10931    /**
10932     * @return The first repetition of repeating field {@link #term}, creating it if it does not already exist
10933     */
10934    public TermComponent getTermFirstRep() { 
10935      if (getTerm().isEmpty()) {
10936        addTerm();
10937      }
10938      return getTerm().get(0);
10939    }
10940
10941    /**
10942     * @return {@link #supportingInfo} (Information that may be needed by/relevant to the performer in their execution of this term action.)
10943     */
10944    public List<Reference> getSupportingInfo() { 
10945      if (this.supportingInfo == null)
10946        this.supportingInfo = new ArrayList<Reference>();
10947      return this.supportingInfo;
10948    }
10949
10950    /**
10951     * @return Returns a reference to <code>this</code> for easy method chaining
10952     */
10953    public Contract setSupportingInfo(List<Reference> theSupportingInfo) { 
10954      this.supportingInfo = theSupportingInfo;
10955      return this;
10956    }
10957
10958    public boolean hasSupportingInfo() { 
10959      if (this.supportingInfo == null)
10960        return false;
10961      for (Reference item : this.supportingInfo)
10962        if (!item.isEmpty())
10963          return true;
10964      return false;
10965    }
10966
10967    public Reference addSupportingInfo() { //3
10968      Reference t = new Reference();
10969      if (this.supportingInfo == null)
10970        this.supportingInfo = new ArrayList<Reference>();
10971      this.supportingInfo.add(t);
10972      return t;
10973    }
10974
10975    public Contract addSupportingInfo(Reference t) { //3
10976      if (t == null)
10977        return this;
10978      if (this.supportingInfo == null)
10979        this.supportingInfo = new ArrayList<Reference>();
10980      this.supportingInfo.add(t);
10981      return this;
10982    }
10983
10984    /**
10985     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
10986     */
10987    public Reference getSupportingInfoFirstRep() { 
10988      if (getSupportingInfo().isEmpty()) {
10989        addSupportingInfo();
10990      }
10991      return getSupportingInfo().get(0);
10992    }
10993
10994    /**
10995     * @deprecated Use Reference#setResource(IBaseResource) instead
10996     */
10997    @Deprecated
10998    public List<Resource> getSupportingInfoTarget() { 
10999      if (this.supportingInfoTarget == null)
11000        this.supportingInfoTarget = new ArrayList<Resource>();
11001      return this.supportingInfoTarget;
11002    }
11003
11004    /**
11005     * @return {@link #relevantHistory} (Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
11006     */
11007    public List<Reference> getRelevantHistory() { 
11008      if (this.relevantHistory == null)
11009        this.relevantHistory = new ArrayList<Reference>();
11010      return this.relevantHistory;
11011    }
11012
11013    /**
11014     * @return Returns a reference to <code>this</code> for easy method chaining
11015     */
11016    public Contract setRelevantHistory(List<Reference> theRelevantHistory) { 
11017      this.relevantHistory = theRelevantHistory;
11018      return this;
11019    }
11020
11021    public boolean hasRelevantHistory() { 
11022      if (this.relevantHistory == null)
11023        return false;
11024      for (Reference item : this.relevantHistory)
11025        if (!item.isEmpty())
11026          return true;
11027      return false;
11028    }
11029
11030    public Reference addRelevantHistory() { //3
11031      Reference t = new Reference();
11032      if (this.relevantHistory == null)
11033        this.relevantHistory = new ArrayList<Reference>();
11034      this.relevantHistory.add(t);
11035      return t;
11036    }
11037
11038    public Contract addRelevantHistory(Reference t) { //3
11039      if (t == null)
11040        return this;
11041      if (this.relevantHistory == null)
11042        this.relevantHistory = new ArrayList<Reference>();
11043      this.relevantHistory.add(t);
11044      return this;
11045    }
11046
11047    /**
11048     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
11049     */
11050    public Reference getRelevantHistoryFirstRep() { 
11051      if (getRelevantHistory().isEmpty()) {
11052        addRelevantHistory();
11053      }
11054      return getRelevantHistory().get(0);
11055    }
11056
11057    /**
11058     * @deprecated Use Reference#setResource(IBaseResource) instead
11059     */
11060    @Deprecated
11061    public List<Provenance> getRelevantHistoryTarget() { 
11062      if (this.relevantHistoryTarget == null)
11063        this.relevantHistoryTarget = new ArrayList<Provenance>();
11064      return this.relevantHistoryTarget;
11065    }
11066
11067    /**
11068     * @deprecated Use Reference#setResource(IBaseResource) instead
11069     */
11070    @Deprecated
11071    public Provenance addRelevantHistoryTarget() { 
11072      Provenance r = new Provenance();
11073      if (this.relevantHistoryTarget == null)
11074        this.relevantHistoryTarget = new ArrayList<Provenance>();
11075      this.relevantHistoryTarget.add(r);
11076      return r;
11077    }
11078
11079    /**
11080     * @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.)
11081     */
11082    public List<SignatoryComponent> getSigner() { 
11083      if (this.signer == null)
11084        this.signer = new ArrayList<SignatoryComponent>();
11085      return this.signer;
11086    }
11087
11088    /**
11089     * @return Returns a reference to <code>this</code> for easy method chaining
11090     */
11091    public Contract setSigner(List<SignatoryComponent> theSigner) { 
11092      this.signer = theSigner;
11093      return this;
11094    }
11095
11096    public boolean hasSigner() { 
11097      if (this.signer == null)
11098        return false;
11099      for (SignatoryComponent item : this.signer)
11100        if (!item.isEmpty())
11101          return true;
11102      return false;
11103    }
11104
11105    public SignatoryComponent addSigner() { //3
11106      SignatoryComponent t = new SignatoryComponent();
11107      if (this.signer == null)
11108        this.signer = new ArrayList<SignatoryComponent>();
11109      this.signer.add(t);
11110      return t;
11111    }
11112
11113    public Contract addSigner(SignatoryComponent t) { //3
11114      if (t == null)
11115        return this;
11116      if (this.signer == null)
11117        this.signer = new ArrayList<SignatoryComponent>();
11118      this.signer.add(t);
11119      return this;
11120    }
11121
11122    /**
11123     * @return The first repetition of repeating field {@link #signer}, creating it if it does not already exist
11124     */
11125    public SignatoryComponent getSignerFirstRep() { 
11126      if (getSigner().isEmpty()) {
11127        addSigner();
11128      }
11129      return getSigner().get(0);
11130    }
11131
11132    /**
11133     * @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.)
11134     */
11135    public List<FriendlyLanguageComponent> getFriendly() { 
11136      if (this.friendly == null)
11137        this.friendly = new ArrayList<FriendlyLanguageComponent>();
11138      return this.friendly;
11139    }
11140
11141    /**
11142     * @return Returns a reference to <code>this</code> for easy method chaining
11143     */
11144    public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) { 
11145      this.friendly = theFriendly;
11146      return this;
11147    }
11148
11149    public boolean hasFriendly() { 
11150      if (this.friendly == null)
11151        return false;
11152      for (FriendlyLanguageComponent item : this.friendly)
11153        if (!item.isEmpty())
11154          return true;
11155      return false;
11156    }
11157
11158    public FriendlyLanguageComponent addFriendly() { //3
11159      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
11160      if (this.friendly == null)
11161        this.friendly = new ArrayList<FriendlyLanguageComponent>();
11162      this.friendly.add(t);
11163      return t;
11164    }
11165
11166    public Contract addFriendly(FriendlyLanguageComponent t) { //3
11167      if (t == null)
11168        return this;
11169      if (this.friendly == null)
11170        this.friendly = new ArrayList<FriendlyLanguageComponent>();
11171      this.friendly.add(t);
11172      return this;
11173    }
11174
11175    /**
11176     * @return The first repetition of repeating field {@link #friendly}, creating it if it does not already exist
11177     */
11178    public FriendlyLanguageComponent getFriendlyFirstRep() { 
11179      if (getFriendly().isEmpty()) {
11180        addFriendly();
11181      }
11182      return getFriendly().get(0);
11183    }
11184
11185    /**
11186     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
11187     */
11188    public List<LegalLanguageComponent> getLegal() { 
11189      if (this.legal == null)
11190        this.legal = new ArrayList<LegalLanguageComponent>();
11191      return this.legal;
11192    }
11193
11194    /**
11195     * @return Returns a reference to <code>this</code> for easy method chaining
11196     */
11197    public Contract setLegal(List<LegalLanguageComponent> theLegal) { 
11198      this.legal = theLegal;
11199      return this;
11200    }
11201
11202    public boolean hasLegal() { 
11203      if (this.legal == null)
11204        return false;
11205      for (LegalLanguageComponent item : this.legal)
11206        if (!item.isEmpty())
11207          return true;
11208      return false;
11209    }
11210
11211    public LegalLanguageComponent addLegal() { //3
11212      LegalLanguageComponent t = new LegalLanguageComponent();
11213      if (this.legal == null)
11214        this.legal = new ArrayList<LegalLanguageComponent>();
11215      this.legal.add(t);
11216      return t;
11217    }
11218
11219    public Contract addLegal(LegalLanguageComponent t) { //3
11220      if (t == null)
11221        return this;
11222      if (this.legal == null)
11223        this.legal = new ArrayList<LegalLanguageComponent>();
11224      this.legal.add(t);
11225      return this;
11226    }
11227
11228    /**
11229     * @return The first repetition of repeating field {@link #legal}, creating it if it does not already exist
11230     */
11231    public LegalLanguageComponent getLegalFirstRep() { 
11232      if (getLegal().isEmpty()) {
11233        addLegal();
11234      }
11235      return getLegal().get(0);
11236    }
11237
11238    /**
11239     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
11240     */
11241    public List<ComputableLanguageComponent> getRule() { 
11242      if (this.rule == null)
11243        this.rule = new ArrayList<ComputableLanguageComponent>();
11244      return this.rule;
11245    }
11246
11247    /**
11248     * @return Returns a reference to <code>this</code> for easy method chaining
11249     */
11250    public Contract setRule(List<ComputableLanguageComponent> theRule) { 
11251      this.rule = theRule;
11252      return this;
11253    }
11254
11255    public boolean hasRule() { 
11256      if (this.rule == null)
11257        return false;
11258      for (ComputableLanguageComponent item : this.rule)
11259        if (!item.isEmpty())
11260          return true;
11261      return false;
11262    }
11263
11264    public ComputableLanguageComponent addRule() { //3
11265      ComputableLanguageComponent t = new ComputableLanguageComponent();
11266      if (this.rule == null)
11267        this.rule = new ArrayList<ComputableLanguageComponent>();
11268      this.rule.add(t);
11269      return t;
11270    }
11271
11272    public Contract addRule(ComputableLanguageComponent t) { //3
11273      if (t == null)
11274        return this;
11275      if (this.rule == null)
11276        this.rule = new ArrayList<ComputableLanguageComponent>();
11277      this.rule.add(t);
11278      return this;
11279    }
11280
11281    /**
11282     * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
11283     */
11284    public ComputableLanguageComponent getRuleFirstRep() { 
11285      if (getRule().isEmpty()) {
11286        addRule();
11287      }
11288      return getRule().get(0);
11289    }
11290
11291    /**
11292     * @return {@link #legallyBinding} (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.)
11293     */
11294    public Type getLegallyBinding() { 
11295      return this.legallyBinding;
11296    }
11297
11298    /**
11299     * @return {@link #legallyBinding} (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.)
11300     */
11301    public Attachment getLegallyBindingAttachment() throws FHIRException { 
11302      if (this.legallyBinding == null)
11303        this.legallyBinding = new Attachment();
11304      if (!(this.legallyBinding instanceof Attachment))
11305        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
11306      return (Attachment) this.legallyBinding;
11307    }
11308
11309    public boolean hasLegallyBindingAttachment() { 
11310      return this != null && this.legallyBinding instanceof Attachment;
11311    }
11312
11313    /**
11314     * @return {@link #legallyBinding} (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.)
11315     */
11316    public Reference getLegallyBindingReference() throws FHIRException { 
11317      if (this.legallyBinding == null)
11318        this.legallyBinding = new Reference();
11319      if (!(this.legallyBinding instanceof Reference))
11320        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
11321      return (Reference) this.legallyBinding;
11322    }
11323
11324    public boolean hasLegallyBindingReference() { 
11325      return this != null && this.legallyBinding instanceof Reference;
11326    }
11327
11328    public boolean hasLegallyBinding() { 
11329      return this.legallyBinding != null && !this.legallyBinding.isEmpty();
11330    }
11331
11332    /**
11333     * @param value {@link #legallyBinding} (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.)
11334     */
11335    public Contract setLegallyBinding(Type value) { 
11336      if (value != null && !(value instanceof Attachment || value instanceof Reference))
11337        throw new Error("Not the right type for Contract.legallyBinding[x]: "+value.fhirType());
11338      this.legallyBinding = value;
11339      return this;
11340    }
11341
11342      protected void listChildren(List<Property> children) {
11343        super.listChildren(children);
11344        children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier));
11345        children.add(new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url));
11346        children.add(new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version));
11347        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
11348        children.add(new Property("legalState", "CodeableConcept", "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.", 0, 1, legalState));
11349        children.add(new Property("instantiatesCanonical", "Reference(Contract)", "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.", 0, 1, instantiatesCanonical));
11350        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.", 0, 1, instantiatesUri));
11351        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));
11352        children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
11353        children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies));
11354        children.add(new Property("expirationType", "CodeableConcept", "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.", 0, 1, expirationType));
11355        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));
11356        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));
11357        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));
11358        children.add(new Property("site", "Reference(Location)", "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE, site));
11359        children.add(new Property("name", "string", "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
11360        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, title));
11361        children.add(new Property("subtitle", "string", "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, subtitle));
11362        children.add(new Property("alias", "string", "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.", 0, java.lang.Integer.MAX_VALUE, alias));
11363        children.add(new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.", 0, 1, author));
11364        children.add(new Property("scope", "CodeableConcept", "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1, scope));
11365        children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic));
11366        children.add(new Property("type", "CodeableConcept", "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.", 0, 1, type));
11367        children.add(new Property("subType", "CodeableConcept", "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.", 0, java.lang.Integer.MAX_VALUE, subType));
11368        children.add(new Property("contentDefinition", "", "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.", 0, 1, contentDefinition));
11369        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));
11370        children.add(new Property("supportingInfo", "Reference(Any)", "Information that may be needed by/relevant to the performer in their execution of this term action.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
11371        children.add(new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
11372        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));
11373        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));
11374        children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
11375        children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
11376        children.add(new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "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, legallyBinding));
11377      }
11378
11379      @Override
11380      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11381        switch (_hash) {
11382        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier);
11383        case 116079: /*url*/  return new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url);
11384        case 351608024: /*version*/  return new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version);
11385        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
11386        case 568606040: /*legalState*/  return new Property("legalState", "CodeableConcept", "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.", 0, 1, legalState);
11387        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "Reference(Contract)", "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.", 0, 1, instantiatesCanonical);
11388        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.", 0, 1, instantiatesUri);
11389        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);
11390        case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
11391        case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
11392        case -668311927: /*expirationType*/  return new Property("expirationType", "CodeableConcept", "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.", 0, 1, expirationType);
11393        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);
11394        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);
11395        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);
11396        case 3530567: /*site*/  return new Property("site", "Reference(Location)", "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE, site);
11397        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
11398        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, title);
11399        case -2060497896: /*subtitle*/  return new Property("subtitle", "string", "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, subtitle);
11400        case 92902992: /*alias*/  return new Property("alias", "string", "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.", 0, java.lang.Integer.MAX_VALUE, alias);
11401        case -1406328437: /*author*/  return new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.", 0, 1, author);
11402        case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1, scope);
11403        case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11404        case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11405        case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11406        case -343345444: /*topicReference*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11407        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.", 0, 1, type);
11408        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.", 0, java.lang.Integer.MAX_VALUE, subType);
11409        case 247055020: /*contentDefinition*/  return new Property("contentDefinition", "", "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.", 0, 1, contentDefinition);
11410        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);
11411        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Information that may be needed by/relevant to the performer in their execution of this term action.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
11412        case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
11413        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);
11414        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);
11415        case 102851257: /*legal*/  return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal);
11416        case 3512060: /*rule*/  return new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule);
11417        case -772497791: /*legallyBinding[x]*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "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, legallyBinding);
11418        case -126751329: /*legallyBinding*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "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, legallyBinding);
11419        case 344057890: /*legallyBindingAttachment*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "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, legallyBinding);
11420        case -296528788: /*legallyBindingReference*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "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, legallyBinding);
11421        default: return super.getNamedProperty(_hash, _name, _checkValid);
11422        }
11423
11424      }
11425
11426      @Override
11427      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11428        switch (hash) {
11429        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
11430        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
11431        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
11432        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractStatus>
11433        case 568606040: /*legalState*/ return this.legalState == null ? new Base[0] : new Base[] {this.legalState}; // CodeableConcept
11434        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : new Base[] {this.instantiatesCanonical}; // Reference
11435        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : new Base[] {this.instantiatesUri}; // UriType
11436        case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
11437        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
11438        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
11439        case -668311927: /*expirationType*/ return this.expirationType == null ? new Base[0] : new Base[] {this.expirationType}; // CodeableConcept
11440        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
11441        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : this.authority.toArray(new Base[this.authority.size()]); // Reference
11442        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
11443        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
11444        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11445        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
11446        case -2060497896: /*subtitle*/ return this.subtitle == null ? new Base[0] : new Base[] {this.subtitle}; // StringType
11447        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
11448        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
11449        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
11450        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Type
11451        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11452        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
11453        case 247055020: /*contentDefinition*/ return this.contentDefinition == null ? new Base[0] : new Base[] {this.contentDefinition}; // ContentDefinitionComponent
11454        case 3556460: /*term*/ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
11455        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
11456        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
11457        case -902467798: /*signer*/ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
11458        case -1423054677: /*friendly*/ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
11459        case 102851257: /*legal*/ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
11460        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
11461        case -126751329: /*legallyBinding*/ return this.legallyBinding == null ? new Base[0] : new Base[] {this.legallyBinding}; // Type
11462        default: return super.getProperty(hash, name, checkValid);
11463        }
11464
11465      }
11466
11467      @Override
11468      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11469        switch (hash) {
11470        case -1618432855: // identifier
11471          this.getIdentifier().add(castToIdentifier(value)); // Identifier
11472          return value;
11473        case 116079: // url
11474          this.url = castToUri(value); // UriType
11475          return value;
11476        case 351608024: // version
11477          this.version = castToString(value); // StringType
11478          return value;
11479        case -892481550: // status
11480          value = new ContractStatusEnumFactory().fromType(castToCode(value));
11481          this.status = (Enumeration) value; // Enumeration<ContractStatus>
11482          return value;
11483        case 568606040: // legalState
11484          this.legalState = castToCodeableConcept(value); // CodeableConcept
11485          return value;
11486        case 8911915: // instantiatesCanonical
11487          this.instantiatesCanonical = castToReference(value); // Reference
11488          return value;
11489        case -1926393373: // instantiatesUri
11490          this.instantiatesUri = castToUri(value); // UriType
11491          return value;
11492        case -92412192: // contentDerivative
11493          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
11494          return value;
11495        case -1179159893: // issued
11496          this.issued = castToDateTime(value); // DateTimeType
11497          return value;
11498        case -793235316: // applies
11499          this.applies = castToPeriod(value); // Period
11500          return value;
11501        case -668311927: // expirationType
11502          this.expirationType = castToCodeableConcept(value); // CodeableConcept
11503          return value;
11504        case -1867885268: // subject
11505          this.getSubject().add(castToReference(value)); // Reference
11506          return value;
11507        case 1475610435: // authority
11508          this.getAuthority().add(castToReference(value)); // Reference
11509          return value;
11510        case -1326197564: // domain
11511          this.getDomain().add(castToReference(value)); // Reference
11512          return value;
11513        case 3530567: // site
11514          this.getSite().add(castToReference(value)); // Reference
11515          return value;
11516        case 3373707: // name
11517          this.name = castToString(value); // StringType
11518          return value;
11519        case 110371416: // title
11520          this.title = castToString(value); // StringType
11521          return value;
11522        case -2060497896: // subtitle
11523          this.subtitle = castToString(value); // StringType
11524          return value;
11525        case 92902992: // alias
11526          this.getAlias().add(castToString(value)); // StringType
11527          return value;
11528        case -1406328437: // author
11529          this.author = castToReference(value); // Reference
11530          return value;
11531        case 109264468: // scope
11532          this.scope = castToCodeableConcept(value); // CodeableConcept
11533          return value;
11534        case 110546223: // topic
11535          this.topic = castToType(value); // Type
11536          return value;
11537        case 3575610: // type
11538          this.type = castToCodeableConcept(value); // CodeableConcept
11539          return value;
11540        case -1868521062: // subType
11541          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
11542          return value;
11543        case 247055020: // contentDefinition
11544          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
11545          return value;
11546        case 3556460: // term
11547          this.getTerm().add((TermComponent) value); // TermComponent
11548          return value;
11549        case 1922406657: // supportingInfo
11550          this.getSupportingInfo().add(castToReference(value)); // Reference
11551          return value;
11552        case 1538891575: // relevantHistory
11553          this.getRelevantHistory().add(castToReference(value)); // Reference
11554          return value;
11555        case -902467798: // signer
11556          this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
11557          return value;
11558        case -1423054677: // friendly
11559          this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
11560          return value;
11561        case 102851257: // legal
11562          this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
11563          return value;
11564        case 3512060: // rule
11565          this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
11566          return value;
11567        case -126751329: // legallyBinding
11568          this.legallyBinding = castToType(value); // Type
11569          return value;
11570        default: return super.setProperty(hash, name, value);
11571        }
11572
11573      }
11574
11575      @Override
11576      public Base setProperty(String name, Base value) throws FHIRException {
11577        if (name.equals("identifier")) {
11578          this.getIdentifier().add(castToIdentifier(value));
11579        } else if (name.equals("url")) {
11580          this.url = castToUri(value); // UriType
11581        } else if (name.equals("version")) {
11582          this.version = castToString(value); // StringType
11583        } else if (name.equals("status")) {
11584          value = new ContractStatusEnumFactory().fromType(castToCode(value));
11585          this.status = (Enumeration) value; // Enumeration<ContractStatus>
11586        } else if (name.equals("legalState")) {
11587          this.legalState = castToCodeableConcept(value); // CodeableConcept
11588        } else if (name.equals("instantiatesCanonical")) {
11589          this.instantiatesCanonical = castToReference(value); // Reference
11590        } else if (name.equals("instantiatesUri")) {
11591          this.instantiatesUri = castToUri(value); // UriType
11592        } else if (name.equals("contentDerivative")) {
11593          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
11594        } else if (name.equals("issued")) {
11595          this.issued = castToDateTime(value); // DateTimeType
11596        } else if (name.equals("applies")) {
11597          this.applies = castToPeriod(value); // Period
11598        } else if (name.equals("expirationType")) {
11599          this.expirationType = castToCodeableConcept(value); // CodeableConcept
11600        } else if (name.equals("subject")) {
11601          this.getSubject().add(castToReference(value));
11602        } else if (name.equals("authority")) {
11603          this.getAuthority().add(castToReference(value));
11604        } else if (name.equals("domain")) {
11605          this.getDomain().add(castToReference(value));
11606        } else if (name.equals("site")) {
11607          this.getSite().add(castToReference(value));
11608        } else if (name.equals("name")) {
11609          this.name = castToString(value); // StringType
11610        } else if (name.equals("title")) {
11611          this.title = castToString(value); // StringType
11612        } else if (name.equals("subtitle")) {
11613          this.subtitle = castToString(value); // StringType
11614        } else if (name.equals("alias")) {
11615          this.getAlias().add(castToString(value));
11616        } else if (name.equals("author")) {
11617          this.author = castToReference(value); // Reference
11618        } else if (name.equals("scope")) {
11619          this.scope = castToCodeableConcept(value); // CodeableConcept
11620        } else if (name.equals("topic[x]")) {
11621          this.topic = castToType(value); // Type
11622        } else if (name.equals("type")) {
11623          this.type = castToCodeableConcept(value); // CodeableConcept
11624        } else if (name.equals("subType")) {
11625          this.getSubType().add(castToCodeableConcept(value));
11626        } else if (name.equals("contentDefinition")) {
11627          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
11628        } else if (name.equals("term")) {
11629          this.getTerm().add((TermComponent) value);
11630        } else if (name.equals("supportingInfo")) {
11631          this.getSupportingInfo().add(castToReference(value));
11632        } else if (name.equals("relevantHistory")) {
11633          this.getRelevantHistory().add(castToReference(value));
11634        } else if (name.equals("signer")) {
11635          this.getSigner().add((SignatoryComponent) value);
11636        } else if (name.equals("friendly")) {
11637          this.getFriendly().add((FriendlyLanguageComponent) value);
11638        } else if (name.equals("legal")) {
11639          this.getLegal().add((LegalLanguageComponent) value);
11640        } else if (name.equals("rule")) {
11641          this.getRule().add((ComputableLanguageComponent) value);
11642        } else if (name.equals("legallyBinding[x]")) {
11643          this.legallyBinding = castToType(value); // Type
11644        } else
11645          return super.setProperty(name, value);
11646        return value;
11647      }
11648
11649      @Override
11650      public Base makeProperty(int hash, String name) throws FHIRException {
11651        switch (hash) {
11652        case -1618432855:  return addIdentifier(); 
11653        case 116079:  return getUrlElement();
11654        case 351608024:  return getVersionElement();
11655        case -892481550:  return getStatusElement();
11656        case 568606040:  return getLegalState(); 
11657        case 8911915:  return getInstantiatesCanonical(); 
11658        case -1926393373:  return getInstantiatesUriElement();
11659        case -92412192:  return getContentDerivative(); 
11660        case -1179159893:  return getIssuedElement();
11661        case -793235316:  return getApplies(); 
11662        case -668311927:  return getExpirationType(); 
11663        case -1867885268:  return addSubject(); 
11664        case 1475610435:  return addAuthority(); 
11665        case -1326197564:  return addDomain(); 
11666        case 3530567:  return addSite(); 
11667        case 3373707:  return getNameElement();
11668        case 110371416:  return getTitleElement();
11669        case -2060497896:  return getSubtitleElement();
11670        case 92902992:  return addAliasElement();
11671        case -1406328437:  return getAuthor(); 
11672        case 109264468:  return getScope(); 
11673        case -957295375:  return getTopic(); 
11674        case 110546223:  return getTopic(); 
11675        case 3575610:  return getType(); 
11676        case -1868521062:  return addSubType(); 
11677        case 247055020:  return getContentDefinition(); 
11678        case 3556460:  return addTerm(); 
11679        case 1922406657:  return addSupportingInfo(); 
11680        case 1538891575:  return addRelevantHistory(); 
11681        case -902467798:  return addSigner(); 
11682        case -1423054677:  return addFriendly(); 
11683        case 102851257:  return addLegal(); 
11684        case 3512060:  return addRule(); 
11685        case -772497791:  return getLegallyBinding(); 
11686        case -126751329:  return getLegallyBinding(); 
11687        default: return super.makeProperty(hash, name);
11688        }
11689
11690      }
11691
11692      @Override
11693      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11694        switch (hash) {
11695        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11696        case 116079: /*url*/ return new String[] {"uri"};
11697        case 351608024: /*version*/ return new String[] {"string"};
11698        case -892481550: /*status*/ return new String[] {"code"};
11699        case 568606040: /*legalState*/ return new String[] {"CodeableConcept"};
11700        case 8911915: /*instantiatesCanonical*/ return new String[] {"Reference"};
11701        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
11702        case -92412192: /*contentDerivative*/ return new String[] {"CodeableConcept"};
11703        case -1179159893: /*issued*/ return new String[] {"dateTime"};
11704        case -793235316: /*applies*/ return new String[] {"Period"};
11705        case -668311927: /*expirationType*/ return new String[] {"CodeableConcept"};
11706        case -1867885268: /*subject*/ return new String[] {"Reference"};
11707        case 1475610435: /*authority*/ return new String[] {"Reference"};
11708        case -1326197564: /*domain*/ return new String[] {"Reference"};
11709        case 3530567: /*site*/ return new String[] {"Reference"};
11710        case 3373707: /*name*/ return new String[] {"string"};
11711        case 110371416: /*title*/ return new String[] {"string"};
11712        case -2060497896: /*subtitle*/ return new String[] {"string"};
11713        case 92902992: /*alias*/ return new String[] {"string"};
11714        case -1406328437: /*author*/ return new String[] {"Reference"};
11715        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
11716        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
11717        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11718        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
11719        case 247055020: /*contentDefinition*/ return new String[] {};
11720        case 3556460: /*term*/ return new String[] {};
11721        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
11722        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
11723        case -902467798: /*signer*/ return new String[] {};
11724        case -1423054677: /*friendly*/ return new String[] {};
11725        case 102851257: /*legal*/ return new String[] {};
11726        case 3512060: /*rule*/ return new String[] {};
11727        case -126751329: /*legallyBinding*/ return new String[] {"Attachment", "Reference"};
11728        default: return super.getTypesForProperty(hash, name);
11729        }
11730
11731      }
11732
11733      @Override
11734      public Base addChild(String name) throws FHIRException {
11735        if (name.equals("identifier")) {
11736          return addIdentifier();
11737        }
11738        else if (name.equals("url")) {
11739          throw new FHIRException("Cannot call addChild on a primitive type Contract.url");
11740        }
11741        else if (name.equals("version")) {
11742          throw new FHIRException("Cannot call addChild on a primitive type Contract.version");
11743        }
11744        else if (name.equals("status")) {
11745          throw new FHIRException("Cannot call addChild on a primitive type Contract.status");
11746        }
11747        else if (name.equals("legalState")) {
11748          this.legalState = new CodeableConcept();
11749          return this.legalState;
11750        }
11751        else if (name.equals("instantiatesCanonical")) {
11752          this.instantiatesCanonical = new Reference();
11753          return this.instantiatesCanonical;
11754        }
11755        else if (name.equals("instantiatesUri")) {
11756          throw new FHIRException("Cannot call addChild on a primitive type Contract.instantiatesUri");
11757        }
11758        else if (name.equals("contentDerivative")) {
11759          this.contentDerivative = new CodeableConcept();
11760          return this.contentDerivative;
11761        }
11762        else if (name.equals("issued")) {
11763          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
11764        }
11765        else if (name.equals("applies")) {
11766          this.applies = new Period();
11767          return this.applies;
11768        }
11769        else if (name.equals("expirationType")) {
11770          this.expirationType = new CodeableConcept();
11771          return this.expirationType;
11772        }
11773        else if (name.equals("subject")) {
11774          return addSubject();
11775        }
11776        else if (name.equals("authority")) {
11777          return addAuthority();
11778        }
11779        else if (name.equals("domain")) {
11780          return addDomain();
11781        }
11782        else if (name.equals("site")) {
11783          return addSite();
11784        }
11785        else if (name.equals("name")) {
11786          throw new FHIRException("Cannot call addChild on a primitive type Contract.name");
11787        }
11788        else if (name.equals("title")) {
11789          throw new FHIRException("Cannot call addChild on a primitive type Contract.title");
11790        }
11791        else if (name.equals("subtitle")) {
11792          throw new FHIRException("Cannot call addChild on a primitive type Contract.subtitle");
11793        }
11794        else if (name.equals("alias")) {
11795          throw new FHIRException("Cannot call addChild on a primitive type Contract.alias");
11796        }
11797        else if (name.equals("author")) {
11798          this.author = new Reference();
11799          return this.author;
11800        }
11801        else if (name.equals("scope")) {
11802          this.scope = new CodeableConcept();
11803          return this.scope;
11804        }
11805        else if (name.equals("topicCodeableConcept")) {
11806          this.topic = new CodeableConcept();
11807          return this.topic;
11808        }
11809        else if (name.equals("topicReference")) {
11810          this.topic = new Reference();
11811          return this.topic;
11812        }
11813        else if (name.equals("type")) {
11814          this.type = new CodeableConcept();
11815          return this.type;
11816        }
11817        else if (name.equals("subType")) {
11818          return addSubType();
11819        }
11820        else if (name.equals("contentDefinition")) {
11821          this.contentDefinition = new ContentDefinitionComponent();
11822          return this.contentDefinition;
11823        }
11824        else if (name.equals("term")) {
11825          return addTerm();
11826        }
11827        else if (name.equals("supportingInfo")) {
11828          return addSupportingInfo();
11829        }
11830        else if (name.equals("relevantHistory")) {
11831          return addRelevantHistory();
11832        }
11833        else if (name.equals("signer")) {
11834          return addSigner();
11835        }
11836        else if (name.equals("friendly")) {
11837          return addFriendly();
11838        }
11839        else if (name.equals("legal")) {
11840          return addLegal();
11841        }
11842        else if (name.equals("rule")) {
11843          return addRule();
11844        }
11845        else if (name.equals("legallyBindingAttachment")) {
11846          this.legallyBinding = new Attachment();
11847          return this.legallyBinding;
11848        }
11849        else if (name.equals("legallyBindingReference")) {
11850          this.legallyBinding = new Reference();
11851          return this.legallyBinding;
11852        }
11853        else
11854          return super.addChild(name);
11855      }
11856
11857  public String fhirType() {
11858    return "Contract";
11859
11860  }
11861
11862      public Contract copy() {
11863        Contract dst = new Contract();
11864        copyValues(dst);
11865        return dst;
11866      }
11867
11868      public void copyValues(Contract dst) {
11869        super.copyValues(dst);
11870        if (identifier != null) {
11871          dst.identifier = new ArrayList<Identifier>();
11872          for (Identifier i : identifier)
11873            dst.identifier.add(i.copy());
11874        };
11875        dst.url = url == null ? null : url.copy();
11876        dst.version = version == null ? null : version.copy();
11877        dst.status = status == null ? null : status.copy();
11878        dst.legalState = legalState == null ? null : legalState.copy();
11879        dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
11880        dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
11881        dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
11882        dst.issued = issued == null ? null : issued.copy();
11883        dst.applies = applies == null ? null : applies.copy();
11884        dst.expirationType = expirationType == null ? null : expirationType.copy();
11885        if (subject != null) {
11886          dst.subject = new ArrayList<Reference>();
11887          for (Reference i : subject)
11888            dst.subject.add(i.copy());
11889        };
11890        if (authority != null) {
11891          dst.authority = new ArrayList<Reference>();
11892          for (Reference i : authority)
11893            dst.authority.add(i.copy());
11894        };
11895        if (domain != null) {
11896          dst.domain = new ArrayList<Reference>();
11897          for (Reference i : domain)
11898            dst.domain.add(i.copy());
11899        };
11900        if (site != null) {
11901          dst.site = new ArrayList<Reference>();
11902          for (Reference i : site)
11903            dst.site.add(i.copy());
11904        };
11905        dst.name = name == null ? null : name.copy();
11906        dst.title = title == null ? null : title.copy();
11907        dst.subtitle = subtitle == null ? null : subtitle.copy();
11908        if (alias != null) {
11909          dst.alias = new ArrayList<StringType>();
11910          for (StringType i : alias)
11911            dst.alias.add(i.copy());
11912        };
11913        dst.author = author == null ? null : author.copy();
11914        dst.scope = scope == null ? null : scope.copy();
11915        dst.topic = topic == null ? null : topic.copy();
11916        dst.type = type == null ? null : type.copy();
11917        if (subType != null) {
11918          dst.subType = new ArrayList<CodeableConcept>();
11919          for (CodeableConcept i : subType)
11920            dst.subType.add(i.copy());
11921        };
11922        dst.contentDefinition = contentDefinition == null ? null : contentDefinition.copy();
11923        if (term != null) {
11924          dst.term = new ArrayList<TermComponent>();
11925          for (TermComponent i : term)
11926            dst.term.add(i.copy());
11927        };
11928        if (supportingInfo != null) {
11929          dst.supportingInfo = new ArrayList<Reference>();
11930          for (Reference i : supportingInfo)
11931            dst.supportingInfo.add(i.copy());
11932        };
11933        if (relevantHistory != null) {
11934          dst.relevantHistory = new ArrayList<Reference>();
11935          for (Reference i : relevantHistory)
11936            dst.relevantHistory.add(i.copy());
11937        };
11938        if (signer != null) {
11939          dst.signer = new ArrayList<SignatoryComponent>();
11940          for (SignatoryComponent i : signer)
11941            dst.signer.add(i.copy());
11942        };
11943        if (friendly != null) {
11944          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
11945          for (FriendlyLanguageComponent i : friendly)
11946            dst.friendly.add(i.copy());
11947        };
11948        if (legal != null) {
11949          dst.legal = new ArrayList<LegalLanguageComponent>();
11950          for (LegalLanguageComponent i : legal)
11951            dst.legal.add(i.copy());
11952        };
11953        if (rule != null) {
11954          dst.rule = new ArrayList<ComputableLanguageComponent>();
11955          for (ComputableLanguageComponent i : rule)
11956            dst.rule.add(i.copy());
11957        };
11958        dst.legallyBinding = legallyBinding == null ? null : legallyBinding.copy();
11959      }
11960
11961      protected Contract typedCopy() {
11962        return copy();
11963      }
11964
11965      @Override
11966      public boolean equalsDeep(Base other_) {
11967        if (!super.equalsDeep(other_))
11968          return false;
11969        if (!(other_ instanceof Contract))
11970          return false;
11971        Contract o = (Contract) other_;
11972        return compareDeep(identifier, o.identifier, true) && compareDeep(url, o.url, true) && compareDeep(version, o.version, true)
11973           && compareDeep(status, o.status, true) && compareDeep(legalState, o.legalState, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
11974           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(contentDerivative, o.contentDerivative, true)
11975           && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true) && compareDeep(expirationType, o.expirationType, true)
11976           && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true)
11977           && compareDeep(site, o.site, true) && compareDeep(name, o.name, true) && compareDeep(title, o.title, true)
11978           && compareDeep(subtitle, o.subtitle, true) && compareDeep(alias, o.alias, true) && compareDeep(author, o.author, true)
11979           && compareDeep(scope, o.scope, true) && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true)
11980           && compareDeep(subType, o.subType, true) && compareDeep(contentDefinition, o.contentDefinition, true)
11981           && compareDeep(term, o.term, true) && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(relevantHistory, o.relevantHistory, true)
11982           && compareDeep(signer, o.signer, true) && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true)
11983           && compareDeep(rule, o.rule, true) && compareDeep(legallyBinding, o.legallyBinding, true);
11984      }
11985
11986      @Override
11987      public boolean equalsShallow(Base other_) {
11988        if (!super.equalsShallow(other_))
11989          return false;
11990        if (!(other_ instanceof Contract))
11991          return false;
11992        Contract o = (Contract) other_;
11993        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(status, o.status, true)
11994           && compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(issued, o.issued, true)
11995           && compareValues(name, o.name, true) && compareValues(title, o.title, true) && compareValues(subtitle, o.subtitle, true)
11996           && compareValues(alias, o.alias, true);
11997      }
11998
11999      public boolean isEmpty() {
12000        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, url, version
12001          , status, legalState, instantiatesCanonical, instantiatesUri, contentDerivative, issued
12002          , applies, expirationType, subject, authority, domain, site, name, title, subtitle
12003          , alias, author, scope, topic, type, subType, contentDefinition, term, supportingInfo
12004          , relevantHistory, signer, friendly, legal, rule, legallyBinding);
12005      }
12006
12007  @Override
12008  public ResourceType getResourceType() {
12009    return ResourceType.Contract;
12010   }
12011
12012 /**
12013   * Search parameter: <b>identifier</b>
12014   * <p>
12015   * Description: <b>The identity of the contract</b><br>
12016   * Type: <b>token</b><br>
12017   * Path: <b>Contract.identifier</b><br>
12018   * </p>
12019   */
12020  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
12021  public static final String SP_IDENTIFIER = "identifier";
12022 /**
12023   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12024   * <p>
12025   * Description: <b>The identity of the contract</b><br>
12026   * Type: <b>token</b><br>
12027   * Path: <b>Contract.identifier</b><br>
12028   * </p>
12029   */
12030  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12031
12032 /**
12033   * Search parameter: <b>instantiates</b>
12034   * <p>
12035   * Description: <b>A source definition of the contract</b><br>
12036   * Type: <b>uri</b><br>
12037   * Path: <b>Contract.instantiatesUri</b><br>
12038   * </p>
12039   */
12040  @SearchParamDefinition(name="instantiates", path="Contract.instantiatesUri", description="A source definition of the contract", type="uri" )
12041  public static final String SP_INSTANTIATES = "instantiates";
12042 /**
12043   * <b>Fluent Client</b> search parameter constant for <b>instantiates</b>
12044   * <p>
12045   * Description: <b>A source definition of the contract</b><br>
12046   * Type: <b>uri</b><br>
12047   * Path: <b>Contract.instantiatesUri</b><br>
12048   * </p>
12049   */
12050  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES);
12051
12052 /**
12053   * Search parameter: <b>patient</b>
12054   * <p>
12055   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
12056   * Type: <b>reference</b><br>
12057   * Path: <b>Contract.subject</b><br>
12058   * </p>
12059   */
12060  @SearchParamDefinition(name="patient", path="Contract.subject.where(resolve() is Patient)", description="The identity of the subject of the contract (if a patient)", type="reference", target={Patient.class } )
12061  public static final String SP_PATIENT = "patient";
12062 /**
12063   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
12064   * <p>
12065   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
12066   * Type: <b>reference</b><br>
12067   * Path: <b>Contract.subject</b><br>
12068   * </p>
12069   */
12070  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
12071
12072/**
12073   * Constant for fluent queries to be used to add include statements. Specifies
12074   * the path value of "<b>Contract:patient</b>".
12075   */
12076  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Contract:patient").toLocked();
12077
12078 /**
12079   * Search parameter: <b>subject</b>
12080   * <p>
12081   * Description: <b>The identity of the subject of the contract</b><br>
12082   * Type: <b>reference</b><br>
12083   * Path: <b>Contract.subject</b><br>
12084   * </p>
12085   */
12086  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the subject of the contract", type="reference" )
12087  public static final String SP_SUBJECT = "subject";
12088 /**
12089   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
12090   * <p>
12091   * Description: <b>The identity of the subject of the contract</b><br>
12092   * Type: <b>reference</b><br>
12093   * Path: <b>Contract.subject</b><br>
12094   * </p>
12095   */
12096  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
12097
12098/**
12099   * Constant for fluent queries to be used to add include statements. Specifies
12100   * the path value of "<b>Contract:subject</b>".
12101   */
12102  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Contract:subject").toLocked();
12103
12104 /**
12105   * Search parameter: <b>authority</b>
12106   * <p>
12107   * Description: <b>The authority of the contract</b><br>
12108   * Type: <b>reference</b><br>
12109   * Path: <b>Contract.authority</b><br>
12110   * </p>
12111   */
12112  @SearchParamDefinition(name="authority", path="Contract.authority", description="The authority of the contract", type="reference", target={Organization.class } )
12113  public static final String SP_AUTHORITY = "authority";
12114 /**
12115   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
12116   * <p>
12117   * Description: <b>The authority of the contract</b><br>
12118   * Type: <b>reference</b><br>
12119   * Path: <b>Contract.authority</b><br>
12120   * </p>
12121   */
12122  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHORITY);
12123
12124/**
12125   * Constant for fluent queries to be used to add include statements. Specifies
12126   * the path value of "<b>Contract:authority</b>".
12127   */
12128  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include("Contract:authority").toLocked();
12129
12130 /**
12131   * Search parameter: <b>domain</b>
12132   * <p>
12133   * Description: <b>The domain of the contract</b><br>
12134   * Type: <b>reference</b><br>
12135   * Path: <b>Contract.domain</b><br>
12136   * </p>
12137   */
12138  @SearchParamDefinition(name="domain", path="Contract.domain", description="The domain of the contract", type="reference", target={Location.class } )
12139  public static final String SP_DOMAIN = "domain";
12140 /**
12141   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
12142   * <p>
12143   * Description: <b>The domain of the contract</b><br>
12144   * Type: <b>reference</b><br>
12145   * Path: <b>Contract.domain</b><br>
12146   * </p>
12147   */
12148  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DOMAIN);
12149
12150/**
12151   * Constant for fluent queries to be used to add include statements. Specifies
12152   * the path value of "<b>Contract:domain</b>".
12153   */
12154  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include("Contract:domain").toLocked();
12155
12156 /**
12157   * Search parameter: <b>issued</b>
12158   * <p>
12159   * Description: <b>The date/time the contract was issued</b><br>
12160   * Type: <b>date</b><br>
12161   * Path: <b>Contract.issued</b><br>
12162   * </p>
12163   */
12164  @SearchParamDefinition(name="issued", path="Contract.issued", description="The date/time the contract was issued", type="date" )
12165  public static final String SP_ISSUED = "issued";
12166 /**
12167   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
12168   * <p>
12169   * Description: <b>The date/time the contract was issued</b><br>
12170   * Type: <b>date</b><br>
12171   * Path: <b>Contract.issued</b><br>
12172   * </p>
12173   */
12174  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
12175
12176 /**
12177   * Search parameter: <b>url</b>
12178   * <p>
12179   * Description: <b>The basal contract definition</b><br>
12180   * Type: <b>uri</b><br>
12181   * Path: <b>Contract.url</b><br>
12182   * </p>
12183   */
12184  @SearchParamDefinition(name="url", path="Contract.url", description="The basal contract definition", type="uri" )
12185  public static final String SP_URL = "url";
12186 /**
12187   * <b>Fluent Client</b> search parameter constant for <b>url</b>
12188   * <p>
12189   * Description: <b>The basal contract definition</b><br>
12190   * Type: <b>uri</b><br>
12191   * Path: <b>Contract.url</b><br>
12192   * </p>
12193   */
12194  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
12195
12196 /**
12197   * Search parameter: <b>signer</b>
12198   * <p>
12199   * Description: <b>Contract Signatory Party</b><br>
12200   * Type: <b>reference</b><br>
12201   * Path: <b>Contract.signer.party</b><br>
12202   * </p>
12203   */
12204  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference", target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
12205  public static final String SP_SIGNER = "signer";
12206 /**
12207   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
12208   * <p>
12209   * Description: <b>Contract Signatory Party</b><br>
12210   * Type: <b>reference</b><br>
12211   * Path: <b>Contract.signer.party</b><br>
12212   * </p>
12213   */
12214  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SIGNER);
12215
12216/**
12217   * Constant for fluent queries to be used to add include statements. Specifies
12218   * the path value of "<b>Contract:signer</b>".
12219   */
12220  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include("Contract:signer").toLocked();
12221
12222 /**
12223   * Search parameter: <b>status</b>
12224   * <p>
12225   * Description: <b>The status of the contract</b><br>
12226   * Type: <b>token</b><br>
12227   * Path: <b>Contract.status</b><br>
12228   * </p>
12229   */
12230  @SearchParamDefinition(name="status", path="Contract.status", description="The status of the contract", type="token" )
12231  public static final String SP_STATUS = "status";
12232 /**
12233   * <b>Fluent Client</b> search parameter constant for <b>status</b>
12234   * <p>
12235   * Description: <b>The status of the contract</b><br>
12236   * Type: <b>token</b><br>
12237   * Path: <b>Contract.status</b><br>
12238   * </p>
12239   */
12240  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
12241
12242
12243}