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