001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import java.math.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.
053 */
054@ResourceDef(name="Contract", profile="http://hl7.org/fhir/StructureDefinition/Contract")
055public class Contract extends DomainResource {
056
057    public enum ContractResourcePublicationStatusCodes {
058        /**
059         * 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.
060         */
061        AMENDED, 
062        /**
063         * 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.
064         */
065        APPENDED, 
066        /**
067         * 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.
068         */
069        CANCELLED, 
070        /**
071         * 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.
072         */
073        DISPUTED, 
074        /**
075         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
076         */
077        ENTEREDINERROR, 
078        /**
079         * 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.
080         */
081        EXECUTABLE, 
082        /**
083         * 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.
084         */
085        EXECUTED, 
086        /**
087         * 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.
088         */
089        NEGOTIABLE, 
090        /**
091         * 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.
092         */
093        OFFERED, 
094        /**
095         * 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.
096         */
097        POLICY, 
098        /**
099         *  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.
100         */
101        REJECTED, 
102        /**
103         * 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.
104         */
105        RENEWED, 
106        /**
107         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
108         */
109        REVOKED, 
110        /**
111         * 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.
112         */
113        RESOLVED, 
114        /**
115         * 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.
116         */
117        TERMINATED, 
118        /**
119         * added to help the parsers with the generic types
120         */
121        NULL;
122        public static ContractResourcePublicationStatusCodes fromCode(String codeString) throws FHIRException {
123            if (codeString == null || "".equals(codeString))
124                return null;
125        if ("amended".equals(codeString))
126          return AMENDED;
127        if ("appended".equals(codeString))
128          return APPENDED;
129        if ("cancelled".equals(codeString))
130          return CANCELLED;
131        if ("disputed".equals(codeString))
132          return DISPUTED;
133        if ("entered-in-error".equals(codeString))
134          return ENTEREDINERROR;
135        if ("executable".equals(codeString))
136          return EXECUTABLE;
137        if ("executed".equals(codeString))
138          return EXECUTED;
139        if ("negotiable".equals(codeString))
140          return NEGOTIABLE;
141        if ("offered".equals(codeString))
142          return OFFERED;
143        if ("policy".equals(codeString))
144          return POLICY;
145        if ("rejected".equals(codeString))
146          return REJECTED;
147        if ("renewed".equals(codeString))
148          return RENEWED;
149        if ("revoked".equals(codeString))
150          return REVOKED;
151        if ("resolved".equals(codeString))
152          return RESOLVED;
153        if ("terminated".equals(codeString))
154          return TERMINATED;
155        if (Configuration.isAcceptInvalidEnums())
156          return null;
157        else
158          throw new FHIRException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
159        }
160        public String toCode() {
161          switch (this) {
162            case AMENDED: return "amended";
163            case APPENDED: return "appended";
164            case CANCELLED: return "cancelled";
165            case DISPUTED: return "disputed";
166            case ENTEREDINERROR: return "entered-in-error";
167            case EXECUTABLE: return "executable";
168            case EXECUTED: return "executed";
169            case NEGOTIABLE: return "negotiable";
170            case OFFERED: return "offered";
171            case POLICY: return "policy";
172            case REJECTED: return "rejected";
173            case RENEWED: return "renewed";
174            case REVOKED: return "revoked";
175            case RESOLVED: return "resolved";
176            case TERMINATED: return "terminated";
177            default: return "?";
178          }
179        }
180        public String getSystem() {
181          switch (this) {
182            case AMENDED: return "http://hl7.org/fhir/contract-publicationstatus";
183            case APPENDED: return "http://hl7.org/fhir/contract-publicationstatus";
184            case CANCELLED: return "http://hl7.org/fhir/contract-publicationstatus";
185            case DISPUTED: return "http://hl7.org/fhir/contract-publicationstatus";
186            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-publicationstatus";
187            case EXECUTABLE: return "http://hl7.org/fhir/contract-publicationstatus";
188            case EXECUTED: return "http://hl7.org/fhir/contract-publicationstatus";
189            case NEGOTIABLE: return "http://hl7.org/fhir/contract-publicationstatus";
190            case OFFERED: return "http://hl7.org/fhir/contract-publicationstatus";
191            case POLICY: return "http://hl7.org/fhir/contract-publicationstatus";
192            case REJECTED: return "http://hl7.org/fhir/contract-publicationstatus";
193            case RENEWED: return "http://hl7.org/fhir/contract-publicationstatus";
194            case REVOKED: return "http://hl7.org/fhir/contract-publicationstatus";
195            case RESOLVED: return "http://hl7.org/fhir/contract-publicationstatus";
196            case TERMINATED: return "http://hl7.org/fhir/contract-publicationstatus";
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            default: return "?";
218          }
219        }
220        public String getDisplay() {
221          switch (this) {
222            case AMENDED: return "Amended";
223            case APPENDED: return "Appended";
224            case CANCELLED: return "Cancelled";
225            case DISPUTED: return "Disputed";
226            case ENTEREDINERROR: return "Entered in Error";
227            case EXECUTABLE: return "Executable";
228            case EXECUTED: return "Executed";
229            case NEGOTIABLE: return "Negotiable";
230            case OFFERED: return "Offered";
231            case POLICY: return "Policy";
232            case REJECTED: return "Rejected";
233            case RENEWED: return "Renewed";
234            case REVOKED: return "Revoked";
235            case RESOLVED: return "Resolved";
236            case TERMINATED: return "Terminated";
237            default: return "?";
238          }
239        }
240    }
241
242  public static class ContractResourcePublicationStatusCodesEnumFactory implements EnumFactory<ContractResourcePublicationStatusCodes> {
243    public ContractResourcePublicationStatusCodes fromCode(String codeString) throws IllegalArgumentException {
244      if (codeString == null || "".equals(codeString))
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("amended".equals(codeString))
248          return ContractResourcePublicationStatusCodes.AMENDED;
249        if ("appended".equals(codeString))
250          return ContractResourcePublicationStatusCodes.APPENDED;
251        if ("cancelled".equals(codeString))
252          return ContractResourcePublicationStatusCodes.CANCELLED;
253        if ("disputed".equals(codeString))
254          return ContractResourcePublicationStatusCodes.DISPUTED;
255        if ("entered-in-error".equals(codeString))
256          return ContractResourcePublicationStatusCodes.ENTEREDINERROR;
257        if ("executable".equals(codeString))
258          return ContractResourcePublicationStatusCodes.EXECUTABLE;
259        if ("executed".equals(codeString))
260          return ContractResourcePublicationStatusCodes.EXECUTED;
261        if ("negotiable".equals(codeString))
262          return ContractResourcePublicationStatusCodes.NEGOTIABLE;
263        if ("offered".equals(codeString))
264          return ContractResourcePublicationStatusCodes.OFFERED;
265        if ("policy".equals(codeString))
266          return ContractResourcePublicationStatusCodes.POLICY;
267        if ("rejected".equals(codeString))
268          return ContractResourcePublicationStatusCodes.REJECTED;
269        if ("renewed".equals(codeString))
270          return ContractResourcePublicationStatusCodes.RENEWED;
271        if ("revoked".equals(codeString))
272          return ContractResourcePublicationStatusCodes.REVOKED;
273        if ("resolved".equals(codeString))
274          return ContractResourcePublicationStatusCodes.RESOLVED;
275        if ("terminated".equals(codeString))
276          return ContractResourcePublicationStatusCodes.TERMINATED;
277        throw new IllegalArgumentException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
278        }
279        public Enumeration<ContractResourcePublicationStatusCodes> fromType(Base code) throws FHIRException {
280          if (code == null)
281            return null;
282          if (code.isEmpty())
283            return new Enumeration<ContractResourcePublicationStatusCodes>(this);
284          String codeString = ((PrimitiveType) code).asStringValue();
285          if (codeString == null || "".equals(codeString))
286            return null;
287        if ("amended".equals(codeString))
288          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.AMENDED);
289        if ("appended".equals(codeString))
290          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.APPENDED);
291        if ("cancelled".equals(codeString))
292          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.CANCELLED);
293        if ("disputed".equals(codeString))
294          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.DISPUTED);
295        if ("entered-in-error".equals(codeString))
296          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.ENTEREDINERROR);
297        if ("executable".equals(codeString))
298          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.EXECUTABLE);
299        if ("executed".equals(codeString))
300          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.EXECUTED);
301        if ("negotiable".equals(codeString))
302          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.NEGOTIABLE);
303        if ("offered".equals(codeString))
304          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.OFFERED);
305        if ("policy".equals(codeString))
306          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.POLICY);
307        if ("rejected".equals(codeString))
308          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.REJECTED);
309        if ("renewed".equals(codeString))
310          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.RENEWED);
311        if ("revoked".equals(codeString))
312          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.REVOKED);
313        if ("resolved".equals(codeString))
314          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.RESOLVED);
315        if ("terminated".equals(codeString))
316          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.TERMINATED);
317        throw new FHIRException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
318        }
319    public String toCode(ContractResourcePublicationStatusCodes code) {
320      if (code == ContractResourcePublicationStatusCodes.AMENDED)
321        return "amended";
322      if (code == ContractResourcePublicationStatusCodes.APPENDED)
323        return "appended";
324      if (code == ContractResourcePublicationStatusCodes.CANCELLED)
325        return "cancelled";
326      if (code == ContractResourcePublicationStatusCodes.DISPUTED)
327        return "disputed";
328      if (code == ContractResourcePublicationStatusCodes.ENTEREDINERROR)
329        return "entered-in-error";
330      if (code == ContractResourcePublicationStatusCodes.EXECUTABLE)
331        return "executable";
332      if (code == ContractResourcePublicationStatusCodes.EXECUTED)
333        return "executed";
334      if (code == ContractResourcePublicationStatusCodes.NEGOTIABLE)
335        return "negotiable";
336      if (code == ContractResourcePublicationStatusCodes.OFFERED)
337        return "offered";
338      if (code == ContractResourcePublicationStatusCodes.POLICY)
339        return "policy";
340      if (code == ContractResourcePublicationStatusCodes.REJECTED)
341        return "rejected";
342      if (code == ContractResourcePublicationStatusCodes.RENEWED)
343        return "renewed";
344      if (code == ContractResourcePublicationStatusCodes.REVOKED)
345        return "revoked";
346      if (code == ContractResourcePublicationStatusCodes.RESOLVED)
347        return "resolved";
348      if (code == ContractResourcePublicationStatusCodes.TERMINATED)
349        return "terminated";
350      return "?";
351      }
352    public String toSystem(ContractResourcePublicationStatusCodes code) {
353      return code.getSystem();
354      }
355    }
356
357    public enum ContractResourceStatusCodes {
358        /**
359         * 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.
360         */
361        AMENDED, 
362        /**
363         * 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.
364         */
365        APPENDED, 
366        /**
367         * 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.
368         */
369        CANCELLED, 
370        /**
371         * 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.
372         */
373        DISPUTED, 
374        /**
375         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
376         */
377        ENTEREDINERROR, 
378        /**
379         * 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.
380         */
381        EXECUTABLE, 
382        /**
383         * 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.
384         */
385        EXECUTED, 
386        /**
387         * 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.
388         */
389        NEGOTIABLE, 
390        /**
391         * 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.
392         */
393        OFFERED, 
394        /**
395         * 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.
396         */
397        POLICY, 
398        /**
399         *  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.
400         */
401        REJECTED, 
402        /**
403         * 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.
404         */
405        RENEWED, 
406        /**
407         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
408         */
409        REVOKED, 
410        /**
411         * 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.
412         */
413        RESOLVED, 
414        /**
415         * 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.
416         */
417        TERMINATED, 
418        /**
419         * added to help the parsers with the generic types
420         */
421        NULL;
422        public static ContractResourceStatusCodes fromCode(String codeString) throws FHIRException {
423            if (codeString == null || "".equals(codeString))
424                return null;
425        if ("amended".equals(codeString))
426          return AMENDED;
427        if ("appended".equals(codeString))
428          return APPENDED;
429        if ("cancelled".equals(codeString))
430          return CANCELLED;
431        if ("disputed".equals(codeString))
432          return DISPUTED;
433        if ("entered-in-error".equals(codeString))
434          return ENTEREDINERROR;
435        if ("executable".equals(codeString))
436          return EXECUTABLE;
437        if ("executed".equals(codeString))
438          return EXECUTED;
439        if ("negotiable".equals(codeString))
440          return NEGOTIABLE;
441        if ("offered".equals(codeString))
442          return OFFERED;
443        if ("policy".equals(codeString))
444          return POLICY;
445        if ("rejected".equals(codeString))
446          return REJECTED;
447        if ("renewed".equals(codeString))
448          return RENEWED;
449        if ("revoked".equals(codeString))
450          return REVOKED;
451        if ("resolved".equals(codeString))
452          return RESOLVED;
453        if ("terminated".equals(codeString))
454          return TERMINATED;
455        if (Configuration.isAcceptInvalidEnums())
456          return null;
457        else
458          throw new FHIRException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
459        }
460        public String toCode() {
461          switch (this) {
462            case AMENDED: return "amended";
463            case APPENDED: return "appended";
464            case CANCELLED: return "cancelled";
465            case DISPUTED: return "disputed";
466            case ENTEREDINERROR: return "entered-in-error";
467            case EXECUTABLE: return "executable";
468            case EXECUTED: return "executed";
469            case NEGOTIABLE: return "negotiable";
470            case OFFERED: return "offered";
471            case POLICY: return "policy";
472            case REJECTED: return "rejected";
473            case RENEWED: return "renewed";
474            case REVOKED: return "revoked";
475            case RESOLVED: return "resolved";
476            case TERMINATED: return "terminated";
477            default: return "?";
478          }
479        }
480        public String getSystem() {
481          switch (this) {
482            case AMENDED: return "http://hl7.org/fhir/contract-status";
483            case APPENDED: return "http://hl7.org/fhir/contract-status";
484            case CANCELLED: return "http://hl7.org/fhir/contract-status";
485            case DISPUTED: return "http://hl7.org/fhir/contract-status";
486            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
487            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
488            case EXECUTED: return "http://hl7.org/fhir/contract-status";
489            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
490            case OFFERED: return "http://hl7.org/fhir/contract-status";
491            case POLICY: return "http://hl7.org/fhir/contract-status";
492            case REJECTED: return "http://hl7.org/fhir/contract-status";
493            case RENEWED: return "http://hl7.org/fhir/contract-status";
494            case REVOKED: return "http://hl7.org/fhir/contract-status";
495            case RESOLVED: return "http://hl7.org/fhir/contract-status";
496            case TERMINATED: return "http://hl7.org/fhir/contract-status";
497            default: return "?";
498          }
499        }
500        public String getDefinition() {
501          switch (this) {
502            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.";
503            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.";
504            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.";
505            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.";
506            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
507            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.";
508            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.";
509            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.";
510            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.";
511            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.";
512            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.";
513            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.";
514            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.";
515            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.";
516            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.";
517            default: return "?";
518          }
519        }
520        public String getDisplay() {
521          switch (this) {
522            case AMENDED: return "Amended";
523            case APPENDED: return "Appended";
524            case CANCELLED: return "Cancelled";
525            case DISPUTED: return "Disputed";
526            case ENTEREDINERROR: return "Entered in Error";
527            case EXECUTABLE: return "Executable";
528            case EXECUTED: return "Executed";
529            case NEGOTIABLE: return "Negotiable";
530            case OFFERED: return "Offered";
531            case POLICY: return "Policy";
532            case REJECTED: return "Rejected";
533            case RENEWED: return "Renewed";
534            case REVOKED: return "Revoked";
535            case RESOLVED: return "Resolved";
536            case TERMINATED: return "Terminated";
537            default: return "?";
538          }
539        }
540    }
541
542  public static class ContractResourceStatusCodesEnumFactory implements EnumFactory<ContractResourceStatusCodes> {
543    public ContractResourceStatusCodes fromCode(String codeString) throws IllegalArgumentException {
544      if (codeString == null || "".equals(codeString))
545            if (codeString == null || "".equals(codeString))
546                return null;
547        if ("amended".equals(codeString))
548          return ContractResourceStatusCodes.AMENDED;
549        if ("appended".equals(codeString))
550          return ContractResourceStatusCodes.APPENDED;
551        if ("cancelled".equals(codeString))
552          return ContractResourceStatusCodes.CANCELLED;
553        if ("disputed".equals(codeString))
554          return ContractResourceStatusCodes.DISPUTED;
555        if ("entered-in-error".equals(codeString))
556          return ContractResourceStatusCodes.ENTEREDINERROR;
557        if ("executable".equals(codeString))
558          return ContractResourceStatusCodes.EXECUTABLE;
559        if ("executed".equals(codeString))
560          return ContractResourceStatusCodes.EXECUTED;
561        if ("negotiable".equals(codeString))
562          return ContractResourceStatusCodes.NEGOTIABLE;
563        if ("offered".equals(codeString))
564          return ContractResourceStatusCodes.OFFERED;
565        if ("policy".equals(codeString))
566          return ContractResourceStatusCodes.POLICY;
567        if ("rejected".equals(codeString))
568          return ContractResourceStatusCodes.REJECTED;
569        if ("renewed".equals(codeString))
570          return ContractResourceStatusCodes.RENEWED;
571        if ("revoked".equals(codeString))
572          return ContractResourceStatusCodes.REVOKED;
573        if ("resolved".equals(codeString))
574          return ContractResourceStatusCodes.RESOLVED;
575        if ("terminated".equals(codeString))
576          return ContractResourceStatusCodes.TERMINATED;
577        throw new IllegalArgumentException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
578        }
579        public Enumeration<ContractResourceStatusCodes> fromType(Base code) throws FHIRException {
580          if (code == null)
581            return null;
582          if (code.isEmpty())
583            return new Enumeration<ContractResourceStatusCodes>(this);
584          String codeString = ((PrimitiveType) code).asStringValue();
585          if (codeString == null || "".equals(codeString))
586            return null;
587        if ("amended".equals(codeString))
588          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.AMENDED);
589        if ("appended".equals(codeString))
590          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.APPENDED);
591        if ("cancelled".equals(codeString))
592          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.CANCELLED);
593        if ("disputed".equals(codeString))
594          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.DISPUTED);
595        if ("entered-in-error".equals(codeString))
596          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.ENTEREDINERROR);
597        if ("executable".equals(codeString))
598          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.EXECUTABLE);
599        if ("executed".equals(codeString))
600          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.EXECUTED);
601        if ("negotiable".equals(codeString))
602          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.NEGOTIABLE);
603        if ("offered".equals(codeString))
604          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.OFFERED);
605        if ("policy".equals(codeString))
606          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.POLICY);
607        if ("rejected".equals(codeString))
608          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.REJECTED);
609        if ("renewed".equals(codeString))
610          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.RENEWED);
611        if ("revoked".equals(codeString))
612          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.REVOKED);
613        if ("resolved".equals(codeString))
614          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.RESOLVED);
615        if ("terminated".equals(codeString))
616          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.TERMINATED);
617        throw new FHIRException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
618        }
619    public String toCode(ContractResourceStatusCodes code) {
620      if (code == ContractResourceStatusCodes.AMENDED)
621        return "amended";
622      if (code == ContractResourceStatusCodes.APPENDED)
623        return "appended";
624      if (code == ContractResourceStatusCodes.CANCELLED)
625        return "cancelled";
626      if (code == ContractResourceStatusCodes.DISPUTED)
627        return "disputed";
628      if (code == ContractResourceStatusCodes.ENTEREDINERROR)
629        return "entered-in-error";
630      if (code == ContractResourceStatusCodes.EXECUTABLE)
631        return "executable";
632      if (code == ContractResourceStatusCodes.EXECUTED)
633        return "executed";
634      if (code == ContractResourceStatusCodes.NEGOTIABLE)
635        return "negotiable";
636      if (code == ContractResourceStatusCodes.OFFERED)
637        return "offered";
638      if (code == ContractResourceStatusCodes.POLICY)
639        return "policy";
640      if (code == ContractResourceStatusCodes.REJECTED)
641        return "rejected";
642      if (code == ContractResourceStatusCodes.RENEWED)
643        return "renewed";
644      if (code == ContractResourceStatusCodes.REVOKED)
645        return "revoked";
646      if (code == ContractResourceStatusCodes.RESOLVED)
647        return "resolved";
648      if (code == ContractResourceStatusCodes.TERMINATED)
649        return "terminated";
650      return "?";
651      }
652    public String toSystem(ContractResourceStatusCodes code) {
653      return code.getSystem();
654      }
655    }
656
657    @Block()
658    public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
659        /**
660         * 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.
661         */
662        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
663        @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." )
664        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-type")
665        protected CodeableConcept type;
666
667        /**
668         * Detailed Precusory content type.
669         */
670        @Child(name = "subType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
671        @Description(shortDefinition="Detailed Content Type Definition", formalDefinition="Detailed Precusory content type." )
672        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-subtype")
673        protected CodeableConcept subType;
674
675        /**
676         * The  individual or organization that published the Contract precursor content.
677         */
678        @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
679        @Description(shortDefinition="Publisher Entity", formalDefinition="The  individual or organization that published the Contract precursor content." )
680        protected Reference publisher;
681
682        /**
683         * 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.
684         */
685        @Child(name = "publicationDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
686        @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." )
687        protected DateTimeType publicationDate;
688
689        /**
690         * amended | appended | cancelled | disputed | entered-in-error | executable +.
691         */
692        @Child(name = "publicationStatus", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=false)
693        @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +", formalDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +." )
694        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-publicationstatus")
695        protected Enumeration<ContractResourcePublicationStatusCodes> publicationStatus;
696
697        /**
698         * A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
699         */
700        @Child(name = "copyright", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=false)
701        @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." )
702        protected MarkdownType copyright;
703
704        private static final long serialVersionUID = 306178803L;
705
706    /**
707     * Constructor
708     */
709      public ContentDefinitionComponent() {
710        super();
711      }
712
713    /**
714     * Constructor
715     */
716      public ContentDefinitionComponent(CodeableConcept type, ContractResourcePublicationStatusCodes publicationStatus) {
717        super();
718        this.setType(type);
719        this.setPublicationStatus(publicationStatus);
720      }
721
722        /**
723         * @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.)
724         */
725        public CodeableConcept getType() { 
726          if (this.type == null)
727            if (Configuration.errorOnAutoCreate())
728              throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
729            else if (Configuration.doAutoCreate())
730              this.type = new CodeableConcept(); // cc
731          return this.type;
732        }
733
734        public boolean hasType() { 
735          return this.type != null && !this.type.isEmpty();
736        }
737
738        /**
739         * @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.)
740         */
741        public ContentDefinitionComponent setType(CodeableConcept value) { 
742          this.type = value;
743          return this;
744        }
745
746        /**
747         * @return {@link #subType} (Detailed Precusory content type.)
748         */
749        public CodeableConcept getSubType() { 
750          if (this.subType == null)
751            if (Configuration.errorOnAutoCreate())
752              throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
753            else if (Configuration.doAutoCreate())
754              this.subType = new CodeableConcept(); // cc
755          return this.subType;
756        }
757
758        public boolean hasSubType() { 
759          return this.subType != null && !this.subType.isEmpty();
760        }
761
762        /**
763         * @param value {@link #subType} (Detailed Precusory content type.)
764         */
765        public ContentDefinitionComponent setSubType(CodeableConcept value) { 
766          this.subType = value;
767          return this;
768        }
769
770        /**
771         * @return {@link #publisher} (The  individual or organization that published the Contract precursor content.)
772         */
773        public Reference getPublisher() { 
774          if (this.publisher == null)
775            if (Configuration.errorOnAutoCreate())
776              throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
777            else if (Configuration.doAutoCreate())
778              this.publisher = new Reference(); // cc
779          return this.publisher;
780        }
781
782        public boolean hasPublisher() { 
783          return this.publisher != null && !this.publisher.isEmpty();
784        }
785
786        /**
787         * @param value {@link #publisher} (The  individual or organization that published the Contract precursor content.)
788         */
789        public ContentDefinitionComponent setPublisher(Reference value) { 
790          this.publisher = value;
791          return this;
792        }
793
794        /**
795         * @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
796         */
797        public DateTimeType getPublicationDateElement() { 
798          if (this.publicationDate == null)
799            if (Configuration.errorOnAutoCreate())
800              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
801            else if (Configuration.doAutoCreate())
802              this.publicationDate = new DateTimeType(); // bb
803          return this.publicationDate;
804        }
805
806        public boolean hasPublicationDateElement() { 
807          return this.publicationDate != null && !this.publicationDate.isEmpty();
808        }
809
810        public boolean hasPublicationDate() { 
811          return this.publicationDate != null && !this.publicationDate.isEmpty();
812        }
813
814        /**
815         * @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
816         */
817        public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) { 
818          this.publicationDate = value;
819          return this;
820        }
821
822        /**
823         * @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.
824         */
825        public Date getPublicationDate() { 
826          return this.publicationDate == null ? null : this.publicationDate.getValue();
827        }
828
829        /**
830         * @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.
831         */
832        public ContentDefinitionComponent setPublicationDate(Date value) { 
833          if (value == null)
834            this.publicationDate = null;
835          else {
836            if (this.publicationDate == null)
837              this.publicationDate = new DateTimeType();
838            this.publicationDate.setValue(value);
839          }
840          return this;
841        }
842
843        /**
844         * @return {@link #publicationStatus} (amended | appended | cancelled | disputed | entered-in-error | executable +.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
845         */
846        public Enumeration<ContractResourcePublicationStatusCodes> getPublicationStatusElement() { 
847          if (this.publicationStatus == null)
848            if (Configuration.errorOnAutoCreate())
849              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
850            else if (Configuration.doAutoCreate())
851              this.publicationStatus = new Enumeration<ContractResourcePublicationStatusCodes>(new ContractResourcePublicationStatusCodesEnumFactory()); // bb
852          return this.publicationStatus;
853        }
854
855        public boolean hasPublicationStatusElement() { 
856          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
857        }
858
859        public boolean hasPublicationStatus() { 
860          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
861        }
862
863        /**
864         * @param value {@link #publicationStatus} (amended | appended | cancelled | disputed | entered-in-error | executable +.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
865         */
866        public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractResourcePublicationStatusCodes> value) { 
867          this.publicationStatus = value;
868          return this;
869        }
870
871        /**
872         * @return amended | appended | cancelled | disputed | entered-in-error | executable +.
873         */
874        public ContractResourcePublicationStatusCodes getPublicationStatus() { 
875          return this.publicationStatus == null ? null : this.publicationStatus.getValue();
876        }
877
878        /**
879         * @param value amended | appended | cancelled | disputed | entered-in-error | executable +.
880         */
881        public ContentDefinitionComponent setPublicationStatus(ContractResourcePublicationStatusCodes value) { 
882            if (this.publicationStatus == null)
883              this.publicationStatus = new Enumeration<ContractResourcePublicationStatusCodes>(new ContractResourcePublicationStatusCodesEnumFactory());
884            this.publicationStatus.setValue(value);
885          return this;
886        }
887
888        /**
889         * @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
890         */
891        public MarkdownType getCopyrightElement() { 
892          if (this.copyright == null)
893            if (Configuration.errorOnAutoCreate())
894              throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
895            else if (Configuration.doAutoCreate())
896              this.copyright = new MarkdownType(); // bb
897          return this.copyright;
898        }
899
900        public boolean hasCopyrightElement() { 
901          return this.copyright != null && !this.copyright.isEmpty();
902        }
903
904        public boolean hasCopyright() { 
905          return this.copyright != null && !this.copyright.isEmpty();
906        }
907
908        /**
909         * @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
910         */
911        public ContentDefinitionComponent setCopyrightElement(MarkdownType value) { 
912          this.copyright = value;
913          return this;
914        }
915
916        /**
917         * @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.
918         */
919        public String getCopyright() { 
920          return this.copyright == null ? null : this.copyright.getValue();
921        }
922
923        /**
924         * @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.
925         */
926        public ContentDefinitionComponent setCopyright(String value) { 
927          if (value == null)
928            this.copyright = null;
929          else {
930            if (this.copyright == null)
931              this.copyright = new MarkdownType();
932            this.copyright.setValue(value);
933          }
934          return this;
935        }
936
937        protected void listChildren(List<Property> children) {
938          super.listChildren(children);
939          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));
940          children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
941          children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
942          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));
943          children.add(new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus));
944          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));
945        }
946
947        @Override
948        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
949          switch (_hash) {
950          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);
951          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType);
952          case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
953          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);
954          case 616500542: /*publicationStatus*/  return new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus);
955          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);
956          default: return super.getNamedProperty(_hash, _name, _checkValid);
957          }
958
959        }
960
961      @Override
962      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
963        switch (hash) {
964        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
965        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
966        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
967        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateTimeType
968        case 616500542: /*publicationStatus*/ return this.publicationStatus == null ? new Base[0] : new Base[] {this.publicationStatus}; // Enumeration<ContractResourcePublicationStatusCodes>
969        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
970        default: return super.getProperty(hash, name, checkValid);
971        }
972
973      }
974
975      @Override
976      public Base setProperty(int hash, String name, Base value) throws FHIRException {
977        switch (hash) {
978        case 3575610: // type
979          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
980          return value;
981        case -1868521062: // subType
982          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
983          return value;
984        case 1447404028: // publisher
985          this.publisher = TypeConvertor.castToReference(value); // Reference
986          return value;
987        case 1470566394: // publicationDate
988          this.publicationDate = TypeConvertor.castToDateTime(value); // DateTimeType
989          return value;
990        case 616500542: // publicationStatus
991          value = new ContractResourcePublicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
992          this.publicationStatus = (Enumeration) value; // Enumeration<ContractResourcePublicationStatusCodes>
993          return value;
994        case 1522889671: // copyright
995          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
996          return value;
997        default: return super.setProperty(hash, name, value);
998        }
999
1000      }
1001
1002      @Override
1003      public Base setProperty(String name, Base value) throws FHIRException {
1004        if (name.equals("type")) {
1005          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1006        } else if (name.equals("subType")) {
1007          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1008        } else if (name.equals("publisher")) {
1009          this.publisher = TypeConvertor.castToReference(value); // Reference
1010        } else if (name.equals("publicationDate")) {
1011          this.publicationDate = TypeConvertor.castToDateTime(value); // DateTimeType
1012        } else if (name.equals("publicationStatus")) {
1013          value = new ContractResourcePublicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1014          this.publicationStatus = (Enumeration) value; // Enumeration<ContractResourcePublicationStatusCodes>
1015        } else if (name.equals("copyright")) {
1016          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
1017        } else
1018          return super.setProperty(name, value);
1019        return value;
1020      }
1021
1022      @Override
1023      public Base makeProperty(int hash, String name) throws FHIRException {
1024        switch (hash) {
1025        case 3575610:  return getType();
1026        case -1868521062:  return getSubType();
1027        case 1447404028:  return getPublisher();
1028        case 1470566394:  return getPublicationDateElement();
1029        case 616500542:  return getPublicationStatusElement();
1030        case 1522889671:  return getCopyrightElement();
1031        default: return super.makeProperty(hash, name);
1032        }
1033
1034      }
1035
1036      @Override
1037      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1038        switch (hash) {
1039        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1040        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1041        case 1447404028: /*publisher*/ return new String[] {"Reference"};
1042        case 1470566394: /*publicationDate*/ return new String[] {"dateTime"};
1043        case 616500542: /*publicationStatus*/ return new String[] {"code"};
1044        case 1522889671: /*copyright*/ return new String[] {"markdown"};
1045        default: return super.getTypesForProperty(hash, name);
1046        }
1047
1048      }
1049
1050      @Override
1051      public Base addChild(String name) throws FHIRException {
1052        if (name.equals("type")) {
1053          this.type = new CodeableConcept();
1054          return this.type;
1055        }
1056        else if (name.equals("subType")) {
1057          this.subType = new CodeableConcept();
1058          return this.subType;
1059        }
1060        else if (name.equals("publisher")) {
1061          this.publisher = new Reference();
1062          return this.publisher;
1063        }
1064        else if (name.equals("publicationDate")) {
1065          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.publicationDate");
1066        }
1067        else if (name.equals("publicationStatus")) {
1068          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.publicationStatus");
1069        }
1070        else if (name.equals("copyright")) {
1071          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.copyright");
1072        }
1073        else
1074          return super.addChild(name);
1075      }
1076
1077      public ContentDefinitionComponent copy() {
1078        ContentDefinitionComponent dst = new ContentDefinitionComponent();
1079        copyValues(dst);
1080        return dst;
1081      }
1082
1083      public void copyValues(ContentDefinitionComponent dst) {
1084        super.copyValues(dst);
1085        dst.type = type == null ? null : type.copy();
1086        dst.subType = subType == null ? null : subType.copy();
1087        dst.publisher = publisher == null ? null : publisher.copy();
1088        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1089        dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1090        dst.copyright = copyright == null ? null : copyright.copy();
1091      }
1092
1093      @Override
1094      public boolean equalsDeep(Base other_) {
1095        if (!super.equalsDeep(other_))
1096          return false;
1097        if (!(other_ instanceof ContentDefinitionComponent))
1098          return false;
1099        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1100        return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(publisher, o.publisher, true)
1101           && compareDeep(publicationDate, o.publicationDate, true) && compareDeep(publicationStatus, o.publicationStatus, true)
1102           && compareDeep(copyright, o.copyright, true);
1103      }
1104
1105      @Override
1106      public boolean equalsShallow(Base other_) {
1107        if (!super.equalsShallow(other_))
1108          return false;
1109        if (!(other_ instanceof ContentDefinitionComponent))
1110          return false;
1111        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1112        return compareValues(publicationDate, o.publicationDate, true) && compareValues(publicationStatus, o.publicationStatus, true)
1113           && compareValues(copyright, o.copyright, true);
1114      }
1115
1116      public boolean isEmpty() {
1117        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher
1118          , publicationDate, publicationStatus, copyright);
1119      }
1120
1121  public String fhirType() {
1122    return "Contract.contentDefinition";
1123
1124  }
1125
1126  }
1127
1128    @Block()
1129    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1130        /**
1131         * Unique identifier for this particular Contract Provision.
1132         */
1133        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1134        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1135        protected Identifier identifier;
1136
1137        /**
1138         * When this Contract Provision was issued.
1139         */
1140        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1141        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1142        protected DateTimeType issued;
1143
1144        /**
1145         * Relevant time or time-period when this Contract Provision is applicable.
1146         */
1147        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1148        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1149        protected Period applies;
1150
1151        /**
1152         * The entity that the term applies to.
1153         */
1154        @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=4, min=0, max=1, modifier=false, summary=false)
1155        @Description(shortDefinition="Term Concern", formalDefinition="The entity that the term applies to." )
1156        protected DataType topic;
1157
1158        /**
1159         * 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.
1160         */
1161        @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1162        @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." )
1163        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1164        protected CodeableConcept type;
1165
1166        /**
1167         * A specialized legal clause or condition based on overarching contract type.
1168         */
1169        @Child(name = "subType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1170        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="A specialized legal clause or condition based on overarching contract type." )
1171        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1172        protected CodeableConcept subType;
1173
1174        /**
1175         * Statement of a provision in a policy or a contract.
1176         */
1177        @Child(name = "text", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1178        @Description(shortDefinition="Term Statement", formalDefinition="Statement of a provision in a policy or a contract." )
1179        protected StringType text;
1180
1181        /**
1182         * Security labels that protect the handling of information about the term and its elements, which may be specifically identified..
1183         */
1184        @Child(name = "securityLabel", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1185        @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.." )
1186        protected List<SecurityLabelComponent> securityLabel;
1187
1188        /**
1189         * The matter of concern in the context of this provision of the agrement.
1190         */
1191        @Child(name = "offer", type = {}, order=9, min=1, max=1, modifier=false, summary=false)
1192        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1193        protected ContractOfferComponent offer;
1194
1195        /**
1196         * Contract Term Asset List.
1197         */
1198        @Child(name = "asset", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1199        @Description(shortDefinition="Contract Term Asset List", formalDefinition="Contract Term Asset List." )
1200        protected List<ContractAssetComponent> asset;
1201
1202        /**
1203         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1204         */
1205        @Child(name = "action", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1206        @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." )
1207        protected List<ActionComponent> action;
1208
1209        /**
1210         * Nested group of Contract Provisions.
1211         */
1212        @Child(name = "group", type = {TermComponent.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1213        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1214        protected List<TermComponent> group;
1215
1216        private static final long serialVersionUID = -1647037544L;
1217
1218    /**
1219     * Constructor
1220     */
1221      public TermComponent() {
1222        super();
1223      }
1224
1225    /**
1226     * Constructor
1227     */
1228      public TermComponent(ContractOfferComponent offer) {
1229        super();
1230        this.setOffer(offer);
1231      }
1232
1233        /**
1234         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1235         */
1236        public Identifier getIdentifier() { 
1237          if (this.identifier == null)
1238            if (Configuration.errorOnAutoCreate())
1239              throw new Error("Attempt to auto-create TermComponent.identifier");
1240            else if (Configuration.doAutoCreate())
1241              this.identifier = new Identifier(); // cc
1242          return this.identifier;
1243        }
1244
1245        public boolean hasIdentifier() { 
1246          return this.identifier != null && !this.identifier.isEmpty();
1247        }
1248
1249        /**
1250         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1251         */
1252        public TermComponent setIdentifier(Identifier value) { 
1253          this.identifier = value;
1254          return this;
1255        }
1256
1257        /**
1258         * @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
1259         */
1260        public DateTimeType getIssuedElement() { 
1261          if (this.issued == null)
1262            if (Configuration.errorOnAutoCreate())
1263              throw new Error("Attempt to auto-create TermComponent.issued");
1264            else if (Configuration.doAutoCreate())
1265              this.issued = new DateTimeType(); // bb
1266          return this.issued;
1267        }
1268
1269        public boolean hasIssuedElement() { 
1270          return this.issued != null && !this.issued.isEmpty();
1271        }
1272
1273        public boolean hasIssued() { 
1274          return this.issued != null && !this.issued.isEmpty();
1275        }
1276
1277        /**
1278         * @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
1279         */
1280        public TermComponent setIssuedElement(DateTimeType value) { 
1281          this.issued = value;
1282          return this;
1283        }
1284
1285        /**
1286         * @return When this Contract Provision was issued.
1287         */
1288        public Date getIssued() { 
1289          return this.issued == null ? null : this.issued.getValue();
1290        }
1291
1292        /**
1293         * @param value When this Contract Provision was issued.
1294         */
1295        public TermComponent setIssued(Date value) { 
1296          if (value == null)
1297            this.issued = null;
1298          else {
1299            if (this.issued == null)
1300              this.issued = new DateTimeType();
1301            this.issued.setValue(value);
1302          }
1303          return this;
1304        }
1305
1306        /**
1307         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1308         */
1309        public Period getApplies() { 
1310          if (this.applies == null)
1311            if (Configuration.errorOnAutoCreate())
1312              throw new Error("Attempt to auto-create TermComponent.applies");
1313            else if (Configuration.doAutoCreate())
1314              this.applies = new Period(); // cc
1315          return this.applies;
1316        }
1317
1318        public boolean hasApplies() { 
1319          return this.applies != null && !this.applies.isEmpty();
1320        }
1321
1322        /**
1323         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1324         */
1325        public TermComponent setApplies(Period value) { 
1326          this.applies = value;
1327          return this;
1328        }
1329
1330        /**
1331         * @return {@link #topic} (The entity that the term applies to.)
1332         */
1333        public DataType getTopic() { 
1334          return this.topic;
1335        }
1336
1337        /**
1338         * @return {@link #topic} (The entity that the term applies to.)
1339         */
1340        public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
1341          if (this.topic == null)
1342            this.topic = new CodeableConcept();
1343          if (!(this.topic instanceof CodeableConcept))
1344            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
1345          return (CodeableConcept) this.topic;
1346        }
1347
1348        public boolean hasTopicCodeableConcept() { 
1349          return this != null && this.topic instanceof CodeableConcept;
1350        }
1351
1352        /**
1353         * @return {@link #topic} (The entity that the term applies to.)
1354         */
1355        public Reference getTopicReference() throws FHIRException { 
1356          if (this.topic == null)
1357            this.topic = new Reference();
1358          if (!(this.topic instanceof Reference))
1359            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
1360          return (Reference) this.topic;
1361        }
1362
1363        public boolean hasTopicReference() { 
1364          return this != null && this.topic instanceof Reference;
1365        }
1366
1367        public boolean hasTopic() { 
1368          return this.topic != null && !this.topic.isEmpty();
1369        }
1370
1371        /**
1372         * @param value {@link #topic} (The entity that the term applies to.)
1373         */
1374        public TermComponent setTopic(DataType value) { 
1375          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1376            throw new Error("Not the right type for Contract.term.topic[x]: "+value.fhirType());
1377          this.topic = value;
1378          return this;
1379        }
1380
1381        /**
1382         * @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.)
1383         */
1384        public CodeableConcept getType() { 
1385          if (this.type == null)
1386            if (Configuration.errorOnAutoCreate())
1387              throw new Error("Attempt to auto-create TermComponent.type");
1388            else if (Configuration.doAutoCreate())
1389              this.type = new CodeableConcept(); // cc
1390          return this.type;
1391        }
1392
1393        public boolean hasType() { 
1394          return this.type != null && !this.type.isEmpty();
1395        }
1396
1397        /**
1398         * @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.)
1399         */
1400        public TermComponent setType(CodeableConcept value) { 
1401          this.type = value;
1402          return this;
1403        }
1404
1405        /**
1406         * @return {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1407         */
1408        public CodeableConcept getSubType() { 
1409          if (this.subType == null)
1410            if (Configuration.errorOnAutoCreate())
1411              throw new Error("Attempt to auto-create TermComponent.subType");
1412            else if (Configuration.doAutoCreate())
1413              this.subType = new CodeableConcept(); // cc
1414          return this.subType;
1415        }
1416
1417        public boolean hasSubType() { 
1418          return this.subType != null && !this.subType.isEmpty();
1419        }
1420
1421        /**
1422         * @param value {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1423         */
1424        public TermComponent setSubType(CodeableConcept value) { 
1425          this.subType = value;
1426          return this;
1427        }
1428
1429        /**
1430         * @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
1431         */
1432        public StringType getTextElement() { 
1433          if (this.text == null)
1434            if (Configuration.errorOnAutoCreate())
1435              throw new Error("Attempt to auto-create TermComponent.text");
1436            else if (Configuration.doAutoCreate())
1437              this.text = new StringType(); // bb
1438          return this.text;
1439        }
1440
1441        public boolean hasTextElement() { 
1442          return this.text != null && !this.text.isEmpty();
1443        }
1444
1445        public boolean hasText() { 
1446          return this.text != null && !this.text.isEmpty();
1447        }
1448
1449        /**
1450         * @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
1451         */
1452        public TermComponent setTextElement(StringType value) { 
1453          this.text = value;
1454          return this;
1455        }
1456
1457        /**
1458         * @return Statement of a provision in a policy or a contract.
1459         */
1460        public String getText() { 
1461          return this.text == null ? null : this.text.getValue();
1462        }
1463
1464        /**
1465         * @param value Statement of a provision in a policy or a contract.
1466         */
1467        public TermComponent setText(String value) { 
1468          if (Utilities.noString(value))
1469            this.text = null;
1470          else {
1471            if (this.text == null)
1472              this.text = new StringType();
1473            this.text.setValue(value);
1474          }
1475          return this;
1476        }
1477
1478        /**
1479         * @return {@link #securityLabel} (Security labels that protect the handling of information about the term and its elements, which may be specifically identified..)
1480         */
1481        public List<SecurityLabelComponent> getSecurityLabel() { 
1482          if (this.securityLabel == null)
1483            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1484          return this.securityLabel;
1485        }
1486
1487        /**
1488         * @return Returns a reference to <code>this</code> for easy method chaining
1489         */
1490        public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) { 
1491          this.securityLabel = theSecurityLabel;
1492          return this;
1493        }
1494
1495        public boolean hasSecurityLabel() { 
1496          if (this.securityLabel == null)
1497            return false;
1498          for (SecurityLabelComponent item : this.securityLabel)
1499            if (!item.isEmpty())
1500              return true;
1501          return false;
1502        }
1503
1504        public SecurityLabelComponent addSecurityLabel() { //3
1505          SecurityLabelComponent t = new SecurityLabelComponent();
1506          if (this.securityLabel == null)
1507            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1508          this.securityLabel.add(t);
1509          return t;
1510        }
1511
1512        public TermComponent addSecurityLabel(SecurityLabelComponent t) { //3
1513          if (t == null)
1514            return this;
1515          if (this.securityLabel == null)
1516            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1517          this.securityLabel.add(t);
1518          return this;
1519        }
1520
1521        /**
1522         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist {3}
1523         */
1524        public SecurityLabelComponent getSecurityLabelFirstRep() { 
1525          if (getSecurityLabel().isEmpty()) {
1526            addSecurityLabel();
1527          }
1528          return getSecurityLabel().get(0);
1529        }
1530
1531        /**
1532         * @return {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1533         */
1534        public ContractOfferComponent getOffer() { 
1535          if (this.offer == null)
1536            if (Configuration.errorOnAutoCreate())
1537              throw new Error("Attempt to auto-create TermComponent.offer");
1538            else if (Configuration.doAutoCreate())
1539              this.offer = new ContractOfferComponent(); // cc
1540          return this.offer;
1541        }
1542
1543        public boolean hasOffer() { 
1544          return this.offer != null && !this.offer.isEmpty();
1545        }
1546
1547        /**
1548         * @param value {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1549         */
1550        public TermComponent setOffer(ContractOfferComponent value) { 
1551          this.offer = value;
1552          return this;
1553        }
1554
1555        /**
1556         * @return {@link #asset} (Contract Term Asset List.)
1557         */
1558        public List<ContractAssetComponent> getAsset() { 
1559          if (this.asset == null)
1560            this.asset = new ArrayList<ContractAssetComponent>();
1561          return this.asset;
1562        }
1563
1564        /**
1565         * @return Returns a reference to <code>this</code> for easy method chaining
1566         */
1567        public TermComponent setAsset(List<ContractAssetComponent> theAsset) { 
1568          this.asset = theAsset;
1569          return this;
1570        }
1571
1572        public boolean hasAsset() { 
1573          if (this.asset == null)
1574            return false;
1575          for (ContractAssetComponent item : this.asset)
1576            if (!item.isEmpty())
1577              return true;
1578          return false;
1579        }
1580
1581        public ContractAssetComponent addAsset() { //3
1582          ContractAssetComponent t = new ContractAssetComponent();
1583          if (this.asset == null)
1584            this.asset = new ArrayList<ContractAssetComponent>();
1585          this.asset.add(t);
1586          return t;
1587        }
1588
1589        public TermComponent addAsset(ContractAssetComponent t) { //3
1590          if (t == null)
1591            return this;
1592          if (this.asset == null)
1593            this.asset = new ArrayList<ContractAssetComponent>();
1594          this.asset.add(t);
1595          return this;
1596        }
1597
1598        /**
1599         * @return The first repetition of repeating field {@link #asset}, creating it if it does not already exist {3}
1600         */
1601        public ContractAssetComponent getAssetFirstRep() { 
1602          if (getAsset().isEmpty()) {
1603            addAsset();
1604          }
1605          return getAsset().get(0);
1606        }
1607
1608        /**
1609         * @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.)
1610         */
1611        public List<ActionComponent> getAction() { 
1612          if (this.action == null)
1613            this.action = new ArrayList<ActionComponent>();
1614          return this.action;
1615        }
1616
1617        /**
1618         * @return Returns a reference to <code>this</code> for easy method chaining
1619         */
1620        public TermComponent setAction(List<ActionComponent> theAction) { 
1621          this.action = theAction;
1622          return this;
1623        }
1624
1625        public boolean hasAction() { 
1626          if (this.action == null)
1627            return false;
1628          for (ActionComponent item : this.action)
1629            if (!item.isEmpty())
1630              return true;
1631          return false;
1632        }
1633
1634        public ActionComponent addAction() { //3
1635          ActionComponent t = new ActionComponent();
1636          if (this.action == null)
1637            this.action = new ArrayList<ActionComponent>();
1638          this.action.add(t);
1639          return t;
1640        }
1641
1642        public TermComponent addAction(ActionComponent t) { //3
1643          if (t == null)
1644            return this;
1645          if (this.action == null)
1646            this.action = new ArrayList<ActionComponent>();
1647          this.action.add(t);
1648          return this;
1649        }
1650
1651        /**
1652         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist {3}
1653         */
1654        public ActionComponent getActionFirstRep() { 
1655          if (getAction().isEmpty()) {
1656            addAction();
1657          }
1658          return getAction().get(0);
1659        }
1660
1661        /**
1662         * @return {@link #group} (Nested group of Contract Provisions.)
1663         */
1664        public List<TermComponent> getGroup() { 
1665          if (this.group == null)
1666            this.group = new ArrayList<TermComponent>();
1667          return this.group;
1668        }
1669
1670        /**
1671         * @return Returns a reference to <code>this</code> for easy method chaining
1672         */
1673        public TermComponent setGroup(List<TermComponent> theGroup) { 
1674          this.group = theGroup;
1675          return this;
1676        }
1677
1678        public boolean hasGroup() { 
1679          if (this.group == null)
1680            return false;
1681          for (TermComponent item : this.group)
1682            if (!item.isEmpty())
1683              return true;
1684          return false;
1685        }
1686
1687        public TermComponent addGroup() { //3
1688          TermComponent t = new TermComponent();
1689          if (this.group == null)
1690            this.group = new ArrayList<TermComponent>();
1691          this.group.add(t);
1692          return t;
1693        }
1694
1695        public TermComponent addGroup(TermComponent t) { //3
1696          if (t == null)
1697            return this;
1698          if (this.group == null)
1699            this.group = new ArrayList<TermComponent>();
1700          this.group.add(t);
1701          return this;
1702        }
1703
1704        /**
1705         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist {3}
1706         */
1707        public TermComponent getGroupFirstRep() { 
1708          if (getGroup().isEmpty()) {
1709            addGroup();
1710          }
1711          return getGroup().get(0);
1712        }
1713
1714        protected void listChildren(List<Property> children) {
1715          super.listChildren(children);
1716          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
1717          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
1718          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
1719          children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic));
1720          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));
1721          children.add(new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
1722          children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
1723          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));
1724          children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer));
1725          children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
1726          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));
1727          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
1728        }
1729
1730        @Override
1731        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1732          switch (_hash) {
1733          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
1734          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
1735          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
1736          case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1737          case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1738          case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept", "The entity that the term applies to.", 0, 1, topic);
1739          case -343345444: /*topicReference*/  return new Property("topic[x]", "Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1740          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);
1741          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
1742          case 3556653: /*text*/  return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text);
1743          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);
1744          case 105650780: /*offer*/  return new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
1745          case 93121264: /*asset*/  return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset);
1746          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);
1747          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
1748          default: return super.getNamedProperty(_hash, _name, _checkValid);
1749          }
1750
1751        }
1752
1753      @Override
1754      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1755        switch (hash) {
1756        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1757        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
1758        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
1759        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // DataType
1760        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1761        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
1762        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1763        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
1764        case 105650780: /*offer*/ return this.offer == null ? new Base[0] : new Base[] {this.offer}; // ContractOfferComponent
1765        case 93121264: /*asset*/ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
1766        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
1767        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
1768        default: return super.getProperty(hash, name, checkValid);
1769        }
1770
1771      }
1772
1773      @Override
1774      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1775        switch (hash) {
1776        case -1618432855: // identifier
1777          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
1778          return value;
1779        case -1179159893: // issued
1780          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
1781          return value;
1782        case -793235316: // applies
1783          this.applies = TypeConvertor.castToPeriod(value); // Period
1784          return value;
1785        case 110546223: // topic
1786          this.topic = TypeConvertor.castToType(value); // DataType
1787          return value;
1788        case 3575610: // type
1789          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1790          return value;
1791        case -1868521062: // subType
1792          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1793          return value;
1794        case 3556653: // text
1795          this.text = TypeConvertor.castToString(value); // StringType
1796          return value;
1797        case -722296940: // securityLabel
1798          this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
1799          return value;
1800        case 105650780: // offer
1801          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1802          return value;
1803        case 93121264: // asset
1804          this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
1805          return value;
1806        case -1422950858: // action
1807          this.getAction().add((ActionComponent) value); // ActionComponent
1808          return value;
1809        case 98629247: // group
1810          this.getGroup().add((TermComponent) value); // TermComponent
1811          return value;
1812        default: return super.setProperty(hash, name, value);
1813        }
1814
1815      }
1816
1817      @Override
1818      public Base setProperty(String name, Base value) throws FHIRException {
1819        if (name.equals("identifier")) {
1820          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
1821        } else if (name.equals("issued")) {
1822          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
1823        } else if (name.equals("applies")) {
1824          this.applies = TypeConvertor.castToPeriod(value); // Period
1825        } else if (name.equals("topic[x]")) {
1826          this.topic = TypeConvertor.castToType(value); // DataType
1827        } else if (name.equals("type")) {
1828          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1829        } else if (name.equals("subType")) {
1830          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1831        } else if (name.equals("text")) {
1832          this.text = TypeConvertor.castToString(value); // StringType
1833        } else if (name.equals("securityLabel")) {
1834          this.getSecurityLabel().add((SecurityLabelComponent) value);
1835        } else if (name.equals("offer")) {
1836          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1837        } else if (name.equals("asset")) {
1838          this.getAsset().add((ContractAssetComponent) value);
1839        } else if (name.equals("action")) {
1840          this.getAction().add((ActionComponent) value);
1841        } else if (name.equals("group")) {
1842          this.getGroup().add((TermComponent) value);
1843        } else
1844          return super.setProperty(name, value);
1845        return value;
1846      }
1847
1848      @Override
1849      public Base makeProperty(int hash, String name) throws FHIRException {
1850        switch (hash) {
1851        case -1618432855:  return getIdentifier();
1852        case -1179159893:  return getIssuedElement();
1853        case -793235316:  return getApplies();
1854        case -957295375:  return getTopic();
1855        case 110546223:  return getTopic();
1856        case 3575610:  return getType();
1857        case -1868521062:  return getSubType();
1858        case 3556653:  return getTextElement();
1859        case -722296940:  return addSecurityLabel(); 
1860        case 105650780:  return getOffer();
1861        case 93121264:  return addAsset(); 
1862        case -1422950858:  return addAction(); 
1863        case 98629247:  return addGroup(); 
1864        default: return super.makeProperty(hash, name);
1865        }
1866
1867      }
1868
1869      @Override
1870      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1871        switch (hash) {
1872        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1873        case -1179159893: /*issued*/ return new String[] {"dateTime"};
1874        case -793235316: /*applies*/ return new String[] {"Period"};
1875        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
1876        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1877        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1878        case 3556653: /*text*/ return new String[] {"string"};
1879        case -722296940: /*securityLabel*/ return new String[] {};
1880        case 105650780: /*offer*/ return new String[] {};
1881        case 93121264: /*asset*/ return new String[] {};
1882        case -1422950858: /*action*/ return new String[] {};
1883        case 98629247: /*group*/ return new String[] {"@Contract.term"};
1884        default: return super.getTypesForProperty(hash, name);
1885        }
1886
1887      }
1888
1889      @Override
1890      public Base addChild(String name) throws FHIRException {
1891        if (name.equals("identifier")) {
1892          this.identifier = new Identifier();
1893          return this.identifier;
1894        }
1895        else if (name.equals("issued")) {
1896          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.issued");
1897        }
1898        else if (name.equals("applies")) {
1899          this.applies = new Period();
1900          return this.applies;
1901        }
1902        else if (name.equals("topicCodeableConcept")) {
1903          this.topic = new CodeableConcept();
1904          return this.topic;
1905        }
1906        else if (name.equals("topicReference")) {
1907          this.topic = new Reference();
1908          return this.topic;
1909        }
1910        else if (name.equals("type")) {
1911          this.type = new CodeableConcept();
1912          return this.type;
1913        }
1914        else if (name.equals("subType")) {
1915          this.subType = new CodeableConcept();
1916          return this.subType;
1917        }
1918        else if (name.equals("text")) {
1919          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.text");
1920        }
1921        else if (name.equals("securityLabel")) {
1922          return addSecurityLabel();
1923        }
1924        else if (name.equals("offer")) {
1925          this.offer = new ContractOfferComponent();
1926          return this.offer;
1927        }
1928        else if (name.equals("asset")) {
1929          return addAsset();
1930        }
1931        else if (name.equals("action")) {
1932          return addAction();
1933        }
1934        else if (name.equals("group")) {
1935          return addGroup();
1936        }
1937        else
1938          return super.addChild(name);
1939      }
1940
1941      public TermComponent copy() {
1942        TermComponent dst = new TermComponent();
1943        copyValues(dst);
1944        return dst;
1945      }
1946
1947      public void copyValues(TermComponent dst) {
1948        super.copyValues(dst);
1949        dst.identifier = identifier == null ? null : identifier.copy();
1950        dst.issued = issued == null ? null : issued.copy();
1951        dst.applies = applies == null ? null : applies.copy();
1952        dst.topic = topic == null ? null : topic.copy();
1953        dst.type = type == null ? null : type.copy();
1954        dst.subType = subType == null ? null : subType.copy();
1955        dst.text = text == null ? null : text.copy();
1956        if (securityLabel != null) {
1957          dst.securityLabel = new ArrayList<SecurityLabelComponent>();
1958          for (SecurityLabelComponent i : securityLabel)
1959            dst.securityLabel.add(i.copy());
1960        };
1961        dst.offer = offer == null ? null : offer.copy();
1962        if (asset != null) {
1963          dst.asset = new ArrayList<ContractAssetComponent>();
1964          for (ContractAssetComponent i : asset)
1965            dst.asset.add(i.copy());
1966        };
1967        if (action != null) {
1968          dst.action = new ArrayList<ActionComponent>();
1969          for (ActionComponent i : action)
1970            dst.action.add(i.copy());
1971        };
1972        if (group != null) {
1973          dst.group = new ArrayList<TermComponent>();
1974          for (TermComponent i : group)
1975            dst.group.add(i.copy());
1976        };
1977      }
1978
1979      @Override
1980      public boolean equalsDeep(Base other_) {
1981        if (!super.equalsDeep(other_))
1982          return false;
1983        if (!(other_ instanceof TermComponent))
1984          return false;
1985        TermComponent o = (TermComponent) other_;
1986        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
1987           && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
1988           && compareDeep(text, o.text, true) && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
1989           && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true) && compareDeep(group, o.group, true)
1990          ;
1991      }
1992
1993      @Override
1994      public boolean equalsShallow(Base other_) {
1995        if (!super.equalsShallow(other_))
1996          return false;
1997        if (!(other_ instanceof TermComponent))
1998          return false;
1999        TermComponent o = (TermComponent) other_;
2000        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2001      }
2002
2003      public boolean isEmpty() {
2004        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2005          , topic, type, subType, text, securityLabel, offer, asset, action, group);
2006      }
2007
2008  public String fhirType() {
2009    return "Contract.term";
2010
2011  }
2012
2013  }
2014
2015    @Block()
2016    public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2017        /**
2018         * Number used to link this term or term element to the applicable Security Label.
2019         */
2020        @Child(name = "number", type = {UnsignedIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2021        @Description(shortDefinition="Link to Security Labels", formalDefinition="Number used to link this term or term element to the applicable Security Label." )
2022        protected List<UnsignedIntType> number;
2023
2024        /**
2025         * Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.
2026         */
2027        @Child(name = "classification", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=false)
2028        @Description(shortDefinition="Confidentiality Protection", formalDefinition="Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements." )
2029        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-classification")
2030        protected Coding classification;
2031
2032        /**
2033         * Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.
2034         */
2035        @Child(name = "category", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2036        @Description(shortDefinition="Applicable Policy", formalDefinition="Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements." )
2037        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-category")
2038        protected List<Coding> category;
2039
2040        /**
2041         * Security label privacy tag that species the manner in which term and/or term elements are to be protected.
2042         */
2043        @Child(name = "control", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2044        @Description(shortDefinition="Handling Instructions", formalDefinition="Security label privacy tag that species the manner in which term and/or term elements are to be protected." )
2045        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-control")
2046        protected List<Coding> control;
2047
2048        private static final long serialVersionUID = 788281758L;
2049
2050    /**
2051     * Constructor
2052     */
2053      public SecurityLabelComponent() {
2054        super();
2055      }
2056
2057    /**
2058     * Constructor
2059     */
2060      public SecurityLabelComponent(Coding classification) {
2061        super();
2062        this.setClassification(classification);
2063      }
2064
2065        /**
2066         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2067         */
2068        public List<UnsignedIntType> getNumber() { 
2069          if (this.number == null)
2070            this.number = new ArrayList<UnsignedIntType>();
2071          return this.number;
2072        }
2073
2074        /**
2075         * @return Returns a reference to <code>this</code> for easy method chaining
2076         */
2077        public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) { 
2078          this.number = theNumber;
2079          return this;
2080        }
2081
2082        public boolean hasNumber() { 
2083          if (this.number == null)
2084            return false;
2085          for (UnsignedIntType item : this.number)
2086            if (!item.isEmpty())
2087              return true;
2088          return false;
2089        }
2090
2091        /**
2092         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2093         */
2094        public UnsignedIntType addNumberElement() {//2 
2095          UnsignedIntType t = new UnsignedIntType();
2096          if (this.number == null)
2097            this.number = new ArrayList<UnsignedIntType>();
2098          this.number.add(t);
2099          return t;
2100        }
2101
2102        /**
2103         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2104         */
2105        public SecurityLabelComponent addNumber(int value) { //1
2106          UnsignedIntType t = new UnsignedIntType();
2107          t.setValue(value);
2108          if (this.number == null)
2109            this.number = new ArrayList<UnsignedIntType>();
2110          this.number.add(t);
2111          return this;
2112        }
2113
2114        /**
2115         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2116         */
2117        public boolean hasNumber(int value) { 
2118          if (this.number == null)
2119            return false;
2120          for (UnsignedIntType v : this.number)
2121            if (v.getValue().equals(value)) // unsignedInt
2122              return true;
2123          return false;
2124        }
2125
2126        /**
2127         * @return {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2128         */
2129        public Coding getClassification() { 
2130          if (this.classification == null)
2131            if (Configuration.errorOnAutoCreate())
2132              throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2133            else if (Configuration.doAutoCreate())
2134              this.classification = new Coding(); // cc
2135          return this.classification;
2136        }
2137
2138        public boolean hasClassification() { 
2139          return this.classification != null && !this.classification.isEmpty();
2140        }
2141
2142        /**
2143         * @param value {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2144         */
2145        public SecurityLabelComponent setClassification(Coding value) { 
2146          this.classification = value;
2147          return this;
2148        }
2149
2150        /**
2151         * @return {@link #category} (Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.)
2152         */
2153        public List<Coding> getCategory() { 
2154          if (this.category == null)
2155            this.category = new ArrayList<Coding>();
2156          return this.category;
2157        }
2158
2159        /**
2160         * @return Returns a reference to <code>this</code> for easy method chaining
2161         */
2162        public SecurityLabelComponent setCategory(List<Coding> theCategory) { 
2163          this.category = theCategory;
2164          return this;
2165        }
2166
2167        public boolean hasCategory() { 
2168          if (this.category == null)
2169            return false;
2170          for (Coding item : this.category)
2171            if (!item.isEmpty())
2172              return true;
2173          return false;
2174        }
2175
2176        public Coding addCategory() { //3
2177          Coding t = new Coding();
2178          if (this.category == null)
2179            this.category = new ArrayList<Coding>();
2180          this.category.add(t);
2181          return t;
2182        }
2183
2184        public SecurityLabelComponent addCategory(Coding t) { //3
2185          if (t == null)
2186            return this;
2187          if (this.category == null)
2188            this.category = new ArrayList<Coding>();
2189          this.category.add(t);
2190          return this;
2191        }
2192
2193        /**
2194         * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2195         */
2196        public Coding getCategoryFirstRep() { 
2197          if (getCategory().isEmpty()) {
2198            addCategory();
2199          }
2200          return getCategory().get(0);
2201        }
2202
2203        /**
2204         * @return {@link #control} (Security label privacy tag that species the manner in which term and/or term elements are to be protected.)
2205         */
2206        public List<Coding> getControl() { 
2207          if (this.control == null)
2208            this.control = new ArrayList<Coding>();
2209          return this.control;
2210        }
2211
2212        /**
2213         * @return Returns a reference to <code>this</code> for easy method chaining
2214         */
2215        public SecurityLabelComponent setControl(List<Coding> theControl) { 
2216          this.control = theControl;
2217          return this;
2218        }
2219
2220        public boolean hasControl() { 
2221          if (this.control == null)
2222            return false;
2223          for (Coding item : this.control)
2224            if (!item.isEmpty())
2225              return true;
2226          return false;
2227        }
2228
2229        public Coding addControl() { //3
2230          Coding t = new Coding();
2231          if (this.control == null)
2232            this.control = new ArrayList<Coding>();
2233          this.control.add(t);
2234          return t;
2235        }
2236
2237        public SecurityLabelComponent addControl(Coding t) { //3
2238          if (t == null)
2239            return this;
2240          if (this.control == null)
2241            this.control = new ArrayList<Coding>();
2242          this.control.add(t);
2243          return this;
2244        }
2245
2246        /**
2247         * @return The first repetition of repeating field {@link #control}, creating it if it does not already exist {3}
2248         */
2249        public Coding getControlFirstRep() { 
2250          if (getControl().isEmpty()) {
2251            addControl();
2252          }
2253          return getControl().get(0);
2254        }
2255
2256        protected void listChildren(List<Property> children) {
2257          super.listChildren(children);
2258          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));
2259          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));
2260          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));
2261          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));
2262        }
2263
2264        @Override
2265        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2266          switch (_hash) {
2267          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);
2268          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);
2269          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);
2270          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);
2271          default: return super.getNamedProperty(_hash, _name, _checkValid);
2272          }
2273
2274        }
2275
2276      @Override
2277      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2278        switch (hash) {
2279        case -1034364087: /*number*/ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2280        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // Coding
2281        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // Coding
2282        case 951543133: /*control*/ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2283        default: return super.getProperty(hash, name, checkValid);
2284        }
2285
2286      }
2287
2288      @Override
2289      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2290        switch (hash) {
2291        case -1034364087: // number
2292          this.getNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
2293          return value;
2294        case 382350310: // classification
2295          this.classification = TypeConvertor.castToCoding(value); // Coding
2296          return value;
2297        case 50511102: // category
2298          this.getCategory().add(TypeConvertor.castToCoding(value)); // Coding
2299          return value;
2300        case 951543133: // control
2301          this.getControl().add(TypeConvertor.castToCoding(value)); // Coding
2302          return value;
2303        default: return super.setProperty(hash, name, value);
2304        }
2305
2306      }
2307
2308      @Override
2309      public Base setProperty(String name, Base value) throws FHIRException {
2310        if (name.equals("number")) {
2311          this.getNumber().add(TypeConvertor.castToUnsignedInt(value));
2312        } else if (name.equals("classification")) {
2313          this.classification = TypeConvertor.castToCoding(value); // Coding
2314        } else if (name.equals("category")) {
2315          this.getCategory().add(TypeConvertor.castToCoding(value));
2316        } else if (name.equals("control")) {
2317          this.getControl().add(TypeConvertor.castToCoding(value));
2318        } else
2319          return super.setProperty(name, value);
2320        return value;
2321      }
2322
2323      @Override
2324      public Base makeProperty(int hash, String name) throws FHIRException {
2325        switch (hash) {
2326        case -1034364087:  return addNumberElement();
2327        case 382350310:  return getClassification();
2328        case 50511102:  return addCategory(); 
2329        case 951543133:  return addControl(); 
2330        default: return super.makeProperty(hash, name);
2331        }
2332
2333      }
2334
2335      @Override
2336      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2337        switch (hash) {
2338        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
2339        case 382350310: /*classification*/ return new String[] {"Coding"};
2340        case 50511102: /*category*/ return new String[] {"Coding"};
2341        case 951543133: /*control*/ return new String[] {"Coding"};
2342        default: return super.getTypesForProperty(hash, name);
2343        }
2344
2345      }
2346
2347      @Override
2348      public Base addChild(String name) throws FHIRException {
2349        if (name.equals("number")) {
2350          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.securityLabel.number");
2351        }
2352        else if (name.equals("classification")) {
2353          this.classification = new Coding();
2354          return this.classification;
2355        }
2356        else if (name.equals("category")) {
2357          return addCategory();
2358        }
2359        else if (name.equals("control")) {
2360          return addControl();
2361        }
2362        else
2363          return super.addChild(name);
2364      }
2365
2366      public SecurityLabelComponent copy() {
2367        SecurityLabelComponent dst = new SecurityLabelComponent();
2368        copyValues(dst);
2369        return dst;
2370      }
2371
2372      public void copyValues(SecurityLabelComponent dst) {
2373        super.copyValues(dst);
2374        if (number != null) {
2375          dst.number = new ArrayList<UnsignedIntType>();
2376          for (UnsignedIntType i : number)
2377            dst.number.add(i.copy());
2378        };
2379        dst.classification = classification == null ? null : classification.copy();
2380        if (category != null) {
2381          dst.category = new ArrayList<Coding>();
2382          for (Coding i : category)
2383            dst.category.add(i.copy());
2384        };
2385        if (control != null) {
2386          dst.control = new ArrayList<Coding>();
2387          for (Coding i : control)
2388            dst.control.add(i.copy());
2389        };
2390      }
2391
2392      @Override
2393      public boolean equalsDeep(Base other_) {
2394        if (!super.equalsDeep(other_))
2395          return false;
2396        if (!(other_ instanceof SecurityLabelComponent))
2397          return false;
2398        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2399        return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
2400           && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
2401      }
2402
2403      @Override
2404      public boolean equalsShallow(Base other_) {
2405        if (!super.equalsShallow(other_))
2406          return false;
2407        if (!(other_ instanceof SecurityLabelComponent))
2408          return false;
2409        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2410        return compareValues(number, o.number, true);
2411      }
2412
2413      public boolean isEmpty() {
2414        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category
2415          , control);
2416      }
2417
2418  public String fhirType() {
2419    return "Contract.term.securityLabel";
2420
2421  }
2422
2423  }
2424
2425    @Block()
2426    public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
2427        /**
2428         * Unique identifier for this particular Contract Provision.
2429         */
2430        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2431        @Description(shortDefinition="Offer business ID", formalDefinition="Unique identifier for this particular Contract Provision." )
2432        protected List<Identifier> identifier;
2433
2434        /**
2435         * Offer Recipient.
2436         */
2437        @Child(name = "party", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2438        @Description(shortDefinition="Offer Recipient", formalDefinition="Offer Recipient." )
2439        protected List<ContractPartyComponent> party;
2440
2441        /**
2442         * 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).
2443         */
2444        @Child(name = "topic", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=true)
2445        @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)." )
2446        protected Reference topic;
2447
2448        /**
2449         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
2450         */
2451        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
2452        @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." )
2453        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
2454        protected CodeableConcept type;
2455
2456        /**
2457         * Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.
2458         */
2459        @Child(name = "decision", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
2460        @Description(shortDefinition="Accepting party choice", formalDefinition="Type of choice made by accepting party with respect to an offer made by an offeror/ grantee." )
2461        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
2462        protected CodeableConcept decision;
2463
2464        /**
2465         * How the decision about a Contract was conveyed.
2466         */
2467        @Child(name = "decisionMode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2468        @Description(shortDefinition="How decision is conveyed", formalDefinition="How the decision about a Contract was conveyed." )
2469        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-decision-mode")
2470        protected List<CodeableConcept> decisionMode;
2471
2472        /**
2473         * Response to offer text.
2474         */
2475        @Child(name = "answer", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2476        @Description(shortDefinition="Response to offer text", formalDefinition="Response to offer text." )
2477        protected List<AnswerComponent> answer;
2478
2479        /**
2480         * Human readable form of this Contract Offer.
2481         */
2482        @Child(name = "text", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2483        @Description(shortDefinition="Human readable offer text", formalDefinition="Human readable form of this Contract Offer." )
2484        protected StringType text;
2485
2486        /**
2487         * The id of the clause or question text of the offer in the referenced questionnaire/response.
2488         */
2489        @Child(name = "linkId", type = {StringType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2490        @Description(shortDefinition="Pointer to text", formalDefinition="The id of the clause or question text of the offer in the referenced questionnaire/response." )
2491        protected List<StringType> linkId;
2492
2493        /**
2494         * Security labels that protects the offer.
2495         */
2496        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2497        @Description(shortDefinition="Offer restriction numbers", formalDefinition="Security labels that protects the offer." )
2498        protected List<UnsignedIntType> securityLabelNumber;
2499
2500        private static final long serialVersionUID = -852140711L;
2501
2502    /**
2503     * Constructor
2504     */
2505      public ContractOfferComponent() {
2506        super();
2507      }
2508
2509        /**
2510         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
2511         */
2512        public List<Identifier> getIdentifier() { 
2513          if (this.identifier == null)
2514            this.identifier = new ArrayList<Identifier>();
2515          return this.identifier;
2516        }
2517
2518        /**
2519         * @return Returns a reference to <code>this</code> for easy method chaining
2520         */
2521        public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) { 
2522          this.identifier = theIdentifier;
2523          return this;
2524        }
2525
2526        public boolean hasIdentifier() { 
2527          if (this.identifier == null)
2528            return false;
2529          for (Identifier item : this.identifier)
2530            if (!item.isEmpty())
2531              return true;
2532          return false;
2533        }
2534
2535        public Identifier addIdentifier() { //3
2536          Identifier t = new Identifier();
2537          if (this.identifier == null)
2538            this.identifier = new ArrayList<Identifier>();
2539          this.identifier.add(t);
2540          return t;
2541        }
2542
2543        public ContractOfferComponent addIdentifier(Identifier t) { //3
2544          if (t == null)
2545            return this;
2546          if (this.identifier == null)
2547            this.identifier = new ArrayList<Identifier>();
2548          this.identifier.add(t);
2549          return this;
2550        }
2551
2552        /**
2553         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2554         */
2555        public Identifier getIdentifierFirstRep() { 
2556          if (getIdentifier().isEmpty()) {
2557            addIdentifier();
2558          }
2559          return getIdentifier().get(0);
2560        }
2561
2562        /**
2563         * @return {@link #party} (Offer Recipient.)
2564         */
2565        public List<ContractPartyComponent> getParty() { 
2566          if (this.party == null)
2567            this.party = new ArrayList<ContractPartyComponent>();
2568          return this.party;
2569        }
2570
2571        /**
2572         * @return Returns a reference to <code>this</code> for easy method chaining
2573         */
2574        public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) { 
2575          this.party = theParty;
2576          return this;
2577        }
2578
2579        public boolean hasParty() { 
2580          if (this.party == null)
2581            return false;
2582          for (ContractPartyComponent item : this.party)
2583            if (!item.isEmpty())
2584              return true;
2585          return false;
2586        }
2587
2588        public ContractPartyComponent addParty() { //3
2589          ContractPartyComponent t = new ContractPartyComponent();
2590          if (this.party == null)
2591            this.party = new ArrayList<ContractPartyComponent>();
2592          this.party.add(t);
2593          return t;
2594        }
2595
2596        public ContractOfferComponent addParty(ContractPartyComponent t) { //3
2597          if (t == null)
2598            return this;
2599          if (this.party == null)
2600            this.party = new ArrayList<ContractPartyComponent>();
2601          this.party.add(t);
2602          return this;
2603        }
2604
2605        /**
2606         * @return The first repetition of repeating field {@link #party}, creating it if it does not already exist {3}
2607         */
2608        public ContractPartyComponent getPartyFirstRep() { 
2609          if (getParty().isEmpty()) {
2610            addParty();
2611          }
2612          return getParty().get(0);
2613        }
2614
2615        /**
2616         * @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).)
2617         */
2618        public Reference getTopic() { 
2619          if (this.topic == null)
2620            if (Configuration.errorOnAutoCreate())
2621              throw new Error("Attempt to auto-create ContractOfferComponent.topic");
2622            else if (Configuration.doAutoCreate())
2623              this.topic = new Reference(); // cc
2624          return this.topic;
2625        }
2626
2627        public boolean hasTopic() { 
2628          return this.topic != null && !this.topic.isEmpty();
2629        }
2630
2631        /**
2632         * @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).)
2633         */
2634        public ContractOfferComponent setTopic(Reference value) { 
2635          this.topic = value;
2636          return this;
2637        }
2638
2639        /**
2640         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2641         */
2642        public CodeableConcept getType() { 
2643          if (this.type == null)
2644            if (Configuration.errorOnAutoCreate())
2645              throw new Error("Attempt to auto-create ContractOfferComponent.type");
2646            else if (Configuration.doAutoCreate())
2647              this.type = new CodeableConcept(); // cc
2648          return this.type;
2649        }
2650
2651        public boolean hasType() { 
2652          return this.type != null && !this.type.isEmpty();
2653        }
2654
2655        /**
2656         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2657         */
2658        public ContractOfferComponent setType(CodeableConcept value) { 
2659          this.type = value;
2660          return this;
2661        }
2662
2663        /**
2664         * @return {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2665         */
2666        public CodeableConcept getDecision() { 
2667          if (this.decision == null)
2668            if (Configuration.errorOnAutoCreate())
2669              throw new Error("Attempt to auto-create ContractOfferComponent.decision");
2670            else if (Configuration.doAutoCreate())
2671              this.decision = new CodeableConcept(); // cc
2672          return this.decision;
2673        }
2674
2675        public boolean hasDecision() { 
2676          return this.decision != null && !this.decision.isEmpty();
2677        }
2678
2679        /**
2680         * @param value {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2681         */
2682        public ContractOfferComponent setDecision(CodeableConcept value) { 
2683          this.decision = value;
2684          return this;
2685        }
2686
2687        /**
2688         * @return {@link #decisionMode} (How the decision about a Contract was conveyed.)
2689         */
2690        public List<CodeableConcept> getDecisionMode() { 
2691          if (this.decisionMode == null)
2692            this.decisionMode = new ArrayList<CodeableConcept>();
2693          return this.decisionMode;
2694        }
2695
2696        /**
2697         * @return Returns a reference to <code>this</code> for easy method chaining
2698         */
2699        public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) { 
2700          this.decisionMode = theDecisionMode;
2701          return this;
2702        }
2703
2704        public boolean hasDecisionMode() { 
2705          if (this.decisionMode == null)
2706            return false;
2707          for (CodeableConcept item : this.decisionMode)
2708            if (!item.isEmpty())
2709              return true;
2710          return false;
2711        }
2712
2713        public CodeableConcept addDecisionMode() { //3
2714          CodeableConcept t = new CodeableConcept();
2715          if (this.decisionMode == null)
2716            this.decisionMode = new ArrayList<CodeableConcept>();
2717          this.decisionMode.add(t);
2718          return t;
2719        }
2720
2721        public ContractOfferComponent addDecisionMode(CodeableConcept t) { //3
2722          if (t == null)
2723            return this;
2724          if (this.decisionMode == null)
2725            this.decisionMode = new ArrayList<CodeableConcept>();
2726          this.decisionMode.add(t);
2727          return this;
2728        }
2729
2730        /**
2731         * @return The first repetition of repeating field {@link #decisionMode}, creating it if it does not already exist {3}
2732         */
2733        public CodeableConcept getDecisionModeFirstRep() { 
2734          if (getDecisionMode().isEmpty()) {
2735            addDecisionMode();
2736          }
2737          return getDecisionMode().get(0);
2738        }
2739
2740        /**
2741         * @return {@link #answer} (Response to offer text.)
2742         */
2743        public List<AnswerComponent> getAnswer() { 
2744          if (this.answer == null)
2745            this.answer = new ArrayList<AnswerComponent>();
2746          return this.answer;
2747        }
2748
2749        /**
2750         * @return Returns a reference to <code>this</code> for easy method chaining
2751         */
2752        public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) { 
2753          this.answer = theAnswer;
2754          return this;
2755        }
2756
2757        public boolean hasAnswer() { 
2758          if (this.answer == null)
2759            return false;
2760          for (AnswerComponent item : this.answer)
2761            if (!item.isEmpty())
2762              return true;
2763          return false;
2764        }
2765
2766        public AnswerComponent addAnswer() { //3
2767          AnswerComponent t = new AnswerComponent();
2768          if (this.answer == null)
2769            this.answer = new ArrayList<AnswerComponent>();
2770          this.answer.add(t);
2771          return t;
2772        }
2773
2774        public ContractOfferComponent addAnswer(AnswerComponent t) { //3
2775          if (t == null)
2776            return this;
2777          if (this.answer == null)
2778            this.answer = new ArrayList<AnswerComponent>();
2779          this.answer.add(t);
2780          return this;
2781        }
2782
2783        /**
2784         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist {3}
2785         */
2786        public AnswerComponent getAnswerFirstRep() { 
2787          if (getAnswer().isEmpty()) {
2788            addAnswer();
2789          }
2790          return getAnswer().get(0);
2791        }
2792
2793        /**
2794         * @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
2795         */
2796        public StringType getTextElement() { 
2797          if (this.text == null)
2798            if (Configuration.errorOnAutoCreate())
2799              throw new Error("Attempt to auto-create ContractOfferComponent.text");
2800            else if (Configuration.doAutoCreate())
2801              this.text = new StringType(); // bb
2802          return this.text;
2803        }
2804
2805        public boolean hasTextElement() { 
2806          return this.text != null && !this.text.isEmpty();
2807        }
2808
2809        public boolean hasText() { 
2810          return this.text != null && !this.text.isEmpty();
2811        }
2812
2813        /**
2814         * @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
2815         */
2816        public ContractOfferComponent setTextElement(StringType value) { 
2817          this.text = value;
2818          return this;
2819        }
2820
2821        /**
2822         * @return Human readable form of this Contract Offer.
2823         */
2824        public String getText() { 
2825          return this.text == null ? null : this.text.getValue();
2826        }
2827
2828        /**
2829         * @param value Human readable form of this Contract Offer.
2830         */
2831        public ContractOfferComponent setText(String value) { 
2832          if (Utilities.noString(value))
2833            this.text = null;
2834          else {
2835            if (this.text == null)
2836              this.text = new StringType();
2837            this.text.setValue(value);
2838          }
2839          return this;
2840        }
2841
2842        /**
2843         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2844         */
2845        public List<StringType> getLinkId() { 
2846          if (this.linkId == null)
2847            this.linkId = new ArrayList<StringType>();
2848          return this.linkId;
2849        }
2850
2851        /**
2852         * @return Returns a reference to <code>this</code> for easy method chaining
2853         */
2854        public ContractOfferComponent setLinkId(List<StringType> theLinkId) { 
2855          this.linkId = theLinkId;
2856          return this;
2857        }
2858
2859        public boolean hasLinkId() { 
2860          if (this.linkId == null)
2861            return false;
2862          for (StringType item : this.linkId)
2863            if (!item.isEmpty())
2864              return true;
2865          return false;
2866        }
2867
2868        /**
2869         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2870         */
2871        public StringType addLinkIdElement() {//2 
2872          StringType t = new StringType();
2873          if (this.linkId == null)
2874            this.linkId = new ArrayList<StringType>();
2875          this.linkId.add(t);
2876          return t;
2877        }
2878
2879        /**
2880         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2881         */
2882        public ContractOfferComponent addLinkId(String value) { //1
2883          StringType t = new StringType();
2884          t.setValue(value);
2885          if (this.linkId == null)
2886            this.linkId = new ArrayList<StringType>();
2887          this.linkId.add(t);
2888          return this;
2889        }
2890
2891        /**
2892         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2893         */
2894        public boolean hasLinkId(String value) { 
2895          if (this.linkId == null)
2896            return false;
2897          for (StringType v : this.linkId)
2898            if (v.getValue().equals(value)) // string
2899              return true;
2900          return false;
2901        }
2902
2903        /**
2904         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2905         */
2906        public List<UnsignedIntType> getSecurityLabelNumber() { 
2907          if (this.securityLabelNumber == null)
2908            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2909          return this.securityLabelNumber;
2910        }
2911
2912        /**
2913         * @return Returns a reference to <code>this</code> for easy method chaining
2914         */
2915        public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
2916          this.securityLabelNumber = theSecurityLabelNumber;
2917          return this;
2918        }
2919
2920        public boolean hasSecurityLabelNumber() { 
2921          if (this.securityLabelNumber == null)
2922            return false;
2923          for (UnsignedIntType item : this.securityLabelNumber)
2924            if (!item.isEmpty())
2925              return true;
2926          return false;
2927        }
2928
2929        /**
2930         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2931         */
2932        public UnsignedIntType addSecurityLabelNumberElement() {//2 
2933          UnsignedIntType t = new UnsignedIntType();
2934          if (this.securityLabelNumber == null)
2935            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2936          this.securityLabelNumber.add(t);
2937          return t;
2938        }
2939
2940        /**
2941         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2942         */
2943        public ContractOfferComponent addSecurityLabelNumber(int value) { //1
2944          UnsignedIntType t = new UnsignedIntType();
2945          t.setValue(value);
2946          if (this.securityLabelNumber == null)
2947            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2948          this.securityLabelNumber.add(t);
2949          return this;
2950        }
2951
2952        /**
2953         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2954         */
2955        public boolean hasSecurityLabelNumber(int value) { 
2956          if (this.securityLabelNumber == null)
2957            return false;
2958          for (UnsignedIntType v : this.securityLabelNumber)
2959            if (v.getValue().equals(value)) // unsignedInt
2960              return true;
2961          return false;
2962        }
2963
2964        protected void listChildren(List<Property> children) {
2965          super.listChildren(children);
2966          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier));
2967          children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
2968          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));
2969          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));
2970          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));
2971          children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode));
2972          children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
2973          children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
2974          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));
2975          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
2976        }
2977
2978        @Override
2979        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2980          switch (_hash) {
2981          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
2982          case 106437350: /*party*/  return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
2983          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);
2984          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);
2985          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);
2986          case 675909535: /*decisionMode*/  return new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
2987          case -1412808770: /*answer*/  return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer);
2988          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
2989          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);
2990          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
2991          default: return super.getNamedProperty(_hash, _name, _checkValid);
2992          }
2993
2994        }
2995
2996      @Override
2997      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2998        switch (hash) {
2999        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3000        case 106437350: /*party*/ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3001        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Reference
3002        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3003        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
3004        case 675909535: /*decisionMode*/ return this.decisionMode == null ? new Base[0] : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3005        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3006        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
3007        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3008        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3009        default: return super.getProperty(hash, name, checkValid);
3010        }
3011
3012      }
3013
3014      @Override
3015      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3016        switch (hash) {
3017        case -1618432855: // identifier
3018          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3019          return value;
3020        case 106437350: // party
3021          this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3022          return value;
3023        case 110546223: // topic
3024          this.topic = TypeConvertor.castToReference(value); // Reference
3025          return value;
3026        case 3575610: // type
3027          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3028          return value;
3029        case 565719004: // decision
3030          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3031          return value;
3032        case 675909535: // decisionMode
3033          this.getDecisionMode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3034          return value;
3035        case -1412808770: // answer
3036          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3037          return value;
3038        case 3556653: // text
3039          this.text = TypeConvertor.castToString(value); // StringType
3040          return value;
3041        case -1102667083: // linkId
3042          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
3043          return value;
3044        case -149460995: // securityLabelNumber
3045          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
3046          return value;
3047        default: return super.setProperty(hash, name, value);
3048        }
3049
3050      }
3051
3052      @Override
3053      public Base setProperty(String name, Base value) throws FHIRException {
3054        if (name.equals("identifier")) {
3055          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3056        } else if (name.equals("party")) {
3057          this.getParty().add((ContractPartyComponent) value);
3058        } else if (name.equals("topic")) {
3059          this.topic = TypeConvertor.castToReference(value); // Reference
3060        } else if (name.equals("type")) {
3061          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3062        } else if (name.equals("decision")) {
3063          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3064        } else if (name.equals("decisionMode")) {
3065          this.getDecisionMode().add(TypeConvertor.castToCodeableConcept(value));
3066        } else if (name.equals("answer")) {
3067          this.getAnswer().add((AnswerComponent) value);
3068        } else if (name.equals("text")) {
3069          this.text = TypeConvertor.castToString(value); // StringType
3070        } else if (name.equals("linkId")) {
3071          this.getLinkId().add(TypeConvertor.castToString(value));
3072        } else if (name.equals("securityLabelNumber")) {
3073          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
3074        } else
3075          return super.setProperty(name, value);
3076        return value;
3077      }
3078
3079      @Override
3080      public Base makeProperty(int hash, String name) throws FHIRException {
3081        switch (hash) {
3082        case -1618432855:  return addIdentifier(); 
3083        case 106437350:  return addParty(); 
3084        case 110546223:  return getTopic();
3085        case 3575610:  return getType();
3086        case 565719004:  return getDecision();
3087        case 675909535:  return addDecisionMode(); 
3088        case -1412808770:  return addAnswer(); 
3089        case 3556653:  return getTextElement();
3090        case -1102667083:  return addLinkIdElement();
3091        case -149460995:  return addSecurityLabelNumberElement();
3092        default: return super.makeProperty(hash, name);
3093        }
3094
3095      }
3096
3097      @Override
3098      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3099        switch (hash) {
3100        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3101        case 106437350: /*party*/ return new String[] {};
3102        case 110546223: /*topic*/ return new String[] {"Reference"};
3103        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3104        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
3105        case 675909535: /*decisionMode*/ return new String[] {"CodeableConcept"};
3106        case -1412808770: /*answer*/ return new String[] {};
3107        case 3556653: /*text*/ return new String[] {"string"};
3108        case -1102667083: /*linkId*/ return new String[] {"string"};
3109        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
3110        default: return super.getTypesForProperty(hash, name);
3111        }
3112
3113      }
3114
3115      @Override
3116      public Base addChild(String name) throws FHIRException {
3117        if (name.equals("identifier")) {
3118          return addIdentifier();
3119        }
3120        else if (name.equals("party")) {
3121          return addParty();
3122        }
3123        else if (name.equals("topic")) {
3124          this.topic = new Reference();
3125          return this.topic;
3126        }
3127        else if (name.equals("type")) {
3128          this.type = new CodeableConcept();
3129          return this.type;
3130        }
3131        else if (name.equals("decision")) {
3132          this.decision = new CodeableConcept();
3133          return this.decision;
3134        }
3135        else if (name.equals("decisionMode")) {
3136          return addDecisionMode();
3137        }
3138        else if (name.equals("answer")) {
3139          return addAnswer();
3140        }
3141        else if (name.equals("text")) {
3142          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.text");
3143        }
3144        else if (name.equals("linkId")) {
3145          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.linkId");
3146        }
3147        else if (name.equals("securityLabelNumber")) {
3148          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.securityLabelNumber");
3149        }
3150        else
3151          return super.addChild(name);
3152      }
3153
3154      public ContractOfferComponent copy() {
3155        ContractOfferComponent dst = new ContractOfferComponent();
3156        copyValues(dst);
3157        return dst;
3158      }
3159
3160      public void copyValues(ContractOfferComponent dst) {
3161        super.copyValues(dst);
3162        if (identifier != null) {
3163          dst.identifier = new ArrayList<Identifier>();
3164          for (Identifier i : identifier)
3165            dst.identifier.add(i.copy());
3166        };
3167        if (party != null) {
3168          dst.party = new ArrayList<ContractPartyComponent>();
3169          for (ContractPartyComponent i : party)
3170            dst.party.add(i.copy());
3171        };
3172        dst.topic = topic == null ? null : topic.copy();
3173        dst.type = type == null ? null : type.copy();
3174        dst.decision = decision == null ? null : decision.copy();
3175        if (decisionMode != null) {
3176          dst.decisionMode = new ArrayList<CodeableConcept>();
3177          for (CodeableConcept i : decisionMode)
3178            dst.decisionMode.add(i.copy());
3179        };
3180        if (answer != null) {
3181          dst.answer = new ArrayList<AnswerComponent>();
3182          for (AnswerComponent i : answer)
3183            dst.answer.add(i.copy());
3184        };
3185        dst.text = text == null ? null : text.copy();
3186        if (linkId != null) {
3187          dst.linkId = new ArrayList<StringType>();
3188          for (StringType i : linkId)
3189            dst.linkId.add(i.copy());
3190        };
3191        if (securityLabelNumber != null) {
3192          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
3193          for (UnsignedIntType i : securityLabelNumber)
3194            dst.securityLabelNumber.add(i.copy());
3195        };
3196      }
3197
3198      @Override
3199      public boolean equalsDeep(Base other_) {
3200        if (!super.equalsDeep(other_))
3201          return false;
3202        if (!(other_ instanceof ContractOfferComponent))
3203          return false;
3204        ContractOfferComponent o = (ContractOfferComponent) other_;
3205        return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true) && compareDeep(topic, o.topic, true)
3206           && compareDeep(type, o.type, true) && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
3207           && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
3208           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
3209      }
3210
3211      @Override
3212      public boolean equalsShallow(Base other_) {
3213        if (!super.equalsShallow(other_))
3214          return false;
3215        if (!(other_ instanceof ContractOfferComponent))
3216          return false;
3217        ContractOfferComponent o = (ContractOfferComponent) other_;
3218        return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
3219          ;
3220      }
3221
3222      public boolean isEmpty() {
3223        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic
3224          , type, decision, decisionMode, answer, text, linkId, securityLabelNumber);
3225      }
3226
3227  public String fhirType() {
3228    return "Contract.term.offer";
3229
3230  }
3231
3232  }
3233
3234    @Block()
3235    public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
3236        /**
3237         * Participant in the offer.
3238         */
3239        @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)
3240        @Description(shortDefinition="Referenced entity", formalDefinition="Participant in the offer." )
3241        protected List<Reference> reference;
3242
3243        /**
3244         * How the party participates in the offer.
3245         */
3246        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
3247        @Description(shortDefinition="Participant engagement type", formalDefinition="How the party participates in the offer." )
3248        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-party-role")
3249        protected CodeableConcept role;
3250
3251        private static final long serialVersionUID = -1599592477L;
3252
3253    /**
3254     * Constructor
3255     */
3256      public ContractPartyComponent() {
3257        super();
3258      }
3259
3260    /**
3261     * Constructor
3262     */
3263      public ContractPartyComponent(Reference reference, CodeableConcept role) {
3264        super();
3265        this.addReference(reference);
3266        this.setRole(role);
3267      }
3268
3269        /**
3270         * @return {@link #reference} (Participant in the offer.)
3271         */
3272        public List<Reference> getReference() { 
3273          if (this.reference == null)
3274            this.reference = new ArrayList<Reference>();
3275          return this.reference;
3276        }
3277
3278        /**
3279         * @return Returns a reference to <code>this</code> for easy method chaining
3280         */
3281        public ContractPartyComponent setReference(List<Reference> theReference) { 
3282          this.reference = theReference;
3283          return this;
3284        }
3285
3286        public boolean hasReference() { 
3287          if (this.reference == null)
3288            return false;
3289          for (Reference item : this.reference)
3290            if (!item.isEmpty())
3291              return true;
3292          return false;
3293        }
3294
3295        public Reference addReference() { //3
3296          Reference t = new Reference();
3297          if (this.reference == null)
3298            this.reference = new ArrayList<Reference>();
3299          this.reference.add(t);
3300          return t;
3301        }
3302
3303        public ContractPartyComponent addReference(Reference t) { //3
3304          if (t == null)
3305            return this;
3306          if (this.reference == null)
3307            this.reference = new ArrayList<Reference>();
3308          this.reference.add(t);
3309          return this;
3310        }
3311
3312        /**
3313         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist {3}
3314         */
3315        public Reference getReferenceFirstRep() { 
3316          if (getReference().isEmpty()) {
3317            addReference();
3318          }
3319          return getReference().get(0);
3320        }
3321
3322        /**
3323         * @return {@link #role} (How the party participates in the offer.)
3324         */
3325        public CodeableConcept getRole() { 
3326          if (this.role == null)
3327            if (Configuration.errorOnAutoCreate())
3328              throw new Error("Attempt to auto-create ContractPartyComponent.role");
3329            else if (Configuration.doAutoCreate())
3330              this.role = new CodeableConcept(); // cc
3331          return this.role;
3332        }
3333
3334        public boolean hasRole() { 
3335          return this.role != null && !this.role.isEmpty();
3336        }
3337
3338        /**
3339         * @param value {@link #role} (How the party participates in the offer.)
3340         */
3341        public ContractPartyComponent setRole(CodeableConcept value) { 
3342          this.role = value;
3343          return this;
3344        }
3345
3346        protected void listChildren(List<Property> children) {
3347          super.listChildren(children);
3348          children.add(new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
3349          children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
3350        }
3351
3352        @Override
3353        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3354          switch (_hash) {
3355          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);
3356          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role);
3357          default: return super.getNamedProperty(_hash, _name, _checkValid);
3358          }
3359
3360        }
3361
3362      @Override
3363      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3364        switch (hash) {
3365        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
3366        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
3367        default: return super.getProperty(hash, name, checkValid);
3368        }
3369
3370      }
3371
3372      @Override
3373      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3374        switch (hash) {
3375        case -925155509: // reference
3376          this.getReference().add(TypeConvertor.castToReference(value)); // Reference
3377          return value;
3378        case 3506294: // role
3379          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3380          return value;
3381        default: return super.setProperty(hash, name, value);
3382        }
3383
3384      }
3385
3386      @Override
3387      public Base setProperty(String name, Base value) throws FHIRException {
3388        if (name.equals("reference")) {
3389          this.getReference().add(TypeConvertor.castToReference(value));
3390        } else if (name.equals("role")) {
3391          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3392        } else
3393          return super.setProperty(name, value);
3394        return value;
3395      }
3396
3397      @Override
3398      public Base makeProperty(int hash, String name) throws FHIRException {
3399        switch (hash) {
3400        case -925155509:  return addReference(); 
3401        case 3506294:  return getRole();
3402        default: return super.makeProperty(hash, name);
3403        }
3404
3405      }
3406
3407      @Override
3408      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3409        switch (hash) {
3410        case -925155509: /*reference*/ return new String[] {"Reference"};
3411        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
3412        default: return super.getTypesForProperty(hash, name);
3413        }
3414
3415      }
3416
3417      @Override
3418      public Base addChild(String name) throws FHIRException {
3419        if (name.equals("reference")) {
3420          return addReference();
3421        }
3422        else if (name.equals("role")) {
3423          this.role = new CodeableConcept();
3424          return this.role;
3425        }
3426        else
3427          return super.addChild(name);
3428      }
3429
3430      public ContractPartyComponent copy() {
3431        ContractPartyComponent dst = new ContractPartyComponent();
3432        copyValues(dst);
3433        return dst;
3434      }
3435
3436      public void copyValues(ContractPartyComponent dst) {
3437        super.copyValues(dst);
3438        if (reference != null) {
3439          dst.reference = new ArrayList<Reference>();
3440          for (Reference i : reference)
3441            dst.reference.add(i.copy());
3442        };
3443        dst.role = role == null ? null : role.copy();
3444      }
3445
3446      @Override
3447      public boolean equalsDeep(Base other_) {
3448        if (!super.equalsDeep(other_))
3449          return false;
3450        if (!(other_ instanceof ContractPartyComponent))
3451          return false;
3452        ContractPartyComponent o = (ContractPartyComponent) other_;
3453        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
3454      }
3455
3456      @Override
3457      public boolean equalsShallow(Base other_) {
3458        if (!super.equalsShallow(other_))
3459          return false;
3460        if (!(other_ instanceof ContractPartyComponent))
3461          return false;
3462        ContractPartyComponent o = (ContractPartyComponent) other_;
3463        return true;
3464      }
3465
3466      public boolean isEmpty() {
3467        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
3468      }
3469
3470  public String fhirType() {
3471    return "Contract.term.offer.party";
3472
3473  }
3474
3475  }
3476
3477    @Block()
3478    public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
3479        /**
3480         * 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.
3481         */
3482        @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)
3483        @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." )
3484        protected DataType value;
3485
3486        private static final long serialVersionUID = -1135414639L;
3487
3488    /**
3489     * Constructor
3490     */
3491      public AnswerComponent() {
3492        super();
3493      }
3494
3495    /**
3496     * Constructor
3497     */
3498      public AnswerComponent(DataType value) {
3499        super();
3500        this.setValue(value);
3501      }
3502
3503        /**
3504         * @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.)
3505         */
3506        public DataType getValue() { 
3507          return this.value;
3508        }
3509
3510        /**
3511         * @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.)
3512         */
3513        public BooleanType getValueBooleanType() throws FHIRException { 
3514          if (this.value == null)
3515            this.value = new BooleanType();
3516          if (!(this.value instanceof BooleanType))
3517            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3518          return (BooleanType) this.value;
3519        }
3520
3521        public boolean hasValueBooleanType() { 
3522          return this != null && this.value instanceof BooleanType;
3523        }
3524
3525        /**
3526         * @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.)
3527         */
3528        public DecimalType getValueDecimalType() throws FHIRException { 
3529          if (this.value == null)
3530            this.value = new DecimalType();
3531          if (!(this.value instanceof DecimalType))
3532            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
3533          return (DecimalType) this.value;
3534        }
3535
3536        public boolean hasValueDecimalType() { 
3537          return this != null && this.value instanceof DecimalType;
3538        }
3539
3540        /**
3541         * @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.)
3542         */
3543        public IntegerType getValueIntegerType() throws FHIRException { 
3544          if (this.value == null)
3545            this.value = new IntegerType();
3546          if (!(this.value instanceof IntegerType))
3547            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3548          return (IntegerType) this.value;
3549        }
3550
3551        public boolean hasValueIntegerType() { 
3552          return this != null && this.value instanceof IntegerType;
3553        }
3554
3555        /**
3556         * @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.)
3557         */
3558        public DateType getValueDateType() throws FHIRException { 
3559          if (this.value == null)
3560            this.value = new DateType();
3561          if (!(this.value instanceof DateType))
3562            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
3563          return (DateType) this.value;
3564        }
3565
3566        public boolean hasValueDateType() { 
3567          return this != null && this.value instanceof DateType;
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 DateTimeType getValueDateTimeType() throws FHIRException { 
3574          if (this.value == null)
3575            this.value = new DateTimeType();
3576          if (!(this.value instanceof DateTimeType))
3577            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3578          return (DateTimeType) this.value;
3579        }
3580
3581        public boolean hasValueDateTimeType() { 
3582          return this != null && this.value instanceof DateTimeType;
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 TimeType getValueTimeType() throws FHIRException { 
3589          if (this.value == null)
3590            this.value = new TimeType();
3591          if (!(this.value instanceof TimeType))
3592            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3593          return (TimeType) this.value;
3594        }
3595
3596        public boolean hasValueTimeType() { 
3597          return this != null && this.value instanceof TimeType;
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 StringType getValueStringType() throws FHIRException { 
3604          if (this.value == null)
3605            this.value = new StringType();
3606          if (!(this.value instanceof StringType))
3607            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3608          return (StringType) this.value;
3609        }
3610
3611        public boolean hasValueStringType() { 
3612          return this != null && this.value instanceof StringType;
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 UriType getValueUriType() throws FHIRException { 
3619          if (this.value == null)
3620            this.value = new UriType();
3621          if (!(this.value instanceof UriType))
3622            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3623          return (UriType) this.value;
3624        }
3625
3626        public boolean hasValueUriType() { 
3627          return this != null && this.value instanceof UriType;
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 Attachment getValueAttachment() throws FHIRException { 
3634          if (this.value == null)
3635            this.value = new Attachment();
3636          if (!(this.value instanceof Attachment))
3637            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3638          return (Attachment) this.value;
3639        }
3640
3641        public boolean hasValueAttachment() { 
3642          return this != null && this.value instanceof Attachment;
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 Coding getValueCoding() throws FHIRException { 
3649          if (this.value == null)
3650            this.value = new Coding();
3651          if (!(this.value instanceof Coding))
3652            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3653          return (Coding) this.value;
3654        }
3655
3656        public boolean hasValueCoding() { 
3657          return this != null && this.value instanceof Coding;
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 Quantity getValueQuantity() throws FHIRException { 
3664          if (this.value == null)
3665            this.value = new Quantity();
3666          if (!(this.value instanceof Quantity))
3667            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3668          return (Quantity) this.value;
3669        }
3670
3671        public boolean hasValueQuantity() { 
3672          return this != null && this.value instanceof Quantity;
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 Reference getValueReference() throws FHIRException { 
3679          if (this.value == null)
3680            this.value = new Reference();
3681          if (!(this.value instanceof Reference))
3682            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3683          return (Reference) this.value;
3684        }
3685
3686        public boolean hasValueReference() { 
3687          return this != null && this.value instanceof Reference;
3688        }
3689
3690        public boolean hasValue() { 
3691          return this.value != null && !this.value.isEmpty();
3692        }
3693
3694        /**
3695         * @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.)
3696         */
3697        public AnswerComponent setValue(DataType value) { 
3698          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))
3699            throw new Error("Not the right type for Contract.term.offer.answer.value[x]: "+value.fhirType());
3700          this.value = value;
3701          return this;
3702        }
3703
3704        protected void listChildren(List<Property> children) {
3705          super.listChildren(children);
3706          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));
3707        }
3708
3709        @Override
3710        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3711          switch (_hash) {
3712          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);
3713          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);
3714          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "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);
3715          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "decimal", "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);
3716          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "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);
3717          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "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);
3718          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "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);
3719          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "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);
3720          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "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);
3721          case -1410172357: /*valueUri*/  return new Property("value[x]", "uri", "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);
3722          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "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);
3723          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "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);
3724          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "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);
3725          case 1755241690: /*valueReference*/  return new Property("value[x]", "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);
3726          default: return super.getNamedProperty(_hash, _name, _checkValid);
3727          }
3728
3729        }
3730
3731      @Override
3732      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3733        switch (hash) {
3734        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3735        default: return super.getProperty(hash, name, checkValid);
3736        }
3737
3738      }
3739
3740      @Override
3741      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3742        switch (hash) {
3743        case 111972721: // value
3744          this.value = TypeConvertor.castToType(value); // DataType
3745          return value;
3746        default: return super.setProperty(hash, name, value);
3747        }
3748
3749      }
3750
3751      @Override
3752      public Base setProperty(String name, Base value) throws FHIRException {
3753        if (name.equals("value[x]")) {
3754          this.value = TypeConvertor.castToType(value); // DataType
3755        } else
3756          return super.setProperty(name, value);
3757        return value;
3758      }
3759
3760      @Override
3761      public Base makeProperty(int hash, String name) throws FHIRException {
3762        switch (hash) {
3763        case -1410166417:  return getValue();
3764        case 111972721:  return getValue();
3765        default: return super.makeProperty(hash, name);
3766        }
3767
3768      }
3769
3770      @Override
3771      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3772        switch (hash) {
3773        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3774        default: return super.getTypesForProperty(hash, name);
3775        }
3776
3777      }
3778
3779      @Override
3780      public Base addChild(String name) throws FHIRException {
3781        if (name.equals("valueBoolean")) {
3782          this.value = new BooleanType();
3783          return this.value;
3784        }
3785        else if (name.equals("valueDecimal")) {
3786          this.value = new DecimalType();
3787          return this.value;
3788        }
3789        else if (name.equals("valueInteger")) {
3790          this.value = new IntegerType();
3791          return this.value;
3792        }
3793        else if (name.equals("valueDate")) {
3794          this.value = new DateType();
3795          return this.value;
3796        }
3797        else if (name.equals("valueDateTime")) {
3798          this.value = new DateTimeType();
3799          return this.value;
3800        }
3801        else if (name.equals("valueTime")) {
3802          this.value = new TimeType();
3803          return this.value;
3804        }
3805        else if (name.equals("valueString")) {
3806          this.value = new StringType();
3807          return this.value;
3808        }
3809        else if (name.equals("valueUri")) {
3810          this.value = new UriType();
3811          return this.value;
3812        }
3813        else if (name.equals("valueAttachment")) {
3814          this.value = new Attachment();
3815          return this.value;
3816        }
3817        else if (name.equals("valueCoding")) {
3818          this.value = new Coding();
3819          return this.value;
3820        }
3821        else if (name.equals("valueQuantity")) {
3822          this.value = new Quantity();
3823          return this.value;
3824        }
3825        else if (name.equals("valueReference")) {
3826          this.value = new Reference();
3827          return this.value;
3828        }
3829        else
3830          return super.addChild(name);
3831      }
3832
3833      public AnswerComponent copy() {
3834        AnswerComponent dst = new AnswerComponent();
3835        copyValues(dst);
3836        return dst;
3837      }
3838
3839      public void copyValues(AnswerComponent dst) {
3840        super.copyValues(dst);
3841        dst.value = value == null ? null : value.copy();
3842      }
3843
3844      @Override
3845      public boolean equalsDeep(Base other_) {
3846        if (!super.equalsDeep(other_))
3847          return false;
3848        if (!(other_ instanceof AnswerComponent))
3849          return false;
3850        AnswerComponent o = (AnswerComponent) other_;
3851        return compareDeep(value, o.value, true);
3852      }
3853
3854      @Override
3855      public boolean equalsShallow(Base other_) {
3856        if (!super.equalsShallow(other_))
3857          return false;
3858        if (!(other_ instanceof AnswerComponent))
3859          return false;
3860        AnswerComponent o = (AnswerComponent) other_;
3861        return true;
3862      }
3863
3864      public boolean isEmpty() {
3865        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3866      }
3867
3868  public String fhirType() {
3869    return "Contract.term.offer.answer";
3870
3871  }
3872
3873  }
3874
3875    @Block()
3876    public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
3877        /**
3878         * Differentiates the kind of the asset .
3879         */
3880        @Child(name = "scope", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3881        @Description(shortDefinition="Range of asset", formalDefinition="Differentiates the kind of the asset ." )
3882        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetscope")
3883        protected CodeableConcept scope;
3884
3885        /**
3886         * Target entity type about which the term may be concerned.
3887         */
3888        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3889        @Description(shortDefinition="Asset category", formalDefinition="Target entity type about which the term may be concerned." )
3890        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assettype")
3891        protected List<CodeableConcept> type;
3892
3893        /**
3894         * Associated entities.
3895         */
3896        @Child(name = "typeReference", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3897        @Description(shortDefinition="Associated entities", formalDefinition="Associated entities." )
3898        protected List<Reference> typeReference;
3899
3900        /**
3901         * May be a subtype or part of an offered asset.
3902         */
3903        @Child(name = "subtype", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3904        @Description(shortDefinition="Asset sub-category", formalDefinition="May be a subtype or part of an offered asset." )
3905        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetsubtype")
3906        protected List<CodeableConcept> subtype;
3907
3908        /**
3909         * 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.
3910         */
3911        @Child(name = "relationship", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=false)
3912        @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." )
3913        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-class")
3914        protected Coding relationship;
3915
3916        /**
3917         * Circumstance of the asset.
3918         */
3919        @Child(name = "context", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3920        @Description(shortDefinition="Circumstance of the asset", formalDefinition="Circumstance of the asset." )
3921        protected List<AssetContextComponent> context;
3922
3923        /**
3924         * Description of the quality and completeness of the asset that imay be a factor in its valuation.
3925         */
3926        @Child(name = "condition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3927        @Description(shortDefinition="Quality desctiption of asset", formalDefinition="Description of the quality and completeness of the asset that imay be a factor in its valuation." )
3928        protected StringType condition;
3929
3930        /**
3931         * Type of Asset availability for use or ownership.
3932         */
3933        @Child(name = "periodType", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3934        @Description(shortDefinition="Asset availability types", formalDefinition="Type of Asset availability for use or ownership." )
3935        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/asset-availability")
3936        protected List<CodeableConcept> periodType;
3937
3938        /**
3939         * Asset relevant contractual time period.
3940         */
3941        @Child(name = "period", type = {Period.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3942        @Description(shortDefinition="Time period of the asset", formalDefinition="Asset relevant contractual time period." )
3943        protected List<Period> period;
3944
3945        /**
3946         * Time period of asset use.
3947         */
3948        @Child(name = "usePeriod", type = {Period.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3949        @Description(shortDefinition="Time period", formalDefinition="Time period of asset use." )
3950        protected List<Period> usePeriod;
3951
3952        /**
3953         * Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
3954         */
3955        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
3956        @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." )
3957        protected StringType text;
3958
3959        /**
3960         * Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.
3961         */
3962        @Child(name = "linkId", type = {StringType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3963        @Description(shortDefinition="Pointer to asset text", formalDefinition="Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse." )
3964        protected List<StringType> linkId;
3965
3966        /**
3967         * Response to assets.
3968         */
3969        @Child(name = "answer", type = {AnswerComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3970        @Description(shortDefinition="Response to assets", formalDefinition="Response to assets." )
3971        protected List<AnswerComponent> answer;
3972
3973        /**
3974         * Security labels that protects the asset.
3975         */
3976        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3977        @Description(shortDefinition="Asset restriction numbers", formalDefinition="Security labels that protects the asset." )
3978        protected List<UnsignedIntType> securityLabelNumber;
3979
3980        /**
3981         * Contract Valued Item List.
3982         */
3983        @Child(name = "valuedItem", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3984        @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
3985        protected List<ValuedItemComponent> valuedItem;
3986
3987        private static final long serialVersionUID = -581986730L;
3988
3989    /**
3990     * Constructor
3991     */
3992      public ContractAssetComponent() {
3993        super();
3994      }
3995
3996        /**
3997         * @return {@link #scope} (Differentiates the kind of the asset .)
3998         */
3999        public CodeableConcept getScope() { 
4000          if (this.scope == null)
4001            if (Configuration.errorOnAutoCreate())
4002              throw new Error("Attempt to auto-create ContractAssetComponent.scope");
4003            else if (Configuration.doAutoCreate())
4004              this.scope = new CodeableConcept(); // cc
4005          return this.scope;
4006        }
4007
4008        public boolean hasScope() { 
4009          return this.scope != null && !this.scope.isEmpty();
4010        }
4011
4012        /**
4013         * @param value {@link #scope} (Differentiates the kind of the asset .)
4014         */
4015        public ContractAssetComponent setScope(CodeableConcept value) { 
4016          this.scope = value;
4017          return this;
4018        }
4019
4020        /**
4021         * @return {@link #type} (Target entity type about which the term may be concerned.)
4022         */
4023        public List<CodeableConcept> getType() { 
4024          if (this.type == null)
4025            this.type = new ArrayList<CodeableConcept>();
4026          return this.type;
4027        }
4028
4029        /**
4030         * @return Returns a reference to <code>this</code> for easy method chaining
4031         */
4032        public ContractAssetComponent setType(List<CodeableConcept> theType) { 
4033          this.type = theType;
4034          return this;
4035        }
4036
4037        public boolean hasType() { 
4038          if (this.type == null)
4039            return false;
4040          for (CodeableConcept item : this.type)
4041            if (!item.isEmpty())
4042              return true;
4043          return false;
4044        }
4045
4046        public CodeableConcept addType() { //3
4047          CodeableConcept t = new CodeableConcept();
4048          if (this.type == null)
4049            this.type = new ArrayList<CodeableConcept>();
4050          this.type.add(t);
4051          return t;
4052        }
4053
4054        public ContractAssetComponent addType(CodeableConcept t) { //3
4055          if (t == null)
4056            return this;
4057          if (this.type == null)
4058            this.type = new ArrayList<CodeableConcept>();
4059          this.type.add(t);
4060          return this;
4061        }
4062
4063        /**
4064         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
4065         */
4066        public CodeableConcept getTypeFirstRep() { 
4067          if (getType().isEmpty()) {
4068            addType();
4069          }
4070          return getType().get(0);
4071        }
4072
4073        /**
4074         * @return {@link #typeReference} (Associated entities.)
4075         */
4076        public List<Reference> getTypeReference() { 
4077          if (this.typeReference == null)
4078            this.typeReference = new ArrayList<Reference>();
4079          return this.typeReference;
4080        }
4081
4082        /**
4083         * @return Returns a reference to <code>this</code> for easy method chaining
4084         */
4085        public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) { 
4086          this.typeReference = theTypeReference;
4087          return this;
4088        }
4089
4090        public boolean hasTypeReference() { 
4091          if (this.typeReference == null)
4092            return false;
4093          for (Reference item : this.typeReference)
4094            if (!item.isEmpty())
4095              return true;
4096          return false;
4097        }
4098
4099        public Reference addTypeReference() { //3
4100          Reference t = new Reference();
4101          if (this.typeReference == null)
4102            this.typeReference = new ArrayList<Reference>();
4103          this.typeReference.add(t);
4104          return t;
4105        }
4106
4107        public ContractAssetComponent addTypeReference(Reference t) { //3
4108          if (t == null)
4109            return this;
4110          if (this.typeReference == null)
4111            this.typeReference = new ArrayList<Reference>();
4112          this.typeReference.add(t);
4113          return this;
4114        }
4115
4116        /**
4117         * @return The first repetition of repeating field {@link #typeReference}, creating it if it does not already exist {3}
4118         */
4119        public Reference getTypeReferenceFirstRep() { 
4120          if (getTypeReference().isEmpty()) {
4121            addTypeReference();
4122          }
4123          return getTypeReference().get(0);
4124        }
4125
4126        /**
4127         * @return {@link #subtype} (May be a subtype or part of an offered asset.)
4128         */
4129        public List<CodeableConcept> getSubtype() { 
4130          if (this.subtype == null)
4131            this.subtype = new ArrayList<CodeableConcept>();
4132          return this.subtype;
4133        }
4134
4135        /**
4136         * @return Returns a reference to <code>this</code> for easy method chaining
4137         */
4138        public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) { 
4139          this.subtype = theSubtype;
4140          return this;
4141        }
4142
4143        public boolean hasSubtype() { 
4144          if (this.subtype == null)
4145            return false;
4146          for (CodeableConcept item : this.subtype)
4147            if (!item.isEmpty())
4148              return true;
4149          return false;
4150        }
4151
4152        public CodeableConcept addSubtype() { //3
4153          CodeableConcept t = new CodeableConcept();
4154          if (this.subtype == null)
4155            this.subtype = new ArrayList<CodeableConcept>();
4156          this.subtype.add(t);
4157          return t;
4158        }
4159
4160        public ContractAssetComponent addSubtype(CodeableConcept t) { //3
4161          if (t == null)
4162            return this;
4163          if (this.subtype == null)
4164            this.subtype = new ArrayList<CodeableConcept>();
4165          this.subtype.add(t);
4166          return this;
4167        }
4168
4169        /**
4170         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist {3}
4171         */
4172        public CodeableConcept getSubtypeFirstRep() { 
4173          if (getSubtype().isEmpty()) {
4174            addSubtype();
4175          }
4176          return getSubtype().get(0);
4177        }
4178
4179        /**
4180         * @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.)
4181         */
4182        public Coding getRelationship() { 
4183          if (this.relationship == null)
4184            if (Configuration.errorOnAutoCreate())
4185              throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
4186            else if (Configuration.doAutoCreate())
4187              this.relationship = new Coding(); // cc
4188          return this.relationship;
4189        }
4190
4191        public boolean hasRelationship() { 
4192          return this.relationship != null && !this.relationship.isEmpty();
4193        }
4194
4195        /**
4196         * @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.)
4197         */
4198        public ContractAssetComponent setRelationship(Coding value) { 
4199          this.relationship = value;
4200          return this;
4201        }
4202
4203        /**
4204         * @return {@link #context} (Circumstance of the asset.)
4205         */
4206        public List<AssetContextComponent> getContext() { 
4207          if (this.context == null)
4208            this.context = new ArrayList<AssetContextComponent>();
4209          return this.context;
4210        }
4211
4212        /**
4213         * @return Returns a reference to <code>this</code> for easy method chaining
4214         */
4215        public ContractAssetComponent setContext(List<AssetContextComponent> theContext) { 
4216          this.context = theContext;
4217          return this;
4218        }
4219
4220        public boolean hasContext() { 
4221          if (this.context == null)
4222            return false;
4223          for (AssetContextComponent item : this.context)
4224            if (!item.isEmpty())
4225              return true;
4226          return false;
4227        }
4228
4229        public AssetContextComponent addContext() { //3
4230          AssetContextComponent t = new AssetContextComponent();
4231          if (this.context == null)
4232            this.context = new ArrayList<AssetContextComponent>();
4233          this.context.add(t);
4234          return t;
4235        }
4236
4237        public ContractAssetComponent addContext(AssetContextComponent t) { //3
4238          if (t == null)
4239            return this;
4240          if (this.context == null)
4241            this.context = new ArrayList<AssetContextComponent>();
4242          this.context.add(t);
4243          return this;
4244        }
4245
4246        /**
4247         * @return The first repetition of repeating field {@link #context}, creating it if it does not already exist {3}
4248         */
4249        public AssetContextComponent getContextFirstRep() { 
4250          if (getContext().isEmpty()) {
4251            addContext();
4252          }
4253          return getContext().get(0);
4254        }
4255
4256        /**
4257         * @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
4258         */
4259        public StringType getConditionElement() { 
4260          if (this.condition == null)
4261            if (Configuration.errorOnAutoCreate())
4262              throw new Error("Attempt to auto-create ContractAssetComponent.condition");
4263            else if (Configuration.doAutoCreate())
4264              this.condition = new StringType(); // bb
4265          return this.condition;
4266        }
4267
4268        public boolean hasConditionElement() { 
4269          return this.condition != null && !this.condition.isEmpty();
4270        }
4271
4272        public boolean hasCondition() { 
4273          return this.condition != null && !this.condition.isEmpty();
4274        }
4275
4276        /**
4277         * @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
4278         */
4279        public ContractAssetComponent setConditionElement(StringType value) { 
4280          this.condition = value;
4281          return this;
4282        }
4283
4284        /**
4285         * @return Description of the quality and completeness of the asset that imay be a factor in its valuation.
4286         */
4287        public String getCondition() { 
4288          return this.condition == null ? null : this.condition.getValue();
4289        }
4290
4291        /**
4292         * @param value Description of the quality and completeness of the asset that imay be a factor in its valuation.
4293         */
4294        public ContractAssetComponent setCondition(String value) { 
4295          if (Utilities.noString(value))
4296            this.condition = null;
4297          else {
4298            if (this.condition == null)
4299              this.condition = new StringType();
4300            this.condition.setValue(value);
4301          }
4302          return this;
4303        }
4304
4305        /**
4306         * @return {@link #periodType} (Type of Asset availability for use or ownership.)
4307         */
4308        public List<CodeableConcept> getPeriodType() { 
4309          if (this.periodType == null)
4310            this.periodType = new ArrayList<CodeableConcept>();
4311          return this.periodType;
4312        }
4313
4314        /**
4315         * @return Returns a reference to <code>this</code> for easy method chaining
4316         */
4317        public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) { 
4318          this.periodType = thePeriodType;
4319          return this;
4320        }
4321
4322        public boolean hasPeriodType() { 
4323          if (this.periodType == null)
4324            return false;
4325          for (CodeableConcept item : this.periodType)
4326            if (!item.isEmpty())
4327              return true;
4328          return false;
4329        }
4330
4331        public CodeableConcept addPeriodType() { //3
4332          CodeableConcept t = new CodeableConcept();
4333          if (this.periodType == null)
4334            this.periodType = new ArrayList<CodeableConcept>();
4335          this.periodType.add(t);
4336          return t;
4337        }
4338
4339        public ContractAssetComponent addPeriodType(CodeableConcept t) { //3
4340          if (t == null)
4341            return this;
4342          if (this.periodType == null)
4343            this.periodType = new ArrayList<CodeableConcept>();
4344          this.periodType.add(t);
4345          return this;
4346        }
4347
4348        /**
4349         * @return The first repetition of repeating field {@link #periodType}, creating it if it does not already exist {3}
4350         */
4351        public CodeableConcept getPeriodTypeFirstRep() { 
4352          if (getPeriodType().isEmpty()) {
4353            addPeriodType();
4354          }
4355          return getPeriodType().get(0);
4356        }
4357
4358        /**
4359         * @return {@link #period} (Asset relevant contractual time period.)
4360         */
4361        public List<Period> getPeriod() { 
4362          if (this.period == null)
4363            this.period = new ArrayList<Period>();
4364          return this.period;
4365        }
4366
4367        /**
4368         * @return Returns a reference to <code>this</code> for easy method chaining
4369         */
4370        public ContractAssetComponent setPeriod(List<Period> thePeriod) { 
4371          this.period = thePeriod;
4372          return this;
4373        }
4374
4375        public boolean hasPeriod() { 
4376          if (this.period == null)
4377            return false;
4378          for (Period item : this.period)
4379            if (!item.isEmpty())
4380              return true;
4381          return false;
4382        }
4383
4384        public Period addPeriod() { //3
4385          Period t = new Period();
4386          if (this.period == null)
4387            this.period = new ArrayList<Period>();
4388          this.period.add(t);
4389          return t;
4390        }
4391
4392        public ContractAssetComponent addPeriod(Period t) { //3
4393          if (t == null)
4394            return this;
4395          if (this.period == null)
4396            this.period = new ArrayList<Period>();
4397          this.period.add(t);
4398          return this;
4399        }
4400
4401        /**
4402         * @return The first repetition of repeating field {@link #period}, creating it if it does not already exist {3}
4403         */
4404        public Period getPeriodFirstRep() { 
4405          if (getPeriod().isEmpty()) {
4406            addPeriod();
4407          }
4408          return getPeriod().get(0);
4409        }
4410
4411        /**
4412         * @return {@link #usePeriod} (Time period of asset use.)
4413         */
4414        public List<Period> getUsePeriod() { 
4415          if (this.usePeriod == null)
4416            this.usePeriod = new ArrayList<Period>();
4417          return this.usePeriod;
4418        }
4419
4420        /**
4421         * @return Returns a reference to <code>this</code> for easy method chaining
4422         */
4423        public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) { 
4424          this.usePeriod = theUsePeriod;
4425          return this;
4426        }
4427
4428        public boolean hasUsePeriod() { 
4429          if (this.usePeriod == null)
4430            return false;
4431          for (Period item : this.usePeriod)
4432            if (!item.isEmpty())
4433              return true;
4434          return false;
4435        }
4436
4437        public Period addUsePeriod() { //3
4438          Period t = new Period();
4439          if (this.usePeriod == null)
4440            this.usePeriod = new ArrayList<Period>();
4441          this.usePeriod.add(t);
4442          return t;
4443        }
4444
4445        public ContractAssetComponent addUsePeriod(Period t) { //3
4446          if (t == null)
4447            return this;
4448          if (this.usePeriod == null)
4449            this.usePeriod = new ArrayList<Period>();
4450          this.usePeriod.add(t);
4451          return this;
4452        }
4453
4454        /**
4455         * @return The first repetition of repeating field {@link #usePeriod}, creating it if it does not already exist {3}
4456         */
4457        public Period getUsePeriodFirstRep() { 
4458          if (getUsePeriod().isEmpty()) {
4459            addUsePeriod();
4460          }
4461          return getUsePeriod().get(0);
4462        }
4463
4464        /**
4465         * @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
4466         */
4467        public StringType getTextElement() { 
4468          if (this.text == null)
4469            if (Configuration.errorOnAutoCreate())
4470              throw new Error("Attempt to auto-create ContractAssetComponent.text");
4471            else if (Configuration.doAutoCreate())
4472              this.text = new StringType(); // bb
4473          return this.text;
4474        }
4475
4476        public boolean hasTextElement() { 
4477          return this.text != null && !this.text.isEmpty();
4478        }
4479
4480        public boolean hasText() { 
4481          return this.text != null && !this.text.isEmpty();
4482        }
4483
4484        /**
4485         * @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
4486         */
4487        public ContractAssetComponent setTextElement(StringType value) { 
4488          this.text = value;
4489          return this;
4490        }
4491
4492        /**
4493         * @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.
4494         */
4495        public String getText() { 
4496          return this.text == null ? null : this.text.getValue();
4497        }
4498
4499        /**
4500         * @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.
4501         */
4502        public ContractAssetComponent setText(String value) { 
4503          if (Utilities.noString(value))
4504            this.text = null;
4505          else {
4506            if (this.text == null)
4507              this.text = new StringType();
4508            this.text.setValue(value);
4509          }
4510          return this;
4511        }
4512
4513        /**
4514         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4515         */
4516        public List<StringType> getLinkId() { 
4517          if (this.linkId == null)
4518            this.linkId = new ArrayList<StringType>();
4519          return this.linkId;
4520        }
4521
4522        /**
4523         * @return Returns a reference to <code>this</code> for easy method chaining
4524         */
4525        public ContractAssetComponent setLinkId(List<StringType> theLinkId) { 
4526          this.linkId = theLinkId;
4527          return this;
4528        }
4529
4530        public boolean hasLinkId() { 
4531          if (this.linkId == null)
4532            return false;
4533          for (StringType item : this.linkId)
4534            if (!item.isEmpty())
4535              return true;
4536          return false;
4537        }
4538
4539        /**
4540         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4541         */
4542        public StringType addLinkIdElement() {//2 
4543          StringType t = new StringType();
4544          if (this.linkId == null)
4545            this.linkId = new ArrayList<StringType>();
4546          this.linkId.add(t);
4547          return t;
4548        }
4549
4550        /**
4551         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4552         */
4553        public ContractAssetComponent addLinkId(String value) { //1
4554          StringType t = new StringType();
4555          t.setValue(value);
4556          if (this.linkId == null)
4557            this.linkId = new ArrayList<StringType>();
4558          this.linkId.add(t);
4559          return this;
4560        }
4561
4562        /**
4563         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4564         */
4565        public boolean hasLinkId(String value) { 
4566          if (this.linkId == null)
4567            return false;
4568          for (StringType v : this.linkId)
4569            if (v.getValue().equals(value)) // string
4570              return true;
4571          return false;
4572        }
4573
4574        /**
4575         * @return {@link #answer} (Response to assets.)
4576         */
4577        public List<AnswerComponent> getAnswer() { 
4578          if (this.answer == null)
4579            this.answer = new ArrayList<AnswerComponent>();
4580          return this.answer;
4581        }
4582
4583        /**
4584         * @return Returns a reference to <code>this</code> for easy method chaining
4585         */
4586        public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) { 
4587          this.answer = theAnswer;
4588          return this;
4589        }
4590
4591        public boolean hasAnswer() { 
4592          if (this.answer == null)
4593            return false;
4594          for (AnswerComponent item : this.answer)
4595            if (!item.isEmpty())
4596              return true;
4597          return false;
4598        }
4599
4600        public AnswerComponent addAnswer() { //3
4601          AnswerComponent t = new AnswerComponent();
4602          if (this.answer == null)
4603            this.answer = new ArrayList<AnswerComponent>();
4604          this.answer.add(t);
4605          return t;
4606        }
4607
4608        public ContractAssetComponent addAnswer(AnswerComponent t) { //3
4609          if (t == null)
4610            return this;
4611          if (this.answer == null)
4612            this.answer = new ArrayList<AnswerComponent>();
4613          this.answer.add(t);
4614          return this;
4615        }
4616
4617        /**
4618         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist {3}
4619         */
4620        public AnswerComponent getAnswerFirstRep() { 
4621          if (getAnswer().isEmpty()) {
4622            addAnswer();
4623          }
4624          return getAnswer().get(0);
4625        }
4626
4627        /**
4628         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4629         */
4630        public List<UnsignedIntType> getSecurityLabelNumber() { 
4631          if (this.securityLabelNumber == null)
4632            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4633          return this.securityLabelNumber;
4634        }
4635
4636        /**
4637         * @return Returns a reference to <code>this</code> for easy method chaining
4638         */
4639        public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
4640          this.securityLabelNumber = theSecurityLabelNumber;
4641          return this;
4642        }
4643
4644        public boolean hasSecurityLabelNumber() { 
4645          if (this.securityLabelNumber == null)
4646            return false;
4647          for (UnsignedIntType item : this.securityLabelNumber)
4648            if (!item.isEmpty())
4649              return true;
4650          return false;
4651        }
4652
4653        /**
4654         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4655         */
4656        public UnsignedIntType addSecurityLabelNumberElement() {//2 
4657          UnsignedIntType t = new UnsignedIntType();
4658          if (this.securityLabelNumber == null)
4659            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4660          this.securityLabelNumber.add(t);
4661          return t;
4662        }
4663
4664        /**
4665         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4666         */
4667        public ContractAssetComponent addSecurityLabelNumber(int value) { //1
4668          UnsignedIntType t = new UnsignedIntType();
4669          t.setValue(value);
4670          if (this.securityLabelNumber == null)
4671            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4672          this.securityLabelNumber.add(t);
4673          return this;
4674        }
4675
4676        /**
4677         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4678         */
4679        public boolean hasSecurityLabelNumber(int value) { 
4680          if (this.securityLabelNumber == null)
4681            return false;
4682          for (UnsignedIntType v : this.securityLabelNumber)
4683            if (v.getValue().equals(value)) // unsignedInt
4684              return true;
4685          return false;
4686        }
4687
4688        /**
4689         * @return {@link #valuedItem} (Contract Valued Item List.)
4690         */
4691        public List<ValuedItemComponent> getValuedItem() { 
4692          if (this.valuedItem == null)
4693            this.valuedItem = new ArrayList<ValuedItemComponent>();
4694          return this.valuedItem;
4695        }
4696
4697        /**
4698         * @return Returns a reference to <code>this</code> for easy method chaining
4699         */
4700        public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) { 
4701          this.valuedItem = theValuedItem;
4702          return this;
4703        }
4704
4705        public boolean hasValuedItem() { 
4706          if (this.valuedItem == null)
4707            return false;
4708          for (ValuedItemComponent item : this.valuedItem)
4709            if (!item.isEmpty())
4710              return true;
4711          return false;
4712        }
4713
4714        public ValuedItemComponent addValuedItem() { //3
4715          ValuedItemComponent t = new ValuedItemComponent();
4716          if (this.valuedItem == null)
4717            this.valuedItem = new ArrayList<ValuedItemComponent>();
4718          this.valuedItem.add(t);
4719          return t;
4720        }
4721
4722        public ContractAssetComponent addValuedItem(ValuedItemComponent t) { //3
4723          if (t == null)
4724            return this;
4725          if (this.valuedItem == null)
4726            this.valuedItem = new ArrayList<ValuedItemComponent>();
4727          this.valuedItem.add(t);
4728          return this;
4729        }
4730
4731        /**
4732         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist {3}
4733         */
4734        public ValuedItemComponent getValuedItemFirstRep() { 
4735          if (getValuedItem().isEmpty()) {
4736            addValuedItem();
4737          }
4738          return getValuedItem().get(0);
4739        }
4740
4741        protected void listChildren(List<Property> children) {
4742          super.listChildren(children);
4743          children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
4744          children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type));
4745          children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference));
4746          children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0, java.lang.Integer.MAX_VALUE, subtype));
4747          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));
4748          children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
4749          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));
4750          children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType));
4751          children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period));
4752          children.add(new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
4753          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));
4754          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));
4755          children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer));
4756          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
4757          children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
4758        }
4759
4760        @Override
4761        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4762          switch (_hash) {
4763          case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope);
4764          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);
4765          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference);
4766          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);
4767          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);
4768          case 951530927: /*context*/  return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context);
4769          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);
4770          case 384348315: /*periodType*/  return new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
4771          case -991726143: /*period*/  return new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period);
4772          case -628382168: /*usePeriod*/  return new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod);
4773          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);
4774          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);
4775          case -1412808770: /*answer*/  return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer);
4776          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
4777          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
4778          default: return super.getNamedProperty(_hash, _name, _checkValid);
4779          }
4780
4781        }
4782
4783      @Override
4784      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4785        switch (hash) {
4786        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
4787        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4788        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
4789        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
4790        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
4791        case 951530927: /*context*/ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
4792        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
4793        case 384348315: /*periodType*/ return this.periodType == null ? new Base[0] : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
4794        case -991726143: /*period*/ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
4795        case -628382168: /*usePeriod*/ return this.usePeriod == null ? new Base[0] : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
4796        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
4797        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
4798        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
4799        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
4800        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
4801        default: return super.getProperty(hash, name, checkValid);
4802        }
4803
4804      }
4805
4806      @Override
4807      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4808        switch (hash) {
4809        case 109264468: // scope
4810          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4811          return value;
4812        case 3575610: // type
4813          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4814          return value;
4815        case 2074825009: // typeReference
4816          this.getTypeReference().add(TypeConvertor.castToReference(value)); // Reference
4817          return value;
4818        case -1867567750: // subtype
4819          this.getSubtype().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4820          return value;
4821        case -261851592: // relationship
4822          this.relationship = TypeConvertor.castToCoding(value); // Coding
4823          return value;
4824        case 951530927: // context
4825          this.getContext().add((AssetContextComponent) value); // AssetContextComponent
4826          return value;
4827        case -861311717: // condition
4828          this.condition = TypeConvertor.castToString(value); // StringType
4829          return value;
4830        case 384348315: // periodType
4831          this.getPeriodType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4832          return value;
4833        case -991726143: // period
4834          this.getPeriod().add(TypeConvertor.castToPeriod(value)); // Period
4835          return value;
4836        case -628382168: // usePeriod
4837          this.getUsePeriod().add(TypeConvertor.castToPeriod(value)); // Period
4838          return value;
4839        case 3556653: // text
4840          this.text = TypeConvertor.castToString(value); // StringType
4841          return value;
4842        case -1102667083: // linkId
4843          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
4844          return value;
4845        case -1412808770: // answer
4846          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
4847          return value;
4848        case -149460995: // securityLabelNumber
4849          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
4850          return value;
4851        case 2046675654: // valuedItem
4852          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
4853          return value;
4854        default: return super.setProperty(hash, name, value);
4855        }
4856
4857      }
4858
4859      @Override
4860      public Base setProperty(String name, Base value) throws FHIRException {
4861        if (name.equals("scope")) {
4862          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4863        } else if (name.equals("type")) {
4864          this.getType().add(TypeConvertor.castToCodeableConcept(value));
4865        } else if (name.equals("typeReference")) {
4866          this.getTypeReference().add(TypeConvertor.castToReference(value));
4867        } else if (name.equals("subtype")) {
4868          this.getSubtype().add(TypeConvertor.castToCodeableConcept(value));
4869        } else if (name.equals("relationship")) {
4870          this.relationship = TypeConvertor.castToCoding(value); // Coding
4871        } else if (name.equals("context")) {
4872          this.getContext().add((AssetContextComponent) value);
4873        } else if (name.equals("condition")) {
4874          this.condition = TypeConvertor.castToString(value); // StringType
4875        } else if (name.equals("periodType")) {
4876          this.getPeriodType().add(TypeConvertor.castToCodeableConcept(value));
4877        } else if (name.equals("period")) {
4878          this.getPeriod().add(TypeConvertor.castToPeriod(value));
4879        } else if (name.equals("usePeriod")) {
4880          this.getUsePeriod().add(TypeConvertor.castToPeriod(value));
4881        } else if (name.equals("text")) {
4882          this.text = TypeConvertor.castToString(value); // StringType
4883        } else if (name.equals("linkId")) {
4884          this.getLinkId().add(TypeConvertor.castToString(value));
4885        } else if (name.equals("answer")) {
4886          this.getAnswer().add((AnswerComponent) value);
4887        } else if (name.equals("securityLabelNumber")) {
4888          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
4889        } else if (name.equals("valuedItem")) {
4890          this.getValuedItem().add((ValuedItemComponent) value);
4891        } else
4892          return super.setProperty(name, value);
4893        return value;
4894      }
4895
4896      @Override
4897      public Base makeProperty(int hash, String name) throws FHIRException {
4898        switch (hash) {
4899        case 109264468:  return getScope();
4900        case 3575610:  return addType(); 
4901        case 2074825009:  return addTypeReference(); 
4902        case -1867567750:  return addSubtype(); 
4903        case -261851592:  return getRelationship();
4904        case 951530927:  return addContext(); 
4905        case -861311717:  return getConditionElement();
4906        case 384348315:  return addPeriodType(); 
4907        case -991726143:  return addPeriod(); 
4908        case -628382168:  return addUsePeriod(); 
4909        case 3556653:  return getTextElement();
4910        case -1102667083:  return addLinkIdElement();
4911        case -1412808770:  return addAnswer(); 
4912        case -149460995:  return addSecurityLabelNumberElement();
4913        case 2046675654:  return addValuedItem(); 
4914        default: return super.makeProperty(hash, name);
4915        }
4916
4917      }
4918
4919      @Override
4920      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4921        switch (hash) {
4922        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
4923        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4924        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
4925        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
4926        case -261851592: /*relationship*/ return new String[] {"Coding"};
4927        case 951530927: /*context*/ return new String[] {};
4928        case -861311717: /*condition*/ return new String[] {"string"};
4929        case 384348315: /*periodType*/ return new String[] {"CodeableConcept"};
4930        case -991726143: /*period*/ return new String[] {"Period"};
4931        case -628382168: /*usePeriod*/ return new String[] {"Period"};
4932        case 3556653: /*text*/ return new String[] {"string"};
4933        case -1102667083: /*linkId*/ return new String[] {"string"};
4934        case -1412808770: /*answer*/ return new String[] {"@Contract.term.offer.answer"};
4935        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
4936        case 2046675654: /*valuedItem*/ return new String[] {};
4937        default: return super.getTypesForProperty(hash, name);
4938        }
4939
4940      }
4941
4942      @Override
4943      public Base addChild(String name) throws FHIRException {
4944        if (name.equals("scope")) {
4945          this.scope = new CodeableConcept();
4946          return this.scope;
4947        }
4948        else if (name.equals("type")) {
4949          return addType();
4950        }
4951        else if (name.equals("typeReference")) {
4952          return addTypeReference();
4953        }
4954        else if (name.equals("subtype")) {
4955          return addSubtype();
4956        }
4957        else if (name.equals("relationship")) {
4958          this.relationship = new Coding();
4959          return this.relationship;
4960        }
4961        else if (name.equals("context")) {
4962          return addContext();
4963        }
4964        else if (name.equals("condition")) {
4965          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.condition");
4966        }
4967        else if (name.equals("periodType")) {
4968          return addPeriodType();
4969        }
4970        else if (name.equals("period")) {
4971          return addPeriod();
4972        }
4973        else if (name.equals("usePeriod")) {
4974          return addUsePeriod();
4975        }
4976        else if (name.equals("text")) {
4977          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.text");
4978        }
4979        else if (name.equals("linkId")) {
4980          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.linkId");
4981        }
4982        else if (name.equals("answer")) {
4983          return addAnswer();
4984        }
4985        else if (name.equals("securityLabelNumber")) {
4986          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.securityLabelNumber");
4987        }
4988        else if (name.equals("valuedItem")) {
4989          return addValuedItem();
4990        }
4991        else
4992          return super.addChild(name);
4993      }
4994
4995      public ContractAssetComponent copy() {
4996        ContractAssetComponent dst = new ContractAssetComponent();
4997        copyValues(dst);
4998        return dst;
4999      }
5000
5001      public void copyValues(ContractAssetComponent dst) {
5002        super.copyValues(dst);
5003        dst.scope = scope == null ? null : scope.copy();
5004        if (type != null) {
5005          dst.type = new ArrayList<CodeableConcept>();
5006          for (CodeableConcept i : type)
5007            dst.type.add(i.copy());
5008        };
5009        if (typeReference != null) {
5010          dst.typeReference = new ArrayList<Reference>();
5011          for (Reference i : typeReference)
5012            dst.typeReference.add(i.copy());
5013        };
5014        if (subtype != null) {
5015          dst.subtype = new ArrayList<CodeableConcept>();
5016          for (CodeableConcept i : subtype)
5017            dst.subtype.add(i.copy());
5018        };
5019        dst.relationship = relationship == null ? null : relationship.copy();
5020        if (context != null) {
5021          dst.context = new ArrayList<AssetContextComponent>();
5022          for (AssetContextComponent i : context)
5023            dst.context.add(i.copy());
5024        };
5025        dst.condition = condition == null ? null : condition.copy();
5026        if (periodType != null) {
5027          dst.periodType = new ArrayList<CodeableConcept>();
5028          for (CodeableConcept i : periodType)
5029            dst.periodType.add(i.copy());
5030        };
5031        if (period != null) {
5032          dst.period = new ArrayList<Period>();
5033          for (Period i : period)
5034            dst.period.add(i.copy());
5035        };
5036        if (usePeriod != null) {
5037          dst.usePeriod = new ArrayList<Period>();
5038          for (Period i : usePeriod)
5039            dst.usePeriod.add(i.copy());
5040        };
5041        dst.text = text == null ? null : text.copy();
5042        if (linkId != null) {
5043          dst.linkId = new ArrayList<StringType>();
5044          for (StringType i : linkId)
5045            dst.linkId.add(i.copy());
5046        };
5047        if (answer != null) {
5048          dst.answer = new ArrayList<AnswerComponent>();
5049          for (AnswerComponent i : answer)
5050            dst.answer.add(i.copy());
5051        };
5052        if (securityLabelNumber != null) {
5053          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
5054          for (UnsignedIntType i : securityLabelNumber)
5055            dst.securityLabelNumber.add(i.copy());
5056        };
5057        if (valuedItem != null) {
5058          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5059          for (ValuedItemComponent i : valuedItem)
5060            dst.valuedItem.add(i.copy());
5061        };
5062      }
5063
5064      @Override
5065      public boolean equalsDeep(Base other_) {
5066        if (!super.equalsDeep(other_))
5067          return false;
5068        if (!(other_ instanceof ContractAssetComponent))
5069          return false;
5070        ContractAssetComponent o = (ContractAssetComponent) other_;
5071        return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true) && compareDeep(typeReference, o.typeReference, true)
5072           && compareDeep(subtype, o.subtype, true) && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
5073           && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true) && compareDeep(period, o.period, true)
5074           && compareDeep(usePeriod, o.usePeriod, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
5075           && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
5076           && compareDeep(valuedItem, o.valuedItem, true);
5077      }
5078
5079      @Override
5080      public boolean equalsShallow(Base other_) {
5081        if (!super.equalsShallow(other_))
5082          return false;
5083        if (!(other_ instanceof ContractAssetComponent))
5084          return false;
5085        ContractAssetComponent o = (ContractAssetComponent) other_;
5086        return compareValues(condition, o.condition, true) && compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
5087           && compareValues(securityLabelNumber, o.securityLabelNumber, true);
5088      }
5089
5090      public boolean isEmpty() {
5091        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference
5092          , subtype, relationship, context, condition, periodType, period, usePeriod, text
5093          , linkId, answer, securityLabelNumber, valuedItem);
5094      }
5095
5096  public String fhirType() {
5097    return "Contract.term.asset";
5098
5099  }
5100
5101  }
5102
5103    @Block()
5104    public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
5105        /**
5106         * Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.
5107         */
5108        @Child(name = "reference", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5109        @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." )
5110        protected Reference reference;
5111
5112        /**
5113         * Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.
5114         */
5115        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5116        @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." )
5117        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetcontext")
5118        protected List<CodeableConcept> code;
5119
5120        /**
5121         * Context description.
5122         */
5123        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5124        @Description(shortDefinition="Context description", formalDefinition="Context description." )
5125        protected StringType text;
5126
5127        private static final long serialVersionUID = -388598648L;
5128
5129    /**
5130     * Constructor
5131     */
5132      public AssetContextComponent() {
5133        super();
5134      }
5135
5136        /**
5137         * @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.)
5138         */
5139        public Reference getReference() { 
5140          if (this.reference == null)
5141            if (Configuration.errorOnAutoCreate())
5142              throw new Error("Attempt to auto-create AssetContextComponent.reference");
5143            else if (Configuration.doAutoCreate())
5144              this.reference = new Reference(); // cc
5145          return this.reference;
5146        }
5147
5148        public boolean hasReference() { 
5149          return this.reference != null && !this.reference.isEmpty();
5150        }
5151
5152        /**
5153         * @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.)
5154         */
5155        public AssetContextComponent setReference(Reference value) { 
5156          this.reference = value;
5157          return this;
5158        }
5159
5160        /**
5161         * @return {@link #code} (Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.)
5162         */
5163        public List<CodeableConcept> getCode() { 
5164          if (this.code == null)
5165            this.code = new ArrayList<CodeableConcept>();
5166          return this.code;
5167        }
5168
5169        /**
5170         * @return Returns a reference to <code>this</code> for easy method chaining
5171         */
5172        public AssetContextComponent setCode(List<CodeableConcept> theCode) { 
5173          this.code = theCode;
5174          return this;
5175        }
5176
5177        public boolean hasCode() { 
5178          if (this.code == null)
5179            return false;
5180          for (CodeableConcept item : this.code)
5181            if (!item.isEmpty())
5182              return true;
5183          return false;
5184        }
5185
5186        public CodeableConcept addCode() { //3
5187          CodeableConcept t = new CodeableConcept();
5188          if (this.code == null)
5189            this.code = new ArrayList<CodeableConcept>();
5190          this.code.add(t);
5191          return t;
5192        }
5193
5194        public AssetContextComponent addCode(CodeableConcept t) { //3
5195          if (t == null)
5196            return this;
5197          if (this.code == null)
5198            this.code = new ArrayList<CodeableConcept>();
5199          this.code.add(t);
5200          return this;
5201        }
5202
5203        /**
5204         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
5205         */
5206        public CodeableConcept getCodeFirstRep() { 
5207          if (getCode().isEmpty()) {
5208            addCode();
5209          }
5210          return getCode().get(0);
5211        }
5212
5213        /**
5214         * @return {@link #text} (Context description.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
5215         */
5216        public StringType getTextElement() { 
5217          if (this.text == null)
5218            if (Configuration.errorOnAutoCreate())
5219              throw new Error("Attempt to auto-create AssetContextComponent.text");
5220            else if (Configuration.doAutoCreate())
5221              this.text = new StringType(); // bb
5222          return this.text;
5223        }
5224
5225        public boolean hasTextElement() { 
5226          return this.text != null && !this.text.isEmpty();
5227        }
5228
5229        public boolean hasText() { 
5230          return this.text != null && !this.text.isEmpty();
5231        }
5232
5233        /**
5234         * @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
5235         */
5236        public AssetContextComponent setTextElement(StringType value) { 
5237          this.text = value;
5238          return this;
5239        }
5240
5241        /**
5242         * @return Context description.
5243         */
5244        public String getText() { 
5245          return this.text == null ? null : this.text.getValue();
5246        }
5247
5248        /**
5249         * @param value Context description.
5250         */
5251        public AssetContextComponent setText(String value) { 
5252          if (Utilities.noString(value))
5253            this.text = null;
5254          else {
5255            if (this.text == null)
5256              this.text = new StringType();
5257            this.text.setValue(value);
5258          }
5259          return this;
5260        }
5261
5262        protected void listChildren(List<Property> children) {
5263          super.listChildren(children);
5264          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));
5265          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));
5266          children.add(new Property("text", "string", "Context description.", 0, 1, text));
5267        }
5268
5269        @Override
5270        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5271          switch (_hash) {
5272          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);
5273          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);
5274          case 3556653: /*text*/  return new Property("text", "string", "Context description.", 0, 1, text);
5275          default: return super.getNamedProperty(_hash, _name, _checkValid);
5276          }
5277
5278        }
5279
5280      @Override
5281      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5282        switch (hash) {
5283        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
5284        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
5285        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
5286        default: return super.getProperty(hash, name, checkValid);
5287        }
5288
5289      }
5290
5291      @Override
5292      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5293        switch (hash) {
5294        case -925155509: // reference
5295          this.reference = TypeConvertor.castToReference(value); // Reference
5296          return value;
5297        case 3059181: // code
5298          this.getCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5299          return value;
5300        case 3556653: // text
5301          this.text = TypeConvertor.castToString(value); // StringType
5302          return value;
5303        default: return super.setProperty(hash, name, value);
5304        }
5305
5306      }
5307
5308      @Override
5309      public Base setProperty(String name, Base value) throws FHIRException {
5310        if (name.equals("reference")) {
5311          this.reference = TypeConvertor.castToReference(value); // Reference
5312        } else if (name.equals("code")) {
5313          this.getCode().add(TypeConvertor.castToCodeableConcept(value));
5314        } else if (name.equals("text")) {
5315          this.text = TypeConvertor.castToString(value); // StringType
5316        } else
5317          return super.setProperty(name, value);
5318        return value;
5319      }
5320
5321      @Override
5322      public Base makeProperty(int hash, String name) throws FHIRException {
5323        switch (hash) {
5324        case -925155509:  return getReference();
5325        case 3059181:  return addCode(); 
5326        case 3556653:  return getTextElement();
5327        default: return super.makeProperty(hash, name);
5328        }
5329
5330      }
5331
5332      @Override
5333      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5334        switch (hash) {
5335        case -925155509: /*reference*/ return new String[] {"Reference"};
5336        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
5337        case 3556653: /*text*/ return new String[] {"string"};
5338        default: return super.getTypesForProperty(hash, name);
5339        }
5340
5341      }
5342
5343      @Override
5344      public Base addChild(String name) throws FHIRException {
5345        if (name.equals("reference")) {
5346          this.reference = new Reference();
5347          return this.reference;
5348        }
5349        else if (name.equals("code")) {
5350          return addCode();
5351        }
5352        else if (name.equals("text")) {
5353          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.context.text");
5354        }
5355        else
5356          return super.addChild(name);
5357      }
5358
5359      public AssetContextComponent copy() {
5360        AssetContextComponent dst = new AssetContextComponent();
5361        copyValues(dst);
5362        return dst;
5363      }
5364
5365      public void copyValues(AssetContextComponent dst) {
5366        super.copyValues(dst);
5367        dst.reference = reference == null ? null : reference.copy();
5368        if (code != null) {
5369          dst.code = new ArrayList<CodeableConcept>();
5370          for (CodeableConcept i : code)
5371            dst.code.add(i.copy());
5372        };
5373        dst.text = text == null ? null : text.copy();
5374      }
5375
5376      @Override
5377      public boolean equalsDeep(Base other_) {
5378        if (!super.equalsDeep(other_))
5379          return false;
5380        if (!(other_ instanceof AssetContextComponent))
5381          return false;
5382        AssetContextComponent o = (AssetContextComponent) other_;
5383        return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
5384          ;
5385      }
5386
5387      @Override
5388      public boolean equalsShallow(Base other_) {
5389        if (!super.equalsShallow(other_))
5390          return false;
5391        if (!(other_ instanceof AssetContextComponent))
5392          return false;
5393        AssetContextComponent o = (AssetContextComponent) other_;
5394        return compareValues(text, o.text, true);
5395      }
5396
5397      public boolean isEmpty() {
5398        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
5399      }
5400
5401  public String fhirType() {
5402    return "Contract.term.asset.context";
5403
5404  }
5405
5406  }
5407
5408    @Block()
5409    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
5410        /**
5411         * Specific type of Contract Valued Item that may be priced.
5412         */
5413        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5414        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
5415        protected DataType entity;
5416
5417        /**
5418         * Identifies a Contract Valued Item instance.
5419         */
5420        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
5421        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
5422        protected Identifier identifier;
5423
5424        /**
5425         * Indicates the time during which this Contract ValuedItem information is effective.
5426         */
5427        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5428        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
5429        protected DateTimeType effectiveTime;
5430
5431        /**
5432         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
5433         */
5434        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
5435        @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." )
5436        protected Quantity quantity;
5437
5438        /**
5439         * A Contract Valued Item unit valuation measure.
5440         */
5441        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
5442        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
5443        protected Money unitPrice;
5444
5445        /**
5446         * 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.
5447         */
5448        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5449        @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." )
5450        protected DecimalType factor;
5451
5452        /**
5453         * 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.
5454         */
5455        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5456        @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." )
5457        protected DecimalType points;
5458
5459        /**
5460         * 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.
5461         */
5462        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5463        @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." )
5464        protected Money net;
5465
5466        /**
5467         * Terms of valuation.
5468         */
5469        @Child(name = "payment", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5470        @Description(shortDefinition="Terms of valuation", formalDefinition="Terms of valuation." )
5471        protected StringType payment;
5472
5473        /**
5474         * When payment is due.
5475         */
5476        @Child(name = "paymentDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5477        @Description(shortDefinition="When payment is due", formalDefinition="When payment is due." )
5478        protected DateTimeType paymentDate;
5479
5480        /**
5481         * Who will make payment.
5482         */
5483        @Child(name = "responsible", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=false)
5484        @Description(shortDefinition="Who will make payment", formalDefinition="Who will make payment." )
5485        protected Reference responsible;
5486
5487        /**
5488         * Who will receive payment.
5489         */
5490        @Child(name = "recipient", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=12, min=0, max=1, modifier=false, summary=false)
5491        @Description(shortDefinition="Who will receive payment", formalDefinition="Who will receive payment." )
5492        protected Reference recipient;
5493
5494        /**
5495         * Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.
5496         */
5497        @Child(name = "linkId", type = {StringType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5498        @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." )
5499        protected List<StringType> linkId;
5500
5501        /**
5502         * A set of security labels that define which terms are controlled by this condition.
5503         */
5504        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5505        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
5506        protected List<UnsignedIntType> securityLabelNumber;
5507
5508        private static final long serialVersionUID = 915998998L;
5509
5510    /**
5511     * Constructor
5512     */
5513      public ValuedItemComponent() {
5514        super();
5515      }
5516
5517        /**
5518         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5519         */
5520        public DataType getEntity() { 
5521          return this.entity;
5522        }
5523
5524        /**
5525         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5526         */
5527        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
5528          if (this.entity == null)
5529            this.entity = new CodeableConcept();
5530          if (!(this.entity instanceof CodeableConcept))
5531            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
5532          return (CodeableConcept) this.entity;
5533        }
5534
5535        public boolean hasEntityCodeableConcept() { 
5536          return this != null && this.entity instanceof CodeableConcept;
5537        }
5538
5539        /**
5540         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5541         */
5542        public Reference getEntityReference() throws FHIRException { 
5543          if (this.entity == null)
5544            this.entity = new Reference();
5545          if (!(this.entity instanceof Reference))
5546            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
5547          return (Reference) this.entity;
5548        }
5549
5550        public boolean hasEntityReference() { 
5551          return this != null && this.entity instanceof Reference;
5552        }
5553
5554        public boolean hasEntity() { 
5555          return this.entity != null && !this.entity.isEmpty();
5556        }
5557
5558        /**
5559         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5560         */
5561        public ValuedItemComponent setEntity(DataType value) { 
5562          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
5563            throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: "+value.fhirType());
5564          this.entity = value;
5565          return this;
5566        }
5567
5568        /**
5569         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
5570         */
5571        public Identifier getIdentifier() { 
5572          if (this.identifier == null)
5573            if (Configuration.errorOnAutoCreate())
5574              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
5575            else if (Configuration.doAutoCreate())
5576              this.identifier = new Identifier(); // cc
5577          return this.identifier;
5578        }
5579
5580        public boolean hasIdentifier() { 
5581          return this.identifier != null && !this.identifier.isEmpty();
5582        }
5583
5584        /**
5585         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
5586         */
5587        public ValuedItemComponent setIdentifier(Identifier value) { 
5588          this.identifier = value;
5589          return this;
5590        }
5591
5592        /**
5593         * @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
5594         */
5595        public DateTimeType getEffectiveTimeElement() { 
5596          if (this.effectiveTime == null)
5597            if (Configuration.errorOnAutoCreate())
5598              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
5599            else if (Configuration.doAutoCreate())
5600              this.effectiveTime = new DateTimeType(); // bb
5601          return this.effectiveTime;
5602        }
5603
5604        public boolean hasEffectiveTimeElement() { 
5605          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5606        }
5607
5608        public boolean hasEffectiveTime() { 
5609          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5610        }
5611
5612        /**
5613         * @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
5614         */
5615        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
5616          this.effectiveTime = value;
5617          return this;
5618        }
5619
5620        /**
5621         * @return Indicates the time during which this Contract ValuedItem information is effective.
5622         */
5623        public Date getEffectiveTime() { 
5624          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
5625        }
5626
5627        /**
5628         * @param value Indicates the time during which this Contract ValuedItem information is effective.
5629         */
5630        public ValuedItemComponent setEffectiveTime(Date value) { 
5631          if (value == null)
5632            this.effectiveTime = null;
5633          else {
5634            if (this.effectiveTime == null)
5635              this.effectiveTime = new DateTimeType();
5636            this.effectiveTime.setValue(value);
5637          }
5638          return this;
5639        }
5640
5641        /**
5642         * @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.)
5643         */
5644        public Quantity getQuantity() { 
5645          if (this.quantity == null)
5646            if (Configuration.errorOnAutoCreate())
5647              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
5648            else if (Configuration.doAutoCreate())
5649              this.quantity = new Quantity(); // cc
5650          return this.quantity;
5651        }
5652
5653        public boolean hasQuantity() { 
5654          return this.quantity != null && !this.quantity.isEmpty();
5655        }
5656
5657        /**
5658         * @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.)
5659         */
5660        public ValuedItemComponent setQuantity(Quantity value) { 
5661          this.quantity = value;
5662          return this;
5663        }
5664
5665        /**
5666         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5667         */
5668        public Money getUnitPrice() { 
5669          if (this.unitPrice == null)
5670            if (Configuration.errorOnAutoCreate())
5671              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
5672            else if (Configuration.doAutoCreate())
5673              this.unitPrice = new Money(); // cc
5674          return this.unitPrice;
5675        }
5676
5677        public boolean hasUnitPrice() { 
5678          return this.unitPrice != null && !this.unitPrice.isEmpty();
5679        }
5680
5681        /**
5682         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5683         */
5684        public ValuedItemComponent setUnitPrice(Money value) { 
5685          this.unitPrice = value;
5686          return this;
5687        }
5688
5689        /**
5690         * @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
5691         */
5692        public DecimalType getFactorElement() { 
5693          if (this.factor == null)
5694            if (Configuration.errorOnAutoCreate())
5695              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
5696            else if (Configuration.doAutoCreate())
5697              this.factor = new DecimalType(); // bb
5698          return this.factor;
5699        }
5700
5701        public boolean hasFactorElement() { 
5702          return this.factor != null && !this.factor.isEmpty();
5703        }
5704
5705        public boolean hasFactor() { 
5706          return this.factor != null && !this.factor.isEmpty();
5707        }
5708
5709        /**
5710         * @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
5711         */
5712        public ValuedItemComponent setFactorElement(DecimalType value) { 
5713          this.factor = value;
5714          return this;
5715        }
5716
5717        /**
5718         * @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.
5719         */
5720        public BigDecimal getFactor() { 
5721          return this.factor == null ? null : this.factor.getValue();
5722        }
5723
5724        /**
5725         * @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.
5726         */
5727        public ValuedItemComponent setFactor(BigDecimal value) { 
5728          if (value == null)
5729            this.factor = null;
5730          else {
5731            if (this.factor == null)
5732              this.factor = new DecimalType();
5733            this.factor.setValue(value);
5734          }
5735          return this;
5736        }
5737
5738        /**
5739         * @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.
5740         */
5741        public ValuedItemComponent setFactor(long value) { 
5742              this.factor = new DecimalType();
5743            this.factor.setValue(value);
5744          return this;
5745        }
5746
5747        /**
5748         * @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.
5749         */
5750        public ValuedItemComponent setFactor(double value) { 
5751              this.factor = new DecimalType();
5752            this.factor.setValue(value);
5753          return this;
5754        }
5755
5756        /**
5757         * @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
5758         */
5759        public DecimalType getPointsElement() { 
5760          if (this.points == null)
5761            if (Configuration.errorOnAutoCreate())
5762              throw new Error("Attempt to auto-create ValuedItemComponent.points");
5763            else if (Configuration.doAutoCreate())
5764              this.points = new DecimalType(); // bb
5765          return this.points;
5766        }
5767
5768        public boolean hasPointsElement() { 
5769          return this.points != null && !this.points.isEmpty();
5770        }
5771
5772        public boolean hasPoints() { 
5773          return this.points != null && !this.points.isEmpty();
5774        }
5775
5776        /**
5777         * @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
5778         */
5779        public ValuedItemComponent setPointsElement(DecimalType value) { 
5780          this.points = value;
5781          return this;
5782        }
5783
5784        /**
5785         * @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.
5786         */
5787        public BigDecimal getPoints() { 
5788          return this.points == null ? null : this.points.getValue();
5789        }
5790
5791        /**
5792         * @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.
5793         */
5794        public ValuedItemComponent setPoints(BigDecimal value) { 
5795          if (value == null)
5796            this.points = null;
5797          else {
5798            if (this.points == null)
5799              this.points = new DecimalType();
5800            this.points.setValue(value);
5801          }
5802          return this;
5803        }
5804
5805        /**
5806         * @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.
5807         */
5808        public ValuedItemComponent setPoints(long value) { 
5809              this.points = new DecimalType();
5810            this.points.setValue(value);
5811          return this;
5812        }
5813
5814        /**
5815         * @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.
5816         */
5817        public ValuedItemComponent setPoints(double value) { 
5818              this.points = new DecimalType();
5819            this.points.setValue(value);
5820          return this;
5821        }
5822
5823        /**
5824         * @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.)
5825         */
5826        public Money getNet() { 
5827          if (this.net == null)
5828            if (Configuration.errorOnAutoCreate())
5829              throw new Error("Attempt to auto-create ValuedItemComponent.net");
5830            else if (Configuration.doAutoCreate())
5831              this.net = new Money(); // cc
5832          return this.net;
5833        }
5834
5835        public boolean hasNet() { 
5836          return this.net != null && !this.net.isEmpty();
5837        }
5838
5839        /**
5840         * @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.)
5841         */
5842        public ValuedItemComponent setNet(Money value) { 
5843          this.net = value;
5844          return this;
5845        }
5846
5847        /**
5848         * @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
5849         */
5850        public StringType getPaymentElement() { 
5851          if (this.payment == null)
5852            if (Configuration.errorOnAutoCreate())
5853              throw new Error("Attempt to auto-create ValuedItemComponent.payment");
5854            else if (Configuration.doAutoCreate())
5855              this.payment = new StringType(); // bb
5856          return this.payment;
5857        }
5858
5859        public boolean hasPaymentElement() { 
5860          return this.payment != null && !this.payment.isEmpty();
5861        }
5862
5863        public boolean hasPayment() { 
5864          return this.payment != null && !this.payment.isEmpty();
5865        }
5866
5867        /**
5868         * @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
5869         */
5870        public ValuedItemComponent setPaymentElement(StringType value) { 
5871          this.payment = value;
5872          return this;
5873        }
5874
5875        /**
5876         * @return Terms of valuation.
5877         */
5878        public String getPayment() { 
5879          return this.payment == null ? null : this.payment.getValue();
5880        }
5881
5882        /**
5883         * @param value Terms of valuation.
5884         */
5885        public ValuedItemComponent setPayment(String value) { 
5886          if (Utilities.noString(value))
5887            this.payment = null;
5888          else {
5889            if (this.payment == null)
5890              this.payment = new StringType();
5891            this.payment.setValue(value);
5892          }
5893          return this;
5894        }
5895
5896        /**
5897         * @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
5898         */
5899        public DateTimeType getPaymentDateElement() { 
5900          if (this.paymentDate == null)
5901            if (Configuration.errorOnAutoCreate())
5902              throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
5903            else if (Configuration.doAutoCreate())
5904              this.paymentDate = new DateTimeType(); // bb
5905          return this.paymentDate;
5906        }
5907
5908        public boolean hasPaymentDateElement() { 
5909          return this.paymentDate != null && !this.paymentDate.isEmpty();
5910        }
5911
5912        public boolean hasPaymentDate() { 
5913          return this.paymentDate != null && !this.paymentDate.isEmpty();
5914        }
5915
5916        /**
5917         * @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
5918         */
5919        public ValuedItemComponent setPaymentDateElement(DateTimeType value) { 
5920          this.paymentDate = value;
5921          return this;
5922        }
5923
5924        /**
5925         * @return When payment is due.
5926         */
5927        public Date getPaymentDate() { 
5928          return this.paymentDate == null ? null : this.paymentDate.getValue();
5929        }
5930
5931        /**
5932         * @param value When payment is due.
5933         */
5934        public ValuedItemComponent setPaymentDate(Date value) { 
5935          if (value == null)
5936            this.paymentDate = null;
5937          else {
5938            if (this.paymentDate == null)
5939              this.paymentDate = new DateTimeType();
5940            this.paymentDate.setValue(value);
5941          }
5942          return this;
5943        }
5944
5945        /**
5946         * @return {@link #responsible} (Who will make payment.)
5947         */
5948        public Reference getResponsible() { 
5949          if (this.responsible == null)
5950            if (Configuration.errorOnAutoCreate())
5951              throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
5952            else if (Configuration.doAutoCreate())
5953              this.responsible = new Reference(); // cc
5954          return this.responsible;
5955        }
5956
5957        public boolean hasResponsible() { 
5958          return this.responsible != null && !this.responsible.isEmpty();
5959        }
5960
5961        /**
5962         * @param value {@link #responsible} (Who will make payment.)
5963         */
5964        public ValuedItemComponent setResponsible(Reference value) { 
5965          this.responsible = value;
5966          return this;
5967        }
5968
5969        /**
5970         * @return {@link #recipient} (Who will receive payment.)
5971         */
5972        public Reference getRecipient() { 
5973          if (this.recipient == null)
5974            if (Configuration.errorOnAutoCreate())
5975              throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
5976            else if (Configuration.doAutoCreate())
5977              this.recipient = new Reference(); // cc
5978          return this.recipient;
5979        }
5980
5981        public boolean hasRecipient() { 
5982          return this.recipient != null && !this.recipient.isEmpty();
5983        }
5984
5985        /**
5986         * @param value {@link #recipient} (Who will receive payment.)
5987         */
5988        public ValuedItemComponent setRecipient(Reference value) { 
5989          this.recipient = value;
5990          return this;
5991        }
5992
5993        /**
5994         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
5995         */
5996        public List<StringType> getLinkId() { 
5997          if (this.linkId == null)
5998            this.linkId = new ArrayList<StringType>();
5999          return this.linkId;
6000        }
6001
6002        /**
6003         * @return Returns a reference to <code>this</code> for easy method chaining
6004         */
6005        public ValuedItemComponent setLinkId(List<StringType> theLinkId) { 
6006          this.linkId = theLinkId;
6007          return this;
6008        }
6009
6010        public boolean hasLinkId() { 
6011          if (this.linkId == null)
6012            return false;
6013          for (StringType item : this.linkId)
6014            if (!item.isEmpty())
6015              return true;
6016          return false;
6017        }
6018
6019        /**
6020         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6021         */
6022        public StringType addLinkIdElement() {//2 
6023          StringType t = new StringType();
6024          if (this.linkId == null)
6025            this.linkId = new ArrayList<StringType>();
6026          this.linkId.add(t);
6027          return t;
6028        }
6029
6030        /**
6031         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6032         */
6033        public ValuedItemComponent addLinkId(String value) { //1
6034          StringType t = new StringType();
6035          t.setValue(value);
6036          if (this.linkId == null)
6037            this.linkId = new ArrayList<StringType>();
6038          this.linkId.add(t);
6039          return this;
6040        }
6041
6042        /**
6043         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6044         */
6045        public boolean hasLinkId(String value) { 
6046          if (this.linkId == null)
6047            return false;
6048          for (StringType v : this.linkId)
6049            if (v.getValue().equals(value)) // string
6050              return true;
6051          return false;
6052        }
6053
6054        /**
6055         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6056         */
6057        public List<UnsignedIntType> getSecurityLabelNumber() { 
6058          if (this.securityLabelNumber == null)
6059            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6060          return this.securityLabelNumber;
6061        }
6062
6063        /**
6064         * @return Returns a reference to <code>this</code> for easy method chaining
6065         */
6066        public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
6067          this.securityLabelNumber = theSecurityLabelNumber;
6068          return this;
6069        }
6070
6071        public boolean hasSecurityLabelNumber() { 
6072          if (this.securityLabelNumber == null)
6073            return false;
6074          for (UnsignedIntType item : this.securityLabelNumber)
6075            if (!item.isEmpty())
6076              return true;
6077          return false;
6078        }
6079
6080        /**
6081         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6082         */
6083        public UnsignedIntType addSecurityLabelNumberElement() {//2 
6084          UnsignedIntType t = new UnsignedIntType();
6085          if (this.securityLabelNumber == null)
6086            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6087          this.securityLabelNumber.add(t);
6088          return t;
6089        }
6090
6091        /**
6092         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6093         */
6094        public ValuedItemComponent addSecurityLabelNumber(int value) { //1
6095          UnsignedIntType t = new UnsignedIntType();
6096          t.setValue(value);
6097          if (this.securityLabelNumber == null)
6098            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6099          this.securityLabelNumber.add(t);
6100          return this;
6101        }
6102
6103        /**
6104         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6105         */
6106        public boolean hasSecurityLabelNumber(int value) { 
6107          if (this.securityLabelNumber == null)
6108            return false;
6109          for (UnsignedIntType v : this.securityLabelNumber)
6110            if (v.getValue().equals(value)) // unsignedInt
6111              return true;
6112          return false;
6113        }
6114
6115        protected void listChildren(List<Property> children) {
6116          super.listChildren(children);
6117          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
6118          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
6119          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
6120          children.add(new Property("quantity", "Quantity", "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));
6121          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
6122          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));
6123          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));
6124          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));
6125          children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
6126          children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
6127          children.add(new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible));
6128          children.add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient));
6129          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));
6130          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));
6131        }
6132
6133        @Override
6134        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6135          switch (_hash) {
6136          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);
6137          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6138          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6139          case -356635992: /*entityReference*/  return new Property("entity[x]", "Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6140          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
6141          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
6142          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "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);
6143          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
6144          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);
6145          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);
6146          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);
6147          case -786681338: /*payment*/  return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
6148          case -1540873516: /*paymentDate*/  return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
6149          case 1847674614: /*responsible*/  return new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible);
6150          case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient);
6151          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);
6152          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);
6153          default: return super.getNamedProperty(_hash, _name, _checkValid);
6154          }
6155
6156        }
6157
6158      @Override
6159      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6160        switch (hash) {
6161        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // DataType
6162        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
6163        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
6164        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6165        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6166        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6167        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
6168        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6169        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // StringType
6170        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateTimeType
6171        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // Reference
6172        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
6173        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
6174        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
6175        default: return super.getProperty(hash, name, checkValid);
6176        }
6177
6178      }
6179
6180      @Override
6181      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6182        switch (hash) {
6183        case -1298275357: // entity
6184          this.entity = TypeConvertor.castToType(value); // DataType
6185          return value;
6186        case -1618432855: // identifier
6187          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
6188          return value;
6189        case -929905388: // effectiveTime
6190          this.effectiveTime = TypeConvertor.castToDateTime(value); // DateTimeType
6191          return value;
6192        case -1285004149: // quantity
6193          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6194          return value;
6195        case -486196699: // unitPrice
6196          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6197          return value;
6198        case -1282148017: // factor
6199          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6200          return value;
6201        case -982754077: // points
6202          this.points = TypeConvertor.castToDecimal(value); // DecimalType
6203          return value;
6204        case 108957: // net
6205          this.net = TypeConvertor.castToMoney(value); // Money
6206          return value;
6207        case -786681338: // payment
6208          this.payment = TypeConvertor.castToString(value); // StringType
6209          return value;
6210        case -1540873516: // paymentDate
6211          this.paymentDate = TypeConvertor.castToDateTime(value); // DateTimeType
6212          return value;
6213        case 1847674614: // responsible
6214          this.responsible = TypeConvertor.castToReference(value); // Reference
6215          return value;
6216        case 820081177: // recipient
6217          this.recipient = TypeConvertor.castToReference(value); // Reference
6218          return value;
6219        case -1102667083: // linkId
6220          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
6221          return value;
6222        case -149460995: // securityLabelNumber
6223          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
6224          return value;
6225        default: return super.setProperty(hash, name, value);
6226        }
6227
6228      }
6229
6230      @Override
6231      public Base setProperty(String name, Base value) throws FHIRException {
6232        if (name.equals("entity[x]")) {
6233          this.entity = TypeConvertor.castToType(value); // DataType
6234        } else if (name.equals("identifier")) {
6235          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
6236        } else if (name.equals("effectiveTime")) {
6237          this.effectiveTime = TypeConvertor.castToDateTime(value); // DateTimeType
6238        } else if (name.equals("quantity")) {
6239          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6240        } else if (name.equals("unitPrice")) {
6241          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6242        } else if (name.equals("factor")) {
6243          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6244        } else if (name.equals("points")) {
6245          this.points = TypeConvertor.castToDecimal(value); // DecimalType
6246        } else if (name.equals("net")) {
6247          this.net = TypeConvertor.castToMoney(value); // Money
6248        } else if (name.equals("payment")) {
6249          this.payment = TypeConvertor.castToString(value); // StringType
6250        } else if (name.equals("paymentDate")) {
6251          this.paymentDate = TypeConvertor.castToDateTime(value); // DateTimeType
6252        } else if (name.equals("responsible")) {
6253          this.responsible = TypeConvertor.castToReference(value); // Reference
6254        } else if (name.equals("recipient")) {
6255          this.recipient = TypeConvertor.castToReference(value); // Reference
6256        } else if (name.equals("linkId")) {
6257          this.getLinkId().add(TypeConvertor.castToString(value));
6258        } else if (name.equals("securityLabelNumber")) {
6259          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
6260        } else
6261          return super.setProperty(name, value);
6262        return value;
6263      }
6264
6265      @Override
6266      public Base makeProperty(int hash, String name) throws FHIRException {
6267        switch (hash) {
6268        case -740568643:  return getEntity();
6269        case -1298275357:  return getEntity();
6270        case -1618432855:  return getIdentifier();
6271        case -929905388:  return getEffectiveTimeElement();
6272        case -1285004149:  return getQuantity();
6273        case -486196699:  return getUnitPrice();
6274        case -1282148017:  return getFactorElement();
6275        case -982754077:  return getPointsElement();
6276        case 108957:  return getNet();
6277        case -786681338:  return getPaymentElement();
6278        case -1540873516:  return getPaymentDateElement();
6279        case 1847674614:  return getResponsible();
6280        case 820081177:  return getRecipient();
6281        case -1102667083:  return addLinkIdElement();
6282        case -149460995:  return addSecurityLabelNumberElement();
6283        default: return super.makeProperty(hash, name);
6284        }
6285
6286      }
6287
6288      @Override
6289      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6290        switch (hash) {
6291        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
6292        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6293        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
6294        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6295        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6296        case -1282148017: /*factor*/ return new String[] {"decimal"};
6297        case -982754077: /*points*/ return new String[] {"decimal"};
6298        case 108957: /*net*/ return new String[] {"Money"};
6299        case -786681338: /*payment*/ return new String[] {"string"};
6300        case -1540873516: /*paymentDate*/ return new String[] {"dateTime"};
6301        case 1847674614: /*responsible*/ return new String[] {"Reference"};
6302        case 820081177: /*recipient*/ return new String[] {"Reference"};
6303        case -1102667083: /*linkId*/ return new String[] {"string"};
6304        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
6305        default: return super.getTypesForProperty(hash, name);
6306        }
6307
6308      }
6309
6310      @Override
6311      public Base addChild(String name) throws FHIRException {
6312        if (name.equals("entityCodeableConcept")) {
6313          this.entity = new CodeableConcept();
6314          return this.entity;
6315        }
6316        else if (name.equals("entityReference")) {
6317          this.entity = new Reference();
6318          return this.entity;
6319        }
6320        else if (name.equals("identifier")) {
6321          this.identifier = new Identifier();
6322          return this.identifier;
6323        }
6324        else if (name.equals("effectiveTime")) {
6325          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.effectiveTime");
6326        }
6327        else if (name.equals("quantity")) {
6328          this.quantity = new Quantity();
6329          return this.quantity;
6330        }
6331        else if (name.equals("unitPrice")) {
6332          this.unitPrice = new Money();
6333          return this.unitPrice;
6334        }
6335        else if (name.equals("factor")) {
6336          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.factor");
6337        }
6338        else if (name.equals("points")) {
6339          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.points");
6340        }
6341        else if (name.equals("net")) {
6342          this.net = new Money();
6343          return this.net;
6344        }
6345        else if (name.equals("payment")) {
6346          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.payment");
6347        }
6348        else if (name.equals("paymentDate")) {
6349          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.paymentDate");
6350        }
6351        else if (name.equals("responsible")) {
6352          this.responsible = new Reference();
6353          return this.responsible;
6354        }
6355        else if (name.equals("recipient")) {
6356          this.recipient = new Reference();
6357          return this.recipient;
6358        }
6359        else if (name.equals("linkId")) {
6360          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.linkId");
6361        }
6362        else if (name.equals("securityLabelNumber")) {
6363          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.securityLabelNumber");
6364        }
6365        else
6366          return super.addChild(name);
6367      }
6368
6369      public ValuedItemComponent copy() {
6370        ValuedItemComponent dst = new ValuedItemComponent();
6371        copyValues(dst);
6372        return dst;
6373      }
6374
6375      public void copyValues(ValuedItemComponent dst) {
6376        super.copyValues(dst);
6377        dst.entity = entity == null ? null : entity.copy();
6378        dst.identifier = identifier == null ? null : identifier.copy();
6379        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
6380        dst.quantity = quantity == null ? null : quantity.copy();
6381        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6382        dst.factor = factor == null ? null : factor.copy();
6383        dst.points = points == null ? null : points.copy();
6384        dst.net = net == null ? null : net.copy();
6385        dst.payment = payment == null ? null : payment.copy();
6386        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
6387        dst.responsible = responsible == null ? null : responsible.copy();
6388        dst.recipient = recipient == null ? null : recipient.copy();
6389        if (linkId != null) {
6390          dst.linkId = new ArrayList<StringType>();
6391          for (StringType i : linkId)
6392            dst.linkId.add(i.copy());
6393        };
6394        if (securityLabelNumber != null) {
6395          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6396          for (UnsignedIntType i : securityLabelNumber)
6397            dst.securityLabelNumber.add(i.copy());
6398        };
6399      }
6400
6401      @Override
6402      public boolean equalsDeep(Base other_) {
6403        if (!super.equalsDeep(other_))
6404          return false;
6405        if (!(other_ instanceof ValuedItemComponent))
6406          return false;
6407        ValuedItemComponent o = (ValuedItemComponent) other_;
6408        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
6409           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6410           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(payment, o.payment, true)
6411           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(responsible, o.responsible, true)
6412           && compareDeep(recipient, o.recipient, true) && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6413          ;
6414      }
6415
6416      @Override
6417      public boolean equalsShallow(Base other_) {
6418        if (!super.equalsShallow(other_))
6419          return false;
6420        if (!(other_ instanceof ValuedItemComponent))
6421          return false;
6422        ValuedItemComponent o = (ValuedItemComponent) other_;
6423        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
6424           && compareValues(points, o.points, true) && compareValues(payment, o.payment, true) && compareValues(paymentDate, o.paymentDate, true)
6425           && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
6426          ;
6427      }
6428
6429      public boolean isEmpty() {
6430        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
6431          , quantity, unitPrice, factor, points, net, payment, paymentDate, responsible
6432          , recipient, linkId, securityLabelNumber);
6433      }
6434
6435  public String fhirType() {
6436    return "Contract.term.asset.valuedItem";
6437
6438  }
6439
6440  }
6441
6442    @Block()
6443    public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
6444        /**
6445         * True if the term prohibits the  action.
6446         */
6447        @Child(name = "doNotPerform", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=false)
6448        @Description(shortDefinition="True if the term prohibits the  action", formalDefinition="True if the term prohibits the  action." )
6449        protected BooleanType doNotPerform;
6450
6451        /**
6452         * Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.
6453         */
6454        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6455        @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." )
6456        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
6457        protected CodeableConcept type;
6458
6459        /**
6460         * Entity of the action.
6461         */
6462        @Child(name = "subject", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6463        @Description(shortDefinition="Entity of the action", formalDefinition="Entity of the action." )
6464        protected List<ActionSubjectComponent> subject;
6465
6466        /**
6467         * Reason or purpose for the action stipulated by this Contract Provision.
6468         */
6469        @Child(name = "intent", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6470        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
6471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6472        protected CodeableConcept intent;
6473
6474        /**
6475         * Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.
6476         */
6477        @Child(name = "linkId", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6478        @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." )
6479        protected List<StringType> linkId;
6480
6481        /**
6482         * Current state of the term action.
6483         */
6484        @Child(name = "status", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=false, summary=false)
6485        @Description(shortDefinition="State of the action", formalDefinition="Current state of the term action." )
6486        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actionstatus")
6487        protected CodeableConcept status;
6488
6489        /**
6490         * Encounter or Episode with primary association to specified term activity.
6491         */
6492        @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=false)
6493        @Description(shortDefinition="Episode associated with action", formalDefinition="Encounter or Episode with primary association to specified term activity." )
6494        protected Reference context;
6495
6496        /**
6497         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6498         */
6499        @Child(name = "contextLinkId", type = {StringType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6500        @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." )
6501        protected List<StringType> contextLinkId;
6502
6503        /**
6504         * When action happens.
6505         */
6506        @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=9, min=0, max=1, modifier=false, summary=false)
6507        @Description(shortDefinition="When action happens", formalDefinition="When action happens." )
6508        protected DataType occurrence;
6509
6510        /**
6511         * Who or what initiated the action and has responsibility for its activation.
6512         */
6513        @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)
6514        @Description(shortDefinition="Who asked for action", formalDefinition="Who or what initiated the action and has responsibility for its activation." )
6515        protected List<Reference> requester;
6516
6517        /**
6518         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6519         */
6520        @Child(name = "requesterLinkId", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6521        @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." )
6522        protected List<StringType> requesterLinkId;
6523
6524        /**
6525         * The type of individual that is desired or required to perform or not perform the action.
6526         */
6527        @Child(name = "performerType", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6528        @Description(shortDefinition="Kind of service performer", formalDefinition="The type of individual that is desired or required to perform or not perform the action." )
6529        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participation-role-type")
6530        protected List<CodeableConcept> performerType;
6531
6532        /**
6533         * The type of role or competency of an individual desired or required to perform or not perform the action.
6534         */
6535        @Child(name = "performerRole", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
6536        @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." )
6537        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-role-type")
6538        protected CodeableConcept performerRole;
6539
6540        /**
6541         * Indicates who or what is being asked to perform (or not perform) the ction.
6542         */
6543        @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)
6544        @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." )
6545        protected Reference performer;
6546
6547        /**
6548         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6549         */
6550        @Child(name = "performerLinkId", type = {StringType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6551        @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." )
6552        protected List<StringType> performerLinkId;
6553
6554        /**
6555         * Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited. Either a coded concept, or another resource whose existence justifies permitting or not permitting this action.
6556         */
6557        @Child(name = "reason", type = {CodeableReference.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6558        @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. Either a coded concept, or another resource whose existence justifies permitting or not permitting this action." )
6559        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6560        protected List<CodeableReference> reason;
6561
6562        /**
6563         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6564         */
6565        @Child(name = "reasonLinkId", type = {StringType.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6566        @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." )
6567        protected List<StringType> reasonLinkId;
6568
6569        /**
6570         * Comments made about the term action made by the requester, performer, subject or other participants.
6571         */
6572        @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6573        @Description(shortDefinition="Comments about the action", formalDefinition="Comments made about the term action made by the requester, performer, subject or other participants." )
6574        protected List<Annotation> note;
6575
6576        /**
6577         * Security labels that protects the action.
6578         */
6579        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6580        @Description(shortDefinition="Action restriction numbers", formalDefinition="Security labels that protects the action." )
6581        protected List<UnsignedIntType> securityLabelNumber;
6582
6583        private static final long serialVersionUID = 337159017L;
6584
6585    /**
6586     * Constructor
6587     */
6588      public ActionComponent() {
6589        super();
6590      }
6591
6592    /**
6593     * Constructor
6594     */
6595      public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
6596        super();
6597        this.setType(type);
6598        this.setIntent(intent);
6599        this.setStatus(status);
6600      }
6601
6602        /**
6603         * @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
6604         */
6605        public BooleanType getDoNotPerformElement() { 
6606          if (this.doNotPerform == null)
6607            if (Configuration.errorOnAutoCreate())
6608              throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
6609            else if (Configuration.doAutoCreate())
6610              this.doNotPerform = new BooleanType(); // bb
6611          return this.doNotPerform;
6612        }
6613
6614        public boolean hasDoNotPerformElement() { 
6615          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6616        }
6617
6618        public boolean hasDoNotPerform() { 
6619          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6620        }
6621
6622        /**
6623         * @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
6624         */
6625        public ActionComponent setDoNotPerformElement(BooleanType value) { 
6626          this.doNotPerform = value;
6627          return this;
6628        }
6629
6630        /**
6631         * @return True if the term prohibits the  action.
6632         */
6633        public boolean getDoNotPerform() { 
6634          return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
6635        }
6636
6637        /**
6638         * @param value True if the term prohibits the  action.
6639         */
6640        public ActionComponent setDoNotPerform(boolean value) { 
6641            if (this.doNotPerform == null)
6642              this.doNotPerform = new BooleanType();
6643            this.doNotPerform.setValue(value);
6644          return this;
6645        }
6646
6647        /**
6648         * @return {@link #type} (Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.)
6649         */
6650        public CodeableConcept getType() { 
6651          if (this.type == null)
6652            if (Configuration.errorOnAutoCreate())
6653              throw new Error("Attempt to auto-create ActionComponent.type");
6654            else if (Configuration.doAutoCreate())
6655              this.type = new CodeableConcept(); // cc
6656          return this.type;
6657        }
6658
6659        public boolean hasType() { 
6660          return this.type != null && !this.type.isEmpty();
6661        }
6662
6663        /**
6664         * @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.)
6665         */
6666        public ActionComponent setType(CodeableConcept value) { 
6667          this.type = value;
6668          return this;
6669        }
6670
6671        /**
6672         * @return {@link #subject} (Entity of the action.)
6673         */
6674        public List<ActionSubjectComponent> getSubject() { 
6675          if (this.subject == null)
6676            this.subject = new ArrayList<ActionSubjectComponent>();
6677          return this.subject;
6678        }
6679
6680        /**
6681         * @return Returns a reference to <code>this</code> for easy method chaining
6682         */
6683        public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) { 
6684          this.subject = theSubject;
6685          return this;
6686        }
6687
6688        public boolean hasSubject() { 
6689          if (this.subject == null)
6690            return false;
6691          for (ActionSubjectComponent item : this.subject)
6692            if (!item.isEmpty())
6693              return true;
6694          return false;
6695        }
6696
6697        public ActionSubjectComponent addSubject() { //3
6698          ActionSubjectComponent t = new ActionSubjectComponent();
6699          if (this.subject == null)
6700            this.subject = new ArrayList<ActionSubjectComponent>();
6701          this.subject.add(t);
6702          return t;
6703        }
6704
6705        public ActionComponent addSubject(ActionSubjectComponent t) { //3
6706          if (t == null)
6707            return this;
6708          if (this.subject == null)
6709            this.subject = new ArrayList<ActionSubjectComponent>();
6710          this.subject.add(t);
6711          return this;
6712        }
6713
6714        /**
6715         * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
6716         */
6717        public ActionSubjectComponent getSubjectFirstRep() { 
6718          if (getSubject().isEmpty()) {
6719            addSubject();
6720          }
6721          return getSubject().get(0);
6722        }
6723
6724        /**
6725         * @return {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6726         */
6727        public CodeableConcept getIntent() { 
6728          if (this.intent == null)
6729            if (Configuration.errorOnAutoCreate())
6730              throw new Error("Attempt to auto-create ActionComponent.intent");
6731            else if (Configuration.doAutoCreate())
6732              this.intent = new CodeableConcept(); // cc
6733          return this.intent;
6734        }
6735
6736        public boolean hasIntent() { 
6737          return this.intent != null && !this.intent.isEmpty();
6738        }
6739
6740        /**
6741         * @param value {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6742         */
6743        public ActionComponent setIntent(CodeableConcept value) { 
6744          this.intent = value;
6745          return this;
6746        }
6747
6748        /**
6749         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6750         */
6751        public List<StringType> getLinkId() { 
6752          if (this.linkId == null)
6753            this.linkId = new ArrayList<StringType>();
6754          return this.linkId;
6755        }
6756
6757        /**
6758         * @return Returns a reference to <code>this</code> for easy method chaining
6759         */
6760        public ActionComponent setLinkId(List<StringType> theLinkId) { 
6761          this.linkId = theLinkId;
6762          return this;
6763        }
6764
6765        public boolean hasLinkId() { 
6766          if (this.linkId == null)
6767            return false;
6768          for (StringType item : this.linkId)
6769            if (!item.isEmpty())
6770              return true;
6771          return false;
6772        }
6773
6774        /**
6775         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6776         */
6777        public StringType addLinkIdElement() {//2 
6778          StringType t = new StringType();
6779          if (this.linkId == null)
6780            this.linkId = new ArrayList<StringType>();
6781          this.linkId.add(t);
6782          return t;
6783        }
6784
6785        /**
6786         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6787         */
6788        public ActionComponent addLinkId(String value) { //1
6789          StringType t = new StringType();
6790          t.setValue(value);
6791          if (this.linkId == null)
6792            this.linkId = new ArrayList<StringType>();
6793          this.linkId.add(t);
6794          return this;
6795        }
6796
6797        /**
6798         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6799         */
6800        public boolean hasLinkId(String value) { 
6801          if (this.linkId == null)
6802            return false;
6803          for (StringType v : this.linkId)
6804            if (v.getValue().equals(value)) // string
6805              return true;
6806          return false;
6807        }
6808
6809        /**
6810         * @return {@link #status} (Current state of the term action.)
6811         */
6812        public CodeableConcept getStatus() { 
6813          if (this.status == null)
6814            if (Configuration.errorOnAutoCreate())
6815              throw new Error("Attempt to auto-create ActionComponent.status");
6816            else if (Configuration.doAutoCreate())
6817              this.status = new CodeableConcept(); // cc
6818          return this.status;
6819        }
6820
6821        public boolean hasStatus() { 
6822          return this.status != null && !this.status.isEmpty();
6823        }
6824
6825        /**
6826         * @param value {@link #status} (Current state of the term action.)
6827         */
6828        public ActionComponent setStatus(CodeableConcept value) { 
6829          this.status = value;
6830          return this;
6831        }
6832
6833        /**
6834         * @return {@link #context} (Encounter or Episode with primary association to specified term activity.)
6835         */
6836        public Reference getContext() { 
6837          if (this.context == null)
6838            if (Configuration.errorOnAutoCreate())
6839              throw new Error("Attempt to auto-create ActionComponent.context");
6840            else if (Configuration.doAutoCreate())
6841              this.context = new Reference(); // cc
6842          return this.context;
6843        }
6844
6845        public boolean hasContext() { 
6846          return this.context != null && !this.context.isEmpty();
6847        }
6848
6849        /**
6850         * @param value {@link #context} (Encounter or Episode with primary association to specified term activity.)
6851         */
6852        public ActionComponent setContext(Reference value) { 
6853          this.context = value;
6854          return this;
6855        }
6856
6857        /**
6858         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
6859         */
6860        public List<StringType> getContextLinkId() { 
6861          if (this.contextLinkId == null)
6862            this.contextLinkId = new ArrayList<StringType>();
6863          return this.contextLinkId;
6864        }
6865
6866        /**
6867         * @return Returns a reference to <code>this</code> for easy method chaining
6868         */
6869        public ActionComponent setContextLinkId(List<StringType> theContextLinkId) { 
6870          this.contextLinkId = theContextLinkId;
6871          return this;
6872        }
6873
6874        public boolean hasContextLinkId() { 
6875          if (this.contextLinkId == null)
6876            return false;
6877          for (StringType item : this.contextLinkId)
6878            if (!item.isEmpty())
6879              return true;
6880          return false;
6881        }
6882
6883        /**
6884         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
6885         */
6886        public StringType addContextLinkIdElement() {//2 
6887          StringType t = new StringType();
6888          if (this.contextLinkId == null)
6889            this.contextLinkId = new ArrayList<StringType>();
6890          this.contextLinkId.add(t);
6891          return t;
6892        }
6893
6894        /**
6895         * @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.)
6896         */
6897        public ActionComponent addContextLinkId(String value) { //1
6898          StringType t = new StringType();
6899          t.setValue(value);
6900          if (this.contextLinkId == null)
6901            this.contextLinkId = new ArrayList<StringType>();
6902          this.contextLinkId.add(t);
6903          return this;
6904        }
6905
6906        /**
6907         * @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.)
6908         */
6909        public boolean hasContextLinkId(String value) { 
6910          if (this.contextLinkId == null)
6911            return false;
6912          for (StringType v : this.contextLinkId)
6913            if (v.getValue().equals(value)) // string
6914              return true;
6915          return false;
6916        }
6917
6918        /**
6919         * @return {@link #occurrence} (When action happens.)
6920         */
6921        public DataType getOccurrence() { 
6922          return this.occurrence;
6923        }
6924
6925        /**
6926         * @return {@link #occurrence} (When action happens.)
6927         */
6928        public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
6929          if (this.occurrence == null)
6930            this.occurrence = new DateTimeType();
6931          if (!(this.occurrence instanceof DateTimeType))
6932            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6933          return (DateTimeType) this.occurrence;
6934        }
6935
6936        public boolean hasOccurrenceDateTimeType() { 
6937          return this != null && this.occurrence instanceof DateTimeType;
6938        }
6939
6940        /**
6941         * @return {@link #occurrence} (When action happens.)
6942         */
6943        public Period getOccurrencePeriod() throws FHIRException { 
6944          if (this.occurrence == null)
6945            this.occurrence = new Period();
6946          if (!(this.occurrence instanceof Period))
6947            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6948          return (Period) this.occurrence;
6949        }
6950
6951        public boolean hasOccurrencePeriod() { 
6952          return this != null && this.occurrence instanceof Period;
6953        }
6954
6955        /**
6956         * @return {@link #occurrence} (When action happens.)
6957         */
6958        public Timing getOccurrenceTiming() throws FHIRException { 
6959          if (this.occurrence == null)
6960            this.occurrence = new Timing();
6961          if (!(this.occurrence instanceof Timing))
6962            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6963          return (Timing) this.occurrence;
6964        }
6965
6966        public boolean hasOccurrenceTiming() { 
6967          return this != null && this.occurrence instanceof Timing;
6968        }
6969
6970        public boolean hasOccurrence() { 
6971          return this.occurrence != null && !this.occurrence.isEmpty();
6972        }
6973
6974        /**
6975         * @param value {@link #occurrence} (When action happens.)
6976         */
6977        public ActionComponent setOccurrence(DataType value) { 
6978          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
6979            throw new Error("Not the right type for Contract.term.action.occurrence[x]: "+value.fhirType());
6980          this.occurrence = value;
6981          return this;
6982        }
6983
6984        /**
6985         * @return {@link #requester} (Who or what initiated the action and has responsibility for its activation.)
6986         */
6987        public List<Reference> getRequester() { 
6988          if (this.requester == null)
6989            this.requester = new ArrayList<Reference>();
6990          return this.requester;
6991        }
6992
6993        /**
6994         * @return Returns a reference to <code>this</code> for easy method chaining
6995         */
6996        public ActionComponent setRequester(List<Reference> theRequester) { 
6997          this.requester = theRequester;
6998          return this;
6999        }
7000
7001        public boolean hasRequester() { 
7002          if (this.requester == null)
7003            return false;
7004          for (Reference item : this.requester)
7005            if (!item.isEmpty())
7006              return true;
7007          return false;
7008        }
7009
7010        public Reference addRequester() { //3
7011          Reference t = new Reference();
7012          if (this.requester == null)
7013            this.requester = new ArrayList<Reference>();
7014          this.requester.add(t);
7015          return t;
7016        }
7017
7018        public ActionComponent addRequester(Reference t) { //3
7019          if (t == null)
7020            return this;
7021          if (this.requester == null)
7022            this.requester = new ArrayList<Reference>();
7023          this.requester.add(t);
7024          return this;
7025        }
7026
7027        /**
7028         * @return The first repetition of repeating field {@link #requester}, creating it if it does not already exist {3}
7029         */
7030        public Reference getRequesterFirstRep() { 
7031          if (getRequester().isEmpty()) {
7032            addRequester();
7033          }
7034          return getRequester().get(0);
7035        }
7036
7037        /**
7038         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7039         */
7040        public List<StringType> getRequesterLinkId() { 
7041          if (this.requesterLinkId == null)
7042            this.requesterLinkId = new ArrayList<StringType>();
7043          return this.requesterLinkId;
7044        }
7045
7046        /**
7047         * @return Returns a reference to <code>this</code> for easy method chaining
7048         */
7049        public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) { 
7050          this.requesterLinkId = theRequesterLinkId;
7051          return this;
7052        }
7053
7054        public boolean hasRequesterLinkId() { 
7055          if (this.requesterLinkId == null)
7056            return false;
7057          for (StringType item : this.requesterLinkId)
7058            if (!item.isEmpty())
7059              return true;
7060          return false;
7061        }
7062
7063        /**
7064         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7065         */
7066        public StringType addRequesterLinkIdElement() {//2 
7067          StringType t = new StringType();
7068          if (this.requesterLinkId == null)
7069            this.requesterLinkId = new ArrayList<StringType>();
7070          this.requesterLinkId.add(t);
7071          return t;
7072        }
7073
7074        /**
7075         * @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.)
7076         */
7077        public ActionComponent addRequesterLinkId(String value) { //1
7078          StringType t = new StringType();
7079          t.setValue(value);
7080          if (this.requesterLinkId == null)
7081            this.requesterLinkId = new ArrayList<StringType>();
7082          this.requesterLinkId.add(t);
7083          return this;
7084        }
7085
7086        /**
7087         * @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.)
7088         */
7089        public boolean hasRequesterLinkId(String value) { 
7090          if (this.requesterLinkId == null)
7091            return false;
7092          for (StringType v : this.requesterLinkId)
7093            if (v.getValue().equals(value)) // string
7094              return true;
7095          return false;
7096        }
7097
7098        /**
7099         * @return {@link #performerType} (The type of individual that is desired or required to perform or not perform the action.)
7100         */
7101        public List<CodeableConcept> getPerformerType() { 
7102          if (this.performerType == null)
7103            this.performerType = new ArrayList<CodeableConcept>();
7104          return this.performerType;
7105        }
7106
7107        /**
7108         * @return Returns a reference to <code>this</code> for easy method chaining
7109         */
7110        public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) { 
7111          this.performerType = thePerformerType;
7112          return this;
7113        }
7114
7115        public boolean hasPerformerType() { 
7116          if (this.performerType == null)
7117            return false;
7118          for (CodeableConcept item : this.performerType)
7119            if (!item.isEmpty())
7120              return true;
7121          return false;
7122        }
7123
7124        public CodeableConcept addPerformerType() { //3
7125          CodeableConcept t = new CodeableConcept();
7126          if (this.performerType == null)
7127            this.performerType = new ArrayList<CodeableConcept>();
7128          this.performerType.add(t);
7129          return t;
7130        }
7131
7132        public ActionComponent addPerformerType(CodeableConcept t) { //3
7133          if (t == null)
7134            return this;
7135          if (this.performerType == null)
7136            this.performerType = new ArrayList<CodeableConcept>();
7137          this.performerType.add(t);
7138          return this;
7139        }
7140
7141        /**
7142         * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist {3}
7143         */
7144        public CodeableConcept getPerformerTypeFirstRep() { 
7145          if (getPerformerType().isEmpty()) {
7146            addPerformerType();
7147          }
7148          return getPerformerType().get(0);
7149        }
7150
7151        /**
7152         * @return {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7153         */
7154        public CodeableConcept getPerformerRole() { 
7155          if (this.performerRole == null)
7156            if (Configuration.errorOnAutoCreate())
7157              throw new Error("Attempt to auto-create ActionComponent.performerRole");
7158            else if (Configuration.doAutoCreate())
7159              this.performerRole = new CodeableConcept(); // cc
7160          return this.performerRole;
7161        }
7162
7163        public boolean hasPerformerRole() { 
7164          return this.performerRole != null && !this.performerRole.isEmpty();
7165        }
7166
7167        /**
7168         * @param value {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7169         */
7170        public ActionComponent setPerformerRole(CodeableConcept value) { 
7171          this.performerRole = value;
7172          return this;
7173        }
7174
7175        /**
7176         * @return {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7177         */
7178        public Reference getPerformer() { 
7179          if (this.performer == null)
7180            if (Configuration.errorOnAutoCreate())
7181              throw new Error("Attempt to auto-create ActionComponent.performer");
7182            else if (Configuration.doAutoCreate())
7183              this.performer = new Reference(); // cc
7184          return this.performer;
7185        }
7186
7187        public boolean hasPerformer() { 
7188          return this.performer != null && !this.performer.isEmpty();
7189        }
7190
7191        /**
7192         * @param value {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7193         */
7194        public ActionComponent setPerformer(Reference value) { 
7195          this.performer = value;
7196          return this;
7197        }
7198
7199        /**
7200         * @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.)
7201         */
7202        public List<StringType> getPerformerLinkId() { 
7203          if (this.performerLinkId == null)
7204            this.performerLinkId = new ArrayList<StringType>();
7205          return this.performerLinkId;
7206        }
7207
7208        /**
7209         * @return Returns a reference to <code>this</code> for easy method chaining
7210         */
7211        public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) { 
7212          this.performerLinkId = thePerformerLinkId;
7213          return this;
7214        }
7215
7216        public boolean hasPerformerLinkId() { 
7217          if (this.performerLinkId == null)
7218            return false;
7219          for (StringType item : this.performerLinkId)
7220            if (!item.isEmpty())
7221              return true;
7222          return false;
7223        }
7224
7225        /**
7226         * @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.)
7227         */
7228        public StringType addPerformerLinkIdElement() {//2 
7229          StringType t = new StringType();
7230          if (this.performerLinkId == null)
7231            this.performerLinkId = new ArrayList<StringType>();
7232          this.performerLinkId.add(t);
7233          return t;
7234        }
7235
7236        /**
7237         * @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.)
7238         */
7239        public ActionComponent addPerformerLinkId(String value) { //1
7240          StringType t = new StringType();
7241          t.setValue(value);
7242          if (this.performerLinkId == null)
7243            this.performerLinkId = new ArrayList<StringType>();
7244          this.performerLinkId.add(t);
7245          return this;
7246        }
7247
7248        /**
7249         * @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.)
7250         */
7251        public boolean hasPerformerLinkId(String value) { 
7252          if (this.performerLinkId == null)
7253            return false;
7254          for (StringType v : this.performerLinkId)
7255            if (v.getValue().equals(value)) // string
7256              return true;
7257          return false;
7258        }
7259
7260        /**
7261         * @return {@link #reason} (Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited. Either a coded concept, or another resource whose existence justifies permitting or not permitting this action.)
7262         */
7263        public List<CodeableReference> getReason() { 
7264          if (this.reason == null)
7265            this.reason = new ArrayList<CodeableReference>();
7266          return this.reason;
7267        }
7268
7269        /**
7270         * @return Returns a reference to <code>this</code> for easy method chaining
7271         */
7272        public ActionComponent setReason(List<CodeableReference> theReason) { 
7273          this.reason = theReason;
7274          return this;
7275        }
7276
7277        public boolean hasReason() { 
7278          if (this.reason == null)
7279            return false;
7280          for (CodeableReference item : this.reason)
7281            if (!item.isEmpty())
7282              return true;
7283          return false;
7284        }
7285
7286        public CodeableReference addReason() { //3
7287          CodeableReference t = new CodeableReference();
7288          if (this.reason == null)
7289            this.reason = new ArrayList<CodeableReference>();
7290          this.reason.add(t);
7291          return t;
7292        }
7293
7294        public ActionComponent addReason(CodeableReference t) { //3
7295          if (t == null)
7296            return this;
7297          if (this.reason == null)
7298            this.reason = new ArrayList<CodeableReference>();
7299          this.reason.add(t);
7300          return this;
7301        }
7302
7303        /**
7304         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
7305         */
7306        public CodeableReference getReasonFirstRep() { 
7307          if (getReason().isEmpty()) {
7308            addReason();
7309          }
7310          return getReason().get(0);
7311        }
7312
7313        /**
7314         * @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.)
7315         */
7316        public List<StringType> getReasonLinkId() { 
7317          if (this.reasonLinkId == null)
7318            this.reasonLinkId = new ArrayList<StringType>();
7319          return this.reasonLinkId;
7320        }
7321
7322        /**
7323         * @return Returns a reference to <code>this</code> for easy method chaining
7324         */
7325        public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) { 
7326          this.reasonLinkId = theReasonLinkId;
7327          return this;
7328        }
7329
7330        public boolean hasReasonLinkId() { 
7331          if (this.reasonLinkId == null)
7332            return false;
7333          for (StringType item : this.reasonLinkId)
7334            if (!item.isEmpty())
7335              return true;
7336          return false;
7337        }
7338
7339        /**
7340         * @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.)
7341         */
7342        public StringType addReasonLinkIdElement() {//2 
7343          StringType t = new StringType();
7344          if (this.reasonLinkId == null)
7345            this.reasonLinkId = new ArrayList<StringType>();
7346          this.reasonLinkId.add(t);
7347          return t;
7348        }
7349
7350        /**
7351         * @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.)
7352         */
7353        public ActionComponent addReasonLinkId(String value) { //1
7354          StringType t = new StringType();
7355          t.setValue(value);
7356          if (this.reasonLinkId == null)
7357            this.reasonLinkId = new ArrayList<StringType>();
7358          this.reasonLinkId.add(t);
7359          return this;
7360        }
7361
7362        /**
7363         * @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.)
7364         */
7365        public boolean hasReasonLinkId(String value) { 
7366          if (this.reasonLinkId == null)
7367            return false;
7368          for (StringType v : this.reasonLinkId)
7369            if (v.getValue().equals(value)) // string
7370              return true;
7371          return false;
7372        }
7373
7374        /**
7375         * @return {@link #note} (Comments made about the term action made by the requester, performer, subject or other participants.)
7376         */
7377        public List<Annotation> getNote() { 
7378          if (this.note == null)
7379            this.note = new ArrayList<Annotation>();
7380          return this.note;
7381        }
7382
7383        /**
7384         * @return Returns a reference to <code>this</code> for easy method chaining
7385         */
7386        public ActionComponent setNote(List<Annotation> theNote) { 
7387          this.note = theNote;
7388          return this;
7389        }
7390
7391        public boolean hasNote() { 
7392          if (this.note == null)
7393            return false;
7394          for (Annotation item : this.note)
7395            if (!item.isEmpty())
7396              return true;
7397          return false;
7398        }
7399
7400        public Annotation addNote() { //3
7401          Annotation t = new Annotation();
7402          if (this.note == null)
7403            this.note = new ArrayList<Annotation>();
7404          this.note.add(t);
7405          return t;
7406        }
7407
7408        public ActionComponent addNote(Annotation t) { //3
7409          if (t == null)
7410            return this;
7411          if (this.note == null)
7412            this.note = new ArrayList<Annotation>();
7413          this.note.add(t);
7414          return this;
7415        }
7416
7417        /**
7418         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
7419         */
7420        public Annotation getNoteFirstRep() { 
7421          if (getNote().isEmpty()) {
7422            addNote();
7423          }
7424          return getNote().get(0);
7425        }
7426
7427        /**
7428         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7429         */
7430        public List<UnsignedIntType> getSecurityLabelNumber() { 
7431          if (this.securityLabelNumber == null)
7432            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7433          return this.securityLabelNumber;
7434        }
7435
7436        /**
7437         * @return Returns a reference to <code>this</code> for easy method chaining
7438         */
7439        public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
7440          this.securityLabelNumber = theSecurityLabelNumber;
7441          return this;
7442        }
7443
7444        public boolean hasSecurityLabelNumber() { 
7445          if (this.securityLabelNumber == null)
7446            return false;
7447          for (UnsignedIntType item : this.securityLabelNumber)
7448            if (!item.isEmpty())
7449              return true;
7450          return false;
7451        }
7452
7453        /**
7454         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7455         */
7456        public UnsignedIntType addSecurityLabelNumberElement() {//2 
7457          UnsignedIntType t = new UnsignedIntType();
7458          if (this.securityLabelNumber == null)
7459            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7460          this.securityLabelNumber.add(t);
7461          return t;
7462        }
7463
7464        /**
7465         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7466         */
7467        public ActionComponent addSecurityLabelNumber(int value) { //1
7468          UnsignedIntType t = new UnsignedIntType();
7469          t.setValue(value);
7470          if (this.securityLabelNumber == null)
7471            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7472          this.securityLabelNumber.add(t);
7473          return this;
7474        }
7475
7476        /**
7477         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7478         */
7479        public boolean hasSecurityLabelNumber(int value) { 
7480          if (this.securityLabelNumber == null)
7481            return false;
7482          for (UnsignedIntType v : this.securityLabelNumber)
7483            if (v.getValue().equals(value)) // unsignedInt
7484              return true;
7485          return false;
7486        }
7487
7488        protected void listChildren(List<Property> children) {
7489          super.listChildren(children);
7490          children.add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
7491          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));
7492          children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
7493          children.add(new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
7494          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));
7495          children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
7496          children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
7497          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));
7498          children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
7499          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));
7500          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));
7501          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));
7502          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));
7503          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));
7504          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));
7505          children.add(new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited. Either a coded concept, or another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reason));
7506          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));
7507          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));
7508          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
7509        }
7510
7511        @Override
7512        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7513          switch (_hash) {
7514          case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform);
7515          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);
7516          case -1867885268: /*subject*/  return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject);
7517          case -1183762788: /*intent*/  return new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
7518          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);
7519          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status);
7520          case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
7521          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);
7522          case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7523          case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7524          case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime", "When action happens.", 0, 1, occurrence);
7525          case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "Period", "When action happens.", 0, 1, occurrence);
7526          case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "Timing", "When action happens.", 0, 1, occurrence);
7527          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);
7528          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);
7529          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);
7530          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);
7531          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);
7532          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);
7533          case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited. Either a coded concept, or another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reason);
7534          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);
7535          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);
7536          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
7537          default: return super.getNamedProperty(_hash, _name, _checkValid);
7538          }
7539
7540        }
7541
7542      @Override
7543      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7544        switch (hash) {
7545        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
7546        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
7547        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
7548        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // CodeableConcept
7549        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7550        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
7551        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
7552        case -288783036: /*contextLinkId*/ return this.contextLinkId == null ? new Base[0] : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
7553        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // DataType
7554        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : this.requester.toArray(new Base[this.requester.size()]); // Reference
7555        case -1468032687: /*requesterLinkId*/ return this.requesterLinkId == null ? new Base[0] : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
7556        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
7557        case -901513884: /*performerRole*/ return this.performerRole == null ? new Base[0] : new Base[] {this.performerRole}; // CodeableConcept
7558        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
7559        case 1051302947: /*performerLinkId*/ return this.performerLinkId == null ? new Base[0] : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
7560        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
7561        case -1557963239: /*reasonLinkId*/ return this.reasonLinkId == null ? new Base[0] : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
7562        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
7563        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7564        default: return super.getProperty(hash, name, checkValid);
7565        }
7566
7567      }
7568
7569      @Override
7570      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7571        switch (hash) {
7572        case -1788508167: // doNotPerform
7573          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
7574          return value;
7575        case 3575610: // type
7576          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7577          return value;
7578        case -1867885268: // subject
7579          this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
7580          return value;
7581        case -1183762788: // intent
7582          this.intent = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7583          return value;
7584        case -1102667083: // linkId
7585          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
7586          return value;
7587        case -892481550: // status
7588          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7589          return value;
7590        case 951530927: // context
7591          this.context = TypeConvertor.castToReference(value); // Reference
7592          return value;
7593        case -288783036: // contextLinkId
7594          this.getContextLinkId().add(TypeConvertor.castToString(value)); // StringType
7595          return value;
7596        case 1687874001: // occurrence
7597          this.occurrence = TypeConvertor.castToType(value); // DataType
7598          return value;
7599        case 693933948: // requester
7600          this.getRequester().add(TypeConvertor.castToReference(value)); // Reference
7601          return value;
7602        case -1468032687: // requesterLinkId
7603          this.getRequesterLinkId().add(TypeConvertor.castToString(value)); // StringType
7604          return value;
7605        case -901444568: // performerType
7606          this.getPerformerType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7607          return value;
7608        case -901513884: // performerRole
7609          this.performerRole = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7610          return value;
7611        case 481140686: // performer
7612          this.performer = TypeConvertor.castToReference(value); // Reference
7613          return value;
7614        case 1051302947: // performerLinkId
7615          this.getPerformerLinkId().add(TypeConvertor.castToString(value)); // StringType
7616          return value;
7617        case -934964668: // reason
7618          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
7619          return value;
7620        case -1557963239: // reasonLinkId
7621          this.getReasonLinkId().add(TypeConvertor.castToString(value)); // StringType
7622          return value;
7623        case 3387378: // note
7624          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
7625          return value;
7626        case -149460995: // securityLabelNumber
7627          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
7628          return value;
7629        default: return super.setProperty(hash, name, value);
7630        }
7631
7632      }
7633
7634      @Override
7635      public Base setProperty(String name, Base value) throws FHIRException {
7636        if (name.equals("doNotPerform")) {
7637          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
7638        } else if (name.equals("type")) {
7639          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7640        } else if (name.equals("subject")) {
7641          this.getSubject().add((ActionSubjectComponent) value);
7642        } else if (name.equals("intent")) {
7643          this.intent = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7644        } else if (name.equals("linkId")) {
7645          this.getLinkId().add(TypeConvertor.castToString(value));
7646        } else if (name.equals("status")) {
7647          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7648        } else if (name.equals("context")) {
7649          this.context = TypeConvertor.castToReference(value); // Reference
7650        } else if (name.equals("contextLinkId")) {
7651          this.getContextLinkId().add(TypeConvertor.castToString(value));
7652        } else if (name.equals("occurrence[x]")) {
7653          this.occurrence = TypeConvertor.castToType(value); // DataType
7654        } else if (name.equals("requester")) {
7655          this.getRequester().add(TypeConvertor.castToReference(value));
7656        } else if (name.equals("requesterLinkId")) {
7657          this.getRequesterLinkId().add(TypeConvertor.castToString(value));
7658        } else if (name.equals("performerType")) {
7659          this.getPerformerType().add(TypeConvertor.castToCodeableConcept(value));
7660        } else if (name.equals("performerRole")) {
7661          this.performerRole = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7662        } else if (name.equals("performer")) {
7663          this.performer = TypeConvertor.castToReference(value); // Reference
7664        } else if (name.equals("performerLinkId")) {
7665          this.getPerformerLinkId().add(TypeConvertor.castToString(value));
7666        } else if (name.equals("reason")) {
7667          this.getReason().add(TypeConvertor.castToCodeableReference(value));
7668        } else if (name.equals("reasonLinkId")) {
7669          this.getReasonLinkId().add(TypeConvertor.castToString(value));
7670        } else if (name.equals("note")) {
7671          this.getNote().add(TypeConvertor.castToAnnotation(value));
7672        } else if (name.equals("securityLabelNumber")) {
7673          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
7674        } else
7675          return super.setProperty(name, value);
7676        return value;
7677      }
7678
7679      @Override
7680      public Base makeProperty(int hash, String name) throws FHIRException {
7681        switch (hash) {
7682        case -1788508167:  return getDoNotPerformElement();
7683        case 3575610:  return getType();
7684        case -1867885268:  return addSubject(); 
7685        case -1183762788:  return getIntent();
7686        case -1102667083:  return addLinkIdElement();
7687        case -892481550:  return getStatus();
7688        case 951530927:  return getContext();
7689        case -288783036:  return addContextLinkIdElement();
7690        case -2022646513:  return getOccurrence();
7691        case 1687874001:  return getOccurrence();
7692        case 693933948:  return addRequester(); 
7693        case -1468032687:  return addRequesterLinkIdElement();
7694        case -901444568:  return addPerformerType(); 
7695        case -901513884:  return getPerformerRole();
7696        case 481140686:  return getPerformer();
7697        case 1051302947:  return addPerformerLinkIdElement();
7698        case -934964668:  return addReason(); 
7699        case -1557963239:  return addReasonLinkIdElement();
7700        case 3387378:  return addNote(); 
7701        case -149460995:  return addSecurityLabelNumberElement();
7702        default: return super.makeProperty(hash, name);
7703        }
7704
7705      }
7706
7707      @Override
7708      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7709        switch (hash) {
7710        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
7711        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7712        case -1867885268: /*subject*/ return new String[] {};
7713        case -1183762788: /*intent*/ return new String[] {"CodeableConcept"};
7714        case -1102667083: /*linkId*/ return new String[] {"string"};
7715        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
7716        case 951530927: /*context*/ return new String[] {"Reference"};
7717        case -288783036: /*contextLinkId*/ return new String[] {"string"};
7718        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
7719        case 693933948: /*requester*/ return new String[] {"Reference"};
7720        case -1468032687: /*requesterLinkId*/ return new String[] {"string"};
7721        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
7722        case -901513884: /*performerRole*/ return new String[] {"CodeableConcept"};
7723        case 481140686: /*performer*/ return new String[] {"Reference"};
7724        case 1051302947: /*performerLinkId*/ return new String[] {"string"};
7725        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
7726        case -1557963239: /*reasonLinkId*/ return new String[] {"string"};
7727        case 3387378: /*note*/ return new String[] {"Annotation"};
7728        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
7729        default: return super.getTypesForProperty(hash, name);
7730        }
7731
7732      }
7733
7734      @Override
7735      public Base addChild(String name) throws FHIRException {
7736        if (name.equals("doNotPerform")) {
7737          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.doNotPerform");
7738        }
7739        else if (name.equals("type")) {
7740          this.type = new CodeableConcept();
7741          return this.type;
7742        }
7743        else if (name.equals("subject")) {
7744          return addSubject();
7745        }
7746        else if (name.equals("intent")) {
7747          this.intent = new CodeableConcept();
7748          return this.intent;
7749        }
7750        else if (name.equals("linkId")) {
7751          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.linkId");
7752        }
7753        else if (name.equals("status")) {
7754          this.status = new CodeableConcept();
7755          return this.status;
7756        }
7757        else if (name.equals("context")) {
7758          this.context = new Reference();
7759          return this.context;
7760        }
7761        else if (name.equals("contextLinkId")) {
7762          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.contextLinkId");
7763        }
7764        else if (name.equals("occurrenceDateTime")) {
7765          this.occurrence = new DateTimeType();
7766          return this.occurrence;
7767        }
7768        else if (name.equals("occurrencePeriod")) {
7769          this.occurrence = new Period();
7770          return this.occurrence;
7771        }
7772        else if (name.equals("occurrenceTiming")) {
7773          this.occurrence = new Timing();
7774          return this.occurrence;
7775        }
7776        else if (name.equals("requester")) {
7777          return addRequester();
7778        }
7779        else if (name.equals("requesterLinkId")) {
7780          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.requesterLinkId");
7781        }
7782        else if (name.equals("performerType")) {
7783          return addPerformerType();
7784        }
7785        else if (name.equals("performerRole")) {
7786          this.performerRole = new CodeableConcept();
7787          return this.performerRole;
7788        }
7789        else if (name.equals("performer")) {
7790          this.performer = new Reference();
7791          return this.performer;
7792        }
7793        else if (name.equals("performerLinkId")) {
7794          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.performerLinkId");
7795        }
7796        else if (name.equals("reason")) {
7797          return addReason();
7798        }
7799        else if (name.equals("reasonLinkId")) {
7800          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.reasonLinkId");
7801        }
7802        else if (name.equals("note")) {
7803          return addNote();
7804        }
7805        else if (name.equals("securityLabelNumber")) {
7806          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.securityLabelNumber");
7807        }
7808        else
7809          return super.addChild(name);
7810      }
7811
7812      public ActionComponent copy() {
7813        ActionComponent dst = new ActionComponent();
7814        copyValues(dst);
7815        return dst;
7816      }
7817
7818      public void copyValues(ActionComponent dst) {
7819        super.copyValues(dst);
7820        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
7821        dst.type = type == null ? null : type.copy();
7822        if (subject != null) {
7823          dst.subject = new ArrayList<ActionSubjectComponent>();
7824          for (ActionSubjectComponent i : subject)
7825            dst.subject.add(i.copy());
7826        };
7827        dst.intent = intent == null ? null : intent.copy();
7828        if (linkId != null) {
7829          dst.linkId = new ArrayList<StringType>();
7830          for (StringType i : linkId)
7831            dst.linkId.add(i.copy());
7832        };
7833        dst.status = status == null ? null : status.copy();
7834        dst.context = context == null ? null : context.copy();
7835        if (contextLinkId != null) {
7836          dst.contextLinkId = new ArrayList<StringType>();
7837          for (StringType i : contextLinkId)
7838            dst.contextLinkId.add(i.copy());
7839        };
7840        dst.occurrence = occurrence == null ? null : occurrence.copy();
7841        if (requester != null) {
7842          dst.requester = new ArrayList<Reference>();
7843          for (Reference i : requester)
7844            dst.requester.add(i.copy());
7845        };
7846        if (requesterLinkId != null) {
7847          dst.requesterLinkId = new ArrayList<StringType>();
7848          for (StringType i : requesterLinkId)
7849            dst.requesterLinkId.add(i.copy());
7850        };
7851        if (performerType != null) {
7852          dst.performerType = new ArrayList<CodeableConcept>();
7853          for (CodeableConcept i : performerType)
7854            dst.performerType.add(i.copy());
7855        };
7856        dst.performerRole = performerRole == null ? null : performerRole.copy();
7857        dst.performer = performer == null ? null : performer.copy();
7858        if (performerLinkId != null) {
7859          dst.performerLinkId = new ArrayList<StringType>();
7860          for (StringType i : performerLinkId)
7861            dst.performerLinkId.add(i.copy());
7862        };
7863        if (reason != null) {
7864          dst.reason = new ArrayList<CodeableReference>();
7865          for (CodeableReference i : reason)
7866            dst.reason.add(i.copy());
7867        };
7868        if (reasonLinkId != null) {
7869          dst.reasonLinkId = new ArrayList<StringType>();
7870          for (StringType i : reasonLinkId)
7871            dst.reasonLinkId.add(i.copy());
7872        };
7873        if (note != null) {
7874          dst.note = new ArrayList<Annotation>();
7875          for (Annotation i : note)
7876            dst.note.add(i.copy());
7877        };
7878        if (securityLabelNumber != null) {
7879          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
7880          for (UnsignedIntType i : securityLabelNumber)
7881            dst.securityLabelNumber.add(i.copy());
7882        };
7883      }
7884
7885      @Override
7886      public boolean equalsDeep(Base other_) {
7887        if (!super.equalsDeep(other_))
7888          return false;
7889        if (!(other_ instanceof ActionComponent))
7890          return false;
7891        ActionComponent o = (ActionComponent) other_;
7892        return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
7893           && compareDeep(intent, o.intent, true) && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
7894           && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true) && compareDeep(occurrence, o.occurrence, true)
7895           && compareDeep(requester, o.requester, true) && compareDeep(requesterLinkId, o.requesterLinkId, true)
7896           && compareDeep(performerType, o.performerType, true) && compareDeep(performerRole, o.performerRole, true)
7897           && compareDeep(performer, o.performer, true) && compareDeep(performerLinkId, o.performerLinkId, true)
7898           && compareDeep(reason, o.reason, true) && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
7899           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
7900      }
7901
7902      @Override
7903      public boolean equalsShallow(Base other_) {
7904        if (!super.equalsShallow(other_))
7905          return false;
7906        if (!(other_ instanceof ActionComponent))
7907          return false;
7908        ActionComponent o = (ActionComponent) other_;
7909        return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true) && compareValues(contextLinkId, o.contextLinkId, true)
7910           && compareValues(requesterLinkId, o.requesterLinkId, true) && compareValues(performerLinkId, o.performerLinkId, true)
7911           && compareValues(reasonLinkId, o.reasonLinkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
7912          ;
7913      }
7914
7915      public boolean isEmpty() {
7916        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject
7917          , intent, linkId, status, context, contextLinkId, occurrence, requester, requesterLinkId
7918          , performerType, performerRole, performer, performerLinkId, reason, reasonLinkId
7919          , note, securityLabelNumber);
7920      }
7921
7922  public String fhirType() {
7923    return "Contract.term.action";
7924
7925  }
7926
7927  }
7928
7929    @Block()
7930    public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
7931        /**
7932         * The entity the action is performed or not performed on or for.
7933         */
7934        @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)
7935        @Description(shortDefinition="Entity of the action", formalDefinition="The entity the action is performed or not performed on or for." )
7936        protected List<Reference> reference;
7937
7938        /**
7939         * Role type of agent assigned roles in this Contract.
7940         */
7941        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7942        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
7943        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
7944        protected CodeableConcept role;
7945
7946        private static final long serialVersionUID = -1599592477L;
7947
7948    /**
7949     * Constructor
7950     */
7951      public ActionSubjectComponent() {
7952        super();
7953      }
7954
7955    /**
7956     * Constructor
7957     */
7958      public ActionSubjectComponent(Reference reference) {
7959        super();
7960        this.addReference(reference);
7961      }
7962
7963        /**
7964         * @return {@link #reference} (The entity the action is performed or not performed on or for.)
7965         */
7966        public List<Reference> getReference() { 
7967          if (this.reference == null)
7968            this.reference = new ArrayList<Reference>();
7969          return this.reference;
7970        }
7971
7972        /**
7973         * @return Returns a reference to <code>this</code> for easy method chaining
7974         */
7975        public ActionSubjectComponent setReference(List<Reference> theReference) { 
7976          this.reference = theReference;
7977          return this;
7978        }
7979
7980        public boolean hasReference() { 
7981          if (this.reference == null)
7982            return false;
7983          for (Reference item : this.reference)
7984            if (!item.isEmpty())
7985              return true;
7986          return false;
7987        }
7988
7989        public Reference addReference() { //3
7990          Reference t = new Reference();
7991          if (this.reference == null)
7992            this.reference = new ArrayList<Reference>();
7993          this.reference.add(t);
7994          return t;
7995        }
7996
7997        public ActionSubjectComponent addReference(Reference t) { //3
7998          if (t == null)
7999            return this;
8000          if (this.reference == null)
8001            this.reference = new ArrayList<Reference>();
8002          this.reference.add(t);
8003          return this;
8004        }
8005
8006        /**
8007         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist {3}
8008         */
8009        public Reference getReferenceFirstRep() { 
8010          if (getReference().isEmpty()) {
8011            addReference();
8012          }
8013          return getReference().get(0);
8014        }
8015
8016        /**
8017         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
8018         */
8019        public CodeableConcept getRole() { 
8020          if (this.role == null)
8021            if (Configuration.errorOnAutoCreate())
8022              throw new Error("Attempt to auto-create ActionSubjectComponent.role");
8023            else if (Configuration.doAutoCreate())
8024              this.role = new CodeableConcept(); // cc
8025          return this.role;
8026        }
8027
8028        public boolean hasRole() { 
8029          return this.role != null && !this.role.isEmpty();
8030        }
8031
8032        /**
8033         * @param value {@link #role} (Role type of agent assigned roles in this Contract.)
8034         */
8035        public ActionSubjectComponent setRole(CodeableConcept value) { 
8036          this.role = value;
8037          return this;
8038        }
8039
8040        protected void listChildren(List<Property> children) {
8041          super.listChildren(children);
8042          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));
8043          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
8044        }
8045
8046        @Override
8047        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8048          switch (_hash) {
8049          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);
8050          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role);
8051          default: return super.getNamedProperty(_hash, _name, _checkValid);
8052          }
8053
8054        }
8055
8056      @Override
8057      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8058        switch (hash) {
8059        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
8060        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
8061        default: return super.getProperty(hash, name, checkValid);
8062        }
8063
8064      }
8065
8066      @Override
8067      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8068        switch (hash) {
8069        case -925155509: // reference
8070          this.getReference().add(TypeConvertor.castToReference(value)); // Reference
8071          return value;
8072        case 3506294: // role
8073          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8074          return value;
8075        default: return super.setProperty(hash, name, value);
8076        }
8077
8078      }
8079
8080      @Override
8081      public Base setProperty(String name, Base value) throws FHIRException {
8082        if (name.equals("reference")) {
8083          this.getReference().add(TypeConvertor.castToReference(value));
8084        } else if (name.equals("role")) {
8085          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8086        } else
8087          return super.setProperty(name, value);
8088        return value;
8089      }
8090
8091      @Override
8092      public Base makeProperty(int hash, String name) throws FHIRException {
8093        switch (hash) {
8094        case -925155509:  return addReference(); 
8095        case 3506294:  return getRole();
8096        default: return super.makeProperty(hash, name);
8097        }
8098
8099      }
8100
8101      @Override
8102      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8103        switch (hash) {
8104        case -925155509: /*reference*/ return new String[] {"Reference"};
8105        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
8106        default: return super.getTypesForProperty(hash, name);
8107        }
8108
8109      }
8110
8111      @Override
8112      public Base addChild(String name) throws FHIRException {
8113        if (name.equals("reference")) {
8114          return addReference();
8115        }
8116        else if (name.equals("role")) {
8117          this.role = new CodeableConcept();
8118          return this.role;
8119        }
8120        else
8121          return super.addChild(name);
8122      }
8123
8124      public ActionSubjectComponent copy() {
8125        ActionSubjectComponent dst = new ActionSubjectComponent();
8126        copyValues(dst);
8127        return dst;
8128      }
8129
8130      public void copyValues(ActionSubjectComponent dst) {
8131        super.copyValues(dst);
8132        if (reference != null) {
8133          dst.reference = new ArrayList<Reference>();
8134          for (Reference i : reference)
8135            dst.reference.add(i.copy());
8136        };
8137        dst.role = role == null ? null : role.copy();
8138      }
8139
8140      @Override
8141      public boolean equalsDeep(Base other_) {
8142        if (!super.equalsDeep(other_))
8143          return false;
8144        if (!(other_ instanceof ActionSubjectComponent))
8145          return false;
8146        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8147        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
8148      }
8149
8150      @Override
8151      public boolean equalsShallow(Base other_) {
8152        if (!super.equalsShallow(other_))
8153          return false;
8154        if (!(other_ instanceof ActionSubjectComponent))
8155          return false;
8156        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8157        return true;
8158      }
8159
8160      public boolean isEmpty() {
8161        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
8162      }
8163
8164  public String fhirType() {
8165    return "Contract.term.action.subject";
8166
8167  }
8168
8169  }
8170
8171    @Block()
8172    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
8173        /**
8174         * Role of this Contract signer, e.g. notary, grantee.
8175         */
8176        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
8177        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
8178        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
8179        protected Coding type;
8180
8181        /**
8182         * Party which is a signator to this Contract.
8183         */
8184        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
8185        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
8186        protected Reference party;
8187
8188        /**
8189         * Legally binding Contract DSIG signature contents in Base64.
8190         */
8191        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8192        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
8193        protected List<Signature> signature;
8194
8195        private static final long serialVersionUID = 1384929729L;
8196
8197    /**
8198     * Constructor
8199     */
8200      public SignatoryComponent() {
8201        super();
8202      }
8203
8204    /**
8205     * Constructor
8206     */
8207      public SignatoryComponent(Coding type, Reference party, Signature signature) {
8208        super();
8209        this.setType(type);
8210        this.setParty(party);
8211        this.addSignature(signature);
8212      }
8213
8214        /**
8215         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8216         */
8217        public Coding getType() { 
8218          if (this.type == null)
8219            if (Configuration.errorOnAutoCreate())
8220              throw new Error("Attempt to auto-create SignatoryComponent.type");
8221            else if (Configuration.doAutoCreate())
8222              this.type = new Coding(); // cc
8223          return this.type;
8224        }
8225
8226        public boolean hasType() { 
8227          return this.type != null && !this.type.isEmpty();
8228        }
8229
8230        /**
8231         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8232         */
8233        public SignatoryComponent setType(Coding value) { 
8234          this.type = value;
8235          return this;
8236        }
8237
8238        /**
8239         * @return {@link #party} (Party which is a signator to this Contract.)
8240         */
8241        public Reference getParty() { 
8242          if (this.party == null)
8243            if (Configuration.errorOnAutoCreate())
8244              throw new Error("Attempt to auto-create SignatoryComponent.party");
8245            else if (Configuration.doAutoCreate())
8246              this.party = new Reference(); // cc
8247          return this.party;
8248        }
8249
8250        public boolean hasParty() { 
8251          return this.party != null && !this.party.isEmpty();
8252        }
8253
8254        /**
8255         * @param value {@link #party} (Party which is a signator to this Contract.)
8256         */
8257        public SignatoryComponent setParty(Reference value) { 
8258          this.party = value;
8259          return this;
8260        }
8261
8262        /**
8263         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
8264         */
8265        public List<Signature> getSignature() { 
8266          if (this.signature == null)
8267            this.signature = new ArrayList<Signature>();
8268          return this.signature;
8269        }
8270
8271        /**
8272         * @return Returns a reference to <code>this</code> for easy method chaining
8273         */
8274        public SignatoryComponent setSignature(List<Signature> theSignature) { 
8275          this.signature = theSignature;
8276          return this;
8277        }
8278
8279        public boolean hasSignature() { 
8280          if (this.signature == null)
8281            return false;
8282          for (Signature item : this.signature)
8283            if (!item.isEmpty())
8284              return true;
8285          return false;
8286        }
8287
8288        public Signature addSignature() { //3
8289          Signature t = new Signature();
8290          if (this.signature == null)
8291            this.signature = new ArrayList<Signature>();
8292          this.signature.add(t);
8293          return t;
8294        }
8295
8296        public SignatoryComponent addSignature(Signature t) { //3
8297          if (t == null)
8298            return this;
8299          if (this.signature == null)
8300            this.signature = new ArrayList<Signature>();
8301          this.signature.add(t);
8302          return this;
8303        }
8304
8305        /**
8306         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist {3}
8307         */
8308        public Signature getSignatureFirstRep() { 
8309          if (getSignature().isEmpty()) {
8310            addSignature();
8311          }
8312          return getSignature().get(0);
8313        }
8314
8315        protected void listChildren(List<Property> children) {
8316          super.listChildren(children);
8317          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
8318          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
8319          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
8320        }
8321
8322        @Override
8323        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8324          switch (_hash) {
8325          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
8326          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
8327          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
8328          default: return super.getNamedProperty(_hash, _name, _checkValid);
8329          }
8330
8331        }
8332
8333      @Override
8334      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8335        switch (hash) {
8336        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8337        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
8338        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
8339        default: return super.getProperty(hash, name, checkValid);
8340        }
8341
8342      }
8343
8344      @Override
8345      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8346        switch (hash) {
8347        case 3575610: // type
8348          this.type = TypeConvertor.castToCoding(value); // Coding
8349          return value;
8350        case 106437350: // party
8351          this.party = TypeConvertor.castToReference(value); // Reference
8352          return value;
8353        case 1073584312: // signature
8354          this.getSignature().add(TypeConvertor.castToSignature(value)); // Signature
8355          return value;
8356        default: return super.setProperty(hash, name, value);
8357        }
8358
8359      }
8360
8361      @Override
8362      public Base setProperty(String name, Base value) throws FHIRException {
8363        if (name.equals("type")) {
8364          this.type = TypeConvertor.castToCoding(value); // Coding
8365        } else if (name.equals("party")) {
8366          this.party = TypeConvertor.castToReference(value); // Reference
8367        } else if (name.equals("signature")) {
8368          this.getSignature().add(TypeConvertor.castToSignature(value));
8369        } else
8370          return super.setProperty(name, value);
8371        return value;
8372      }
8373
8374      @Override
8375      public Base makeProperty(int hash, String name) throws FHIRException {
8376        switch (hash) {
8377        case 3575610:  return getType();
8378        case 106437350:  return getParty();
8379        case 1073584312:  return addSignature(); 
8380        default: return super.makeProperty(hash, name);
8381        }
8382
8383      }
8384
8385      @Override
8386      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8387        switch (hash) {
8388        case 3575610: /*type*/ return new String[] {"Coding"};
8389        case 106437350: /*party*/ return new String[] {"Reference"};
8390        case 1073584312: /*signature*/ return new String[] {"Signature"};
8391        default: return super.getTypesForProperty(hash, name);
8392        }
8393
8394      }
8395
8396      @Override
8397      public Base addChild(String name) throws FHIRException {
8398        if (name.equals("type")) {
8399          this.type = new Coding();
8400          return this.type;
8401        }
8402        else if (name.equals("party")) {
8403          this.party = new Reference();
8404          return this.party;
8405        }
8406        else if (name.equals("signature")) {
8407          return addSignature();
8408        }
8409        else
8410          return super.addChild(name);
8411      }
8412
8413      public SignatoryComponent copy() {
8414        SignatoryComponent dst = new SignatoryComponent();
8415        copyValues(dst);
8416        return dst;
8417      }
8418
8419      public void copyValues(SignatoryComponent dst) {
8420        super.copyValues(dst);
8421        dst.type = type == null ? null : type.copy();
8422        dst.party = party == null ? null : party.copy();
8423        if (signature != null) {
8424          dst.signature = new ArrayList<Signature>();
8425          for (Signature i : signature)
8426            dst.signature.add(i.copy());
8427        };
8428      }
8429
8430      @Override
8431      public boolean equalsDeep(Base other_) {
8432        if (!super.equalsDeep(other_))
8433          return false;
8434        if (!(other_ instanceof SignatoryComponent))
8435          return false;
8436        SignatoryComponent o = (SignatoryComponent) other_;
8437        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
8438          ;
8439      }
8440
8441      @Override
8442      public boolean equalsShallow(Base other_) {
8443        if (!super.equalsShallow(other_))
8444          return false;
8445        if (!(other_ instanceof SignatoryComponent))
8446          return false;
8447        SignatoryComponent o = (SignatoryComponent) other_;
8448        return true;
8449      }
8450
8451      public boolean isEmpty() {
8452        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
8453      }
8454
8455  public String fhirType() {
8456    return "Contract.signer";
8457
8458  }
8459
8460  }
8461
8462    @Block()
8463    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8464        /**
8465         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
8466         */
8467        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8468        @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." )
8469        protected DataType content;
8470
8471        private static final long serialVersionUID = -1954179063L;
8472
8473    /**
8474     * Constructor
8475     */
8476      public FriendlyLanguageComponent() {
8477        super();
8478      }
8479
8480    /**
8481     * Constructor
8482     */
8483      public FriendlyLanguageComponent(DataType content) {
8484        super();
8485        this.setContent(content);
8486      }
8487
8488        /**
8489         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8490         */
8491        public DataType getContent() { 
8492          return this.content;
8493        }
8494
8495        /**
8496         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8497         */
8498        public Attachment getContentAttachment() throws FHIRException { 
8499          if (this.content == null)
8500            this.content = new Attachment();
8501          if (!(this.content instanceof Attachment))
8502            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8503          return (Attachment) this.content;
8504        }
8505
8506        public boolean hasContentAttachment() { 
8507          return this != null && this.content instanceof Attachment;
8508        }
8509
8510        /**
8511         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8512         */
8513        public Reference getContentReference() throws FHIRException { 
8514          if (this.content == null)
8515            this.content = new Reference();
8516          if (!(this.content instanceof Reference))
8517            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8518          return (Reference) this.content;
8519        }
8520
8521        public boolean hasContentReference() { 
8522          return this != null && this.content instanceof Reference;
8523        }
8524
8525        public boolean hasContent() { 
8526          return this.content != null && !this.content.isEmpty();
8527        }
8528
8529        /**
8530         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8531         */
8532        public FriendlyLanguageComponent setContent(DataType value) { 
8533          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8534            throw new Error("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
8535          this.content = value;
8536          return this;
8537        }
8538
8539        protected void listChildren(List<Property> children) {
8540          super.listChildren(children);
8541          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));
8542        }
8543
8544        @Override
8545        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8546          switch (_hash) {
8547          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);
8548          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);
8549          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
8550          case 1193747154: /*contentReference*/  return new Property("content[x]", "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);
8551          default: return super.getNamedProperty(_hash, _name, _checkValid);
8552          }
8553
8554        }
8555
8556      @Override
8557      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8558        switch (hash) {
8559        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // DataType
8560        default: return super.getProperty(hash, name, checkValid);
8561        }
8562
8563      }
8564
8565      @Override
8566      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8567        switch (hash) {
8568        case 951530617: // content
8569          this.content = TypeConvertor.castToType(value); // DataType
8570          return value;
8571        default: return super.setProperty(hash, name, value);
8572        }
8573
8574      }
8575
8576      @Override
8577      public Base setProperty(String name, Base value) throws FHIRException {
8578        if (name.equals("content[x]")) {
8579          this.content = TypeConvertor.castToType(value); // DataType
8580        } else
8581          return super.setProperty(name, value);
8582        return value;
8583      }
8584
8585      @Override
8586      public Base makeProperty(int hash, String name) throws FHIRException {
8587        switch (hash) {
8588        case 264548711:  return getContent();
8589        case 951530617:  return getContent();
8590        default: return super.makeProperty(hash, name);
8591        }
8592
8593      }
8594
8595      @Override
8596      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8597        switch (hash) {
8598        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8599        default: return super.getTypesForProperty(hash, name);
8600        }
8601
8602      }
8603
8604      @Override
8605      public Base addChild(String name) throws FHIRException {
8606        if (name.equals("contentAttachment")) {
8607          this.content = new Attachment();
8608          return this.content;
8609        }
8610        else if (name.equals("contentReference")) {
8611          this.content = new Reference();
8612          return this.content;
8613        }
8614        else
8615          return super.addChild(name);
8616      }
8617
8618      public FriendlyLanguageComponent copy() {
8619        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
8620        copyValues(dst);
8621        return dst;
8622      }
8623
8624      public void copyValues(FriendlyLanguageComponent dst) {
8625        super.copyValues(dst);
8626        dst.content = content == null ? null : content.copy();
8627      }
8628
8629      @Override
8630      public boolean equalsDeep(Base other_) {
8631        if (!super.equalsDeep(other_))
8632          return false;
8633        if (!(other_ instanceof FriendlyLanguageComponent))
8634          return false;
8635        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8636        return compareDeep(content, o.content, true);
8637      }
8638
8639      @Override
8640      public boolean equalsShallow(Base other_) {
8641        if (!super.equalsShallow(other_))
8642          return false;
8643        if (!(other_ instanceof FriendlyLanguageComponent))
8644          return false;
8645        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8646        return true;
8647      }
8648
8649      public boolean isEmpty() {
8650        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
8651      }
8652
8653  public String fhirType() {
8654    return "Contract.friendly";
8655
8656  }
8657
8658  }
8659
8660    @Block()
8661    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8662        /**
8663         * Contract legal text in human renderable form.
8664         */
8665        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8666        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
8667        protected DataType content;
8668
8669        private static final long serialVersionUID = -1954179063L;
8670
8671    /**
8672     * Constructor
8673     */
8674      public LegalLanguageComponent() {
8675        super();
8676      }
8677
8678    /**
8679     * Constructor
8680     */
8681      public LegalLanguageComponent(DataType content) {
8682        super();
8683        this.setContent(content);
8684      }
8685
8686        /**
8687         * @return {@link #content} (Contract legal text in human renderable form.)
8688         */
8689        public DataType getContent() { 
8690          return this.content;
8691        }
8692
8693        /**
8694         * @return {@link #content} (Contract legal text in human renderable form.)
8695         */
8696        public Attachment getContentAttachment() throws FHIRException { 
8697          if (this.content == null)
8698            this.content = new Attachment();
8699          if (!(this.content instanceof Attachment))
8700            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8701          return (Attachment) this.content;
8702        }
8703
8704        public boolean hasContentAttachment() { 
8705          return this != null && this.content instanceof Attachment;
8706        }
8707
8708        /**
8709         * @return {@link #content} (Contract legal text in human renderable form.)
8710         */
8711        public Reference getContentReference() throws FHIRException { 
8712          if (this.content == null)
8713            this.content = new Reference();
8714          if (!(this.content instanceof Reference))
8715            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8716          return (Reference) this.content;
8717        }
8718
8719        public boolean hasContentReference() { 
8720          return this != null && this.content instanceof Reference;
8721        }
8722
8723        public boolean hasContent() { 
8724          return this.content != null && !this.content.isEmpty();
8725        }
8726
8727        /**
8728         * @param value {@link #content} (Contract legal text in human renderable form.)
8729         */
8730        public LegalLanguageComponent setContent(DataType value) { 
8731          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8732            throw new Error("Not the right type for Contract.legal.content[x]: "+value.fhirType());
8733          this.content = value;
8734          return this;
8735        }
8736
8737        protected void listChildren(List<Property> children) {
8738          super.listChildren(children);
8739          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
8740        }
8741
8742        @Override
8743        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8744          switch (_hash) {
8745          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8746          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8747          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment", "Contract legal text in human renderable form.", 0, 1, content);
8748          case 1193747154: /*contentReference*/  return new Property("content[x]", "Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8749          default: return super.getNamedProperty(_hash, _name, _checkValid);
8750          }
8751
8752        }
8753
8754      @Override
8755      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8756        switch (hash) {
8757        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // DataType
8758        default: return super.getProperty(hash, name, checkValid);
8759        }
8760
8761      }
8762
8763      @Override
8764      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8765        switch (hash) {
8766        case 951530617: // content
8767          this.content = TypeConvertor.castToType(value); // DataType
8768          return value;
8769        default: return super.setProperty(hash, name, value);
8770        }
8771
8772      }
8773
8774      @Override
8775      public Base setProperty(String name, Base value) throws FHIRException {
8776        if (name.equals("content[x]")) {
8777          this.content = TypeConvertor.castToType(value); // DataType
8778        } else
8779          return super.setProperty(name, value);
8780        return value;
8781      }
8782
8783      @Override
8784      public Base makeProperty(int hash, String name) throws FHIRException {
8785        switch (hash) {
8786        case 264548711:  return getContent();
8787        case 951530617:  return getContent();
8788        default: return super.makeProperty(hash, name);
8789        }
8790
8791      }
8792
8793      @Override
8794      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8795        switch (hash) {
8796        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8797        default: return super.getTypesForProperty(hash, name);
8798        }
8799
8800      }
8801
8802      @Override
8803      public Base addChild(String name) throws FHIRException {
8804        if (name.equals("contentAttachment")) {
8805          this.content = new Attachment();
8806          return this.content;
8807        }
8808        else if (name.equals("contentReference")) {
8809          this.content = new Reference();
8810          return this.content;
8811        }
8812        else
8813          return super.addChild(name);
8814      }
8815
8816      public LegalLanguageComponent copy() {
8817        LegalLanguageComponent dst = new LegalLanguageComponent();
8818        copyValues(dst);
8819        return dst;
8820      }
8821
8822      public void copyValues(LegalLanguageComponent dst) {
8823        super.copyValues(dst);
8824        dst.content = content == null ? null : content.copy();
8825      }
8826
8827      @Override
8828      public boolean equalsDeep(Base other_) {
8829        if (!super.equalsDeep(other_))
8830          return false;
8831        if (!(other_ instanceof LegalLanguageComponent))
8832          return false;
8833        LegalLanguageComponent o = (LegalLanguageComponent) other_;
8834        return compareDeep(content, o.content, true);
8835      }
8836
8837      @Override
8838      public boolean equalsShallow(Base other_) {
8839        if (!super.equalsShallow(other_))
8840          return false;
8841        if (!(other_ instanceof LegalLanguageComponent))
8842          return false;
8843        LegalLanguageComponent o = (LegalLanguageComponent) other_;
8844        return true;
8845      }
8846
8847      public boolean isEmpty() {
8848        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
8849      }
8850
8851  public String fhirType() {
8852    return "Contract.legal";
8853
8854  }
8855
8856  }
8857
8858    @Block()
8859    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8860        /**
8861         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
8862         */
8863        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
8864        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
8865        protected DataType content;
8866
8867        private static final long serialVersionUID = -1954179063L;
8868
8869    /**
8870     * Constructor
8871     */
8872      public ComputableLanguageComponent() {
8873        super();
8874      }
8875
8876    /**
8877     * Constructor
8878     */
8879      public ComputableLanguageComponent(DataType content) {
8880        super();
8881        this.setContent(content);
8882      }
8883
8884        /**
8885         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8886         */
8887        public DataType getContent() { 
8888          return this.content;
8889        }
8890
8891        /**
8892         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
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} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
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} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8927         */
8928        public ComputableLanguageComponent setContent(DataType value) { 
8929          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8930            throw new Error("Not the right type for Contract.rule.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(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 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(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
8944          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);
8945          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
8946          case 1193747154: /*contentReference*/  return new Property("content[x]", "Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 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}; // DataType
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 = TypeConvertor.castToType(value); // DataType
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 = TypeConvertor.castToType(value); // DataType
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