001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import java.math.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.r5.model.Enumerations.*;
060import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
061import org.hl7.fhir.exceptions.FHIRException;
062import org.hl7.fhir.instance.model.api.ICompositeType;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.ChildOrder;
068import ca.uhn.fhir.model.api.annotation.Description;
069import ca.uhn.fhir.model.api.annotation.Block;
070
071/**
072 * Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.
073 */
074@ResourceDef(name="Contract", profile="http://hl7.org/fhir/StructureDefinition/Contract")
075public class Contract extends DomainResource {
076
077    public enum ContractResourcePublicationStatusCodes {
078        /**
079         * 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.
080         */
081        AMENDED, 
082        /**
083         * 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.
084         */
085        APPENDED, 
086        /**
087         * 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.
088         */
089        CANCELLED, 
090        /**
091         * 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.
092         */
093        DISPUTED, 
094        /**
095         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
096         */
097        ENTEREDINERROR, 
098        /**
099         * 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.
100         */
101        EXECUTABLE, 
102        /**
103         * 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.
104         */
105        EXECUTED, 
106        /**
107         * 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.
108         */
109        NEGOTIABLE, 
110        /**
111         * 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.
112         */
113        OFFERED, 
114        /**
115         * 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.
116         */
117        POLICY, 
118        /**
119         *  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.
120         */
121        REJECTED, 
122        /**
123         * 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.
124         */
125        RENEWED, 
126        /**
127         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
128         */
129        REVOKED, 
130        /**
131         * 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.
132         */
133        RESOLVED, 
134        /**
135         * 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.
136         */
137        TERMINATED, 
138        /**
139         * added to help the parsers with the generic types
140         */
141        NULL;
142        public static ContractResourcePublicationStatusCodes fromCode(String codeString) throws FHIRException {
143            if (codeString == null || "".equals(codeString))
144                return null;
145        if ("amended".equals(codeString))
146          return AMENDED;
147        if ("appended".equals(codeString))
148          return APPENDED;
149        if ("cancelled".equals(codeString))
150          return CANCELLED;
151        if ("disputed".equals(codeString))
152          return DISPUTED;
153        if ("entered-in-error".equals(codeString))
154          return ENTEREDINERROR;
155        if ("executable".equals(codeString))
156          return EXECUTABLE;
157        if ("executed".equals(codeString))
158          return EXECUTED;
159        if ("negotiable".equals(codeString))
160          return NEGOTIABLE;
161        if ("offered".equals(codeString))
162          return OFFERED;
163        if ("policy".equals(codeString))
164          return POLICY;
165        if ("rejected".equals(codeString))
166          return REJECTED;
167        if ("renewed".equals(codeString))
168          return RENEWED;
169        if ("revoked".equals(codeString))
170          return REVOKED;
171        if ("resolved".equals(codeString))
172          return RESOLVED;
173        if ("terminated".equals(codeString))
174          return TERMINATED;
175        if (Configuration.isAcceptInvalidEnums())
176          return null;
177        else
178          throw new FHIRException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
179        }
180        public String toCode() {
181          switch (this) {
182            case AMENDED: return "amended";
183            case APPENDED: return "appended";
184            case CANCELLED: return "cancelled";
185            case DISPUTED: return "disputed";
186            case ENTEREDINERROR: return "entered-in-error";
187            case EXECUTABLE: return "executable";
188            case EXECUTED: return "executed";
189            case NEGOTIABLE: return "negotiable";
190            case OFFERED: return "offered";
191            case POLICY: return "policy";
192            case REJECTED: return "rejected";
193            case RENEWED: return "renewed";
194            case REVOKED: return "revoked";
195            case RESOLVED: return "resolved";
196            case TERMINATED: return "terminated";
197            default: return "?";
198          }
199        }
200        public String getSystem() {
201          switch (this) {
202            case AMENDED: return "http://hl7.org/fhir/contract-publicationstatus";
203            case APPENDED: return "http://hl7.org/fhir/contract-publicationstatus";
204            case CANCELLED: return "http://hl7.org/fhir/contract-publicationstatus";
205            case DISPUTED: return "http://hl7.org/fhir/contract-publicationstatus";
206            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-publicationstatus";
207            case EXECUTABLE: return "http://hl7.org/fhir/contract-publicationstatus";
208            case EXECUTED: return "http://hl7.org/fhir/contract-publicationstatus";
209            case NEGOTIABLE: return "http://hl7.org/fhir/contract-publicationstatus";
210            case OFFERED: return "http://hl7.org/fhir/contract-publicationstatus";
211            case POLICY: return "http://hl7.org/fhir/contract-publicationstatus";
212            case REJECTED: return "http://hl7.org/fhir/contract-publicationstatus";
213            case RENEWED: return "http://hl7.org/fhir/contract-publicationstatus";
214            case REVOKED: return "http://hl7.org/fhir/contract-publicationstatus";
215            case RESOLVED: return "http://hl7.org/fhir/contract-publicationstatus";
216            case TERMINATED: return "http://hl7.org/fhir/contract-publicationstatus";
217            default: return "?";
218          }
219        }
220        public String getDefinition() {
221          switch (this) {
222            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.";
223            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.";
224            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.";
225            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.";
226            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
227            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.";
228            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.";
229            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.";
230            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.";
231            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.";
232            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.";
233            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.";
234            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.";
235            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.";
236            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.";
237            default: return "?";
238          }
239        }
240        public String getDisplay() {
241          switch (this) {
242            case AMENDED: return "Amended";
243            case APPENDED: return "Appended";
244            case CANCELLED: return "Cancelled";
245            case DISPUTED: return "Disputed";
246            case ENTEREDINERROR: return "Entered in Error";
247            case EXECUTABLE: return "Executable";
248            case EXECUTED: return "Executed";
249            case NEGOTIABLE: return "Negotiable";
250            case OFFERED: return "Offered";
251            case POLICY: return "Policy";
252            case REJECTED: return "Rejected";
253            case RENEWED: return "Renewed";
254            case REVOKED: return "Revoked";
255            case RESOLVED: return "Resolved";
256            case TERMINATED: return "Terminated";
257            default: return "?";
258          }
259        }
260    }
261
262  public static class ContractResourcePublicationStatusCodesEnumFactory implements EnumFactory<ContractResourcePublicationStatusCodes> {
263    public ContractResourcePublicationStatusCodes fromCode(String codeString) throws IllegalArgumentException {
264      if (codeString == null || "".equals(codeString))
265            if (codeString == null || "".equals(codeString))
266                return null;
267        if ("amended".equals(codeString))
268          return ContractResourcePublicationStatusCodes.AMENDED;
269        if ("appended".equals(codeString))
270          return ContractResourcePublicationStatusCodes.APPENDED;
271        if ("cancelled".equals(codeString))
272          return ContractResourcePublicationStatusCodes.CANCELLED;
273        if ("disputed".equals(codeString))
274          return ContractResourcePublicationStatusCodes.DISPUTED;
275        if ("entered-in-error".equals(codeString))
276          return ContractResourcePublicationStatusCodes.ENTEREDINERROR;
277        if ("executable".equals(codeString))
278          return ContractResourcePublicationStatusCodes.EXECUTABLE;
279        if ("executed".equals(codeString))
280          return ContractResourcePublicationStatusCodes.EXECUTED;
281        if ("negotiable".equals(codeString))
282          return ContractResourcePublicationStatusCodes.NEGOTIABLE;
283        if ("offered".equals(codeString))
284          return ContractResourcePublicationStatusCodes.OFFERED;
285        if ("policy".equals(codeString))
286          return ContractResourcePublicationStatusCodes.POLICY;
287        if ("rejected".equals(codeString))
288          return ContractResourcePublicationStatusCodes.REJECTED;
289        if ("renewed".equals(codeString))
290          return ContractResourcePublicationStatusCodes.RENEWED;
291        if ("revoked".equals(codeString))
292          return ContractResourcePublicationStatusCodes.REVOKED;
293        if ("resolved".equals(codeString))
294          return ContractResourcePublicationStatusCodes.RESOLVED;
295        if ("terminated".equals(codeString))
296          return ContractResourcePublicationStatusCodes.TERMINATED;
297        throw new IllegalArgumentException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
298        }
299        public Enumeration<ContractResourcePublicationStatusCodes> fromType(Base code) throws FHIRException {
300          if (code == null)
301            return null;
302          if (code.isEmpty())
303            return new Enumeration<ContractResourcePublicationStatusCodes>(this);
304          String codeString = ((PrimitiveType) code).asStringValue();
305          if (codeString == null || "".equals(codeString))
306            return null;
307        if ("amended".equals(codeString))
308          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.AMENDED);
309        if ("appended".equals(codeString))
310          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.APPENDED);
311        if ("cancelled".equals(codeString))
312          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.CANCELLED);
313        if ("disputed".equals(codeString))
314          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.DISPUTED);
315        if ("entered-in-error".equals(codeString))
316          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.ENTEREDINERROR);
317        if ("executable".equals(codeString))
318          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.EXECUTABLE);
319        if ("executed".equals(codeString))
320          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.EXECUTED);
321        if ("negotiable".equals(codeString))
322          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.NEGOTIABLE);
323        if ("offered".equals(codeString))
324          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.OFFERED);
325        if ("policy".equals(codeString))
326          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.POLICY);
327        if ("rejected".equals(codeString))
328          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.REJECTED);
329        if ("renewed".equals(codeString))
330          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.RENEWED);
331        if ("revoked".equals(codeString))
332          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.REVOKED);
333        if ("resolved".equals(codeString))
334          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.RESOLVED);
335        if ("terminated".equals(codeString))
336          return new Enumeration<ContractResourcePublicationStatusCodes>(this, ContractResourcePublicationStatusCodes.TERMINATED);
337        throw new FHIRException("Unknown ContractResourcePublicationStatusCodes code '"+codeString+"'");
338        }
339    public String toCode(ContractResourcePublicationStatusCodes code) {
340      if (code == ContractResourcePublicationStatusCodes.AMENDED)
341        return "amended";
342      if (code == ContractResourcePublicationStatusCodes.APPENDED)
343        return "appended";
344      if (code == ContractResourcePublicationStatusCodes.CANCELLED)
345        return "cancelled";
346      if (code == ContractResourcePublicationStatusCodes.DISPUTED)
347        return "disputed";
348      if (code == ContractResourcePublicationStatusCodes.ENTEREDINERROR)
349        return "entered-in-error";
350      if (code == ContractResourcePublicationStatusCodes.EXECUTABLE)
351        return "executable";
352      if (code == ContractResourcePublicationStatusCodes.EXECUTED)
353        return "executed";
354      if (code == ContractResourcePublicationStatusCodes.NEGOTIABLE)
355        return "negotiable";
356      if (code == ContractResourcePublicationStatusCodes.OFFERED)
357        return "offered";
358      if (code == ContractResourcePublicationStatusCodes.POLICY)
359        return "policy";
360      if (code == ContractResourcePublicationStatusCodes.REJECTED)
361        return "rejected";
362      if (code == ContractResourcePublicationStatusCodes.RENEWED)
363        return "renewed";
364      if (code == ContractResourcePublicationStatusCodes.REVOKED)
365        return "revoked";
366      if (code == ContractResourcePublicationStatusCodes.RESOLVED)
367        return "resolved";
368      if (code == ContractResourcePublicationStatusCodes.TERMINATED)
369        return "terminated";
370      return "?";
371      }
372    public String toSystem(ContractResourcePublicationStatusCodes code) {
373      return code.getSystem();
374      }
375    }
376
377    public enum ContractResourceStatusCodes {
378        /**
379         * 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.
380         */
381        AMENDED, 
382        /**
383         * 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.
384         */
385        APPENDED, 
386        /**
387         * 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.
388         */
389        CANCELLED, 
390        /**
391         * 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.
392         */
393        DISPUTED, 
394        /**
395         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
396         */
397        ENTEREDINERROR, 
398        /**
399         * 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.
400         */
401        EXECUTABLE, 
402        /**
403         * 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.
404         */
405        EXECUTED, 
406        /**
407         * 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.
408         */
409        NEGOTIABLE, 
410        /**
411         * 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.
412         */
413        OFFERED, 
414        /**
415         * 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.
416         */
417        POLICY, 
418        /**
419         *  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.
420         */
421        REJECTED, 
422        /**
423         * 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.
424         */
425        RENEWED, 
426        /**
427         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
428         */
429        REVOKED, 
430        /**
431         * 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.
432         */
433        RESOLVED, 
434        /**
435         * 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.
436         */
437        TERMINATED, 
438        /**
439         * added to help the parsers with the generic types
440         */
441        NULL;
442        public static ContractResourceStatusCodes fromCode(String codeString) throws FHIRException {
443            if (codeString == null || "".equals(codeString))
444                return null;
445        if ("amended".equals(codeString))
446          return AMENDED;
447        if ("appended".equals(codeString))
448          return APPENDED;
449        if ("cancelled".equals(codeString))
450          return CANCELLED;
451        if ("disputed".equals(codeString))
452          return DISPUTED;
453        if ("entered-in-error".equals(codeString))
454          return ENTEREDINERROR;
455        if ("executable".equals(codeString))
456          return EXECUTABLE;
457        if ("executed".equals(codeString))
458          return EXECUTED;
459        if ("negotiable".equals(codeString))
460          return NEGOTIABLE;
461        if ("offered".equals(codeString))
462          return OFFERED;
463        if ("policy".equals(codeString))
464          return POLICY;
465        if ("rejected".equals(codeString))
466          return REJECTED;
467        if ("renewed".equals(codeString))
468          return RENEWED;
469        if ("revoked".equals(codeString))
470          return REVOKED;
471        if ("resolved".equals(codeString))
472          return RESOLVED;
473        if ("terminated".equals(codeString))
474          return TERMINATED;
475        if (Configuration.isAcceptInvalidEnums())
476          return null;
477        else
478          throw new FHIRException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
479        }
480        public String toCode() {
481          switch (this) {
482            case AMENDED: return "amended";
483            case APPENDED: return "appended";
484            case CANCELLED: return "cancelled";
485            case DISPUTED: return "disputed";
486            case ENTEREDINERROR: return "entered-in-error";
487            case EXECUTABLE: return "executable";
488            case EXECUTED: return "executed";
489            case NEGOTIABLE: return "negotiable";
490            case OFFERED: return "offered";
491            case POLICY: return "policy";
492            case REJECTED: return "rejected";
493            case RENEWED: return "renewed";
494            case REVOKED: return "revoked";
495            case RESOLVED: return "resolved";
496            case TERMINATED: return "terminated";
497            default: return "?";
498          }
499        }
500        public String getSystem() {
501          switch (this) {
502            case AMENDED: return "http://hl7.org/fhir/contract-status";
503            case APPENDED: return "http://hl7.org/fhir/contract-status";
504            case CANCELLED: return "http://hl7.org/fhir/contract-status";
505            case DISPUTED: return "http://hl7.org/fhir/contract-status";
506            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
507            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
508            case EXECUTED: return "http://hl7.org/fhir/contract-status";
509            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
510            case OFFERED: return "http://hl7.org/fhir/contract-status";
511            case POLICY: return "http://hl7.org/fhir/contract-status";
512            case REJECTED: return "http://hl7.org/fhir/contract-status";
513            case RENEWED: return "http://hl7.org/fhir/contract-status";
514            case REVOKED: return "http://hl7.org/fhir/contract-status";
515            case RESOLVED: return "http://hl7.org/fhir/contract-status";
516            case TERMINATED: return "http://hl7.org/fhir/contract-status";
517            default: return "?";
518          }
519        }
520        public String getDefinition() {
521          switch (this) {
522            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.";
523            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.";
524            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.";
525            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.";
526            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
527            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.";
528            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.";
529            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.";
530            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.";
531            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.";
532            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.";
533            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.";
534            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.";
535            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.";
536            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.";
537            default: return "?";
538          }
539        }
540        public String getDisplay() {
541          switch (this) {
542            case AMENDED: return "Amended";
543            case APPENDED: return "Appended";
544            case CANCELLED: return "Cancelled";
545            case DISPUTED: return "Disputed";
546            case ENTEREDINERROR: return "Entered in Error";
547            case EXECUTABLE: return "Executable";
548            case EXECUTED: return "Executed";
549            case NEGOTIABLE: return "Negotiable";
550            case OFFERED: return "Offered";
551            case POLICY: return "Policy";
552            case REJECTED: return "Rejected";
553            case RENEWED: return "Renewed";
554            case REVOKED: return "Revoked";
555            case RESOLVED: return "Resolved";
556            case TERMINATED: return "Terminated";
557            default: return "?";
558          }
559        }
560    }
561
562  public static class ContractResourceStatusCodesEnumFactory implements EnumFactory<ContractResourceStatusCodes> {
563    public ContractResourceStatusCodes fromCode(String codeString) throws IllegalArgumentException {
564      if (codeString == null || "".equals(codeString))
565            if (codeString == null || "".equals(codeString))
566                return null;
567        if ("amended".equals(codeString))
568          return ContractResourceStatusCodes.AMENDED;
569        if ("appended".equals(codeString))
570          return ContractResourceStatusCodes.APPENDED;
571        if ("cancelled".equals(codeString))
572          return ContractResourceStatusCodes.CANCELLED;
573        if ("disputed".equals(codeString))
574          return ContractResourceStatusCodes.DISPUTED;
575        if ("entered-in-error".equals(codeString))
576          return ContractResourceStatusCodes.ENTEREDINERROR;
577        if ("executable".equals(codeString))
578          return ContractResourceStatusCodes.EXECUTABLE;
579        if ("executed".equals(codeString))
580          return ContractResourceStatusCodes.EXECUTED;
581        if ("negotiable".equals(codeString))
582          return ContractResourceStatusCodes.NEGOTIABLE;
583        if ("offered".equals(codeString))
584          return ContractResourceStatusCodes.OFFERED;
585        if ("policy".equals(codeString))
586          return ContractResourceStatusCodes.POLICY;
587        if ("rejected".equals(codeString))
588          return ContractResourceStatusCodes.REJECTED;
589        if ("renewed".equals(codeString))
590          return ContractResourceStatusCodes.RENEWED;
591        if ("revoked".equals(codeString))
592          return ContractResourceStatusCodes.REVOKED;
593        if ("resolved".equals(codeString))
594          return ContractResourceStatusCodes.RESOLVED;
595        if ("terminated".equals(codeString))
596          return ContractResourceStatusCodes.TERMINATED;
597        throw new IllegalArgumentException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
598        }
599        public Enumeration<ContractResourceStatusCodes> fromType(Base code) throws FHIRException {
600          if (code == null)
601            return null;
602          if (code.isEmpty())
603            return new Enumeration<ContractResourceStatusCodes>(this);
604          String codeString = ((PrimitiveType) code).asStringValue();
605          if (codeString == null || "".equals(codeString))
606            return null;
607        if ("amended".equals(codeString))
608          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.AMENDED);
609        if ("appended".equals(codeString))
610          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.APPENDED);
611        if ("cancelled".equals(codeString))
612          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.CANCELLED);
613        if ("disputed".equals(codeString))
614          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.DISPUTED);
615        if ("entered-in-error".equals(codeString))
616          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.ENTEREDINERROR);
617        if ("executable".equals(codeString))
618          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.EXECUTABLE);
619        if ("executed".equals(codeString))
620          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.EXECUTED);
621        if ("negotiable".equals(codeString))
622          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.NEGOTIABLE);
623        if ("offered".equals(codeString))
624          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.OFFERED);
625        if ("policy".equals(codeString))
626          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.POLICY);
627        if ("rejected".equals(codeString))
628          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.REJECTED);
629        if ("renewed".equals(codeString))
630          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.RENEWED);
631        if ("revoked".equals(codeString))
632          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.REVOKED);
633        if ("resolved".equals(codeString))
634          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.RESOLVED);
635        if ("terminated".equals(codeString))
636          return new Enumeration<ContractResourceStatusCodes>(this, ContractResourceStatusCodes.TERMINATED);
637        throw new FHIRException("Unknown ContractResourceStatusCodes code '"+codeString+"'");
638        }
639    public String toCode(ContractResourceStatusCodes code) {
640      if (code == ContractResourceStatusCodes.AMENDED)
641        return "amended";
642      if (code == ContractResourceStatusCodes.APPENDED)
643        return "appended";
644      if (code == ContractResourceStatusCodes.CANCELLED)
645        return "cancelled";
646      if (code == ContractResourceStatusCodes.DISPUTED)
647        return "disputed";
648      if (code == ContractResourceStatusCodes.ENTEREDINERROR)
649        return "entered-in-error";
650      if (code == ContractResourceStatusCodes.EXECUTABLE)
651        return "executable";
652      if (code == ContractResourceStatusCodes.EXECUTED)
653        return "executed";
654      if (code == ContractResourceStatusCodes.NEGOTIABLE)
655        return "negotiable";
656      if (code == ContractResourceStatusCodes.OFFERED)
657        return "offered";
658      if (code == ContractResourceStatusCodes.POLICY)
659        return "policy";
660      if (code == ContractResourceStatusCodes.REJECTED)
661        return "rejected";
662      if (code == ContractResourceStatusCodes.RENEWED)
663        return "renewed";
664      if (code == ContractResourceStatusCodes.REVOKED)
665        return "revoked";
666      if (code == ContractResourceStatusCodes.RESOLVED)
667        return "resolved";
668      if (code == ContractResourceStatusCodes.TERMINATED)
669        return "terminated";
670      return "?";
671      }
672    public String toSystem(ContractResourceStatusCodes code) {
673      return code.getSystem();
674      }
675    }
676
677    @Block()
678    public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
679        /**
680         * 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.
681         */
682        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
683        @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." )
684        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-type")
685        protected CodeableConcept type;
686
687        /**
688         * Detailed Precusory content type.
689         */
690        @Child(name = "subType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
691        @Description(shortDefinition="Detailed Content Type Definition", formalDefinition="Detailed Precusory content type." )
692        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-subtype")
693        protected CodeableConcept subType;
694
695        /**
696         * The  individual or organization that published the Contract precursor content.
697         */
698        @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
699        @Description(shortDefinition="Publisher Entity", formalDefinition="The  individual or organization that published the Contract precursor content." )
700        protected Reference publisher;
701
702        /**
703         * 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.
704         */
705        @Child(name = "publicationDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
706        @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." )
707        protected DateTimeType publicationDate;
708
709        /**
710         * amended | appended | cancelled | disputed | entered-in-error | executable +.
711         */
712        @Child(name = "publicationStatus", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=false)
713        @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +", formalDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +." )
714        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-publicationstatus")
715        protected Enumeration<ContractResourcePublicationStatusCodes> publicationStatus;
716
717        /**
718         * A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
719         */
720        @Child(name = "copyright", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=false)
721        @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." )
722        protected MarkdownType copyright;
723
724        private static final long serialVersionUID = 306178803L;
725
726    /**
727     * Constructor
728     */
729      public ContentDefinitionComponent() {
730        super();
731      }
732
733    /**
734     * Constructor
735     */
736      public ContentDefinitionComponent(CodeableConcept type, ContractResourcePublicationStatusCodes publicationStatus) {
737        super();
738        this.setType(type);
739        this.setPublicationStatus(publicationStatus);
740      }
741
742        /**
743         * @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.)
744         */
745        public CodeableConcept getType() { 
746          if (this.type == null)
747            if (Configuration.errorOnAutoCreate())
748              throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
749            else if (Configuration.doAutoCreate())
750              this.type = new CodeableConcept(); // cc
751          return this.type;
752        }
753
754        public boolean hasType() { 
755          return this.type != null && !this.type.isEmpty();
756        }
757
758        /**
759         * @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.)
760         */
761        public ContentDefinitionComponent setType(CodeableConcept value) { 
762          this.type = value;
763          return this;
764        }
765
766        /**
767         * @return {@link #subType} (Detailed Precusory content type.)
768         */
769        public CodeableConcept getSubType() { 
770          if (this.subType == null)
771            if (Configuration.errorOnAutoCreate())
772              throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
773            else if (Configuration.doAutoCreate())
774              this.subType = new CodeableConcept(); // cc
775          return this.subType;
776        }
777
778        public boolean hasSubType() { 
779          return this.subType != null && !this.subType.isEmpty();
780        }
781
782        /**
783         * @param value {@link #subType} (Detailed Precusory content type.)
784         */
785        public ContentDefinitionComponent setSubType(CodeableConcept value) { 
786          this.subType = value;
787          return this;
788        }
789
790        /**
791         * @return {@link #publisher} (The  individual or organization that published the Contract precursor content.)
792         */
793        public Reference getPublisher() { 
794          if (this.publisher == null)
795            if (Configuration.errorOnAutoCreate())
796              throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
797            else if (Configuration.doAutoCreate())
798              this.publisher = new Reference(); // cc
799          return this.publisher;
800        }
801
802        public boolean hasPublisher() { 
803          return this.publisher != null && !this.publisher.isEmpty();
804        }
805
806        /**
807         * @param value {@link #publisher} (The  individual or organization that published the Contract precursor content.)
808         */
809        public ContentDefinitionComponent setPublisher(Reference value) { 
810          this.publisher = value;
811          return this;
812        }
813
814        /**
815         * @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
816         */
817        public DateTimeType getPublicationDateElement() { 
818          if (this.publicationDate == null)
819            if (Configuration.errorOnAutoCreate())
820              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
821            else if (Configuration.doAutoCreate())
822              this.publicationDate = new DateTimeType(); // bb
823          return this.publicationDate;
824        }
825
826        public boolean hasPublicationDateElement() { 
827          return this.publicationDate != null && !this.publicationDate.isEmpty();
828        }
829
830        public boolean hasPublicationDate() { 
831          return this.publicationDate != null && !this.publicationDate.isEmpty();
832        }
833
834        /**
835         * @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
836         */
837        public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) { 
838          this.publicationDate = value;
839          return this;
840        }
841
842        /**
843         * @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.
844         */
845        public Date getPublicationDate() { 
846          return this.publicationDate == null ? null : this.publicationDate.getValue();
847        }
848
849        /**
850         * @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.
851         */
852        public ContentDefinitionComponent setPublicationDate(Date value) { 
853          if (value == null)
854            this.publicationDate = null;
855          else {
856            if (this.publicationDate == null)
857              this.publicationDate = new DateTimeType();
858            this.publicationDate.setValue(value);
859          }
860          return this;
861        }
862
863        /**
864         * @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
865         */
866        public Enumeration<ContractResourcePublicationStatusCodes> getPublicationStatusElement() { 
867          if (this.publicationStatus == null)
868            if (Configuration.errorOnAutoCreate())
869              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
870            else if (Configuration.doAutoCreate())
871              this.publicationStatus = new Enumeration<ContractResourcePublicationStatusCodes>(new ContractResourcePublicationStatusCodesEnumFactory()); // bb
872          return this.publicationStatus;
873        }
874
875        public boolean hasPublicationStatusElement() { 
876          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
877        }
878
879        public boolean hasPublicationStatus() { 
880          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
881        }
882
883        /**
884         * @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
885         */
886        public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractResourcePublicationStatusCodes> value) { 
887          this.publicationStatus = value;
888          return this;
889        }
890
891        /**
892         * @return amended | appended | cancelled | disputed | entered-in-error | executable +.
893         */
894        public ContractResourcePublicationStatusCodes getPublicationStatus() { 
895          return this.publicationStatus == null ? null : this.publicationStatus.getValue();
896        }
897
898        /**
899         * @param value amended | appended | cancelled | disputed | entered-in-error | executable +.
900         */
901        public ContentDefinitionComponent setPublicationStatus(ContractResourcePublicationStatusCodes value) { 
902            if (this.publicationStatus == null)
903              this.publicationStatus = new Enumeration<ContractResourcePublicationStatusCodes>(new ContractResourcePublicationStatusCodesEnumFactory());
904            this.publicationStatus.setValue(value);
905          return this;
906        }
907
908        /**
909         * @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
910         */
911        public MarkdownType getCopyrightElement() { 
912          if (this.copyright == null)
913            if (Configuration.errorOnAutoCreate())
914              throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
915            else if (Configuration.doAutoCreate())
916              this.copyright = new MarkdownType(); // bb
917          return this.copyright;
918        }
919
920        public boolean hasCopyrightElement() { 
921          return this.copyright != null && !this.copyright.isEmpty();
922        }
923
924        public boolean hasCopyright() { 
925          return this.copyright != null && !this.copyright.isEmpty();
926        }
927
928        /**
929         * @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
930         */
931        public ContentDefinitionComponent setCopyrightElement(MarkdownType value) { 
932          this.copyright = value;
933          return this;
934        }
935
936        /**
937         * @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.
938         */
939        public String getCopyright() { 
940          return this.copyright == null ? null : this.copyright.getValue();
941        }
942
943        /**
944         * @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.
945         */
946        public ContentDefinitionComponent setCopyright(String value) { 
947          if (value == null)
948            this.copyright = null;
949          else {
950            if (this.copyright == null)
951              this.copyright = new MarkdownType();
952            this.copyright.setValue(value);
953          }
954          return this;
955        }
956
957        protected void listChildren(List<Property> children) {
958          super.listChildren(children);
959          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));
960          children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
961          children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
962          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));
963          children.add(new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus));
964          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));
965        }
966
967        @Override
968        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
969          switch (_hash) {
970          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);
971          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType);
972          case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
973          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);
974          case 616500542: /*publicationStatus*/  return new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus);
975          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);
976          default: return super.getNamedProperty(_hash, _name, _checkValid);
977          }
978
979        }
980
981      @Override
982      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
983        switch (hash) {
984        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
985        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
986        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
987        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateTimeType
988        case 616500542: /*publicationStatus*/ return this.publicationStatus == null ? new Base[0] : new Base[] {this.publicationStatus}; // Enumeration<ContractResourcePublicationStatusCodes>
989        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
990        default: return super.getProperty(hash, name, checkValid);
991        }
992
993      }
994
995      @Override
996      public Base setProperty(int hash, String name, Base value) throws FHIRException {
997        switch (hash) {
998        case 3575610: // type
999          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1000          return value;
1001        case -1868521062: // subType
1002          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1003          return value;
1004        case 1447404028: // publisher
1005          this.publisher = TypeConvertor.castToReference(value); // Reference
1006          return value;
1007        case 1470566394: // publicationDate
1008          this.publicationDate = TypeConvertor.castToDateTime(value); // DateTimeType
1009          return value;
1010        case 616500542: // publicationStatus
1011          value = new ContractResourcePublicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1012          this.publicationStatus = (Enumeration) value; // Enumeration<ContractResourcePublicationStatusCodes>
1013          return value;
1014        case 1522889671: // copyright
1015          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
1016          return value;
1017        default: return super.setProperty(hash, name, value);
1018        }
1019
1020      }
1021
1022      @Override
1023      public Base setProperty(String name, Base value) throws FHIRException {
1024        if (name.equals("type")) {
1025          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1026        } else if (name.equals("subType")) {
1027          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1028        } else if (name.equals("publisher")) {
1029          this.publisher = TypeConvertor.castToReference(value); // Reference
1030        } else if (name.equals("publicationDate")) {
1031          this.publicationDate = TypeConvertor.castToDateTime(value); // DateTimeType
1032        } else if (name.equals("publicationStatus")) {
1033          value = new ContractResourcePublicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1034          this.publicationStatus = (Enumeration) value; // Enumeration<ContractResourcePublicationStatusCodes>
1035        } else if (name.equals("copyright")) {
1036          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
1037        } else
1038          return super.setProperty(name, value);
1039        return value;
1040      }
1041
1042      @Override
1043      public Base makeProperty(int hash, String name) throws FHIRException {
1044        switch (hash) {
1045        case 3575610:  return getType();
1046        case -1868521062:  return getSubType();
1047        case 1447404028:  return getPublisher();
1048        case 1470566394:  return getPublicationDateElement();
1049        case 616500542:  return getPublicationStatusElement();
1050        case 1522889671:  return getCopyrightElement();
1051        default: return super.makeProperty(hash, name);
1052        }
1053
1054      }
1055
1056      @Override
1057      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1058        switch (hash) {
1059        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1060        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1061        case 1447404028: /*publisher*/ return new String[] {"Reference"};
1062        case 1470566394: /*publicationDate*/ return new String[] {"dateTime"};
1063        case 616500542: /*publicationStatus*/ return new String[] {"code"};
1064        case 1522889671: /*copyright*/ return new String[] {"markdown"};
1065        default: return super.getTypesForProperty(hash, name);
1066        }
1067
1068      }
1069
1070      @Override
1071      public Base addChild(String name) throws FHIRException {
1072        if (name.equals("type")) {
1073          this.type = new CodeableConcept();
1074          return this.type;
1075        }
1076        else if (name.equals("subType")) {
1077          this.subType = new CodeableConcept();
1078          return this.subType;
1079        }
1080        else if (name.equals("publisher")) {
1081          this.publisher = new Reference();
1082          return this.publisher;
1083        }
1084        else if (name.equals("publicationDate")) {
1085          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.publicationDate");
1086        }
1087        else if (name.equals("publicationStatus")) {
1088          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.publicationStatus");
1089        }
1090        else if (name.equals("copyright")) {
1091          throw new FHIRException("Cannot call addChild on a primitive type Contract.contentDefinition.copyright");
1092        }
1093        else
1094          return super.addChild(name);
1095      }
1096
1097      public ContentDefinitionComponent copy() {
1098        ContentDefinitionComponent dst = new ContentDefinitionComponent();
1099        copyValues(dst);
1100        return dst;
1101      }
1102
1103      public void copyValues(ContentDefinitionComponent dst) {
1104        super.copyValues(dst);
1105        dst.type = type == null ? null : type.copy();
1106        dst.subType = subType == null ? null : subType.copy();
1107        dst.publisher = publisher == null ? null : publisher.copy();
1108        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1109        dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1110        dst.copyright = copyright == null ? null : copyright.copy();
1111      }
1112
1113      @Override
1114      public boolean equalsDeep(Base other_) {
1115        if (!super.equalsDeep(other_))
1116          return false;
1117        if (!(other_ instanceof ContentDefinitionComponent))
1118          return false;
1119        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1120        return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(publisher, o.publisher, true)
1121           && compareDeep(publicationDate, o.publicationDate, true) && compareDeep(publicationStatus, o.publicationStatus, true)
1122           && compareDeep(copyright, o.copyright, true);
1123      }
1124
1125      @Override
1126      public boolean equalsShallow(Base other_) {
1127        if (!super.equalsShallow(other_))
1128          return false;
1129        if (!(other_ instanceof ContentDefinitionComponent))
1130          return false;
1131        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1132        return compareValues(publicationDate, o.publicationDate, true) && compareValues(publicationStatus, o.publicationStatus, true)
1133           && compareValues(copyright, o.copyright, true);
1134      }
1135
1136      public boolean isEmpty() {
1137        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher
1138          , publicationDate, publicationStatus, copyright);
1139      }
1140
1141  public String fhirType() {
1142    return "Contract.contentDefinition";
1143
1144  }
1145
1146  }
1147
1148    @Block()
1149    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1150        /**
1151         * Unique identifier for this particular Contract Provision.
1152         */
1153        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1154        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1155        protected Identifier identifier;
1156
1157        /**
1158         * When this Contract Provision was issued.
1159         */
1160        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1161        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1162        protected DateTimeType issued;
1163
1164        /**
1165         * Relevant time or time-period when this Contract Provision is applicable.
1166         */
1167        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1168        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1169        protected Period applies;
1170
1171        /**
1172         * The entity that the term applies to.
1173         */
1174        @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=4, min=0, max=1, modifier=false, summary=false)
1175        @Description(shortDefinition="Term Concern", formalDefinition="The entity that the term applies to." )
1176        protected DataType topic;
1177
1178        /**
1179         * 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.
1180         */
1181        @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1182        @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." )
1183        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1184        protected CodeableConcept type;
1185
1186        /**
1187         * A specialized legal clause or condition based on overarching contract type.
1188         */
1189        @Child(name = "subType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1190        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="A specialized legal clause or condition based on overarching contract type." )
1191        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1192        protected CodeableConcept subType;
1193
1194        /**
1195         * Statement of a provision in a policy or a contract.
1196         */
1197        @Child(name = "text", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1198        @Description(shortDefinition="Term Statement", formalDefinition="Statement of a provision in a policy or a contract." )
1199        protected StringType text;
1200
1201        /**
1202         * Security labels that protect the handling of information about the term and its elements, which may be specifically identified..
1203         */
1204        @Child(name = "securityLabel", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1205        @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.." )
1206        protected List<SecurityLabelComponent> securityLabel;
1207
1208        /**
1209         * The matter of concern in the context of this provision of the agrement.
1210         */
1211        @Child(name = "offer", type = {}, order=9, min=1, max=1, modifier=false, summary=false)
1212        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1213        protected ContractOfferComponent offer;
1214
1215        /**
1216         * Contract Term Asset List.
1217         */
1218        @Child(name = "asset", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1219        @Description(shortDefinition="Contract Term Asset List", formalDefinition="Contract Term Asset List." )
1220        protected List<ContractAssetComponent> asset;
1221
1222        /**
1223         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1224         */
1225        @Child(name = "action", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1226        @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." )
1227        protected List<ActionComponent> action;
1228
1229        /**
1230         * Nested group of Contract Provisions.
1231         */
1232        @Child(name = "group", type = {TermComponent.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1233        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1234        protected List<TermComponent> group;
1235
1236        private static final long serialVersionUID = -1647037544L;
1237
1238    /**
1239     * Constructor
1240     */
1241      public TermComponent() {
1242        super();
1243      }
1244
1245    /**
1246     * Constructor
1247     */
1248      public TermComponent(ContractOfferComponent offer) {
1249        super();
1250        this.setOffer(offer);
1251      }
1252
1253        /**
1254         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1255         */
1256        public Identifier getIdentifier() { 
1257          if (this.identifier == null)
1258            if (Configuration.errorOnAutoCreate())
1259              throw new Error("Attempt to auto-create TermComponent.identifier");
1260            else if (Configuration.doAutoCreate())
1261              this.identifier = new Identifier(); // cc
1262          return this.identifier;
1263        }
1264
1265        public boolean hasIdentifier() { 
1266          return this.identifier != null && !this.identifier.isEmpty();
1267        }
1268
1269        /**
1270         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1271         */
1272        public TermComponent setIdentifier(Identifier value) { 
1273          this.identifier = value;
1274          return this;
1275        }
1276
1277        /**
1278         * @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
1279         */
1280        public DateTimeType getIssuedElement() { 
1281          if (this.issued == null)
1282            if (Configuration.errorOnAutoCreate())
1283              throw new Error("Attempt to auto-create TermComponent.issued");
1284            else if (Configuration.doAutoCreate())
1285              this.issued = new DateTimeType(); // bb
1286          return this.issued;
1287        }
1288
1289        public boolean hasIssuedElement() { 
1290          return this.issued != null && !this.issued.isEmpty();
1291        }
1292
1293        public boolean hasIssued() { 
1294          return this.issued != null && !this.issued.isEmpty();
1295        }
1296
1297        /**
1298         * @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
1299         */
1300        public TermComponent setIssuedElement(DateTimeType value) { 
1301          this.issued = value;
1302          return this;
1303        }
1304
1305        /**
1306         * @return When this Contract Provision was issued.
1307         */
1308        public Date getIssued() { 
1309          return this.issued == null ? null : this.issued.getValue();
1310        }
1311
1312        /**
1313         * @param value When this Contract Provision was issued.
1314         */
1315        public TermComponent setIssued(Date value) { 
1316          if (value == null)
1317            this.issued = null;
1318          else {
1319            if (this.issued == null)
1320              this.issued = new DateTimeType();
1321            this.issued.setValue(value);
1322          }
1323          return this;
1324        }
1325
1326        /**
1327         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1328         */
1329        public Period getApplies() { 
1330          if (this.applies == null)
1331            if (Configuration.errorOnAutoCreate())
1332              throw new Error("Attempt to auto-create TermComponent.applies");
1333            else if (Configuration.doAutoCreate())
1334              this.applies = new Period(); // cc
1335          return this.applies;
1336        }
1337
1338        public boolean hasApplies() { 
1339          return this.applies != null && !this.applies.isEmpty();
1340        }
1341
1342        /**
1343         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1344         */
1345        public TermComponent setApplies(Period value) { 
1346          this.applies = value;
1347          return this;
1348        }
1349
1350        /**
1351         * @return {@link #topic} (The entity that the term applies to.)
1352         */
1353        public DataType getTopic() { 
1354          return this.topic;
1355        }
1356
1357        /**
1358         * @return {@link #topic} (The entity that the term applies to.)
1359         */
1360        public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
1361          if (this.topic == null)
1362            this.topic = new CodeableConcept();
1363          if (!(this.topic instanceof CodeableConcept))
1364            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
1365          return (CodeableConcept) this.topic;
1366        }
1367
1368        public boolean hasTopicCodeableConcept() { 
1369          return this != null && this.topic instanceof CodeableConcept;
1370        }
1371
1372        /**
1373         * @return {@link #topic} (The entity that the term applies to.)
1374         */
1375        public Reference getTopicReference() throws FHIRException { 
1376          if (this.topic == null)
1377            this.topic = new Reference();
1378          if (!(this.topic instanceof Reference))
1379            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
1380          return (Reference) this.topic;
1381        }
1382
1383        public boolean hasTopicReference() { 
1384          return this != null && this.topic instanceof Reference;
1385        }
1386
1387        public boolean hasTopic() { 
1388          return this.topic != null && !this.topic.isEmpty();
1389        }
1390
1391        /**
1392         * @param value {@link #topic} (The entity that the term applies to.)
1393         */
1394        public TermComponent setTopic(DataType value) { 
1395          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1396            throw new Error("Not the right type for Contract.term.topic[x]: "+value.fhirType());
1397          this.topic = value;
1398          return this;
1399        }
1400
1401        /**
1402         * @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.)
1403         */
1404        public CodeableConcept getType() { 
1405          if (this.type == null)
1406            if (Configuration.errorOnAutoCreate())
1407              throw new Error("Attempt to auto-create TermComponent.type");
1408            else if (Configuration.doAutoCreate())
1409              this.type = new CodeableConcept(); // cc
1410          return this.type;
1411        }
1412
1413        public boolean hasType() { 
1414          return this.type != null && !this.type.isEmpty();
1415        }
1416
1417        /**
1418         * @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.)
1419         */
1420        public TermComponent setType(CodeableConcept value) { 
1421          this.type = value;
1422          return this;
1423        }
1424
1425        /**
1426         * @return {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1427         */
1428        public CodeableConcept getSubType() { 
1429          if (this.subType == null)
1430            if (Configuration.errorOnAutoCreate())
1431              throw new Error("Attempt to auto-create TermComponent.subType");
1432            else if (Configuration.doAutoCreate())
1433              this.subType = new CodeableConcept(); // cc
1434          return this.subType;
1435        }
1436
1437        public boolean hasSubType() { 
1438          return this.subType != null && !this.subType.isEmpty();
1439        }
1440
1441        /**
1442         * @param value {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1443         */
1444        public TermComponent setSubType(CodeableConcept value) { 
1445          this.subType = value;
1446          return this;
1447        }
1448
1449        /**
1450         * @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
1451         */
1452        public StringType getTextElement() { 
1453          if (this.text == null)
1454            if (Configuration.errorOnAutoCreate())
1455              throw new Error("Attempt to auto-create TermComponent.text");
1456            else if (Configuration.doAutoCreate())
1457              this.text = new StringType(); // bb
1458          return this.text;
1459        }
1460
1461        public boolean hasTextElement() { 
1462          return this.text != null && !this.text.isEmpty();
1463        }
1464
1465        public boolean hasText() { 
1466          return this.text != null && !this.text.isEmpty();
1467        }
1468
1469        /**
1470         * @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
1471         */
1472        public TermComponent setTextElement(StringType value) { 
1473          this.text = value;
1474          return this;
1475        }
1476
1477        /**
1478         * @return Statement of a provision in a policy or a contract.
1479         */
1480        public String getText() { 
1481          return this.text == null ? null : this.text.getValue();
1482        }
1483
1484        /**
1485         * @param value Statement of a provision in a policy or a contract.
1486         */
1487        public TermComponent setText(String value) { 
1488          if (Utilities.noString(value))
1489            this.text = null;
1490          else {
1491            if (this.text == null)
1492              this.text = new StringType();
1493            this.text.setValue(value);
1494          }
1495          return this;
1496        }
1497
1498        /**
1499         * @return {@link #securityLabel} (Security labels that protect the handling of information about the term and its elements, which may be specifically identified..)
1500         */
1501        public List<SecurityLabelComponent> getSecurityLabel() { 
1502          if (this.securityLabel == null)
1503            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1504          return this.securityLabel;
1505        }
1506
1507        /**
1508         * @return Returns a reference to <code>this</code> for easy method chaining
1509         */
1510        public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) { 
1511          this.securityLabel = theSecurityLabel;
1512          return this;
1513        }
1514
1515        public boolean hasSecurityLabel() { 
1516          if (this.securityLabel == null)
1517            return false;
1518          for (SecurityLabelComponent item : this.securityLabel)
1519            if (!item.isEmpty())
1520              return true;
1521          return false;
1522        }
1523
1524        public SecurityLabelComponent addSecurityLabel() { //3
1525          SecurityLabelComponent t = new SecurityLabelComponent();
1526          if (this.securityLabel == null)
1527            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1528          this.securityLabel.add(t);
1529          return t;
1530        }
1531
1532        public TermComponent addSecurityLabel(SecurityLabelComponent t) { //3
1533          if (t == null)
1534            return this;
1535          if (this.securityLabel == null)
1536            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1537          this.securityLabel.add(t);
1538          return this;
1539        }
1540
1541        /**
1542         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist {3}
1543         */
1544        public SecurityLabelComponent getSecurityLabelFirstRep() { 
1545          if (getSecurityLabel().isEmpty()) {
1546            addSecurityLabel();
1547          }
1548          return getSecurityLabel().get(0);
1549        }
1550
1551        /**
1552         * @return {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1553         */
1554        public ContractOfferComponent getOffer() { 
1555          if (this.offer == null)
1556            if (Configuration.errorOnAutoCreate())
1557              throw new Error("Attempt to auto-create TermComponent.offer");
1558            else if (Configuration.doAutoCreate())
1559              this.offer = new ContractOfferComponent(); // cc
1560          return this.offer;
1561        }
1562
1563        public boolean hasOffer() { 
1564          return this.offer != null && !this.offer.isEmpty();
1565        }
1566
1567        /**
1568         * @param value {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1569         */
1570        public TermComponent setOffer(ContractOfferComponent value) { 
1571          this.offer = value;
1572          return this;
1573        }
1574
1575        /**
1576         * @return {@link #asset} (Contract Term Asset List.)
1577         */
1578        public List<ContractAssetComponent> getAsset() { 
1579          if (this.asset == null)
1580            this.asset = new ArrayList<ContractAssetComponent>();
1581          return this.asset;
1582        }
1583
1584        /**
1585         * @return Returns a reference to <code>this</code> for easy method chaining
1586         */
1587        public TermComponent setAsset(List<ContractAssetComponent> theAsset) { 
1588          this.asset = theAsset;
1589          return this;
1590        }
1591
1592        public boolean hasAsset() { 
1593          if (this.asset == null)
1594            return false;
1595          for (ContractAssetComponent item : this.asset)
1596            if (!item.isEmpty())
1597              return true;
1598          return false;
1599        }
1600
1601        public ContractAssetComponent addAsset() { //3
1602          ContractAssetComponent t = new ContractAssetComponent();
1603          if (this.asset == null)
1604            this.asset = new ArrayList<ContractAssetComponent>();
1605          this.asset.add(t);
1606          return t;
1607        }
1608
1609        public TermComponent addAsset(ContractAssetComponent t) { //3
1610          if (t == null)
1611            return this;
1612          if (this.asset == null)
1613            this.asset = new ArrayList<ContractAssetComponent>();
1614          this.asset.add(t);
1615          return this;
1616        }
1617
1618        /**
1619         * @return The first repetition of repeating field {@link #asset}, creating it if it does not already exist {3}
1620         */
1621        public ContractAssetComponent getAssetFirstRep() { 
1622          if (getAsset().isEmpty()) {
1623            addAsset();
1624          }
1625          return getAsset().get(0);
1626        }
1627
1628        /**
1629         * @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.)
1630         */
1631        public List<ActionComponent> getAction() { 
1632          if (this.action == null)
1633            this.action = new ArrayList<ActionComponent>();
1634          return this.action;
1635        }
1636
1637        /**
1638         * @return Returns a reference to <code>this</code> for easy method chaining
1639         */
1640        public TermComponent setAction(List<ActionComponent> theAction) { 
1641          this.action = theAction;
1642          return this;
1643        }
1644
1645        public boolean hasAction() { 
1646          if (this.action == null)
1647            return false;
1648          for (ActionComponent item : this.action)
1649            if (!item.isEmpty())
1650              return true;
1651          return false;
1652        }
1653
1654        public ActionComponent addAction() { //3
1655          ActionComponent t = new ActionComponent();
1656          if (this.action == null)
1657            this.action = new ArrayList<ActionComponent>();
1658          this.action.add(t);
1659          return t;
1660        }
1661
1662        public TermComponent addAction(ActionComponent t) { //3
1663          if (t == null)
1664            return this;
1665          if (this.action == null)
1666            this.action = new ArrayList<ActionComponent>();
1667          this.action.add(t);
1668          return this;
1669        }
1670
1671        /**
1672         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist {3}
1673         */
1674        public ActionComponent getActionFirstRep() { 
1675          if (getAction().isEmpty()) {
1676            addAction();
1677          }
1678          return getAction().get(0);
1679        }
1680
1681        /**
1682         * @return {@link #group} (Nested group of Contract Provisions.)
1683         */
1684        public List<TermComponent> getGroup() { 
1685          if (this.group == null)
1686            this.group = new ArrayList<TermComponent>();
1687          return this.group;
1688        }
1689
1690        /**
1691         * @return Returns a reference to <code>this</code> for easy method chaining
1692         */
1693        public TermComponent setGroup(List<TermComponent> theGroup) { 
1694          this.group = theGroup;
1695          return this;
1696        }
1697
1698        public boolean hasGroup() { 
1699          if (this.group == null)
1700            return false;
1701          for (TermComponent item : this.group)
1702            if (!item.isEmpty())
1703              return true;
1704          return false;
1705        }
1706
1707        public TermComponent addGroup() { //3
1708          TermComponent t = new TermComponent();
1709          if (this.group == null)
1710            this.group = new ArrayList<TermComponent>();
1711          this.group.add(t);
1712          return t;
1713        }
1714
1715        public TermComponent addGroup(TermComponent t) { //3
1716          if (t == null)
1717            return this;
1718          if (this.group == null)
1719            this.group = new ArrayList<TermComponent>();
1720          this.group.add(t);
1721          return this;
1722        }
1723
1724        /**
1725         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist {3}
1726         */
1727        public TermComponent getGroupFirstRep() { 
1728          if (getGroup().isEmpty()) {
1729            addGroup();
1730          }
1731          return getGroup().get(0);
1732        }
1733
1734        protected void listChildren(List<Property> children) {
1735          super.listChildren(children);
1736          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
1737          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
1738          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
1739          children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic));
1740          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));
1741          children.add(new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
1742          children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
1743          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));
1744          children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer));
1745          children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
1746          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));
1747          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
1748        }
1749
1750        @Override
1751        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1752          switch (_hash) {
1753          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
1754          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
1755          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
1756          case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1757          case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1758          case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept", "The entity that the term applies to.", 0, 1, topic);
1759          case -343345444: /*topicReference*/  return new Property("topic[x]", "Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1760          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);
1761          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
1762          case 3556653: /*text*/  return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text);
1763          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);
1764          case 105650780: /*offer*/  return new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
1765          case 93121264: /*asset*/  return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset);
1766          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);
1767          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
1768          default: return super.getNamedProperty(_hash, _name, _checkValid);
1769          }
1770
1771        }
1772
1773      @Override
1774      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1775        switch (hash) {
1776        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1777        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
1778        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
1779        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // DataType
1780        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1781        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
1782        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1783        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
1784        case 105650780: /*offer*/ return this.offer == null ? new Base[0] : new Base[] {this.offer}; // ContractOfferComponent
1785        case 93121264: /*asset*/ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
1786        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
1787        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
1788        default: return super.getProperty(hash, name, checkValid);
1789        }
1790
1791      }
1792
1793      @Override
1794      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1795        switch (hash) {
1796        case -1618432855: // identifier
1797          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
1798          return value;
1799        case -1179159893: // issued
1800          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
1801          return value;
1802        case -793235316: // applies
1803          this.applies = TypeConvertor.castToPeriod(value); // Period
1804          return value;
1805        case 110546223: // topic
1806          this.topic = TypeConvertor.castToType(value); // DataType
1807          return value;
1808        case 3575610: // type
1809          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1810          return value;
1811        case -1868521062: // subType
1812          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1813          return value;
1814        case 3556653: // text
1815          this.text = TypeConvertor.castToString(value); // StringType
1816          return value;
1817        case -722296940: // securityLabel
1818          this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
1819          return value;
1820        case 105650780: // offer
1821          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1822          return value;
1823        case 93121264: // asset
1824          this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
1825          return value;
1826        case -1422950858: // action
1827          this.getAction().add((ActionComponent) value); // ActionComponent
1828          return value;
1829        case 98629247: // group
1830          this.getGroup().add((TermComponent) value); // TermComponent
1831          return value;
1832        default: return super.setProperty(hash, name, value);
1833        }
1834
1835      }
1836
1837      @Override
1838      public Base setProperty(String name, Base value) throws FHIRException {
1839        if (name.equals("identifier")) {
1840          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
1841        } else if (name.equals("issued")) {
1842          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
1843        } else if (name.equals("applies")) {
1844          this.applies = TypeConvertor.castToPeriod(value); // Period
1845        } else if (name.equals("topic[x]")) {
1846          this.topic = TypeConvertor.castToType(value); // DataType
1847        } else if (name.equals("type")) {
1848          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1849        } else if (name.equals("subType")) {
1850          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1851        } else if (name.equals("text")) {
1852          this.text = TypeConvertor.castToString(value); // StringType
1853        } else if (name.equals("securityLabel")) {
1854          this.getSecurityLabel().add((SecurityLabelComponent) value);
1855        } else if (name.equals("offer")) {
1856          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1857        } else if (name.equals("asset")) {
1858          this.getAsset().add((ContractAssetComponent) value);
1859        } else if (name.equals("action")) {
1860          this.getAction().add((ActionComponent) value);
1861        } else if (name.equals("group")) {
1862          this.getGroup().add((TermComponent) value);
1863        } else
1864          return super.setProperty(name, value);
1865        return value;
1866      }
1867
1868      @Override
1869      public Base makeProperty(int hash, String name) throws FHIRException {
1870        switch (hash) {
1871        case -1618432855:  return getIdentifier();
1872        case -1179159893:  return getIssuedElement();
1873        case -793235316:  return getApplies();
1874        case -957295375:  return getTopic();
1875        case 110546223:  return getTopic();
1876        case 3575610:  return getType();
1877        case -1868521062:  return getSubType();
1878        case 3556653:  return getTextElement();
1879        case -722296940:  return addSecurityLabel(); 
1880        case 105650780:  return getOffer();
1881        case 93121264:  return addAsset(); 
1882        case -1422950858:  return addAction(); 
1883        case 98629247:  return addGroup(); 
1884        default: return super.makeProperty(hash, name);
1885        }
1886
1887      }
1888
1889      @Override
1890      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1891        switch (hash) {
1892        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1893        case -1179159893: /*issued*/ return new String[] {"dateTime"};
1894        case -793235316: /*applies*/ return new String[] {"Period"};
1895        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
1896        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1897        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1898        case 3556653: /*text*/ return new String[] {"string"};
1899        case -722296940: /*securityLabel*/ return new String[] {};
1900        case 105650780: /*offer*/ return new String[] {};
1901        case 93121264: /*asset*/ return new String[] {};
1902        case -1422950858: /*action*/ return new String[] {};
1903        case 98629247: /*group*/ return new String[] {"@Contract.term"};
1904        default: return super.getTypesForProperty(hash, name);
1905        }
1906
1907      }
1908
1909      @Override
1910      public Base addChild(String name) throws FHIRException {
1911        if (name.equals("identifier")) {
1912          this.identifier = new Identifier();
1913          return this.identifier;
1914        }
1915        else if (name.equals("issued")) {
1916          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.issued");
1917        }
1918        else if (name.equals("applies")) {
1919          this.applies = new Period();
1920          return this.applies;
1921        }
1922        else if (name.equals("topicCodeableConcept")) {
1923          this.topic = new CodeableConcept();
1924          return this.topic;
1925        }
1926        else if (name.equals("topicReference")) {
1927          this.topic = new Reference();
1928          return this.topic;
1929        }
1930        else if (name.equals("type")) {
1931          this.type = new CodeableConcept();
1932          return this.type;
1933        }
1934        else if (name.equals("subType")) {
1935          this.subType = new CodeableConcept();
1936          return this.subType;
1937        }
1938        else if (name.equals("text")) {
1939          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.text");
1940        }
1941        else if (name.equals("securityLabel")) {
1942          return addSecurityLabel();
1943        }
1944        else if (name.equals("offer")) {
1945          this.offer = new ContractOfferComponent();
1946          return this.offer;
1947        }
1948        else if (name.equals("asset")) {
1949          return addAsset();
1950        }
1951        else if (name.equals("action")) {
1952          return addAction();
1953        }
1954        else if (name.equals("group")) {
1955          return addGroup();
1956        }
1957        else
1958          return super.addChild(name);
1959      }
1960
1961      public TermComponent copy() {
1962        TermComponent dst = new TermComponent();
1963        copyValues(dst);
1964        return dst;
1965      }
1966
1967      public void copyValues(TermComponent dst) {
1968        super.copyValues(dst);
1969        dst.identifier = identifier == null ? null : identifier.copy();
1970        dst.issued = issued == null ? null : issued.copy();
1971        dst.applies = applies == null ? null : applies.copy();
1972        dst.topic = topic == null ? null : topic.copy();
1973        dst.type = type == null ? null : type.copy();
1974        dst.subType = subType == null ? null : subType.copy();
1975        dst.text = text == null ? null : text.copy();
1976        if (securityLabel != null) {
1977          dst.securityLabel = new ArrayList<SecurityLabelComponent>();
1978          for (SecurityLabelComponent i : securityLabel)
1979            dst.securityLabel.add(i.copy());
1980        };
1981        dst.offer = offer == null ? null : offer.copy();
1982        if (asset != null) {
1983          dst.asset = new ArrayList<ContractAssetComponent>();
1984          for (ContractAssetComponent i : asset)
1985            dst.asset.add(i.copy());
1986        };
1987        if (action != null) {
1988          dst.action = new ArrayList<ActionComponent>();
1989          for (ActionComponent i : action)
1990            dst.action.add(i.copy());
1991        };
1992        if (group != null) {
1993          dst.group = new ArrayList<TermComponent>();
1994          for (TermComponent i : group)
1995            dst.group.add(i.copy());
1996        };
1997      }
1998
1999      @Override
2000      public boolean equalsDeep(Base other_) {
2001        if (!super.equalsDeep(other_))
2002          return false;
2003        if (!(other_ instanceof TermComponent))
2004          return false;
2005        TermComponent o = (TermComponent) other_;
2006        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
2007           && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
2008           && compareDeep(text, o.text, true) && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
2009           && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true) && compareDeep(group, o.group, true)
2010          ;
2011      }
2012
2013      @Override
2014      public boolean equalsShallow(Base other_) {
2015        if (!super.equalsShallow(other_))
2016          return false;
2017        if (!(other_ instanceof TermComponent))
2018          return false;
2019        TermComponent o = (TermComponent) other_;
2020        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2021      }
2022
2023      public boolean isEmpty() {
2024        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2025          , topic, type, subType, text, securityLabel, offer, asset, action, group);
2026      }
2027
2028  public String fhirType() {
2029    return "Contract.term";
2030
2031  }
2032
2033  }
2034
2035    @Block()
2036    public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2037        /**
2038         * Number used to link this term or term element to the applicable Security Label.
2039         */
2040        @Child(name = "number", type = {UnsignedIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2041        @Description(shortDefinition="Link to Security Labels", formalDefinition="Number used to link this term or term element to the applicable Security Label." )
2042        protected List<UnsignedIntType> number;
2043
2044        /**
2045         * Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.
2046         */
2047        @Child(name = "classification", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=false)
2048        @Description(shortDefinition="Confidentiality Protection", formalDefinition="Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements." )
2049        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-classification")
2050        protected Coding classification;
2051
2052        /**
2053         * Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.
2054         */
2055        @Child(name = "category", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2056        @Description(shortDefinition="Applicable Policy", formalDefinition="Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements." )
2057        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-category")
2058        protected List<Coding> category;
2059
2060        /**
2061         * Security label privacy tag that species the manner in which term and/or term elements are to be protected.
2062         */
2063        @Child(name = "control", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2064        @Description(shortDefinition="Handling Instructions", formalDefinition="Security label privacy tag that species the manner in which term and/or term elements are to be protected." )
2065        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-control")
2066        protected List<Coding> control;
2067
2068        private static final long serialVersionUID = 788281758L;
2069
2070    /**
2071     * Constructor
2072     */
2073      public SecurityLabelComponent() {
2074        super();
2075      }
2076
2077    /**
2078     * Constructor
2079     */
2080      public SecurityLabelComponent(Coding classification) {
2081        super();
2082        this.setClassification(classification);
2083      }
2084
2085        /**
2086         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2087         */
2088        public List<UnsignedIntType> getNumber() { 
2089          if (this.number == null)
2090            this.number = new ArrayList<UnsignedIntType>();
2091          return this.number;
2092        }
2093
2094        /**
2095         * @return Returns a reference to <code>this</code> for easy method chaining
2096         */
2097        public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) { 
2098          this.number = theNumber;
2099          return this;
2100        }
2101
2102        public boolean hasNumber() { 
2103          if (this.number == null)
2104            return false;
2105          for (UnsignedIntType item : this.number)
2106            if (!item.isEmpty())
2107              return true;
2108          return false;
2109        }
2110
2111        /**
2112         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2113         */
2114        public UnsignedIntType addNumberElement() {//2 
2115          UnsignedIntType t = new UnsignedIntType();
2116          if (this.number == null)
2117            this.number = new ArrayList<UnsignedIntType>();
2118          this.number.add(t);
2119          return t;
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 SecurityLabelComponent addNumber(int value) { //1
2126          UnsignedIntType t = new UnsignedIntType();
2127          t.setValue(value);
2128          if (this.number == null)
2129            this.number = new ArrayList<UnsignedIntType>();
2130          this.number.add(t);
2131          return this;
2132        }
2133
2134        /**
2135         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2136         */
2137        public boolean hasNumber(int value) { 
2138          if (this.number == null)
2139            return false;
2140          for (UnsignedIntType v : this.number)
2141            if (v.getValue().equals(value)) // unsignedInt
2142              return true;
2143          return false;
2144        }
2145
2146        /**
2147         * @return {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2148         */
2149        public Coding getClassification() { 
2150          if (this.classification == null)
2151            if (Configuration.errorOnAutoCreate())
2152              throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2153            else if (Configuration.doAutoCreate())
2154              this.classification = new Coding(); // cc
2155          return this.classification;
2156        }
2157
2158        public boolean hasClassification() { 
2159          return this.classification != null && !this.classification.isEmpty();
2160        }
2161
2162        /**
2163         * @param value {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2164         */
2165        public SecurityLabelComponent setClassification(Coding value) { 
2166          this.classification = value;
2167          return this;
2168        }
2169
2170        /**
2171         * @return {@link #category} (Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.)
2172         */
2173        public List<Coding> getCategory() { 
2174          if (this.category == null)
2175            this.category = new ArrayList<Coding>();
2176          return this.category;
2177        }
2178
2179        /**
2180         * @return Returns a reference to <code>this</code> for easy method chaining
2181         */
2182        public SecurityLabelComponent setCategory(List<Coding> theCategory) { 
2183          this.category = theCategory;
2184          return this;
2185        }
2186
2187        public boolean hasCategory() { 
2188          if (this.category == null)
2189            return false;
2190          for (Coding item : this.category)
2191            if (!item.isEmpty())
2192              return true;
2193          return false;
2194        }
2195
2196        public Coding addCategory() { //3
2197          Coding t = new Coding();
2198          if (this.category == null)
2199            this.category = new ArrayList<Coding>();
2200          this.category.add(t);
2201          return t;
2202        }
2203
2204        public SecurityLabelComponent addCategory(Coding t) { //3
2205          if (t == null)
2206            return this;
2207          if (this.category == null)
2208            this.category = new ArrayList<Coding>();
2209          this.category.add(t);
2210          return this;
2211        }
2212
2213        /**
2214         * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2215         */
2216        public Coding getCategoryFirstRep() { 
2217          if (getCategory().isEmpty()) {
2218            addCategory();
2219          }
2220          return getCategory().get(0);
2221        }
2222
2223        /**
2224         * @return {@link #control} (Security label privacy tag that species the manner in which term and/or term elements are to be protected.)
2225         */
2226        public List<Coding> getControl() { 
2227          if (this.control == null)
2228            this.control = new ArrayList<Coding>();
2229          return this.control;
2230        }
2231
2232        /**
2233         * @return Returns a reference to <code>this</code> for easy method chaining
2234         */
2235        public SecurityLabelComponent setControl(List<Coding> theControl) { 
2236          this.control = theControl;
2237          return this;
2238        }
2239
2240        public boolean hasControl() { 
2241          if (this.control == null)
2242            return false;
2243          for (Coding item : this.control)
2244            if (!item.isEmpty())
2245              return true;
2246          return false;
2247        }
2248
2249        public Coding addControl() { //3
2250          Coding t = new Coding();
2251          if (this.control == null)
2252            this.control = new ArrayList<Coding>();
2253          this.control.add(t);
2254          return t;
2255        }
2256
2257        public SecurityLabelComponent addControl(Coding t) { //3
2258          if (t == null)
2259            return this;
2260          if (this.control == null)
2261            this.control = new ArrayList<Coding>();
2262          this.control.add(t);
2263          return this;
2264        }
2265
2266        /**
2267         * @return The first repetition of repeating field {@link #control}, creating it if it does not already exist {3}
2268         */
2269        public Coding getControlFirstRep() { 
2270          if (getControl().isEmpty()) {
2271            addControl();
2272          }
2273          return getControl().get(0);
2274        }
2275
2276        protected void listChildren(List<Property> children) {
2277          super.listChildren(children);
2278          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));
2279          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));
2280          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));
2281          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));
2282        }
2283
2284        @Override
2285        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2286          switch (_hash) {
2287          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);
2288          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);
2289          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);
2290          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);
2291          default: return super.getNamedProperty(_hash, _name, _checkValid);
2292          }
2293
2294        }
2295
2296      @Override
2297      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2298        switch (hash) {
2299        case -1034364087: /*number*/ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2300        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // Coding
2301        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // Coding
2302        case 951543133: /*control*/ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2303        default: return super.getProperty(hash, name, checkValid);
2304        }
2305
2306      }
2307
2308      @Override
2309      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2310        switch (hash) {
2311        case -1034364087: // number
2312          this.getNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
2313          return value;
2314        case 382350310: // classification
2315          this.classification = TypeConvertor.castToCoding(value); // Coding
2316          return value;
2317        case 50511102: // category
2318          this.getCategory().add(TypeConvertor.castToCoding(value)); // Coding
2319          return value;
2320        case 951543133: // control
2321          this.getControl().add(TypeConvertor.castToCoding(value)); // Coding
2322          return value;
2323        default: return super.setProperty(hash, name, value);
2324        }
2325
2326      }
2327
2328      @Override
2329      public Base setProperty(String name, Base value) throws FHIRException {
2330        if (name.equals("number")) {
2331          this.getNumber().add(TypeConvertor.castToUnsignedInt(value));
2332        } else if (name.equals("classification")) {
2333          this.classification = TypeConvertor.castToCoding(value); // Coding
2334        } else if (name.equals("category")) {
2335          this.getCategory().add(TypeConvertor.castToCoding(value));
2336        } else if (name.equals("control")) {
2337          this.getControl().add(TypeConvertor.castToCoding(value));
2338        } else
2339          return super.setProperty(name, value);
2340        return value;
2341      }
2342
2343      @Override
2344      public Base makeProperty(int hash, String name) throws FHIRException {
2345        switch (hash) {
2346        case -1034364087:  return addNumberElement();
2347        case 382350310:  return getClassification();
2348        case 50511102:  return addCategory(); 
2349        case 951543133:  return addControl(); 
2350        default: return super.makeProperty(hash, name);
2351        }
2352
2353      }
2354
2355      @Override
2356      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2357        switch (hash) {
2358        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
2359        case 382350310: /*classification*/ return new String[] {"Coding"};
2360        case 50511102: /*category*/ return new String[] {"Coding"};
2361        case 951543133: /*control*/ return new String[] {"Coding"};
2362        default: return super.getTypesForProperty(hash, name);
2363        }
2364
2365      }
2366
2367      @Override
2368      public Base addChild(String name) throws FHIRException {
2369        if (name.equals("number")) {
2370          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.securityLabel.number");
2371        }
2372        else if (name.equals("classification")) {
2373          this.classification = new Coding();
2374          return this.classification;
2375        }
2376        else if (name.equals("category")) {
2377          return addCategory();
2378        }
2379        else if (name.equals("control")) {
2380          return addControl();
2381        }
2382        else
2383          return super.addChild(name);
2384      }
2385
2386      public SecurityLabelComponent copy() {
2387        SecurityLabelComponent dst = new SecurityLabelComponent();
2388        copyValues(dst);
2389        return dst;
2390      }
2391
2392      public void copyValues(SecurityLabelComponent dst) {
2393        super.copyValues(dst);
2394        if (number != null) {
2395          dst.number = new ArrayList<UnsignedIntType>();
2396          for (UnsignedIntType i : number)
2397            dst.number.add(i.copy());
2398        };
2399        dst.classification = classification == null ? null : classification.copy();
2400        if (category != null) {
2401          dst.category = new ArrayList<Coding>();
2402          for (Coding i : category)
2403            dst.category.add(i.copy());
2404        };
2405        if (control != null) {
2406          dst.control = new ArrayList<Coding>();
2407          for (Coding i : control)
2408            dst.control.add(i.copy());
2409        };
2410      }
2411
2412      @Override
2413      public boolean equalsDeep(Base other_) {
2414        if (!super.equalsDeep(other_))
2415          return false;
2416        if (!(other_ instanceof SecurityLabelComponent))
2417          return false;
2418        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2419        return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
2420           && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
2421      }
2422
2423      @Override
2424      public boolean equalsShallow(Base other_) {
2425        if (!super.equalsShallow(other_))
2426          return false;
2427        if (!(other_ instanceof SecurityLabelComponent))
2428          return false;
2429        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2430        return compareValues(number, o.number, true);
2431      }
2432
2433      public boolean isEmpty() {
2434        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category
2435          , control);
2436      }
2437
2438  public String fhirType() {
2439    return "Contract.term.securityLabel";
2440
2441  }
2442
2443  }
2444
2445    @Block()
2446    public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
2447        /**
2448         * Unique identifier for this particular Contract Provision.
2449         */
2450        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2451        @Description(shortDefinition="Offer business ID", formalDefinition="Unique identifier for this particular Contract Provision." )
2452        protected List<Identifier> identifier;
2453
2454        /**
2455         * Offer Recipient.
2456         */
2457        @Child(name = "party", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2458        @Description(shortDefinition="Offer Recipient", formalDefinition="Offer Recipient." )
2459        protected List<ContractPartyComponent> party;
2460
2461        /**
2462         * 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).
2463         */
2464        @Child(name = "topic", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=true)
2465        @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)." )
2466        protected Reference topic;
2467
2468        /**
2469         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
2470         */
2471        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
2472        @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." )
2473        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
2474        protected CodeableConcept type;
2475
2476        /**
2477         * Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.
2478         */
2479        @Child(name = "decision", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
2480        @Description(shortDefinition="Accepting party choice", formalDefinition="Type of choice made by accepting party with respect to an offer made by an offeror/ grantee." )
2481        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
2482        protected CodeableConcept decision;
2483
2484        /**
2485         * How the decision about a Contract was conveyed.
2486         */
2487        @Child(name = "decisionMode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2488        @Description(shortDefinition="How decision is conveyed", formalDefinition="How the decision about a Contract was conveyed." )
2489        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-decision-mode")
2490        protected List<CodeableConcept> decisionMode;
2491
2492        /**
2493         * Response to offer text.
2494         */
2495        @Child(name = "answer", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2496        @Description(shortDefinition="Response to offer text", formalDefinition="Response to offer text." )
2497        protected List<AnswerComponent> answer;
2498
2499        /**
2500         * Human readable form of this Contract Offer.
2501         */
2502        @Child(name = "text", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2503        @Description(shortDefinition="Human readable offer text", formalDefinition="Human readable form of this Contract Offer." )
2504        protected StringType text;
2505
2506        /**
2507         * The id of the clause or question text of the offer in the referenced questionnaire/response.
2508         */
2509        @Child(name = "linkId", type = {StringType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2510        @Description(shortDefinition="Pointer to text", formalDefinition="The id of the clause or question text of the offer in the referenced questionnaire/response." )
2511        protected List<StringType> linkId;
2512
2513        /**
2514         * Security labels that protects the offer.
2515         */
2516        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2517        @Description(shortDefinition="Offer restriction numbers", formalDefinition="Security labels that protects the offer." )
2518        protected List<UnsignedIntType> securityLabelNumber;
2519
2520        private static final long serialVersionUID = -852140711L;
2521
2522    /**
2523     * Constructor
2524     */
2525      public ContractOfferComponent() {
2526        super();
2527      }
2528
2529        /**
2530         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
2531         */
2532        public List<Identifier> getIdentifier() { 
2533          if (this.identifier == null)
2534            this.identifier = new ArrayList<Identifier>();
2535          return this.identifier;
2536        }
2537
2538        /**
2539         * @return Returns a reference to <code>this</code> for easy method chaining
2540         */
2541        public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) { 
2542          this.identifier = theIdentifier;
2543          return this;
2544        }
2545
2546        public boolean hasIdentifier() { 
2547          if (this.identifier == null)
2548            return false;
2549          for (Identifier item : this.identifier)
2550            if (!item.isEmpty())
2551              return true;
2552          return false;
2553        }
2554
2555        public Identifier addIdentifier() { //3
2556          Identifier t = new Identifier();
2557          if (this.identifier == null)
2558            this.identifier = new ArrayList<Identifier>();
2559          this.identifier.add(t);
2560          return t;
2561        }
2562
2563        public ContractOfferComponent addIdentifier(Identifier t) { //3
2564          if (t == null)
2565            return this;
2566          if (this.identifier == null)
2567            this.identifier = new ArrayList<Identifier>();
2568          this.identifier.add(t);
2569          return this;
2570        }
2571
2572        /**
2573         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2574         */
2575        public Identifier getIdentifierFirstRep() { 
2576          if (getIdentifier().isEmpty()) {
2577            addIdentifier();
2578          }
2579          return getIdentifier().get(0);
2580        }
2581
2582        /**
2583         * @return {@link #party} (Offer Recipient.)
2584         */
2585        public List<ContractPartyComponent> getParty() { 
2586          if (this.party == null)
2587            this.party = new ArrayList<ContractPartyComponent>();
2588          return this.party;
2589        }
2590
2591        /**
2592         * @return Returns a reference to <code>this</code> for easy method chaining
2593         */
2594        public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) { 
2595          this.party = theParty;
2596          return this;
2597        }
2598
2599        public boolean hasParty() { 
2600          if (this.party == null)
2601            return false;
2602          for (ContractPartyComponent item : this.party)
2603            if (!item.isEmpty())
2604              return true;
2605          return false;
2606        }
2607
2608        public ContractPartyComponent addParty() { //3
2609          ContractPartyComponent t = new ContractPartyComponent();
2610          if (this.party == null)
2611            this.party = new ArrayList<ContractPartyComponent>();
2612          this.party.add(t);
2613          return t;
2614        }
2615
2616        public ContractOfferComponent addParty(ContractPartyComponent t) { //3
2617          if (t == null)
2618            return this;
2619          if (this.party == null)
2620            this.party = new ArrayList<ContractPartyComponent>();
2621          this.party.add(t);
2622          return this;
2623        }
2624
2625        /**
2626         * @return The first repetition of repeating field {@link #party}, creating it if it does not already exist {3}
2627         */
2628        public ContractPartyComponent getPartyFirstRep() { 
2629          if (getParty().isEmpty()) {
2630            addParty();
2631          }
2632          return getParty().get(0);
2633        }
2634
2635        /**
2636         * @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).)
2637         */
2638        public Reference getTopic() { 
2639          if (this.topic == null)
2640            if (Configuration.errorOnAutoCreate())
2641              throw new Error("Attempt to auto-create ContractOfferComponent.topic");
2642            else if (Configuration.doAutoCreate())
2643              this.topic = new Reference(); // cc
2644          return this.topic;
2645        }
2646
2647        public boolean hasTopic() { 
2648          return this.topic != null && !this.topic.isEmpty();
2649        }
2650
2651        /**
2652         * @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).)
2653         */
2654        public ContractOfferComponent setTopic(Reference value) { 
2655          this.topic = value;
2656          return this;
2657        }
2658
2659        /**
2660         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2661         */
2662        public CodeableConcept getType() { 
2663          if (this.type == null)
2664            if (Configuration.errorOnAutoCreate())
2665              throw new Error("Attempt to auto-create ContractOfferComponent.type");
2666            else if (Configuration.doAutoCreate())
2667              this.type = new CodeableConcept(); // cc
2668          return this.type;
2669        }
2670
2671        public boolean hasType() { 
2672          return this.type != null && !this.type.isEmpty();
2673        }
2674
2675        /**
2676         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2677         */
2678        public ContractOfferComponent setType(CodeableConcept value) { 
2679          this.type = value;
2680          return this;
2681        }
2682
2683        /**
2684         * @return {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2685         */
2686        public CodeableConcept getDecision() { 
2687          if (this.decision == null)
2688            if (Configuration.errorOnAutoCreate())
2689              throw new Error("Attempt to auto-create ContractOfferComponent.decision");
2690            else if (Configuration.doAutoCreate())
2691              this.decision = new CodeableConcept(); // cc
2692          return this.decision;
2693        }
2694
2695        public boolean hasDecision() { 
2696          return this.decision != null && !this.decision.isEmpty();
2697        }
2698
2699        /**
2700         * @param value {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2701         */
2702        public ContractOfferComponent setDecision(CodeableConcept value) { 
2703          this.decision = value;
2704          return this;
2705        }
2706
2707        /**
2708         * @return {@link #decisionMode} (How the decision about a Contract was conveyed.)
2709         */
2710        public List<CodeableConcept> getDecisionMode() { 
2711          if (this.decisionMode == null)
2712            this.decisionMode = new ArrayList<CodeableConcept>();
2713          return this.decisionMode;
2714        }
2715
2716        /**
2717         * @return Returns a reference to <code>this</code> for easy method chaining
2718         */
2719        public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) { 
2720          this.decisionMode = theDecisionMode;
2721          return this;
2722        }
2723
2724        public boolean hasDecisionMode() { 
2725          if (this.decisionMode == null)
2726            return false;
2727          for (CodeableConcept item : this.decisionMode)
2728            if (!item.isEmpty())
2729              return true;
2730          return false;
2731        }
2732
2733        public CodeableConcept addDecisionMode() { //3
2734          CodeableConcept t = new CodeableConcept();
2735          if (this.decisionMode == null)
2736            this.decisionMode = new ArrayList<CodeableConcept>();
2737          this.decisionMode.add(t);
2738          return t;
2739        }
2740
2741        public ContractOfferComponent addDecisionMode(CodeableConcept t) { //3
2742          if (t == null)
2743            return this;
2744          if (this.decisionMode == null)
2745            this.decisionMode = new ArrayList<CodeableConcept>();
2746          this.decisionMode.add(t);
2747          return this;
2748        }
2749
2750        /**
2751         * @return The first repetition of repeating field {@link #decisionMode}, creating it if it does not already exist {3}
2752         */
2753        public CodeableConcept getDecisionModeFirstRep() { 
2754          if (getDecisionMode().isEmpty()) {
2755            addDecisionMode();
2756          }
2757          return getDecisionMode().get(0);
2758        }
2759
2760        /**
2761         * @return {@link #answer} (Response to offer text.)
2762         */
2763        public List<AnswerComponent> getAnswer() { 
2764          if (this.answer == null)
2765            this.answer = new ArrayList<AnswerComponent>();
2766          return this.answer;
2767        }
2768
2769        /**
2770         * @return Returns a reference to <code>this</code> for easy method chaining
2771         */
2772        public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) { 
2773          this.answer = theAnswer;
2774          return this;
2775        }
2776
2777        public boolean hasAnswer() { 
2778          if (this.answer == null)
2779            return false;
2780          for (AnswerComponent item : this.answer)
2781            if (!item.isEmpty())
2782              return true;
2783          return false;
2784        }
2785
2786        public AnswerComponent addAnswer() { //3
2787          AnswerComponent t = new AnswerComponent();
2788          if (this.answer == null)
2789            this.answer = new ArrayList<AnswerComponent>();
2790          this.answer.add(t);
2791          return t;
2792        }
2793
2794        public ContractOfferComponent addAnswer(AnswerComponent t) { //3
2795          if (t == null)
2796            return this;
2797          if (this.answer == null)
2798            this.answer = new ArrayList<AnswerComponent>();
2799          this.answer.add(t);
2800          return this;
2801        }
2802
2803        /**
2804         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist {3}
2805         */
2806        public AnswerComponent getAnswerFirstRep() { 
2807          if (getAnswer().isEmpty()) {
2808            addAnswer();
2809          }
2810          return getAnswer().get(0);
2811        }
2812
2813        /**
2814         * @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
2815         */
2816        public StringType getTextElement() { 
2817          if (this.text == null)
2818            if (Configuration.errorOnAutoCreate())
2819              throw new Error("Attempt to auto-create ContractOfferComponent.text");
2820            else if (Configuration.doAutoCreate())
2821              this.text = new StringType(); // bb
2822          return this.text;
2823        }
2824
2825        public boolean hasTextElement() { 
2826          return this.text != null && !this.text.isEmpty();
2827        }
2828
2829        public boolean hasText() { 
2830          return this.text != null && !this.text.isEmpty();
2831        }
2832
2833        /**
2834         * @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
2835         */
2836        public ContractOfferComponent setTextElement(StringType value) { 
2837          this.text = value;
2838          return this;
2839        }
2840
2841        /**
2842         * @return Human readable form of this Contract Offer.
2843         */
2844        public String getText() { 
2845          return this.text == null ? null : this.text.getValue();
2846        }
2847
2848        /**
2849         * @param value Human readable form of this Contract Offer.
2850         */
2851        public ContractOfferComponent setText(String value) { 
2852          if (Utilities.noString(value))
2853            this.text = null;
2854          else {
2855            if (this.text == null)
2856              this.text = new StringType();
2857            this.text.setValue(value);
2858          }
2859          return this;
2860        }
2861
2862        /**
2863         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2864         */
2865        public List<StringType> getLinkId() { 
2866          if (this.linkId == null)
2867            this.linkId = new ArrayList<StringType>();
2868          return this.linkId;
2869        }
2870
2871        /**
2872         * @return Returns a reference to <code>this</code> for easy method chaining
2873         */
2874        public ContractOfferComponent setLinkId(List<StringType> theLinkId) { 
2875          this.linkId = theLinkId;
2876          return this;
2877        }
2878
2879        public boolean hasLinkId() { 
2880          if (this.linkId == null)
2881            return false;
2882          for (StringType item : this.linkId)
2883            if (!item.isEmpty())
2884              return true;
2885          return false;
2886        }
2887
2888        /**
2889         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2890         */
2891        public StringType addLinkIdElement() {//2 
2892          StringType t = new StringType();
2893          if (this.linkId == null)
2894            this.linkId = new ArrayList<StringType>();
2895          this.linkId.add(t);
2896          return t;
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 ContractOfferComponent addLinkId(String value) { //1
2903          StringType t = new StringType();
2904          t.setValue(value);
2905          if (this.linkId == null)
2906            this.linkId = new ArrayList<StringType>();
2907          this.linkId.add(t);
2908          return this;
2909        }
2910
2911        /**
2912         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2913         */
2914        public boolean hasLinkId(String value) { 
2915          if (this.linkId == null)
2916            return false;
2917          for (StringType v : this.linkId)
2918            if (v.getValue().equals(value)) // string
2919              return true;
2920          return false;
2921        }
2922
2923        /**
2924         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2925         */
2926        public List<UnsignedIntType> getSecurityLabelNumber() { 
2927          if (this.securityLabelNumber == null)
2928            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2929          return this.securityLabelNumber;
2930        }
2931
2932        /**
2933         * @return Returns a reference to <code>this</code> for easy method chaining
2934         */
2935        public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
2936          this.securityLabelNumber = theSecurityLabelNumber;
2937          return this;
2938        }
2939
2940        public boolean hasSecurityLabelNumber() { 
2941          if (this.securityLabelNumber == null)
2942            return false;
2943          for (UnsignedIntType item : this.securityLabelNumber)
2944            if (!item.isEmpty())
2945              return true;
2946          return false;
2947        }
2948
2949        /**
2950         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2951         */
2952        public UnsignedIntType addSecurityLabelNumberElement() {//2 
2953          UnsignedIntType t = new UnsignedIntType();
2954          if (this.securityLabelNumber == null)
2955            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2956          this.securityLabelNumber.add(t);
2957          return t;
2958        }
2959
2960        /**
2961         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2962         */
2963        public ContractOfferComponent addSecurityLabelNumber(int value) { //1
2964          UnsignedIntType t = new UnsignedIntType();
2965          t.setValue(value);
2966          if (this.securityLabelNumber == null)
2967            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2968          this.securityLabelNumber.add(t);
2969          return this;
2970        }
2971
2972        /**
2973         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2974         */
2975        public boolean hasSecurityLabelNumber(int value) { 
2976          if (this.securityLabelNumber == null)
2977            return false;
2978          for (UnsignedIntType v : this.securityLabelNumber)
2979            if (v.getValue().equals(value)) // unsignedInt
2980              return true;
2981          return false;
2982        }
2983
2984        protected void listChildren(List<Property> children) {
2985          super.listChildren(children);
2986          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier));
2987          children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
2988          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));
2989          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));
2990          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));
2991          children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode));
2992          children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
2993          children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
2994          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));
2995          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
2996        }
2997
2998        @Override
2999        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3000          switch (_hash) {
3001          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
3002          case 106437350: /*party*/  return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
3003          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);
3004          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);
3005          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);
3006          case 675909535: /*decisionMode*/  return new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
3007          case -1412808770: /*answer*/  return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer);
3008          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
3009          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);
3010          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
3011          default: return super.getNamedProperty(_hash, _name, _checkValid);
3012          }
3013
3014        }
3015
3016      @Override
3017      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3018        switch (hash) {
3019        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3020        case 106437350: /*party*/ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3021        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Reference
3022        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3023        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
3024        case 675909535: /*decisionMode*/ return this.decisionMode == null ? new Base[0] : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3025        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3026        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
3027        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3028        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3029        default: return super.getProperty(hash, name, checkValid);
3030        }
3031
3032      }
3033
3034      @Override
3035      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3036        switch (hash) {
3037        case -1618432855: // identifier
3038          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3039          return value;
3040        case 106437350: // party
3041          this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3042          return value;
3043        case 110546223: // topic
3044          this.topic = TypeConvertor.castToReference(value); // Reference
3045          return value;
3046        case 3575610: // type
3047          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3048          return value;
3049        case 565719004: // decision
3050          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3051          return value;
3052        case 675909535: // decisionMode
3053          this.getDecisionMode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3054          return value;
3055        case -1412808770: // answer
3056          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3057          return value;
3058        case 3556653: // text
3059          this.text = TypeConvertor.castToString(value); // StringType
3060          return value;
3061        case -1102667083: // linkId
3062          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
3063          return value;
3064        case -149460995: // securityLabelNumber
3065          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
3066          return value;
3067        default: return super.setProperty(hash, name, value);
3068        }
3069
3070      }
3071
3072      @Override
3073      public Base setProperty(String name, Base value) throws FHIRException {
3074        if (name.equals("identifier")) {
3075          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3076        } else if (name.equals("party")) {
3077          this.getParty().add((ContractPartyComponent) value);
3078        } else if (name.equals("topic")) {
3079          this.topic = TypeConvertor.castToReference(value); // Reference
3080        } else if (name.equals("type")) {
3081          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3082        } else if (name.equals("decision")) {
3083          this.decision = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3084        } else if (name.equals("decisionMode")) {
3085          this.getDecisionMode().add(TypeConvertor.castToCodeableConcept(value));
3086        } else if (name.equals("answer")) {
3087          this.getAnswer().add((AnswerComponent) value);
3088        } else if (name.equals("text")) {
3089          this.text = TypeConvertor.castToString(value); // StringType
3090        } else if (name.equals("linkId")) {
3091          this.getLinkId().add(TypeConvertor.castToString(value));
3092        } else if (name.equals("securityLabelNumber")) {
3093          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
3094        } else
3095          return super.setProperty(name, value);
3096        return value;
3097      }
3098
3099      @Override
3100      public Base makeProperty(int hash, String name) throws FHIRException {
3101        switch (hash) {
3102        case -1618432855:  return addIdentifier(); 
3103        case 106437350:  return addParty(); 
3104        case 110546223:  return getTopic();
3105        case 3575610:  return getType();
3106        case 565719004:  return getDecision();
3107        case 675909535:  return addDecisionMode(); 
3108        case -1412808770:  return addAnswer(); 
3109        case 3556653:  return getTextElement();
3110        case -1102667083:  return addLinkIdElement();
3111        case -149460995:  return addSecurityLabelNumberElement();
3112        default: return super.makeProperty(hash, name);
3113        }
3114
3115      }
3116
3117      @Override
3118      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3119        switch (hash) {
3120        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3121        case 106437350: /*party*/ return new String[] {};
3122        case 110546223: /*topic*/ return new String[] {"Reference"};
3123        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3124        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
3125        case 675909535: /*decisionMode*/ return new String[] {"CodeableConcept"};
3126        case -1412808770: /*answer*/ return new String[] {};
3127        case 3556653: /*text*/ return new String[] {"string"};
3128        case -1102667083: /*linkId*/ return new String[] {"string"};
3129        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
3130        default: return super.getTypesForProperty(hash, name);
3131        }
3132
3133      }
3134
3135      @Override
3136      public Base addChild(String name) throws FHIRException {
3137        if (name.equals("identifier")) {
3138          return addIdentifier();
3139        }
3140        else if (name.equals("party")) {
3141          return addParty();
3142        }
3143        else if (name.equals("topic")) {
3144          this.topic = new Reference();
3145          return this.topic;
3146        }
3147        else if (name.equals("type")) {
3148          this.type = new CodeableConcept();
3149          return this.type;
3150        }
3151        else if (name.equals("decision")) {
3152          this.decision = new CodeableConcept();
3153          return this.decision;
3154        }
3155        else if (name.equals("decisionMode")) {
3156          return addDecisionMode();
3157        }
3158        else if (name.equals("answer")) {
3159          return addAnswer();
3160        }
3161        else if (name.equals("text")) {
3162          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.text");
3163        }
3164        else if (name.equals("linkId")) {
3165          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.linkId");
3166        }
3167        else if (name.equals("securityLabelNumber")) {
3168          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.offer.securityLabelNumber");
3169        }
3170        else
3171          return super.addChild(name);
3172      }
3173
3174      public ContractOfferComponent copy() {
3175        ContractOfferComponent dst = new ContractOfferComponent();
3176        copyValues(dst);
3177        return dst;
3178      }
3179
3180      public void copyValues(ContractOfferComponent dst) {
3181        super.copyValues(dst);
3182        if (identifier != null) {
3183          dst.identifier = new ArrayList<Identifier>();
3184          for (Identifier i : identifier)
3185            dst.identifier.add(i.copy());
3186        };
3187        if (party != null) {
3188          dst.party = new ArrayList<ContractPartyComponent>();
3189          for (ContractPartyComponent i : party)
3190            dst.party.add(i.copy());
3191        };
3192        dst.topic = topic == null ? null : topic.copy();
3193        dst.type = type == null ? null : type.copy();
3194        dst.decision = decision == null ? null : decision.copy();
3195        if (decisionMode != null) {
3196          dst.decisionMode = new ArrayList<CodeableConcept>();
3197          for (CodeableConcept i : decisionMode)
3198            dst.decisionMode.add(i.copy());
3199        };
3200        if (answer != null) {
3201          dst.answer = new ArrayList<AnswerComponent>();
3202          for (AnswerComponent i : answer)
3203            dst.answer.add(i.copy());
3204        };
3205        dst.text = text == null ? null : text.copy();
3206        if (linkId != null) {
3207          dst.linkId = new ArrayList<StringType>();
3208          for (StringType i : linkId)
3209            dst.linkId.add(i.copy());
3210        };
3211        if (securityLabelNumber != null) {
3212          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
3213          for (UnsignedIntType i : securityLabelNumber)
3214            dst.securityLabelNumber.add(i.copy());
3215        };
3216      }
3217
3218      @Override
3219      public boolean equalsDeep(Base other_) {
3220        if (!super.equalsDeep(other_))
3221          return false;
3222        if (!(other_ instanceof ContractOfferComponent))
3223          return false;
3224        ContractOfferComponent o = (ContractOfferComponent) other_;
3225        return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true) && compareDeep(topic, o.topic, true)
3226           && compareDeep(type, o.type, true) && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
3227           && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
3228           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
3229      }
3230
3231      @Override
3232      public boolean equalsShallow(Base other_) {
3233        if (!super.equalsShallow(other_))
3234          return false;
3235        if (!(other_ instanceof ContractOfferComponent))
3236          return false;
3237        ContractOfferComponent o = (ContractOfferComponent) other_;
3238        return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
3239          ;
3240      }
3241
3242      public boolean isEmpty() {
3243        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic
3244          , type, decision, decisionMode, answer, text, linkId, securityLabelNumber);
3245      }
3246
3247  public String fhirType() {
3248    return "Contract.term.offer";
3249
3250  }
3251
3252  }
3253
3254    @Block()
3255    public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
3256        /**
3257         * Participant in the offer.
3258         */
3259        @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)
3260        @Description(shortDefinition="Referenced entity", formalDefinition="Participant in the offer." )
3261        protected List<Reference> reference;
3262
3263        /**
3264         * How the party participates in the offer.
3265         */
3266        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
3267        @Description(shortDefinition="Participant engagement type", formalDefinition="How the party participates in the offer." )
3268        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-party-role")
3269        protected CodeableConcept role;
3270
3271        private static final long serialVersionUID = -1599592477L;
3272
3273    /**
3274     * Constructor
3275     */
3276      public ContractPartyComponent() {
3277        super();
3278      }
3279
3280    /**
3281     * Constructor
3282     */
3283      public ContractPartyComponent(Reference reference, CodeableConcept role) {
3284        super();
3285        this.addReference(reference);
3286        this.setRole(role);
3287      }
3288
3289        /**
3290         * @return {@link #reference} (Participant in the offer.)
3291         */
3292        public List<Reference> getReference() { 
3293          if (this.reference == null)
3294            this.reference = new ArrayList<Reference>();
3295          return this.reference;
3296        }
3297
3298        /**
3299         * @return Returns a reference to <code>this</code> for easy method chaining
3300         */
3301        public ContractPartyComponent setReference(List<Reference> theReference) { 
3302          this.reference = theReference;
3303          return this;
3304        }
3305
3306        public boolean hasReference() { 
3307          if (this.reference == null)
3308            return false;
3309          for (Reference item : this.reference)
3310            if (!item.isEmpty())
3311              return true;
3312          return false;
3313        }
3314
3315        public Reference addReference() { //3
3316          Reference t = new Reference();
3317          if (this.reference == null)
3318            this.reference = new ArrayList<Reference>();
3319          this.reference.add(t);
3320          return t;
3321        }
3322
3323        public ContractPartyComponent addReference(Reference t) { //3
3324          if (t == null)
3325            return this;
3326          if (this.reference == null)
3327            this.reference = new ArrayList<Reference>();
3328          this.reference.add(t);
3329          return this;
3330        }
3331
3332        /**
3333         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist {3}
3334         */
3335        public Reference getReferenceFirstRep() { 
3336          if (getReference().isEmpty()) {
3337            addReference();
3338          }
3339          return getReference().get(0);
3340        }
3341
3342        /**
3343         * @return {@link #role} (How the party participates in the offer.)
3344         */
3345        public CodeableConcept getRole() { 
3346          if (this.role == null)
3347            if (Configuration.errorOnAutoCreate())
3348              throw new Error("Attempt to auto-create ContractPartyComponent.role");
3349            else if (Configuration.doAutoCreate())
3350              this.role = new CodeableConcept(); // cc
3351          return this.role;
3352        }
3353
3354        public boolean hasRole() { 
3355          return this.role != null && !this.role.isEmpty();
3356        }
3357
3358        /**
3359         * @param value {@link #role} (How the party participates in the offer.)
3360         */
3361        public ContractPartyComponent setRole(CodeableConcept value) { 
3362          this.role = value;
3363          return this;
3364        }
3365
3366        protected void listChildren(List<Property> children) {
3367          super.listChildren(children);
3368          children.add(new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
3369          children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
3370        }
3371
3372        @Override
3373        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3374          switch (_hash) {
3375          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);
3376          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role);
3377          default: return super.getNamedProperty(_hash, _name, _checkValid);
3378          }
3379
3380        }
3381
3382      @Override
3383      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3384        switch (hash) {
3385        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
3386        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
3387        default: return super.getProperty(hash, name, checkValid);
3388        }
3389
3390      }
3391
3392      @Override
3393      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3394        switch (hash) {
3395        case -925155509: // reference
3396          this.getReference().add(TypeConvertor.castToReference(value)); // Reference
3397          return value;
3398        case 3506294: // role
3399          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3400          return value;
3401        default: return super.setProperty(hash, name, value);
3402        }
3403
3404      }
3405
3406      @Override
3407      public Base setProperty(String name, Base value) throws FHIRException {
3408        if (name.equals("reference")) {
3409          this.getReference().add(TypeConvertor.castToReference(value));
3410        } else if (name.equals("role")) {
3411          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3412        } else
3413          return super.setProperty(name, value);
3414        return value;
3415      }
3416
3417      @Override
3418      public Base makeProperty(int hash, String name) throws FHIRException {
3419        switch (hash) {
3420        case -925155509:  return addReference(); 
3421        case 3506294:  return getRole();
3422        default: return super.makeProperty(hash, name);
3423        }
3424
3425      }
3426
3427      @Override
3428      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3429        switch (hash) {
3430        case -925155509: /*reference*/ return new String[] {"Reference"};
3431        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
3432        default: return super.getTypesForProperty(hash, name);
3433        }
3434
3435      }
3436
3437      @Override
3438      public Base addChild(String name) throws FHIRException {
3439        if (name.equals("reference")) {
3440          return addReference();
3441        }
3442        else if (name.equals("role")) {
3443          this.role = new CodeableConcept();
3444          return this.role;
3445        }
3446        else
3447          return super.addChild(name);
3448      }
3449
3450      public ContractPartyComponent copy() {
3451        ContractPartyComponent dst = new ContractPartyComponent();
3452        copyValues(dst);
3453        return dst;
3454      }
3455
3456      public void copyValues(ContractPartyComponent dst) {
3457        super.copyValues(dst);
3458        if (reference != null) {
3459          dst.reference = new ArrayList<Reference>();
3460          for (Reference i : reference)
3461            dst.reference.add(i.copy());
3462        };
3463        dst.role = role == null ? null : role.copy();
3464      }
3465
3466      @Override
3467      public boolean equalsDeep(Base other_) {
3468        if (!super.equalsDeep(other_))
3469          return false;
3470        if (!(other_ instanceof ContractPartyComponent))
3471          return false;
3472        ContractPartyComponent o = (ContractPartyComponent) other_;
3473        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
3474      }
3475
3476      @Override
3477      public boolean equalsShallow(Base other_) {
3478        if (!super.equalsShallow(other_))
3479          return false;
3480        if (!(other_ instanceof ContractPartyComponent))
3481          return false;
3482        ContractPartyComponent o = (ContractPartyComponent) other_;
3483        return true;
3484      }
3485
3486      public boolean isEmpty() {
3487        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
3488      }
3489
3490  public String fhirType() {
3491    return "Contract.term.offer.party";
3492
3493  }
3494
3495  }
3496
3497    @Block()
3498    public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
3499        /**
3500         * 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.
3501         */
3502        @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)
3503        @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." )
3504        protected DataType value;
3505
3506        private static final long serialVersionUID = -1135414639L;
3507
3508    /**
3509     * Constructor
3510     */
3511      public AnswerComponent() {
3512        super();
3513      }
3514
3515    /**
3516     * Constructor
3517     */
3518      public AnswerComponent(DataType value) {
3519        super();
3520        this.setValue(value);
3521      }
3522
3523        /**
3524         * @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.)
3525         */
3526        public DataType getValue() { 
3527          return this.value;
3528        }
3529
3530        /**
3531         * @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.)
3532         */
3533        public BooleanType getValueBooleanType() throws FHIRException { 
3534          if (this.value == null)
3535            this.value = new BooleanType();
3536          if (!(this.value instanceof BooleanType))
3537            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3538          return (BooleanType) this.value;
3539        }
3540
3541        public boolean hasValueBooleanType() { 
3542          return this != null && this.value instanceof BooleanType;
3543        }
3544
3545        /**
3546         * @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.)
3547         */
3548        public DecimalType getValueDecimalType() throws FHIRException { 
3549          if (this.value == null)
3550            this.value = new DecimalType();
3551          if (!(this.value instanceof DecimalType))
3552            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
3553          return (DecimalType) this.value;
3554        }
3555
3556        public boolean hasValueDecimalType() { 
3557          return this != null && this.value instanceof DecimalType;
3558        }
3559
3560        /**
3561         * @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.)
3562         */
3563        public IntegerType getValueIntegerType() throws FHIRException { 
3564          if (this.value == null)
3565            this.value = new IntegerType();
3566          if (!(this.value instanceof IntegerType))
3567            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3568          return (IntegerType) this.value;
3569        }
3570
3571        public boolean hasValueIntegerType() { 
3572          return this != null && this.value instanceof IntegerType;
3573        }
3574
3575        /**
3576         * @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.)
3577         */
3578        public DateType getValueDateType() throws FHIRException { 
3579          if (this.value == null)
3580            this.value = new DateType();
3581          if (!(this.value instanceof DateType))
3582            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
3583          return (DateType) this.value;
3584        }
3585
3586        public boolean hasValueDateType() { 
3587          return this != null && this.value instanceof DateType;
3588        }
3589
3590        /**
3591         * @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.)
3592         */
3593        public DateTimeType getValueDateTimeType() throws FHIRException { 
3594          if (this.value == null)
3595            this.value = new DateTimeType();
3596          if (!(this.value instanceof DateTimeType))
3597            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3598          return (DateTimeType) this.value;
3599        }
3600
3601        public boolean hasValueDateTimeType() { 
3602          return this != null && this.value instanceof DateTimeType;
3603        }
3604
3605        /**
3606         * @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.)
3607         */
3608        public TimeType getValueTimeType() throws FHIRException { 
3609          if (this.value == null)
3610            this.value = new TimeType();
3611          if (!(this.value instanceof TimeType))
3612            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3613          return (TimeType) this.value;
3614        }
3615
3616        public boolean hasValueTimeType() { 
3617          return this != null && this.value instanceof TimeType;
3618        }
3619
3620        /**
3621         * @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.)
3622         */
3623        public StringType getValueStringType() throws FHIRException { 
3624          if (this.value == null)
3625            this.value = new StringType();
3626          if (!(this.value instanceof StringType))
3627            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3628          return (StringType) this.value;
3629        }
3630
3631        public boolean hasValueStringType() { 
3632          return this != null && this.value instanceof StringType;
3633        }
3634
3635        /**
3636         * @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.)
3637         */
3638        public UriType getValueUriType() throws FHIRException { 
3639          if (this.value == null)
3640            this.value = new UriType();
3641          if (!(this.value instanceof UriType))
3642            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3643          return (UriType) this.value;
3644        }
3645
3646        public boolean hasValueUriType() { 
3647          return this != null && this.value instanceof UriType;
3648        }
3649
3650        /**
3651         * @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.)
3652         */
3653        public Attachment getValueAttachment() throws FHIRException { 
3654          if (this.value == null)
3655            this.value = new Attachment();
3656          if (!(this.value instanceof Attachment))
3657            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3658          return (Attachment) this.value;
3659        }
3660
3661        public boolean hasValueAttachment() { 
3662          return this != null && this.value instanceof Attachment;
3663        }
3664
3665        /**
3666         * @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.)
3667         */
3668        public Coding getValueCoding() throws FHIRException { 
3669          if (this.value == null)
3670            this.value = new Coding();
3671          if (!(this.value instanceof Coding))
3672            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3673          return (Coding) this.value;
3674        }
3675
3676        public boolean hasValueCoding() { 
3677          return this != null && this.value instanceof Coding;
3678        }
3679
3680        /**
3681         * @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.)
3682         */
3683        public Quantity getValueQuantity() throws FHIRException { 
3684          if (this.value == null)
3685            this.value = new Quantity();
3686          if (!(this.value instanceof Quantity))
3687            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3688          return (Quantity) this.value;
3689        }
3690
3691        public boolean hasValueQuantity() { 
3692          return this != null && this.value instanceof Quantity;
3693        }
3694
3695        /**
3696         * @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.)
3697         */
3698        public Reference getValueReference() throws FHIRException { 
3699          if (this.value == null)
3700            this.value = new Reference();
3701          if (!(this.value instanceof Reference))
3702            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3703          return (Reference) this.value;
3704        }
3705
3706        public boolean hasValueReference() { 
3707          return this != null && this.value instanceof Reference;
3708        }
3709
3710        public boolean hasValue() { 
3711          return this.value != null && !this.value.isEmpty();
3712        }
3713
3714        /**
3715         * @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.)
3716         */
3717        public AnswerComponent setValue(DataType value) { 
3718          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))
3719            throw new Error("Not the right type for Contract.term.offer.answer.value[x]: "+value.fhirType());
3720          this.value = value;
3721          return this;
3722        }
3723
3724        protected void listChildren(List<Property> children) {
3725          super.listChildren(children);
3726          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));
3727        }
3728
3729        @Override
3730        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3731          switch (_hash) {
3732          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);
3733          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);
3734          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);
3735          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);
3736          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);
3737          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);
3738          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);
3739          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);
3740          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);
3741          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);
3742          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);
3743          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);
3744          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);
3745          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);
3746          default: return super.getNamedProperty(_hash, _name, _checkValid);
3747          }
3748
3749        }
3750
3751      @Override
3752      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3753        switch (hash) {
3754        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3755        default: return super.getProperty(hash, name, checkValid);
3756        }
3757
3758      }
3759
3760      @Override
3761      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3762        switch (hash) {
3763        case 111972721: // value
3764          this.value = TypeConvertor.castToType(value); // DataType
3765          return value;
3766        default: return super.setProperty(hash, name, value);
3767        }
3768
3769      }
3770
3771      @Override
3772      public Base setProperty(String name, Base value) throws FHIRException {
3773        if (name.equals("value[x]")) {
3774          this.value = TypeConvertor.castToType(value); // DataType
3775        } else
3776          return super.setProperty(name, value);
3777        return value;
3778      }
3779
3780      @Override
3781      public Base makeProperty(int hash, String name) throws FHIRException {
3782        switch (hash) {
3783        case -1410166417:  return getValue();
3784        case 111972721:  return getValue();
3785        default: return super.makeProperty(hash, name);
3786        }
3787
3788      }
3789
3790      @Override
3791      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3792        switch (hash) {
3793        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3794        default: return super.getTypesForProperty(hash, name);
3795        }
3796
3797      }
3798
3799      @Override
3800      public Base addChild(String name) throws FHIRException {
3801        if (name.equals("valueBoolean")) {
3802          this.value = new BooleanType();
3803          return this.value;
3804        }
3805        else if (name.equals("valueDecimal")) {
3806          this.value = new DecimalType();
3807          return this.value;
3808        }
3809        else if (name.equals("valueInteger")) {
3810          this.value = new IntegerType();
3811          return this.value;
3812        }
3813        else if (name.equals("valueDate")) {
3814          this.value = new DateType();
3815          return this.value;
3816        }
3817        else if (name.equals("valueDateTime")) {
3818          this.value = new DateTimeType();
3819          return this.value;
3820        }
3821        else if (name.equals("valueTime")) {
3822          this.value = new TimeType();
3823          return this.value;
3824        }
3825        else if (name.equals("valueString")) {
3826          this.value = new StringType();
3827          return this.value;
3828        }
3829        else if (name.equals("valueUri")) {
3830          this.value = new UriType();
3831          return this.value;
3832        }
3833        else if (name.equals("valueAttachment")) {
3834          this.value = new Attachment();
3835          return this.value;
3836        }
3837        else if (name.equals("valueCoding")) {
3838          this.value = new Coding();
3839          return this.value;
3840        }
3841        else if (name.equals("valueQuantity")) {
3842          this.value = new Quantity();
3843          return this.value;
3844        }
3845        else if (name.equals("valueReference")) {
3846          this.value = new Reference();
3847          return this.value;
3848        }
3849        else
3850          return super.addChild(name);
3851      }
3852
3853      public AnswerComponent copy() {
3854        AnswerComponent dst = new AnswerComponent();
3855        copyValues(dst);
3856        return dst;
3857      }
3858
3859      public void copyValues(AnswerComponent dst) {
3860        super.copyValues(dst);
3861        dst.value = value == null ? null : value.copy();
3862      }
3863
3864      @Override
3865      public boolean equalsDeep(Base other_) {
3866        if (!super.equalsDeep(other_))
3867          return false;
3868        if (!(other_ instanceof AnswerComponent))
3869          return false;
3870        AnswerComponent o = (AnswerComponent) other_;
3871        return compareDeep(value, o.value, true);
3872      }
3873
3874      @Override
3875      public boolean equalsShallow(Base other_) {
3876        if (!super.equalsShallow(other_))
3877          return false;
3878        if (!(other_ instanceof AnswerComponent))
3879          return false;
3880        AnswerComponent o = (AnswerComponent) other_;
3881        return true;
3882      }
3883
3884      public boolean isEmpty() {
3885        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3886      }
3887
3888  public String fhirType() {
3889    return "Contract.term.offer.answer";
3890
3891  }
3892
3893  }
3894
3895    @Block()
3896    public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
3897        /**
3898         * Differentiates the kind of the asset .
3899         */
3900        @Child(name = "scope", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3901        @Description(shortDefinition="Range of asset", formalDefinition="Differentiates the kind of the asset ." )
3902        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetscope")
3903        protected CodeableConcept scope;
3904
3905        /**
3906         * Target entity type about which the term may be concerned.
3907         */
3908        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3909        @Description(shortDefinition="Asset category", formalDefinition="Target entity type about which the term may be concerned." )
3910        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assettype")
3911        protected List<CodeableConcept> type;
3912
3913        /**
3914         * Associated entities.
3915         */
3916        @Child(name = "typeReference", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3917        @Description(shortDefinition="Associated entities", formalDefinition="Associated entities." )
3918        protected List<Reference> typeReference;
3919
3920        /**
3921         * May be a subtype or part of an offered asset.
3922         */
3923        @Child(name = "subtype", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3924        @Description(shortDefinition="Asset sub-category", formalDefinition="May be a subtype or part of an offered asset." )
3925        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetsubtype")
3926        protected List<CodeableConcept> subtype;
3927
3928        /**
3929         * 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.
3930         */
3931        @Child(name = "relationship", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=false)
3932        @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." )
3933        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-class")
3934        protected Coding relationship;
3935
3936        /**
3937         * Circumstance of the asset.
3938         */
3939        @Child(name = "context", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3940        @Description(shortDefinition="Circumstance of the asset", formalDefinition="Circumstance of the asset." )
3941        protected List<AssetContextComponent> context;
3942
3943        /**
3944         * Description of the quality and completeness of the asset that imay be a factor in its valuation.
3945         */
3946        @Child(name = "condition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3947        @Description(shortDefinition="Quality desctiption of asset", formalDefinition="Description of the quality and completeness of the asset that imay be a factor in its valuation." )
3948        protected StringType condition;
3949
3950        /**
3951         * Type of Asset availability for use or ownership.
3952         */
3953        @Child(name = "periodType", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3954        @Description(shortDefinition="Asset availability types", formalDefinition="Type of Asset availability for use or ownership." )
3955        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/asset-availability")
3956        protected List<CodeableConcept> periodType;
3957
3958        /**
3959         * Asset relevant contractual time period.
3960         */
3961        @Child(name = "period", type = {Period.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3962        @Description(shortDefinition="Time period of the asset", formalDefinition="Asset relevant contractual time period." )
3963        protected List<Period> period;
3964
3965        /**
3966         * Time period of asset use.
3967         */
3968        @Child(name = "usePeriod", type = {Period.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3969        @Description(shortDefinition="Time period", formalDefinition="Time period of asset use." )
3970        protected List<Period> usePeriod;
3971
3972        /**
3973         * Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
3974         */
3975        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
3976        @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." )
3977        protected StringType text;
3978
3979        /**
3980         * Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.
3981         */
3982        @Child(name = "linkId", type = {StringType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3983        @Description(shortDefinition="Pointer to asset text", formalDefinition="Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse." )
3984        protected List<StringType> linkId;
3985
3986        /**
3987         * Response to assets.
3988         */
3989        @Child(name = "answer", type = {AnswerComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3990        @Description(shortDefinition="Response to assets", formalDefinition="Response to assets." )
3991        protected List<AnswerComponent> answer;
3992
3993        /**
3994         * Security labels that protects the asset.
3995         */
3996        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3997        @Description(shortDefinition="Asset restriction numbers", formalDefinition="Security labels that protects the asset." )
3998        protected List<UnsignedIntType> securityLabelNumber;
3999
4000        /**
4001         * Contract Valued Item List.
4002         */
4003        @Child(name = "valuedItem", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4004        @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
4005        protected List<ValuedItemComponent> valuedItem;
4006
4007        private static final long serialVersionUID = -581986730L;
4008
4009    /**
4010     * Constructor
4011     */
4012      public ContractAssetComponent() {
4013        super();
4014      }
4015
4016        /**
4017         * @return {@link #scope} (Differentiates the kind of the asset .)
4018         */
4019        public CodeableConcept getScope() { 
4020          if (this.scope == null)
4021            if (Configuration.errorOnAutoCreate())
4022              throw new Error("Attempt to auto-create ContractAssetComponent.scope");
4023            else if (Configuration.doAutoCreate())
4024              this.scope = new CodeableConcept(); // cc
4025          return this.scope;
4026        }
4027
4028        public boolean hasScope() { 
4029          return this.scope != null && !this.scope.isEmpty();
4030        }
4031
4032        /**
4033         * @param value {@link #scope} (Differentiates the kind of the asset .)
4034         */
4035        public ContractAssetComponent setScope(CodeableConcept value) { 
4036          this.scope = value;
4037          return this;
4038        }
4039
4040        /**
4041         * @return {@link #type} (Target entity type about which the term may be concerned.)
4042         */
4043        public List<CodeableConcept> getType() { 
4044          if (this.type == null)
4045            this.type = new ArrayList<CodeableConcept>();
4046          return this.type;
4047        }
4048
4049        /**
4050         * @return Returns a reference to <code>this</code> for easy method chaining
4051         */
4052        public ContractAssetComponent setType(List<CodeableConcept> theType) { 
4053          this.type = theType;
4054          return this;
4055        }
4056
4057        public boolean hasType() { 
4058          if (this.type == null)
4059            return false;
4060          for (CodeableConcept item : this.type)
4061            if (!item.isEmpty())
4062              return true;
4063          return false;
4064        }
4065
4066        public CodeableConcept addType() { //3
4067          CodeableConcept t = new CodeableConcept();
4068          if (this.type == null)
4069            this.type = new ArrayList<CodeableConcept>();
4070          this.type.add(t);
4071          return t;
4072        }
4073
4074        public ContractAssetComponent addType(CodeableConcept t) { //3
4075          if (t == null)
4076            return this;
4077          if (this.type == null)
4078            this.type = new ArrayList<CodeableConcept>();
4079          this.type.add(t);
4080          return this;
4081        }
4082
4083        /**
4084         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
4085         */
4086        public CodeableConcept getTypeFirstRep() { 
4087          if (getType().isEmpty()) {
4088            addType();
4089          }
4090          return getType().get(0);
4091        }
4092
4093        /**
4094         * @return {@link #typeReference} (Associated entities.)
4095         */
4096        public List<Reference> getTypeReference() { 
4097          if (this.typeReference == null)
4098            this.typeReference = new ArrayList<Reference>();
4099          return this.typeReference;
4100        }
4101
4102        /**
4103         * @return Returns a reference to <code>this</code> for easy method chaining
4104         */
4105        public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) { 
4106          this.typeReference = theTypeReference;
4107          return this;
4108        }
4109
4110        public boolean hasTypeReference() { 
4111          if (this.typeReference == null)
4112            return false;
4113          for (Reference item : this.typeReference)
4114            if (!item.isEmpty())
4115              return true;
4116          return false;
4117        }
4118
4119        public Reference addTypeReference() { //3
4120          Reference t = new Reference();
4121          if (this.typeReference == null)
4122            this.typeReference = new ArrayList<Reference>();
4123          this.typeReference.add(t);
4124          return t;
4125        }
4126
4127        public ContractAssetComponent addTypeReference(Reference t) { //3
4128          if (t == null)
4129            return this;
4130          if (this.typeReference == null)
4131            this.typeReference = new ArrayList<Reference>();
4132          this.typeReference.add(t);
4133          return this;
4134        }
4135
4136        /**
4137         * @return The first repetition of repeating field {@link #typeReference}, creating it if it does not already exist {3}
4138         */
4139        public Reference getTypeReferenceFirstRep() { 
4140          if (getTypeReference().isEmpty()) {
4141            addTypeReference();
4142          }
4143          return getTypeReference().get(0);
4144        }
4145
4146        /**
4147         * @return {@link #subtype} (May be a subtype or part of an offered asset.)
4148         */
4149        public List<CodeableConcept> getSubtype() { 
4150          if (this.subtype == null)
4151            this.subtype = new ArrayList<CodeableConcept>();
4152          return this.subtype;
4153        }
4154
4155        /**
4156         * @return Returns a reference to <code>this</code> for easy method chaining
4157         */
4158        public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) { 
4159          this.subtype = theSubtype;
4160          return this;
4161        }
4162
4163        public boolean hasSubtype() { 
4164          if (this.subtype == null)
4165            return false;
4166          for (CodeableConcept item : this.subtype)
4167            if (!item.isEmpty())
4168              return true;
4169          return false;
4170        }
4171
4172        public CodeableConcept addSubtype() { //3
4173          CodeableConcept t = new CodeableConcept();
4174          if (this.subtype == null)
4175            this.subtype = new ArrayList<CodeableConcept>();
4176          this.subtype.add(t);
4177          return t;
4178        }
4179
4180        public ContractAssetComponent addSubtype(CodeableConcept t) { //3
4181          if (t == null)
4182            return this;
4183          if (this.subtype == null)
4184            this.subtype = new ArrayList<CodeableConcept>();
4185          this.subtype.add(t);
4186          return this;
4187        }
4188
4189        /**
4190         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist {3}
4191         */
4192        public CodeableConcept getSubtypeFirstRep() { 
4193          if (getSubtype().isEmpty()) {
4194            addSubtype();
4195          }
4196          return getSubtype().get(0);
4197        }
4198
4199        /**
4200         * @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.)
4201         */
4202        public Coding getRelationship() { 
4203          if (this.relationship == null)
4204            if (Configuration.errorOnAutoCreate())
4205              throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
4206            else if (Configuration.doAutoCreate())
4207              this.relationship = new Coding(); // cc
4208          return this.relationship;
4209        }
4210
4211        public boolean hasRelationship() { 
4212          return this.relationship != null && !this.relationship.isEmpty();
4213        }
4214
4215        /**
4216         * @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.)
4217         */
4218        public ContractAssetComponent setRelationship(Coding value) { 
4219          this.relationship = value;
4220          return this;
4221        }
4222
4223        /**
4224         * @return {@link #context} (Circumstance of the asset.)
4225         */
4226        public List<AssetContextComponent> getContext() { 
4227          if (this.context == null)
4228            this.context = new ArrayList<AssetContextComponent>();
4229          return this.context;
4230        }
4231
4232        /**
4233         * @return Returns a reference to <code>this</code> for easy method chaining
4234         */
4235        public ContractAssetComponent setContext(List<AssetContextComponent> theContext) { 
4236          this.context = theContext;
4237          return this;
4238        }
4239
4240        public boolean hasContext() { 
4241          if (this.context == null)
4242            return false;
4243          for (AssetContextComponent item : this.context)
4244            if (!item.isEmpty())
4245              return true;
4246          return false;
4247        }
4248
4249        public AssetContextComponent addContext() { //3
4250          AssetContextComponent t = new AssetContextComponent();
4251          if (this.context == null)
4252            this.context = new ArrayList<AssetContextComponent>();
4253          this.context.add(t);
4254          return t;
4255        }
4256
4257        public ContractAssetComponent addContext(AssetContextComponent t) { //3
4258          if (t == null)
4259            return this;
4260          if (this.context == null)
4261            this.context = new ArrayList<AssetContextComponent>();
4262          this.context.add(t);
4263          return this;
4264        }
4265
4266        /**
4267         * @return The first repetition of repeating field {@link #context}, creating it if it does not already exist {3}
4268         */
4269        public AssetContextComponent getContextFirstRep() { 
4270          if (getContext().isEmpty()) {
4271            addContext();
4272          }
4273          return getContext().get(0);
4274        }
4275
4276        /**
4277         * @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
4278         */
4279        public StringType getConditionElement() { 
4280          if (this.condition == null)
4281            if (Configuration.errorOnAutoCreate())
4282              throw new Error("Attempt to auto-create ContractAssetComponent.condition");
4283            else if (Configuration.doAutoCreate())
4284              this.condition = new StringType(); // bb
4285          return this.condition;
4286        }
4287
4288        public boolean hasConditionElement() { 
4289          return this.condition != null && !this.condition.isEmpty();
4290        }
4291
4292        public boolean hasCondition() { 
4293          return this.condition != null && !this.condition.isEmpty();
4294        }
4295
4296        /**
4297         * @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
4298         */
4299        public ContractAssetComponent setConditionElement(StringType value) { 
4300          this.condition = value;
4301          return this;
4302        }
4303
4304        /**
4305         * @return Description of the quality and completeness of the asset that imay be a factor in its valuation.
4306         */
4307        public String getCondition() { 
4308          return this.condition == null ? null : this.condition.getValue();
4309        }
4310
4311        /**
4312         * @param value Description of the quality and completeness of the asset that imay be a factor in its valuation.
4313         */
4314        public ContractAssetComponent setCondition(String value) { 
4315          if (Utilities.noString(value))
4316            this.condition = null;
4317          else {
4318            if (this.condition == null)
4319              this.condition = new StringType();
4320            this.condition.setValue(value);
4321          }
4322          return this;
4323        }
4324
4325        /**
4326         * @return {@link #periodType} (Type of Asset availability for use or ownership.)
4327         */
4328        public List<CodeableConcept> getPeriodType() { 
4329          if (this.periodType == null)
4330            this.periodType = new ArrayList<CodeableConcept>();
4331          return this.periodType;
4332        }
4333
4334        /**
4335         * @return Returns a reference to <code>this</code> for easy method chaining
4336         */
4337        public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) { 
4338          this.periodType = thePeriodType;
4339          return this;
4340        }
4341
4342        public boolean hasPeriodType() { 
4343          if (this.periodType == null)
4344            return false;
4345          for (CodeableConcept item : this.periodType)
4346            if (!item.isEmpty())
4347              return true;
4348          return false;
4349        }
4350
4351        public CodeableConcept addPeriodType() { //3
4352          CodeableConcept t = new CodeableConcept();
4353          if (this.periodType == null)
4354            this.periodType = new ArrayList<CodeableConcept>();
4355          this.periodType.add(t);
4356          return t;
4357        }
4358
4359        public ContractAssetComponent addPeriodType(CodeableConcept t) { //3
4360          if (t == null)
4361            return this;
4362          if (this.periodType == null)
4363            this.periodType = new ArrayList<CodeableConcept>();
4364          this.periodType.add(t);
4365          return this;
4366        }
4367
4368        /**
4369         * @return The first repetition of repeating field {@link #periodType}, creating it if it does not already exist {3}
4370         */
4371        public CodeableConcept getPeriodTypeFirstRep() { 
4372          if (getPeriodType().isEmpty()) {
4373            addPeriodType();
4374          }
4375          return getPeriodType().get(0);
4376        }
4377
4378        /**
4379         * @return {@link #period} (Asset relevant contractual time period.)
4380         */
4381        public List<Period> getPeriod() { 
4382          if (this.period == null)
4383            this.period = new ArrayList<Period>();
4384          return this.period;
4385        }
4386
4387        /**
4388         * @return Returns a reference to <code>this</code> for easy method chaining
4389         */
4390        public ContractAssetComponent setPeriod(List<Period> thePeriod) { 
4391          this.period = thePeriod;
4392          return this;
4393        }
4394
4395        public boolean hasPeriod() { 
4396          if (this.period == null)
4397            return false;
4398          for (Period item : this.period)
4399            if (!item.isEmpty())
4400              return true;
4401          return false;
4402        }
4403
4404        public Period addPeriod() { //3
4405          Period t = new Period();
4406          if (this.period == null)
4407            this.period = new ArrayList<Period>();
4408          this.period.add(t);
4409          return t;
4410        }
4411
4412        public ContractAssetComponent addPeriod(Period t) { //3
4413          if (t == null)
4414            return this;
4415          if (this.period == null)
4416            this.period = new ArrayList<Period>();
4417          this.period.add(t);
4418          return this;
4419        }
4420
4421        /**
4422         * @return The first repetition of repeating field {@link #period}, creating it if it does not already exist {3}
4423         */
4424        public Period getPeriodFirstRep() { 
4425          if (getPeriod().isEmpty()) {
4426            addPeriod();
4427          }
4428          return getPeriod().get(0);
4429        }
4430
4431        /**
4432         * @return {@link #usePeriod} (Time period of asset use.)
4433         */
4434        public List<Period> getUsePeriod() { 
4435          if (this.usePeriod == null)
4436            this.usePeriod = new ArrayList<Period>();
4437          return this.usePeriod;
4438        }
4439
4440        /**
4441         * @return Returns a reference to <code>this</code> for easy method chaining
4442         */
4443        public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) { 
4444          this.usePeriod = theUsePeriod;
4445          return this;
4446        }
4447
4448        public boolean hasUsePeriod() { 
4449          if (this.usePeriod == null)
4450            return false;
4451          for (Period item : this.usePeriod)
4452            if (!item.isEmpty())
4453              return true;
4454          return false;
4455        }
4456
4457        public Period addUsePeriod() { //3
4458          Period t = new Period();
4459          if (this.usePeriod == null)
4460            this.usePeriod = new ArrayList<Period>();
4461          this.usePeriod.add(t);
4462          return t;
4463        }
4464
4465        public ContractAssetComponent addUsePeriod(Period t) { //3
4466          if (t == null)
4467            return this;
4468          if (this.usePeriod == null)
4469            this.usePeriod = new ArrayList<Period>();
4470          this.usePeriod.add(t);
4471          return this;
4472        }
4473
4474        /**
4475         * @return The first repetition of repeating field {@link #usePeriod}, creating it if it does not already exist {3}
4476         */
4477        public Period getUsePeriodFirstRep() { 
4478          if (getUsePeriod().isEmpty()) {
4479            addUsePeriod();
4480          }
4481          return getUsePeriod().get(0);
4482        }
4483
4484        /**
4485         * @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
4486         */
4487        public StringType getTextElement() { 
4488          if (this.text == null)
4489            if (Configuration.errorOnAutoCreate())
4490              throw new Error("Attempt to auto-create ContractAssetComponent.text");
4491            else if (Configuration.doAutoCreate())
4492              this.text = new StringType(); // bb
4493          return this.text;
4494        }
4495
4496        public boolean hasTextElement() { 
4497          return this.text != null && !this.text.isEmpty();
4498        }
4499
4500        public boolean hasText() { 
4501          return this.text != null && !this.text.isEmpty();
4502        }
4503
4504        /**
4505         * @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
4506         */
4507        public ContractAssetComponent setTextElement(StringType value) { 
4508          this.text = value;
4509          return this;
4510        }
4511
4512        /**
4513         * @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.
4514         */
4515        public String getText() { 
4516          return this.text == null ? null : this.text.getValue();
4517        }
4518
4519        /**
4520         * @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.
4521         */
4522        public ContractAssetComponent setText(String value) { 
4523          if (Utilities.noString(value))
4524            this.text = null;
4525          else {
4526            if (this.text == null)
4527              this.text = new StringType();
4528            this.text.setValue(value);
4529          }
4530          return this;
4531        }
4532
4533        /**
4534         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4535         */
4536        public List<StringType> getLinkId() { 
4537          if (this.linkId == null)
4538            this.linkId = new ArrayList<StringType>();
4539          return this.linkId;
4540        }
4541
4542        /**
4543         * @return Returns a reference to <code>this</code> for easy method chaining
4544         */
4545        public ContractAssetComponent setLinkId(List<StringType> theLinkId) { 
4546          this.linkId = theLinkId;
4547          return this;
4548        }
4549
4550        public boolean hasLinkId() { 
4551          if (this.linkId == null)
4552            return false;
4553          for (StringType item : this.linkId)
4554            if (!item.isEmpty())
4555              return true;
4556          return false;
4557        }
4558
4559        /**
4560         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4561         */
4562        public StringType addLinkIdElement() {//2 
4563          StringType t = new StringType();
4564          if (this.linkId == null)
4565            this.linkId = new ArrayList<StringType>();
4566          this.linkId.add(t);
4567          return t;
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 ContractAssetComponent addLinkId(String value) { //1
4574          StringType t = new StringType();
4575          t.setValue(value);
4576          if (this.linkId == null)
4577            this.linkId = new ArrayList<StringType>();
4578          this.linkId.add(t);
4579          return this;
4580        }
4581
4582        /**
4583         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4584         */
4585        public boolean hasLinkId(String value) { 
4586          if (this.linkId == null)
4587            return false;
4588          for (StringType v : this.linkId)
4589            if (v.getValue().equals(value)) // string
4590              return true;
4591          return false;
4592        }
4593
4594        /**
4595         * @return {@link #answer} (Response to assets.)
4596         */
4597        public List<AnswerComponent> getAnswer() { 
4598          if (this.answer == null)
4599            this.answer = new ArrayList<AnswerComponent>();
4600          return this.answer;
4601        }
4602
4603        /**
4604         * @return Returns a reference to <code>this</code> for easy method chaining
4605         */
4606        public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) { 
4607          this.answer = theAnswer;
4608          return this;
4609        }
4610
4611        public boolean hasAnswer() { 
4612          if (this.answer == null)
4613            return false;
4614          for (AnswerComponent item : this.answer)
4615            if (!item.isEmpty())
4616              return true;
4617          return false;
4618        }
4619
4620        public AnswerComponent addAnswer() { //3
4621          AnswerComponent t = new AnswerComponent();
4622          if (this.answer == null)
4623            this.answer = new ArrayList<AnswerComponent>();
4624          this.answer.add(t);
4625          return t;
4626        }
4627
4628        public ContractAssetComponent addAnswer(AnswerComponent t) { //3
4629          if (t == null)
4630            return this;
4631          if (this.answer == null)
4632            this.answer = new ArrayList<AnswerComponent>();
4633          this.answer.add(t);
4634          return this;
4635        }
4636
4637        /**
4638         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist {3}
4639         */
4640        public AnswerComponent getAnswerFirstRep() { 
4641          if (getAnswer().isEmpty()) {
4642            addAnswer();
4643          }
4644          return getAnswer().get(0);
4645        }
4646
4647        /**
4648         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4649         */
4650        public List<UnsignedIntType> getSecurityLabelNumber() { 
4651          if (this.securityLabelNumber == null)
4652            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4653          return this.securityLabelNumber;
4654        }
4655
4656        /**
4657         * @return Returns a reference to <code>this</code> for easy method chaining
4658         */
4659        public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
4660          this.securityLabelNumber = theSecurityLabelNumber;
4661          return this;
4662        }
4663
4664        public boolean hasSecurityLabelNumber() { 
4665          if (this.securityLabelNumber == null)
4666            return false;
4667          for (UnsignedIntType item : this.securityLabelNumber)
4668            if (!item.isEmpty())
4669              return true;
4670          return false;
4671        }
4672
4673        /**
4674         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4675         */
4676        public UnsignedIntType addSecurityLabelNumberElement() {//2 
4677          UnsignedIntType t = new UnsignedIntType();
4678          if (this.securityLabelNumber == null)
4679            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4680          this.securityLabelNumber.add(t);
4681          return t;
4682        }
4683
4684        /**
4685         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4686         */
4687        public ContractAssetComponent addSecurityLabelNumber(int value) { //1
4688          UnsignedIntType t = new UnsignedIntType();
4689          t.setValue(value);
4690          if (this.securityLabelNumber == null)
4691            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4692          this.securityLabelNumber.add(t);
4693          return this;
4694        }
4695
4696        /**
4697         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4698         */
4699        public boolean hasSecurityLabelNumber(int value) { 
4700          if (this.securityLabelNumber == null)
4701            return false;
4702          for (UnsignedIntType v : this.securityLabelNumber)
4703            if (v.getValue().equals(value)) // unsignedInt
4704              return true;
4705          return false;
4706        }
4707
4708        /**
4709         * @return {@link #valuedItem} (Contract Valued Item List.)
4710         */
4711        public List<ValuedItemComponent> getValuedItem() { 
4712          if (this.valuedItem == null)
4713            this.valuedItem = new ArrayList<ValuedItemComponent>();
4714          return this.valuedItem;
4715        }
4716
4717        /**
4718         * @return Returns a reference to <code>this</code> for easy method chaining
4719         */
4720        public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) { 
4721          this.valuedItem = theValuedItem;
4722          return this;
4723        }
4724
4725        public boolean hasValuedItem() { 
4726          if (this.valuedItem == null)
4727            return false;
4728          for (ValuedItemComponent item : this.valuedItem)
4729            if (!item.isEmpty())
4730              return true;
4731          return false;
4732        }
4733
4734        public ValuedItemComponent addValuedItem() { //3
4735          ValuedItemComponent t = new ValuedItemComponent();
4736          if (this.valuedItem == null)
4737            this.valuedItem = new ArrayList<ValuedItemComponent>();
4738          this.valuedItem.add(t);
4739          return t;
4740        }
4741
4742        public ContractAssetComponent addValuedItem(ValuedItemComponent t) { //3
4743          if (t == null)
4744            return this;
4745          if (this.valuedItem == null)
4746            this.valuedItem = new ArrayList<ValuedItemComponent>();
4747          this.valuedItem.add(t);
4748          return this;
4749        }
4750
4751        /**
4752         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist {3}
4753         */
4754        public ValuedItemComponent getValuedItemFirstRep() { 
4755          if (getValuedItem().isEmpty()) {
4756            addValuedItem();
4757          }
4758          return getValuedItem().get(0);
4759        }
4760
4761        protected void listChildren(List<Property> children) {
4762          super.listChildren(children);
4763          children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
4764          children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type));
4765          children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference));
4766          children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0, java.lang.Integer.MAX_VALUE, subtype));
4767          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));
4768          children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
4769          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));
4770          children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType));
4771          children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period));
4772          children.add(new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
4773          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));
4774          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));
4775          children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer));
4776          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
4777          children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
4778        }
4779
4780        @Override
4781        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4782          switch (_hash) {
4783          case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope);
4784          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);
4785          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference);
4786          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);
4787          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);
4788          case 951530927: /*context*/  return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context);
4789          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);
4790          case 384348315: /*periodType*/  return new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
4791          case -991726143: /*period*/  return new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period);
4792          case -628382168: /*usePeriod*/  return new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod);
4793          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);
4794          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);
4795          case -1412808770: /*answer*/  return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer);
4796          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
4797          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
4798          default: return super.getNamedProperty(_hash, _name, _checkValid);
4799          }
4800
4801        }
4802
4803      @Override
4804      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4805        switch (hash) {
4806        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
4807        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4808        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
4809        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
4810        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
4811        case 951530927: /*context*/ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
4812        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
4813        case 384348315: /*periodType*/ return this.periodType == null ? new Base[0] : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
4814        case -991726143: /*period*/ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
4815        case -628382168: /*usePeriod*/ return this.usePeriod == null ? new Base[0] : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
4816        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
4817        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
4818        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
4819        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
4820        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
4821        default: return super.getProperty(hash, name, checkValid);
4822        }
4823
4824      }
4825
4826      @Override
4827      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4828        switch (hash) {
4829        case 109264468: // scope
4830          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4831          return value;
4832        case 3575610: // type
4833          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4834          return value;
4835        case 2074825009: // typeReference
4836          this.getTypeReference().add(TypeConvertor.castToReference(value)); // Reference
4837          return value;
4838        case -1867567750: // subtype
4839          this.getSubtype().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4840          return value;
4841        case -261851592: // relationship
4842          this.relationship = TypeConvertor.castToCoding(value); // Coding
4843          return value;
4844        case 951530927: // context
4845          this.getContext().add((AssetContextComponent) value); // AssetContextComponent
4846          return value;
4847        case -861311717: // condition
4848          this.condition = TypeConvertor.castToString(value); // StringType
4849          return value;
4850        case 384348315: // periodType
4851          this.getPeriodType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4852          return value;
4853        case -991726143: // period
4854          this.getPeriod().add(TypeConvertor.castToPeriod(value)); // Period
4855          return value;
4856        case -628382168: // usePeriod
4857          this.getUsePeriod().add(TypeConvertor.castToPeriod(value)); // Period
4858          return value;
4859        case 3556653: // text
4860          this.text = TypeConvertor.castToString(value); // StringType
4861          return value;
4862        case -1102667083: // linkId
4863          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
4864          return value;
4865        case -1412808770: // answer
4866          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
4867          return value;
4868        case -149460995: // securityLabelNumber
4869          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
4870          return value;
4871        case 2046675654: // valuedItem
4872          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
4873          return value;
4874        default: return super.setProperty(hash, name, value);
4875        }
4876
4877      }
4878
4879      @Override
4880      public Base setProperty(String name, Base value) throws FHIRException {
4881        if (name.equals("scope")) {
4882          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4883        } else if (name.equals("type")) {
4884          this.getType().add(TypeConvertor.castToCodeableConcept(value));
4885        } else if (name.equals("typeReference")) {
4886          this.getTypeReference().add(TypeConvertor.castToReference(value));
4887        } else if (name.equals("subtype")) {
4888          this.getSubtype().add(TypeConvertor.castToCodeableConcept(value));
4889        } else if (name.equals("relationship")) {
4890          this.relationship = TypeConvertor.castToCoding(value); // Coding
4891        } else if (name.equals("context")) {
4892          this.getContext().add((AssetContextComponent) value);
4893        } else if (name.equals("condition")) {
4894          this.condition = TypeConvertor.castToString(value); // StringType
4895        } else if (name.equals("periodType")) {
4896          this.getPeriodType().add(TypeConvertor.castToCodeableConcept(value));
4897        } else if (name.equals("period")) {
4898          this.getPeriod().add(TypeConvertor.castToPeriod(value));
4899        } else if (name.equals("usePeriod")) {
4900          this.getUsePeriod().add(TypeConvertor.castToPeriod(value));
4901        } else if (name.equals("text")) {
4902          this.text = TypeConvertor.castToString(value); // StringType
4903        } else if (name.equals("linkId")) {
4904          this.getLinkId().add(TypeConvertor.castToString(value));
4905        } else if (name.equals("answer")) {
4906          this.getAnswer().add((AnswerComponent) value);
4907        } else if (name.equals("securityLabelNumber")) {
4908          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
4909        } else if (name.equals("valuedItem")) {
4910          this.getValuedItem().add((ValuedItemComponent) value);
4911        } else
4912          return super.setProperty(name, value);
4913        return value;
4914      }
4915
4916      @Override
4917      public Base makeProperty(int hash, String name) throws FHIRException {
4918        switch (hash) {
4919        case 109264468:  return getScope();
4920        case 3575610:  return addType(); 
4921        case 2074825009:  return addTypeReference(); 
4922        case -1867567750:  return addSubtype(); 
4923        case -261851592:  return getRelationship();
4924        case 951530927:  return addContext(); 
4925        case -861311717:  return getConditionElement();
4926        case 384348315:  return addPeriodType(); 
4927        case -991726143:  return addPeriod(); 
4928        case -628382168:  return addUsePeriod(); 
4929        case 3556653:  return getTextElement();
4930        case -1102667083:  return addLinkIdElement();
4931        case -1412808770:  return addAnswer(); 
4932        case -149460995:  return addSecurityLabelNumberElement();
4933        case 2046675654:  return addValuedItem(); 
4934        default: return super.makeProperty(hash, name);
4935        }
4936
4937      }
4938
4939      @Override
4940      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4941        switch (hash) {
4942        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
4943        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4944        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
4945        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
4946        case -261851592: /*relationship*/ return new String[] {"Coding"};
4947        case 951530927: /*context*/ return new String[] {};
4948        case -861311717: /*condition*/ return new String[] {"string"};
4949        case 384348315: /*periodType*/ return new String[] {"CodeableConcept"};
4950        case -991726143: /*period*/ return new String[] {"Period"};
4951        case -628382168: /*usePeriod*/ return new String[] {"Period"};
4952        case 3556653: /*text*/ return new String[] {"string"};
4953        case -1102667083: /*linkId*/ return new String[] {"string"};
4954        case -1412808770: /*answer*/ return new String[] {"@Contract.term.offer.answer"};
4955        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
4956        case 2046675654: /*valuedItem*/ return new String[] {};
4957        default: return super.getTypesForProperty(hash, name);
4958        }
4959
4960      }
4961
4962      @Override
4963      public Base addChild(String name) throws FHIRException {
4964        if (name.equals("scope")) {
4965          this.scope = new CodeableConcept();
4966          return this.scope;
4967        }
4968        else if (name.equals("type")) {
4969          return addType();
4970        }
4971        else if (name.equals("typeReference")) {
4972          return addTypeReference();
4973        }
4974        else if (name.equals("subtype")) {
4975          return addSubtype();
4976        }
4977        else if (name.equals("relationship")) {
4978          this.relationship = new Coding();
4979          return this.relationship;
4980        }
4981        else if (name.equals("context")) {
4982          return addContext();
4983        }
4984        else if (name.equals("condition")) {
4985          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.condition");
4986        }
4987        else if (name.equals("periodType")) {
4988          return addPeriodType();
4989        }
4990        else if (name.equals("period")) {
4991          return addPeriod();
4992        }
4993        else if (name.equals("usePeriod")) {
4994          return addUsePeriod();
4995        }
4996        else if (name.equals("text")) {
4997          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.text");
4998        }
4999        else if (name.equals("linkId")) {
5000          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.linkId");
5001        }
5002        else if (name.equals("answer")) {
5003          return addAnswer();
5004        }
5005        else if (name.equals("securityLabelNumber")) {
5006          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.securityLabelNumber");
5007        }
5008        else if (name.equals("valuedItem")) {
5009          return addValuedItem();
5010        }
5011        else
5012          return super.addChild(name);
5013      }
5014
5015      public ContractAssetComponent copy() {
5016        ContractAssetComponent dst = new ContractAssetComponent();
5017        copyValues(dst);
5018        return dst;
5019      }
5020
5021      public void copyValues(ContractAssetComponent dst) {
5022        super.copyValues(dst);
5023        dst.scope = scope == null ? null : scope.copy();
5024        if (type != null) {
5025          dst.type = new ArrayList<CodeableConcept>();
5026          for (CodeableConcept i : type)
5027            dst.type.add(i.copy());
5028        };
5029        if (typeReference != null) {
5030          dst.typeReference = new ArrayList<Reference>();
5031          for (Reference i : typeReference)
5032            dst.typeReference.add(i.copy());
5033        };
5034        if (subtype != null) {
5035          dst.subtype = new ArrayList<CodeableConcept>();
5036          for (CodeableConcept i : subtype)
5037            dst.subtype.add(i.copy());
5038        };
5039        dst.relationship = relationship == null ? null : relationship.copy();
5040        if (context != null) {
5041          dst.context = new ArrayList<AssetContextComponent>();
5042          for (AssetContextComponent i : context)
5043            dst.context.add(i.copy());
5044        };
5045        dst.condition = condition == null ? null : condition.copy();
5046        if (periodType != null) {
5047          dst.periodType = new ArrayList<CodeableConcept>();
5048          for (CodeableConcept i : periodType)
5049            dst.periodType.add(i.copy());
5050        };
5051        if (period != null) {
5052          dst.period = new ArrayList<Period>();
5053          for (Period i : period)
5054            dst.period.add(i.copy());
5055        };
5056        if (usePeriod != null) {
5057          dst.usePeriod = new ArrayList<Period>();
5058          for (Period i : usePeriod)
5059            dst.usePeriod.add(i.copy());
5060        };
5061        dst.text = text == null ? null : text.copy();
5062        if (linkId != null) {
5063          dst.linkId = new ArrayList<StringType>();
5064          for (StringType i : linkId)
5065            dst.linkId.add(i.copy());
5066        };
5067        if (answer != null) {
5068          dst.answer = new ArrayList<AnswerComponent>();
5069          for (AnswerComponent i : answer)
5070            dst.answer.add(i.copy());
5071        };
5072        if (securityLabelNumber != null) {
5073          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
5074          for (UnsignedIntType i : securityLabelNumber)
5075            dst.securityLabelNumber.add(i.copy());
5076        };
5077        if (valuedItem != null) {
5078          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5079          for (ValuedItemComponent i : valuedItem)
5080            dst.valuedItem.add(i.copy());
5081        };
5082      }
5083
5084      @Override
5085      public boolean equalsDeep(Base other_) {
5086        if (!super.equalsDeep(other_))
5087          return false;
5088        if (!(other_ instanceof ContractAssetComponent))
5089          return false;
5090        ContractAssetComponent o = (ContractAssetComponent) other_;
5091        return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true) && compareDeep(typeReference, o.typeReference, true)
5092           && compareDeep(subtype, o.subtype, true) && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
5093           && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true) && compareDeep(period, o.period, true)
5094           && compareDeep(usePeriod, o.usePeriod, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
5095           && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
5096           && compareDeep(valuedItem, o.valuedItem, true);
5097      }
5098
5099      @Override
5100      public boolean equalsShallow(Base other_) {
5101        if (!super.equalsShallow(other_))
5102          return false;
5103        if (!(other_ instanceof ContractAssetComponent))
5104          return false;
5105        ContractAssetComponent o = (ContractAssetComponent) other_;
5106        return compareValues(condition, o.condition, true) && compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
5107           && compareValues(securityLabelNumber, o.securityLabelNumber, true);
5108      }
5109
5110      public boolean isEmpty() {
5111        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference
5112          , subtype, relationship, context, condition, periodType, period, usePeriod, text
5113          , linkId, answer, securityLabelNumber, valuedItem);
5114      }
5115
5116  public String fhirType() {
5117    return "Contract.term.asset";
5118
5119  }
5120
5121  }
5122
5123    @Block()
5124    public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
5125        /**
5126         * Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.
5127         */
5128        @Child(name = "reference", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5129        @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." )
5130        protected Reference reference;
5131
5132        /**
5133         * Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.
5134         */
5135        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5136        @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." )
5137        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetcontext")
5138        protected List<CodeableConcept> code;
5139
5140        /**
5141         * Context description.
5142         */
5143        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5144        @Description(shortDefinition="Context description", formalDefinition="Context description." )
5145        protected StringType text;
5146
5147        private static final long serialVersionUID = -388598648L;
5148
5149    /**
5150     * Constructor
5151     */
5152      public AssetContextComponent() {
5153        super();
5154      }
5155
5156        /**
5157         * @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.)
5158         */
5159        public Reference getReference() { 
5160          if (this.reference == null)
5161            if (Configuration.errorOnAutoCreate())
5162              throw new Error("Attempt to auto-create AssetContextComponent.reference");
5163            else if (Configuration.doAutoCreate())
5164              this.reference = new Reference(); // cc
5165          return this.reference;
5166        }
5167
5168        public boolean hasReference() { 
5169          return this.reference != null && !this.reference.isEmpty();
5170        }
5171
5172        /**
5173         * @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.)
5174         */
5175        public AssetContextComponent setReference(Reference value) { 
5176          this.reference = value;
5177          return this;
5178        }
5179
5180        /**
5181         * @return {@link #code} (Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.)
5182         */
5183        public List<CodeableConcept> getCode() { 
5184          if (this.code == null)
5185            this.code = new ArrayList<CodeableConcept>();
5186          return this.code;
5187        }
5188
5189        /**
5190         * @return Returns a reference to <code>this</code> for easy method chaining
5191         */
5192        public AssetContextComponent setCode(List<CodeableConcept> theCode) { 
5193          this.code = theCode;
5194          return this;
5195        }
5196
5197        public boolean hasCode() { 
5198          if (this.code == null)
5199            return false;
5200          for (CodeableConcept item : this.code)
5201            if (!item.isEmpty())
5202              return true;
5203          return false;
5204        }
5205
5206        public CodeableConcept addCode() { //3
5207          CodeableConcept t = new CodeableConcept();
5208          if (this.code == null)
5209            this.code = new ArrayList<CodeableConcept>();
5210          this.code.add(t);
5211          return t;
5212        }
5213
5214        public AssetContextComponent addCode(CodeableConcept t) { //3
5215          if (t == null)
5216            return this;
5217          if (this.code == null)
5218            this.code = new ArrayList<CodeableConcept>();
5219          this.code.add(t);
5220          return this;
5221        }
5222
5223        /**
5224         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
5225         */
5226        public CodeableConcept getCodeFirstRep() { 
5227          if (getCode().isEmpty()) {
5228            addCode();
5229          }
5230          return getCode().get(0);
5231        }
5232
5233        /**
5234         * @return {@link #text} (Context description.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
5235         */
5236        public StringType getTextElement() { 
5237          if (this.text == null)
5238            if (Configuration.errorOnAutoCreate())
5239              throw new Error("Attempt to auto-create AssetContextComponent.text");
5240            else if (Configuration.doAutoCreate())
5241              this.text = new StringType(); // bb
5242          return this.text;
5243        }
5244
5245        public boolean hasTextElement() { 
5246          return this.text != null && !this.text.isEmpty();
5247        }
5248
5249        public boolean hasText() { 
5250          return this.text != null && !this.text.isEmpty();
5251        }
5252
5253        /**
5254         * @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
5255         */
5256        public AssetContextComponent setTextElement(StringType value) { 
5257          this.text = value;
5258          return this;
5259        }
5260
5261        /**
5262         * @return Context description.
5263         */
5264        public String getText() { 
5265          return this.text == null ? null : this.text.getValue();
5266        }
5267
5268        /**
5269         * @param value Context description.
5270         */
5271        public AssetContextComponent setText(String value) { 
5272          if (Utilities.noString(value))
5273            this.text = null;
5274          else {
5275            if (this.text == null)
5276              this.text = new StringType();
5277            this.text.setValue(value);
5278          }
5279          return this;
5280        }
5281
5282        protected void listChildren(List<Property> children) {
5283          super.listChildren(children);
5284          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));
5285          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));
5286          children.add(new Property("text", "string", "Context description.", 0, 1, text));
5287        }
5288
5289        @Override
5290        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5291          switch (_hash) {
5292          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);
5293          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);
5294          case 3556653: /*text*/  return new Property("text", "string", "Context description.", 0, 1, text);
5295          default: return super.getNamedProperty(_hash, _name, _checkValid);
5296          }
5297
5298        }
5299
5300      @Override
5301      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5302        switch (hash) {
5303        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
5304        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
5305        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
5306        default: return super.getProperty(hash, name, checkValid);
5307        }
5308
5309      }
5310
5311      @Override
5312      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5313        switch (hash) {
5314        case -925155509: // reference
5315          this.reference = TypeConvertor.castToReference(value); // Reference
5316          return value;
5317        case 3059181: // code
5318          this.getCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5319          return value;
5320        case 3556653: // text
5321          this.text = TypeConvertor.castToString(value); // StringType
5322          return value;
5323        default: return super.setProperty(hash, name, value);
5324        }
5325
5326      }
5327
5328      @Override
5329      public Base setProperty(String name, Base value) throws FHIRException {
5330        if (name.equals("reference")) {
5331          this.reference = TypeConvertor.castToReference(value); // Reference
5332        } else if (name.equals("code")) {
5333          this.getCode().add(TypeConvertor.castToCodeableConcept(value));
5334        } else if (name.equals("text")) {
5335          this.text = TypeConvertor.castToString(value); // StringType
5336        } else
5337          return super.setProperty(name, value);
5338        return value;
5339      }
5340
5341      @Override
5342      public Base makeProperty(int hash, String name) throws FHIRException {
5343        switch (hash) {
5344        case -925155509:  return getReference();
5345        case 3059181:  return addCode(); 
5346        case 3556653:  return getTextElement();
5347        default: return super.makeProperty(hash, name);
5348        }
5349
5350      }
5351
5352      @Override
5353      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5354        switch (hash) {
5355        case -925155509: /*reference*/ return new String[] {"Reference"};
5356        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
5357        case 3556653: /*text*/ return new String[] {"string"};
5358        default: return super.getTypesForProperty(hash, name);
5359        }
5360
5361      }
5362
5363      @Override
5364      public Base addChild(String name) throws FHIRException {
5365        if (name.equals("reference")) {
5366          this.reference = new Reference();
5367          return this.reference;
5368        }
5369        else if (name.equals("code")) {
5370          return addCode();
5371        }
5372        else if (name.equals("text")) {
5373          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.context.text");
5374        }
5375        else
5376          return super.addChild(name);
5377      }
5378
5379      public AssetContextComponent copy() {
5380        AssetContextComponent dst = new AssetContextComponent();
5381        copyValues(dst);
5382        return dst;
5383      }
5384
5385      public void copyValues(AssetContextComponent dst) {
5386        super.copyValues(dst);
5387        dst.reference = reference == null ? null : reference.copy();
5388        if (code != null) {
5389          dst.code = new ArrayList<CodeableConcept>();
5390          for (CodeableConcept i : code)
5391            dst.code.add(i.copy());
5392        };
5393        dst.text = text == null ? null : text.copy();
5394      }
5395
5396      @Override
5397      public boolean equalsDeep(Base other_) {
5398        if (!super.equalsDeep(other_))
5399          return false;
5400        if (!(other_ instanceof AssetContextComponent))
5401          return false;
5402        AssetContextComponent o = (AssetContextComponent) other_;
5403        return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
5404          ;
5405      }
5406
5407      @Override
5408      public boolean equalsShallow(Base other_) {
5409        if (!super.equalsShallow(other_))
5410          return false;
5411        if (!(other_ instanceof AssetContextComponent))
5412          return false;
5413        AssetContextComponent o = (AssetContextComponent) other_;
5414        return compareValues(text, o.text, true);
5415      }
5416
5417      public boolean isEmpty() {
5418        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
5419      }
5420
5421  public String fhirType() {
5422    return "Contract.term.asset.context";
5423
5424  }
5425
5426  }
5427
5428    @Block()
5429    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
5430        /**
5431         * Specific type of Contract Valued Item that may be priced.
5432         */
5433        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5434        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
5435        protected DataType entity;
5436
5437        /**
5438         * Identifies a Contract Valued Item instance.
5439         */
5440        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
5441        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
5442        protected Identifier identifier;
5443
5444        /**
5445         * Indicates the time during which this Contract ValuedItem information is effective.
5446         */
5447        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5448        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
5449        protected DateTimeType effectiveTime;
5450
5451        /**
5452         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
5453         */
5454        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
5455        @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." )
5456        protected Quantity quantity;
5457
5458        /**
5459         * A Contract Valued Item unit valuation measure.
5460         */
5461        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
5462        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
5463        protected Money unitPrice;
5464
5465        /**
5466         * 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.
5467         */
5468        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5469        @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." )
5470        protected DecimalType factor;
5471
5472        /**
5473         * 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.
5474         */
5475        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5476        @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." )
5477        protected DecimalType points;
5478
5479        /**
5480         * 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.
5481         */
5482        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5483        @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." )
5484        protected Money net;
5485
5486        /**
5487         * Terms of valuation.
5488         */
5489        @Child(name = "payment", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5490        @Description(shortDefinition="Terms of valuation", formalDefinition="Terms of valuation." )
5491        protected StringType payment;
5492
5493        /**
5494         * When payment is due.
5495         */
5496        @Child(name = "paymentDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5497        @Description(shortDefinition="When payment is due", formalDefinition="When payment is due." )
5498        protected DateTimeType paymentDate;
5499
5500        /**
5501         * Who will make payment.
5502         */
5503        @Child(name = "responsible", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=false)
5504        @Description(shortDefinition="Who will make payment", formalDefinition="Who will make payment." )
5505        protected Reference responsible;
5506
5507        /**
5508         * Who will receive payment.
5509         */
5510        @Child(name = "recipient", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=12, min=0, max=1, modifier=false, summary=false)
5511        @Description(shortDefinition="Who will receive payment", formalDefinition="Who will receive payment." )
5512        protected Reference recipient;
5513
5514        /**
5515         * Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.
5516         */
5517        @Child(name = "linkId", type = {StringType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5518        @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." )
5519        protected List<StringType> linkId;
5520
5521        /**
5522         * A set of security labels that define which terms are controlled by this condition.
5523         */
5524        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5525        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
5526        protected List<UnsignedIntType> securityLabelNumber;
5527
5528        private static final long serialVersionUID = 915998998L;
5529
5530    /**
5531     * Constructor
5532     */
5533      public ValuedItemComponent() {
5534        super();
5535      }
5536
5537        /**
5538         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5539         */
5540        public DataType getEntity() { 
5541          return this.entity;
5542        }
5543
5544        /**
5545         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5546         */
5547        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
5548          if (this.entity == null)
5549            this.entity = new CodeableConcept();
5550          if (!(this.entity instanceof CodeableConcept))
5551            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
5552          return (CodeableConcept) this.entity;
5553        }
5554
5555        public boolean hasEntityCodeableConcept() { 
5556          return this != null && this.entity instanceof CodeableConcept;
5557        }
5558
5559        /**
5560         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5561         */
5562        public Reference getEntityReference() throws FHIRException { 
5563          if (this.entity == null)
5564            this.entity = new Reference();
5565          if (!(this.entity instanceof Reference))
5566            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
5567          return (Reference) this.entity;
5568        }
5569
5570        public boolean hasEntityReference() { 
5571          return this != null && this.entity instanceof Reference;
5572        }
5573
5574        public boolean hasEntity() { 
5575          return this.entity != null && !this.entity.isEmpty();
5576        }
5577
5578        /**
5579         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5580         */
5581        public ValuedItemComponent setEntity(DataType value) { 
5582          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
5583            throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: "+value.fhirType());
5584          this.entity = value;
5585          return this;
5586        }
5587
5588        /**
5589         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
5590         */
5591        public Identifier getIdentifier() { 
5592          if (this.identifier == null)
5593            if (Configuration.errorOnAutoCreate())
5594              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
5595            else if (Configuration.doAutoCreate())
5596              this.identifier = new Identifier(); // cc
5597          return this.identifier;
5598        }
5599
5600        public boolean hasIdentifier() { 
5601          return this.identifier != null && !this.identifier.isEmpty();
5602        }
5603
5604        /**
5605         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
5606         */
5607        public ValuedItemComponent setIdentifier(Identifier value) { 
5608          this.identifier = value;
5609          return this;
5610        }
5611
5612        /**
5613         * @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
5614         */
5615        public DateTimeType getEffectiveTimeElement() { 
5616          if (this.effectiveTime == null)
5617            if (Configuration.errorOnAutoCreate())
5618              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
5619            else if (Configuration.doAutoCreate())
5620              this.effectiveTime = new DateTimeType(); // bb
5621          return this.effectiveTime;
5622        }
5623
5624        public boolean hasEffectiveTimeElement() { 
5625          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5626        }
5627
5628        public boolean hasEffectiveTime() { 
5629          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5630        }
5631
5632        /**
5633         * @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
5634         */
5635        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
5636          this.effectiveTime = value;
5637          return this;
5638        }
5639
5640        /**
5641         * @return Indicates the time during which this Contract ValuedItem information is effective.
5642         */
5643        public Date getEffectiveTime() { 
5644          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
5645        }
5646
5647        /**
5648         * @param value Indicates the time during which this Contract ValuedItem information is effective.
5649         */
5650        public ValuedItemComponent setEffectiveTime(Date value) { 
5651          if (value == null)
5652            this.effectiveTime = null;
5653          else {
5654            if (this.effectiveTime == null)
5655              this.effectiveTime = new DateTimeType();
5656            this.effectiveTime.setValue(value);
5657          }
5658          return this;
5659        }
5660
5661        /**
5662         * @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.)
5663         */
5664        public Quantity getQuantity() { 
5665          if (this.quantity == null)
5666            if (Configuration.errorOnAutoCreate())
5667              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
5668            else if (Configuration.doAutoCreate())
5669              this.quantity = new Quantity(); // cc
5670          return this.quantity;
5671        }
5672
5673        public boolean hasQuantity() { 
5674          return this.quantity != null && !this.quantity.isEmpty();
5675        }
5676
5677        /**
5678         * @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.)
5679         */
5680        public ValuedItemComponent setQuantity(Quantity value) { 
5681          this.quantity = value;
5682          return this;
5683        }
5684
5685        /**
5686         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5687         */
5688        public Money getUnitPrice() { 
5689          if (this.unitPrice == null)
5690            if (Configuration.errorOnAutoCreate())
5691              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
5692            else if (Configuration.doAutoCreate())
5693              this.unitPrice = new Money(); // cc
5694          return this.unitPrice;
5695        }
5696
5697        public boolean hasUnitPrice() { 
5698          return this.unitPrice != null && !this.unitPrice.isEmpty();
5699        }
5700
5701        /**
5702         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5703         */
5704        public ValuedItemComponent setUnitPrice(Money value) { 
5705          this.unitPrice = value;
5706          return this;
5707        }
5708
5709        /**
5710         * @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
5711         */
5712        public DecimalType getFactorElement() { 
5713          if (this.factor == null)
5714            if (Configuration.errorOnAutoCreate())
5715              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
5716            else if (Configuration.doAutoCreate())
5717              this.factor = new DecimalType(); // bb
5718          return this.factor;
5719        }
5720
5721        public boolean hasFactorElement() { 
5722          return this.factor != null && !this.factor.isEmpty();
5723        }
5724
5725        public boolean hasFactor() { 
5726          return this.factor != null && !this.factor.isEmpty();
5727        }
5728
5729        /**
5730         * @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
5731         */
5732        public ValuedItemComponent setFactorElement(DecimalType value) { 
5733          this.factor = value;
5734          return this;
5735        }
5736
5737        /**
5738         * @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.
5739         */
5740        public BigDecimal getFactor() { 
5741          return this.factor == null ? null : this.factor.getValue();
5742        }
5743
5744        /**
5745         * @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.
5746         */
5747        public ValuedItemComponent setFactor(BigDecimal value) { 
5748          if (value == null)
5749            this.factor = null;
5750          else {
5751            if (this.factor == null)
5752              this.factor = new DecimalType();
5753            this.factor.setValue(value);
5754          }
5755          return this;
5756        }
5757
5758        /**
5759         * @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.
5760         */
5761        public ValuedItemComponent setFactor(long value) { 
5762              this.factor = new DecimalType();
5763            this.factor.setValue(value);
5764          return this;
5765        }
5766
5767        /**
5768         * @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.
5769         */
5770        public ValuedItemComponent setFactor(double value) { 
5771              this.factor = new DecimalType();
5772            this.factor.setValue(value);
5773          return this;
5774        }
5775
5776        /**
5777         * @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
5778         */
5779        public DecimalType getPointsElement() { 
5780          if (this.points == null)
5781            if (Configuration.errorOnAutoCreate())
5782              throw new Error("Attempt to auto-create ValuedItemComponent.points");
5783            else if (Configuration.doAutoCreate())
5784              this.points = new DecimalType(); // bb
5785          return this.points;
5786        }
5787
5788        public boolean hasPointsElement() { 
5789          return this.points != null && !this.points.isEmpty();
5790        }
5791
5792        public boolean hasPoints() { 
5793          return this.points != null && !this.points.isEmpty();
5794        }
5795
5796        /**
5797         * @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
5798         */
5799        public ValuedItemComponent setPointsElement(DecimalType value) { 
5800          this.points = value;
5801          return this;
5802        }
5803
5804        /**
5805         * @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.
5806         */
5807        public BigDecimal getPoints() { 
5808          return this.points == null ? null : this.points.getValue();
5809        }
5810
5811        /**
5812         * @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.
5813         */
5814        public ValuedItemComponent setPoints(BigDecimal value) { 
5815          if (value == null)
5816            this.points = null;
5817          else {
5818            if (this.points == null)
5819              this.points = new DecimalType();
5820            this.points.setValue(value);
5821          }
5822          return this;
5823        }
5824
5825        /**
5826         * @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.
5827         */
5828        public ValuedItemComponent setPoints(long value) { 
5829              this.points = new DecimalType();
5830            this.points.setValue(value);
5831          return this;
5832        }
5833
5834        /**
5835         * @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.
5836         */
5837        public ValuedItemComponent setPoints(double value) { 
5838              this.points = new DecimalType();
5839            this.points.setValue(value);
5840          return this;
5841        }
5842
5843        /**
5844         * @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.)
5845         */
5846        public Money getNet() { 
5847          if (this.net == null)
5848            if (Configuration.errorOnAutoCreate())
5849              throw new Error("Attempt to auto-create ValuedItemComponent.net");
5850            else if (Configuration.doAutoCreate())
5851              this.net = new Money(); // cc
5852          return this.net;
5853        }
5854
5855        public boolean hasNet() { 
5856          return this.net != null && !this.net.isEmpty();
5857        }
5858
5859        /**
5860         * @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.)
5861         */
5862        public ValuedItemComponent setNet(Money value) { 
5863          this.net = value;
5864          return this;
5865        }
5866
5867        /**
5868         * @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
5869         */
5870        public StringType getPaymentElement() { 
5871          if (this.payment == null)
5872            if (Configuration.errorOnAutoCreate())
5873              throw new Error("Attempt to auto-create ValuedItemComponent.payment");
5874            else if (Configuration.doAutoCreate())
5875              this.payment = new StringType(); // bb
5876          return this.payment;
5877        }
5878
5879        public boolean hasPaymentElement() { 
5880          return this.payment != null && !this.payment.isEmpty();
5881        }
5882
5883        public boolean hasPayment() { 
5884          return this.payment != null && !this.payment.isEmpty();
5885        }
5886
5887        /**
5888         * @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
5889         */
5890        public ValuedItemComponent setPaymentElement(StringType value) { 
5891          this.payment = value;
5892          return this;
5893        }
5894
5895        /**
5896         * @return Terms of valuation.
5897         */
5898        public String getPayment() { 
5899          return this.payment == null ? null : this.payment.getValue();
5900        }
5901
5902        /**
5903         * @param value Terms of valuation.
5904         */
5905        public ValuedItemComponent setPayment(String value) { 
5906          if (Utilities.noString(value))
5907            this.payment = null;
5908          else {
5909            if (this.payment == null)
5910              this.payment = new StringType();
5911            this.payment.setValue(value);
5912          }
5913          return this;
5914        }
5915
5916        /**
5917         * @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
5918         */
5919        public DateTimeType getPaymentDateElement() { 
5920          if (this.paymentDate == null)
5921            if (Configuration.errorOnAutoCreate())
5922              throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
5923            else if (Configuration.doAutoCreate())
5924              this.paymentDate = new DateTimeType(); // bb
5925          return this.paymentDate;
5926        }
5927
5928        public boolean hasPaymentDateElement() { 
5929          return this.paymentDate != null && !this.paymentDate.isEmpty();
5930        }
5931
5932        public boolean hasPaymentDate() { 
5933          return this.paymentDate != null && !this.paymentDate.isEmpty();
5934        }
5935
5936        /**
5937         * @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
5938         */
5939        public ValuedItemComponent setPaymentDateElement(DateTimeType value) { 
5940          this.paymentDate = value;
5941          return this;
5942        }
5943
5944        /**
5945         * @return When payment is due.
5946         */
5947        public Date getPaymentDate() { 
5948          return this.paymentDate == null ? null : this.paymentDate.getValue();
5949        }
5950
5951        /**
5952         * @param value When payment is due.
5953         */
5954        public ValuedItemComponent setPaymentDate(Date value) { 
5955          if (value == null)
5956            this.paymentDate = null;
5957          else {
5958            if (this.paymentDate == null)
5959              this.paymentDate = new DateTimeType();
5960            this.paymentDate.setValue(value);
5961          }
5962          return this;
5963        }
5964
5965        /**
5966         * @return {@link #responsible} (Who will make payment.)
5967         */
5968        public Reference getResponsible() { 
5969          if (this.responsible == null)
5970            if (Configuration.errorOnAutoCreate())
5971              throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
5972            else if (Configuration.doAutoCreate())
5973              this.responsible = new Reference(); // cc
5974          return this.responsible;
5975        }
5976
5977        public boolean hasResponsible() { 
5978          return this.responsible != null && !this.responsible.isEmpty();
5979        }
5980
5981        /**
5982         * @param value {@link #responsible} (Who will make payment.)
5983         */
5984        public ValuedItemComponent setResponsible(Reference value) { 
5985          this.responsible = value;
5986          return this;
5987        }
5988
5989        /**
5990         * @return {@link #recipient} (Who will receive payment.)
5991         */
5992        public Reference getRecipient() { 
5993          if (this.recipient == null)
5994            if (Configuration.errorOnAutoCreate())
5995              throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
5996            else if (Configuration.doAutoCreate())
5997              this.recipient = new Reference(); // cc
5998          return this.recipient;
5999        }
6000
6001        public boolean hasRecipient() { 
6002          return this.recipient != null && !this.recipient.isEmpty();
6003        }
6004
6005        /**
6006         * @param value {@link #recipient} (Who will receive payment.)
6007         */
6008        public ValuedItemComponent setRecipient(Reference value) { 
6009          this.recipient = value;
6010          return this;
6011        }
6012
6013        /**
6014         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6015         */
6016        public List<StringType> getLinkId() { 
6017          if (this.linkId == null)
6018            this.linkId = new ArrayList<StringType>();
6019          return this.linkId;
6020        }
6021
6022        /**
6023         * @return Returns a reference to <code>this</code> for easy method chaining
6024         */
6025        public ValuedItemComponent setLinkId(List<StringType> theLinkId) { 
6026          this.linkId = theLinkId;
6027          return this;
6028        }
6029
6030        public boolean hasLinkId() { 
6031          if (this.linkId == null)
6032            return false;
6033          for (StringType item : this.linkId)
6034            if (!item.isEmpty())
6035              return true;
6036          return false;
6037        }
6038
6039        /**
6040         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6041         */
6042        public StringType addLinkIdElement() {//2 
6043          StringType t = new StringType();
6044          if (this.linkId == null)
6045            this.linkId = new ArrayList<StringType>();
6046          this.linkId.add(t);
6047          return t;
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 ValuedItemComponent addLinkId(String value) { //1
6054          StringType t = new StringType();
6055          t.setValue(value);
6056          if (this.linkId == null)
6057            this.linkId = new ArrayList<StringType>();
6058          this.linkId.add(t);
6059          return this;
6060        }
6061
6062        /**
6063         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6064         */
6065        public boolean hasLinkId(String value) { 
6066          if (this.linkId == null)
6067            return false;
6068          for (StringType v : this.linkId)
6069            if (v.getValue().equals(value)) // string
6070              return true;
6071          return false;
6072        }
6073
6074        /**
6075         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6076         */
6077        public List<UnsignedIntType> getSecurityLabelNumber() { 
6078          if (this.securityLabelNumber == null)
6079            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6080          return this.securityLabelNumber;
6081        }
6082
6083        /**
6084         * @return Returns a reference to <code>this</code> for easy method chaining
6085         */
6086        public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
6087          this.securityLabelNumber = theSecurityLabelNumber;
6088          return this;
6089        }
6090
6091        public boolean hasSecurityLabelNumber() { 
6092          if (this.securityLabelNumber == null)
6093            return false;
6094          for (UnsignedIntType item : this.securityLabelNumber)
6095            if (!item.isEmpty())
6096              return true;
6097          return false;
6098        }
6099
6100        /**
6101         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6102         */
6103        public UnsignedIntType addSecurityLabelNumberElement() {//2 
6104          UnsignedIntType t = new UnsignedIntType();
6105          if (this.securityLabelNumber == null)
6106            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6107          this.securityLabelNumber.add(t);
6108          return t;
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 ValuedItemComponent addSecurityLabelNumber(int value) { //1
6115          UnsignedIntType t = new UnsignedIntType();
6116          t.setValue(value);
6117          if (this.securityLabelNumber == null)
6118            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6119          this.securityLabelNumber.add(t);
6120          return this;
6121        }
6122
6123        /**
6124         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6125         */
6126        public boolean hasSecurityLabelNumber(int value) { 
6127          if (this.securityLabelNumber == null)
6128            return false;
6129          for (UnsignedIntType v : this.securityLabelNumber)
6130            if (v.getValue().equals(value)) // unsignedInt
6131              return true;
6132          return false;
6133        }
6134
6135        protected void listChildren(List<Property> children) {
6136          super.listChildren(children);
6137          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
6138          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
6139          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
6140          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));
6141          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
6142          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));
6143          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));
6144          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));
6145          children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
6146          children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
6147          children.add(new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible));
6148          children.add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient));
6149          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));
6150          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));
6151        }
6152
6153        @Override
6154        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6155          switch (_hash) {
6156          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);
6157          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6158          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6159          case -356635992: /*entityReference*/  return new Property("entity[x]", "Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6160          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
6161          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
6162          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);
6163          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
6164          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);
6165          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);
6166          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);
6167          case -786681338: /*payment*/  return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
6168          case -1540873516: /*paymentDate*/  return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
6169          case 1847674614: /*responsible*/  return new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible);
6170          case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient);
6171          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);
6172          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);
6173          default: return super.getNamedProperty(_hash, _name, _checkValid);
6174          }
6175
6176        }
6177
6178      @Override
6179      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6180        switch (hash) {
6181        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // DataType
6182        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
6183        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
6184        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6185        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6186        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6187        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
6188        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6189        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // StringType
6190        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateTimeType
6191        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // Reference
6192        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
6193        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
6194        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
6195        default: return super.getProperty(hash, name, checkValid);
6196        }
6197
6198      }
6199
6200      @Override
6201      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6202        switch (hash) {
6203        case -1298275357: // entity
6204          this.entity = TypeConvertor.castToType(value); // DataType
6205          return value;
6206        case -1618432855: // identifier
6207          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
6208          return value;
6209        case -929905388: // effectiveTime
6210          this.effectiveTime = TypeConvertor.castToDateTime(value); // DateTimeType
6211          return value;
6212        case -1285004149: // quantity
6213          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6214          return value;
6215        case -486196699: // unitPrice
6216          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6217          return value;
6218        case -1282148017: // factor
6219          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6220          return value;
6221        case -982754077: // points
6222          this.points = TypeConvertor.castToDecimal(value); // DecimalType
6223          return value;
6224        case 108957: // net
6225          this.net = TypeConvertor.castToMoney(value); // Money
6226          return value;
6227        case -786681338: // payment
6228          this.payment = TypeConvertor.castToString(value); // StringType
6229          return value;
6230        case -1540873516: // paymentDate
6231          this.paymentDate = TypeConvertor.castToDateTime(value); // DateTimeType
6232          return value;
6233        case 1847674614: // responsible
6234          this.responsible = TypeConvertor.castToReference(value); // Reference
6235          return value;
6236        case 820081177: // recipient
6237          this.recipient = TypeConvertor.castToReference(value); // Reference
6238          return value;
6239        case -1102667083: // linkId
6240          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
6241          return value;
6242        case -149460995: // securityLabelNumber
6243          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
6244          return value;
6245        default: return super.setProperty(hash, name, value);
6246        }
6247
6248      }
6249
6250      @Override
6251      public Base setProperty(String name, Base value) throws FHIRException {
6252        if (name.equals("entity[x]")) {
6253          this.entity = TypeConvertor.castToType(value); // DataType
6254        } else if (name.equals("identifier")) {
6255          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
6256        } else if (name.equals("effectiveTime")) {
6257          this.effectiveTime = TypeConvertor.castToDateTime(value); // DateTimeType
6258        } else if (name.equals("quantity")) {
6259          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6260        } else if (name.equals("unitPrice")) {
6261          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6262        } else if (name.equals("factor")) {
6263          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6264        } else if (name.equals("points")) {
6265          this.points = TypeConvertor.castToDecimal(value); // DecimalType
6266        } else if (name.equals("net")) {
6267          this.net = TypeConvertor.castToMoney(value); // Money
6268        } else if (name.equals("payment")) {
6269          this.payment = TypeConvertor.castToString(value); // StringType
6270        } else if (name.equals("paymentDate")) {
6271          this.paymentDate = TypeConvertor.castToDateTime(value); // DateTimeType
6272        } else if (name.equals("responsible")) {
6273          this.responsible = TypeConvertor.castToReference(value); // Reference
6274        } else if (name.equals("recipient")) {
6275          this.recipient = TypeConvertor.castToReference(value); // Reference
6276        } else if (name.equals("linkId")) {
6277          this.getLinkId().add(TypeConvertor.castToString(value));
6278        } else if (name.equals("securityLabelNumber")) {
6279          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
6280        } else
6281          return super.setProperty(name, value);
6282        return value;
6283      }
6284
6285      @Override
6286      public Base makeProperty(int hash, String name) throws FHIRException {
6287        switch (hash) {
6288        case -740568643:  return getEntity();
6289        case -1298275357:  return getEntity();
6290        case -1618432855:  return getIdentifier();
6291        case -929905388:  return getEffectiveTimeElement();
6292        case -1285004149:  return getQuantity();
6293        case -486196699:  return getUnitPrice();
6294        case -1282148017:  return getFactorElement();
6295        case -982754077:  return getPointsElement();
6296        case 108957:  return getNet();
6297        case -786681338:  return getPaymentElement();
6298        case -1540873516:  return getPaymentDateElement();
6299        case 1847674614:  return getResponsible();
6300        case 820081177:  return getRecipient();
6301        case -1102667083:  return addLinkIdElement();
6302        case -149460995:  return addSecurityLabelNumberElement();
6303        default: return super.makeProperty(hash, name);
6304        }
6305
6306      }
6307
6308      @Override
6309      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6310        switch (hash) {
6311        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
6312        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6313        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
6314        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6315        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6316        case -1282148017: /*factor*/ return new String[] {"decimal"};
6317        case -982754077: /*points*/ return new String[] {"decimal"};
6318        case 108957: /*net*/ return new String[] {"Money"};
6319        case -786681338: /*payment*/ return new String[] {"string"};
6320        case -1540873516: /*paymentDate*/ return new String[] {"dateTime"};
6321        case 1847674614: /*responsible*/ return new String[] {"Reference"};
6322        case 820081177: /*recipient*/ return new String[] {"Reference"};
6323        case -1102667083: /*linkId*/ return new String[] {"string"};
6324        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
6325        default: return super.getTypesForProperty(hash, name);
6326        }
6327
6328      }
6329
6330      @Override
6331      public Base addChild(String name) throws FHIRException {
6332        if (name.equals("entityCodeableConcept")) {
6333          this.entity = new CodeableConcept();
6334          return this.entity;
6335        }
6336        else if (name.equals("entityReference")) {
6337          this.entity = new Reference();
6338          return this.entity;
6339        }
6340        else if (name.equals("identifier")) {
6341          this.identifier = new Identifier();
6342          return this.identifier;
6343        }
6344        else if (name.equals("effectiveTime")) {
6345          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.effectiveTime");
6346        }
6347        else if (name.equals("quantity")) {
6348          this.quantity = new Quantity();
6349          return this.quantity;
6350        }
6351        else if (name.equals("unitPrice")) {
6352          this.unitPrice = new Money();
6353          return this.unitPrice;
6354        }
6355        else if (name.equals("factor")) {
6356          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.factor");
6357        }
6358        else if (name.equals("points")) {
6359          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.points");
6360        }
6361        else if (name.equals("net")) {
6362          this.net = new Money();
6363          return this.net;
6364        }
6365        else if (name.equals("payment")) {
6366          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.payment");
6367        }
6368        else if (name.equals("paymentDate")) {
6369          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.paymentDate");
6370        }
6371        else if (name.equals("responsible")) {
6372          this.responsible = new Reference();
6373          return this.responsible;
6374        }
6375        else if (name.equals("recipient")) {
6376          this.recipient = new Reference();
6377          return this.recipient;
6378        }
6379        else if (name.equals("linkId")) {
6380          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.linkId");
6381        }
6382        else if (name.equals("securityLabelNumber")) {
6383          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.asset.valuedItem.securityLabelNumber");
6384        }
6385        else
6386          return super.addChild(name);
6387      }
6388
6389      public ValuedItemComponent copy() {
6390        ValuedItemComponent dst = new ValuedItemComponent();
6391        copyValues(dst);
6392        return dst;
6393      }
6394
6395      public void copyValues(ValuedItemComponent dst) {
6396        super.copyValues(dst);
6397        dst.entity = entity == null ? null : entity.copy();
6398        dst.identifier = identifier == null ? null : identifier.copy();
6399        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
6400        dst.quantity = quantity == null ? null : quantity.copy();
6401        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6402        dst.factor = factor == null ? null : factor.copy();
6403        dst.points = points == null ? null : points.copy();
6404        dst.net = net == null ? null : net.copy();
6405        dst.payment = payment == null ? null : payment.copy();
6406        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
6407        dst.responsible = responsible == null ? null : responsible.copy();
6408        dst.recipient = recipient == null ? null : recipient.copy();
6409        if (linkId != null) {
6410          dst.linkId = new ArrayList<StringType>();
6411          for (StringType i : linkId)
6412            dst.linkId.add(i.copy());
6413        };
6414        if (securityLabelNumber != null) {
6415          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6416          for (UnsignedIntType i : securityLabelNumber)
6417            dst.securityLabelNumber.add(i.copy());
6418        };
6419      }
6420
6421      @Override
6422      public boolean equalsDeep(Base other_) {
6423        if (!super.equalsDeep(other_))
6424          return false;
6425        if (!(other_ instanceof ValuedItemComponent))
6426          return false;
6427        ValuedItemComponent o = (ValuedItemComponent) other_;
6428        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
6429           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6430           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(payment, o.payment, true)
6431           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(responsible, o.responsible, true)
6432           && compareDeep(recipient, o.recipient, true) && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6433          ;
6434      }
6435
6436      @Override
6437      public boolean equalsShallow(Base other_) {
6438        if (!super.equalsShallow(other_))
6439          return false;
6440        if (!(other_ instanceof ValuedItemComponent))
6441          return false;
6442        ValuedItemComponent o = (ValuedItemComponent) other_;
6443        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
6444           && compareValues(points, o.points, true) && compareValues(payment, o.payment, true) && compareValues(paymentDate, o.paymentDate, true)
6445           && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
6446          ;
6447      }
6448
6449      public boolean isEmpty() {
6450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
6451          , quantity, unitPrice, factor, points, net, payment, paymentDate, responsible
6452          , recipient, linkId, securityLabelNumber);
6453      }
6454
6455  public String fhirType() {
6456    return "Contract.term.asset.valuedItem";
6457
6458  }
6459
6460  }
6461
6462    @Block()
6463    public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
6464        /**
6465         * True if the term prohibits the  action.
6466         */
6467        @Child(name = "doNotPerform", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=false)
6468        @Description(shortDefinition="True if the term prohibits the  action", formalDefinition="True if the term prohibits the  action." )
6469        protected BooleanType doNotPerform;
6470
6471        /**
6472         * Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.
6473         */
6474        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6475        @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." )
6476        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
6477        protected CodeableConcept type;
6478
6479        /**
6480         * Entity of the action.
6481         */
6482        @Child(name = "subject", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6483        @Description(shortDefinition="Entity of the action", formalDefinition="Entity of the action." )
6484        protected List<ActionSubjectComponent> subject;
6485
6486        /**
6487         * Reason or purpose for the action stipulated by this Contract Provision.
6488         */
6489        @Child(name = "intent", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6490        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
6491        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6492        protected CodeableConcept intent;
6493
6494        /**
6495         * Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.
6496         */
6497        @Child(name = "linkId", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6498        @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." )
6499        protected List<StringType> linkId;
6500
6501        /**
6502         * Current state of the term action.
6503         */
6504        @Child(name = "status", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=false, summary=false)
6505        @Description(shortDefinition="State of the action", formalDefinition="Current state of the term action." )
6506        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actionstatus")
6507        protected CodeableConcept status;
6508
6509        /**
6510         * Encounter or Episode with primary association to specified term activity.
6511         */
6512        @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=false)
6513        @Description(shortDefinition="Episode associated with action", formalDefinition="Encounter or Episode with primary association to specified term activity." )
6514        protected Reference context;
6515
6516        /**
6517         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6518         */
6519        @Child(name = "contextLinkId", type = {StringType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6520        @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." )
6521        protected List<StringType> contextLinkId;
6522
6523        /**
6524         * When action happens.
6525         */
6526        @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=9, min=0, max=1, modifier=false, summary=false)
6527        @Description(shortDefinition="When action happens", formalDefinition="When action happens." )
6528        protected DataType occurrence;
6529
6530        /**
6531         * Who or what initiated the action and has responsibility for its activation.
6532         */
6533        @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)
6534        @Description(shortDefinition="Who asked for action", formalDefinition="Who or what initiated the action and has responsibility for its activation." )
6535        protected List<Reference> requester;
6536
6537        /**
6538         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6539         */
6540        @Child(name = "requesterLinkId", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6541        @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." )
6542        protected List<StringType> requesterLinkId;
6543
6544        /**
6545         * The type of individual that is desired or required to perform or not perform the action.
6546         */
6547        @Child(name = "performerType", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6548        @Description(shortDefinition="Kind of service performer", formalDefinition="The type of individual that is desired or required to perform or not perform the action." )
6549        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-type")
6550        protected List<CodeableConcept> performerType;
6551
6552        /**
6553         * The type of role or competency of an individual desired or required to perform or not perform the action.
6554         */
6555        @Child(name = "performerRole", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
6556        @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." )
6557        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-role")
6558        protected CodeableConcept performerRole;
6559
6560        /**
6561         * Indicates who or what is being asked to perform (or not perform) the ction.
6562         */
6563        @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)
6564        @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." )
6565        protected Reference performer;
6566
6567        /**
6568         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6569         */
6570        @Child(name = "performerLinkId", type = {StringType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6571        @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." )
6572        protected List<StringType> performerLinkId;
6573
6574        /**
6575         * 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.
6576         */
6577        @Child(name = "reason", type = {CodeableReference.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6578        @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." )
6579        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6580        protected List<CodeableReference> reason;
6581
6582        /**
6583         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6584         */
6585        @Child(name = "reasonLinkId", type = {StringType.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6586        @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." )
6587        protected List<StringType> reasonLinkId;
6588
6589        /**
6590         * Comments made about the term action made by the requester, performer, subject or other participants.
6591         */
6592        @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6593        @Description(shortDefinition="Comments about the action", formalDefinition="Comments made about the term action made by the requester, performer, subject or other participants." )
6594        protected List<Annotation> note;
6595
6596        /**
6597         * Security labels that protects the action.
6598         */
6599        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6600        @Description(shortDefinition="Action restriction numbers", formalDefinition="Security labels that protects the action." )
6601        protected List<UnsignedIntType> securityLabelNumber;
6602
6603        private static final long serialVersionUID = 337159017L;
6604
6605    /**
6606     * Constructor
6607     */
6608      public ActionComponent() {
6609        super();
6610      }
6611
6612    /**
6613     * Constructor
6614     */
6615      public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
6616        super();
6617        this.setType(type);
6618        this.setIntent(intent);
6619        this.setStatus(status);
6620      }
6621
6622        /**
6623         * @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
6624         */
6625        public BooleanType getDoNotPerformElement() { 
6626          if (this.doNotPerform == null)
6627            if (Configuration.errorOnAutoCreate())
6628              throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
6629            else if (Configuration.doAutoCreate())
6630              this.doNotPerform = new BooleanType(); // bb
6631          return this.doNotPerform;
6632        }
6633
6634        public boolean hasDoNotPerformElement() { 
6635          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6636        }
6637
6638        public boolean hasDoNotPerform() { 
6639          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6640        }
6641
6642        /**
6643         * @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
6644         */
6645        public ActionComponent setDoNotPerformElement(BooleanType value) { 
6646          this.doNotPerform = value;
6647          return this;
6648        }
6649
6650        /**
6651         * @return True if the term prohibits the  action.
6652         */
6653        public boolean getDoNotPerform() { 
6654          return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
6655        }
6656
6657        /**
6658         * @param value True if the term prohibits the  action.
6659         */
6660        public ActionComponent setDoNotPerform(boolean value) { 
6661            if (this.doNotPerform == null)
6662              this.doNotPerform = new BooleanType();
6663            this.doNotPerform.setValue(value);
6664          return this;
6665        }
6666
6667        /**
6668         * @return {@link #type} (Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.)
6669         */
6670        public CodeableConcept getType() { 
6671          if (this.type == null)
6672            if (Configuration.errorOnAutoCreate())
6673              throw new Error("Attempt to auto-create ActionComponent.type");
6674            else if (Configuration.doAutoCreate())
6675              this.type = new CodeableConcept(); // cc
6676          return this.type;
6677        }
6678
6679        public boolean hasType() { 
6680          return this.type != null && !this.type.isEmpty();
6681        }
6682
6683        /**
6684         * @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.)
6685         */
6686        public ActionComponent setType(CodeableConcept value) { 
6687          this.type = value;
6688          return this;
6689        }
6690
6691        /**
6692         * @return {@link #subject} (Entity of the action.)
6693         */
6694        public List<ActionSubjectComponent> getSubject() { 
6695          if (this.subject == null)
6696            this.subject = new ArrayList<ActionSubjectComponent>();
6697          return this.subject;
6698        }
6699
6700        /**
6701         * @return Returns a reference to <code>this</code> for easy method chaining
6702         */
6703        public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) { 
6704          this.subject = theSubject;
6705          return this;
6706        }
6707
6708        public boolean hasSubject() { 
6709          if (this.subject == null)
6710            return false;
6711          for (ActionSubjectComponent item : this.subject)
6712            if (!item.isEmpty())
6713              return true;
6714          return false;
6715        }
6716
6717        public ActionSubjectComponent addSubject() { //3
6718          ActionSubjectComponent t = new ActionSubjectComponent();
6719          if (this.subject == null)
6720            this.subject = new ArrayList<ActionSubjectComponent>();
6721          this.subject.add(t);
6722          return t;
6723        }
6724
6725        public ActionComponent addSubject(ActionSubjectComponent t) { //3
6726          if (t == null)
6727            return this;
6728          if (this.subject == null)
6729            this.subject = new ArrayList<ActionSubjectComponent>();
6730          this.subject.add(t);
6731          return this;
6732        }
6733
6734        /**
6735         * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
6736         */
6737        public ActionSubjectComponent getSubjectFirstRep() { 
6738          if (getSubject().isEmpty()) {
6739            addSubject();
6740          }
6741          return getSubject().get(0);
6742        }
6743
6744        /**
6745         * @return {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6746         */
6747        public CodeableConcept getIntent() { 
6748          if (this.intent == null)
6749            if (Configuration.errorOnAutoCreate())
6750              throw new Error("Attempt to auto-create ActionComponent.intent");
6751            else if (Configuration.doAutoCreate())
6752              this.intent = new CodeableConcept(); // cc
6753          return this.intent;
6754        }
6755
6756        public boolean hasIntent() { 
6757          return this.intent != null && !this.intent.isEmpty();
6758        }
6759
6760        /**
6761         * @param value {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6762         */
6763        public ActionComponent setIntent(CodeableConcept value) { 
6764          this.intent = value;
6765          return this;
6766        }
6767
6768        /**
6769         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6770         */
6771        public List<StringType> getLinkId() { 
6772          if (this.linkId == null)
6773            this.linkId = new ArrayList<StringType>();
6774          return this.linkId;
6775        }
6776
6777        /**
6778         * @return Returns a reference to <code>this</code> for easy method chaining
6779         */
6780        public ActionComponent setLinkId(List<StringType> theLinkId) { 
6781          this.linkId = theLinkId;
6782          return this;
6783        }
6784
6785        public boolean hasLinkId() { 
6786          if (this.linkId == null)
6787            return false;
6788          for (StringType item : this.linkId)
6789            if (!item.isEmpty())
6790              return true;
6791          return false;
6792        }
6793
6794        /**
6795         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6796         */
6797        public StringType addLinkIdElement() {//2 
6798          StringType t = new StringType();
6799          if (this.linkId == null)
6800            this.linkId = new ArrayList<StringType>();
6801          this.linkId.add(t);
6802          return t;
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 ActionComponent addLinkId(String value) { //1
6809          StringType t = new StringType();
6810          t.setValue(value);
6811          if (this.linkId == null)
6812            this.linkId = new ArrayList<StringType>();
6813          this.linkId.add(t);
6814          return this;
6815        }
6816
6817        /**
6818         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6819         */
6820        public boolean hasLinkId(String value) { 
6821          if (this.linkId == null)
6822            return false;
6823          for (StringType v : this.linkId)
6824            if (v.getValue().equals(value)) // string
6825              return true;
6826          return false;
6827        }
6828
6829        /**
6830         * @return {@link #status} (Current state of the term action.)
6831         */
6832        public CodeableConcept getStatus() { 
6833          if (this.status == null)
6834            if (Configuration.errorOnAutoCreate())
6835              throw new Error("Attempt to auto-create ActionComponent.status");
6836            else if (Configuration.doAutoCreate())
6837              this.status = new CodeableConcept(); // cc
6838          return this.status;
6839        }
6840
6841        public boolean hasStatus() { 
6842          return this.status != null && !this.status.isEmpty();
6843        }
6844
6845        /**
6846         * @param value {@link #status} (Current state of the term action.)
6847         */
6848        public ActionComponent setStatus(CodeableConcept value) { 
6849          this.status = value;
6850          return this;
6851        }
6852
6853        /**
6854         * @return {@link #context} (Encounter or Episode with primary association to specified term activity.)
6855         */
6856        public Reference getContext() { 
6857          if (this.context == null)
6858            if (Configuration.errorOnAutoCreate())
6859              throw new Error("Attempt to auto-create ActionComponent.context");
6860            else if (Configuration.doAutoCreate())
6861              this.context = new Reference(); // cc
6862          return this.context;
6863        }
6864
6865        public boolean hasContext() { 
6866          return this.context != null && !this.context.isEmpty();
6867        }
6868
6869        /**
6870         * @param value {@link #context} (Encounter or Episode with primary association to specified term activity.)
6871         */
6872        public ActionComponent setContext(Reference value) { 
6873          this.context = value;
6874          return this;
6875        }
6876
6877        /**
6878         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
6879         */
6880        public List<StringType> getContextLinkId() { 
6881          if (this.contextLinkId == null)
6882            this.contextLinkId = new ArrayList<StringType>();
6883          return this.contextLinkId;
6884        }
6885
6886        /**
6887         * @return Returns a reference to <code>this</code> for easy method chaining
6888         */
6889        public ActionComponent setContextLinkId(List<StringType> theContextLinkId) { 
6890          this.contextLinkId = theContextLinkId;
6891          return this;
6892        }
6893
6894        public boolean hasContextLinkId() { 
6895          if (this.contextLinkId == null)
6896            return false;
6897          for (StringType item : this.contextLinkId)
6898            if (!item.isEmpty())
6899              return true;
6900          return false;
6901        }
6902
6903        /**
6904         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
6905         */
6906        public StringType addContextLinkIdElement() {//2 
6907          StringType t = new StringType();
6908          if (this.contextLinkId == null)
6909            this.contextLinkId = new ArrayList<StringType>();
6910          this.contextLinkId.add(t);
6911          return t;
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 ActionComponent addContextLinkId(String value) { //1
6918          StringType t = new StringType();
6919          t.setValue(value);
6920          if (this.contextLinkId == null)
6921            this.contextLinkId = new ArrayList<StringType>();
6922          this.contextLinkId.add(t);
6923          return this;
6924        }
6925
6926        /**
6927         * @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.)
6928         */
6929        public boolean hasContextLinkId(String value) { 
6930          if (this.contextLinkId == null)
6931            return false;
6932          for (StringType v : this.contextLinkId)
6933            if (v.getValue().equals(value)) // string
6934              return true;
6935          return false;
6936        }
6937
6938        /**
6939         * @return {@link #occurrence} (When action happens.)
6940         */
6941        public DataType getOccurrence() { 
6942          return this.occurrence;
6943        }
6944
6945        /**
6946         * @return {@link #occurrence} (When action happens.)
6947         */
6948        public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
6949          if (this.occurrence == null)
6950            this.occurrence = new DateTimeType();
6951          if (!(this.occurrence instanceof DateTimeType))
6952            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6953          return (DateTimeType) this.occurrence;
6954        }
6955
6956        public boolean hasOccurrenceDateTimeType() { 
6957          return this != null && this.occurrence instanceof DateTimeType;
6958        }
6959
6960        /**
6961         * @return {@link #occurrence} (When action happens.)
6962         */
6963        public Period getOccurrencePeriod() throws FHIRException { 
6964          if (this.occurrence == null)
6965            this.occurrence = new Period();
6966          if (!(this.occurrence instanceof Period))
6967            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6968          return (Period) this.occurrence;
6969        }
6970
6971        public boolean hasOccurrencePeriod() { 
6972          return this != null && this.occurrence instanceof Period;
6973        }
6974
6975        /**
6976         * @return {@link #occurrence} (When action happens.)
6977         */
6978        public Timing getOccurrenceTiming() throws FHIRException { 
6979          if (this.occurrence == null)
6980            this.occurrence = new Timing();
6981          if (!(this.occurrence instanceof Timing))
6982            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6983          return (Timing) this.occurrence;
6984        }
6985
6986        public boolean hasOccurrenceTiming() { 
6987          return this != null && this.occurrence instanceof Timing;
6988        }
6989
6990        public boolean hasOccurrence() { 
6991          return this.occurrence != null && !this.occurrence.isEmpty();
6992        }
6993
6994        /**
6995         * @param value {@link #occurrence} (When action happens.)
6996         */
6997        public ActionComponent setOccurrence(DataType value) { 
6998          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
6999            throw new Error("Not the right type for Contract.term.action.occurrence[x]: "+value.fhirType());
7000          this.occurrence = value;
7001          return this;
7002        }
7003
7004        /**
7005         * @return {@link #requester} (Who or what initiated the action and has responsibility for its activation.)
7006         */
7007        public List<Reference> getRequester() { 
7008          if (this.requester == null)
7009            this.requester = new ArrayList<Reference>();
7010          return this.requester;
7011        }
7012
7013        /**
7014         * @return Returns a reference to <code>this</code> for easy method chaining
7015         */
7016        public ActionComponent setRequester(List<Reference> theRequester) { 
7017          this.requester = theRequester;
7018          return this;
7019        }
7020
7021        public boolean hasRequester() { 
7022          if (this.requester == null)
7023            return false;
7024          for (Reference item : this.requester)
7025            if (!item.isEmpty())
7026              return true;
7027          return false;
7028        }
7029
7030        public Reference addRequester() { //3
7031          Reference t = new Reference();
7032          if (this.requester == null)
7033            this.requester = new ArrayList<Reference>();
7034          this.requester.add(t);
7035          return t;
7036        }
7037
7038        public ActionComponent addRequester(Reference t) { //3
7039          if (t == null)
7040            return this;
7041          if (this.requester == null)
7042            this.requester = new ArrayList<Reference>();
7043          this.requester.add(t);
7044          return this;
7045        }
7046
7047        /**
7048         * @return The first repetition of repeating field {@link #requester}, creating it if it does not already exist {3}
7049         */
7050        public Reference getRequesterFirstRep() { 
7051          if (getRequester().isEmpty()) {
7052            addRequester();
7053          }
7054          return getRequester().get(0);
7055        }
7056
7057        /**
7058         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7059         */
7060        public List<StringType> getRequesterLinkId() { 
7061          if (this.requesterLinkId == null)
7062            this.requesterLinkId = new ArrayList<StringType>();
7063          return this.requesterLinkId;
7064        }
7065
7066        /**
7067         * @return Returns a reference to <code>this</code> for easy method chaining
7068         */
7069        public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) { 
7070          this.requesterLinkId = theRequesterLinkId;
7071          return this;
7072        }
7073
7074        public boolean hasRequesterLinkId() { 
7075          if (this.requesterLinkId == null)
7076            return false;
7077          for (StringType item : this.requesterLinkId)
7078            if (!item.isEmpty())
7079              return true;
7080          return false;
7081        }
7082
7083        /**
7084         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7085         */
7086        public StringType addRequesterLinkIdElement() {//2 
7087          StringType t = new StringType();
7088          if (this.requesterLinkId == null)
7089            this.requesterLinkId = new ArrayList<StringType>();
7090          this.requesterLinkId.add(t);
7091          return t;
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 ActionComponent addRequesterLinkId(String value) { //1
7098          StringType t = new StringType();
7099          t.setValue(value);
7100          if (this.requesterLinkId == null)
7101            this.requesterLinkId = new ArrayList<StringType>();
7102          this.requesterLinkId.add(t);
7103          return this;
7104        }
7105
7106        /**
7107         * @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.)
7108         */
7109        public boolean hasRequesterLinkId(String value) { 
7110          if (this.requesterLinkId == null)
7111            return false;
7112          for (StringType v : this.requesterLinkId)
7113            if (v.getValue().equals(value)) // string
7114              return true;
7115          return false;
7116        }
7117
7118        /**
7119         * @return {@link #performerType} (The type of individual that is desired or required to perform or not perform the action.)
7120         */
7121        public List<CodeableConcept> getPerformerType() { 
7122          if (this.performerType == null)
7123            this.performerType = new ArrayList<CodeableConcept>();
7124          return this.performerType;
7125        }
7126
7127        /**
7128         * @return Returns a reference to <code>this</code> for easy method chaining
7129         */
7130        public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) { 
7131          this.performerType = thePerformerType;
7132          return this;
7133        }
7134
7135        public boolean hasPerformerType() { 
7136          if (this.performerType == null)
7137            return false;
7138          for (CodeableConcept item : this.performerType)
7139            if (!item.isEmpty())
7140              return true;
7141          return false;
7142        }
7143
7144        public CodeableConcept addPerformerType() { //3
7145          CodeableConcept t = new CodeableConcept();
7146          if (this.performerType == null)
7147            this.performerType = new ArrayList<CodeableConcept>();
7148          this.performerType.add(t);
7149          return t;
7150        }
7151
7152        public ActionComponent addPerformerType(CodeableConcept t) { //3
7153          if (t == null)
7154            return this;
7155          if (this.performerType == null)
7156            this.performerType = new ArrayList<CodeableConcept>();
7157          this.performerType.add(t);
7158          return this;
7159        }
7160
7161        /**
7162         * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist {3}
7163         */
7164        public CodeableConcept getPerformerTypeFirstRep() { 
7165          if (getPerformerType().isEmpty()) {
7166            addPerformerType();
7167          }
7168          return getPerformerType().get(0);
7169        }
7170
7171        /**
7172         * @return {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7173         */
7174        public CodeableConcept getPerformerRole() { 
7175          if (this.performerRole == null)
7176            if (Configuration.errorOnAutoCreate())
7177              throw new Error("Attempt to auto-create ActionComponent.performerRole");
7178            else if (Configuration.doAutoCreate())
7179              this.performerRole = new CodeableConcept(); // cc
7180          return this.performerRole;
7181        }
7182
7183        public boolean hasPerformerRole() { 
7184          return this.performerRole != null && !this.performerRole.isEmpty();
7185        }
7186
7187        /**
7188         * @param value {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7189         */
7190        public ActionComponent setPerformerRole(CodeableConcept value) { 
7191          this.performerRole = value;
7192          return this;
7193        }
7194
7195        /**
7196         * @return {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7197         */
7198        public Reference getPerformer() { 
7199          if (this.performer == null)
7200            if (Configuration.errorOnAutoCreate())
7201              throw new Error("Attempt to auto-create ActionComponent.performer");
7202            else if (Configuration.doAutoCreate())
7203              this.performer = new Reference(); // cc
7204          return this.performer;
7205        }
7206
7207        public boolean hasPerformer() { 
7208          return this.performer != null && !this.performer.isEmpty();
7209        }
7210
7211        /**
7212         * @param value {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7213         */
7214        public ActionComponent setPerformer(Reference value) { 
7215          this.performer = value;
7216          return this;
7217        }
7218
7219        /**
7220         * @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.)
7221         */
7222        public List<StringType> getPerformerLinkId() { 
7223          if (this.performerLinkId == null)
7224            this.performerLinkId = new ArrayList<StringType>();
7225          return this.performerLinkId;
7226        }
7227
7228        /**
7229         * @return Returns a reference to <code>this</code> for easy method chaining
7230         */
7231        public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) { 
7232          this.performerLinkId = thePerformerLinkId;
7233          return this;
7234        }
7235
7236        public boolean hasPerformerLinkId() { 
7237          if (this.performerLinkId == null)
7238            return false;
7239          for (StringType item : this.performerLinkId)
7240            if (!item.isEmpty())
7241              return true;
7242          return false;
7243        }
7244
7245        /**
7246         * @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.)
7247         */
7248        public StringType addPerformerLinkIdElement() {//2 
7249          StringType t = new StringType();
7250          if (this.performerLinkId == null)
7251            this.performerLinkId = new ArrayList<StringType>();
7252          this.performerLinkId.add(t);
7253          return t;
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 ActionComponent addPerformerLinkId(String value) { //1
7260          StringType t = new StringType();
7261          t.setValue(value);
7262          if (this.performerLinkId == null)
7263            this.performerLinkId = new ArrayList<StringType>();
7264          this.performerLinkId.add(t);
7265          return this;
7266        }
7267
7268        /**
7269         * @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.)
7270         */
7271        public boolean hasPerformerLinkId(String value) { 
7272          if (this.performerLinkId == null)
7273            return false;
7274          for (StringType v : this.performerLinkId)
7275            if (v.getValue().equals(value)) // string
7276              return true;
7277          return false;
7278        }
7279
7280        /**
7281         * @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.)
7282         */
7283        public List<CodeableReference> getReason() { 
7284          if (this.reason == null)
7285            this.reason = new ArrayList<CodeableReference>();
7286          return this.reason;
7287        }
7288
7289        /**
7290         * @return Returns a reference to <code>this</code> for easy method chaining
7291         */
7292        public ActionComponent setReason(List<CodeableReference> theReason) { 
7293          this.reason = theReason;
7294          return this;
7295        }
7296
7297        public boolean hasReason() { 
7298          if (this.reason == null)
7299            return false;
7300          for (CodeableReference item : this.reason)
7301            if (!item.isEmpty())
7302              return true;
7303          return false;
7304        }
7305
7306        public CodeableReference addReason() { //3
7307          CodeableReference t = new CodeableReference();
7308          if (this.reason == null)
7309            this.reason = new ArrayList<CodeableReference>();
7310          this.reason.add(t);
7311          return t;
7312        }
7313
7314        public ActionComponent addReason(CodeableReference t) { //3
7315          if (t == null)
7316            return this;
7317          if (this.reason == null)
7318            this.reason = new ArrayList<CodeableReference>();
7319          this.reason.add(t);
7320          return this;
7321        }
7322
7323        /**
7324         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
7325         */
7326        public CodeableReference getReasonFirstRep() { 
7327          if (getReason().isEmpty()) {
7328            addReason();
7329          }
7330          return getReason().get(0);
7331        }
7332
7333        /**
7334         * @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.)
7335         */
7336        public List<StringType> getReasonLinkId() { 
7337          if (this.reasonLinkId == null)
7338            this.reasonLinkId = new ArrayList<StringType>();
7339          return this.reasonLinkId;
7340        }
7341
7342        /**
7343         * @return Returns a reference to <code>this</code> for easy method chaining
7344         */
7345        public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) { 
7346          this.reasonLinkId = theReasonLinkId;
7347          return this;
7348        }
7349
7350        public boolean hasReasonLinkId() { 
7351          if (this.reasonLinkId == null)
7352            return false;
7353          for (StringType item : this.reasonLinkId)
7354            if (!item.isEmpty())
7355              return true;
7356          return false;
7357        }
7358
7359        /**
7360         * @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.)
7361         */
7362        public StringType addReasonLinkIdElement() {//2 
7363          StringType t = new StringType();
7364          if (this.reasonLinkId == null)
7365            this.reasonLinkId = new ArrayList<StringType>();
7366          this.reasonLinkId.add(t);
7367          return t;
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 ActionComponent addReasonLinkId(String value) { //1
7374          StringType t = new StringType();
7375          t.setValue(value);
7376          if (this.reasonLinkId == null)
7377            this.reasonLinkId = new ArrayList<StringType>();
7378          this.reasonLinkId.add(t);
7379          return this;
7380        }
7381
7382        /**
7383         * @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.)
7384         */
7385        public boolean hasReasonLinkId(String value) { 
7386          if (this.reasonLinkId == null)
7387            return false;
7388          for (StringType v : this.reasonLinkId)
7389            if (v.getValue().equals(value)) // string
7390              return true;
7391          return false;
7392        }
7393
7394        /**
7395         * @return {@link #note} (Comments made about the term action made by the requester, performer, subject or other participants.)
7396         */
7397        public List<Annotation> getNote() { 
7398          if (this.note == null)
7399            this.note = new ArrayList<Annotation>();
7400          return this.note;
7401        }
7402
7403        /**
7404         * @return Returns a reference to <code>this</code> for easy method chaining
7405         */
7406        public ActionComponent setNote(List<Annotation> theNote) { 
7407          this.note = theNote;
7408          return this;
7409        }
7410
7411        public boolean hasNote() { 
7412          if (this.note == null)
7413            return false;
7414          for (Annotation item : this.note)
7415            if (!item.isEmpty())
7416              return true;
7417          return false;
7418        }
7419
7420        public Annotation addNote() { //3
7421          Annotation t = new Annotation();
7422          if (this.note == null)
7423            this.note = new ArrayList<Annotation>();
7424          this.note.add(t);
7425          return t;
7426        }
7427
7428        public ActionComponent addNote(Annotation t) { //3
7429          if (t == null)
7430            return this;
7431          if (this.note == null)
7432            this.note = new ArrayList<Annotation>();
7433          this.note.add(t);
7434          return this;
7435        }
7436
7437        /**
7438         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
7439         */
7440        public Annotation getNoteFirstRep() { 
7441          if (getNote().isEmpty()) {
7442            addNote();
7443          }
7444          return getNote().get(0);
7445        }
7446
7447        /**
7448         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7449         */
7450        public List<UnsignedIntType> getSecurityLabelNumber() { 
7451          if (this.securityLabelNumber == null)
7452            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7453          return this.securityLabelNumber;
7454        }
7455
7456        /**
7457         * @return Returns a reference to <code>this</code> for easy method chaining
7458         */
7459        public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
7460          this.securityLabelNumber = theSecurityLabelNumber;
7461          return this;
7462        }
7463
7464        public boolean hasSecurityLabelNumber() { 
7465          if (this.securityLabelNumber == null)
7466            return false;
7467          for (UnsignedIntType item : this.securityLabelNumber)
7468            if (!item.isEmpty())
7469              return true;
7470          return false;
7471        }
7472
7473        /**
7474         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7475         */
7476        public UnsignedIntType addSecurityLabelNumberElement() {//2 
7477          UnsignedIntType t = new UnsignedIntType();
7478          if (this.securityLabelNumber == null)
7479            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7480          this.securityLabelNumber.add(t);
7481          return t;
7482        }
7483
7484        /**
7485         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7486         */
7487        public ActionComponent addSecurityLabelNumber(int value) { //1
7488          UnsignedIntType t = new UnsignedIntType();
7489          t.setValue(value);
7490          if (this.securityLabelNumber == null)
7491            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7492          this.securityLabelNumber.add(t);
7493          return this;
7494        }
7495
7496        /**
7497         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7498         */
7499        public boolean hasSecurityLabelNumber(int value) { 
7500          if (this.securityLabelNumber == null)
7501            return false;
7502          for (UnsignedIntType v : this.securityLabelNumber)
7503            if (v.getValue().equals(value)) // unsignedInt
7504              return true;
7505          return false;
7506        }
7507
7508        protected void listChildren(List<Property> children) {
7509          super.listChildren(children);
7510          children.add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
7511          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));
7512          children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
7513          children.add(new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
7514          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));
7515          children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
7516          children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
7517          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));
7518          children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
7519          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));
7520          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));
7521          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));
7522          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));
7523          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));
7524          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));
7525          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));
7526          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));
7527          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));
7528          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
7529        }
7530
7531        @Override
7532        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7533          switch (_hash) {
7534          case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform);
7535          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);
7536          case -1867885268: /*subject*/  return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject);
7537          case -1183762788: /*intent*/  return new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
7538          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);
7539          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status);
7540          case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
7541          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);
7542          case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7543          case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7544          case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime", "When action happens.", 0, 1, occurrence);
7545          case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "Period", "When action happens.", 0, 1, occurrence);
7546          case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "Timing", "When action happens.", 0, 1, occurrence);
7547          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);
7548          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);
7549          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);
7550          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);
7551          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);
7552          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);
7553          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);
7554          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);
7555          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);
7556          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
7557          default: return super.getNamedProperty(_hash, _name, _checkValid);
7558          }
7559
7560        }
7561
7562      @Override
7563      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7564        switch (hash) {
7565        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
7566        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
7567        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
7568        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // CodeableConcept
7569        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7570        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
7571        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
7572        case -288783036: /*contextLinkId*/ return this.contextLinkId == null ? new Base[0] : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
7573        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // DataType
7574        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : this.requester.toArray(new Base[this.requester.size()]); // Reference
7575        case -1468032687: /*requesterLinkId*/ return this.requesterLinkId == null ? new Base[0] : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
7576        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
7577        case -901513884: /*performerRole*/ return this.performerRole == null ? new Base[0] : new Base[] {this.performerRole}; // CodeableConcept
7578        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
7579        case 1051302947: /*performerLinkId*/ return this.performerLinkId == null ? new Base[0] : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
7580        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
7581        case -1557963239: /*reasonLinkId*/ return this.reasonLinkId == null ? new Base[0] : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
7582        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
7583        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7584        default: return super.getProperty(hash, name, checkValid);
7585        }
7586
7587      }
7588
7589      @Override
7590      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7591        switch (hash) {
7592        case -1788508167: // doNotPerform
7593          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
7594          return value;
7595        case 3575610: // type
7596          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7597          return value;
7598        case -1867885268: // subject
7599          this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
7600          return value;
7601        case -1183762788: // intent
7602          this.intent = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7603          return value;
7604        case -1102667083: // linkId
7605          this.getLinkId().add(TypeConvertor.castToString(value)); // StringType
7606          return value;
7607        case -892481550: // status
7608          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7609          return value;
7610        case 951530927: // context
7611          this.context = TypeConvertor.castToReference(value); // Reference
7612          return value;
7613        case -288783036: // contextLinkId
7614          this.getContextLinkId().add(TypeConvertor.castToString(value)); // StringType
7615          return value;
7616        case 1687874001: // occurrence
7617          this.occurrence = TypeConvertor.castToType(value); // DataType
7618          return value;
7619        case 693933948: // requester
7620          this.getRequester().add(TypeConvertor.castToReference(value)); // Reference
7621          return value;
7622        case -1468032687: // requesterLinkId
7623          this.getRequesterLinkId().add(TypeConvertor.castToString(value)); // StringType
7624          return value;
7625        case -901444568: // performerType
7626          this.getPerformerType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7627          return value;
7628        case -901513884: // performerRole
7629          this.performerRole = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7630          return value;
7631        case 481140686: // performer
7632          this.performer = TypeConvertor.castToReference(value); // Reference
7633          return value;
7634        case 1051302947: // performerLinkId
7635          this.getPerformerLinkId().add(TypeConvertor.castToString(value)); // StringType
7636          return value;
7637        case -934964668: // reason
7638          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
7639          return value;
7640        case -1557963239: // reasonLinkId
7641          this.getReasonLinkId().add(TypeConvertor.castToString(value)); // StringType
7642          return value;
7643        case 3387378: // note
7644          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
7645          return value;
7646        case -149460995: // securityLabelNumber
7647          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value)); // UnsignedIntType
7648          return value;
7649        default: return super.setProperty(hash, name, value);
7650        }
7651
7652      }
7653
7654      @Override
7655      public Base setProperty(String name, Base value) throws FHIRException {
7656        if (name.equals("doNotPerform")) {
7657          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
7658        } else if (name.equals("type")) {
7659          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7660        } else if (name.equals("subject")) {
7661          this.getSubject().add((ActionSubjectComponent) value);
7662        } else if (name.equals("intent")) {
7663          this.intent = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7664        } else if (name.equals("linkId")) {
7665          this.getLinkId().add(TypeConvertor.castToString(value));
7666        } else if (name.equals("status")) {
7667          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7668        } else if (name.equals("context")) {
7669          this.context = TypeConvertor.castToReference(value); // Reference
7670        } else if (name.equals("contextLinkId")) {
7671          this.getContextLinkId().add(TypeConvertor.castToString(value));
7672        } else if (name.equals("occurrence[x]")) {
7673          this.occurrence = TypeConvertor.castToType(value); // DataType
7674        } else if (name.equals("requester")) {
7675          this.getRequester().add(TypeConvertor.castToReference(value));
7676        } else if (name.equals("requesterLinkId")) {
7677          this.getRequesterLinkId().add(TypeConvertor.castToString(value));
7678        } else if (name.equals("performerType")) {
7679          this.getPerformerType().add(TypeConvertor.castToCodeableConcept(value));
7680        } else if (name.equals("performerRole")) {
7681          this.performerRole = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7682        } else if (name.equals("performer")) {
7683          this.performer = TypeConvertor.castToReference(value); // Reference
7684        } else if (name.equals("performerLinkId")) {
7685          this.getPerformerLinkId().add(TypeConvertor.castToString(value));
7686        } else if (name.equals("reason")) {
7687          this.getReason().add(TypeConvertor.castToCodeableReference(value));
7688        } else if (name.equals("reasonLinkId")) {
7689          this.getReasonLinkId().add(TypeConvertor.castToString(value));
7690        } else if (name.equals("note")) {
7691          this.getNote().add(TypeConvertor.castToAnnotation(value));
7692        } else if (name.equals("securityLabelNumber")) {
7693          this.getSecurityLabelNumber().add(TypeConvertor.castToUnsignedInt(value));
7694        } else
7695          return super.setProperty(name, value);
7696        return value;
7697      }
7698
7699      @Override
7700      public Base makeProperty(int hash, String name) throws FHIRException {
7701        switch (hash) {
7702        case -1788508167:  return getDoNotPerformElement();
7703        case 3575610:  return getType();
7704        case -1867885268:  return addSubject(); 
7705        case -1183762788:  return getIntent();
7706        case -1102667083:  return addLinkIdElement();
7707        case -892481550:  return getStatus();
7708        case 951530927:  return getContext();
7709        case -288783036:  return addContextLinkIdElement();
7710        case -2022646513:  return getOccurrence();
7711        case 1687874001:  return getOccurrence();
7712        case 693933948:  return addRequester(); 
7713        case -1468032687:  return addRequesterLinkIdElement();
7714        case -901444568:  return addPerformerType(); 
7715        case -901513884:  return getPerformerRole();
7716        case 481140686:  return getPerformer();
7717        case 1051302947:  return addPerformerLinkIdElement();
7718        case -934964668:  return addReason(); 
7719        case -1557963239:  return addReasonLinkIdElement();
7720        case 3387378:  return addNote(); 
7721        case -149460995:  return addSecurityLabelNumberElement();
7722        default: return super.makeProperty(hash, name);
7723        }
7724
7725      }
7726
7727      @Override
7728      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7729        switch (hash) {
7730        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
7731        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7732        case -1867885268: /*subject*/ return new String[] {};
7733        case -1183762788: /*intent*/ return new String[] {"CodeableConcept"};
7734        case -1102667083: /*linkId*/ return new String[] {"string"};
7735        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
7736        case 951530927: /*context*/ return new String[] {"Reference"};
7737        case -288783036: /*contextLinkId*/ return new String[] {"string"};
7738        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
7739        case 693933948: /*requester*/ return new String[] {"Reference"};
7740        case -1468032687: /*requesterLinkId*/ return new String[] {"string"};
7741        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
7742        case -901513884: /*performerRole*/ return new String[] {"CodeableConcept"};
7743        case 481140686: /*performer*/ return new String[] {"Reference"};
7744        case 1051302947: /*performerLinkId*/ return new String[] {"string"};
7745        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
7746        case -1557963239: /*reasonLinkId*/ return new String[] {"string"};
7747        case 3387378: /*note*/ return new String[] {"Annotation"};
7748        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
7749        default: return super.getTypesForProperty(hash, name);
7750        }
7751
7752      }
7753
7754      @Override
7755      public Base addChild(String name) throws FHIRException {
7756        if (name.equals("doNotPerform")) {
7757          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.doNotPerform");
7758        }
7759        else if (name.equals("type")) {
7760          this.type = new CodeableConcept();
7761          return this.type;
7762        }
7763        else if (name.equals("subject")) {
7764          return addSubject();
7765        }
7766        else if (name.equals("intent")) {
7767          this.intent = new CodeableConcept();
7768          return this.intent;
7769        }
7770        else if (name.equals("linkId")) {
7771          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.linkId");
7772        }
7773        else if (name.equals("status")) {
7774          this.status = new CodeableConcept();
7775          return this.status;
7776        }
7777        else if (name.equals("context")) {
7778          this.context = new Reference();
7779          return this.context;
7780        }
7781        else if (name.equals("contextLinkId")) {
7782          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.contextLinkId");
7783        }
7784        else if (name.equals("occurrenceDateTime")) {
7785          this.occurrence = new DateTimeType();
7786          return this.occurrence;
7787        }
7788        else if (name.equals("occurrencePeriod")) {
7789          this.occurrence = new Period();
7790          return this.occurrence;
7791        }
7792        else if (name.equals("occurrenceTiming")) {
7793          this.occurrence = new Timing();
7794          return this.occurrence;
7795        }
7796        else if (name.equals("requester")) {
7797          return addRequester();
7798        }
7799        else if (name.equals("requesterLinkId")) {
7800          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.requesterLinkId");
7801        }
7802        else if (name.equals("performerType")) {
7803          return addPerformerType();
7804        }
7805        else if (name.equals("performerRole")) {
7806          this.performerRole = new CodeableConcept();
7807          return this.performerRole;
7808        }
7809        else if (name.equals("performer")) {
7810          this.performer = new Reference();
7811          return this.performer;
7812        }
7813        else if (name.equals("performerLinkId")) {
7814          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.performerLinkId");
7815        }
7816        else if (name.equals("reason")) {
7817          return addReason();
7818        }
7819        else if (name.equals("reasonLinkId")) {
7820          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.reasonLinkId");
7821        }
7822        else if (name.equals("note")) {
7823          return addNote();
7824        }
7825        else if (name.equals("securityLabelNumber")) {
7826          throw new FHIRException("Cannot call addChild on a primitive type Contract.term.action.securityLabelNumber");
7827        }
7828        else
7829          return super.addChild(name);
7830      }
7831
7832      public ActionComponent copy() {
7833        ActionComponent dst = new ActionComponent();
7834        copyValues(dst);
7835        return dst;
7836      }
7837
7838      public void copyValues(ActionComponent dst) {
7839        super.copyValues(dst);
7840        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
7841        dst.type = type == null ? null : type.copy();
7842        if (subject != null) {
7843          dst.subject = new ArrayList<ActionSubjectComponent>();
7844          for (ActionSubjectComponent i : subject)
7845            dst.subject.add(i.copy());
7846        };
7847        dst.intent = intent == null ? null : intent.copy();
7848        if (linkId != null) {
7849          dst.linkId = new ArrayList<StringType>();
7850          for (StringType i : linkId)
7851            dst.linkId.add(i.copy());
7852        };
7853        dst.status = status == null ? null : status.copy();
7854        dst.context = context == null ? null : context.copy();
7855        if (contextLinkId != null) {
7856          dst.contextLinkId = new ArrayList<StringType>();
7857          for (StringType i : contextLinkId)
7858            dst.contextLinkId.add(i.copy());
7859        };
7860        dst.occurrence = occurrence == null ? null : occurrence.copy();
7861        if (requester != null) {
7862          dst.requester = new ArrayList<Reference>();
7863          for (Reference i : requester)
7864            dst.requester.add(i.copy());
7865        };
7866        if (requesterLinkId != null) {
7867          dst.requesterLinkId = new ArrayList<StringType>();
7868          for (StringType i : requesterLinkId)
7869            dst.requesterLinkId.add(i.copy());
7870        };
7871        if (performerType != null) {
7872          dst.performerType = new ArrayList<CodeableConcept>();
7873          for (CodeableConcept i : performerType)
7874            dst.performerType.add(i.copy());
7875        };
7876        dst.performerRole = performerRole == null ? null : performerRole.copy();
7877        dst.performer = performer == null ? null : performer.copy();
7878        if (performerLinkId != null) {
7879          dst.performerLinkId = new ArrayList<StringType>();
7880          for (StringType i : performerLinkId)
7881            dst.performerLinkId.add(i.copy());
7882        };
7883        if (reason != null) {
7884          dst.reason = new ArrayList<CodeableReference>();
7885          for (CodeableReference i : reason)
7886            dst.reason.add(i.copy());
7887        };
7888        if (reasonLinkId != null) {
7889          dst.reasonLinkId = new ArrayList<StringType>();
7890          for (StringType i : reasonLinkId)
7891            dst.reasonLinkId.add(i.copy());
7892        };
7893        if (note != null) {
7894          dst.note = new ArrayList<Annotation>();
7895          for (Annotation i : note)
7896            dst.note.add(i.copy());
7897        };
7898        if (securityLabelNumber != null) {
7899          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
7900          for (UnsignedIntType i : securityLabelNumber)
7901            dst.securityLabelNumber.add(i.copy());
7902        };
7903      }
7904
7905      @Override
7906      public boolean equalsDeep(Base other_) {
7907        if (!super.equalsDeep(other_))
7908          return false;
7909        if (!(other_ instanceof ActionComponent))
7910          return false;
7911        ActionComponent o = (ActionComponent) other_;
7912        return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
7913           && compareDeep(intent, o.intent, true) && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
7914           && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true) && compareDeep(occurrence, o.occurrence, true)
7915           && compareDeep(requester, o.requester, true) && compareDeep(requesterLinkId, o.requesterLinkId, true)
7916           && compareDeep(performerType, o.performerType, true) && compareDeep(performerRole, o.performerRole, true)
7917           && compareDeep(performer, o.performer, true) && compareDeep(performerLinkId, o.performerLinkId, true)
7918           && compareDeep(reason, o.reason, true) && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
7919           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
7920      }
7921
7922      @Override
7923      public boolean equalsShallow(Base other_) {
7924        if (!super.equalsShallow(other_))
7925          return false;
7926        if (!(other_ instanceof ActionComponent))
7927          return false;
7928        ActionComponent o = (ActionComponent) other_;
7929        return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true) && compareValues(contextLinkId, o.contextLinkId, true)
7930           && compareValues(requesterLinkId, o.requesterLinkId, true) && compareValues(performerLinkId, o.performerLinkId, true)
7931           && compareValues(reasonLinkId, o.reasonLinkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
7932          ;
7933      }
7934
7935      public boolean isEmpty() {
7936        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject
7937          , intent, linkId, status, context, contextLinkId, occurrence, requester, requesterLinkId
7938          , performerType, performerRole, performer, performerLinkId, reason, reasonLinkId
7939          , note, securityLabelNumber);
7940      }
7941
7942  public String fhirType() {
7943    return "Contract.term.action";
7944
7945  }
7946
7947  }
7948
7949    @Block()
7950    public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
7951        /**
7952         * The entity the action is performed or not performed on or for.
7953         */
7954        @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)
7955        @Description(shortDefinition="Entity of the action", formalDefinition="The entity the action is performed or not performed on or for." )
7956        protected List<Reference> reference;
7957
7958        /**
7959         * Role type of agent assigned roles in this Contract.
7960         */
7961        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
7962        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
7963        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
7964        protected CodeableConcept role;
7965
7966        private static final long serialVersionUID = -1599592477L;
7967
7968    /**
7969     * Constructor
7970     */
7971      public ActionSubjectComponent() {
7972        super();
7973      }
7974
7975    /**
7976     * Constructor
7977     */
7978      public ActionSubjectComponent(Reference reference) {
7979        super();
7980        this.addReference(reference);
7981      }
7982
7983        /**
7984         * @return {@link #reference} (The entity the action is performed or not performed on or for.)
7985         */
7986        public List<Reference> getReference() { 
7987          if (this.reference == null)
7988            this.reference = new ArrayList<Reference>();
7989          return this.reference;
7990        }
7991
7992        /**
7993         * @return Returns a reference to <code>this</code> for easy method chaining
7994         */
7995        public ActionSubjectComponent setReference(List<Reference> theReference) { 
7996          this.reference = theReference;
7997          return this;
7998        }
7999
8000        public boolean hasReference() { 
8001          if (this.reference == null)
8002            return false;
8003          for (Reference item : this.reference)
8004            if (!item.isEmpty())
8005              return true;
8006          return false;
8007        }
8008
8009        public Reference addReference() { //3
8010          Reference t = new Reference();
8011          if (this.reference == null)
8012            this.reference = new ArrayList<Reference>();
8013          this.reference.add(t);
8014          return t;
8015        }
8016
8017        public ActionSubjectComponent addReference(Reference t) { //3
8018          if (t == null)
8019            return this;
8020          if (this.reference == null)
8021            this.reference = new ArrayList<Reference>();
8022          this.reference.add(t);
8023          return this;
8024        }
8025
8026        /**
8027         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist {3}
8028         */
8029        public Reference getReferenceFirstRep() { 
8030          if (getReference().isEmpty()) {
8031            addReference();
8032          }
8033          return getReference().get(0);
8034        }
8035
8036        /**
8037         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
8038         */
8039        public CodeableConcept getRole() { 
8040          if (this.role == null)
8041            if (Configuration.errorOnAutoCreate())
8042              throw new Error("Attempt to auto-create ActionSubjectComponent.role");
8043            else if (Configuration.doAutoCreate())
8044              this.role = new CodeableConcept(); // cc
8045          return this.role;
8046        }
8047
8048        public boolean hasRole() { 
8049          return this.role != null && !this.role.isEmpty();
8050        }
8051
8052        /**
8053         * @param value {@link #role} (Role type of agent assigned roles in this Contract.)
8054         */
8055        public ActionSubjectComponent setRole(CodeableConcept value) { 
8056          this.role = value;
8057          return this;
8058        }
8059
8060        protected void listChildren(List<Property> children) {
8061          super.listChildren(children);
8062          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));
8063          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
8064        }
8065
8066        @Override
8067        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8068          switch (_hash) {
8069          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);
8070          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role);
8071          default: return super.getNamedProperty(_hash, _name, _checkValid);
8072          }
8073
8074        }
8075
8076      @Override
8077      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8078        switch (hash) {
8079        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
8080        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
8081        default: return super.getProperty(hash, name, checkValid);
8082        }
8083
8084      }
8085
8086      @Override
8087      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8088        switch (hash) {
8089        case -925155509: // reference
8090          this.getReference().add(TypeConvertor.castToReference(value)); // Reference
8091          return value;
8092        case 3506294: // role
8093          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8094          return value;
8095        default: return super.setProperty(hash, name, value);
8096        }
8097
8098      }
8099
8100      @Override
8101      public Base setProperty(String name, Base value) throws FHIRException {
8102        if (name.equals("reference")) {
8103          this.getReference().add(TypeConvertor.castToReference(value));
8104        } else if (name.equals("role")) {
8105          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8106        } else
8107          return super.setProperty(name, value);
8108        return value;
8109      }
8110
8111      @Override
8112      public Base makeProperty(int hash, String name) throws FHIRException {
8113        switch (hash) {
8114        case -925155509:  return addReference(); 
8115        case 3506294:  return getRole();
8116        default: return super.makeProperty(hash, name);
8117        }
8118
8119      }
8120
8121      @Override
8122      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8123        switch (hash) {
8124        case -925155509: /*reference*/ return new String[] {"Reference"};
8125        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
8126        default: return super.getTypesForProperty(hash, name);
8127        }
8128
8129      }
8130
8131      @Override
8132      public Base addChild(String name) throws FHIRException {
8133        if (name.equals("reference")) {
8134          return addReference();
8135        }
8136        else if (name.equals("role")) {
8137          this.role = new CodeableConcept();
8138          return this.role;
8139        }
8140        else
8141          return super.addChild(name);
8142      }
8143
8144      public ActionSubjectComponent copy() {
8145        ActionSubjectComponent dst = new ActionSubjectComponent();
8146        copyValues(dst);
8147        return dst;
8148      }
8149
8150      public void copyValues(ActionSubjectComponent dst) {
8151        super.copyValues(dst);
8152        if (reference != null) {
8153          dst.reference = new ArrayList<Reference>();
8154          for (Reference i : reference)
8155            dst.reference.add(i.copy());
8156        };
8157        dst.role = role == null ? null : role.copy();
8158      }
8159
8160      @Override
8161      public boolean equalsDeep(Base other_) {
8162        if (!super.equalsDeep(other_))
8163          return false;
8164        if (!(other_ instanceof ActionSubjectComponent))
8165          return false;
8166        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8167        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
8168      }
8169
8170      @Override
8171      public boolean equalsShallow(Base other_) {
8172        if (!super.equalsShallow(other_))
8173          return false;
8174        if (!(other_ instanceof ActionSubjectComponent))
8175          return false;
8176        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8177        return true;
8178      }
8179
8180      public boolean isEmpty() {
8181        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
8182      }
8183
8184  public String fhirType() {
8185    return "Contract.term.action.subject";
8186
8187  }
8188
8189  }
8190
8191    @Block()
8192    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
8193        /**
8194         * Role of this Contract signer, e.g. notary, grantee.
8195         */
8196        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
8197        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
8198        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
8199        protected Coding type;
8200
8201        /**
8202         * Party which is a signator to this Contract.
8203         */
8204        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
8205        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
8206        protected Reference party;
8207
8208        /**
8209         * Legally binding Contract DSIG signature contents in Base64.
8210         */
8211        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8212        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
8213        protected List<Signature> signature;
8214
8215        private static final long serialVersionUID = 1384929729L;
8216
8217    /**
8218     * Constructor
8219     */
8220      public SignatoryComponent() {
8221        super();
8222      }
8223
8224    /**
8225     * Constructor
8226     */
8227      public SignatoryComponent(Coding type, Reference party, Signature signature) {
8228        super();
8229        this.setType(type);
8230        this.setParty(party);
8231        this.addSignature(signature);
8232      }
8233
8234        /**
8235         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8236         */
8237        public Coding getType() { 
8238          if (this.type == null)
8239            if (Configuration.errorOnAutoCreate())
8240              throw new Error("Attempt to auto-create SignatoryComponent.type");
8241            else if (Configuration.doAutoCreate())
8242              this.type = new Coding(); // cc
8243          return this.type;
8244        }
8245
8246        public boolean hasType() { 
8247          return this.type != null && !this.type.isEmpty();
8248        }
8249
8250        /**
8251         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8252         */
8253        public SignatoryComponent setType(Coding value) { 
8254          this.type = value;
8255          return this;
8256        }
8257
8258        /**
8259         * @return {@link #party} (Party which is a signator to this Contract.)
8260         */
8261        public Reference getParty() { 
8262          if (this.party == null)
8263            if (Configuration.errorOnAutoCreate())
8264              throw new Error("Attempt to auto-create SignatoryComponent.party");
8265            else if (Configuration.doAutoCreate())
8266              this.party = new Reference(); // cc
8267          return this.party;
8268        }
8269
8270        public boolean hasParty() { 
8271          return this.party != null && !this.party.isEmpty();
8272        }
8273
8274        /**
8275         * @param value {@link #party} (Party which is a signator to this Contract.)
8276         */
8277        public SignatoryComponent setParty(Reference value) { 
8278          this.party = value;
8279          return this;
8280        }
8281
8282        /**
8283         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
8284         */
8285        public List<Signature> getSignature() { 
8286          if (this.signature == null)
8287            this.signature = new ArrayList<Signature>();
8288          return this.signature;
8289        }
8290
8291        /**
8292         * @return Returns a reference to <code>this</code> for easy method chaining
8293         */
8294        public SignatoryComponent setSignature(List<Signature> theSignature) { 
8295          this.signature = theSignature;
8296          return this;
8297        }
8298
8299        public boolean hasSignature() { 
8300          if (this.signature == null)
8301            return false;
8302          for (Signature item : this.signature)
8303            if (!item.isEmpty())
8304              return true;
8305          return false;
8306        }
8307
8308        public Signature addSignature() { //3
8309          Signature t = new Signature();
8310          if (this.signature == null)
8311            this.signature = new ArrayList<Signature>();
8312          this.signature.add(t);
8313          return t;
8314        }
8315
8316        public SignatoryComponent addSignature(Signature t) { //3
8317          if (t == null)
8318            return this;
8319          if (this.signature == null)
8320            this.signature = new ArrayList<Signature>();
8321          this.signature.add(t);
8322          return this;
8323        }
8324
8325        /**
8326         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist {3}
8327         */
8328        public Signature getSignatureFirstRep() { 
8329          if (getSignature().isEmpty()) {
8330            addSignature();
8331          }
8332          return getSignature().get(0);
8333        }
8334
8335        protected void listChildren(List<Property> children) {
8336          super.listChildren(children);
8337          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
8338          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
8339          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
8340        }
8341
8342        @Override
8343        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8344          switch (_hash) {
8345          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
8346          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
8347          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
8348          default: return super.getNamedProperty(_hash, _name, _checkValid);
8349          }
8350
8351        }
8352
8353      @Override
8354      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8355        switch (hash) {
8356        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8357        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
8358        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
8359        default: return super.getProperty(hash, name, checkValid);
8360        }
8361
8362      }
8363
8364      @Override
8365      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8366        switch (hash) {
8367        case 3575610: // type
8368          this.type = TypeConvertor.castToCoding(value); // Coding
8369          return value;
8370        case 106437350: // party
8371          this.party = TypeConvertor.castToReference(value); // Reference
8372          return value;
8373        case 1073584312: // signature
8374          this.getSignature().add(TypeConvertor.castToSignature(value)); // Signature
8375          return value;
8376        default: return super.setProperty(hash, name, value);
8377        }
8378
8379      }
8380
8381      @Override
8382      public Base setProperty(String name, Base value) throws FHIRException {
8383        if (name.equals("type")) {
8384          this.type = TypeConvertor.castToCoding(value); // Coding
8385        } else if (name.equals("party")) {
8386          this.party = TypeConvertor.castToReference(value); // Reference
8387        } else if (name.equals("signature")) {
8388          this.getSignature().add(TypeConvertor.castToSignature(value));
8389        } else
8390          return super.setProperty(name, value);
8391        return value;
8392      }
8393
8394      @Override
8395      public Base makeProperty(int hash, String name) throws FHIRException {
8396        switch (hash) {
8397        case 3575610:  return getType();
8398        case 106437350:  return getParty();
8399        case 1073584312:  return addSignature(); 
8400        default: return super.makeProperty(hash, name);
8401        }
8402
8403      }
8404
8405      @Override
8406      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8407        switch (hash) {
8408        case 3575610: /*type*/ return new String[] {"Coding"};
8409        case 106437350: /*party*/ return new String[] {"Reference"};
8410        case 1073584312: /*signature*/ return new String[] {"Signature"};
8411        default: return super.getTypesForProperty(hash, name);
8412        }
8413
8414      }
8415
8416      @Override
8417      public Base addChild(String name) throws FHIRException {
8418        if (name.equals("type")) {
8419          this.type = new Coding();
8420          return this.type;
8421        }
8422        else if (name.equals("party")) {
8423          this.party = new Reference();
8424          return this.party;
8425        }
8426        else if (name.equals("signature")) {
8427          return addSignature();
8428        }
8429        else
8430          return super.addChild(name);
8431      }
8432
8433      public SignatoryComponent copy() {
8434        SignatoryComponent dst = new SignatoryComponent();
8435        copyValues(dst);
8436        return dst;
8437      }
8438
8439      public void copyValues(SignatoryComponent dst) {
8440        super.copyValues(dst);
8441        dst.type = type == null ? null : type.copy();
8442        dst.party = party == null ? null : party.copy();
8443        if (signature != null) {
8444          dst.signature = new ArrayList<Signature>();
8445          for (Signature i : signature)
8446            dst.signature.add(i.copy());
8447        };
8448      }
8449
8450      @Override
8451      public boolean equalsDeep(Base other_) {
8452        if (!super.equalsDeep(other_))
8453          return false;
8454        if (!(other_ instanceof SignatoryComponent))
8455          return false;
8456        SignatoryComponent o = (SignatoryComponent) other_;
8457        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
8458          ;
8459      }
8460
8461      @Override
8462      public boolean equalsShallow(Base other_) {
8463        if (!super.equalsShallow(other_))
8464          return false;
8465        if (!(other_ instanceof SignatoryComponent))
8466          return false;
8467        SignatoryComponent o = (SignatoryComponent) other_;
8468        return true;
8469      }
8470
8471      public boolean isEmpty() {
8472        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
8473      }
8474
8475  public String fhirType() {
8476    return "Contract.signer";
8477
8478  }
8479
8480  }
8481
8482    @Block()
8483    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8484        /**
8485         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
8486         */
8487        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8488        @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." )
8489        protected DataType content;
8490
8491        private static final long serialVersionUID = -1954179063L;
8492
8493    /**
8494     * Constructor
8495     */
8496      public FriendlyLanguageComponent() {
8497        super();
8498      }
8499
8500    /**
8501     * Constructor
8502     */
8503      public FriendlyLanguageComponent(DataType content) {
8504        super();
8505        this.setContent(content);
8506      }
8507
8508        /**
8509         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8510         */
8511        public DataType getContent() { 
8512          return this.content;
8513        }
8514
8515        /**
8516         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8517         */
8518        public Attachment getContentAttachment() throws FHIRException { 
8519          if (this.content == null)
8520            this.content = new Attachment();
8521          if (!(this.content instanceof Attachment))
8522            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8523          return (Attachment) this.content;
8524        }
8525
8526        public boolean hasContentAttachment() { 
8527          return this != null && this.content instanceof Attachment;
8528        }
8529
8530        /**
8531         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8532         */
8533        public Reference getContentReference() throws FHIRException { 
8534          if (this.content == null)
8535            this.content = new Reference();
8536          if (!(this.content instanceof Reference))
8537            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8538          return (Reference) this.content;
8539        }
8540
8541        public boolean hasContentReference() { 
8542          return this != null && this.content instanceof Reference;
8543        }
8544
8545        public boolean hasContent() { 
8546          return this.content != null && !this.content.isEmpty();
8547        }
8548
8549        /**
8550         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8551         */
8552        public FriendlyLanguageComponent setContent(DataType value) { 
8553          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8554            throw new Error("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
8555          this.content = value;
8556          return this;
8557        }
8558
8559        protected void listChildren(List<Property> children) {
8560          super.listChildren(children);
8561          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));
8562        }
8563
8564        @Override
8565        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8566          switch (_hash) {
8567          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);
8568          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);
8569          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);
8570          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);
8571          default: return super.getNamedProperty(_hash, _name, _checkValid);
8572          }
8573
8574        }
8575
8576      @Override
8577      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8578        switch (hash) {
8579        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // DataType
8580        default: return super.getProperty(hash, name, checkValid);
8581        }
8582
8583      }
8584
8585      @Override
8586      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8587        switch (hash) {
8588        case 951530617: // content
8589          this.content = TypeConvertor.castToType(value); // DataType
8590          return value;
8591        default: return super.setProperty(hash, name, value);
8592        }
8593
8594      }
8595
8596      @Override
8597      public Base setProperty(String name, Base value) throws FHIRException {
8598        if (name.equals("content[x]")) {
8599          this.content = TypeConvertor.castToType(value); // DataType
8600        } else
8601          return super.setProperty(name, value);
8602        return value;
8603      }
8604
8605      @Override
8606      public Base makeProperty(int hash, String name) throws FHIRException {
8607        switch (hash) {
8608        case 264548711:  return getContent();
8609        case 951530617:  return getContent();
8610        default: return super.makeProperty(hash, name);
8611        }
8612
8613      }
8614
8615      @Override
8616      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8617        switch (hash) {
8618        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8619        default: return super.getTypesForProperty(hash, name);
8620        }
8621
8622      }
8623
8624      @Override
8625      public Base addChild(String name) throws FHIRException {
8626        if (name.equals("contentAttachment")) {
8627          this.content = new Attachment();
8628          return this.content;
8629        }
8630        else if (name.equals("contentReference")) {
8631          this.content = new Reference();
8632          return this.content;
8633        }
8634        else
8635          return super.addChild(name);
8636      }
8637
8638      public FriendlyLanguageComponent copy() {
8639        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
8640        copyValues(dst);
8641        return dst;
8642      }
8643
8644      public void copyValues(FriendlyLanguageComponent dst) {
8645        super.copyValues(dst);
8646        dst.content = content == null ? null : content.copy();
8647      }
8648
8649      @Override
8650      public boolean equalsDeep(Base other_) {
8651        if (!super.equalsDeep(other_))
8652          return false;
8653        if (!(other_ instanceof FriendlyLanguageComponent))
8654          return false;
8655        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8656        return compareDeep(content, o.content, true);
8657      }
8658
8659      @Override
8660      public boolean equalsShallow(Base other_) {
8661        if (!super.equalsShallow(other_))
8662          return false;
8663        if (!(other_ instanceof FriendlyLanguageComponent))
8664          return false;
8665        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8666        return true;
8667      }
8668
8669      public boolean isEmpty() {
8670        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
8671      }
8672
8673  public String fhirType() {
8674    return "Contract.friendly";
8675
8676  }
8677
8678  }
8679
8680    @Block()
8681    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8682        /**
8683         * Contract legal text in human renderable form.
8684         */
8685        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8686        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
8687        protected DataType content;
8688
8689        private static final long serialVersionUID = -1954179063L;
8690
8691    /**
8692     * Constructor
8693     */
8694      public LegalLanguageComponent() {
8695        super();
8696      }
8697
8698    /**
8699     * Constructor
8700     */
8701      public LegalLanguageComponent(DataType content) {
8702        super();
8703        this.setContent(content);
8704      }
8705
8706        /**
8707         * @return {@link #content} (Contract legal text in human renderable form.)
8708         */
8709        public DataType getContent() { 
8710          return this.content;
8711        }
8712
8713        /**
8714         * @return {@link #content} (Contract legal text in human renderable form.)
8715         */
8716        public Attachment getContentAttachment() throws FHIRException { 
8717          if (this.content == null)
8718            this.content = new Attachment();
8719          if (!(this.content instanceof Attachment))
8720            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8721          return (Attachment) this.content;
8722        }
8723
8724        public boolean hasContentAttachment() { 
8725          return this != null && this.content instanceof Attachment;
8726        }
8727
8728        /**
8729         * @return {@link #content} (Contract legal text in human renderable form.)
8730         */
8731        public Reference getContentReference() throws FHIRException { 
8732          if (this.content == null)
8733            this.content = new Reference();
8734          if (!(this.content instanceof Reference))
8735            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8736          return (Reference) this.content;
8737        }
8738
8739        public boolean hasContentReference() { 
8740          return this != null && this.content instanceof Reference;
8741        }
8742
8743        public boolean hasContent() { 
8744          return this.content != null && !this.content.isEmpty();
8745        }
8746
8747        /**
8748         * @param value {@link #content} (Contract legal text in human renderable form.)
8749         */
8750        public LegalLanguageComponent setContent(DataType value) { 
8751          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8752            throw new Error("Not the right type for Contract.legal.content[x]: "+value.fhirType());
8753          this.content = value;
8754          return this;
8755        }
8756
8757        protected void listChildren(List<Property> children) {
8758          super.listChildren(children);
8759          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
8760        }
8761
8762        @Override
8763        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8764          switch (_hash) {
8765          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8766          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8767          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment", "Contract legal text in human renderable form.", 0, 1, content);
8768          case 1193747154: /*contentReference*/  return new Property("content[x]", "Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8769          default: return super.getNamedProperty(_hash, _name, _checkValid);
8770          }
8771
8772        }
8773
8774      @Override
8775      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8776        switch (hash) {
8777        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // DataType
8778        default: return super.getProperty(hash, name, checkValid);
8779        }
8780
8781      }
8782
8783      @Override
8784      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8785        switch (hash) {
8786        case 951530617: // content
8787          this.content = TypeConvertor.castToType(value); // DataType
8788          return value;
8789        default: return super.setProperty(hash, name, value);
8790        }
8791
8792      }
8793
8794      @Override
8795      public Base setProperty(String name, Base value) throws FHIRException {
8796        if (name.equals("content[x]")) {
8797          this.content = TypeConvertor.castToType(value); // DataType
8798        } else
8799          return super.setProperty(name, value);
8800        return value;
8801      }
8802
8803      @Override
8804      public Base makeProperty(int hash, String name) throws FHIRException {
8805        switch (hash) {
8806        case 264548711:  return getContent();
8807        case 951530617:  return getContent();
8808        default: return super.makeProperty(hash, name);
8809        }
8810
8811      }
8812
8813      @Override
8814      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8815        switch (hash) {
8816        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8817        default: return super.getTypesForProperty(hash, name);
8818        }
8819
8820      }
8821
8822      @Override
8823      public Base addChild(String name) throws FHIRException {
8824        if (name.equals("contentAttachment")) {
8825          this.content = new Attachment();
8826          return this.content;
8827        }
8828        else if (name.equals("contentReference")) {
8829          this.content = new Reference();
8830          return this.content;
8831        }
8832        else
8833          return super.addChild(name);
8834      }
8835
8836      public LegalLanguageComponent copy() {
8837        LegalLanguageComponent dst = new LegalLanguageComponent();
8838        copyValues(dst);
8839        return dst;
8840      }
8841
8842      public void copyValues(LegalLanguageComponent dst) {
8843        super.copyValues(dst);
8844        dst.content = content == null ? null : content.copy();
8845      }
8846
8847      @Override
8848      public boolean equalsDeep(Base other_) {
8849        if (!super.equalsDeep(other_))
8850          return false;
8851        if (!(other_ instanceof LegalLanguageComponent))
8852          return false;
8853        LegalLanguageComponent o = (LegalLanguageComponent) other_;
8854        return compareDeep(content, o.content, true);
8855      }
8856
8857      @Override
8858      public boolean equalsShallow(Base other_) {
8859        if (!super.equalsShallow(other_))
8860          return false;
8861        if (!(other_ instanceof LegalLanguageComponent))
8862          return false;
8863        LegalLanguageComponent o = (LegalLanguageComponent) other_;
8864        return true;
8865      }
8866
8867      public boolean isEmpty() {
8868        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
8869      }
8870
8871  public String fhirType() {
8872    return "Contract.legal";
8873
8874  }
8875
8876  }
8877
8878    @Block()
8879    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8880        /**
8881         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
8882         */
8883        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
8884        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
8885        protected DataType content;
8886
8887        private static final long serialVersionUID = -1954179063L;
8888
8889    /**
8890     * Constructor
8891     */
8892      public ComputableLanguageComponent() {
8893        super();
8894      }
8895
8896    /**
8897     * Constructor
8898     */
8899      public ComputableLanguageComponent(DataType content) {
8900        super();
8901        this.setContent(content);
8902      }
8903
8904        /**
8905         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8906         */
8907        public DataType getContent() { 
8908          return this.content;
8909        }
8910
8911        /**
8912         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8913         */
8914        public Attachment getContentAttachment() throws FHIRException { 
8915          if (this.content == null)
8916            this.content = new Attachment();
8917          if (!(this.content instanceof Attachment))
8918            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8919          return (Attachment) this.content;
8920        }
8921
8922        public boolean hasContentAttachment() { 
8923          return this != null && this.content instanceof Attachment;
8924        }
8925
8926        /**
8927         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8928         */
8929        public Reference getContentReference() throws FHIRException { 
8930          if (this.content == null)
8931            this.content = new Reference();
8932          if (!(this.content instanceof Reference))
8933            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8934          return (Reference) this.content;
8935        }
8936
8937        public boolean hasContentReference() { 
8938          return this != null && this.content instanceof Reference;
8939        }
8940
8941        public boolean hasContent() { 
8942          return this.content != null && !this.content.isEmpty();
8943        }
8944
8945        /**
8946         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
8947         */
8948        public ComputableLanguageComponent setContent(DataType value) { 
8949          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8950            throw new Error("Not the right type for Contract.rule.content[x]: "+value.fhirType());
8951          this.content = value;
8952          return this;
8953        }
8954
8955        protected void listChildren(List<Property> children) {
8956          super.listChildren(children);
8957          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));
8958        }
8959
8960        @Override
8961        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8962          switch (_hash) {
8963          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);
8964          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);
8965          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);
8966          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);
8967          default: return super.getNamedProperty(_hash, _name, _checkValid);
8968          }
8969
8970        }
8971
8972      @Override
8973      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8974        switch (hash) {
8975        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // DataType
8976        default: return super.getProperty(hash, name, checkValid);
8977        }
8978
8979      }
8980
8981      @Override
8982      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8983        switch (hash) {
8984        case 951530617: // content
8985          this.content = TypeConvertor.castToType(value); // DataType
8986          return value;
8987        default: return super.setProperty(hash, name, value);
8988        }
8989
8990      }
8991
8992      @Override
8993      public Base setProperty(String name, Base value) throws FHIRException {
8994        if (name.equals("content[x]")) {
8995          this.content = TypeConvertor.castToType(value); // DataType
8996        } else
8997          return super.setProperty(name, value);
8998        return value;
8999      }
9000
9001      @Override
9002      public Base makeProperty(int hash, String name) throws FHIRException {
9003        switch (hash) {
9004        case 264548711:  return getContent();
9005        case 951530617:  return getContent();
9006        default: return super.makeProperty(hash, name);
9007        }
9008
9009      }
9010
9011      @Override
9012      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9013        switch (hash) {
9014        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
9015        default: return super.getTypesForProperty(hash, name);
9016        }
9017
9018      }
9019
9020      @Override
9021      public Base addChild(String name) throws FHIRException {
9022        if (name.equals("contentAttachment")) {
9023          this.content = new Attachment();
9024          return this.content;
9025        }
9026        else if (name.equals("contentReference")) {
9027          this.content = new Reference();
9028          return this.content;
9029        }
9030        else
9031          return super.addChild(name);
9032      }
9033
9034      public ComputableLanguageComponent copy() {
9035        ComputableLanguageComponent dst = new ComputableLanguageComponent();
9036        copyValues(dst);
9037        return dst;
9038      }
9039
9040      public void copyValues(ComputableLanguageComponent dst) {
9041        super.copyValues(dst);
9042        dst.content = content == null ? null : content.copy();
9043      }
9044
9045      @Override
9046      public boolean equalsDeep(Base other_) {
9047        if (!super.equalsDeep(other_))
9048          return false;
9049        if (!(other_ instanceof ComputableLanguageComponent))
9050          return false;
9051        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9052        return compareDeep(content, o.content, true);
9053      }
9054
9055      @Override
9056      public boolean equalsShallow(Base other_) {
9057        if (!super.equalsShallow(other_))
9058          return false;
9059        if (!(other_ instanceof ComputableLanguageComponent))
9060          return false;
9061        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9062        return true;
9063      }
9064
9065      public boolean isEmpty() {
9066        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9067      }
9068
9069  public String fhirType() {
9070    return "Contract.rule";
9071
9072  }
9073
9074  }
9075
9076    /**
9077     * Unique identifier for this Contract or a derivative that references a Source Contract.
9078     */
9079    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9080    @Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract or a derivative that references a Source Contract." )
9081    protected List<Identifier> identifier;
9082
9083    /**
9084     * Canonical identifier for this contract, represented as a URI (globally unique).
9085     */
9086    @Child(name = "url", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
9087    @Description(shortDefinition="Basal definition", formalDefinition="Canonical identifier for this contract, represented as a URI (globally unique)." )
9088    protected UriType url;
9089
9090    /**
9091     * An edition identifier used for business purposes to label business significant variants.
9092     */
9093    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
9094    @Description(shortDefinition="Business edition", formalDefinition="An edition identifier used for business purposes to label business significant variants." )
9095    protected StringType version;
9096
9097    /**
9098     * The status of the resource instance.
9099     */
9100    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
9101    @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +", formalDefinition="The status of the resource instance." )
9102    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-status")
9103    protected Enumeration<ContractResourceStatusCodes> status;
9104
9105    /**
9106     * Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.
9107     */
9108    @Child(name = "legalState", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
9109    @Description(shortDefinition="Negotiation status", formalDefinition="Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement." )
9110    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-legalstate")
9111    protected CodeableConcept legalState;
9112
9113    /**
9114     * The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.
9115     */
9116    @Child(name = "instantiatesCanonical", type = {Contract.class}, order=5, min=0, max=1, modifier=false, summary=false)
9117    @Description(shortDefinition="Source Contract Definition", formalDefinition="The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract." )
9118    protected Reference instantiatesCanonical;
9119
9120    /**
9121     * The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9122     */
9123    @Child(name = "instantiatesUri", type = {UriType.class}, order=6, min=0, max=1, modifier=false, summary=false)
9124    @Description(shortDefinition="External Contract Definition", formalDefinition="The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract." )
9125    protected UriType instantiatesUri;
9126
9127    /**
9128     * The minimal content derived from the basal information source at a specific stage in its lifecycle.
9129     */
9130    @Child(name = "contentDerivative", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9131    @Description(shortDefinition="Content derived from the basal information", formalDefinition="The minimal content derived from the basal information source at a specific stage in its lifecycle." )
9132    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-content-derivative")
9133    protected CodeableConcept contentDerivative;
9134
9135    /**
9136     * When this  Contract was issued.
9137     */
9138    @Child(name = "issued", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
9139    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
9140    protected DateTimeType issued;
9141
9142    /**
9143     * Relevant time or time-period when this Contract is applicable.
9144     */
9145    @Child(name = "applies", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
9146    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
9147    protected Period applies;
9148
9149    /**
9150     * Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.
9151     */
9152    @Child(name = "expirationType", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false)
9153    @Description(shortDefinition="Contract cessation cause", formalDefinition="Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract." )
9154    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-expiration-type")
9155    protected CodeableConcept expirationType;
9156
9157    /**
9158     * The target entity impacted by or of interest to parties to the agreement.
9159     */
9160    @Child(name = "subject", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9161    @Description(shortDefinition="Contract Target Entity", formalDefinition="The target entity impacted by or of interest to parties to the agreement." )
9162    protected List<Reference> subject;
9163
9164    /**
9165     * A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.
9166     */
9167    @Child(name = "authority", type = {Organization.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9168    @Description(shortDefinition="Authority under which this Contract has standing", formalDefinition="A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies." )
9169    protected List<Reference> authority;
9170
9171    /**
9172     * Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.
9173     */
9174    @Child(name = "domain", type = {Location.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9175    @Description(shortDefinition="A sphere of control governed by an authoritative jurisdiction, organization, or person", formalDefinition="Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources." )
9176    protected List<Reference> domain;
9177
9178    /**
9179     * Sites in which the contract is complied with,  exercised, or in force.
9180     */
9181    @Child(name = "site", type = {Location.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9182    @Description(shortDefinition="Specific Location", formalDefinition="Sites in which the contract is complied with,  exercised, or in force." )
9183    protected List<Reference> site;
9184
9185    /**
9186     * A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
9187     */
9188    @Child(name = "name", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
9189    @Description(shortDefinition="Computer friendly designation", formalDefinition="A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
9190    protected StringType name;
9191
9192    /**
9193     * A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
9194     */
9195    @Child(name = "title", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=true)
9196    @Description(shortDefinition="Human Friendly name", formalDefinition="A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content." )
9197    protected StringType title;
9198
9199    /**
9200     * An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
9201     */
9202    @Child(name = "subtitle", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
9203    @Description(shortDefinition="Subordinate Friendly name", formalDefinition="An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content." )
9204    protected StringType subtitle;
9205
9206    /**
9207     * Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.
9208     */
9209    @Child(name = "alias", type = {StringType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9210    @Description(shortDefinition="Acronym or short name", formalDefinition="Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation." )
9211    protected List<StringType> alias;
9212
9213    /**
9214     * The individual or organization that authored the Contract definition, derivative, or instance in any legal state.
9215     */
9216    @Child(name = "author", type = {Patient.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
9217    @Description(shortDefinition="Source of Contract", formalDefinition="The individual or organization that authored the Contract definition, derivative, or instance in any legal state." )
9218    protected Reference author;
9219
9220    /**
9221     * A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.
9222     */
9223    @Child(name = "scope", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
9224    @Description(shortDefinition="Range of Legal Concerns", formalDefinition="A selector of legal concerns for this Contract definition, derivative, or instance in any legal state." )
9225    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-scope")
9226    protected CodeableConcept scope;
9227
9228    /**
9229     * Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.
9230     */
9231    @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=21, min=0, max=1, modifier=false, summary=false)
9232    @Description(shortDefinition="Focus of contract interest", formalDefinition="Narrows the range of legal concerns to focus on the achievement of specific contractual objectives." )
9233    protected DataType topic;
9234
9235    /**
9236     * A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.
9237     */
9238    @Child(name = "type", type = {CodeableConcept.class}, order=22, min=0, max=1, modifier=false, summary=true)
9239    @Description(shortDefinition="Legal instrument category", formalDefinition="A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract." )
9240    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-type")
9241    protected CodeableConcept type;
9242
9243    /**
9244     * Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.
9245     */
9246    @Child(name = "subType", type = {CodeableConcept.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9247    @Description(shortDefinition="Subtype within the context of type", formalDefinition="Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope." )
9248    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-subtype")
9249    protected List<CodeableConcept> subType;
9250
9251    /**
9252     * Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.
9253     */
9254    @Child(name = "contentDefinition", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
9255    @Description(shortDefinition="Contract precursor content", formalDefinition="Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract." )
9256    protected ContentDefinitionComponent contentDefinition;
9257
9258    /**
9259     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
9260     */
9261    @Child(name = "term", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9262    @Description(shortDefinition="Contract Term List", formalDefinition="One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups." )
9263    protected List<TermComponent> term;
9264
9265    /**
9266     * Information that may be needed by/relevant to the performer in their execution of this term action.
9267     */
9268    @Child(name = "supportingInfo", type = {Reference.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9269    @Description(shortDefinition="Extra Information", formalDefinition="Information that may be needed by/relevant to the performer in their execution of this term action." )
9270    protected List<Reference> supportingInfo;
9271
9272    /**
9273     * Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.
9274     */
9275    @Child(name = "relevantHistory", type = {Provenance.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9276    @Description(shortDefinition="Key event in Contract History", formalDefinition="Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity." )
9277    protected List<Reference> relevantHistory;
9278
9279    /**
9280     * Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.
9281     */
9282    @Child(name = "signer", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9283    @Description(shortDefinition="Contract Signatory", formalDefinition="Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness." )
9284    protected List<SignatoryComponent> signer;
9285
9286    /**
9287     * The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.
9288     */
9289    @Child(name = "friendly", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9290    @Description(shortDefinition="Contract Friendly Language", formalDefinition="The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement." )
9291    protected List<FriendlyLanguageComponent> friendly;
9292
9293    /**
9294     * List of Legal expressions or representations of this Contract.
9295     */
9296    @Child(name = "legal", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9297    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
9298    protected List<LegalLanguageComponent> legal;
9299
9300    /**
9301     * List of Computable Policy Rule Language Representations of this Contract.
9302     */
9303    @Child(name = "rule", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9304    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
9305    protected List<ComputableLanguageComponent> rule;
9306
9307    /**
9308     * Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.
9309     */
9310    @Child(name = "legallyBinding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class, Contract.class}, order=32, min=0, max=1, modifier=false, summary=false)
9311    @Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract." )
9312    protected DataType legallyBinding;
9313
9314    private static final long serialVersionUID = -792431459L;
9315
9316  /**
9317   * Constructor
9318   */
9319    public Contract() {
9320      super();
9321    }
9322
9323    /**
9324     * @return {@link #identifier} (Unique identifier for this Contract or a derivative that references a Source Contract.)
9325     */
9326    public List<Identifier> getIdentifier() { 
9327      if (this.identifier == null)
9328        this.identifier = new ArrayList<Identifier>();
9329      return this.identifier;
9330    }
9331
9332    /**
9333     * @return Returns a reference to <code>this</code> for easy method chaining
9334     */
9335    public Contract setIdentifier(List<Identifier> theIdentifier) { 
9336      this.identifier = theIdentifier;
9337      return this;
9338    }
9339
9340    public boolean hasIdentifier() { 
9341      if (this.identifier == null)
9342        return false;
9343      for (Identifier item : this.identifier)
9344        if (!item.isEmpty())
9345          return true;
9346      return false;
9347    }
9348
9349    public Identifier addIdentifier() { //3
9350      Identifier t = new Identifier();
9351      if (this.identifier == null)
9352        this.identifier = new ArrayList<Identifier>();
9353      this.identifier.add(t);
9354      return t;
9355    }
9356
9357    public Contract addIdentifier(Identifier t) { //3
9358      if (t == null)
9359        return this;
9360      if (this.identifier == null)
9361        this.identifier = new ArrayList<Identifier>();
9362      this.identifier.add(t);
9363      return this;
9364    }
9365
9366    /**
9367     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
9368     */
9369    public Identifier getIdentifierFirstRep() { 
9370      if (getIdentifier().isEmpty()) {
9371        addIdentifier();
9372      }
9373      return getIdentifier().get(0);
9374    }
9375
9376    /**
9377     * @return {@link #url} (Canonical identifier for this contract, represented as a URI (globally unique).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
9378     */
9379    public UriType getUrlElement() { 
9380      if (this.url == null)
9381        if (Configuration.errorOnAutoCreate())
9382          throw new Error("Attempt to auto-create Contract.url");
9383        else if (Configuration.doAutoCreate())
9384          this.url = new UriType(); // bb
9385      return this.url;
9386    }
9387
9388    public boolean hasUrlElement() { 
9389      return this.url != null && !this.url.isEmpty();
9390    }
9391
9392    public boolean hasUrl() { 
9393      return this.url != null && !this.url.isEmpty();
9394    }
9395
9396    /**
9397     * @param value {@link #url} (Canonical identifier for this contract, represented as a URI (globally unique).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
9398     */
9399    public Contract setUrlElement(UriType value) { 
9400      this.url = value;
9401      return this;
9402    }
9403
9404    /**
9405     * @return Canonical identifier for this contract, represented as a URI (globally unique).
9406     */
9407    public String getUrl() { 
9408      return this.url == null ? null : this.url.getValue();
9409    }
9410
9411    /**
9412     * @param value Canonical identifier for this contract, represented as a URI (globally unique).
9413     */
9414    public Contract setUrl(String value) { 
9415      if (Utilities.noString(value))
9416        this.url = null;
9417      else {
9418        if (this.url == null)
9419          this.url = new UriType();
9420        this.url.setValue(value);
9421      }
9422      return this;
9423    }
9424
9425    /**
9426     * @return {@link #version} (An edition identifier used for business purposes to label business significant variants.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
9427     */
9428    public StringType getVersionElement() { 
9429      if (this.version == null)
9430        if (Configuration.errorOnAutoCreate())
9431          throw new Error("Attempt to auto-create Contract.version");
9432        else if (Configuration.doAutoCreate())
9433          this.version = new StringType(); // bb
9434      return this.version;
9435    }
9436
9437    public boolean hasVersionElement() { 
9438      return this.version != null && !this.version.isEmpty();
9439    }
9440
9441    public boolean hasVersion() { 
9442      return this.version != null && !this.version.isEmpty();
9443    }
9444
9445    /**
9446     * @param value {@link #version} (An edition identifier used for business purposes to label business significant variants.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
9447     */
9448    public Contract setVersionElement(StringType value) { 
9449      this.version = value;
9450      return this;
9451    }
9452
9453    /**
9454     * @return An edition identifier used for business purposes to label business significant variants.
9455     */
9456    public String getVersion() { 
9457      return this.version == null ? null : this.version.getValue();
9458    }
9459
9460    /**
9461     * @param value An edition identifier used for business purposes to label business significant variants.
9462     */
9463    public Contract setVersion(String value) { 
9464      if (Utilities.noString(value))
9465        this.version = null;
9466      else {
9467        if (this.version == null)
9468          this.version = new StringType();
9469        this.version.setValue(value);
9470      }
9471      return this;
9472    }
9473
9474    /**
9475     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
9476     */
9477    public Enumeration<ContractResourceStatusCodes> getStatusElement() { 
9478      if (this.status == null)
9479        if (Configuration.errorOnAutoCreate())
9480          throw new Error("Attempt to auto-create Contract.status");
9481        else if (Configuration.doAutoCreate())
9482          this.status = new Enumeration<ContractResourceStatusCodes>(new ContractResourceStatusCodesEnumFactory()); // bb
9483      return this.status;
9484    }
9485
9486    public boolean hasStatusElement() { 
9487      return this.status != null && !this.status.isEmpty();
9488    }
9489
9490    public boolean hasStatus() { 
9491      return this.status != null && !this.status.isEmpty();
9492    }
9493
9494    /**
9495     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
9496     */
9497    public Contract setStatusElement(Enumeration<ContractResourceStatusCodes> value) { 
9498      this.status = value;
9499      return this;
9500    }
9501
9502    /**
9503     * @return The status of the resource instance.
9504     */
9505    public ContractResourceStatusCodes getStatus() { 
9506      return this.status == null ? null : this.status.getValue();
9507    }
9508
9509    /**
9510     * @param value The status of the resource instance.
9511     */
9512    public Contract setStatus(ContractResourceStatusCodes value) { 
9513      if (value == null)
9514        this.status = null;
9515      else {
9516        if (this.status == null)
9517          this.status = new Enumeration<ContractResourceStatusCodes>(new ContractResourceStatusCodesEnumFactory());
9518        this.status.setValue(value);
9519      }
9520      return this;
9521    }
9522
9523    /**
9524     * @return {@link #legalState} (Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.)
9525     */
9526    public CodeableConcept getLegalState() { 
9527      if (this.legalState == null)
9528        if (Configuration.errorOnAutoCreate())
9529          throw new Error("Attempt to auto-create Contract.legalState");
9530        else if (Configuration.doAutoCreate())
9531          this.legalState = new CodeableConcept(); // cc
9532      return this.legalState;
9533    }
9534
9535    public boolean hasLegalState() { 
9536      return this.legalState != null && !this.legalState.isEmpty();
9537    }
9538
9539    /**
9540     * @param value {@link #legalState} (Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.)
9541     */
9542    public Contract setLegalState(CodeableConcept value) { 
9543      this.legalState = value;
9544      return this;
9545    }
9546
9547    /**
9548     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9549     */
9550    public Reference getInstantiatesCanonical() { 
9551      if (this.instantiatesCanonical == null)
9552        if (Configuration.errorOnAutoCreate())
9553          throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
9554        else if (Configuration.doAutoCreate())
9555          this.instantiatesCanonical = new Reference(); // cc
9556      return this.instantiatesCanonical;
9557    }
9558
9559    public boolean hasInstantiatesCanonical() { 
9560      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
9561    }
9562
9563    /**
9564     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9565     */
9566    public Contract setInstantiatesCanonical(Reference value) { 
9567      this.instantiatesCanonical = value;
9568      return this;
9569    }
9570
9571    /**
9572     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
9573     */
9574    public UriType getInstantiatesUriElement() { 
9575      if (this.instantiatesUri == null)
9576        if (Configuration.errorOnAutoCreate())
9577          throw new Error("Attempt to auto-create Contract.instantiatesUri");
9578        else if (Configuration.doAutoCreate())
9579          this.instantiatesUri = new UriType(); // bb
9580      return this.instantiatesUri;
9581    }
9582
9583    public boolean hasInstantiatesUriElement() { 
9584      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
9585    }
9586
9587    public boolean hasInstantiatesUri() { 
9588      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
9589    }
9590
9591    /**
9592     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
9593     */
9594    public Contract setInstantiatesUriElement(UriType value) { 
9595      this.instantiatesUri = value;
9596      return this;
9597    }
9598
9599    /**
9600     * @return The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9601     */
9602    public String getInstantiatesUri() { 
9603      return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
9604    }
9605
9606    /**
9607     * @param value The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9608     */
9609    public Contract setInstantiatesUri(String value) { 
9610      if (Utilities.noString(value))
9611        this.instantiatesUri = null;
9612      else {
9613        if (this.instantiatesUri == null)
9614          this.instantiatesUri = new UriType();
9615        this.instantiatesUri.setValue(value);
9616      }
9617      return this;
9618    }
9619
9620    /**
9621     * @return {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
9622     */
9623    public CodeableConcept getContentDerivative() { 
9624      if (this.contentDerivative == null)
9625        if (Configuration.errorOnAutoCreate())
9626          throw new Error("Attempt to auto-create Contract.contentDerivative");
9627        else if (Configuration.doAutoCreate())
9628          this.contentDerivative = new CodeableConcept(); // cc
9629      return this.contentDerivative;
9630    }
9631
9632    public boolean hasContentDerivative() { 
9633      return this.contentDerivative != null && !this.contentDerivative.isEmpty();
9634    }
9635
9636    /**
9637     * @param value {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
9638     */
9639    public Contract setContentDerivative(CodeableConcept value) { 
9640      this.contentDerivative = value;
9641      return this;
9642    }
9643
9644    /**
9645     * @return {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
9646     */
9647    public DateTimeType getIssuedElement() { 
9648      if (this.issued == null)
9649        if (Configuration.errorOnAutoCreate())
9650          throw new Error("Attempt to auto-create Contract.issued");
9651        else if (Configuration.doAutoCreate())
9652          this.issued = new DateTimeType(); // bb
9653      return this.issued;
9654    }
9655
9656    public boolean hasIssuedElement() { 
9657      return this.issued != null && !this.issued.isEmpty();
9658    }
9659
9660    public boolean hasIssued() { 
9661      return this.issued != null && !this.issued.isEmpty();
9662    }
9663
9664    /**
9665     * @param value {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
9666     */
9667    public Contract setIssuedElement(DateTimeType value) { 
9668      this.issued = value;
9669      return this;
9670    }
9671
9672    /**
9673     * @return When this  Contract was issued.
9674     */
9675    public Date getIssued() { 
9676      return this.issued == null ? null : this.issued.getValue();
9677    }
9678
9679    /**
9680     * @param value When this  Contract was issued.
9681     */
9682    public Contract setIssued(Date value) { 
9683      if (value == null)
9684        this.issued = null;
9685      else {
9686        if (this.issued == null)
9687          this.issued = new DateTimeType();
9688        this.issued.setValue(value);
9689      }
9690      return this;
9691    }
9692
9693    /**
9694     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
9695     */
9696    public Period getApplies() { 
9697      if (this.applies == null)
9698        if (Configuration.errorOnAutoCreate())
9699          throw new Error("Attempt to auto-create Contract.applies");
9700        else if (Configuration.doAutoCreate())
9701          this.applies = new Period(); // cc
9702      return this.applies;
9703    }
9704
9705    public boolean hasApplies() { 
9706      return this.applies != null && !this.applies.isEmpty();
9707    }
9708
9709    /**
9710     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
9711     */
9712    public Contract setApplies(Period value) { 
9713      this.applies = value;
9714      return this;
9715    }
9716
9717    /**
9718     * @return {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
9719     */
9720    public CodeableConcept getExpirationType() { 
9721      if (this.expirationType == null)
9722        if (Configuration.errorOnAutoCreate())
9723          throw new Error("Attempt to auto-create Contract.expirationType");
9724        else if (Configuration.doAutoCreate())
9725          this.expirationType = new CodeableConcept(); // cc
9726      return this.expirationType;
9727    }
9728
9729    public boolean hasExpirationType() { 
9730      return this.expirationType != null && !this.expirationType.isEmpty();
9731    }
9732
9733    /**
9734     * @param value {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
9735     */
9736    public Contract setExpirationType(CodeableConcept value) { 
9737      this.expirationType = value;
9738      return this;
9739    }
9740
9741    /**
9742     * @return {@link #subject} (The target entity impacted by or of interest to parties to the agreement.)
9743     */
9744    public List<Reference> getSubject() { 
9745      if (this.subject == null)
9746        this.subject = new ArrayList<Reference>();
9747      return this.subject;
9748    }
9749
9750    /**
9751     * @return Returns a reference to <code>this</code> for easy method chaining
9752     */
9753    public Contract setSubject(List<Reference> theSubject) { 
9754      this.subject = theSubject;
9755      return this;
9756    }
9757
9758    public boolean hasSubject() { 
9759      if (this.subject == null)
9760        return false;
9761      for (Reference item : this.subject)
9762        if (!item.isEmpty())
9763          return true;
9764      return false;
9765    }
9766
9767    public Reference addSubject() { //3
9768      Reference t = new Reference();
9769      if (this.subject == null)
9770        this.subject = new ArrayList<Reference>();
9771      this.subject.add(t);
9772      return t;
9773    }
9774
9775    public Contract addSubject(Reference t) { //3
9776      if (t == null)
9777        return this;
9778      if (this.subject == null)
9779        this.subject = new ArrayList<Reference>();
9780      this.subject.add(t);
9781      return this;
9782    }
9783
9784    /**
9785     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
9786     */
9787    public Reference getSubjectFirstRep() { 
9788      if (getSubject().isEmpty()) {
9789        addSubject();
9790      }
9791      return getSubject().get(0);
9792    }
9793
9794    /**
9795     * @return {@link #authority} (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
9796     */
9797    public List<Reference> getAuthority() { 
9798      if (this.authority == null)
9799        this.authority = new ArrayList<Reference>();
9800      return this.authority;
9801    }
9802
9803    /**
9804     * @return Returns a reference to <code>this</code> for easy method chaining
9805     */
9806    public Contract setAuthority(List<Reference> theAuthority) { 
9807      this.authority = theAuthority;
9808      return this;
9809    }
9810
9811    public boolean hasAuthority() { 
9812      if (this.authority == null)
9813        return false;
9814      for (Reference item : this.authority)
9815        if (!item.isEmpty())
9816          return true;
9817      return false;
9818    }
9819
9820    public Reference addAuthority() { //3
9821      Reference t = new Reference();
9822      if (this.authority == null)
9823        this.authority = new ArrayList<Reference>();
9824      this.authority.add(t);
9825      return t;
9826    }
9827
9828    public Contract addAuthority(Reference t) { //3
9829      if (t == null)
9830        return this;
9831      if (this.authority == null)
9832        this.authority = new ArrayList<Reference>();
9833      this.authority.add(t);
9834      return this;
9835    }
9836
9837    /**
9838     * @return The first repetition of repeating field {@link #authority}, creating it if it does not already exist {3}
9839     */
9840    public Reference getAuthorityFirstRep() { 
9841      if (getAuthority().isEmpty()) {
9842        addAuthority();
9843      }
9844      return getAuthority().get(0);
9845    }
9846
9847    /**
9848     * @return {@link #domain} (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
9849     */
9850    public List<Reference> getDomain() { 
9851      if (this.domain == null)
9852        this.domain = new ArrayList<Reference>();
9853      return this.domain;
9854    }
9855
9856    /**
9857     * @return Returns a reference to <code>this</code> for easy method chaining
9858     */
9859    public Contract setDomain(List<Reference> theDomain) { 
9860      this.domain = theDomain;
9861      return this;
9862    }
9863
9864    public boolean hasDomain() { 
9865      if (this.domain == null)
9866        return false;
9867      for (Reference item : this.domain)
9868        if (!item.isEmpty())
9869          return true;
9870      return false;
9871    }
9872
9873    public Reference addDomain() { //3
9874      Reference t = new Reference();
9875      if (this.domain == null)
9876        this.domain = new ArrayList<Reference>();
9877      this.domain.add(t);
9878      return t;
9879    }
9880
9881    public Contract addDomain(Reference t) { //3
9882      if (t == null)
9883        return this;
9884      if (this.domain == null)
9885        this.domain = new ArrayList<Reference>();
9886      this.domain.add(t);
9887      return this;
9888    }
9889
9890    /**
9891     * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist {3}
9892     */
9893    public Reference getDomainFirstRep() { 
9894      if (getDomain().isEmpty()) {
9895        addDomain();
9896      }
9897      return getDomain().get(0);
9898    }
9899
9900    /**
9901     * @return {@link #site} (Sites in which the contract is complied with,  exercised, or in force.)
9902     */
9903    public List<Reference> getSite() { 
9904      if (this.site == null)
9905        this.site = new ArrayList<Reference>();
9906      return this.site;
9907    }
9908
9909    /**
9910     * @return Returns a reference to <code>this</code> for easy method chaining
9911     */
9912    public Contract setSite(List<Reference> theSite) { 
9913      this.site = theSite;
9914      return this;
9915    }
9916
9917    public boolean hasSite() { 
9918      if (this.site == null)
9919        return false;
9920      for (Reference item : this.site)
9921        if (!item.isEmpty())
9922          return true;
9923      return false;
9924    }
9925
9926    public Reference addSite() { //3
9927      Reference t = new Reference();
9928      if (this.site == null)
9929        this.site = new ArrayList<Reference>();
9930      this.site.add(t);
9931      return t;
9932    }
9933
9934    public Contract addSite(Reference t) { //3
9935      if (t == null)
9936        return this;
9937      if (this.site == null)
9938        this.site = new ArrayList<Reference>();
9939      this.site.add(t);
9940      return this;
9941    }
9942
9943    /**
9944     * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist {3}
9945     */
9946    public Reference getSiteFirstRep() { 
9947      if (getSite().isEmpty()) {
9948        addSite();
9949      }
9950      return getSite().get(0);
9951    }
9952
9953    /**
9954     * @return {@link #name} (A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
9955     */
9956    public StringType getNameElement() { 
9957      if (this.name == null)
9958        if (Configuration.errorOnAutoCreate())
9959          throw new Error("Attempt to auto-create Contract.name");
9960        else if (Configuration.doAutoCreate())
9961          this.name = new StringType(); // bb
9962      return this.name;
9963    }
9964
9965    public boolean hasNameElement() { 
9966      return this.name != null && !this.name.isEmpty();
9967    }
9968
9969    public boolean hasName() { 
9970      return this.name != null && !this.name.isEmpty();
9971    }
9972
9973    /**
9974     * @param value {@link #name} (A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
9975     */
9976    public Contract setNameElement(StringType value) { 
9977      this.name = value;
9978      return this;
9979    }
9980
9981    /**
9982     * @return A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
9983     */
9984    public String getName() { 
9985      return this.name == null ? null : this.name.getValue();
9986    }
9987
9988    /**
9989     * @param value A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.
9990     */
9991    public Contract setName(String value) { 
9992      if (Utilities.noString(value))
9993        this.name = null;
9994      else {
9995        if (this.name == null)
9996          this.name = new StringType();
9997        this.name.setValue(value);
9998      }
9999      return this;
10000    }
10001
10002    /**
10003     * @return {@link #title} (A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
10004     */
10005    public StringType getTitleElement() { 
10006      if (this.title == null)
10007        if (Configuration.errorOnAutoCreate())
10008          throw new Error("Attempt to auto-create Contract.title");
10009        else if (Configuration.doAutoCreate())
10010          this.title = new StringType(); // bb
10011      return this.title;
10012    }
10013
10014    public boolean hasTitleElement() { 
10015      return this.title != null && !this.title.isEmpty();
10016    }
10017
10018    public boolean hasTitle() { 
10019      return this.title != null && !this.title.isEmpty();
10020    }
10021
10022    /**
10023     * @param value {@link #title} (A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
10024     */
10025    public Contract setTitleElement(StringType value) { 
10026      this.title = value;
10027      return this;
10028    }
10029
10030    /**
10031     * @return A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10032     */
10033    public String getTitle() { 
10034      return this.title == null ? null : this.title.getValue();
10035    }
10036
10037    /**
10038     * @param value A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10039     */
10040    public Contract setTitle(String value) { 
10041      if (Utilities.noString(value))
10042        this.title = null;
10043      else {
10044        if (this.title == null)
10045          this.title = new StringType();
10046        this.title.setValue(value);
10047      }
10048      return this;
10049    }
10050
10051    /**
10052     * @return {@link #subtitle} (An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
10053     */
10054    public StringType getSubtitleElement() { 
10055      if (this.subtitle == null)
10056        if (Configuration.errorOnAutoCreate())
10057          throw new Error("Attempt to auto-create Contract.subtitle");
10058        else if (Configuration.doAutoCreate())
10059          this.subtitle = new StringType(); // bb
10060      return this.subtitle;
10061    }
10062
10063    public boolean hasSubtitleElement() { 
10064      return this.subtitle != null && !this.subtitle.isEmpty();
10065    }
10066
10067    public boolean hasSubtitle() { 
10068      return this.subtitle != null && !this.subtitle.isEmpty();
10069    }
10070
10071    /**
10072     * @param value {@link #subtitle} (An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
10073     */
10074    public Contract setSubtitleElement(StringType value) { 
10075      this.subtitle = value;
10076      return this;
10077    }
10078
10079    /**
10080     * @return An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10081     */
10082    public String getSubtitle() { 
10083      return this.subtitle == null ? null : this.subtitle.getValue();
10084    }
10085
10086    /**
10087     * @param value An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
10088     */
10089    public Contract setSubtitle(String value) { 
10090      if (Utilities.noString(value))
10091        this.subtitle = null;
10092      else {
10093        if (this.subtitle == null)
10094          this.subtitle = new StringType();
10095        this.subtitle.setValue(value);
10096      }
10097      return this;
10098    }
10099
10100    /**
10101     * @return {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10102     */
10103    public List<StringType> getAlias() { 
10104      if (this.alias == null)
10105        this.alias = new ArrayList<StringType>();
10106      return this.alias;
10107    }
10108
10109    /**
10110     * @return Returns a reference to <code>this</code> for easy method chaining
10111     */
10112    public Contract setAlias(List<StringType> theAlias) { 
10113      this.alias = theAlias;
10114      return this;
10115    }
10116
10117    public boolean hasAlias() { 
10118      if (this.alias == null)
10119        return false;
10120      for (StringType item : this.alias)
10121        if (!item.isEmpty())
10122          return true;
10123      return false;
10124    }
10125
10126    /**
10127     * @return {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10128     */
10129    public StringType addAliasElement() {//2 
10130      StringType t = new StringType();
10131      if (this.alias == null)
10132        this.alias = new ArrayList<StringType>();
10133      this.alias.add(t);
10134      return t;
10135    }
10136
10137    /**
10138     * @param value {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10139     */
10140    public Contract addAlias(String value) { //1
10141      StringType t = new StringType();
10142      t.setValue(value);
10143      if (this.alias == null)
10144        this.alias = new ArrayList<StringType>();
10145      this.alias.add(t);
10146      return this;
10147    }
10148
10149    /**
10150     * @param value {@link #alias} (Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.)
10151     */
10152    public boolean hasAlias(String value) { 
10153      if (this.alias == null)
10154        return false;
10155      for (StringType v : this.alias)
10156        if (v.getValue().equals(value)) // string
10157          return true;
10158      return false;
10159    }
10160
10161    /**
10162     * @return {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10163     */
10164    public Reference getAuthor() { 
10165      if (this.author == null)
10166        if (Configuration.errorOnAutoCreate())
10167          throw new Error("Attempt to auto-create Contract.author");
10168        else if (Configuration.doAutoCreate())
10169          this.author = new Reference(); // cc
10170      return this.author;
10171    }
10172
10173    public boolean hasAuthor() { 
10174      return this.author != null && !this.author.isEmpty();
10175    }
10176
10177    /**
10178     * @param value {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10179     */
10180    public Contract setAuthor(Reference value) { 
10181      this.author = value;
10182      return this;
10183    }
10184
10185    /**
10186     * @return {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10187     */
10188    public CodeableConcept getScope() { 
10189      if (this.scope == null)
10190        if (Configuration.errorOnAutoCreate())
10191          throw new Error("Attempt to auto-create Contract.scope");
10192        else if (Configuration.doAutoCreate())
10193          this.scope = new CodeableConcept(); // cc
10194      return this.scope;
10195    }
10196
10197    public boolean hasScope() { 
10198      return this.scope != null && !this.scope.isEmpty();
10199    }
10200
10201    /**
10202     * @param value {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10203     */
10204    public Contract setScope(CodeableConcept value) { 
10205      this.scope = value;
10206      return this;
10207    }
10208
10209    /**
10210     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10211     */
10212    public DataType getTopic() { 
10213      return this.topic;
10214    }
10215
10216    /**
10217     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10218     */
10219    public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
10220      if (this.topic == null)
10221        this.topic = new CodeableConcept();
10222      if (!(this.topic instanceof CodeableConcept))
10223        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
10224      return (CodeableConcept) this.topic;
10225    }
10226
10227    public boolean hasTopicCodeableConcept() { 
10228      return this != null && this.topic instanceof CodeableConcept;
10229    }
10230
10231    /**
10232     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10233     */
10234    public Reference getTopicReference() throws FHIRException { 
10235      if (this.topic == null)
10236        this.topic = new Reference();
10237      if (!(this.topic instanceof Reference))
10238        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
10239      return (Reference) this.topic;
10240    }
10241
10242    public boolean hasTopicReference() { 
10243      return this != null && this.topic instanceof Reference;
10244    }
10245
10246    public boolean hasTopic() { 
10247      return this.topic != null && !this.topic.isEmpty();
10248    }
10249
10250    /**
10251     * @param value {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10252     */
10253    public Contract setTopic(DataType value) { 
10254      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
10255        throw new Error("Not the right type for Contract.topic[x]: "+value.fhirType());
10256      this.topic = value;
10257      return this;
10258    }
10259
10260    /**
10261     * @return {@link #type} (A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.)
10262     */
10263    public CodeableConcept getType() { 
10264      if (this.type == null)
10265        if (Configuration.errorOnAutoCreate())
10266          throw new Error("Attempt to auto-create Contract.type");
10267        else if (Configuration.doAutoCreate())
10268          this.type = new CodeableConcept(); // cc
10269      return this.type;
10270    }
10271
10272    public boolean hasType() { 
10273      return this.type != null && !this.type.isEmpty();
10274    }
10275
10276    /**
10277     * @param value {@link #type} (A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.)
10278     */
10279    public Contract setType(CodeableConcept value) { 
10280      this.type = value;
10281      return this;
10282    }
10283
10284    /**
10285     * @return {@link #subType} (Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.)
10286     */
10287    public List<CodeableConcept> getSubType() { 
10288      if (this.subType == null)
10289        this.subType = new ArrayList<CodeableConcept>();
10290      return this.subType;
10291    }
10292
10293    /**
10294     * @return Returns a reference to <code>this</code> for easy method chaining
10295     */
10296    public Contract setSubType(List<CodeableConcept> theSubType) { 
10297      this.subType = theSubType;
10298      return this;
10299    }
10300
10301    public boolean hasSubType() { 
10302      if (this.subType == null)
10303        return false;
10304      for (CodeableConcept item : this.subType)
10305        if (!item.isEmpty())
10306          return true;
10307      return false;
10308    }
10309
10310    public CodeableConcept addSubType() { //3
10311      CodeableConcept t = new CodeableConcept();
10312      if (this.subType == null)
10313        this.subType = new ArrayList<CodeableConcept>();
10314      this.subType.add(t);
10315      return t;
10316    }
10317
10318    public Contract addSubType(CodeableConcept t) { //3
10319      if (t == null)
10320        return this;
10321      if (this.subType == null)
10322        this.subType = new ArrayList<CodeableConcept>();
10323      this.subType.add(t);
10324      return this;
10325    }
10326
10327    /**
10328     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist {3}
10329     */
10330    public CodeableConcept getSubTypeFirstRep() { 
10331      if (getSubType().isEmpty()) {
10332        addSubType();
10333      }
10334      return getSubType().get(0);
10335    }
10336
10337    /**
10338     * @return {@link #contentDefinition} (Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.)
10339     */
10340    public ContentDefinitionComponent getContentDefinition() { 
10341      if (this.contentDefinition == null)
10342        if (Configuration.errorOnAutoCreate())
10343          throw new Error("Attempt to auto-create Contract.contentDefinition");
10344        else if (Configuration.doAutoCreate())
10345          this.contentDefinition = new ContentDefinitionComponent(); // cc
10346      return this.contentDefinition;
10347    }
10348
10349    public boolean hasContentDefinition() { 
10350      return this.contentDefinition != null && !this.contentDefinition.isEmpty();
10351    }
10352
10353    /**
10354     * @param value {@link #contentDefinition} (Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.)
10355     */
10356    public Contract setContentDefinition(ContentDefinitionComponent value) { 
10357      this.contentDefinition = value;
10358      return this;
10359    }
10360
10361    /**
10362     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
10363     */
10364    public List<TermComponent> getTerm() { 
10365      if (this.term == null)
10366        this.term = new ArrayList<TermComponent>();
10367      return this.term;
10368    }
10369
10370    /**
10371     * @return Returns a reference to <code>this</code> for easy method chaining
10372     */
10373    public Contract setTerm(List<TermComponent> theTerm) { 
10374      this.term = theTerm;
10375      return this;
10376    }
10377
10378    public boolean hasTerm() { 
10379      if (this.term == null)
10380        return false;
10381      for (TermComponent item : this.term)
10382        if (!item.isEmpty())
10383          return true;
10384      return false;
10385    }
10386
10387    public TermComponent addTerm() { //3
10388      TermComponent t = new TermComponent();
10389      if (this.term == null)
10390        this.term = new ArrayList<TermComponent>();
10391      this.term.add(t);
10392      return t;
10393    }
10394
10395    public Contract addTerm(TermComponent t) { //3
10396      if (t == null)
10397        return this;
10398      if (this.term == null)
10399        this.term = new ArrayList<TermComponent>();
10400      this.term.add(t);
10401      return this;
10402    }
10403
10404    /**
10405     * @return The first repetition of repeating field {@link #term}, creating it if it does not already exist {3}
10406     */
10407    public TermComponent getTermFirstRep() { 
10408      if (getTerm().isEmpty()) {
10409        addTerm();
10410      }
10411      return getTerm().get(0);
10412    }
10413
10414    /**
10415     * @return {@link #supportingInfo} (Information that may be needed by/relevant to the performer in their execution of this term action.)
10416     */
10417    public List<Reference> getSupportingInfo() { 
10418      if (this.supportingInfo == null)
10419        this.supportingInfo = new ArrayList<Reference>();
10420      return this.supportingInfo;
10421    }
10422
10423    /**
10424     * @return Returns a reference to <code>this</code> for easy method chaining
10425     */
10426    public Contract setSupportingInfo(List<Reference> theSupportingInfo) { 
10427      this.supportingInfo = theSupportingInfo;
10428      return this;
10429    }
10430
10431    public boolean hasSupportingInfo() { 
10432      if (this.supportingInfo == null)
10433        return false;
10434      for (Reference item : this.supportingInfo)
10435        if (!item.isEmpty())
10436          return true;
10437      return false;
10438    }
10439
10440    public Reference addSupportingInfo() { //3
10441      Reference t = new Reference();
10442      if (this.supportingInfo == null)
10443        this.supportingInfo = new ArrayList<Reference>();
10444      this.supportingInfo.add(t);
10445      return t;
10446    }
10447
10448    public Contract addSupportingInfo(Reference t) { //3
10449      if (t == null)
10450        return this;
10451      if (this.supportingInfo == null)
10452        this.supportingInfo = new ArrayList<Reference>();
10453      this.supportingInfo.add(t);
10454      return this;
10455    }
10456
10457    /**
10458     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
10459     */
10460    public Reference getSupportingInfoFirstRep() { 
10461      if (getSupportingInfo().isEmpty()) {
10462        addSupportingInfo();
10463      }
10464      return getSupportingInfo().get(0);
10465    }
10466
10467    /**
10468     * @return {@link #relevantHistory} (Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
10469     */
10470    public List<Reference> getRelevantHistory() { 
10471      if (this.relevantHistory == null)
10472        this.relevantHistory = new ArrayList<Reference>();
10473      return this.relevantHistory;
10474    }
10475
10476    /**
10477     * @return Returns a reference to <code>this</code> for easy method chaining
10478     */
10479    public Contract setRelevantHistory(List<Reference> theRelevantHistory) { 
10480      this.relevantHistory = theRelevantHistory;
10481      return this;
10482    }
10483
10484    public boolean hasRelevantHistory() { 
10485      if (this.relevantHistory == null)
10486        return false;
10487      for (Reference item : this.relevantHistory)
10488        if (!item.isEmpty())
10489          return true;
10490      return false;
10491    }
10492
10493    public Reference addRelevantHistory() { //3
10494      Reference t = new Reference();
10495      if (this.relevantHistory == null)
10496        this.relevantHistory = new ArrayList<Reference>();
10497      this.relevantHistory.add(t);
10498      return t;
10499    }
10500
10501    public Contract addRelevantHistory(Reference t) { //3
10502      if (t == null)
10503        return this;
10504      if (this.relevantHistory == null)
10505        this.relevantHistory = new ArrayList<Reference>();
10506      this.relevantHistory.add(t);
10507      return this;
10508    }
10509
10510    /**
10511     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist {3}
10512     */
10513    public Reference getRelevantHistoryFirstRep() { 
10514      if (getRelevantHistory().isEmpty()) {
10515        addRelevantHistory();
10516      }
10517      return getRelevantHistory().get(0);
10518    }
10519
10520    /**
10521     * @return {@link #signer} (Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.)
10522     */
10523    public List<SignatoryComponent> getSigner() { 
10524      if (this.signer == null)
10525        this.signer = new ArrayList<SignatoryComponent>();
10526      return this.signer;
10527    }
10528
10529    /**
10530     * @return Returns a reference to <code>this</code> for easy method chaining
10531     */
10532    public Contract setSigner(List<SignatoryComponent> theSigner) { 
10533      this.signer = theSigner;
10534      return this;
10535    }
10536
10537    public boolean hasSigner() { 
10538      if (this.signer == null)
10539        return false;
10540      for (SignatoryComponent item : this.signer)
10541        if (!item.isEmpty())
10542          return true;
10543      return false;
10544    }
10545
10546    public SignatoryComponent addSigner() { //3
10547      SignatoryComponent t = new SignatoryComponent();
10548      if (this.signer == null)
10549        this.signer = new ArrayList<SignatoryComponent>();
10550      this.signer.add(t);
10551      return t;
10552    }
10553
10554    public Contract addSigner(SignatoryComponent t) { //3
10555      if (t == null)
10556        return this;
10557      if (this.signer == null)
10558        this.signer = new ArrayList<SignatoryComponent>();
10559      this.signer.add(t);
10560      return this;
10561    }
10562
10563    /**
10564     * @return The first repetition of repeating field {@link #signer}, creating it if it does not already exist {3}
10565     */
10566    public SignatoryComponent getSignerFirstRep() { 
10567      if (getSigner().isEmpty()) {
10568        addSigner();
10569      }
10570      return getSigner().get(0);
10571    }
10572
10573    /**
10574     * @return {@link #friendly} (The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.)
10575     */
10576    public List<FriendlyLanguageComponent> getFriendly() { 
10577      if (this.friendly == null)
10578        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10579      return this.friendly;
10580    }
10581
10582    /**
10583     * @return Returns a reference to <code>this</code> for easy method chaining
10584     */
10585    public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) { 
10586      this.friendly = theFriendly;
10587      return this;
10588    }
10589
10590    public boolean hasFriendly() { 
10591      if (this.friendly == null)
10592        return false;
10593      for (FriendlyLanguageComponent item : this.friendly)
10594        if (!item.isEmpty())
10595          return true;
10596      return false;
10597    }
10598
10599    public FriendlyLanguageComponent addFriendly() { //3
10600      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
10601      if (this.friendly == null)
10602        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10603      this.friendly.add(t);
10604      return t;
10605    }
10606
10607    public Contract addFriendly(FriendlyLanguageComponent t) { //3
10608      if (t == null)
10609        return this;
10610      if (this.friendly == null)
10611        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10612      this.friendly.add(t);
10613      return this;
10614    }
10615
10616    /**
10617     * @return The first repetition of repeating field {@link #friendly}, creating it if it does not already exist {3}
10618     */
10619    public FriendlyLanguageComponent getFriendlyFirstRep() { 
10620      if (getFriendly().isEmpty()) {
10621        addFriendly();
10622      }
10623      return getFriendly().get(0);
10624    }
10625
10626    /**
10627     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
10628     */
10629    public List<LegalLanguageComponent> getLegal() { 
10630      if (this.legal == null)
10631        this.legal = new ArrayList<LegalLanguageComponent>();
10632      return this.legal;
10633    }
10634
10635    /**
10636     * @return Returns a reference to <code>this</code> for easy method chaining
10637     */
10638    public Contract setLegal(List<LegalLanguageComponent> theLegal) { 
10639      this.legal = theLegal;
10640      return this;
10641    }
10642
10643    public boolean hasLegal() { 
10644      if (this.legal == null)
10645        return false;
10646      for (LegalLanguageComponent item : this.legal)
10647        if (!item.isEmpty())
10648          return true;
10649      return false;
10650    }
10651
10652    public LegalLanguageComponent addLegal() { //3
10653      LegalLanguageComponent t = new LegalLanguageComponent();
10654      if (this.legal == null)
10655        this.legal = new ArrayList<LegalLanguageComponent>();
10656      this.legal.add(t);
10657      return t;
10658    }
10659
10660    public Contract addLegal(LegalLanguageComponent t) { //3
10661      if (t == null)
10662        return this;
10663      if (this.legal == null)
10664        this.legal = new ArrayList<LegalLanguageComponent>();
10665      this.legal.add(t);
10666      return this;
10667    }
10668
10669    /**
10670     * @return The first repetition of repeating field {@link #legal}, creating it if it does not already exist {3}
10671     */
10672    public LegalLanguageComponent getLegalFirstRep() { 
10673      if (getLegal().isEmpty()) {
10674        addLegal();
10675      }
10676      return getLegal().get(0);
10677    }
10678
10679    /**
10680     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
10681     */
10682    public List<ComputableLanguageComponent> getRule() { 
10683      if (this.rule == null)
10684        this.rule = new ArrayList<ComputableLanguageComponent>();
10685      return this.rule;
10686    }
10687
10688    /**
10689     * @return Returns a reference to <code>this</code> for easy method chaining
10690     */
10691    public Contract setRule(List<ComputableLanguageComponent> theRule) { 
10692      this.rule = theRule;
10693      return this;
10694    }
10695
10696    public boolean hasRule() { 
10697      if (this.rule == null)
10698        return false;
10699      for (ComputableLanguageComponent item : this.rule)
10700        if (!item.isEmpty())
10701          return true;
10702      return false;
10703    }
10704
10705    public ComputableLanguageComponent addRule() { //3
10706      ComputableLanguageComponent t = new ComputableLanguageComponent();
10707      if (this.rule == null)
10708        this.rule = new ArrayList<ComputableLanguageComponent>();
10709      this.rule.add(t);
10710      return t;
10711    }
10712
10713    public Contract addRule(ComputableLanguageComponent t) { //3
10714      if (t == null)
10715        return this;
10716      if (this.rule == null)
10717        this.rule = new ArrayList<ComputableLanguageComponent>();
10718      this.rule.add(t);
10719      return this;
10720    }
10721
10722    /**
10723     * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist {3}
10724     */
10725    public ComputableLanguageComponent getRuleFirstRep() { 
10726      if (getRule().isEmpty()) {
10727        addRule();
10728      }
10729      return getRule().get(0);
10730    }
10731
10732    /**
10733     * @return {@link #legallyBinding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
10734     */
10735    public DataType getLegallyBinding() { 
10736      return this.legallyBinding;
10737    }
10738
10739    /**
10740     * @return {@link #legallyBinding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
10741     */
10742    public Attachment getLegallyBindingAttachment() throws FHIRException { 
10743      if (this.legallyBinding == null)
10744        this.legallyBinding = new Attachment();
10745      if (!(this.legallyBinding instanceof Attachment))
10746        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
10747      return (Attachment) this.legallyBinding;
10748    }
10749
10750    public boolean hasLegallyBindingAttachment() { 
10751      return this != null && this.legallyBinding instanceof Attachment;
10752    }
10753
10754    /**
10755     * @return {@link #legallyBinding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
10756     */
10757    public Reference getLegallyBindingReference() throws FHIRException { 
10758      if (this.legallyBinding == null)
10759        this.legallyBinding = new Reference();
10760      if (!(this.legallyBinding instanceof Reference))
10761        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
10762      return (Reference) this.legallyBinding;
10763    }
10764
10765    public boolean hasLegallyBindingReference() { 
10766      return this != null && this.legallyBinding instanceof Reference;
10767    }
10768
10769    public boolean hasLegallyBinding() { 
10770      return this.legallyBinding != null && !this.legallyBinding.isEmpty();
10771    }
10772
10773    /**
10774     * @param value {@link #legallyBinding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
10775     */
10776    public Contract setLegallyBinding(DataType value) { 
10777      if (value != null && !(value instanceof Attachment || value instanceof Reference))
10778        throw new Error("Not the right type for Contract.legallyBinding[x]: "+value.fhirType());
10779      this.legallyBinding = value;
10780      return this;
10781    }
10782
10783      protected void listChildren(List<Property> children) {
10784        super.listChildren(children);
10785        children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier));
10786        children.add(new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url));
10787        children.add(new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version));
10788        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
10789        children.add(new Property("legalState", "CodeableConcept", "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.", 0, 1, legalState));
10790        children.add(new Property("instantiatesCanonical", "Reference(Contract)", "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.", 0, 1, instantiatesCanonical));
10791        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.", 0, 1, instantiatesUri));
10792        children.add(new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative));
10793        children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
10794        children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies));
10795        children.add(new Property("expirationType", "CodeableConcept", "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.", 0, 1, expirationType));
10796        children.add(new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject));
10797        children.add(new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority));
10798        children.add(new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain));
10799        children.add(new Property("site", "Reference(Location)", "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE, site));
10800        children.add(new Property("name", "string", "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
10801        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, title));
10802        children.add(new Property("subtitle", "string", "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, subtitle));
10803        children.add(new Property("alias", "string", "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.", 0, java.lang.Integer.MAX_VALUE, alias));
10804        children.add(new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.", 0, 1, author));
10805        children.add(new Property("scope", "CodeableConcept", "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1, scope));
10806        children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic));
10807        children.add(new Property("type", "CodeableConcept", "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.", 0, 1, type));
10808        children.add(new Property("subType", "CodeableConcept", "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.", 0, java.lang.Integer.MAX_VALUE, subType));
10809        children.add(new Property("contentDefinition", "", "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.", 0, 1, contentDefinition));
10810        children.add(new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term));
10811        children.add(new Property("supportingInfo", "Reference(Any)", "Information that may be needed by/relevant to the performer in their execution of this term action.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
10812        children.add(new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
10813        children.add(new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer));
10814        children.add(new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly));
10815        children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
10816        children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
10817        children.add(new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding));
10818      }
10819
10820      @Override
10821      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10822        switch (_hash) {
10823        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier);
10824        case 116079: /*url*/  return new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url);
10825        case 351608024: /*version*/  return new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version);
10826        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
10827        case 568606040: /*legalState*/  return new Property("legalState", "CodeableConcept", "Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.", 0, 1, legalState);
10828        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "Reference(Contract)", "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.", 0, 1, instantiatesCanonical);
10829        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.", 0, 1, instantiatesUri);
10830        case -92412192: /*contentDerivative*/  return new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative);
10831        case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
10832        case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
10833        case -668311927: /*expirationType*/  return new Property("expirationType", "CodeableConcept", "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.", 0, 1, expirationType);
10834        case -1867885268: /*subject*/  return new Property("subject", "Reference(Any)", "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE, subject);
10835        case 1475610435: /*authority*/  return new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority);
10836        case -1326197564: /*domain*/  return new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain);
10837        case 3530567: /*site*/  return new Property("site", "Reference(Location)", "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE, site);
10838        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
10839        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, title);
10840        case -2060497896: /*subtitle*/  return new Property("subtitle", "string", "An explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.", 0, 1, subtitle);
10841        case 92902992: /*alias*/  return new Property("alias", "string", "Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.", 0, java.lang.Integer.MAX_VALUE, alias);
10842        case -1406328437: /*author*/  return new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.", 0, 1, author);
10843        case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1, scope);
10844        case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
10845        case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
10846        case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
10847        case -343345444: /*topicReference*/  return new Property("topic[x]", "Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
10848        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.", 0, 1, type);
10849        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.", 0, java.lang.Integer.MAX_VALUE, subType);
10850        case 247055020: /*contentDefinition*/  return new Property("contentDefinition", "", "Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.", 0, 1, contentDefinition);
10851        case 3556460: /*term*/  return new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term);
10852        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Information that may be needed by/relevant to the performer in their execution of this term action.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
10853        case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provence.entity indicates the target that was changed in the update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
10854        case -902467798: /*signer*/  return new Property("signer", "", "Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.", 0, java.lang.Integer.MAX_VALUE, signer);
10855        case -1423054677: /*friendly*/  return new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly);
10856        case 102851257: /*legal*/  return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal);
10857        case 3512060: /*rule*/  return new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule);
10858        case -772497791: /*legallyBinding[x]*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
10859        case -126751329: /*legallyBinding*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
10860        case 344057890: /*legallyBindingAttachment*/  return new Property("legallyBinding[x]", "Attachment", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
10861        case -296528788: /*legallyBindingReference*/  return new Property("legallyBinding[x]", "Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
10862        default: return super.getNamedProperty(_hash, _name, _checkValid);
10863        }
10864
10865      }
10866
10867      @Override
10868      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10869        switch (hash) {
10870        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
10871        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
10872        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
10873        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractResourceStatusCodes>
10874        case 568606040: /*legalState*/ return this.legalState == null ? new Base[0] : new Base[] {this.legalState}; // CodeableConcept
10875        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : new Base[] {this.instantiatesCanonical}; // Reference
10876        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : new Base[] {this.instantiatesUri}; // UriType
10877        case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
10878        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
10879        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
10880        case -668311927: /*expirationType*/ return this.expirationType == null ? new Base[0] : new Base[] {this.expirationType}; // CodeableConcept
10881        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
10882        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : this.authority.toArray(new Base[this.authority.size()]); // Reference
10883        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
10884        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
10885        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
10886        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
10887        case -2060497896: /*subtitle*/ return this.subtitle == null ? new Base[0] : new Base[] {this.subtitle}; // StringType
10888        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
10889        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
10890        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
10891        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // DataType
10892        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10893        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
10894        case 247055020: /*contentDefinition*/ return this.contentDefinition == null ? new Base[0] : new Base[] {this.contentDefinition}; // ContentDefinitionComponent
10895        case 3556460: /*term*/ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
10896        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
10897        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
10898        case -902467798: /*signer*/ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
10899        case -1423054677: /*friendly*/ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
10900        case 102851257: /*legal*/ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
10901        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
10902        case -126751329: /*legallyBinding*/ return this.legallyBinding == null ? new Base[0] : new Base[] {this.legallyBinding}; // DataType
10903        default: return super.getProperty(hash, name, checkValid);
10904        }
10905
10906      }
10907
10908      @Override
10909      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10910        switch (hash) {
10911        case -1618432855: // identifier
10912          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
10913          return value;
10914        case 116079: // url
10915          this.url = TypeConvertor.castToUri(value); // UriType
10916          return value;
10917        case 351608024: // version
10918          this.version = TypeConvertor.castToString(value); // StringType
10919          return value;
10920        case -892481550: // status
10921          value = new ContractResourceStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
10922          this.status = (Enumeration) value; // Enumeration<ContractResourceStatusCodes>
10923          return value;
10924        case 568606040: // legalState
10925          this.legalState = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10926          return value;
10927        case 8911915: // instantiatesCanonical
10928          this.instantiatesCanonical = TypeConvertor.castToReference(value); // Reference
10929          return value;
10930        case -1926393373: // instantiatesUri
10931          this.instantiatesUri = TypeConvertor.castToUri(value); // UriType
10932          return value;
10933        case -92412192: // contentDerivative
10934          this.contentDerivative = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10935          return value;
10936        case -1179159893: // issued
10937          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
10938          return value;
10939        case -793235316: // applies
10940          this.applies = TypeConvertor.castToPeriod(value); // Period
10941          return value;
10942        case -668311927: // expirationType
10943          this.expirationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10944          return value;
10945        case -1867885268: // subject
10946          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
10947          return value;
10948        case 1475610435: // authority
10949          this.getAuthority().add(TypeConvertor.castToReference(value)); // Reference
10950          return value;
10951        case -1326197564: // domain
10952          this.getDomain().add(TypeConvertor.castToReference(value)); // Reference
10953          return value;
10954        case 3530567: // site
10955          this.getSite().add(TypeConvertor.castToReference(value)); // Reference
10956          return value;
10957        case 3373707: // name
10958          this.name = TypeConvertor.castToString(value); // StringType
10959          return value;
10960        case 110371416: // title
10961          this.title = TypeConvertor.castToString(value); // StringType
10962          return value;
10963        case -2060497896: // subtitle
10964          this.subtitle = TypeConvertor.castToString(value); // StringType
10965          return value;
10966        case 92902992: // alias
10967          this.getAlias().add(TypeConvertor.castToString(value)); // StringType
10968          return value;
10969        case -1406328437: // author
10970          this.author = TypeConvertor.castToReference(value); // Reference
10971          return value;
10972        case 109264468: // scope
10973          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10974          return value;
10975        case 110546223: // topic
10976          this.topic = TypeConvertor.castToType(value); // DataType
10977          return value;
10978        case 3575610: // type
10979          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10980          return value;
10981        case -1868521062: // subType
10982          this.getSubType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
10983          return value;
10984        case 247055020: // contentDefinition
10985          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
10986          return value;
10987        case 3556460: // term
10988          this.getTerm().add((TermComponent) value); // TermComponent
10989          return value;
10990        case 1922406657: // supportingInfo
10991          this.getSupportingInfo().add(TypeConvertor.castToReference(value)); // Reference
10992          return value;
10993        case 1538891575: // relevantHistory
10994          this.getRelevantHistory().add(TypeConvertor.castToReference(value)); // Reference
10995          return value;
10996        case -902467798: // signer
10997          this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
10998          return value;
10999        case -1423054677: // friendly
11000          this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
11001          return value;
11002        case 102851257: // legal
11003          this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
11004          return value;
11005        case 3512060: // rule
11006          this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
11007          return value;
11008        case -126751329: // legallyBinding
11009          this.legallyBinding = TypeConvertor.castToType(value); // DataType
11010          return value;
11011        default: return super.setProperty(hash, name, value);
11012        }
11013
11014      }
11015
11016      @Override
11017      public Base setProperty(String name, Base value) throws FHIRException {
11018        if (name.equals("identifier")) {
11019          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
11020        } else if (name.equals("url")) {
11021          this.url = TypeConvertor.castToUri(value); // UriType
11022        } else if (name.equals("version")) {
11023          this.version = TypeConvertor.castToString(value); // StringType
11024        } else if (name.equals("status")) {
11025          value = new ContractResourceStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
11026          this.status = (Enumeration) value; // Enumeration<ContractResourceStatusCodes>
11027        } else if (name.equals("legalState")) {
11028          this.legalState = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11029        } else if (name.equals("instantiatesCanonical")) {
11030          this.instantiatesCanonical = TypeConvertor.castToReference(value); // Reference
11031        } else if (name.equals("instantiatesUri")) {
11032          this.instantiatesUri = TypeConvertor.castToUri(value); // UriType
11033        } else if (name.equals("contentDerivative")) {
11034          this.contentDerivative = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11035        } else if (name.equals("issued")) {
11036          this.issued = TypeConvertor.castToDateTime(value); // DateTimeType
11037        } else if (name.equals("applies")) {
11038          this.applies = TypeConvertor.castToPeriod(value); // Period
11039        } else if (name.equals("expirationType")) {
11040          this.expirationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11041        } else if (name.equals("subject")) {
11042          this.getSubject().add(TypeConvertor.castToReference(value));
11043        } else if (name.equals("authority")) {
11044          this.getAuthority().add(TypeConvertor.castToReference(value));
11045        } else if (name.equals("domain")) {
11046          this.getDomain().add(TypeConvertor.castToReference(value));
11047        } else if (name.equals("site")) {
11048          this.getSite().add(TypeConvertor.castToReference(value));
11049        } else if (name.equals("name")) {
11050          this.name = TypeConvertor.castToString(value); // StringType
11051        } else if (name.equals("title")) {
11052          this.title = TypeConvertor.castToString(value); // StringType
11053        } else if (name.equals("subtitle")) {
11054          this.subtitle = TypeConvertor.castToString(value); // StringType
11055        } else if (name.equals("alias")) {
11056          this.getAlias().add(TypeConvertor.castToString(value));
11057        } else if (name.equals("author")) {
11058          this.author = TypeConvertor.castToReference(value); // Reference
11059        } else if (name.equals("scope")) {
11060          this.scope = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11061        } else if (name.equals("topic[x]")) {
11062          this.topic = TypeConvertor.castToType(value); // DataType
11063        } else if (name.equals("type")) {
11064          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11065        } else if (name.equals("subType")) {
11066          this.getSubType().add(TypeConvertor.castToCodeableConcept(value));
11067        } else if (name.equals("contentDefinition")) {
11068          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
11069        } else if (name.equals("term")) {
11070          this.getTerm().add((TermComponent) value);
11071        } else if (name.equals("supportingInfo")) {
11072          this.getSupportingInfo().add(TypeConvertor.castToReference(value));
11073        } else if (name.equals("relevantHistory")) {
11074          this.getRelevantHistory().add(TypeConvertor.castToReference(value));
11075        } else if (name.equals("signer")) {
11076          this.getSigner().add((SignatoryComponent) value);
11077        } else if (name.equals("friendly")) {
11078          this.getFriendly().add((FriendlyLanguageComponent) value);
11079        } else if (name.equals("legal")) {
11080          this.getLegal().add((LegalLanguageComponent) value);
11081        } else if (name.equals("rule")) {
11082          this.getRule().add((ComputableLanguageComponent) value);
11083        } else if (name.equals("legallyBinding[x]")) {
11084          this.legallyBinding = TypeConvertor.castToType(value); // DataType
11085        } else
11086          return super.setProperty(name, value);
11087        return value;
11088      }
11089
11090      @Override
11091      public Base makeProperty(int hash, String name) throws FHIRException {
11092        switch (hash) {
11093        case -1618432855:  return addIdentifier(); 
11094        case 116079:  return getUrlElement();
11095        case 351608024:  return getVersionElement();
11096        case -892481550:  return getStatusElement();
11097        case 568606040:  return getLegalState();
11098        case 8911915:  return getInstantiatesCanonical();
11099        case -1926393373:  return getInstantiatesUriElement();
11100        case -92412192:  return getContentDerivative();
11101        case -1179159893:  return getIssuedElement();
11102        case -793235316:  return getApplies();
11103        case -668311927:  return getExpirationType();
11104        case -1867885268:  return addSubject(); 
11105        case 1475610435:  return addAuthority(); 
11106        case -1326197564:  return addDomain(); 
11107        case 3530567:  return addSite(); 
11108        case 3373707:  return getNameElement();
11109        case 110371416:  return getTitleElement();
11110        case -2060497896:  return getSubtitleElement();
11111        case 92902992:  return addAliasElement();
11112        case -1406328437:  return getAuthor();
11113        case 109264468:  return getScope();
11114        case -957295375:  return getTopic();
11115        case 110546223:  return getTopic();
11116        case 3575610:  return getType();
11117        case -1868521062:  return addSubType(); 
11118        case 247055020:  return getContentDefinition();
11119        case 3556460:  return addTerm(); 
11120        case 1922406657:  return addSupportingInfo(); 
11121        case 1538891575:  return addRelevantHistory(); 
11122        case -902467798:  return addSigner(); 
11123        case -1423054677:  return addFriendly(); 
11124        case 102851257:  return addLegal(); 
11125        case 3512060:  return addRule(); 
11126        case -772497791:  return getLegallyBinding();
11127        case -126751329:  return getLegallyBinding();
11128        default: return super.makeProperty(hash, name);
11129        }
11130
11131      }
11132
11133      @Override
11134      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11135        switch (hash) {
11136        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11137        case 116079: /*url*/ return new String[] {"uri"};
11138        case 351608024: /*version*/ return new String[] {"string"};
11139        case -892481550: /*status*/ return new String[] {"code"};
11140        case 568606040: /*legalState*/ return new String[] {"CodeableConcept"};
11141        case 8911915: /*instantiatesCanonical*/ return new String[] {"Reference"};
11142        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
11143        case -92412192: /*contentDerivative*/ return new String[] {"CodeableConcept"};
11144        case -1179159893: /*issued*/ return new String[] {"dateTime"};
11145        case -793235316: /*applies*/ return new String[] {"Period"};
11146        case -668311927: /*expirationType*/ return new String[] {"CodeableConcept"};
11147        case -1867885268: /*subject*/ return new String[] {"Reference"};
11148        case 1475610435: /*authority*/ return new String[] {"Reference"};
11149        case -1326197564: /*domain*/ return new String[] {"Reference"};
11150        case 3530567: /*site*/ return new String[] {"Reference"};
11151        case 3373707: /*name*/ return new String[] {"string"};
11152        case 110371416: /*title*/ return new String[] {"string"};
11153        case -2060497896: /*subtitle*/ return new String[] {"string"};
11154        case 92902992: /*alias*/ return new String[] {"string"};
11155        case -1406328437: /*author*/ return new String[] {"Reference"};
11156        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
11157        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
11158        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11159        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
11160        case 247055020: /*contentDefinition*/ return new String[] {};
11161        case 3556460: /*term*/ return new String[] {};
11162        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
11163        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
11164        case -902467798: /*signer*/ return new String[] {};
11165        case -1423054677: /*friendly*/ return new String[] {};
11166        case 102851257: /*legal*/ return new String[] {};
11167        case 3512060: /*rule*/ return new String[] {};
11168        case -126751329: /*legallyBinding*/ return new String[] {"Attachment", "Reference"};
11169        default: return super.getTypesForProperty(hash, name);
11170        }
11171
11172      }
11173
11174      @Override
11175      public Base addChild(String name) throws FHIRException {
11176        if (name.equals("identifier")) {
11177          return addIdentifier();
11178        }
11179        else if (name.equals("url")) {
11180          throw new FHIRException("Cannot call addChild on a primitive type Contract.url");
11181        }
11182        else if (name.equals("version")) {
11183          throw new FHIRException("Cannot call addChild on a primitive type Contract.version");
11184        }
11185        else if (name.equals("status")) {
11186          throw new FHIRException("Cannot call addChild on a primitive type Contract.status");
11187        }
11188        else if (name.equals("legalState")) {
11189          this.legalState = new CodeableConcept();
11190          return this.legalState;
11191        }
11192        else if (name.equals("instantiatesCanonical")) {
11193          this.instantiatesCanonical = new Reference();
11194          return this.instantiatesCanonical;
11195        }
11196        else if (name.equals("instantiatesUri")) {
11197          throw new FHIRException("Cannot call addChild on a primitive type Contract.instantiatesUri");
11198        }
11199        else if (name.equals("contentDerivative")) {
11200          this.contentDerivative = new CodeableConcept();
11201          return this.contentDerivative;
11202        }
11203        else if (name.equals("issued")) {
11204          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
11205        }
11206        else if (name.equals("applies")) {
11207          this.applies = new Period();
11208          return this.applies;
11209        }
11210        else if (name.equals("expirationType")) {
11211          this.expirationType = new CodeableConcept();
11212          return this.expirationType;
11213        }
11214        else if (name.equals("subject")) {
11215          return addSubject();
11216        }
11217        else if (name.equals("authority")) {
11218          return addAuthority();
11219        }
11220        else if (name.equals("domain")) {
11221          return addDomain();
11222        }
11223        else if (name.equals("site")) {
11224          return addSite();
11225        }
11226        else if (name.equals("name")) {
11227          throw new FHIRException("Cannot call addChild on a primitive type Contract.name");
11228        }
11229        else if (name.equals("title")) {
11230          throw new FHIRException("Cannot call addChild on a primitive type Contract.title");
11231        }
11232        else if (name.equals("subtitle")) {
11233          throw new FHIRException("Cannot call addChild on a primitive type Contract.subtitle");
11234        }
11235        else if (name.equals("alias")) {
11236          throw new FHIRException("Cannot call addChild on a primitive type Contract.alias");
11237        }
11238        else if (name.equals("author")) {
11239          this.author = new Reference();
11240          return this.author;
11241        }
11242        else if (name.equals("scope")) {
11243          this.scope = new CodeableConcept();
11244          return this.scope;
11245        }
11246        else if (name.equals("topicCodeableConcept")) {
11247          this.topic = new CodeableConcept();
11248          return this.topic;
11249        }
11250        else if (name.equals("topicReference")) {
11251          this.topic = new Reference();
11252          return this.topic;
11253        }
11254        else if (name.equals("type")) {
11255          this.type = new CodeableConcept();
11256          return this.type;
11257        }
11258        else if (name.equals("subType")) {
11259          return addSubType();
11260        }
11261        else if (name.equals("contentDefinition")) {
11262          this.contentDefinition = new ContentDefinitionComponent();
11263          return this.contentDefinition;
11264        }
11265        else if (name.equals("term")) {
11266          return addTerm();
11267        }
11268        else if (name.equals("supportingInfo")) {
11269          return addSupportingInfo();
11270        }
11271        else if (name.equals("relevantHistory")) {
11272          return addRelevantHistory();
11273        }
11274        else if (name.equals("signer")) {
11275          return addSigner();
11276        }
11277        else if (name.equals("friendly")) {
11278          return addFriendly();
11279        }
11280        else if (name.equals("legal")) {
11281          return addLegal();
11282        }
11283        else if (name.equals("rule")) {
11284          return addRule();
11285        }
11286        else if (name.equals("legallyBindingAttachment")) {
11287          this.legallyBinding = new Attachment();
11288          return this.legallyBinding;
11289        }
11290        else if (name.equals("legallyBindingReference")) {
11291          this.legallyBinding = new Reference();
11292          return this.legallyBinding;
11293        }
11294        else
11295          return super.addChild(name);
11296      }
11297
11298  public String fhirType() {
11299    return "Contract";
11300
11301  }
11302
11303      public Contract copy() {
11304        Contract dst = new Contract();
11305        copyValues(dst);
11306        return dst;
11307      }
11308
11309      public void copyValues(Contract dst) {
11310        super.copyValues(dst);
11311        if (identifier != null) {
11312          dst.identifier = new ArrayList<Identifier>();
11313          for (Identifier i : identifier)
11314            dst.identifier.add(i.copy());
11315        };
11316        dst.url = url == null ? null : url.copy();
11317        dst.version = version == null ? null : version.copy();
11318        dst.status = status == null ? null : status.copy();
11319        dst.legalState = legalState == null ? null : legalState.copy();
11320        dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
11321        dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
11322        dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
11323        dst.issued = issued == null ? null : issued.copy();
11324        dst.applies = applies == null ? null : applies.copy();
11325        dst.expirationType = expirationType == null ? null : expirationType.copy();
11326        if (subject != null) {
11327          dst.subject = new ArrayList<Reference>();
11328          for (Reference i : subject)
11329            dst.subject.add(i.copy());
11330        };
11331        if (authority != null) {
11332          dst.authority = new ArrayList<Reference>();
11333          for (Reference i : authority)
11334            dst.authority.add(i.copy());
11335        };
11336        if (domain != null) {
11337          dst.domain = new ArrayList<Reference>();
11338          for (Reference i : domain)
11339            dst.domain.add(i.copy());
11340        };
11341        if (site != null) {
11342          dst.site = new ArrayList<Reference>();
11343          for (Reference i : site)
11344            dst.site.add(i.copy());
11345        };
11346        dst.name = name == null ? null : name.copy();
11347        dst.title = title == null ? null : title.copy();
11348        dst.subtitle = subtitle == null ? null : subtitle.copy();
11349        if (alias != null) {
11350          dst.alias = new ArrayList<StringType>();
11351          for (StringType i : alias)
11352            dst.alias.add(i.copy());
11353        };
11354        dst.author = author == null ? null : author.copy();
11355        dst.scope = scope == null ? null : scope.copy();
11356        dst.topic = topic == null ? null : topic.copy();
11357        dst.type = type == null ? null : type.copy();
11358        if (subType != null) {
11359          dst.subType = new ArrayList<CodeableConcept>();
11360          for (CodeableConcept i : subType)
11361            dst.subType.add(i.copy());
11362        };
11363        dst.contentDefinition = contentDefinition == null ? null : contentDefinition.copy();
11364        if (term != null) {
11365          dst.term = new ArrayList<TermComponent>();
11366          for (TermComponent i : term)
11367            dst.term.add(i.copy());
11368        };
11369        if (supportingInfo != null) {
11370          dst.supportingInfo = new ArrayList<Reference>();
11371          for (Reference i : supportingInfo)
11372            dst.supportingInfo.add(i.copy());
11373        };
11374        if (relevantHistory != null) {
11375          dst.relevantHistory = new ArrayList<Reference>();
11376          for (Reference i : relevantHistory)
11377            dst.relevantHistory.add(i.copy());
11378        };
11379        if (signer != null) {
11380          dst.signer = new ArrayList<SignatoryComponent>();
11381          for (SignatoryComponent i : signer)
11382            dst.signer.add(i.copy());
11383        };
11384        if (friendly != null) {
11385          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
11386          for (FriendlyLanguageComponent i : friendly)
11387            dst.friendly.add(i.copy());
11388        };
11389        if (legal != null) {
11390          dst.legal = new ArrayList<LegalLanguageComponent>();
11391          for (LegalLanguageComponent i : legal)
11392            dst.legal.add(i.copy());
11393        };
11394        if (rule != null) {
11395          dst.rule = new ArrayList<ComputableLanguageComponent>();
11396          for (ComputableLanguageComponent i : rule)
11397            dst.rule.add(i.copy());
11398        };
11399        dst.legallyBinding = legallyBinding == null ? null : legallyBinding.copy();
11400      }
11401
11402      protected Contract typedCopy() {
11403        return copy();
11404      }
11405
11406      @Override
11407      public boolean equalsDeep(Base other_) {
11408        if (!super.equalsDeep(other_))
11409          return false;
11410        if (!(other_ instanceof Contract))
11411          return false;
11412        Contract o = (Contract) other_;
11413        return compareDeep(identifier, o.identifier, true) && compareDeep(url, o.url, true) && compareDeep(version, o.version, true)
11414           && compareDeep(status, o.status, true) && compareDeep(legalState, o.legalState, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
11415           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(contentDerivative, o.contentDerivative, true)
11416           && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true) && compareDeep(expirationType, o.expirationType, true)
11417           && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true)
11418           && compareDeep(site, o.site, true) && compareDeep(name, o.name, true) && compareDeep(title, o.title, true)
11419           && compareDeep(subtitle, o.subtitle, true) && compareDeep(alias, o.alias, true) && compareDeep(author, o.author, true)
11420           && compareDeep(scope, o.scope, true) && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true)
11421           && compareDeep(subType, o.subType, true) && compareDeep(contentDefinition, o.contentDefinition, true)
11422           && compareDeep(term, o.term, true) && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(relevantHistory, o.relevantHistory, true)
11423           && compareDeep(signer, o.signer, true) && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true)
11424           && compareDeep(rule, o.rule, true) && compareDeep(legallyBinding, o.legallyBinding, true);
11425      }
11426
11427      @Override
11428      public boolean equalsShallow(Base other_) {
11429        if (!super.equalsShallow(other_))
11430          return false;
11431        if (!(other_ instanceof Contract))
11432          return false;
11433        Contract o = (Contract) other_;
11434        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(status, o.status, true)
11435           && compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(issued, o.issued, true)
11436           && compareValues(name, o.name, true) && compareValues(title, o.title, true) && compareValues(subtitle, o.subtitle, true)
11437           && compareValues(alias, o.alias, true);
11438      }
11439
11440      public boolean isEmpty() {
11441        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, url, version
11442          , status, legalState, instantiatesCanonical, instantiatesUri, contentDerivative, issued
11443          , applies, expirationType, subject, authority, domain, site, name, title, subtitle
11444          , alias, author, scope, topic, type, subType, contentDefinition, term, supportingInfo
11445          , relevantHistory, signer, friendly, legal, rule, legallyBinding);
11446      }
11447
11448  @Override
11449  public ResourceType getResourceType() {
11450    return ResourceType.Contract;
11451   }
11452
11453 /**
11454   * Search parameter: <b>authority</b>
11455   * <p>
11456   * Description: <b>The authority of the contract</b><br>
11457   * Type: <b>reference</b><br>
11458   * Path: <b>Contract.authority</b><br>
11459   * </p>
11460   */
11461  @SearchParamDefinition(name="authority", path="Contract.authority", description="The authority of the contract", type="reference", target={Organization.class } )
11462  public static final String SP_AUTHORITY = "authority";
11463 /**
11464   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
11465   * <p>
11466   * Description: <b>The authority of the contract</b><br>
11467   * Type: <b>reference</b><br>
11468   * Path: <b>Contract.authority</b><br>
11469   * </p>
11470   */
11471  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHORITY);
11472
11473/**
11474   * Constant for fluent queries to be used to add include statements. Specifies
11475   * the path value of "<b>Contract:authority</b>".
11476   */
11477  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include("Contract:authority").toLocked();
11478
11479 /**
11480   * Search parameter: <b>domain</b>
11481   * <p>
11482   * Description: <b>The domain of the contract</b><br>
11483   * Type: <b>reference</b><br>
11484   * Path: <b>Contract.domain</b><br>
11485   * </p>
11486   */
11487  @SearchParamDefinition(name="domain", path="Contract.domain", description="The domain of the contract", type="reference", target={Location.class } )
11488  public static final String SP_DOMAIN = "domain";
11489 /**
11490   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
11491   * <p>
11492   * Description: <b>The domain of the contract</b><br>
11493   * Type: <b>reference</b><br>
11494   * Path: <b>Contract.domain</b><br>
11495   * </p>
11496   */
11497  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DOMAIN);
11498
11499/**
11500   * Constant for fluent queries to be used to add include statements. Specifies
11501   * the path value of "<b>Contract:domain</b>".
11502   */
11503  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include("Contract:domain").toLocked();
11504
11505 /**
11506   * Search parameter: <b>identifier</b>
11507   * <p>
11508   * Description: <b>The identity of the contract</b><br>
11509   * Type: <b>token</b><br>
11510   * Path: <b>Contract.identifier</b><br>
11511   * </p>
11512   */
11513  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
11514  public static final String SP_IDENTIFIER = "identifier";
11515 /**
11516   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
11517   * <p>
11518   * Description: <b>The identity of the contract</b><br>
11519   * Type: <b>token</b><br>
11520   * Path: <b>Contract.identifier</b><br>
11521   * </p>
11522   */
11523  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
11524
11525 /**
11526   * Search parameter: <b>instantiates</b>
11527   * <p>
11528   * Description: <b>A source definition of the contract</b><br>
11529   * Type: <b>uri</b><br>
11530   * Path: <b>Contract.instantiatesUri</b><br>
11531   * </p>
11532   */
11533  @SearchParamDefinition(name="instantiates", path="Contract.instantiatesUri", description="A source definition of the contract", type="uri" )
11534  public static final String SP_INSTANTIATES = "instantiates";
11535 /**
11536   * <b>Fluent Client</b> search parameter constant for <b>instantiates</b>
11537   * <p>
11538   * Description: <b>A source definition of the contract</b><br>
11539   * Type: <b>uri</b><br>
11540   * Path: <b>Contract.instantiatesUri</b><br>
11541   * </p>
11542   */
11543  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES);
11544
11545 /**
11546   * Search parameter: <b>issued</b>
11547   * <p>
11548   * Description: <b>The date/time the contract was issued</b><br>
11549   * Type: <b>date</b><br>
11550   * Path: <b>Contract.issued</b><br>
11551   * </p>
11552   */
11553  @SearchParamDefinition(name="issued", path="Contract.issued", description="The date/time the contract was issued", type="date" )
11554  public static final String SP_ISSUED = "issued";
11555 /**
11556   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
11557   * <p>
11558   * Description: <b>The date/time the contract was issued</b><br>
11559   * Type: <b>date</b><br>
11560   * Path: <b>Contract.issued</b><br>
11561   * </p>
11562   */
11563  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
11564
11565 /**
11566   * Search parameter: <b>patient</b>
11567   * <p>
11568   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
11569   * Type: <b>reference</b><br>
11570   * Path: <b>Contract.subject.where(resolve() is Patient)</b><br>
11571   * </p>
11572   */
11573  @SearchParamDefinition(name="patient", path="Contract.subject.where(resolve() is Patient)", description="The identity of the subject of the contract (if a patient)", type="reference", target={Patient.class } )
11574  public static final String SP_PATIENT = "patient";
11575 /**
11576   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
11577   * <p>
11578   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
11579   * Type: <b>reference</b><br>
11580   * Path: <b>Contract.subject.where(resolve() is Patient)</b><br>
11581   * </p>
11582   */
11583  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
11584
11585/**
11586   * Constant for fluent queries to be used to add include statements. Specifies
11587   * the path value of "<b>Contract:patient</b>".
11588   */
11589  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Contract:patient").toLocked();
11590
11591 /**
11592   * Search parameter: <b>signer</b>
11593   * <p>
11594   * Description: <b>Contract Signatory Party</b><br>
11595   * Type: <b>reference</b><br>
11596   * Path: <b>Contract.signer.party</b><br>
11597   * </p>
11598   */
11599  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference", target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
11600  public static final String SP_SIGNER = "signer";
11601 /**
11602   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
11603   * <p>
11604   * Description: <b>Contract Signatory Party</b><br>
11605   * Type: <b>reference</b><br>
11606   * Path: <b>Contract.signer.party</b><br>
11607   * </p>
11608   */
11609  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SIGNER);
11610
11611/**
11612   * Constant for fluent queries to be used to add include statements. Specifies
11613   * the path value of "<b>Contract:signer</b>".
11614   */
11615  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include("Contract:signer").toLocked();
11616
11617 /**
11618   * Search parameter: <b>status</b>
11619   * <p>
11620   * Description: <b>The status of the contract</b><br>
11621   * Type: <b>token</b><br>
11622   * Path: <b>Contract.status</b><br>
11623   * </p>
11624   */
11625  @SearchParamDefinition(name="status", path="Contract.status", description="The status of the contract", type="token" )
11626  public static final String SP_STATUS = "status";
11627 /**
11628   * <b>Fluent Client</b> search parameter constant for <b>status</b>
11629   * <p>
11630   * Description: <b>The status of the contract</b><br>
11631   * Type: <b>token</b><br>
11632   * Path: <b>Contract.status</b><br>
11633   * </p>
11634   */
11635  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
11636
11637 /**
11638   * Search parameter: <b>subject</b>
11639   * <p>
11640   * Description: <b>The identity of the subject of the contract</b><br>
11641   * Type: <b>reference</b><br>
11642   * Path: <b>Contract.subject</b><br>
11643   * </p>
11644   */
11645  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the subject of the contract", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class, DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, Topic.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
11646  public static final String SP_SUBJECT = "subject";
11647 /**
11648   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
11649   * <p>
11650   * Description: <b>The identity of the subject of the contract</b><br>
11651   * Type: <b>reference</b><br>
11652   * Path: <b>Contract.subject</b><br>
11653   * </p>
11654   */
11655  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
11656
11657/**
11658   * Constant for fluent queries to be used to add include statements. Specifies
11659   * the path value of "<b>Contract:subject</b>".
11660   */
11661  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Contract:subject").toLocked();
11662
11663 /**
11664   * Search parameter: <b>url</b>
11665   * <p>
11666   * Description: <b>The basal contract definition</b><br>
11667   * Type: <b>uri</b><br>
11668   * Path: <b>Contract.url</b><br>
11669   * </p>
11670   */
11671  @SearchParamDefinition(name="url", path="Contract.url", description="The basal contract definition", type="uri" )
11672  public static final String SP_URL = "url";
11673 /**
11674   * <b>Fluent Client</b> search parameter constant for <b>url</b>
11675   * <p>
11676   * Description: <b>The basal contract definition</b><br>
11677   * Type: <b>uri</b><br>
11678   * Path: <b>Contract.url</b><br>
11679   * </p>
11680   */
11681  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
11682
11683
11684}
11685