001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import java.math.*;
060import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
061import org.hl7.fhir.utilities.Utilities;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.
071 */
072@ResourceDef(name="Contract", profile="http://hl7.org/fhir/StructureDefinition/Contract")
073public class Contract extends DomainResource {
074
075    public enum ContractStatus {
076        /**
077         * 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.
078         */
079        AMENDED, 
080        /**
081         * 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.
082         */
083        APPENDED, 
084        /**
085         * 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.
086         */
087        CANCELLED, 
088        /**
089         * 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.
090         */
091        DISPUTED, 
092        /**
093         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
094         */
095        ENTEREDINERROR, 
096        /**
097         * 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.
098         */
099        EXECUTABLE, 
100        /**
101         * 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.
102         */
103        EXECUTED, 
104        /**
105         * 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.
106         */
107        NEGOTIABLE, 
108        /**
109         * 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.
110         */
111        OFFERED, 
112        /**
113         * 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.
114         */
115        POLICY, 
116        /**
117         *  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.
118         */
119        REJECTED, 
120        /**
121         * 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.
122         */
123        RENEWED, 
124        /**
125         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
126         */
127        REVOKED, 
128        /**
129         * 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.
130         */
131        RESOLVED, 
132        /**
133         * 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.
134         */
135        TERMINATED, 
136        /**
137         * added to help the parsers with the generic types
138         */
139        NULL;
140        public static ContractStatus fromCode(String codeString) throws FHIRException {
141            if (codeString == null || "".equals(codeString))
142                return null;
143        if ("amended".equals(codeString))
144          return AMENDED;
145        if ("appended".equals(codeString))
146          return APPENDED;
147        if ("cancelled".equals(codeString))
148          return CANCELLED;
149        if ("disputed".equals(codeString))
150          return DISPUTED;
151        if ("entered-in-error".equals(codeString))
152          return ENTEREDINERROR;
153        if ("executable".equals(codeString))
154          return EXECUTABLE;
155        if ("executed".equals(codeString))
156          return EXECUTED;
157        if ("negotiable".equals(codeString))
158          return NEGOTIABLE;
159        if ("offered".equals(codeString))
160          return OFFERED;
161        if ("policy".equals(codeString))
162          return POLICY;
163        if ("rejected".equals(codeString))
164          return REJECTED;
165        if ("renewed".equals(codeString))
166          return RENEWED;
167        if ("revoked".equals(codeString))
168          return REVOKED;
169        if ("resolved".equals(codeString))
170          return RESOLVED;
171        if ("terminated".equals(codeString))
172          return TERMINATED;
173        if (Configuration.isAcceptInvalidEnums())
174          return null;
175        else
176          throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
177        }
178        public String toCode() {
179          switch (this) {
180            case AMENDED: return "amended";
181            case APPENDED: return "appended";
182            case CANCELLED: return "cancelled";
183            case DISPUTED: return "disputed";
184            case ENTEREDINERROR: return "entered-in-error";
185            case EXECUTABLE: return "executable";
186            case EXECUTED: return "executed";
187            case NEGOTIABLE: return "negotiable";
188            case OFFERED: return "offered";
189            case POLICY: return "policy";
190            case REJECTED: return "rejected";
191            case RENEWED: return "renewed";
192            case REVOKED: return "revoked";
193            case RESOLVED: return "resolved";
194            case TERMINATED: return "terminated";
195            default: return "?";
196          }
197        }
198        public String getSystem() {
199          switch (this) {
200            case AMENDED: return "http://hl7.org/fhir/contract-status";
201            case APPENDED: return "http://hl7.org/fhir/contract-status";
202            case CANCELLED: return "http://hl7.org/fhir/contract-status";
203            case DISPUTED: return "http://hl7.org/fhir/contract-status";
204            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-status";
205            case EXECUTABLE: return "http://hl7.org/fhir/contract-status";
206            case EXECUTED: return "http://hl7.org/fhir/contract-status";
207            case NEGOTIABLE: return "http://hl7.org/fhir/contract-status";
208            case OFFERED: return "http://hl7.org/fhir/contract-status";
209            case POLICY: return "http://hl7.org/fhir/contract-status";
210            case REJECTED: return "http://hl7.org/fhir/contract-status";
211            case RENEWED: return "http://hl7.org/fhir/contract-status";
212            case REVOKED: return "http://hl7.org/fhir/contract-status";
213            case RESOLVED: return "http://hl7.org/fhir/contract-status";
214            case TERMINATED: return "http://hl7.org/fhir/contract-status";
215            default: return "?";
216          }
217        }
218        public String getDefinition() {
219          switch (this) {
220            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.";
221            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.";
222            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.";
223            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.";
224            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
225            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.";
226            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.";
227            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.";
228            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.";
229            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.";
230            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.";
231            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.";
232            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.";
233            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.";
234            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.";
235            default: return "?";
236          }
237        }
238        public String getDisplay() {
239          switch (this) {
240            case AMENDED: return "Amended";
241            case APPENDED: return "Appended";
242            case CANCELLED: return "Cancelled";
243            case DISPUTED: return "Disputed";
244            case ENTEREDINERROR: return "Entered in Error";
245            case EXECUTABLE: return "Executable";
246            case EXECUTED: return "Executed";
247            case NEGOTIABLE: return "Negotiable";
248            case OFFERED: return "Offered";
249            case POLICY: return "Policy";
250            case REJECTED: return "Rejected";
251            case RENEWED: return "Renewed";
252            case REVOKED: return "Revoked";
253            case RESOLVED: return "Resolved";
254            case TERMINATED: return "Terminated";
255            default: return "?";
256          }
257        }
258    }
259
260  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
261    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
262      if (codeString == null || "".equals(codeString))
263            if (codeString == null || "".equals(codeString))
264                return null;
265        if ("amended".equals(codeString))
266          return ContractStatus.AMENDED;
267        if ("appended".equals(codeString))
268          return ContractStatus.APPENDED;
269        if ("cancelled".equals(codeString))
270          return ContractStatus.CANCELLED;
271        if ("disputed".equals(codeString))
272          return ContractStatus.DISPUTED;
273        if ("entered-in-error".equals(codeString))
274          return ContractStatus.ENTEREDINERROR;
275        if ("executable".equals(codeString))
276          return ContractStatus.EXECUTABLE;
277        if ("executed".equals(codeString))
278          return ContractStatus.EXECUTED;
279        if ("negotiable".equals(codeString))
280          return ContractStatus.NEGOTIABLE;
281        if ("offered".equals(codeString))
282          return ContractStatus.OFFERED;
283        if ("policy".equals(codeString))
284          return ContractStatus.POLICY;
285        if ("rejected".equals(codeString))
286          return ContractStatus.REJECTED;
287        if ("renewed".equals(codeString))
288          return ContractStatus.RENEWED;
289        if ("revoked".equals(codeString))
290          return ContractStatus.REVOKED;
291        if ("resolved".equals(codeString))
292          return ContractStatus.RESOLVED;
293        if ("terminated".equals(codeString))
294          return ContractStatus.TERMINATED;
295        throw new IllegalArgumentException("Unknown ContractStatus code '"+codeString+"'");
296        }
297        public Enumeration<ContractStatus> fromType(Base code) throws FHIRException {
298          if (code == null)
299            return null;
300          if (code.isEmpty())
301            return new Enumeration<ContractStatus>(this);
302          String codeString = ((PrimitiveType) code).asStringValue();
303          if (codeString == null || "".equals(codeString))
304            return null;
305        if ("amended".equals(codeString))
306          return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED);
307        if ("appended".equals(codeString))
308          return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED);
309        if ("cancelled".equals(codeString))
310          return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED);
311        if ("disputed".equals(codeString))
312          return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED);
313        if ("entered-in-error".equals(codeString))
314          return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR);
315        if ("executable".equals(codeString))
316          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE);
317        if ("executed".equals(codeString))
318          return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED);
319        if ("negotiable".equals(codeString))
320          return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE);
321        if ("offered".equals(codeString))
322          return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED);
323        if ("policy".equals(codeString))
324          return new Enumeration<ContractStatus>(this, ContractStatus.POLICY);
325        if ("rejected".equals(codeString))
326          return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED);
327        if ("renewed".equals(codeString))
328          return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED);
329        if ("revoked".equals(codeString))
330          return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED);
331        if ("resolved".equals(codeString))
332          return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED);
333        if ("terminated".equals(codeString))
334          return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED);
335        throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
336        }
337    public String toCode(ContractStatus code) {
338      if (code == ContractStatus.AMENDED)
339        return "amended";
340      if (code == ContractStatus.APPENDED)
341        return "appended";
342      if (code == ContractStatus.CANCELLED)
343        return "cancelled";
344      if (code == ContractStatus.DISPUTED)
345        return "disputed";
346      if (code == ContractStatus.ENTEREDINERROR)
347        return "entered-in-error";
348      if (code == ContractStatus.EXECUTABLE)
349        return "executable";
350      if (code == ContractStatus.EXECUTED)
351        return "executed";
352      if (code == ContractStatus.NEGOTIABLE)
353        return "negotiable";
354      if (code == ContractStatus.OFFERED)
355        return "offered";
356      if (code == ContractStatus.POLICY)
357        return "policy";
358      if (code == ContractStatus.REJECTED)
359        return "rejected";
360      if (code == ContractStatus.RENEWED)
361        return "renewed";
362      if (code == ContractStatus.REVOKED)
363        return "revoked";
364      if (code == ContractStatus.RESOLVED)
365        return "resolved";
366      if (code == ContractStatus.TERMINATED)
367        return "terminated";
368      return "?";
369      }
370    public String toSystem(ContractStatus code) {
371      return code.getSystem();
372      }
373    }
374
375    public enum ContractPublicationStatus {
376        /**
377         * 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.
378         */
379        AMENDED, 
380        /**
381         * 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.
382         */
383        APPENDED, 
384        /**
385         * 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.
386         */
387        CANCELLED, 
388        /**
389         * 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.
390         */
391        DISPUTED, 
392        /**
393         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
394         */
395        ENTEREDINERROR, 
396        /**
397         * 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.
398         */
399        EXECUTABLE, 
400        /**
401         * 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.
402         */
403        EXECUTED, 
404        /**
405         * 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.
406         */
407        NEGOTIABLE, 
408        /**
409         * 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.
410         */
411        OFFERED, 
412        /**
413         * 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.
414         */
415        POLICY, 
416        /**
417         *  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.
418         */
419        REJECTED, 
420        /**
421         * 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.
422         */
423        RENEWED, 
424        /**
425         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
426         */
427        REVOKED, 
428        /**
429         * 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.
430         */
431        RESOLVED, 
432        /**
433         * 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.
434         */
435        TERMINATED, 
436        /**
437         * added to help the parsers with the generic types
438         */
439        NULL;
440        public static ContractPublicationStatus fromCode(String codeString) throws FHIRException {
441            if (codeString == null || "".equals(codeString))
442                return null;
443        if ("amended".equals(codeString))
444          return AMENDED;
445        if ("appended".equals(codeString))
446          return APPENDED;
447        if ("cancelled".equals(codeString))
448          return CANCELLED;
449        if ("disputed".equals(codeString))
450          return DISPUTED;
451        if ("entered-in-error".equals(codeString))
452          return ENTEREDINERROR;
453        if ("executable".equals(codeString))
454          return EXECUTABLE;
455        if ("executed".equals(codeString))
456          return EXECUTED;
457        if ("negotiable".equals(codeString))
458          return NEGOTIABLE;
459        if ("offered".equals(codeString))
460          return OFFERED;
461        if ("policy".equals(codeString))
462          return POLICY;
463        if ("rejected".equals(codeString))
464          return REJECTED;
465        if ("renewed".equals(codeString))
466          return RENEWED;
467        if ("revoked".equals(codeString))
468          return REVOKED;
469        if ("resolved".equals(codeString))
470          return RESOLVED;
471        if ("terminated".equals(codeString))
472          return TERMINATED;
473        if (Configuration.isAcceptInvalidEnums())
474          return null;
475        else
476          throw new FHIRException("Unknown ContractPublicationStatus code '"+codeString+"'");
477        }
478        public String toCode() {
479          switch (this) {
480            case AMENDED: return "amended";
481            case APPENDED: return "appended";
482            case CANCELLED: return "cancelled";
483            case DISPUTED: return "disputed";
484            case ENTEREDINERROR: return "entered-in-error";
485            case EXECUTABLE: return "executable";
486            case EXECUTED: return "executed";
487            case NEGOTIABLE: return "negotiable";
488            case OFFERED: return "offered";
489            case POLICY: return "policy";
490            case REJECTED: return "rejected";
491            case RENEWED: return "renewed";
492            case REVOKED: return "revoked";
493            case RESOLVED: return "resolved";
494            case TERMINATED: return "terminated";
495            default: return "?";
496          }
497        }
498        public String getSystem() {
499          switch (this) {
500            case AMENDED: return "http://hl7.org/fhir/contract-publicationstatus";
501            case APPENDED: return "http://hl7.org/fhir/contract-publicationstatus";
502            case CANCELLED: return "http://hl7.org/fhir/contract-publicationstatus";
503            case DISPUTED: return "http://hl7.org/fhir/contract-publicationstatus";
504            case ENTEREDINERROR: return "http://hl7.org/fhir/contract-publicationstatus";
505            case EXECUTABLE: return "http://hl7.org/fhir/contract-publicationstatus";
506            case EXECUTED: return "http://hl7.org/fhir/contract-publicationstatus";
507            case NEGOTIABLE: return "http://hl7.org/fhir/contract-publicationstatus";
508            case OFFERED: return "http://hl7.org/fhir/contract-publicationstatus";
509            case POLICY: return "http://hl7.org/fhir/contract-publicationstatus";
510            case REJECTED: return "http://hl7.org/fhir/contract-publicationstatus";
511            case RENEWED: return "http://hl7.org/fhir/contract-publicationstatus";
512            case REVOKED: return "http://hl7.org/fhir/contract-publicationstatus";
513            case RESOLVED: return "http://hl7.org/fhir/contract-publicationstatus";
514            case TERMINATED: return "http://hl7.org/fhir/contract-publicationstatus";
515            default: return "?";
516          }
517        }
518        public String getDefinition() {
519          switch (this) {
520            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.";
521            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.";
522            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.";
523            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.";
524            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
525            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.";
526            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.";
527            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.";
528            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.";
529            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.";
530            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.";
531            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.";
532            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.";
533            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.";
534            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.";
535            default: return "?";
536          }
537        }
538        public String getDisplay() {
539          switch (this) {
540            case AMENDED: return "Amended";
541            case APPENDED: return "Appended";
542            case CANCELLED: return "Cancelled";
543            case DISPUTED: return "Disputed";
544            case ENTEREDINERROR: return "Entered in Error";
545            case EXECUTABLE: return "Executable";
546            case EXECUTED: return "Executed";
547            case NEGOTIABLE: return "Negotiable";
548            case OFFERED: return "Offered";
549            case POLICY: return "Policy";
550            case REJECTED: return "Rejected";
551            case RENEWED: return "Renewed";
552            case REVOKED: return "Revoked";
553            case RESOLVED: return "Resolved";
554            case TERMINATED: return "Terminated";
555            default: return "?";
556          }
557        }
558    }
559
560  public static class ContractPublicationStatusEnumFactory implements EnumFactory<ContractPublicationStatus> {
561    public ContractPublicationStatus fromCode(String codeString) throws IllegalArgumentException {
562      if (codeString == null || "".equals(codeString))
563            if (codeString == null || "".equals(codeString))
564                return null;
565        if ("amended".equals(codeString))
566          return ContractPublicationStatus.AMENDED;
567        if ("appended".equals(codeString))
568          return ContractPublicationStatus.APPENDED;
569        if ("cancelled".equals(codeString))
570          return ContractPublicationStatus.CANCELLED;
571        if ("disputed".equals(codeString))
572          return ContractPublicationStatus.DISPUTED;
573        if ("entered-in-error".equals(codeString))
574          return ContractPublicationStatus.ENTEREDINERROR;
575        if ("executable".equals(codeString))
576          return ContractPublicationStatus.EXECUTABLE;
577        if ("executed".equals(codeString))
578          return ContractPublicationStatus.EXECUTED;
579        if ("negotiable".equals(codeString))
580          return ContractPublicationStatus.NEGOTIABLE;
581        if ("offered".equals(codeString))
582          return ContractPublicationStatus.OFFERED;
583        if ("policy".equals(codeString))
584          return ContractPublicationStatus.POLICY;
585        if ("rejected".equals(codeString))
586          return ContractPublicationStatus.REJECTED;
587        if ("renewed".equals(codeString))
588          return ContractPublicationStatus.RENEWED;
589        if ("revoked".equals(codeString))
590          return ContractPublicationStatus.REVOKED;
591        if ("resolved".equals(codeString))
592          return ContractPublicationStatus.RESOLVED;
593        if ("terminated".equals(codeString))
594          return ContractPublicationStatus.TERMINATED;
595        throw new IllegalArgumentException("Unknown ContractPublicationStatus code '"+codeString+"'");
596        }
597        public Enumeration<ContractPublicationStatus> fromType(Base code) throws FHIRException {
598          if (code == null)
599            return null;
600          if (code.isEmpty())
601            return new Enumeration<ContractPublicationStatus>(this);
602          String codeString = ((PrimitiveType) code).asStringValue();
603          if (codeString == null || "".equals(codeString))
604            return null;
605        if ("amended".equals(codeString))
606          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.AMENDED);
607        if ("appended".equals(codeString))
608          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.APPENDED);
609        if ("cancelled".equals(codeString))
610          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.CANCELLED);
611        if ("disputed".equals(codeString))
612          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.DISPUTED);
613        if ("entered-in-error".equals(codeString))
614          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.ENTEREDINERROR);
615        if ("executable".equals(codeString))
616          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTABLE);
617        if ("executed".equals(codeString))
618          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTED);
619        if ("negotiable".equals(codeString))
620          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NEGOTIABLE);
621        if ("offered".equals(codeString))
622          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.OFFERED);
623        if ("policy".equals(codeString))
624          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.POLICY);
625        if ("rejected".equals(codeString))
626          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REJECTED);
627        if ("renewed".equals(codeString))
628          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RENEWED);
629        if ("revoked".equals(codeString))
630          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REVOKED);
631        if ("resolved".equals(codeString))
632          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RESOLVED);
633        if ("terminated".equals(codeString))
634          return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.TERMINATED);
635        throw new FHIRException("Unknown ContractPublicationStatus code '"+codeString+"'");
636        }
637    public String toCode(ContractPublicationStatus code) {
638      if (code == ContractPublicationStatus.AMENDED)
639        return "amended";
640      if (code == ContractPublicationStatus.APPENDED)
641        return "appended";
642      if (code == ContractPublicationStatus.CANCELLED)
643        return "cancelled";
644      if (code == ContractPublicationStatus.DISPUTED)
645        return "disputed";
646      if (code == ContractPublicationStatus.ENTEREDINERROR)
647        return "entered-in-error";
648      if (code == ContractPublicationStatus.EXECUTABLE)
649        return "executable";
650      if (code == ContractPublicationStatus.EXECUTED)
651        return "executed";
652      if (code == ContractPublicationStatus.NEGOTIABLE)
653        return "negotiable";
654      if (code == ContractPublicationStatus.OFFERED)
655        return "offered";
656      if (code == ContractPublicationStatus.POLICY)
657        return "policy";
658      if (code == ContractPublicationStatus.REJECTED)
659        return "rejected";
660      if (code == ContractPublicationStatus.RENEWED)
661        return "renewed";
662      if (code == ContractPublicationStatus.REVOKED)
663        return "revoked";
664      if (code == ContractPublicationStatus.RESOLVED)
665        return "resolved";
666      if (code == ContractPublicationStatus.TERMINATED)
667        return "terminated";
668      return "?";
669      }
670    public String toSystem(ContractPublicationStatus code) {
671      return code.getSystem();
672      }
673    }
674
675    @Block()
676    public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
677        /**
678         * 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.
679         */
680        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
681        @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." )
682        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-type")
683        protected CodeableConcept type;
684
685        /**
686         * Detailed Precusory content type.
687         */
688        @Child(name = "subType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
689        @Description(shortDefinition="Detailed Content Type Definition", formalDefinition="Detailed Precusory content type." )
690        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-definition-subtype")
691        protected CodeableConcept subType;
692
693        /**
694         * The  individual or organization that published the Contract precursor content.
695         */
696        @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
697        @Description(shortDefinition="Publisher Entity", formalDefinition="The  individual or organization that published the Contract precursor content." )
698        protected Reference publisher;
699
700        /**
701         * 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.
702         */
703        @Child(name = "publicationDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
704        @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." )
705        protected DateTimeType publicationDate;
706
707        /**
708         * amended | appended | cancelled | disputed | entered-in-error | executable +.
709         */
710        @Child(name = "publicationStatus", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=false)
711        @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +", formalDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +." )
712        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-publicationstatus")
713        protected Enumeration<ContractPublicationStatus> publicationStatus;
714
715        /**
716         * A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.
717         */
718        @Child(name = "copyright", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=false)
719        @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." )
720        protected MarkdownType copyright;
721
722        private static final long serialVersionUID = -1586317331L;
723
724    /**
725     * Constructor
726     */
727      public ContentDefinitionComponent() {
728        super();
729      }
730
731    /**
732     * Constructor
733     */
734      public ContentDefinitionComponent(CodeableConcept type, Enumeration<ContractPublicationStatus> publicationStatus) {
735        super();
736        this.type = type;
737        this.publicationStatus = publicationStatus;
738      }
739
740        /**
741         * @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.)
742         */
743        public CodeableConcept getType() { 
744          if (this.type == null)
745            if (Configuration.errorOnAutoCreate())
746              throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
747            else if (Configuration.doAutoCreate())
748              this.type = new CodeableConcept(); // cc
749          return this.type;
750        }
751
752        public boolean hasType() { 
753          return this.type != null && !this.type.isEmpty();
754        }
755
756        /**
757         * @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.)
758         */
759        public ContentDefinitionComponent setType(CodeableConcept value) { 
760          this.type = value;
761          return this;
762        }
763
764        /**
765         * @return {@link #subType} (Detailed Precusory content type.)
766         */
767        public CodeableConcept getSubType() { 
768          if (this.subType == null)
769            if (Configuration.errorOnAutoCreate())
770              throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
771            else if (Configuration.doAutoCreate())
772              this.subType = new CodeableConcept(); // cc
773          return this.subType;
774        }
775
776        public boolean hasSubType() { 
777          return this.subType != null && !this.subType.isEmpty();
778        }
779
780        /**
781         * @param value {@link #subType} (Detailed Precusory content type.)
782         */
783        public ContentDefinitionComponent setSubType(CodeableConcept value) { 
784          this.subType = value;
785          return this;
786        }
787
788        /**
789         * @return {@link #publisher} (The  individual or organization that published the Contract precursor content.)
790         */
791        public Reference getPublisher() { 
792          if (this.publisher == null)
793            if (Configuration.errorOnAutoCreate())
794              throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
795            else if (Configuration.doAutoCreate())
796              this.publisher = new Reference(); // cc
797          return this.publisher;
798        }
799
800        public boolean hasPublisher() { 
801          return this.publisher != null && !this.publisher.isEmpty();
802        }
803
804        /**
805         * @param value {@link #publisher} (The  individual or organization that published the Contract precursor content.)
806         */
807        public ContentDefinitionComponent setPublisher(Reference value) { 
808          this.publisher = value;
809          return this;
810        }
811
812        /**
813         * @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
814         */
815        public DateTimeType getPublicationDateElement() { 
816          if (this.publicationDate == null)
817            if (Configuration.errorOnAutoCreate())
818              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
819            else if (Configuration.doAutoCreate())
820              this.publicationDate = new DateTimeType(); // bb
821          return this.publicationDate;
822        }
823
824        public boolean hasPublicationDateElement() { 
825          return this.publicationDate != null && !this.publicationDate.isEmpty();
826        }
827
828        public boolean hasPublicationDate() { 
829          return this.publicationDate != null && !this.publicationDate.isEmpty();
830        }
831
832        /**
833         * @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
834         */
835        public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) { 
836          this.publicationDate = value;
837          return this;
838        }
839
840        /**
841         * @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.
842         */
843        public Date getPublicationDate() { 
844          return this.publicationDate == null ? null : this.publicationDate.getValue();
845        }
846
847        /**
848         * @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.
849         */
850        public ContentDefinitionComponent setPublicationDate(Date value) { 
851          if (value == null)
852            this.publicationDate = null;
853          else {
854            if (this.publicationDate == null)
855              this.publicationDate = new DateTimeType();
856            this.publicationDate.setValue(value);
857          }
858          return this;
859        }
860
861        /**
862         * @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
863         */
864        public Enumeration<ContractPublicationStatus> getPublicationStatusElement() { 
865          if (this.publicationStatus == null)
866            if (Configuration.errorOnAutoCreate())
867              throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
868            else if (Configuration.doAutoCreate())
869              this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory()); // bb
870          return this.publicationStatus;
871        }
872
873        public boolean hasPublicationStatusElement() { 
874          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
875        }
876
877        public boolean hasPublicationStatus() { 
878          return this.publicationStatus != null && !this.publicationStatus.isEmpty();
879        }
880
881        /**
882         * @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
883         */
884        public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractPublicationStatus> value) { 
885          this.publicationStatus = value;
886          return this;
887        }
888
889        /**
890         * @return amended | appended | cancelled | disputed | entered-in-error | executable +.
891         */
892        public ContractPublicationStatus getPublicationStatus() { 
893          return this.publicationStatus == null ? null : this.publicationStatus.getValue();
894        }
895
896        /**
897         * @param value amended | appended | cancelled | disputed | entered-in-error | executable +.
898         */
899        public ContentDefinitionComponent setPublicationStatus(ContractPublicationStatus value) { 
900            if (this.publicationStatus == null)
901              this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory());
902            this.publicationStatus.setValue(value);
903          return this;
904        }
905
906        /**
907         * @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
908         */
909        public MarkdownType getCopyrightElement() { 
910          if (this.copyright == null)
911            if (Configuration.errorOnAutoCreate())
912              throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
913            else if (Configuration.doAutoCreate())
914              this.copyright = new MarkdownType(); // bb
915          return this.copyright;
916        }
917
918        public boolean hasCopyrightElement() { 
919          return this.copyright != null && !this.copyright.isEmpty();
920        }
921
922        public boolean hasCopyright() { 
923          return this.copyright != null && !this.copyright.isEmpty();
924        }
925
926        /**
927         * @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
928         */
929        public ContentDefinitionComponent setCopyrightElement(MarkdownType value) { 
930          this.copyright = value;
931          return this;
932        }
933
934        /**
935         * @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.
936         */
937        public String getCopyright() { 
938          return this.copyright == null ? null : this.copyright.getValue();
939        }
940
941        /**
942         * @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.
943         */
944        public ContentDefinitionComponent setCopyright(String value) { 
945          if (value == null)
946            this.copyright = null;
947          else {
948            if (this.copyright == null)
949              this.copyright = new MarkdownType();
950            this.copyright.setValue(value);
951          }
952          return this;
953        }
954
955        protected void listChildren(List<Property> children) {
956          super.listChildren(children);
957          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));
958          children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
959          children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
960          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));
961          children.add(new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus));
962          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));
963        }
964
965        @Override
966        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
967          switch (_hash) {
968          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);
969          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType);
970          case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
971          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);
972          case 616500542: /*publicationStatus*/  return new Property("publicationStatus", "code", "amended | appended | cancelled | disputed | entered-in-error | executable +.", 0, 1, publicationStatus);
973          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);
974          default: return super.getNamedProperty(_hash, _name, _checkValid);
975          }
976
977        }
978
979      @Override
980      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
981        switch (hash) {
982        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
983        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
984        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
985        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateTimeType
986        case 616500542: /*publicationStatus*/ return this.publicationStatus == null ? new Base[0] : new Base[] {this.publicationStatus}; // Enumeration<ContractPublicationStatus>
987        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
988        default: return super.getProperty(hash, name, checkValid);
989        }
990
991      }
992
993      @Override
994      public Base setProperty(int hash, String name, Base value) throws FHIRException {
995        switch (hash) {
996        case 3575610: // type
997          this.type = castToCodeableConcept(value); // CodeableConcept
998          return value;
999        case -1868521062: // subType
1000          this.subType = castToCodeableConcept(value); // CodeableConcept
1001          return value;
1002        case 1447404028: // publisher
1003          this.publisher = castToReference(value); // Reference
1004          return value;
1005        case 1470566394: // publicationDate
1006          this.publicationDate = castToDateTime(value); // DateTimeType
1007          return value;
1008        case 616500542: // publicationStatus
1009          value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1010          this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1011          return value;
1012        case 1522889671: // copyright
1013          this.copyright = castToMarkdown(value); // MarkdownType
1014          return value;
1015        default: return super.setProperty(hash, name, value);
1016        }
1017
1018      }
1019
1020      @Override
1021      public Base setProperty(String name, Base value) throws FHIRException {
1022        if (name.equals("type")) {
1023          this.type = castToCodeableConcept(value); // CodeableConcept
1024        } else if (name.equals("subType")) {
1025          this.subType = castToCodeableConcept(value); // CodeableConcept
1026        } else if (name.equals("publisher")) {
1027          this.publisher = castToReference(value); // Reference
1028        } else if (name.equals("publicationDate")) {
1029          this.publicationDate = castToDateTime(value); // DateTimeType
1030        } else if (name.equals("publicationStatus")) {
1031          value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1032          this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1033        } else if (name.equals("copyright")) {
1034          this.copyright = castToMarkdown(value); // MarkdownType
1035        } else
1036          return super.setProperty(name, value);
1037        return value;
1038      }
1039
1040      @Override
1041      public Base makeProperty(int hash, String name) throws FHIRException {
1042        switch (hash) {
1043        case 3575610:  return getType();
1044        case -1868521062:  return getSubType();
1045        case 1447404028:  return getPublisher();
1046        case 1470566394:  return getPublicationDateElement();
1047        case 616500542:  return getPublicationStatusElement();
1048        case 1522889671:  return getCopyrightElement();
1049        default: return super.makeProperty(hash, name);
1050        }
1051
1052      }
1053
1054      @Override
1055      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1056        switch (hash) {
1057        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1058        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1059        case 1447404028: /*publisher*/ return new String[] {"Reference"};
1060        case 1470566394: /*publicationDate*/ return new String[] {"dateTime"};
1061        case 616500542: /*publicationStatus*/ return new String[] {"code"};
1062        case 1522889671: /*copyright*/ return new String[] {"markdown"};
1063        default: return super.getTypesForProperty(hash, name);
1064        }
1065
1066      }
1067
1068      @Override
1069      public Base addChild(String name) throws FHIRException {
1070        if (name.equals("type")) {
1071          this.type = new CodeableConcept();
1072          return this.type;
1073        }
1074        else if (name.equals("subType")) {
1075          this.subType = new CodeableConcept();
1076          return this.subType;
1077        }
1078        else if (name.equals("publisher")) {
1079          this.publisher = new Reference();
1080          return this.publisher;
1081        }
1082        else if (name.equals("publicationDate")) {
1083          throw new FHIRException("Cannot call addChild on a primitive type Contract.publicationDate");
1084        }
1085        else if (name.equals("publicationStatus")) {
1086          throw new FHIRException("Cannot call addChild on a primitive type Contract.publicationStatus");
1087        }
1088        else if (name.equals("copyright")) {
1089          throw new FHIRException("Cannot call addChild on a primitive type Contract.copyright");
1090        }
1091        else
1092          return super.addChild(name);
1093      }
1094
1095      public ContentDefinitionComponent copy() {
1096        ContentDefinitionComponent dst = new ContentDefinitionComponent();
1097        copyValues(dst);
1098        return dst;
1099      }
1100
1101      public void copyValues(ContentDefinitionComponent dst) {
1102        super.copyValues(dst);
1103        dst.type = type == null ? null : type.copy();
1104        dst.subType = subType == null ? null : subType.copy();
1105        dst.publisher = publisher == null ? null : publisher.copy();
1106        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1107        dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1108        dst.copyright = copyright == null ? null : copyright.copy();
1109      }
1110
1111      @Override
1112      public boolean equalsDeep(Base other_) {
1113        if (!super.equalsDeep(other_))
1114          return false;
1115        if (!(other_ instanceof ContentDefinitionComponent))
1116          return false;
1117        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1118        return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(publisher, o.publisher, true)
1119           && compareDeep(publicationDate, o.publicationDate, true) && compareDeep(publicationStatus, o.publicationStatus, true)
1120           && compareDeep(copyright, o.copyright, true);
1121      }
1122
1123      @Override
1124      public boolean equalsShallow(Base other_) {
1125        if (!super.equalsShallow(other_))
1126          return false;
1127        if (!(other_ instanceof ContentDefinitionComponent))
1128          return false;
1129        ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1130        return compareValues(publicationDate, o.publicationDate, true) && compareValues(publicationStatus, o.publicationStatus, true)
1131           && compareValues(copyright, o.copyright, true);
1132      }
1133
1134      public boolean isEmpty() {
1135        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher
1136          , publicationDate, publicationStatus, copyright);
1137      }
1138
1139  public String fhirType() {
1140    return "Contract.contentDefinition";
1141
1142  }
1143
1144  }
1145
1146    @Block()
1147    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1148        /**
1149         * Unique identifier for this particular Contract Provision.
1150         */
1151        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1152        @Description(shortDefinition="Contract Term Number", formalDefinition="Unique identifier for this particular Contract Provision." )
1153        protected Identifier identifier;
1154
1155        /**
1156         * When this Contract Provision was issued.
1157         */
1158        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1159        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
1160        protected DateTimeType issued;
1161
1162        /**
1163         * Relevant time or time-period when this Contract Provision is applicable.
1164         */
1165        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
1166        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
1167        protected Period applies;
1168
1169        /**
1170         * The entity that the term applies to.
1171         */
1172        @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=4, min=0, max=1, modifier=false, summary=false)
1173        @Description(shortDefinition="Term Concern", formalDefinition="The entity that the term applies to." )
1174        protected Type topic;
1175
1176        /**
1177         * 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.
1178         */
1179        @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1180        @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." )
1181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
1182        protected CodeableConcept type;
1183
1184        /**
1185         * A specialized legal clause or condition based on overarching contract type.
1186         */
1187        @Child(name = "subType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1188        @Description(shortDefinition="Contract Term Type specific classification", formalDefinition="A specialized legal clause or condition based on overarching contract type." )
1189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-subtype")
1190        protected CodeableConcept subType;
1191
1192        /**
1193         * Statement of a provision in a policy or a contract.
1194         */
1195        @Child(name = "text", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1196        @Description(shortDefinition="Term Statement", formalDefinition="Statement of a provision in a policy or a contract." )
1197        protected StringType text;
1198
1199        /**
1200         * Security labels that protect the handling of information about the term and its elements, which may be specifically identified..
1201         */
1202        @Child(name = "securityLabel", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1203        @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.." )
1204        protected List<SecurityLabelComponent> securityLabel;
1205
1206        /**
1207         * The matter of concern in the context of this provision of the agrement.
1208         */
1209        @Child(name = "offer", type = {}, order=9, min=1, max=1, modifier=false, summary=false)
1210        @Description(shortDefinition="Context of the Contract term", formalDefinition="The matter of concern in the context of this provision of the agrement." )
1211        protected ContractOfferComponent offer;
1212
1213        /**
1214         * Contract Term Asset List.
1215         */
1216        @Child(name = "asset", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1217        @Description(shortDefinition="Contract Term Asset List", formalDefinition="Contract Term Asset List." )
1218        protected List<ContractAssetComponent> asset;
1219
1220        /**
1221         * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.
1222         */
1223        @Child(name = "action", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1224        @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." )
1225        protected List<ActionComponent> action;
1226
1227        /**
1228         * Nested group of Contract Provisions.
1229         */
1230        @Child(name = "group", type = {TermComponent.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1231        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1232        protected List<TermComponent> group;
1233
1234        private static final long serialVersionUID = -460907186L;
1235
1236    /**
1237     * Constructor
1238     */
1239      public TermComponent() {
1240        super();
1241      }
1242
1243    /**
1244     * Constructor
1245     */
1246      public TermComponent(ContractOfferComponent offer) {
1247        super();
1248        this.offer = offer;
1249      }
1250
1251        /**
1252         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1253         */
1254        public Identifier getIdentifier() { 
1255          if (this.identifier == null)
1256            if (Configuration.errorOnAutoCreate())
1257              throw new Error("Attempt to auto-create TermComponent.identifier");
1258            else if (Configuration.doAutoCreate())
1259              this.identifier = new Identifier(); // cc
1260          return this.identifier;
1261        }
1262
1263        public boolean hasIdentifier() { 
1264          return this.identifier != null && !this.identifier.isEmpty();
1265        }
1266
1267        /**
1268         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1269         */
1270        public TermComponent setIdentifier(Identifier value) { 
1271          this.identifier = value;
1272          return this;
1273        }
1274
1275        /**
1276         * @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
1277         */
1278        public DateTimeType getIssuedElement() { 
1279          if (this.issued == null)
1280            if (Configuration.errorOnAutoCreate())
1281              throw new Error("Attempt to auto-create TermComponent.issued");
1282            else if (Configuration.doAutoCreate())
1283              this.issued = new DateTimeType(); // bb
1284          return this.issued;
1285        }
1286
1287        public boolean hasIssuedElement() { 
1288          return this.issued != null && !this.issued.isEmpty();
1289        }
1290
1291        public boolean hasIssued() { 
1292          return this.issued != null && !this.issued.isEmpty();
1293        }
1294
1295        /**
1296         * @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
1297         */
1298        public TermComponent setIssuedElement(DateTimeType value) { 
1299          this.issued = value;
1300          return this;
1301        }
1302
1303        /**
1304         * @return When this Contract Provision was issued.
1305         */
1306        public Date getIssued() { 
1307          return this.issued == null ? null : this.issued.getValue();
1308        }
1309
1310        /**
1311         * @param value When this Contract Provision was issued.
1312         */
1313        public TermComponent setIssued(Date value) { 
1314          if (value == null)
1315            this.issued = null;
1316          else {
1317            if (this.issued == null)
1318              this.issued = new DateTimeType();
1319            this.issued.setValue(value);
1320          }
1321          return this;
1322        }
1323
1324        /**
1325         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1326         */
1327        public Period getApplies() { 
1328          if (this.applies == null)
1329            if (Configuration.errorOnAutoCreate())
1330              throw new Error("Attempt to auto-create TermComponent.applies");
1331            else if (Configuration.doAutoCreate())
1332              this.applies = new Period(); // cc
1333          return this.applies;
1334        }
1335
1336        public boolean hasApplies() { 
1337          return this.applies != null && !this.applies.isEmpty();
1338        }
1339
1340        /**
1341         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1342         */
1343        public TermComponent setApplies(Period value) { 
1344          this.applies = value;
1345          return this;
1346        }
1347
1348        /**
1349         * @return {@link #topic} (The entity that the term applies to.)
1350         */
1351        public Type getTopic() { 
1352          return this.topic;
1353        }
1354
1355        /**
1356         * @return {@link #topic} (The entity that the term applies to.)
1357         */
1358        public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
1359          if (this.topic == null)
1360            this.topic = new CodeableConcept();
1361          if (!(this.topic instanceof CodeableConcept))
1362            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
1363          return (CodeableConcept) this.topic;
1364        }
1365
1366        public boolean hasTopicCodeableConcept() { 
1367          return this != null && this.topic instanceof CodeableConcept;
1368        }
1369
1370        /**
1371         * @return {@link #topic} (The entity that the term applies to.)
1372         */
1373        public Reference getTopicReference() throws FHIRException { 
1374          if (this.topic == null)
1375            this.topic = new Reference();
1376          if (!(this.topic instanceof Reference))
1377            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
1378          return (Reference) this.topic;
1379        }
1380
1381        public boolean hasTopicReference() { 
1382          return this != null && this.topic instanceof Reference;
1383        }
1384
1385        public boolean hasTopic() { 
1386          return this.topic != null && !this.topic.isEmpty();
1387        }
1388
1389        /**
1390         * @param value {@link #topic} (The entity that the term applies to.)
1391         */
1392        public TermComponent setTopic(Type value) { 
1393          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1394            throw new Error("Not the right type for Contract.term.topic[x]: "+value.fhirType());
1395          this.topic = value;
1396          return this;
1397        }
1398
1399        /**
1400         * @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.)
1401         */
1402        public CodeableConcept getType() { 
1403          if (this.type == null)
1404            if (Configuration.errorOnAutoCreate())
1405              throw new Error("Attempt to auto-create TermComponent.type");
1406            else if (Configuration.doAutoCreate())
1407              this.type = new CodeableConcept(); // cc
1408          return this.type;
1409        }
1410
1411        public boolean hasType() { 
1412          return this.type != null && !this.type.isEmpty();
1413        }
1414
1415        /**
1416         * @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.)
1417         */
1418        public TermComponent setType(CodeableConcept value) { 
1419          this.type = value;
1420          return this;
1421        }
1422
1423        /**
1424         * @return {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1425         */
1426        public CodeableConcept getSubType() { 
1427          if (this.subType == null)
1428            if (Configuration.errorOnAutoCreate())
1429              throw new Error("Attempt to auto-create TermComponent.subType");
1430            else if (Configuration.doAutoCreate())
1431              this.subType = new CodeableConcept(); // cc
1432          return this.subType;
1433        }
1434
1435        public boolean hasSubType() { 
1436          return this.subType != null && !this.subType.isEmpty();
1437        }
1438
1439        /**
1440         * @param value {@link #subType} (A specialized legal clause or condition based on overarching contract type.)
1441         */
1442        public TermComponent setSubType(CodeableConcept value) { 
1443          this.subType = value;
1444          return this;
1445        }
1446
1447        /**
1448         * @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
1449         */
1450        public StringType getTextElement() { 
1451          if (this.text == null)
1452            if (Configuration.errorOnAutoCreate())
1453              throw new Error("Attempt to auto-create TermComponent.text");
1454            else if (Configuration.doAutoCreate())
1455              this.text = new StringType(); // bb
1456          return this.text;
1457        }
1458
1459        public boolean hasTextElement() { 
1460          return this.text != null && !this.text.isEmpty();
1461        }
1462
1463        public boolean hasText() { 
1464          return this.text != null && !this.text.isEmpty();
1465        }
1466
1467        /**
1468         * @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
1469         */
1470        public TermComponent setTextElement(StringType value) { 
1471          this.text = value;
1472          return this;
1473        }
1474
1475        /**
1476         * @return Statement of a provision in a policy or a contract.
1477         */
1478        public String getText() { 
1479          return this.text == null ? null : this.text.getValue();
1480        }
1481
1482        /**
1483         * @param value Statement of a provision in a policy or a contract.
1484         */
1485        public TermComponent setText(String value) { 
1486          if (Utilities.noString(value))
1487            this.text = null;
1488          else {
1489            if (this.text == null)
1490              this.text = new StringType();
1491            this.text.setValue(value);
1492          }
1493          return this;
1494        }
1495
1496        /**
1497         * @return {@link #securityLabel} (Security labels that protect the handling of information about the term and its elements, which may be specifically identified..)
1498         */
1499        public List<SecurityLabelComponent> getSecurityLabel() { 
1500          if (this.securityLabel == null)
1501            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1502          return this.securityLabel;
1503        }
1504
1505        /**
1506         * @return Returns a reference to <code>this</code> for easy method chaining
1507         */
1508        public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) { 
1509          this.securityLabel = theSecurityLabel;
1510          return this;
1511        }
1512
1513        public boolean hasSecurityLabel() { 
1514          if (this.securityLabel == null)
1515            return false;
1516          for (SecurityLabelComponent item : this.securityLabel)
1517            if (!item.isEmpty())
1518              return true;
1519          return false;
1520        }
1521
1522        public SecurityLabelComponent addSecurityLabel() { //3
1523          SecurityLabelComponent t = new SecurityLabelComponent();
1524          if (this.securityLabel == null)
1525            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1526          this.securityLabel.add(t);
1527          return t;
1528        }
1529
1530        public TermComponent addSecurityLabel(SecurityLabelComponent t) { //3
1531          if (t == null)
1532            return this;
1533          if (this.securityLabel == null)
1534            this.securityLabel = new ArrayList<SecurityLabelComponent>();
1535          this.securityLabel.add(t);
1536          return this;
1537        }
1538
1539        /**
1540         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
1541         */
1542        public SecurityLabelComponent getSecurityLabelFirstRep() { 
1543          if (getSecurityLabel().isEmpty()) {
1544            addSecurityLabel();
1545          }
1546          return getSecurityLabel().get(0);
1547        }
1548
1549        /**
1550         * @return {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1551         */
1552        public ContractOfferComponent getOffer() { 
1553          if (this.offer == null)
1554            if (Configuration.errorOnAutoCreate())
1555              throw new Error("Attempt to auto-create TermComponent.offer");
1556            else if (Configuration.doAutoCreate())
1557              this.offer = new ContractOfferComponent(); // cc
1558          return this.offer;
1559        }
1560
1561        public boolean hasOffer() { 
1562          return this.offer != null && !this.offer.isEmpty();
1563        }
1564
1565        /**
1566         * @param value {@link #offer} (The matter of concern in the context of this provision of the agrement.)
1567         */
1568        public TermComponent setOffer(ContractOfferComponent value) { 
1569          this.offer = value;
1570          return this;
1571        }
1572
1573        /**
1574         * @return {@link #asset} (Contract Term Asset List.)
1575         */
1576        public List<ContractAssetComponent> getAsset() { 
1577          if (this.asset == null)
1578            this.asset = new ArrayList<ContractAssetComponent>();
1579          return this.asset;
1580        }
1581
1582        /**
1583         * @return Returns a reference to <code>this</code> for easy method chaining
1584         */
1585        public TermComponent setAsset(List<ContractAssetComponent> theAsset) { 
1586          this.asset = theAsset;
1587          return this;
1588        }
1589
1590        public boolean hasAsset() { 
1591          if (this.asset == null)
1592            return false;
1593          for (ContractAssetComponent item : this.asset)
1594            if (!item.isEmpty())
1595              return true;
1596          return false;
1597        }
1598
1599        public ContractAssetComponent addAsset() { //3
1600          ContractAssetComponent t = new ContractAssetComponent();
1601          if (this.asset == null)
1602            this.asset = new ArrayList<ContractAssetComponent>();
1603          this.asset.add(t);
1604          return t;
1605        }
1606
1607        public TermComponent addAsset(ContractAssetComponent t) { //3
1608          if (t == null)
1609            return this;
1610          if (this.asset == null)
1611            this.asset = new ArrayList<ContractAssetComponent>();
1612          this.asset.add(t);
1613          return this;
1614        }
1615
1616        /**
1617         * @return The first repetition of repeating field {@link #asset}, creating it if it does not already exist
1618         */
1619        public ContractAssetComponent getAssetFirstRep() { 
1620          if (getAsset().isEmpty()) {
1621            addAsset();
1622          }
1623          return getAsset().get(0);
1624        }
1625
1626        /**
1627         * @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.)
1628         */
1629        public List<ActionComponent> getAction() { 
1630          if (this.action == null)
1631            this.action = new ArrayList<ActionComponent>();
1632          return this.action;
1633        }
1634
1635        /**
1636         * @return Returns a reference to <code>this</code> for easy method chaining
1637         */
1638        public TermComponent setAction(List<ActionComponent> theAction) { 
1639          this.action = theAction;
1640          return this;
1641        }
1642
1643        public boolean hasAction() { 
1644          if (this.action == null)
1645            return false;
1646          for (ActionComponent item : this.action)
1647            if (!item.isEmpty())
1648              return true;
1649          return false;
1650        }
1651
1652        public ActionComponent addAction() { //3
1653          ActionComponent t = new ActionComponent();
1654          if (this.action == null)
1655            this.action = new ArrayList<ActionComponent>();
1656          this.action.add(t);
1657          return t;
1658        }
1659
1660        public TermComponent addAction(ActionComponent t) { //3
1661          if (t == null)
1662            return this;
1663          if (this.action == null)
1664            this.action = new ArrayList<ActionComponent>();
1665          this.action.add(t);
1666          return this;
1667        }
1668
1669        /**
1670         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
1671         */
1672        public ActionComponent getActionFirstRep() { 
1673          if (getAction().isEmpty()) {
1674            addAction();
1675          }
1676          return getAction().get(0);
1677        }
1678
1679        /**
1680         * @return {@link #group} (Nested group of Contract Provisions.)
1681         */
1682        public List<TermComponent> getGroup() { 
1683          if (this.group == null)
1684            this.group = new ArrayList<TermComponent>();
1685          return this.group;
1686        }
1687
1688        /**
1689         * @return Returns a reference to <code>this</code> for easy method chaining
1690         */
1691        public TermComponent setGroup(List<TermComponent> theGroup) { 
1692          this.group = theGroup;
1693          return this;
1694        }
1695
1696        public boolean hasGroup() { 
1697          if (this.group == null)
1698            return false;
1699          for (TermComponent item : this.group)
1700            if (!item.isEmpty())
1701              return true;
1702          return false;
1703        }
1704
1705        public TermComponent addGroup() { //3
1706          TermComponent t = new TermComponent();
1707          if (this.group == null)
1708            this.group = new ArrayList<TermComponent>();
1709          this.group.add(t);
1710          return t;
1711        }
1712
1713        public TermComponent addGroup(TermComponent t) { //3
1714          if (t == null)
1715            return this;
1716          if (this.group == null)
1717            this.group = new ArrayList<TermComponent>();
1718          this.group.add(t);
1719          return this;
1720        }
1721
1722        /**
1723         * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
1724         */
1725        public TermComponent getGroupFirstRep() { 
1726          if (getGroup().isEmpty()) {
1727            addGroup();
1728          }
1729          return getGroup().get(0);
1730        }
1731
1732        protected void listChildren(List<Property> children) {
1733          super.listChildren(children);
1734          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier));
1735          children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
1736          children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
1737          children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic));
1738          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));
1739          children.add(new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
1740          children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
1741          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));
1742          children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer));
1743          children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
1744          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));
1745          children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
1746        }
1747
1748        @Override
1749        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1750          switch (_hash) {
1751          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
1752          case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued);
1753          case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
1754          case -957295375: /*topic[x]*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1755          case 110546223: /*topic*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1756          case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1757          case -343345444: /*topicReference*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0, 1, topic);
1758          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);
1759          case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
1760          case 3556653: /*text*/  return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text);
1761          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);
1762          case 105650780: /*offer*/  return new Property("offer", "", "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
1763          case 93121264: /*asset*/  return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset);
1764          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);
1765          case 98629247: /*group*/  return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group);
1766          default: return super.getNamedProperty(_hash, _name, _checkValid);
1767          }
1768
1769        }
1770
1771      @Override
1772      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1773        switch (hash) {
1774        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1775        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
1776        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
1777        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Type
1778        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1779        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
1780        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1781        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
1782        case 105650780: /*offer*/ return this.offer == null ? new Base[0] : new Base[] {this.offer}; // ContractOfferComponent
1783        case 93121264: /*asset*/ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
1784        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
1785        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
1786        default: return super.getProperty(hash, name, checkValid);
1787        }
1788
1789      }
1790
1791      @Override
1792      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1793        switch (hash) {
1794        case -1618432855: // identifier
1795          this.identifier = castToIdentifier(value); // Identifier
1796          return value;
1797        case -1179159893: // issued
1798          this.issued = castToDateTime(value); // DateTimeType
1799          return value;
1800        case -793235316: // applies
1801          this.applies = castToPeriod(value); // Period
1802          return value;
1803        case 110546223: // topic
1804          this.topic = castToType(value); // Type
1805          return value;
1806        case 3575610: // type
1807          this.type = castToCodeableConcept(value); // CodeableConcept
1808          return value;
1809        case -1868521062: // subType
1810          this.subType = castToCodeableConcept(value); // CodeableConcept
1811          return value;
1812        case 3556653: // text
1813          this.text = castToString(value); // StringType
1814          return value;
1815        case -722296940: // securityLabel
1816          this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
1817          return value;
1818        case 105650780: // offer
1819          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1820          return value;
1821        case 93121264: // asset
1822          this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
1823          return value;
1824        case -1422950858: // action
1825          this.getAction().add((ActionComponent) value); // ActionComponent
1826          return value;
1827        case 98629247: // group
1828          this.getGroup().add((TermComponent) value); // TermComponent
1829          return value;
1830        default: return super.setProperty(hash, name, value);
1831        }
1832
1833      }
1834
1835      @Override
1836      public Base setProperty(String name, Base value) throws FHIRException {
1837        if (name.equals("identifier")) {
1838          this.identifier = castToIdentifier(value); // Identifier
1839        } else if (name.equals("issued")) {
1840          this.issued = castToDateTime(value); // DateTimeType
1841        } else if (name.equals("applies")) {
1842          this.applies = castToPeriod(value); // Period
1843        } else if (name.equals("topic[x]")) {
1844          this.topic = castToType(value); // Type
1845        } else if (name.equals("type")) {
1846          this.type = castToCodeableConcept(value); // CodeableConcept
1847        } else if (name.equals("subType")) {
1848          this.subType = castToCodeableConcept(value); // CodeableConcept
1849        } else if (name.equals("text")) {
1850          this.text = castToString(value); // StringType
1851        } else if (name.equals("securityLabel")) {
1852          this.getSecurityLabel().add((SecurityLabelComponent) value);
1853        } else if (name.equals("offer")) {
1854          this.offer = (ContractOfferComponent) value; // ContractOfferComponent
1855        } else if (name.equals("asset")) {
1856          this.getAsset().add((ContractAssetComponent) value);
1857        } else if (name.equals("action")) {
1858          this.getAction().add((ActionComponent) value);
1859        } else if (name.equals("group")) {
1860          this.getGroup().add((TermComponent) value);
1861        } else
1862          return super.setProperty(name, value);
1863        return value;
1864      }
1865
1866      @Override
1867      public Base makeProperty(int hash, String name) throws FHIRException {
1868        switch (hash) {
1869        case -1618432855:  return getIdentifier();
1870        case -1179159893:  return getIssuedElement();
1871        case -793235316:  return getApplies();
1872        case -957295375:  return getTopic();
1873        case 110546223:  return getTopic();
1874        case 3575610:  return getType();
1875        case -1868521062:  return getSubType();
1876        case 3556653:  return getTextElement();
1877        case -722296940:  return addSecurityLabel(); 
1878        case 105650780:  return getOffer();
1879        case 93121264:  return addAsset(); 
1880        case -1422950858:  return addAction(); 
1881        case 98629247:  return addGroup(); 
1882        default: return super.makeProperty(hash, name);
1883        }
1884
1885      }
1886
1887      @Override
1888      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1889        switch (hash) {
1890        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1891        case -1179159893: /*issued*/ return new String[] {"dateTime"};
1892        case -793235316: /*applies*/ return new String[] {"Period"};
1893        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
1894        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1895        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
1896        case 3556653: /*text*/ return new String[] {"string"};
1897        case -722296940: /*securityLabel*/ return new String[] {};
1898        case 105650780: /*offer*/ return new String[] {};
1899        case 93121264: /*asset*/ return new String[] {};
1900        case -1422950858: /*action*/ return new String[] {};
1901        case 98629247: /*group*/ return new String[] {"@Contract.term"};
1902        default: return super.getTypesForProperty(hash, name);
1903        }
1904
1905      }
1906
1907      @Override
1908      public Base addChild(String name) throws FHIRException {
1909        if (name.equals("identifier")) {
1910          this.identifier = new Identifier();
1911          return this.identifier;
1912        }
1913        else if (name.equals("issued")) {
1914          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
1915        }
1916        else if (name.equals("applies")) {
1917          this.applies = new Period();
1918          return this.applies;
1919        }
1920        else if (name.equals("topicCodeableConcept")) {
1921          this.topic = new CodeableConcept();
1922          return this.topic;
1923        }
1924        else if (name.equals("topicReference")) {
1925          this.topic = new Reference();
1926          return this.topic;
1927        }
1928        else if (name.equals("type")) {
1929          this.type = new CodeableConcept();
1930          return this.type;
1931        }
1932        else if (name.equals("subType")) {
1933          this.subType = new CodeableConcept();
1934          return this.subType;
1935        }
1936        else if (name.equals("text")) {
1937          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
1938        }
1939        else if (name.equals("securityLabel")) {
1940          return addSecurityLabel();
1941        }
1942        else if (name.equals("offer")) {
1943          this.offer = new ContractOfferComponent();
1944          return this.offer;
1945        }
1946        else if (name.equals("asset")) {
1947          return addAsset();
1948        }
1949        else if (name.equals("action")) {
1950          return addAction();
1951        }
1952        else if (name.equals("group")) {
1953          return addGroup();
1954        }
1955        else
1956          return super.addChild(name);
1957      }
1958
1959      public TermComponent copy() {
1960        TermComponent dst = new TermComponent();
1961        copyValues(dst);
1962        return dst;
1963      }
1964
1965      public void copyValues(TermComponent dst) {
1966        super.copyValues(dst);
1967        dst.identifier = identifier == null ? null : identifier.copy();
1968        dst.issued = issued == null ? null : issued.copy();
1969        dst.applies = applies == null ? null : applies.copy();
1970        dst.topic = topic == null ? null : topic.copy();
1971        dst.type = type == null ? null : type.copy();
1972        dst.subType = subType == null ? null : subType.copy();
1973        dst.text = text == null ? null : text.copy();
1974        if (securityLabel != null) {
1975          dst.securityLabel = new ArrayList<SecurityLabelComponent>();
1976          for (SecurityLabelComponent i : securityLabel)
1977            dst.securityLabel.add(i.copy());
1978        };
1979        dst.offer = offer == null ? null : offer.copy();
1980        if (asset != null) {
1981          dst.asset = new ArrayList<ContractAssetComponent>();
1982          for (ContractAssetComponent i : asset)
1983            dst.asset.add(i.copy());
1984        };
1985        if (action != null) {
1986          dst.action = new ArrayList<ActionComponent>();
1987          for (ActionComponent i : action)
1988            dst.action.add(i.copy());
1989        };
1990        if (group != null) {
1991          dst.group = new ArrayList<TermComponent>();
1992          for (TermComponent i : group)
1993            dst.group.add(i.copy());
1994        };
1995      }
1996
1997      @Override
1998      public boolean equalsDeep(Base other_) {
1999        if (!super.equalsDeep(other_))
2000          return false;
2001        if (!(other_ instanceof TermComponent))
2002          return false;
2003        TermComponent o = (TermComponent) other_;
2004        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
2005           && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
2006           && compareDeep(text, o.text, true) && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
2007           && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true) && compareDeep(group, o.group, true)
2008          ;
2009      }
2010
2011      @Override
2012      public boolean equalsShallow(Base other_) {
2013        if (!super.equalsShallow(other_))
2014          return false;
2015        if (!(other_ instanceof TermComponent))
2016          return false;
2017        TermComponent o = (TermComponent) other_;
2018        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2019      }
2020
2021      public boolean isEmpty() {
2022        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies
2023          , topic, type, subType, text, securityLabel, offer, asset, action, group);
2024      }
2025
2026  public String fhirType() {
2027    return "Contract.term";
2028
2029  }
2030
2031  }
2032
2033    @Block()
2034    public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2035        /**
2036         * Number used to link this term or term element to the applicable Security Label.
2037         */
2038        @Child(name = "number", type = {UnsignedIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2039        @Description(shortDefinition="Link to Security Labels", formalDefinition="Number used to link this term or term element to the applicable Security Label." )
2040        protected List<UnsignedIntType> number;
2041
2042        /**
2043         * Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.
2044         */
2045        @Child(name = "classification", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=false)
2046        @Description(shortDefinition="Confidentiality Protection", formalDefinition="Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements." )
2047        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-classification")
2048        protected Coding classification;
2049
2050        /**
2051         * Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.
2052         */
2053        @Child(name = "category", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2054        @Description(shortDefinition="Applicable Policy", formalDefinition="Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements." )
2055        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-category")
2056        protected List<Coding> category;
2057
2058        /**
2059         * Security label privacy tag that species the manner in which term and/or term elements are to be protected.
2060         */
2061        @Child(name = "control", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2062        @Description(shortDefinition="Handling Instructions", formalDefinition="Security label privacy tag that species the manner in which term and/or term elements are to be protected." )
2063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-security-control")
2064        protected List<Coding> control;
2065
2066        private static final long serialVersionUID = 788281758L;
2067
2068    /**
2069     * Constructor
2070     */
2071      public SecurityLabelComponent() {
2072        super();
2073      }
2074
2075    /**
2076     * Constructor
2077     */
2078      public SecurityLabelComponent(Coding classification) {
2079        super();
2080        this.classification = classification;
2081      }
2082
2083        /**
2084         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2085         */
2086        public List<UnsignedIntType> getNumber() { 
2087          if (this.number == null)
2088            this.number = new ArrayList<UnsignedIntType>();
2089          return this.number;
2090        }
2091
2092        /**
2093         * @return Returns a reference to <code>this</code> for easy method chaining
2094         */
2095        public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) { 
2096          this.number = theNumber;
2097          return this;
2098        }
2099
2100        public boolean hasNumber() { 
2101          if (this.number == null)
2102            return false;
2103          for (UnsignedIntType item : this.number)
2104            if (!item.isEmpty())
2105              return true;
2106          return false;
2107        }
2108
2109        /**
2110         * @return {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2111         */
2112        public UnsignedIntType addNumberElement() {//2 
2113          UnsignedIntType t = new UnsignedIntType();
2114          if (this.number == null)
2115            this.number = new ArrayList<UnsignedIntType>();
2116          this.number.add(t);
2117          return t;
2118        }
2119
2120        /**
2121         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2122         */
2123        public SecurityLabelComponent addNumber(int value) { //1
2124          UnsignedIntType t = new UnsignedIntType();
2125          t.setValue(value);
2126          if (this.number == null)
2127            this.number = new ArrayList<UnsignedIntType>();
2128          this.number.add(t);
2129          return this;
2130        }
2131
2132        /**
2133         * @param value {@link #number} (Number used to link this term or term element to the applicable Security Label.)
2134         */
2135        public boolean hasNumber(int value) { 
2136          if (this.number == null)
2137            return false;
2138          for (UnsignedIntType v : this.number)
2139            if (v.getValue().equals(value)) // unsignedInt
2140              return true;
2141          return false;
2142        }
2143
2144        /**
2145         * @return {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2146         */
2147        public Coding getClassification() { 
2148          if (this.classification == null)
2149            if (Configuration.errorOnAutoCreate())
2150              throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2151            else if (Configuration.doAutoCreate())
2152              this.classification = new Coding(); // cc
2153          return this.classification;
2154        }
2155
2156        public boolean hasClassification() { 
2157          return this.classification != null && !this.classification.isEmpty();
2158        }
2159
2160        /**
2161         * @param value {@link #classification} (Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.)
2162         */
2163        public SecurityLabelComponent setClassification(Coding value) { 
2164          this.classification = value;
2165          return this;
2166        }
2167
2168        /**
2169         * @return {@link #category} (Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.)
2170         */
2171        public List<Coding> getCategory() { 
2172          if (this.category == null)
2173            this.category = new ArrayList<Coding>();
2174          return this.category;
2175        }
2176
2177        /**
2178         * @return Returns a reference to <code>this</code> for easy method chaining
2179         */
2180        public SecurityLabelComponent setCategory(List<Coding> theCategory) { 
2181          this.category = theCategory;
2182          return this;
2183        }
2184
2185        public boolean hasCategory() { 
2186          if (this.category == null)
2187            return false;
2188          for (Coding item : this.category)
2189            if (!item.isEmpty())
2190              return true;
2191          return false;
2192        }
2193
2194        public Coding addCategory() { //3
2195          Coding t = new Coding();
2196          if (this.category == null)
2197            this.category = new ArrayList<Coding>();
2198          this.category.add(t);
2199          return t;
2200        }
2201
2202        public SecurityLabelComponent addCategory(Coding t) { //3
2203          if (t == null)
2204            return this;
2205          if (this.category == null)
2206            this.category = new ArrayList<Coding>();
2207          this.category.add(t);
2208          return this;
2209        }
2210
2211        /**
2212         * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
2213         */
2214        public Coding getCategoryFirstRep() { 
2215          if (getCategory().isEmpty()) {
2216            addCategory();
2217          }
2218          return getCategory().get(0);
2219        }
2220
2221        /**
2222         * @return {@link #control} (Security label privacy tag that species the manner in which term and/or term elements are to be protected.)
2223         */
2224        public List<Coding> getControl() { 
2225          if (this.control == null)
2226            this.control = new ArrayList<Coding>();
2227          return this.control;
2228        }
2229
2230        /**
2231         * @return Returns a reference to <code>this</code> for easy method chaining
2232         */
2233        public SecurityLabelComponent setControl(List<Coding> theControl) { 
2234          this.control = theControl;
2235          return this;
2236        }
2237
2238        public boolean hasControl() { 
2239          if (this.control == null)
2240            return false;
2241          for (Coding item : this.control)
2242            if (!item.isEmpty())
2243              return true;
2244          return false;
2245        }
2246
2247        public Coding addControl() { //3
2248          Coding t = new Coding();
2249          if (this.control == null)
2250            this.control = new ArrayList<Coding>();
2251          this.control.add(t);
2252          return t;
2253        }
2254
2255        public SecurityLabelComponent addControl(Coding t) { //3
2256          if (t == null)
2257            return this;
2258          if (this.control == null)
2259            this.control = new ArrayList<Coding>();
2260          this.control.add(t);
2261          return this;
2262        }
2263
2264        /**
2265         * @return The first repetition of repeating field {@link #control}, creating it if it does not already exist
2266         */
2267        public Coding getControlFirstRep() { 
2268          if (getControl().isEmpty()) {
2269            addControl();
2270          }
2271          return getControl().get(0);
2272        }
2273
2274        protected void listChildren(List<Property> children) {
2275          super.listChildren(children);
2276          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));
2277          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));
2278          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));
2279          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));
2280        }
2281
2282        @Override
2283        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2284          switch (_hash) {
2285          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);
2286          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);
2287          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);
2288          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);
2289          default: return super.getNamedProperty(_hash, _name, _checkValid);
2290          }
2291
2292        }
2293
2294      @Override
2295      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2296        switch (hash) {
2297        case -1034364087: /*number*/ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2298        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // Coding
2299        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // Coding
2300        case 951543133: /*control*/ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2301        default: return super.getProperty(hash, name, checkValid);
2302        }
2303
2304      }
2305
2306      @Override
2307      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2308        switch (hash) {
2309        case -1034364087: // number
2310          this.getNumber().add(castToUnsignedInt(value)); // UnsignedIntType
2311          return value;
2312        case 382350310: // classification
2313          this.classification = castToCoding(value); // Coding
2314          return value;
2315        case 50511102: // category
2316          this.getCategory().add(castToCoding(value)); // Coding
2317          return value;
2318        case 951543133: // control
2319          this.getControl().add(castToCoding(value)); // Coding
2320          return value;
2321        default: return super.setProperty(hash, name, value);
2322        }
2323
2324      }
2325
2326      @Override
2327      public Base setProperty(String name, Base value) throws FHIRException {
2328        if (name.equals("number")) {
2329          this.getNumber().add(castToUnsignedInt(value));
2330        } else if (name.equals("classification")) {
2331          this.classification = castToCoding(value); // Coding
2332        } else if (name.equals("category")) {
2333          this.getCategory().add(castToCoding(value));
2334        } else if (name.equals("control")) {
2335          this.getControl().add(castToCoding(value));
2336        } else
2337          return super.setProperty(name, value);
2338        return value;
2339      }
2340
2341      @Override
2342      public Base makeProperty(int hash, String name) throws FHIRException {
2343        switch (hash) {
2344        case -1034364087:  return addNumberElement();
2345        case 382350310:  return getClassification();
2346        case 50511102:  return addCategory(); 
2347        case 951543133:  return addControl(); 
2348        default: return super.makeProperty(hash, name);
2349        }
2350
2351      }
2352
2353      @Override
2354      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2355        switch (hash) {
2356        case -1034364087: /*number*/ return new String[] {"unsignedInt"};
2357        case 382350310: /*classification*/ return new String[] {"Coding"};
2358        case 50511102: /*category*/ return new String[] {"Coding"};
2359        case 951543133: /*control*/ return new String[] {"Coding"};
2360        default: return super.getTypesForProperty(hash, name);
2361        }
2362
2363      }
2364
2365      @Override
2366      public Base addChild(String name) throws FHIRException {
2367        if (name.equals("number")) {
2368          throw new FHIRException("Cannot call addChild on a primitive type Contract.number");
2369        }
2370        else if (name.equals("classification")) {
2371          this.classification = new Coding();
2372          return this.classification;
2373        }
2374        else if (name.equals("category")) {
2375          return addCategory();
2376        }
2377        else if (name.equals("control")) {
2378          return addControl();
2379        }
2380        else
2381          return super.addChild(name);
2382      }
2383
2384      public SecurityLabelComponent copy() {
2385        SecurityLabelComponent dst = new SecurityLabelComponent();
2386        copyValues(dst);
2387        return dst;
2388      }
2389
2390      public void copyValues(SecurityLabelComponent dst) {
2391        super.copyValues(dst);
2392        if (number != null) {
2393          dst.number = new ArrayList<UnsignedIntType>();
2394          for (UnsignedIntType i : number)
2395            dst.number.add(i.copy());
2396        };
2397        dst.classification = classification == null ? null : classification.copy();
2398        if (category != null) {
2399          dst.category = new ArrayList<Coding>();
2400          for (Coding i : category)
2401            dst.category.add(i.copy());
2402        };
2403        if (control != null) {
2404          dst.control = new ArrayList<Coding>();
2405          for (Coding i : control)
2406            dst.control.add(i.copy());
2407        };
2408      }
2409
2410      @Override
2411      public boolean equalsDeep(Base other_) {
2412        if (!super.equalsDeep(other_))
2413          return false;
2414        if (!(other_ instanceof SecurityLabelComponent))
2415          return false;
2416        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2417        return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
2418           && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
2419      }
2420
2421      @Override
2422      public boolean equalsShallow(Base other_) {
2423        if (!super.equalsShallow(other_))
2424          return false;
2425        if (!(other_ instanceof SecurityLabelComponent))
2426          return false;
2427        SecurityLabelComponent o = (SecurityLabelComponent) other_;
2428        return compareValues(number, o.number, true);
2429      }
2430
2431      public boolean isEmpty() {
2432        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category
2433          , control);
2434      }
2435
2436  public String fhirType() {
2437    return "Contract.term.securityLabel";
2438
2439  }
2440
2441  }
2442
2443    @Block()
2444    public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
2445        /**
2446         * Unique identifier for this particular Contract Provision.
2447         */
2448        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2449        @Description(shortDefinition="Offer business ID", formalDefinition="Unique identifier for this particular Contract Provision." )
2450        protected List<Identifier> identifier;
2451
2452        /**
2453         * Offer Recipient.
2454         */
2455        @Child(name = "party", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2456        @Description(shortDefinition="Offer Recipient", formalDefinition="Offer Recipient." )
2457        protected List<ContractPartyComponent> party;
2458
2459        /**
2460         * 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).
2461         */
2462        @Child(name = "topic", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=true)
2463        @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)." )
2464        protected Reference topic;
2465
2466        /**
2467         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
2468         */
2469        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
2470        @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." )
2471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-term-type")
2472        protected CodeableConcept type;
2473
2474        /**
2475         * Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.
2476         */
2477        @Child(name = "decision", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
2478        @Description(shortDefinition="Accepting party choice", formalDefinition="Type of choice made by accepting party with respect to an offer made by an offeror/ grantee." )
2479        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
2480        protected CodeableConcept decision;
2481
2482        /**
2483         * How the decision about a Contract was conveyed.
2484         */
2485        @Child(name = "decisionMode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2486        @Description(shortDefinition="How decision is conveyed", formalDefinition="How the decision about a Contract was conveyed." )
2487        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-decision-mode")
2488        protected List<CodeableConcept> decisionMode;
2489
2490        /**
2491         * Response to offer text.
2492         */
2493        @Child(name = "answer", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2494        @Description(shortDefinition="Response to offer text", formalDefinition="Response to offer text." )
2495        protected List<AnswerComponent> answer;
2496
2497        /**
2498         * Human readable form of this Contract Offer.
2499         */
2500        @Child(name = "text", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2501        @Description(shortDefinition="Human readable offer text", formalDefinition="Human readable form of this Contract Offer." )
2502        protected StringType text;
2503
2504        /**
2505         * The id of the clause or question text of the offer in the referenced questionnaire/response.
2506         */
2507        @Child(name = "linkId", type = {StringType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2508        @Description(shortDefinition="Pointer to text", formalDefinition="The id of the clause or question text of the offer in the referenced questionnaire/response." )
2509        protected List<StringType> linkId;
2510
2511        /**
2512         * Security labels that protects the offer.
2513         */
2514        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2515        @Description(shortDefinition="Offer restriction numbers", formalDefinition="Security labels that protects the offer." )
2516        protected List<UnsignedIntType> securityLabelNumber;
2517
2518        private static final long serialVersionUID = -852140711L;
2519
2520    /**
2521     * Constructor
2522     */
2523      public ContractOfferComponent() {
2524        super();
2525      }
2526
2527        /**
2528         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
2529         */
2530        public List<Identifier> getIdentifier() { 
2531          if (this.identifier == null)
2532            this.identifier = new ArrayList<Identifier>();
2533          return this.identifier;
2534        }
2535
2536        /**
2537         * @return Returns a reference to <code>this</code> for easy method chaining
2538         */
2539        public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) { 
2540          this.identifier = theIdentifier;
2541          return this;
2542        }
2543
2544        public boolean hasIdentifier() { 
2545          if (this.identifier == null)
2546            return false;
2547          for (Identifier item : this.identifier)
2548            if (!item.isEmpty())
2549              return true;
2550          return false;
2551        }
2552
2553        public Identifier addIdentifier() { //3
2554          Identifier t = new Identifier();
2555          if (this.identifier == null)
2556            this.identifier = new ArrayList<Identifier>();
2557          this.identifier.add(t);
2558          return t;
2559        }
2560
2561        public ContractOfferComponent addIdentifier(Identifier t) { //3
2562          if (t == null)
2563            return this;
2564          if (this.identifier == null)
2565            this.identifier = new ArrayList<Identifier>();
2566          this.identifier.add(t);
2567          return this;
2568        }
2569
2570        /**
2571         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2572         */
2573        public Identifier getIdentifierFirstRep() { 
2574          if (getIdentifier().isEmpty()) {
2575            addIdentifier();
2576          }
2577          return getIdentifier().get(0);
2578        }
2579
2580        /**
2581         * @return {@link #party} (Offer Recipient.)
2582         */
2583        public List<ContractPartyComponent> getParty() { 
2584          if (this.party == null)
2585            this.party = new ArrayList<ContractPartyComponent>();
2586          return this.party;
2587        }
2588
2589        /**
2590         * @return Returns a reference to <code>this</code> for easy method chaining
2591         */
2592        public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) { 
2593          this.party = theParty;
2594          return this;
2595        }
2596
2597        public boolean hasParty() { 
2598          if (this.party == null)
2599            return false;
2600          for (ContractPartyComponent item : this.party)
2601            if (!item.isEmpty())
2602              return true;
2603          return false;
2604        }
2605
2606        public ContractPartyComponent addParty() { //3
2607          ContractPartyComponent t = new ContractPartyComponent();
2608          if (this.party == null)
2609            this.party = new ArrayList<ContractPartyComponent>();
2610          this.party.add(t);
2611          return t;
2612        }
2613
2614        public ContractOfferComponent addParty(ContractPartyComponent t) { //3
2615          if (t == null)
2616            return this;
2617          if (this.party == null)
2618            this.party = new ArrayList<ContractPartyComponent>();
2619          this.party.add(t);
2620          return this;
2621        }
2622
2623        /**
2624         * @return The first repetition of repeating field {@link #party}, creating it if it does not already exist
2625         */
2626        public ContractPartyComponent getPartyFirstRep() { 
2627          if (getParty().isEmpty()) {
2628            addParty();
2629          }
2630          return getParty().get(0);
2631        }
2632
2633        /**
2634         * @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).)
2635         */
2636        public Reference getTopic() { 
2637          if (this.topic == null)
2638            if (Configuration.errorOnAutoCreate())
2639              throw new Error("Attempt to auto-create ContractOfferComponent.topic");
2640            else if (Configuration.doAutoCreate())
2641              this.topic = new Reference(); // cc
2642          return this.topic;
2643        }
2644
2645        public boolean hasTopic() { 
2646          return this.topic != null && !this.topic.isEmpty();
2647        }
2648
2649        /**
2650         * @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).)
2651         */
2652        public ContractOfferComponent setTopic(Reference value) { 
2653          this.topic = value;
2654          return this;
2655        }
2656
2657        /**
2658         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2659         */
2660        public CodeableConcept getType() { 
2661          if (this.type == null)
2662            if (Configuration.errorOnAutoCreate())
2663              throw new Error("Attempt to auto-create ContractOfferComponent.type");
2664            else if (Configuration.doAutoCreate())
2665              this.type = new CodeableConcept(); // cc
2666          return this.type;
2667        }
2668
2669        public boolean hasType() { 
2670          return this.type != null && !this.type.isEmpty();
2671        }
2672
2673        /**
2674         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
2675         */
2676        public ContractOfferComponent setType(CodeableConcept value) { 
2677          this.type = value;
2678          return this;
2679        }
2680
2681        /**
2682         * @return {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2683         */
2684        public CodeableConcept getDecision() { 
2685          if (this.decision == null)
2686            if (Configuration.errorOnAutoCreate())
2687              throw new Error("Attempt to auto-create ContractOfferComponent.decision");
2688            else if (Configuration.doAutoCreate())
2689              this.decision = new CodeableConcept(); // cc
2690          return this.decision;
2691        }
2692
2693        public boolean hasDecision() { 
2694          return this.decision != null && !this.decision.isEmpty();
2695        }
2696
2697        /**
2698         * @param value {@link #decision} (Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.)
2699         */
2700        public ContractOfferComponent setDecision(CodeableConcept value) { 
2701          this.decision = value;
2702          return this;
2703        }
2704
2705        /**
2706         * @return {@link #decisionMode} (How the decision about a Contract was conveyed.)
2707         */
2708        public List<CodeableConcept> getDecisionMode() { 
2709          if (this.decisionMode == null)
2710            this.decisionMode = new ArrayList<CodeableConcept>();
2711          return this.decisionMode;
2712        }
2713
2714        /**
2715         * @return Returns a reference to <code>this</code> for easy method chaining
2716         */
2717        public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) { 
2718          this.decisionMode = theDecisionMode;
2719          return this;
2720        }
2721
2722        public boolean hasDecisionMode() { 
2723          if (this.decisionMode == null)
2724            return false;
2725          for (CodeableConcept item : this.decisionMode)
2726            if (!item.isEmpty())
2727              return true;
2728          return false;
2729        }
2730
2731        public CodeableConcept addDecisionMode() { //3
2732          CodeableConcept t = new CodeableConcept();
2733          if (this.decisionMode == null)
2734            this.decisionMode = new ArrayList<CodeableConcept>();
2735          this.decisionMode.add(t);
2736          return t;
2737        }
2738
2739        public ContractOfferComponent addDecisionMode(CodeableConcept t) { //3
2740          if (t == null)
2741            return this;
2742          if (this.decisionMode == null)
2743            this.decisionMode = new ArrayList<CodeableConcept>();
2744          this.decisionMode.add(t);
2745          return this;
2746        }
2747
2748        /**
2749         * @return The first repetition of repeating field {@link #decisionMode}, creating it if it does not already exist
2750         */
2751        public CodeableConcept getDecisionModeFirstRep() { 
2752          if (getDecisionMode().isEmpty()) {
2753            addDecisionMode();
2754          }
2755          return getDecisionMode().get(0);
2756        }
2757
2758        /**
2759         * @return {@link #answer} (Response to offer text.)
2760         */
2761        public List<AnswerComponent> getAnswer() { 
2762          if (this.answer == null)
2763            this.answer = new ArrayList<AnswerComponent>();
2764          return this.answer;
2765        }
2766
2767        /**
2768         * @return Returns a reference to <code>this</code> for easy method chaining
2769         */
2770        public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) { 
2771          this.answer = theAnswer;
2772          return this;
2773        }
2774
2775        public boolean hasAnswer() { 
2776          if (this.answer == null)
2777            return false;
2778          for (AnswerComponent item : this.answer)
2779            if (!item.isEmpty())
2780              return true;
2781          return false;
2782        }
2783
2784        public AnswerComponent addAnswer() { //3
2785          AnswerComponent t = new AnswerComponent();
2786          if (this.answer == null)
2787            this.answer = new ArrayList<AnswerComponent>();
2788          this.answer.add(t);
2789          return t;
2790        }
2791
2792        public ContractOfferComponent addAnswer(AnswerComponent t) { //3
2793          if (t == null)
2794            return this;
2795          if (this.answer == null)
2796            this.answer = new ArrayList<AnswerComponent>();
2797          this.answer.add(t);
2798          return this;
2799        }
2800
2801        /**
2802         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist
2803         */
2804        public AnswerComponent getAnswerFirstRep() { 
2805          if (getAnswer().isEmpty()) {
2806            addAnswer();
2807          }
2808          return getAnswer().get(0);
2809        }
2810
2811        /**
2812         * @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
2813         */
2814        public StringType getTextElement() { 
2815          if (this.text == null)
2816            if (Configuration.errorOnAutoCreate())
2817              throw new Error("Attempt to auto-create ContractOfferComponent.text");
2818            else if (Configuration.doAutoCreate())
2819              this.text = new StringType(); // bb
2820          return this.text;
2821        }
2822
2823        public boolean hasTextElement() { 
2824          return this.text != null && !this.text.isEmpty();
2825        }
2826
2827        public boolean hasText() { 
2828          return this.text != null && !this.text.isEmpty();
2829        }
2830
2831        /**
2832         * @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
2833         */
2834        public ContractOfferComponent setTextElement(StringType value) { 
2835          this.text = value;
2836          return this;
2837        }
2838
2839        /**
2840         * @return Human readable form of this Contract Offer.
2841         */
2842        public String getText() { 
2843          return this.text == null ? null : this.text.getValue();
2844        }
2845
2846        /**
2847         * @param value Human readable form of this Contract Offer.
2848         */
2849        public ContractOfferComponent setText(String value) { 
2850          if (Utilities.noString(value))
2851            this.text = null;
2852          else {
2853            if (this.text == null)
2854              this.text = new StringType();
2855            this.text.setValue(value);
2856          }
2857          return this;
2858        }
2859
2860        /**
2861         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2862         */
2863        public List<StringType> getLinkId() { 
2864          if (this.linkId == null)
2865            this.linkId = new ArrayList<StringType>();
2866          return this.linkId;
2867        }
2868
2869        /**
2870         * @return Returns a reference to <code>this</code> for easy method chaining
2871         */
2872        public ContractOfferComponent setLinkId(List<StringType> theLinkId) { 
2873          this.linkId = theLinkId;
2874          return this;
2875        }
2876
2877        public boolean hasLinkId() { 
2878          if (this.linkId == null)
2879            return false;
2880          for (StringType item : this.linkId)
2881            if (!item.isEmpty())
2882              return true;
2883          return false;
2884        }
2885
2886        /**
2887         * @return {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2888         */
2889        public StringType addLinkIdElement() {//2 
2890          StringType t = new StringType();
2891          if (this.linkId == null)
2892            this.linkId = new ArrayList<StringType>();
2893          this.linkId.add(t);
2894          return t;
2895        }
2896
2897        /**
2898         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2899         */
2900        public ContractOfferComponent addLinkId(String value) { //1
2901          StringType t = new StringType();
2902          t.setValue(value);
2903          if (this.linkId == null)
2904            this.linkId = new ArrayList<StringType>();
2905          this.linkId.add(t);
2906          return this;
2907        }
2908
2909        /**
2910         * @param value {@link #linkId} (The id of the clause or question text of the offer in the referenced questionnaire/response.)
2911         */
2912        public boolean hasLinkId(String value) { 
2913          if (this.linkId == null)
2914            return false;
2915          for (StringType v : this.linkId)
2916            if (v.getValue().equals(value)) // string
2917              return true;
2918          return false;
2919        }
2920
2921        /**
2922         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2923         */
2924        public List<UnsignedIntType> getSecurityLabelNumber() { 
2925          if (this.securityLabelNumber == null)
2926            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2927          return this.securityLabelNumber;
2928        }
2929
2930        /**
2931         * @return Returns a reference to <code>this</code> for easy method chaining
2932         */
2933        public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
2934          this.securityLabelNumber = theSecurityLabelNumber;
2935          return this;
2936        }
2937
2938        public boolean hasSecurityLabelNumber() { 
2939          if (this.securityLabelNumber == null)
2940            return false;
2941          for (UnsignedIntType item : this.securityLabelNumber)
2942            if (!item.isEmpty())
2943              return true;
2944          return false;
2945        }
2946
2947        /**
2948         * @return {@link #securityLabelNumber} (Security labels that protects the offer.)
2949         */
2950        public UnsignedIntType addSecurityLabelNumberElement() {//2 
2951          UnsignedIntType t = new UnsignedIntType();
2952          if (this.securityLabelNumber == null)
2953            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2954          this.securityLabelNumber.add(t);
2955          return t;
2956        }
2957
2958        /**
2959         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2960         */
2961        public ContractOfferComponent addSecurityLabelNumber(int value) { //1
2962          UnsignedIntType t = new UnsignedIntType();
2963          t.setValue(value);
2964          if (this.securityLabelNumber == null)
2965            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
2966          this.securityLabelNumber.add(t);
2967          return this;
2968        }
2969
2970        /**
2971         * @param value {@link #securityLabelNumber} (Security labels that protects the offer.)
2972         */
2973        public boolean hasSecurityLabelNumber(int value) { 
2974          if (this.securityLabelNumber == null)
2975            return false;
2976          for (UnsignedIntType v : this.securityLabelNumber)
2977            if (v.getValue().equals(value)) // unsignedInt
2978              return true;
2979          return false;
2980        }
2981
2982        protected void listChildren(List<Property> children) {
2983          super.listChildren(children);
2984          children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier));
2985          children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
2986          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));
2987          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));
2988          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));
2989          children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode));
2990          children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
2991          children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
2992          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));
2993          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
2994        }
2995
2996        @Override
2997        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2998          switch (_hash) {
2999          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
3000          case 106437350: /*party*/  return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
3001          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);
3002          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);
3003          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);
3004          case 675909535: /*decisionMode*/  return new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
3005          case -1412808770: /*answer*/  return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer);
3006          case 3556653: /*text*/  return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
3007          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);
3008          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
3009          default: return super.getNamedProperty(_hash, _name, _checkValid);
3010          }
3011
3012        }
3013
3014      @Override
3015      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3016        switch (hash) {
3017        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3018        case 106437350: /*party*/ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3019        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Reference
3020        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3021        case 565719004: /*decision*/ return this.decision == null ? new Base[0] : new Base[] {this.decision}; // CodeableConcept
3022        case 675909535: /*decisionMode*/ return this.decisionMode == null ? new Base[0] : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3023        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3024        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
3025        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3026        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3027        default: return super.getProperty(hash, name, checkValid);
3028        }
3029
3030      }
3031
3032      @Override
3033      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3034        switch (hash) {
3035        case -1618432855: // identifier
3036          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3037          return value;
3038        case 106437350: // party
3039          this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3040          return value;
3041        case 110546223: // topic
3042          this.topic = castToReference(value); // Reference
3043          return value;
3044        case 3575610: // type
3045          this.type = castToCodeableConcept(value); // CodeableConcept
3046          return value;
3047        case 565719004: // decision
3048          this.decision = castToCodeableConcept(value); // CodeableConcept
3049          return value;
3050        case 675909535: // decisionMode
3051          this.getDecisionMode().add(castToCodeableConcept(value)); // CodeableConcept
3052          return value;
3053        case -1412808770: // answer
3054          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3055          return value;
3056        case 3556653: // text
3057          this.text = castToString(value); // StringType
3058          return value;
3059        case -1102667083: // linkId
3060          this.getLinkId().add(castToString(value)); // StringType
3061          return value;
3062        case -149460995: // securityLabelNumber
3063          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
3064          return value;
3065        default: return super.setProperty(hash, name, value);
3066        }
3067
3068      }
3069
3070      @Override
3071      public Base setProperty(String name, Base value) throws FHIRException {
3072        if (name.equals("identifier")) {
3073          this.getIdentifier().add(castToIdentifier(value));
3074        } else if (name.equals("party")) {
3075          this.getParty().add((ContractPartyComponent) value);
3076        } else if (name.equals("topic")) {
3077          this.topic = castToReference(value); // Reference
3078        } else if (name.equals("type")) {
3079          this.type = castToCodeableConcept(value); // CodeableConcept
3080        } else if (name.equals("decision")) {
3081          this.decision = castToCodeableConcept(value); // CodeableConcept
3082        } else if (name.equals("decisionMode")) {
3083          this.getDecisionMode().add(castToCodeableConcept(value));
3084        } else if (name.equals("answer")) {
3085          this.getAnswer().add((AnswerComponent) value);
3086        } else if (name.equals("text")) {
3087          this.text = castToString(value); // StringType
3088        } else if (name.equals("linkId")) {
3089          this.getLinkId().add(castToString(value));
3090        } else if (name.equals("securityLabelNumber")) {
3091          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
3092        } else
3093          return super.setProperty(name, value);
3094        return value;
3095      }
3096
3097      @Override
3098      public Base makeProperty(int hash, String name) throws FHIRException {
3099        switch (hash) {
3100        case -1618432855:  return addIdentifier(); 
3101        case 106437350:  return addParty(); 
3102        case 110546223:  return getTopic();
3103        case 3575610:  return getType();
3104        case 565719004:  return getDecision();
3105        case 675909535:  return addDecisionMode(); 
3106        case -1412808770:  return addAnswer(); 
3107        case 3556653:  return getTextElement();
3108        case -1102667083:  return addLinkIdElement();
3109        case -149460995:  return addSecurityLabelNumberElement();
3110        default: return super.makeProperty(hash, name);
3111        }
3112
3113      }
3114
3115      @Override
3116      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3117        switch (hash) {
3118        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3119        case 106437350: /*party*/ return new String[] {};
3120        case 110546223: /*topic*/ return new String[] {"Reference"};
3121        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3122        case 565719004: /*decision*/ return new String[] {"CodeableConcept"};
3123        case 675909535: /*decisionMode*/ return new String[] {"CodeableConcept"};
3124        case -1412808770: /*answer*/ return new String[] {};
3125        case 3556653: /*text*/ return new String[] {"string"};
3126        case -1102667083: /*linkId*/ return new String[] {"string"};
3127        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
3128        default: return super.getTypesForProperty(hash, name);
3129        }
3130
3131      }
3132
3133      @Override
3134      public Base addChild(String name) throws FHIRException {
3135        if (name.equals("identifier")) {
3136          return addIdentifier();
3137        }
3138        else if (name.equals("party")) {
3139          return addParty();
3140        }
3141        else if (name.equals("topic")) {
3142          this.topic = new Reference();
3143          return this.topic;
3144        }
3145        else if (name.equals("type")) {
3146          this.type = new CodeableConcept();
3147          return this.type;
3148        }
3149        else if (name.equals("decision")) {
3150          this.decision = new CodeableConcept();
3151          return this.decision;
3152        }
3153        else if (name.equals("decisionMode")) {
3154          return addDecisionMode();
3155        }
3156        else if (name.equals("answer")) {
3157          return addAnswer();
3158        }
3159        else if (name.equals("text")) {
3160          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
3161        }
3162        else if (name.equals("linkId")) {
3163          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
3164        }
3165        else if (name.equals("securityLabelNumber")) {
3166          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
3167        }
3168        else
3169          return super.addChild(name);
3170      }
3171
3172      public ContractOfferComponent copy() {
3173        ContractOfferComponent dst = new ContractOfferComponent();
3174        copyValues(dst);
3175        return dst;
3176      }
3177
3178      public void copyValues(ContractOfferComponent dst) {
3179        super.copyValues(dst);
3180        if (identifier != null) {
3181          dst.identifier = new ArrayList<Identifier>();
3182          for (Identifier i : identifier)
3183            dst.identifier.add(i.copy());
3184        };
3185        if (party != null) {
3186          dst.party = new ArrayList<ContractPartyComponent>();
3187          for (ContractPartyComponent i : party)
3188            dst.party.add(i.copy());
3189        };
3190        dst.topic = topic == null ? null : topic.copy();
3191        dst.type = type == null ? null : type.copy();
3192        dst.decision = decision == null ? null : decision.copy();
3193        if (decisionMode != null) {
3194          dst.decisionMode = new ArrayList<CodeableConcept>();
3195          for (CodeableConcept i : decisionMode)
3196            dst.decisionMode.add(i.copy());
3197        };
3198        if (answer != null) {
3199          dst.answer = new ArrayList<AnswerComponent>();
3200          for (AnswerComponent i : answer)
3201            dst.answer.add(i.copy());
3202        };
3203        dst.text = text == null ? null : text.copy();
3204        if (linkId != null) {
3205          dst.linkId = new ArrayList<StringType>();
3206          for (StringType i : linkId)
3207            dst.linkId.add(i.copy());
3208        };
3209        if (securityLabelNumber != null) {
3210          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
3211          for (UnsignedIntType i : securityLabelNumber)
3212            dst.securityLabelNumber.add(i.copy());
3213        };
3214      }
3215
3216      @Override
3217      public boolean equalsDeep(Base other_) {
3218        if (!super.equalsDeep(other_))
3219          return false;
3220        if (!(other_ instanceof ContractOfferComponent))
3221          return false;
3222        ContractOfferComponent o = (ContractOfferComponent) other_;
3223        return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true) && compareDeep(topic, o.topic, true)
3224           && compareDeep(type, o.type, true) && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
3225           && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
3226           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
3227      }
3228
3229      @Override
3230      public boolean equalsShallow(Base other_) {
3231        if (!super.equalsShallow(other_))
3232          return false;
3233        if (!(other_ instanceof ContractOfferComponent))
3234          return false;
3235        ContractOfferComponent o = (ContractOfferComponent) other_;
3236        return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
3237          ;
3238      }
3239
3240      public boolean isEmpty() {
3241        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic
3242          , type, decision, decisionMode, answer, text, linkId, securityLabelNumber);
3243      }
3244
3245  public String fhirType() {
3246    return "Contract.term.offer";
3247
3248  }
3249
3250  }
3251
3252    @Block()
3253    public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
3254        /**
3255         * Participant in the offer.
3256         */
3257        @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)
3258        @Description(shortDefinition="Referenced entity", formalDefinition="Participant in the offer." )
3259        protected List<Reference> reference;
3260
3261        /**
3262         * How the party participates in the offer.
3263         */
3264        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
3265        @Description(shortDefinition="Participant engagement type", formalDefinition="How the party participates in the offer." )
3266        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-party-role")
3267        protected CodeableConcept role;
3268
3269        private static final long serialVersionUID = -1599592477L;
3270
3271    /**
3272     * Constructor
3273     */
3274      public ContractPartyComponent() {
3275        super();
3276      }
3277
3278    /**
3279     * Constructor
3280     */
3281      public ContractPartyComponent(CodeableConcept role) {
3282        super();
3283        this.role = role;
3284      }
3285
3286        /**
3287         * @return {@link #reference} (Participant in the offer.)
3288         */
3289        public List<Reference> getReference() { 
3290          if (this.reference == null)
3291            this.reference = new ArrayList<Reference>();
3292          return this.reference;
3293        }
3294
3295        /**
3296         * @return Returns a reference to <code>this</code> for easy method chaining
3297         */
3298        public ContractPartyComponent setReference(List<Reference> theReference) { 
3299          this.reference = theReference;
3300          return this;
3301        }
3302
3303        public boolean hasReference() { 
3304          if (this.reference == null)
3305            return false;
3306          for (Reference item : this.reference)
3307            if (!item.isEmpty())
3308              return true;
3309          return false;
3310        }
3311
3312        public Reference addReference() { //3
3313          Reference t = new Reference();
3314          if (this.reference == null)
3315            this.reference = new ArrayList<Reference>();
3316          this.reference.add(t);
3317          return t;
3318        }
3319
3320        public ContractPartyComponent addReference(Reference t) { //3
3321          if (t == null)
3322            return this;
3323          if (this.reference == null)
3324            this.reference = new ArrayList<Reference>();
3325          this.reference.add(t);
3326          return this;
3327        }
3328
3329        /**
3330         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist
3331         */
3332        public Reference getReferenceFirstRep() { 
3333          if (getReference().isEmpty()) {
3334            addReference();
3335          }
3336          return getReference().get(0);
3337        }
3338
3339        /**
3340         * @return {@link #role} (How the party participates in the offer.)
3341         */
3342        public CodeableConcept getRole() { 
3343          if (this.role == null)
3344            if (Configuration.errorOnAutoCreate())
3345              throw new Error("Attempt to auto-create ContractPartyComponent.role");
3346            else if (Configuration.doAutoCreate())
3347              this.role = new CodeableConcept(); // cc
3348          return this.role;
3349        }
3350
3351        public boolean hasRole() { 
3352          return this.role != null && !this.role.isEmpty();
3353        }
3354
3355        /**
3356         * @param value {@link #role} (How the party participates in the offer.)
3357         */
3358        public ContractPartyComponent setRole(CodeableConcept value) { 
3359          this.role = value;
3360          return this;
3361        }
3362
3363        protected void listChildren(List<Property> children) {
3364          super.listChildren(children);
3365          children.add(new Property("reference", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)", "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
3366          children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
3367        }
3368
3369        @Override
3370        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3371          switch (_hash) {
3372          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);
3373          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role);
3374          default: return super.getNamedProperty(_hash, _name, _checkValid);
3375          }
3376
3377        }
3378
3379      @Override
3380      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3381        switch (hash) {
3382        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
3383        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
3384        default: return super.getProperty(hash, name, checkValid);
3385        }
3386
3387      }
3388
3389      @Override
3390      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3391        switch (hash) {
3392        case -925155509: // reference
3393          this.getReference().add(castToReference(value)); // Reference
3394          return value;
3395        case 3506294: // role
3396          this.role = castToCodeableConcept(value); // CodeableConcept
3397          return value;
3398        default: return super.setProperty(hash, name, value);
3399        }
3400
3401      }
3402
3403      @Override
3404      public Base setProperty(String name, Base value) throws FHIRException {
3405        if (name.equals("reference")) {
3406          this.getReference().add(castToReference(value));
3407        } else if (name.equals("role")) {
3408          this.role = castToCodeableConcept(value); // CodeableConcept
3409        } else
3410          return super.setProperty(name, value);
3411        return value;
3412      }
3413
3414      @Override
3415      public Base makeProperty(int hash, String name) throws FHIRException {
3416        switch (hash) {
3417        case -925155509:  return addReference(); 
3418        case 3506294:  return getRole();
3419        default: return super.makeProperty(hash, name);
3420        }
3421
3422      }
3423
3424      @Override
3425      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3426        switch (hash) {
3427        case -925155509: /*reference*/ return new String[] {"Reference"};
3428        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
3429        default: return super.getTypesForProperty(hash, name);
3430        }
3431
3432      }
3433
3434      @Override
3435      public Base addChild(String name) throws FHIRException {
3436        if (name.equals("reference")) {
3437          return addReference();
3438        }
3439        else if (name.equals("role")) {
3440          this.role = new CodeableConcept();
3441          return this.role;
3442        }
3443        else
3444          return super.addChild(name);
3445      }
3446
3447      public ContractPartyComponent copy() {
3448        ContractPartyComponent dst = new ContractPartyComponent();
3449        copyValues(dst);
3450        return dst;
3451      }
3452
3453      public void copyValues(ContractPartyComponent dst) {
3454        super.copyValues(dst);
3455        if (reference != null) {
3456          dst.reference = new ArrayList<Reference>();
3457          for (Reference i : reference)
3458            dst.reference.add(i.copy());
3459        };
3460        dst.role = role == null ? null : role.copy();
3461      }
3462
3463      @Override
3464      public boolean equalsDeep(Base other_) {
3465        if (!super.equalsDeep(other_))
3466          return false;
3467        if (!(other_ instanceof ContractPartyComponent))
3468          return false;
3469        ContractPartyComponent o = (ContractPartyComponent) other_;
3470        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
3471      }
3472
3473      @Override
3474      public boolean equalsShallow(Base other_) {
3475        if (!super.equalsShallow(other_))
3476          return false;
3477        if (!(other_ instanceof ContractPartyComponent))
3478          return false;
3479        ContractPartyComponent o = (ContractPartyComponent) other_;
3480        return true;
3481      }
3482
3483      public boolean isEmpty() {
3484        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
3485      }
3486
3487  public String fhirType() {
3488    return "Contract.term.offer.party";
3489
3490  }
3491
3492  }
3493
3494    @Block()
3495    public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
3496        /**
3497         * 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.
3498         */
3499        @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)
3500        @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." )
3501        protected Type value;
3502
3503        private static final long serialVersionUID = -732981989L;
3504
3505    /**
3506     * Constructor
3507     */
3508      public AnswerComponent() {
3509        super();
3510      }
3511
3512    /**
3513     * Constructor
3514     */
3515      public AnswerComponent(Type value) {
3516        super();
3517        this.value = value;
3518      }
3519
3520        /**
3521         * @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.)
3522         */
3523        public Type getValue() { 
3524          return this.value;
3525        }
3526
3527        /**
3528         * @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.)
3529         */
3530        public BooleanType getValueBooleanType() throws FHIRException { 
3531          if (this.value == null)
3532            this.value = new BooleanType();
3533          if (!(this.value instanceof BooleanType))
3534            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3535          return (BooleanType) this.value;
3536        }
3537
3538        public boolean hasValueBooleanType() { 
3539          return this != null && this.value instanceof BooleanType;
3540        }
3541
3542        /**
3543         * @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.)
3544         */
3545        public DecimalType getValueDecimalType() throws FHIRException { 
3546          if (this.value == null)
3547            this.value = new DecimalType();
3548          if (!(this.value instanceof DecimalType))
3549            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
3550          return (DecimalType) this.value;
3551        }
3552
3553        public boolean hasValueDecimalType() { 
3554          return this != null && this.value instanceof DecimalType;
3555        }
3556
3557        /**
3558         * @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.)
3559         */
3560        public IntegerType getValueIntegerType() throws FHIRException { 
3561          if (this.value == null)
3562            this.value = new IntegerType();
3563          if (!(this.value instanceof IntegerType))
3564            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3565          return (IntegerType) this.value;
3566        }
3567
3568        public boolean hasValueIntegerType() { 
3569          return this != null && this.value instanceof IntegerType;
3570        }
3571
3572        /**
3573         * @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.)
3574         */
3575        public DateType getValueDateType() throws FHIRException { 
3576          if (this.value == null)
3577            this.value = new DateType();
3578          if (!(this.value instanceof DateType))
3579            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
3580          return (DateType) this.value;
3581        }
3582
3583        public boolean hasValueDateType() { 
3584          return this != null && this.value instanceof DateType;
3585        }
3586
3587        /**
3588         * @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.)
3589         */
3590        public DateTimeType getValueDateTimeType() throws FHIRException { 
3591          if (this.value == null)
3592            this.value = new DateTimeType();
3593          if (!(this.value instanceof DateTimeType))
3594            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3595          return (DateTimeType) this.value;
3596        }
3597
3598        public boolean hasValueDateTimeType() { 
3599          return this != null && this.value instanceof DateTimeType;
3600        }
3601
3602        /**
3603         * @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.)
3604         */
3605        public TimeType getValueTimeType() throws FHIRException { 
3606          if (this.value == null)
3607            this.value = new TimeType();
3608          if (!(this.value instanceof TimeType))
3609            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3610          return (TimeType) this.value;
3611        }
3612
3613        public boolean hasValueTimeType() { 
3614          return this != null && this.value instanceof TimeType;
3615        }
3616
3617        /**
3618         * @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.)
3619         */
3620        public StringType getValueStringType() throws FHIRException { 
3621          if (this.value == null)
3622            this.value = new StringType();
3623          if (!(this.value instanceof StringType))
3624            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3625          return (StringType) this.value;
3626        }
3627
3628        public boolean hasValueStringType() { 
3629          return this != null && this.value instanceof StringType;
3630        }
3631
3632        /**
3633         * @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.)
3634         */
3635        public UriType getValueUriType() throws FHIRException { 
3636          if (this.value == null)
3637            this.value = new UriType();
3638          if (!(this.value instanceof UriType))
3639            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3640          return (UriType) this.value;
3641        }
3642
3643        public boolean hasValueUriType() { 
3644          return this != null && this.value instanceof UriType;
3645        }
3646
3647        /**
3648         * @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.)
3649         */
3650        public Attachment getValueAttachment() throws FHIRException { 
3651          if (this.value == null)
3652            this.value = new Attachment();
3653          if (!(this.value instanceof Attachment))
3654            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3655          return (Attachment) this.value;
3656        }
3657
3658        public boolean hasValueAttachment() { 
3659          return this != null && this.value instanceof Attachment;
3660        }
3661
3662        /**
3663         * @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.)
3664         */
3665        public Coding getValueCoding() throws FHIRException { 
3666          if (this.value == null)
3667            this.value = new Coding();
3668          if (!(this.value instanceof Coding))
3669            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3670          return (Coding) this.value;
3671        }
3672
3673        public boolean hasValueCoding() { 
3674          return this != null && this.value instanceof Coding;
3675        }
3676
3677        /**
3678         * @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.)
3679         */
3680        public Quantity getValueQuantity() throws FHIRException { 
3681          if (this.value == null)
3682            this.value = new Quantity();
3683          if (!(this.value instanceof Quantity))
3684            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3685          return (Quantity) this.value;
3686        }
3687
3688        public boolean hasValueQuantity() { 
3689          return this != null && this.value instanceof Quantity;
3690        }
3691
3692        /**
3693         * @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.)
3694         */
3695        public Reference getValueReference() throws FHIRException { 
3696          if (this.value == null)
3697            this.value = new Reference();
3698          if (!(this.value instanceof Reference))
3699            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3700          return (Reference) this.value;
3701        }
3702
3703        public boolean hasValueReference() { 
3704          return this != null && this.value instanceof Reference;
3705        }
3706
3707        public boolean hasValue() { 
3708          return this.value != null && !this.value.isEmpty();
3709        }
3710
3711        /**
3712         * @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.)
3713         */
3714        public AnswerComponent setValue(Type value) { 
3715          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))
3716            throw new Error("Not the right type for Contract.term.offer.answer.value[x]: "+value.fhirType());
3717          this.value = value;
3718          return this;
3719        }
3720
3721        protected void listChildren(List<Property> children) {
3722          super.listChildren(children);
3723          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));
3724        }
3725
3726        @Override
3727        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3728          switch (_hash) {
3729          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);
3730          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);
3731          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3732          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3733          case -1668204915: /*valueInteger*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3734          case -766192449: /*valueDate*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3735          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3736          case -765708322: /*valueTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3737          case -1424603934: /*valueString*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3738          case -1410172357: /*valueUri*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3739          case -475566732: /*valueAttachment*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3740          case -1887705029: /*valueCoding*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3741          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3742          case 1755241690: /*valueReference*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warrently duration, or whether biospecimen may be used for further research.", 0, 1, value);
3743          default: return super.getNamedProperty(_hash, _name, _checkValid);
3744          }
3745
3746        }
3747
3748      @Override
3749      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3750        switch (hash) {
3751        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
3752        default: return super.getProperty(hash, name, checkValid);
3753        }
3754
3755      }
3756
3757      @Override
3758      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3759        switch (hash) {
3760        case 111972721: // value
3761          this.value = castToType(value); // Type
3762          return value;
3763        default: return super.setProperty(hash, name, value);
3764        }
3765
3766      }
3767
3768      @Override
3769      public Base setProperty(String name, Base value) throws FHIRException {
3770        if (name.equals("value[x]")) {
3771          this.value = castToType(value); // Type
3772        } else
3773          return super.setProperty(name, value);
3774        return value;
3775      }
3776
3777      @Override
3778      public Base makeProperty(int hash, String name) throws FHIRException {
3779        switch (hash) {
3780        case -1410166417:  return getValue();
3781        case 111972721:  return getValue();
3782        default: return super.makeProperty(hash, name);
3783        }
3784
3785      }
3786
3787      @Override
3788      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3789        switch (hash) {
3790        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3791        default: return super.getTypesForProperty(hash, name);
3792        }
3793
3794      }
3795
3796      @Override
3797      public Base addChild(String name) throws FHIRException {
3798        if (name.equals("valueBoolean")) {
3799          this.value = new BooleanType();
3800          return this.value;
3801        }
3802        else if (name.equals("valueDecimal")) {
3803          this.value = new DecimalType();
3804          return this.value;
3805        }
3806        else if (name.equals("valueInteger")) {
3807          this.value = new IntegerType();
3808          return this.value;
3809        }
3810        else if (name.equals("valueDate")) {
3811          this.value = new DateType();
3812          return this.value;
3813        }
3814        else if (name.equals("valueDateTime")) {
3815          this.value = new DateTimeType();
3816          return this.value;
3817        }
3818        else if (name.equals("valueTime")) {
3819          this.value = new TimeType();
3820          return this.value;
3821        }
3822        else if (name.equals("valueString")) {
3823          this.value = new StringType();
3824          return this.value;
3825        }
3826        else if (name.equals("valueUri")) {
3827          this.value = new UriType();
3828          return this.value;
3829        }
3830        else if (name.equals("valueAttachment")) {
3831          this.value = new Attachment();
3832          return this.value;
3833        }
3834        else if (name.equals("valueCoding")) {
3835          this.value = new Coding();
3836          return this.value;
3837        }
3838        else if (name.equals("valueQuantity")) {
3839          this.value = new Quantity();
3840          return this.value;
3841        }
3842        else if (name.equals("valueReference")) {
3843          this.value = new Reference();
3844          return this.value;
3845        }
3846        else
3847          return super.addChild(name);
3848      }
3849
3850      public AnswerComponent copy() {
3851        AnswerComponent dst = new AnswerComponent();
3852        copyValues(dst);
3853        return dst;
3854      }
3855
3856      public void copyValues(AnswerComponent dst) {
3857        super.copyValues(dst);
3858        dst.value = value == null ? null : value.copy();
3859      }
3860
3861      @Override
3862      public boolean equalsDeep(Base other_) {
3863        if (!super.equalsDeep(other_))
3864          return false;
3865        if (!(other_ instanceof AnswerComponent))
3866          return false;
3867        AnswerComponent o = (AnswerComponent) other_;
3868        return compareDeep(value, o.value, true);
3869      }
3870
3871      @Override
3872      public boolean equalsShallow(Base other_) {
3873        if (!super.equalsShallow(other_))
3874          return false;
3875        if (!(other_ instanceof AnswerComponent))
3876          return false;
3877        AnswerComponent o = (AnswerComponent) other_;
3878        return true;
3879      }
3880
3881      public boolean isEmpty() {
3882        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3883      }
3884
3885  public String fhirType() {
3886    return "Contract.term.offer.answer";
3887
3888  }
3889
3890  }
3891
3892    @Block()
3893    public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
3894        /**
3895         * Differentiates the kind of the asset .
3896         */
3897        @Child(name = "scope", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3898        @Description(shortDefinition="Range of asset", formalDefinition="Differentiates the kind of the asset ." )
3899        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetscope")
3900        protected CodeableConcept scope;
3901
3902        /**
3903         * Target entity type about which the term may be concerned.
3904         */
3905        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3906        @Description(shortDefinition="Asset category", formalDefinition="Target entity type about which the term may be concerned." )
3907        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assettype")
3908        protected List<CodeableConcept> type;
3909
3910        /**
3911         * Associated entities.
3912         */
3913        @Child(name = "typeReference", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3914        @Description(shortDefinition="Associated entities", formalDefinition="Associated entities." )
3915        protected List<Reference> typeReference;
3916
3917        /**
3918         * May be a subtype or part of an offered asset.
3919         */
3920        @Child(name = "subtype", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3921        @Description(shortDefinition="Asset sub-category", formalDefinition="May be a subtype or part of an offered asset." )
3922        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetsubtype")
3923        protected List<CodeableConcept> subtype;
3924
3925        /**
3926         * 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.
3927         */
3928        @Child(name = "relationship", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=false)
3929        @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." )
3930        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-class")
3931        protected Coding relationship;
3932
3933        /**
3934         * Circumstance of the asset.
3935         */
3936        @Child(name = "context", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3937        @Description(shortDefinition="Circumstance of the asset", formalDefinition="Circumstance of the asset." )
3938        protected List<AssetContextComponent> context;
3939
3940        /**
3941         * Description of the quality and completeness of the asset that imay be a factor in its valuation.
3942         */
3943        @Child(name = "condition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3944        @Description(shortDefinition="Quality desctiption of asset", formalDefinition="Description of the quality and completeness of the asset that imay be a factor in its valuation." )
3945        protected StringType condition;
3946
3947        /**
3948         * Type of Asset availability for use or ownership.
3949         */
3950        @Child(name = "periodType", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3951        @Description(shortDefinition="Asset availability types", formalDefinition="Type of Asset availability for use or ownership." )
3952        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/asset-availability")
3953        protected List<CodeableConcept> periodType;
3954
3955        /**
3956         * Asset relevant contractual time period.
3957         */
3958        @Child(name = "period", type = {Period.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3959        @Description(shortDefinition="Time period of the asset", formalDefinition="Asset relevant contractual time period." )
3960        protected List<Period> period;
3961
3962        /**
3963         * Time period of asset use.
3964         */
3965        @Child(name = "usePeriod", type = {Period.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3966        @Description(shortDefinition="Time period", formalDefinition="Time period of asset use." )
3967        protected List<Period> usePeriod;
3968
3969        /**
3970         * Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.
3971         */
3972        @Child(name = "text", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
3973        @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." )
3974        protected StringType text;
3975
3976        /**
3977         * Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.
3978         */
3979        @Child(name = "linkId", type = {StringType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3980        @Description(shortDefinition="Pointer to asset text", formalDefinition="Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse." )
3981        protected List<StringType> linkId;
3982
3983        /**
3984         * Response to assets.
3985         */
3986        @Child(name = "answer", type = {AnswerComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3987        @Description(shortDefinition="Response to assets", formalDefinition="Response to assets." )
3988        protected List<AnswerComponent> answer;
3989
3990        /**
3991         * Security labels that protects the asset.
3992         */
3993        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3994        @Description(shortDefinition="Asset restriction numbers", formalDefinition="Security labels that protects the asset." )
3995        protected List<UnsignedIntType> securityLabelNumber;
3996
3997        /**
3998         * Contract Valued Item List.
3999         */
4000        @Child(name = "valuedItem", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4001        @Description(shortDefinition="Contract Valued Item List", formalDefinition="Contract Valued Item List." )
4002        protected List<ValuedItemComponent> valuedItem;
4003
4004        private static final long serialVersionUID = -581986730L;
4005
4006    /**
4007     * Constructor
4008     */
4009      public ContractAssetComponent() {
4010        super();
4011      }
4012
4013        /**
4014         * @return {@link #scope} (Differentiates the kind of the asset .)
4015         */
4016        public CodeableConcept getScope() { 
4017          if (this.scope == null)
4018            if (Configuration.errorOnAutoCreate())
4019              throw new Error("Attempt to auto-create ContractAssetComponent.scope");
4020            else if (Configuration.doAutoCreate())
4021              this.scope = new CodeableConcept(); // cc
4022          return this.scope;
4023        }
4024
4025        public boolean hasScope() { 
4026          return this.scope != null && !this.scope.isEmpty();
4027        }
4028
4029        /**
4030         * @param value {@link #scope} (Differentiates the kind of the asset .)
4031         */
4032        public ContractAssetComponent setScope(CodeableConcept value) { 
4033          this.scope = value;
4034          return this;
4035        }
4036
4037        /**
4038         * @return {@link #type} (Target entity type about which the term may be concerned.)
4039         */
4040        public List<CodeableConcept> getType() { 
4041          if (this.type == null)
4042            this.type = new ArrayList<CodeableConcept>();
4043          return this.type;
4044        }
4045
4046        /**
4047         * @return Returns a reference to <code>this</code> for easy method chaining
4048         */
4049        public ContractAssetComponent setType(List<CodeableConcept> theType) { 
4050          this.type = theType;
4051          return this;
4052        }
4053
4054        public boolean hasType() { 
4055          if (this.type == null)
4056            return false;
4057          for (CodeableConcept item : this.type)
4058            if (!item.isEmpty())
4059              return true;
4060          return false;
4061        }
4062
4063        public CodeableConcept addType() { //3
4064          CodeableConcept t = new CodeableConcept();
4065          if (this.type == null)
4066            this.type = new ArrayList<CodeableConcept>();
4067          this.type.add(t);
4068          return t;
4069        }
4070
4071        public ContractAssetComponent addType(CodeableConcept t) { //3
4072          if (t == null)
4073            return this;
4074          if (this.type == null)
4075            this.type = new ArrayList<CodeableConcept>();
4076          this.type.add(t);
4077          return this;
4078        }
4079
4080        /**
4081         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
4082         */
4083        public CodeableConcept getTypeFirstRep() { 
4084          if (getType().isEmpty()) {
4085            addType();
4086          }
4087          return getType().get(0);
4088        }
4089
4090        /**
4091         * @return {@link #typeReference} (Associated entities.)
4092         */
4093        public List<Reference> getTypeReference() { 
4094          if (this.typeReference == null)
4095            this.typeReference = new ArrayList<Reference>();
4096          return this.typeReference;
4097        }
4098
4099        /**
4100         * @return Returns a reference to <code>this</code> for easy method chaining
4101         */
4102        public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) { 
4103          this.typeReference = theTypeReference;
4104          return this;
4105        }
4106
4107        public boolean hasTypeReference() { 
4108          if (this.typeReference == null)
4109            return false;
4110          for (Reference item : this.typeReference)
4111            if (!item.isEmpty())
4112              return true;
4113          return false;
4114        }
4115
4116        public Reference addTypeReference() { //3
4117          Reference t = new Reference();
4118          if (this.typeReference == null)
4119            this.typeReference = new ArrayList<Reference>();
4120          this.typeReference.add(t);
4121          return t;
4122        }
4123
4124        public ContractAssetComponent addTypeReference(Reference t) { //3
4125          if (t == null)
4126            return this;
4127          if (this.typeReference == null)
4128            this.typeReference = new ArrayList<Reference>();
4129          this.typeReference.add(t);
4130          return this;
4131        }
4132
4133        /**
4134         * @return The first repetition of repeating field {@link #typeReference}, creating it if it does not already exist
4135         */
4136        public Reference getTypeReferenceFirstRep() { 
4137          if (getTypeReference().isEmpty()) {
4138            addTypeReference();
4139          }
4140          return getTypeReference().get(0);
4141        }
4142
4143        /**
4144         * @return {@link #subtype} (May be a subtype or part of an offered asset.)
4145         */
4146        public List<CodeableConcept> getSubtype() { 
4147          if (this.subtype == null)
4148            this.subtype = new ArrayList<CodeableConcept>();
4149          return this.subtype;
4150        }
4151
4152        /**
4153         * @return Returns a reference to <code>this</code> for easy method chaining
4154         */
4155        public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) { 
4156          this.subtype = theSubtype;
4157          return this;
4158        }
4159
4160        public boolean hasSubtype() { 
4161          if (this.subtype == null)
4162            return false;
4163          for (CodeableConcept item : this.subtype)
4164            if (!item.isEmpty())
4165              return true;
4166          return false;
4167        }
4168
4169        public CodeableConcept addSubtype() { //3
4170          CodeableConcept t = new CodeableConcept();
4171          if (this.subtype == null)
4172            this.subtype = new ArrayList<CodeableConcept>();
4173          this.subtype.add(t);
4174          return t;
4175        }
4176
4177        public ContractAssetComponent addSubtype(CodeableConcept t) { //3
4178          if (t == null)
4179            return this;
4180          if (this.subtype == null)
4181            this.subtype = new ArrayList<CodeableConcept>();
4182          this.subtype.add(t);
4183          return this;
4184        }
4185
4186        /**
4187         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist
4188         */
4189        public CodeableConcept getSubtypeFirstRep() { 
4190          if (getSubtype().isEmpty()) {
4191            addSubtype();
4192          }
4193          return getSubtype().get(0);
4194        }
4195
4196        /**
4197         * @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.)
4198         */
4199        public Coding getRelationship() { 
4200          if (this.relationship == null)
4201            if (Configuration.errorOnAutoCreate())
4202              throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
4203            else if (Configuration.doAutoCreate())
4204              this.relationship = new Coding(); // cc
4205          return this.relationship;
4206        }
4207
4208        public boolean hasRelationship() { 
4209          return this.relationship != null && !this.relationship.isEmpty();
4210        }
4211
4212        /**
4213         * @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.)
4214         */
4215        public ContractAssetComponent setRelationship(Coding value) { 
4216          this.relationship = value;
4217          return this;
4218        }
4219
4220        /**
4221         * @return {@link #context} (Circumstance of the asset.)
4222         */
4223        public List<AssetContextComponent> getContext() { 
4224          if (this.context == null)
4225            this.context = new ArrayList<AssetContextComponent>();
4226          return this.context;
4227        }
4228
4229        /**
4230         * @return Returns a reference to <code>this</code> for easy method chaining
4231         */
4232        public ContractAssetComponent setContext(List<AssetContextComponent> theContext) { 
4233          this.context = theContext;
4234          return this;
4235        }
4236
4237        public boolean hasContext() { 
4238          if (this.context == null)
4239            return false;
4240          for (AssetContextComponent item : this.context)
4241            if (!item.isEmpty())
4242              return true;
4243          return false;
4244        }
4245
4246        public AssetContextComponent addContext() { //3
4247          AssetContextComponent t = new AssetContextComponent();
4248          if (this.context == null)
4249            this.context = new ArrayList<AssetContextComponent>();
4250          this.context.add(t);
4251          return t;
4252        }
4253
4254        public ContractAssetComponent addContext(AssetContextComponent t) { //3
4255          if (t == null)
4256            return this;
4257          if (this.context == null)
4258            this.context = new ArrayList<AssetContextComponent>();
4259          this.context.add(t);
4260          return this;
4261        }
4262
4263        /**
4264         * @return The first repetition of repeating field {@link #context}, creating it if it does not already exist
4265         */
4266        public AssetContextComponent getContextFirstRep() { 
4267          if (getContext().isEmpty()) {
4268            addContext();
4269          }
4270          return getContext().get(0);
4271        }
4272
4273        /**
4274         * @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
4275         */
4276        public StringType getConditionElement() { 
4277          if (this.condition == null)
4278            if (Configuration.errorOnAutoCreate())
4279              throw new Error("Attempt to auto-create ContractAssetComponent.condition");
4280            else if (Configuration.doAutoCreate())
4281              this.condition = new StringType(); // bb
4282          return this.condition;
4283        }
4284
4285        public boolean hasConditionElement() { 
4286          return this.condition != null && !this.condition.isEmpty();
4287        }
4288
4289        public boolean hasCondition() { 
4290          return this.condition != null && !this.condition.isEmpty();
4291        }
4292
4293        /**
4294         * @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
4295         */
4296        public ContractAssetComponent setConditionElement(StringType value) { 
4297          this.condition = value;
4298          return this;
4299        }
4300
4301        /**
4302         * @return Description of the quality and completeness of the asset that imay be a factor in its valuation.
4303         */
4304        public String getCondition() { 
4305          return this.condition == null ? null : this.condition.getValue();
4306        }
4307
4308        /**
4309         * @param value Description of the quality and completeness of the asset that imay be a factor in its valuation.
4310         */
4311        public ContractAssetComponent setCondition(String value) { 
4312          if (Utilities.noString(value))
4313            this.condition = null;
4314          else {
4315            if (this.condition == null)
4316              this.condition = new StringType();
4317            this.condition.setValue(value);
4318          }
4319          return this;
4320        }
4321
4322        /**
4323         * @return {@link #periodType} (Type of Asset availability for use or ownership.)
4324         */
4325        public List<CodeableConcept> getPeriodType() { 
4326          if (this.periodType == null)
4327            this.periodType = new ArrayList<CodeableConcept>();
4328          return this.periodType;
4329        }
4330
4331        /**
4332         * @return Returns a reference to <code>this</code> for easy method chaining
4333         */
4334        public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) { 
4335          this.periodType = thePeriodType;
4336          return this;
4337        }
4338
4339        public boolean hasPeriodType() { 
4340          if (this.periodType == null)
4341            return false;
4342          for (CodeableConcept item : this.periodType)
4343            if (!item.isEmpty())
4344              return true;
4345          return false;
4346        }
4347
4348        public CodeableConcept addPeriodType() { //3
4349          CodeableConcept t = new CodeableConcept();
4350          if (this.periodType == null)
4351            this.periodType = new ArrayList<CodeableConcept>();
4352          this.periodType.add(t);
4353          return t;
4354        }
4355
4356        public ContractAssetComponent addPeriodType(CodeableConcept t) { //3
4357          if (t == null)
4358            return this;
4359          if (this.periodType == null)
4360            this.periodType = new ArrayList<CodeableConcept>();
4361          this.periodType.add(t);
4362          return this;
4363        }
4364
4365        /**
4366         * @return The first repetition of repeating field {@link #periodType}, creating it if it does not already exist
4367         */
4368        public CodeableConcept getPeriodTypeFirstRep() { 
4369          if (getPeriodType().isEmpty()) {
4370            addPeriodType();
4371          }
4372          return getPeriodType().get(0);
4373        }
4374
4375        /**
4376         * @return {@link #period} (Asset relevant contractual time period.)
4377         */
4378        public List<Period> getPeriod() { 
4379          if (this.period == null)
4380            this.period = new ArrayList<Period>();
4381          return this.period;
4382        }
4383
4384        /**
4385         * @return Returns a reference to <code>this</code> for easy method chaining
4386         */
4387        public ContractAssetComponent setPeriod(List<Period> thePeriod) { 
4388          this.period = thePeriod;
4389          return this;
4390        }
4391
4392        public boolean hasPeriod() { 
4393          if (this.period == null)
4394            return false;
4395          for (Period item : this.period)
4396            if (!item.isEmpty())
4397              return true;
4398          return false;
4399        }
4400
4401        public Period addPeriod() { //3
4402          Period t = new Period();
4403          if (this.period == null)
4404            this.period = new ArrayList<Period>();
4405          this.period.add(t);
4406          return t;
4407        }
4408
4409        public ContractAssetComponent addPeriod(Period t) { //3
4410          if (t == null)
4411            return this;
4412          if (this.period == null)
4413            this.period = new ArrayList<Period>();
4414          this.period.add(t);
4415          return this;
4416        }
4417
4418        /**
4419         * @return The first repetition of repeating field {@link #period}, creating it if it does not already exist
4420         */
4421        public Period getPeriodFirstRep() { 
4422          if (getPeriod().isEmpty()) {
4423            addPeriod();
4424          }
4425          return getPeriod().get(0);
4426        }
4427
4428        /**
4429         * @return {@link #usePeriod} (Time period of asset use.)
4430         */
4431        public List<Period> getUsePeriod() { 
4432          if (this.usePeriod == null)
4433            this.usePeriod = new ArrayList<Period>();
4434          return this.usePeriod;
4435        }
4436
4437        /**
4438         * @return Returns a reference to <code>this</code> for easy method chaining
4439         */
4440        public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) { 
4441          this.usePeriod = theUsePeriod;
4442          return this;
4443        }
4444
4445        public boolean hasUsePeriod() { 
4446          if (this.usePeriod == null)
4447            return false;
4448          for (Period item : this.usePeriod)
4449            if (!item.isEmpty())
4450              return true;
4451          return false;
4452        }
4453
4454        public Period addUsePeriod() { //3
4455          Period t = new Period();
4456          if (this.usePeriod == null)
4457            this.usePeriod = new ArrayList<Period>();
4458          this.usePeriod.add(t);
4459          return t;
4460        }
4461
4462        public ContractAssetComponent addUsePeriod(Period t) { //3
4463          if (t == null)
4464            return this;
4465          if (this.usePeriod == null)
4466            this.usePeriod = new ArrayList<Period>();
4467          this.usePeriod.add(t);
4468          return this;
4469        }
4470
4471        /**
4472         * @return The first repetition of repeating field {@link #usePeriod}, creating it if it does not already exist
4473         */
4474        public Period getUsePeriodFirstRep() { 
4475          if (getUsePeriod().isEmpty()) {
4476            addUsePeriod();
4477          }
4478          return getUsePeriod().get(0);
4479        }
4480
4481        /**
4482         * @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
4483         */
4484        public StringType getTextElement() { 
4485          if (this.text == null)
4486            if (Configuration.errorOnAutoCreate())
4487              throw new Error("Attempt to auto-create ContractAssetComponent.text");
4488            else if (Configuration.doAutoCreate())
4489              this.text = new StringType(); // bb
4490          return this.text;
4491        }
4492
4493        public boolean hasTextElement() { 
4494          return this.text != null && !this.text.isEmpty();
4495        }
4496
4497        public boolean hasText() { 
4498          return this.text != null && !this.text.isEmpty();
4499        }
4500
4501        /**
4502         * @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
4503         */
4504        public ContractAssetComponent setTextElement(StringType value) { 
4505          this.text = value;
4506          return this;
4507        }
4508
4509        /**
4510         * @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.
4511         */
4512        public String getText() { 
4513          return this.text == null ? null : this.text.getValue();
4514        }
4515
4516        /**
4517         * @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.
4518         */
4519        public ContractAssetComponent setText(String value) { 
4520          if (Utilities.noString(value))
4521            this.text = null;
4522          else {
4523            if (this.text == null)
4524              this.text = new StringType();
4525            this.text.setValue(value);
4526          }
4527          return this;
4528        }
4529
4530        /**
4531         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4532         */
4533        public List<StringType> getLinkId() { 
4534          if (this.linkId == null)
4535            this.linkId = new ArrayList<StringType>();
4536          return this.linkId;
4537        }
4538
4539        /**
4540         * @return Returns a reference to <code>this</code> for easy method chaining
4541         */
4542        public ContractAssetComponent setLinkId(List<StringType> theLinkId) { 
4543          this.linkId = theLinkId;
4544          return this;
4545        }
4546
4547        public boolean hasLinkId() { 
4548          if (this.linkId == null)
4549            return false;
4550          for (StringType item : this.linkId)
4551            if (!item.isEmpty())
4552              return true;
4553          return false;
4554        }
4555
4556        /**
4557         * @return {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4558         */
4559        public StringType addLinkIdElement() {//2 
4560          StringType t = new StringType();
4561          if (this.linkId == null)
4562            this.linkId = new ArrayList<StringType>();
4563          this.linkId.add(t);
4564          return t;
4565        }
4566
4567        /**
4568         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4569         */
4570        public ContractAssetComponent addLinkId(String value) { //1
4571          StringType t = new StringType();
4572          t.setValue(value);
4573          if (this.linkId == null)
4574            this.linkId = new ArrayList<StringType>();
4575          this.linkId.add(t);
4576          return this;
4577        }
4578
4579        /**
4580         * @param value {@link #linkId} (Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.)
4581         */
4582        public boolean hasLinkId(String value) { 
4583          if (this.linkId == null)
4584            return false;
4585          for (StringType v : this.linkId)
4586            if (v.getValue().equals(value)) // string
4587              return true;
4588          return false;
4589        }
4590
4591        /**
4592         * @return {@link #answer} (Response to assets.)
4593         */
4594        public List<AnswerComponent> getAnswer() { 
4595          if (this.answer == null)
4596            this.answer = new ArrayList<AnswerComponent>();
4597          return this.answer;
4598        }
4599
4600        /**
4601         * @return Returns a reference to <code>this</code> for easy method chaining
4602         */
4603        public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) { 
4604          this.answer = theAnswer;
4605          return this;
4606        }
4607
4608        public boolean hasAnswer() { 
4609          if (this.answer == null)
4610            return false;
4611          for (AnswerComponent item : this.answer)
4612            if (!item.isEmpty())
4613              return true;
4614          return false;
4615        }
4616
4617        public AnswerComponent addAnswer() { //3
4618          AnswerComponent t = new AnswerComponent();
4619          if (this.answer == null)
4620            this.answer = new ArrayList<AnswerComponent>();
4621          this.answer.add(t);
4622          return t;
4623        }
4624
4625        public ContractAssetComponent addAnswer(AnswerComponent t) { //3
4626          if (t == null)
4627            return this;
4628          if (this.answer == null)
4629            this.answer = new ArrayList<AnswerComponent>();
4630          this.answer.add(t);
4631          return this;
4632        }
4633
4634        /**
4635         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist
4636         */
4637        public AnswerComponent getAnswerFirstRep() { 
4638          if (getAnswer().isEmpty()) {
4639            addAnswer();
4640          }
4641          return getAnswer().get(0);
4642        }
4643
4644        /**
4645         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4646         */
4647        public List<UnsignedIntType> getSecurityLabelNumber() { 
4648          if (this.securityLabelNumber == null)
4649            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4650          return this.securityLabelNumber;
4651        }
4652
4653        /**
4654         * @return Returns a reference to <code>this</code> for easy method chaining
4655         */
4656        public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
4657          this.securityLabelNumber = theSecurityLabelNumber;
4658          return this;
4659        }
4660
4661        public boolean hasSecurityLabelNumber() { 
4662          if (this.securityLabelNumber == null)
4663            return false;
4664          for (UnsignedIntType item : this.securityLabelNumber)
4665            if (!item.isEmpty())
4666              return true;
4667          return false;
4668        }
4669
4670        /**
4671         * @return {@link #securityLabelNumber} (Security labels that protects the asset.)
4672         */
4673        public UnsignedIntType addSecurityLabelNumberElement() {//2 
4674          UnsignedIntType t = new UnsignedIntType();
4675          if (this.securityLabelNumber == null)
4676            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4677          this.securityLabelNumber.add(t);
4678          return t;
4679        }
4680
4681        /**
4682         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4683         */
4684        public ContractAssetComponent addSecurityLabelNumber(int value) { //1
4685          UnsignedIntType t = new UnsignedIntType();
4686          t.setValue(value);
4687          if (this.securityLabelNumber == null)
4688            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
4689          this.securityLabelNumber.add(t);
4690          return this;
4691        }
4692
4693        /**
4694         * @param value {@link #securityLabelNumber} (Security labels that protects the asset.)
4695         */
4696        public boolean hasSecurityLabelNumber(int value) { 
4697          if (this.securityLabelNumber == null)
4698            return false;
4699          for (UnsignedIntType v : this.securityLabelNumber)
4700            if (v.getValue().equals(value)) // unsignedInt
4701              return true;
4702          return false;
4703        }
4704
4705        /**
4706         * @return {@link #valuedItem} (Contract Valued Item List.)
4707         */
4708        public List<ValuedItemComponent> getValuedItem() { 
4709          if (this.valuedItem == null)
4710            this.valuedItem = new ArrayList<ValuedItemComponent>();
4711          return this.valuedItem;
4712        }
4713
4714        /**
4715         * @return Returns a reference to <code>this</code> for easy method chaining
4716         */
4717        public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) { 
4718          this.valuedItem = theValuedItem;
4719          return this;
4720        }
4721
4722        public boolean hasValuedItem() { 
4723          if (this.valuedItem == null)
4724            return false;
4725          for (ValuedItemComponent item : this.valuedItem)
4726            if (!item.isEmpty())
4727              return true;
4728          return false;
4729        }
4730
4731        public ValuedItemComponent addValuedItem() { //3
4732          ValuedItemComponent t = new ValuedItemComponent();
4733          if (this.valuedItem == null)
4734            this.valuedItem = new ArrayList<ValuedItemComponent>();
4735          this.valuedItem.add(t);
4736          return t;
4737        }
4738
4739        public ContractAssetComponent addValuedItem(ValuedItemComponent t) { //3
4740          if (t == null)
4741            return this;
4742          if (this.valuedItem == null)
4743            this.valuedItem = new ArrayList<ValuedItemComponent>();
4744          this.valuedItem.add(t);
4745          return this;
4746        }
4747
4748        /**
4749         * @return The first repetition of repeating field {@link #valuedItem}, creating it if it does not already exist
4750         */
4751        public ValuedItemComponent getValuedItemFirstRep() { 
4752          if (getValuedItem().isEmpty()) {
4753            addValuedItem();
4754          }
4755          return getValuedItem().get(0);
4756        }
4757
4758        protected void listChildren(List<Property> children) {
4759          super.listChildren(children);
4760          children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
4761          children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type));
4762          children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference));
4763          children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0, java.lang.Integer.MAX_VALUE, subtype));
4764          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));
4765          children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
4766          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));
4767          children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType));
4768          children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period));
4769          children.add(new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
4770          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));
4771          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));
4772          children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer));
4773          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
4774          children.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
4775        }
4776
4777        @Override
4778        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4779          switch (_hash) {
4780          case 109264468: /*scope*/  return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope);
4781          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);
4782          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(Any)", "Associated entities.", 0, java.lang.Integer.MAX_VALUE, typeReference);
4783          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);
4784          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);
4785          case 951530927: /*context*/  return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context);
4786          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);
4787          case 384348315: /*periodType*/  return new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
4788          case -991726143: /*period*/  return new Property("period", "Period", "Asset relevant contractual time period.", 0, java.lang.Integer.MAX_VALUE, period);
4789          case -628382168: /*usePeriod*/  return new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod);
4790          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);
4791          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);
4792          case -1412808770: /*answer*/  return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0, java.lang.Integer.MAX_VALUE, answer);
4793          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
4794          case 2046675654: /*valuedItem*/  return new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem);
4795          default: return super.getNamedProperty(_hash, _name, _checkValid);
4796          }
4797
4798        }
4799
4800      @Override
4801      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4802        switch (hash) {
4803        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
4804        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4805        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
4806        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
4807        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
4808        case 951530927: /*context*/ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
4809        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
4810        case 384348315: /*periodType*/ return this.periodType == null ? new Base[0] : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
4811        case -991726143: /*period*/ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
4812        case -628382168: /*usePeriod*/ return this.usePeriod == null ? new Base[0] : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
4813        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
4814        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
4815        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
4816        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
4817        case 2046675654: /*valuedItem*/ return this.valuedItem == null ? new Base[0] : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
4818        default: return super.getProperty(hash, name, checkValid);
4819        }
4820
4821      }
4822
4823      @Override
4824      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4825        switch (hash) {
4826        case 109264468: // scope
4827          this.scope = castToCodeableConcept(value); // CodeableConcept
4828          return value;
4829        case 3575610: // type
4830          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
4831          return value;
4832        case 2074825009: // typeReference
4833          this.getTypeReference().add(castToReference(value)); // Reference
4834          return value;
4835        case -1867567750: // subtype
4836          this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
4837          return value;
4838        case -261851592: // relationship
4839          this.relationship = castToCoding(value); // Coding
4840          return value;
4841        case 951530927: // context
4842          this.getContext().add((AssetContextComponent) value); // AssetContextComponent
4843          return value;
4844        case -861311717: // condition
4845          this.condition = castToString(value); // StringType
4846          return value;
4847        case 384348315: // periodType
4848          this.getPeriodType().add(castToCodeableConcept(value)); // CodeableConcept
4849          return value;
4850        case -991726143: // period
4851          this.getPeriod().add(castToPeriod(value)); // Period
4852          return value;
4853        case -628382168: // usePeriod
4854          this.getUsePeriod().add(castToPeriod(value)); // Period
4855          return value;
4856        case 3556653: // text
4857          this.text = castToString(value); // StringType
4858          return value;
4859        case -1102667083: // linkId
4860          this.getLinkId().add(castToString(value)); // StringType
4861          return value;
4862        case -1412808770: // answer
4863          this.getAnswer().add((AnswerComponent) value); // AnswerComponent
4864          return value;
4865        case -149460995: // securityLabelNumber
4866          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
4867          return value;
4868        case 2046675654: // valuedItem
4869          this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
4870          return value;
4871        default: return super.setProperty(hash, name, value);
4872        }
4873
4874      }
4875
4876      @Override
4877      public Base setProperty(String name, Base value) throws FHIRException {
4878        if (name.equals("scope")) {
4879          this.scope = castToCodeableConcept(value); // CodeableConcept
4880        } else if (name.equals("type")) {
4881          this.getType().add(castToCodeableConcept(value));
4882        } else if (name.equals("typeReference")) {
4883          this.getTypeReference().add(castToReference(value));
4884        } else if (name.equals("subtype")) {
4885          this.getSubtype().add(castToCodeableConcept(value));
4886        } else if (name.equals("relationship")) {
4887          this.relationship = castToCoding(value); // Coding
4888        } else if (name.equals("context")) {
4889          this.getContext().add((AssetContextComponent) value);
4890        } else if (name.equals("condition")) {
4891          this.condition = castToString(value); // StringType
4892        } else if (name.equals("periodType")) {
4893          this.getPeriodType().add(castToCodeableConcept(value));
4894        } else if (name.equals("period")) {
4895          this.getPeriod().add(castToPeriod(value));
4896        } else if (name.equals("usePeriod")) {
4897          this.getUsePeriod().add(castToPeriod(value));
4898        } else if (name.equals("text")) {
4899          this.text = castToString(value); // StringType
4900        } else if (name.equals("linkId")) {
4901          this.getLinkId().add(castToString(value));
4902        } else if (name.equals("answer")) {
4903          this.getAnswer().add((AnswerComponent) value);
4904        } else if (name.equals("securityLabelNumber")) {
4905          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
4906        } else if (name.equals("valuedItem")) {
4907          this.getValuedItem().add((ValuedItemComponent) value);
4908        } else
4909          return super.setProperty(name, value);
4910        return value;
4911      }
4912
4913      @Override
4914      public Base makeProperty(int hash, String name) throws FHIRException {
4915        switch (hash) {
4916        case 109264468:  return getScope();
4917        case 3575610:  return addType(); 
4918        case 2074825009:  return addTypeReference(); 
4919        case -1867567750:  return addSubtype(); 
4920        case -261851592:  return getRelationship();
4921        case 951530927:  return addContext(); 
4922        case -861311717:  return getConditionElement();
4923        case 384348315:  return addPeriodType(); 
4924        case -991726143:  return addPeriod(); 
4925        case -628382168:  return addUsePeriod(); 
4926        case 3556653:  return getTextElement();
4927        case -1102667083:  return addLinkIdElement();
4928        case -1412808770:  return addAnswer(); 
4929        case -149460995:  return addSecurityLabelNumberElement();
4930        case 2046675654:  return addValuedItem(); 
4931        default: return super.makeProperty(hash, name);
4932        }
4933
4934      }
4935
4936      @Override
4937      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4938        switch (hash) {
4939        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
4940        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4941        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
4942        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
4943        case -261851592: /*relationship*/ return new String[] {"Coding"};
4944        case 951530927: /*context*/ return new String[] {};
4945        case -861311717: /*condition*/ return new String[] {"string"};
4946        case 384348315: /*periodType*/ return new String[] {"CodeableConcept"};
4947        case -991726143: /*period*/ return new String[] {"Period"};
4948        case -628382168: /*usePeriod*/ return new String[] {"Period"};
4949        case 3556653: /*text*/ return new String[] {"string"};
4950        case -1102667083: /*linkId*/ return new String[] {"string"};
4951        case -1412808770: /*answer*/ return new String[] {"@Contract.term.offer.answer"};
4952        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
4953        case 2046675654: /*valuedItem*/ return new String[] {};
4954        default: return super.getTypesForProperty(hash, name);
4955        }
4956
4957      }
4958
4959      @Override
4960      public Base addChild(String name) throws FHIRException {
4961        if (name.equals("scope")) {
4962          this.scope = new CodeableConcept();
4963          return this.scope;
4964        }
4965        else if (name.equals("type")) {
4966          return addType();
4967        }
4968        else if (name.equals("typeReference")) {
4969          return addTypeReference();
4970        }
4971        else if (name.equals("subtype")) {
4972          return addSubtype();
4973        }
4974        else if (name.equals("relationship")) {
4975          this.relationship = new Coding();
4976          return this.relationship;
4977        }
4978        else if (name.equals("context")) {
4979          return addContext();
4980        }
4981        else if (name.equals("condition")) {
4982          throw new FHIRException("Cannot call addChild on a primitive type Contract.condition");
4983        }
4984        else if (name.equals("periodType")) {
4985          return addPeriodType();
4986        }
4987        else if (name.equals("period")) {
4988          return addPeriod();
4989        }
4990        else if (name.equals("usePeriod")) {
4991          return addUsePeriod();
4992        }
4993        else if (name.equals("text")) {
4994          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
4995        }
4996        else if (name.equals("linkId")) {
4997          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
4998        }
4999        else if (name.equals("answer")) {
5000          return addAnswer();
5001        }
5002        else if (name.equals("securityLabelNumber")) {
5003          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
5004        }
5005        else if (name.equals("valuedItem")) {
5006          return addValuedItem();
5007        }
5008        else
5009          return super.addChild(name);
5010      }
5011
5012      public ContractAssetComponent copy() {
5013        ContractAssetComponent dst = new ContractAssetComponent();
5014        copyValues(dst);
5015        return dst;
5016      }
5017
5018      public void copyValues(ContractAssetComponent dst) {
5019        super.copyValues(dst);
5020        dst.scope = scope == null ? null : scope.copy();
5021        if (type != null) {
5022          dst.type = new ArrayList<CodeableConcept>();
5023          for (CodeableConcept i : type)
5024            dst.type.add(i.copy());
5025        };
5026        if (typeReference != null) {
5027          dst.typeReference = new ArrayList<Reference>();
5028          for (Reference i : typeReference)
5029            dst.typeReference.add(i.copy());
5030        };
5031        if (subtype != null) {
5032          dst.subtype = new ArrayList<CodeableConcept>();
5033          for (CodeableConcept i : subtype)
5034            dst.subtype.add(i.copy());
5035        };
5036        dst.relationship = relationship == null ? null : relationship.copy();
5037        if (context != null) {
5038          dst.context = new ArrayList<AssetContextComponent>();
5039          for (AssetContextComponent i : context)
5040            dst.context.add(i.copy());
5041        };
5042        dst.condition = condition == null ? null : condition.copy();
5043        if (periodType != null) {
5044          dst.periodType = new ArrayList<CodeableConcept>();
5045          for (CodeableConcept i : periodType)
5046            dst.periodType.add(i.copy());
5047        };
5048        if (period != null) {
5049          dst.period = new ArrayList<Period>();
5050          for (Period i : period)
5051            dst.period.add(i.copy());
5052        };
5053        if (usePeriod != null) {
5054          dst.usePeriod = new ArrayList<Period>();
5055          for (Period i : usePeriod)
5056            dst.usePeriod.add(i.copy());
5057        };
5058        dst.text = text == null ? null : text.copy();
5059        if (linkId != null) {
5060          dst.linkId = new ArrayList<StringType>();
5061          for (StringType i : linkId)
5062            dst.linkId.add(i.copy());
5063        };
5064        if (answer != null) {
5065          dst.answer = new ArrayList<AnswerComponent>();
5066          for (AnswerComponent i : answer)
5067            dst.answer.add(i.copy());
5068        };
5069        if (securityLabelNumber != null) {
5070          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
5071          for (UnsignedIntType i : securityLabelNumber)
5072            dst.securityLabelNumber.add(i.copy());
5073        };
5074        if (valuedItem != null) {
5075          dst.valuedItem = new ArrayList<ValuedItemComponent>();
5076          for (ValuedItemComponent i : valuedItem)
5077            dst.valuedItem.add(i.copy());
5078        };
5079      }
5080
5081      @Override
5082      public boolean equalsDeep(Base other_) {
5083        if (!super.equalsDeep(other_))
5084          return false;
5085        if (!(other_ instanceof ContractAssetComponent))
5086          return false;
5087        ContractAssetComponent o = (ContractAssetComponent) other_;
5088        return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true) && compareDeep(typeReference, o.typeReference, true)
5089           && compareDeep(subtype, o.subtype, true) && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
5090           && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true) && compareDeep(period, o.period, true)
5091           && compareDeep(usePeriod, o.usePeriod, true) && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
5092           && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
5093           && compareDeep(valuedItem, o.valuedItem, true);
5094      }
5095
5096      @Override
5097      public boolean equalsShallow(Base other_) {
5098        if (!super.equalsShallow(other_))
5099          return false;
5100        if (!(other_ instanceof ContractAssetComponent))
5101          return false;
5102        ContractAssetComponent o = (ContractAssetComponent) other_;
5103        return compareValues(condition, o.condition, true) && compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
5104           && compareValues(securityLabelNumber, o.securityLabelNumber, true);
5105      }
5106
5107      public boolean isEmpty() {
5108        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference
5109          , subtype, relationship, context, condition, periodType, period, usePeriod, text
5110          , linkId, answer, securityLabelNumber, valuedItem);
5111      }
5112
5113  public String fhirType() {
5114    return "Contract.term.asset";
5115
5116  }
5117
5118  }
5119
5120    @Block()
5121    public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
5122        /**
5123         * Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.
5124         */
5125        @Child(name = "reference", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5126        @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." )
5127        protected Reference reference;
5128
5129        /**
5130         * Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.
5131         */
5132        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5133        @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." )
5134        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-assetcontext")
5135        protected List<CodeableConcept> code;
5136
5137        /**
5138         * Context description.
5139         */
5140        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5141        @Description(shortDefinition="Context description", formalDefinition="Context description." )
5142        protected StringType text;
5143
5144        private static final long serialVersionUID = -388598648L;
5145
5146    /**
5147     * Constructor
5148     */
5149      public AssetContextComponent() {
5150        super();
5151      }
5152
5153        /**
5154         * @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.)
5155         */
5156        public Reference getReference() { 
5157          if (this.reference == null)
5158            if (Configuration.errorOnAutoCreate())
5159              throw new Error("Attempt to auto-create AssetContextComponent.reference");
5160            else if (Configuration.doAutoCreate())
5161              this.reference = new Reference(); // cc
5162          return this.reference;
5163        }
5164
5165        public boolean hasReference() { 
5166          return this.reference != null && !this.reference.isEmpty();
5167        }
5168
5169        /**
5170         * @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.)
5171         */
5172        public AssetContextComponent setReference(Reference value) { 
5173          this.reference = value;
5174          return this;
5175        }
5176
5177        /**
5178         * @return {@link #code} (Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.)
5179         */
5180        public List<CodeableConcept> getCode() { 
5181          if (this.code == null)
5182            this.code = new ArrayList<CodeableConcept>();
5183          return this.code;
5184        }
5185
5186        /**
5187         * @return Returns a reference to <code>this</code> for easy method chaining
5188         */
5189        public AssetContextComponent setCode(List<CodeableConcept> theCode) { 
5190          this.code = theCode;
5191          return this;
5192        }
5193
5194        public boolean hasCode() { 
5195          if (this.code == null)
5196            return false;
5197          for (CodeableConcept item : this.code)
5198            if (!item.isEmpty())
5199              return true;
5200          return false;
5201        }
5202
5203        public CodeableConcept addCode() { //3
5204          CodeableConcept t = new CodeableConcept();
5205          if (this.code == null)
5206            this.code = new ArrayList<CodeableConcept>();
5207          this.code.add(t);
5208          return t;
5209        }
5210
5211        public AssetContextComponent addCode(CodeableConcept t) { //3
5212          if (t == null)
5213            return this;
5214          if (this.code == null)
5215            this.code = new ArrayList<CodeableConcept>();
5216          this.code.add(t);
5217          return this;
5218        }
5219
5220        /**
5221         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
5222         */
5223        public CodeableConcept getCodeFirstRep() { 
5224          if (getCode().isEmpty()) {
5225            addCode();
5226          }
5227          return getCode().get(0);
5228        }
5229
5230        /**
5231         * @return {@link #text} (Context description.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
5232         */
5233        public StringType getTextElement() { 
5234          if (this.text == null)
5235            if (Configuration.errorOnAutoCreate())
5236              throw new Error("Attempt to auto-create AssetContextComponent.text");
5237            else if (Configuration.doAutoCreate())
5238              this.text = new StringType(); // bb
5239          return this.text;
5240        }
5241
5242        public boolean hasTextElement() { 
5243          return this.text != null && !this.text.isEmpty();
5244        }
5245
5246        public boolean hasText() { 
5247          return this.text != null && !this.text.isEmpty();
5248        }
5249
5250        /**
5251         * @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
5252         */
5253        public AssetContextComponent setTextElement(StringType value) { 
5254          this.text = value;
5255          return this;
5256        }
5257
5258        /**
5259         * @return Context description.
5260         */
5261        public String getText() { 
5262          return this.text == null ? null : this.text.getValue();
5263        }
5264
5265        /**
5266         * @param value Context description.
5267         */
5268        public AssetContextComponent setText(String value) { 
5269          if (Utilities.noString(value))
5270            this.text = null;
5271          else {
5272            if (this.text == null)
5273              this.text = new StringType();
5274            this.text.setValue(value);
5275          }
5276          return this;
5277        }
5278
5279        protected void listChildren(List<Property> children) {
5280          super.listChildren(children);
5281          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));
5282          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));
5283          children.add(new Property("text", "string", "Context description.", 0, 1, text));
5284        }
5285
5286        @Override
5287        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5288          switch (_hash) {
5289          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);
5290          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);
5291          case 3556653: /*text*/  return new Property("text", "string", "Context description.", 0, 1, text);
5292          default: return super.getNamedProperty(_hash, _name, _checkValid);
5293          }
5294
5295        }
5296
5297      @Override
5298      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5299        switch (hash) {
5300        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
5301        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
5302        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
5303        default: return super.getProperty(hash, name, checkValid);
5304        }
5305
5306      }
5307
5308      @Override
5309      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5310        switch (hash) {
5311        case -925155509: // reference
5312          this.reference = castToReference(value); // Reference
5313          return value;
5314        case 3059181: // code
5315          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
5316          return value;
5317        case 3556653: // text
5318          this.text = castToString(value); // StringType
5319          return value;
5320        default: return super.setProperty(hash, name, value);
5321        }
5322
5323      }
5324
5325      @Override
5326      public Base setProperty(String name, Base value) throws FHIRException {
5327        if (name.equals("reference")) {
5328          this.reference = castToReference(value); // Reference
5329        } else if (name.equals("code")) {
5330          this.getCode().add(castToCodeableConcept(value));
5331        } else if (name.equals("text")) {
5332          this.text = castToString(value); // StringType
5333        } else
5334          return super.setProperty(name, value);
5335        return value;
5336      }
5337
5338      @Override
5339      public Base makeProperty(int hash, String name) throws FHIRException {
5340        switch (hash) {
5341        case -925155509:  return getReference();
5342        case 3059181:  return addCode(); 
5343        case 3556653:  return getTextElement();
5344        default: return super.makeProperty(hash, name);
5345        }
5346
5347      }
5348
5349      @Override
5350      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5351        switch (hash) {
5352        case -925155509: /*reference*/ return new String[] {"Reference"};
5353        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
5354        case 3556653: /*text*/ return new String[] {"string"};
5355        default: return super.getTypesForProperty(hash, name);
5356        }
5357
5358      }
5359
5360      @Override
5361      public Base addChild(String name) throws FHIRException {
5362        if (name.equals("reference")) {
5363          this.reference = new Reference();
5364          return this.reference;
5365        }
5366        else if (name.equals("code")) {
5367          return addCode();
5368        }
5369        else if (name.equals("text")) {
5370          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
5371        }
5372        else
5373          return super.addChild(name);
5374      }
5375
5376      public AssetContextComponent copy() {
5377        AssetContextComponent dst = new AssetContextComponent();
5378        copyValues(dst);
5379        return dst;
5380      }
5381
5382      public void copyValues(AssetContextComponent dst) {
5383        super.copyValues(dst);
5384        dst.reference = reference == null ? null : reference.copy();
5385        if (code != null) {
5386          dst.code = new ArrayList<CodeableConcept>();
5387          for (CodeableConcept i : code)
5388            dst.code.add(i.copy());
5389        };
5390        dst.text = text == null ? null : text.copy();
5391      }
5392
5393      @Override
5394      public boolean equalsDeep(Base other_) {
5395        if (!super.equalsDeep(other_))
5396          return false;
5397        if (!(other_ instanceof AssetContextComponent))
5398          return false;
5399        AssetContextComponent o = (AssetContextComponent) other_;
5400        return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
5401          ;
5402      }
5403
5404      @Override
5405      public boolean equalsShallow(Base other_) {
5406        if (!super.equalsShallow(other_))
5407          return false;
5408        if (!(other_ instanceof AssetContextComponent))
5409          return false;
5410        AssetContextComponent o = (AssetContextComponent) other_;
5411        return compareValues(text, o.text, true);
5412      }
5413
5414      public boolean isEmpty() {
5415        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
5416      }
5417
5418  public String fhirType() {
5419    return "Contract.term.asset.context";
5420
5421  }
5422
5423  }
5424
5425    @Block()
5426    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
5427        /**
5428         * Specific type of Contract Valued Item that may be priced.
5429         */
5430        @Child(name = "entity", type = {CodeableConcept.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
5431        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
5432        protected Type entity;
5433
5434        /**
5435         * Identifies a Contract Valued Item instance.
5436         */
5437        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
5438        @Description(shortDefinition="Contract Valued Item Number", formalDefinition="Identifies a Contract Valued Item instance." )
5439        protected Identifier identifier;
5440
5441        /**
5442         * Indicates the time during which this Contract ValuedItem information is effective.
5443         */
5444        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5445        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
5446        protected DateTimeType effectiveTime;
5447
5448        /**
5449         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
5450         */
5451        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
5452        @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." )
5453        protected Quantity quantity;
5454
5455        /**
5456         * A Contract Valued Item unit valuation measure.
5457         */
5458        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
5459        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
5460        protected Money unitPrice;
5461
5462        /**
5463         * 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.
5464         */
5465        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5466        @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." )
5467        protected DecimalType factor;
5468
5469        /**
5470         * 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.
5471         */
5472        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5473        @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." )
5474        protected DecimalType points;
5475
5476        /**
5477         * 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.
5478         */
5479        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5480        @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." )
5481        protected Money net;
5482
5483        /**
5484         * Terms of valuation.
5485         */
5486        @Child(name = "payment", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5487        @Description(shortDefinition="Terms of valuation", formalDefinition="Terms of valuation." )
5488        protected StringType payment;
5489
5490        /**
5491         * When payment is due.
5492         */
5493        @Child(name = "paymentDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5494        @Description(shortDefinition="When payment is due", formalDefinition="When payment is due." )
5495        protected DateTimeType paymentDate;
5496
5497        /**
5498         * Who will make payment.
5499         */
5500        @Child(name = "responsible", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=false)
5501        @Description(shortDefinition="Who will make payment", formalDefinition="Who will make payment." )
5502        protected Reference responsible;
5503
5504        /**
5505         * Who will receive payment.
5506         */
5507        @Child(name = "recipient", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=12, min=0, max=1, modifier=false, summary=false)
5508        @Description(shortDefinition="Who will receive payment", formalDefinition="Who will receive payment." )
5509        protected Reference recipient;
5510
5511        /**
5512         * Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.
5513         */
5514        @Child(name = "linkId", type = {StringType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5515        @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." )
5516        protected List<StringType> linkId;
5517
5518        /**
5519         * A set of security labels that define which terms are controlled by this condition.
5520         */
5521        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5522        @Description(shortDefinition="Security Labels that define affected terms", formalDefinition="A set of security labels that define which terms are controlled by this condition." )
5523        protected List<UnsignedIntType> securityLabelNumber;
5524
5525        private static final long serialVersionUID = -1559329888L;
5526
5527    /**
5528     * Constructor
5529     */
5530      public ValuedItemComponent() {
5531        super();
5532      }
5533
5534        /**
5535         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5536         */
5537        public Type getEntity() { 
5538          return this.entity;
5539        }
5540
5541        /**
5542         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5543         */
5544        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
5545          if (this.entity == null)
5546            this.entity = new CodeableConcept();
5547          if (!(this.entity instanceof CodeableConcept))
5548            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
5549          return (CodeableConcept) this.entity;
5550        }
5551
5552        public boolean hasEntityCodeableConcept() { 
5553          return this != null && this.entity instanceof CodeableConcept;
5554        }
5555
5556        /**
5557         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5558         */
5559        public Reference getEntityReference() throws FHIRException { 
5560          if (this.entity == null)
5561            this.entity = new Reference();
5562          if (!(this.entity instanceof Reference))
5563            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
5564          return (Reference) this.entity;
5565        }
5566
5567        public boolean hasEntityReference() { 
5568          return this != null && this.entity instanceof Reference;
5569        }
5570
5571        public boolean hasEntity() { 
5572          return this.entity != null && !this.entity.isEmpty();
5573        }
5574
5575        /**
5576         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
5577         */
5578        public ValuedItemComponent setEntity(Type value) { 
5579          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
5580            throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: "+value.fhirType());
5581          this.entity = value;
5582          return this;
5583        }
5584
5585        /**
5586         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
5587         */
5588        public Identifier getIdentifier() { 
5589          if (this.identifier == null)
5590            if (Configuration.errorOnAutoCreate())
5591              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
5592            else if (Configuration.doAutoCreate())
5593              this.identifier = new Identifier(); // cc
5594          return this.identifier;
5595        }
5596
5597        public boolean hasIdentifier() { 
5598          return this.identifier != null && !this.identifier.isEmpty();
5599        }
5600
5601        /**
5602         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
5603         */
5604        public ValuedItemComponent setIdentifier(Identifier value) { 
5605          this.identifier = value;
5606          return this;
5607        }
5608
5609        /**
5610         * @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
5611         */
5612        public DateTimeType getEffectiveTimeElement() { 
5613          if (this.effectiveTime == null)
5614            if (Configuration.errorOnAutoCreate())
5615              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
5616            else if (Configuration.doAutoCreate())
5617              this.effectiveTime = new DateTimeType(); // bb
5618          return this.effectiveTime;
5619        }
5620
5621        public boolean hasEffectiveTimeElement() { 
5622          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5623        }
5624
5625        public boolean hasEffectiveTime() { 
5626          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
5627        }
5628
5629        /**
5630         * @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
5631         */
5632        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
5633          this.effectiveTime = value;
5634          return this;
5635        }
5636
5637        /**
5638         * @return Indicates the time during which this Contract ValuedItem information is effective.
5639         */
5640        public Date getEffectiveTime() { 
5641          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
5642        }
5643
5644        /**
5645         * @param value Indicates the time during which this Contract ValuedItem information is effective.
5646         */
5647        public ValuedItemComponent setEffectiveTime(Date value) { 
5648          if (value == null)
5649            this.effectiveTime = null;
5650          else {
5651            if (this.effectiveTime == null)
5652              this.effectiveTime = new DateTimeType();
5653            this.effectiveTime.setValue(value);
5654          }
5655          return this;
5656        }
5657
5658        /**
5659         * @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.)
5660         */
5661        public Quantity getQuantity() { 
5662          if (this.quantity == null)
5663            if (Configuration.errorOnAutoCreate())
5664              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
5665            else if (Configuration.doAutoCreate())
5666              this.quantity = new Quantity(); // cc
5667          return this.quantity;
5668        }
5669
5670        public boolean hasQuantity() { 
5671          return this.quantity != null && !this.quantity.isEmpty();
5672        }
5673
5674        /**
5675         * @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.)
5676         */
5677        public ValuedItemComponent setQuantity(Quantity value) { 
5678          this.quantity = value;
5679          return this;
5680        }
5681
5682        /**
5683         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5684         */
5685        public Money getUnitPrice() { 
5686          if (this.unitPrice == null)
5687            if (Configuration.errorOnAutoCreate())
5688              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
5689            else if (Configuration.doAutoCreate())
5690              this.unitPrice = new Money(); // cc
5691          return this.unitPrice;
5692        }
5693
5694        public boolean hasUnitPrice() { 
5695          return this.unitPrice != null && !this.unitPrice.isEmpty();
5696        }
5697
5698        /**
5699         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
5700         */
5701        public ValuedItemComponent setUnitPrice(Money value) { 
5702          this.unitPrice = value;
5703          return this;
5704        }
5705
5706        /**
5707         * @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
5708         */
5709        public DecimalType getFactorElement() { 
5710          if (this.factor == null)
5711            if (Configuration.errorOnAutoCreate())
5712              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
5713            else if (Configuration.doAutoCreate())
5714              this.factor = new DecimalType(); // bb
5715          return this.factor;
5716        }
5717
5718        public boolean hasFactorElement() { 
5719          return this.factor != null && !this.factor.isEmpty();
5720        }
5721
5722        public boolean hasFactor() { 
5723          return this.factor != null && !this.factor.isEmpty();
5724        }
5725
5726        /**
5727         * @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
5728         */
5729        public ValuedItemComponent setFactorElement(DecimalType value) { 
5730          this.factor = value;
5731          return this;
5732        }
5733
5734        /**
5735         * @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.
5736         */
5737        public BigDecimal getFactor() { 
5738          return this.factor == null ? null : this.factor.getValue();
5739        }
5740
5741        /**
5742         * @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.
5743         */
5744        public ValuedItemComponent setFactor(BigDecimal value) { 
5745          if (value == null)
5746            this.factor = null;
5747          else {
5748            if (this.factor == null)
5749              this.factor = new DecimalType();
5750            this.factor.setValue(value);
5751          }
5752          return this;
5753        }
5754
5755        /**
5756         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5757         */
5758        public ValuedItemComponent setFactor(long value) { 
5759              this.factor = new DecimalType();
5760            this.factor.setValue(value);
5761          return this;
5762        }
5763
5764        /**
5765         * @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.
5766         */
5767        public ValuedItemComponent setFactor(double value) { 
5768              this.factor = new DecimalType();
5769            this.factor.setValue(value);
5770          return this;
5771        }
5772
5773        /**
5774         * @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
5775         */
5776        public DecimalType getPointsElement() { 
5777          if (this.points == null)
5778            if (Configuration.errorOnAutoCreate())
5779              throw new Error("Attempt to auto-create ValuedItemComponent.points");
5780            else if (Configuration.doAutoCreate())
5781              this.points = new DecimalType(); // bb
5782          return this.points;
5783        }
5784
5785        public boolean hasPointsElement() { 
5786          return this.points != null && !this.points.isEmpty();
5787        }
5788
5789        public boolean hasPoints() { 
5790          return this.points != null && !this.points.isEmpty();
5791        }
5792
5793        /**
5794         * @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
5795         */
5796        public ValuedItemComponent setPointsElement(DecimalType value) { 
5797          this.points = value;
5798          return this;
5799        }
5800
5801        /**
5802         * @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.
5803         */
5804        public BigDecimal getPoints() { 
5805          return this.points == null ? null : this.points.getValue();
5806        }
5807
5808        /**
5809         * @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.
5810         */
5811        public ValuedItemComponent setPoints(BigDecimal value) { 
5812          if (value == null)
5813            this.points = null;
5814          else {
5815            if (this.points == null)
5816              this.points = new DecimalType();
5817            this.points.setValue(value);
5818          }
5819          return this;
5820        }
5821
5822        /**
5823         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
5824         */
5825        public ValuedItemComponent setPoints(long value) { 
5826              this.points = new DecimalType();
5827            this.points.setValue(value);
5828          return this;
5829        }
5830
5831        /**
5832         * @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.
5833         */
5834        public ValuedItemComponent setPoints(double value) { 
5835              this.points = new DecimalType();
5836            this.points.setValue(value);
5837          return this;
5838        }
5839
5840        /**
5841         * @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.)
5842         */
5843        public Money getNet() { 
5844          if (this.net == null)
5845            if (Configuration.errorOnAutoCreate())
5846              throw new Error("Attempt to auto-create ValuedItemComponent.net");
5847            else if (Configuration.doAutoCreate())
5848              this.net = new Money(); // cc
5849          return this.net;
5850        }
5851
5852        public boolean hasNet() { 
5853          return this.net != null && !this.net.isEmpty();
5854        }
5855
5856        /**
5857         * @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.)
5858         */
5859        public ValuedItemComponent setNet(Money value) { 
5860          this.net = value;
5861          return this;
5862        }
5863
5864        /**
5865         * @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
5866         */
5867        public StringType getPaymentElement() { 
5868          if (this.payment == null)
5869            if (Configuration.errorOnAutoCreate())
5870              throw new Error("Attempt to auto-create ValuedItemComponent.payment");
5871            else if (Configuration.doAutoCreate())
5872              this.payment = new StringType(); // bb
5873          return this.payment;
5874        }
5875
5876        public boolean hasPaymentElement() { 
5877          return this.payment != null && !this.payment.isEmpty();
5878        }
5879
5880        public boolean hasPayment() { 
5881          return this.payment != null && !this.payment.isEmpty();
5882        }
5883
5884        /**
5885         * @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
5886         */
5887        public ValuedItemComponent setPaymentElement(StringType value) { 
5888          this.payment = value;
5889          return this;
5890        }
5891
5892        /**
5893         * @return Terms of valuation.
5894         */
5895        public String getPayment() { 
5896          return this.payment == null ? null : this.payment.getValue();
5897        }
5898
5899        /**
5900         * @param value Terms of valuation.
5901         */
5902        public ValuedItemComponent setPayment(String value) { 
5903          if (Utilities.noString(value))
5904            this.payment = null;
5905          else {
5906            if (this.payment == null)
5907              this.payment = new StringType();
5908            this.payment.setValue(value);
5909          }
5910          return this;
5911        }
5912
5913        /**
5914         * @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
5915         */
5916        public DateTimeType getPaymentDateElement() { 
5917          if (this.paymentDate == null)
5918            if (Configuration.errorOnAutoCreate())
5919              throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
5920            else if (Configuration.doAutoCreate())
5921              this.paymentDate = new DateTimeType(); // bb
5922          return this.paymentDate;
5923        }
5924
5925        public boolean hasPaymentDateElement() { 
5926          return this.paymentDate != null && !this.paymentDate.isEmpty();
5927        }
5928
5929        public boolean hasPaymentDate() { 
5930          return this.paymentDate != null && !this.paymentDate.isEmpty();
5931        }
5932
5933        /**
5934         * @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
5935         */
5936        public ValuedItemComponent setPaymentDateElement(DateTimeType value) { 
5937          this.paymentDate = value;
5938          return this;
5939        }
5940
5941        /**
5942         * @return When payment is due.
5943         */
5944        public Date getPaymentDate() { 
5945          return this.paymentDate == null ? null : this.paymentDate.getValue();
5946        }
5947
5948        /**
5949         * @param value When payment is due.
5950         */
5951        public ValuedItemComponent setPaymentDate(Date value) { 
5952          if (value == null)
5953            this.paymentDate = null;
5954          else {
5955            if (this.paymentDate == null)
5956              this.paymentDate = new DateTimeType();
5957            this.paymentDate.setValue(value);
5958          }
5959          return this;
5960        }
5961
5962        /**
5963         * @return {@link #responsible} (Who will make payment.)
5964         */
5965        public Reference getResponsible() { 
5966          if (this.responsible == null)
5967            if (Configuration.errorOnAutoCreate())
5968              throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
5969            else if (Configuration.doAutoCreate())
5970              this.responsible = new Reference(); // cc
5971          return this.responsible;
5972        }
5973
5974        public boolean hasResponsible() { 
5975          return this.responsible != null && !this.responsible.isEmpty();
5976        }
5977
5978        /**
5979         * @param value {@link #responsible} (Who will make payment.)
5980         */
5981        public ValuedItemComponent setResponsible(Reference value) { 
5982          this.responsible = value;
5983          return this;
5984        }
5985
5986        /**
5987         * @return {@link #recipient} (Who will receive payment.)
5988         */
5989        public Reference getRecipient() { 
5990          if (this.recipient == null)
5991            if (Configuration.errorOnAutoCreate())
5992              throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
5993            else if (Configuration.doAutoCreate())
5994              this.recipient = new Reference(); // cc
5995          return this.recipient;
5996        }
5997
5998        public boolean hasRecipient() { 
5999          return this.recipient != null && !this.recipient.isEmpty();
6000        }
6001
6002        /**
6003         * @param value {@link #recipient} (Who will receive payment.)
6004         */
6005        public ValuedItemComponent setRecipient(Reference value) { 
6006          this.recipient = value;
6007          return this;
6008        }
6009
6010        /**
6011         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6012         */
6013        public List<StringType> getLinkId() { 
6014          if (this.linkId == null)
6015            this.linkId = new ArrayList<StringType>();
6016          return this.linkId;
6017        }
6018
6019        /**
6020         * @return Returns a reference to <code>this</code> for easy method chaining
6021         */
6022        public ValuedItemComponent setLinkId(List<StringType> theLinkId) { 
6023          this.linkId = theLinkId;
6024          return this;
6025        }
6026
6027        public boolean hasLinkId() { 
6028          if (this.linkId == null)
6029            return false;
6030          for (StringType item : this.linkId)
6031            if (!item.isEmpty())
6032              return true;
6033          return false;
6034        }
6035
6036        /**
6037         * @return {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6038         */
6039        public StringType addLinkIdElement() {//2 
6040          StringType t = new StringType();
6041          if (this.linkId == null)
6042            this.linkId = new ArrayList<StringType>();
6043          this.linkId.add(t);
6044          return t;
6045        }
6046
6047        /**
6048         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6049         */
6050        public ValuedItemComponent addLinkId(String value) { //1
6051          StringType t = new StringType();
6052          t.setValue(value);
6053          if (this.linkId == null)
6054            this.linkId = new ArrayList<StringType>();
6055          this.linkId.add(t);
6056          return this;
6057        }
6058
6059        /**
6060         * @param value {@link #linkId} (Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.)
6061         */
6062        public boolean hasLinkId(String value) { 
6063          if (this.linkId == null)
6064            return false;
6065          for (StringType v : this.linkId)
6066            if (v.getValue().equals(value)) // string
6067              return true;
6068          return false;
6069        }
6070
6071        /**
6072         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6073         */
6074        public List<UnsignedIntType> getSecurityLabelNumber() { 
6075          if (this.securityLabelNumber == null)
6076            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6077          return this.securityLabelNumber;
6078        }
6079
6080        /**
6081         * @return Returns a reference to <code>this</code> for easy method chaining
6082         */
6083        public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
6084          this.securityLabelNumber = theSecurityLabelNumber;
6085          return this;
6086        }
6087
6088        public boolean hasSecurityLabelNumber() { 
6089          if (this.securityLabelNumber == null)
6090            return false;
6091          for (UnsignedIntType item : this.securityLabelNumber)
6092            if (!item.isEmpty())
6093              return true;
6094          return false;
6095        }
6096
6097        /**
6098         * @return {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6099         */
6100        public UnsignedIntType addSecurityLabelNumberElement() {//2 
6101          UnsignedIntType t = new UnsignedIntType();
6102          if (this.securityLabelNumber == null)
6103            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6104          this.securityLabelNumber.add(t);
6105          return t;
6106        }
6107
6108        /**
6109         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6110         */
6111        public ValuedItemComponent addSecurityLabelNumber(int value) { //1
6112          UnsignedIntType t = new UnsignedIntType();
6113          t.setValue(value);
6114          if (this.securityLabelNumber == null)
6115            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
6116          this.securityLabelNumber.add(t);
6117          return this;
6118        }
6119
6120        /**
6121         * @param value {@link #securityLabelNumber} (A set of security labels that define which terms are controlled by this condition.)
6122         */
6123        public boolean hasSecurityLabelNumber(int value) { 
6124          if (this.securityLabelNumber == null)
6125            return false;
6126          for (UnsignedIntType v : this.securityLabelNumber)
6127            if (v.getValue().equals(value)) // unsignedInt
6128              return true;
6129          return false;
6130        }
6131
6132        protected void listChildren(List<Property> children) {
6133          super.listChildren(children);
6134          children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
6135          children.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
6136          children.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
6137          children.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity));
6138          children.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
6139          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));
6140          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));
6141          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));
6142          children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
6143          children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
6144          children.add(new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible));
6145          children.add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient));
6146          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));
6147          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));
6148        }
6149
6150        @Override
6151        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6152          switch (_hash) {
6153          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);
6154          case -1298275357: /*entity*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6155          case 924197182: /*entityCodeableConcept*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6156          case -356635992: /*entityReference*/  return new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
6157          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier);
6158          case -929905388: /*effectiveTime*/  return new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
6159          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, 1, quantity);
6160          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice);
6161          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);
6162          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);
6163          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);
6164          case -786681338: /*payment*/  return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
6165          case -1540873516: /*paymentDate*/  return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
6166          case 1847674614: /*responsible*/  return new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0, 1, responsible);
6167          case 820081177: /*recipient*/  return new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.", 0, 1, recipient);
6168          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);
6169          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);
6170          default: return super.getNamedProperty(_hash, _name, _checkValid);
6171          }
6172
6173        }
6174
6175      @Override
6176      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6177        switch (hash) {
6178        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Type
6179        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
6180        case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // DateTimeType
6181        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6182        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6183        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6184        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
6185        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6186        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // StringType
6187        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateTimeType
6188        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // Reference
6189        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : new Base[] {this.recipient}; // Reference
6190        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
6191        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
6192        default: return super.getProperty(hash, name, checkValid);
6193        }
6194
6195      }
6196
6197      @Override
6198      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6199        switch (hash) {
6200        case -1298275357: // entity
6201          this.entity = castToType(value); // Type
6202          return value;
6203        case -1618432855: // identifier
6204          this.identifier = castToIdentifier(value); // Identifier
6205          return value;
6206        case -929905388: // effectiveTime
6207          this.effectiveTime = castToDateTime(value); // DateTimeType
6208          return value;
6209        case -1285004149: // quantity
6210          this.quantity = castToQuantity(value); // Quantity
6211          return value;
6212        case -486196699: // unitPrice
6213          this.unitPrice = castToMoney(value); // Money
6214          return value;
6215        case -1282148017: // factor
6216          this.factor = castToDecimal(value); // DecimalType
6217          return value;
6218        case -982754077: // points
6219          this.points = castToDecimal(value); // DecimalType
6220          return value;
6221        case 108957: // net
6222          this.net = castToMoney(value); // Money
6223          return value;
6224        case -786681338: // payment
6225          this.payment = castToString(value); // StringType
6226          return value;
6227        case -1540873516: // paymentDate
6228          this.paymentDate = castToDateTime(value); // DateTimeType
6229          return value;
6230        case 1847674614: // responsible
6231          this.responsible = castToReference(value); // Reference
6232          return value;
6233        case 820081177: // recipient
6234          this.recipient = castToReference(value); // Reference
6235          return value;
6236        case -1102667083: // linkId
6237          this.getLinkId().add(castToString(value)); // StringType
6238          return value;
6239        case -149460995: // securityLabelNumber
6240          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
6241          return value;
6242        default: return super.setProperty(hash, name, value);
6243        }
6244
6245      }
6246
6247      @Override
6248      public Base setProperty(String name, Base value) throws FHIRException {
6249        if (name.equals("entity[x]")) {
6250          this.entity = castToType(value); // Type
6251        } else if (name.equals("identifier")) {
6252          this.identifier = castToIdentifier(value); // Identifier
6253        } else if (name.equals("effectiveTime")) {
6254          this.effectiveTime = castToDateTime(value); // DateTimeType
6255        } else if (name.equals("quantity")) {
6256          this.quantity = castToQuantity(value); // Quantity
6257        } else if (name.equals("unitPrice")) {
6258          this.unitPrice = castToMoney(value); // Money
6259        } else if (name.equals("factor")) {
6260          this.factor = castToDecimal(value); // DecimalType
6261        } else if (name.equals("points")) {
6262          this.points = castToDecimal(value); // DecimalType
6263        } else if (name.equals("net")) {
6264          this.net = castToMoney(value); // Money
6265        } else if (name.equals("payment")) {
6266          this.payment = castToString(value); // StringType
6267        } else if (name.equals("paymentDate")) {
6268          this.paymentDate = castToDateTime(value); // DateTimeType
6269        } else if (name.equals("responsible")) {
6270          this.responsible = castToReference(value); // Reference
6271        } else if (name.equals("recipient")) {
6272          this.recipient = castToReference(value); // Reference
6273        } else if (name.equals("linkId")) {
6274          this.getLinkId().add(castToString(value));
6275        } else if (name.equals("securityLabelNumber")) {
6276          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
6277        } else
6278          return super.setProperty(name, value);
6279        return value;
6280      }
6281
6282      @Override
6283      public Base makeProperty(int hash, String name) throws FHIRException {
6284        switch (hash) {
6285        case -740568643:  return getEntity();
6286        case -1298275357:  return getEntity();
6287        case -1618432855:  return getIdentifier();
6288        case -929905388:  return getEffectiveTimeElement();
6289        case -1285004149:  return getQuantity();
6290        case -486196699:  return getUnitPrice();
6291        case -1282148017:  return getFactorElement();
6292        case -982754077:  return getPointsElement();
6293        case 108957:  return getNet();
6294        case -786681338:  return getPaymentElement();
6295        case -1540873516:  return getPaymentDateElement();
6296        case 1847674614:  return getResponsible();
6297        case 820081177:  return getRecipient();
6298        case -1102667083:  return addLinkIdElement();
6299        case -149460995:  return addSecurityLabelNumberElement();
6300        default: return super.makeProperty(hash, name);
6301        }
6302
6303      }
6304
6305      @Override
6306      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6307        switch (hash) {
6308        case -1298275357: /*entity*/ return new String[] {"CodeableConcept", "Reference"};
6309        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6310        case -929905388: /*effectiveTime*/ return new String[] {"dateTime"};
6311        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6312        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6313        case -1282148017: /*factor*/ return new String[] {"decimal"};
6314        case -982754077: /*points*/ return new String[] {"decimal"};
6315        case 108957: /*net*/ return new String[] {"Money"};
6316        case -786681338: /*payment*/ return new String[] {"string"};
6317        case -1540873516: /*paymentDate*/ return new String[] {"dateTime"};
6318        case 1847674614: /*responsible*/ return new String[] {"Reference"};
6319        case 820081177: /*recipient*/ return new String[] {"Reference"};
6320        case -1102667083: /*linkId*/ return new String[] {"string"};
6321        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
6322        default: return super.getTypesForProperty(hash, name);
6323        }
6324
6325      }
6326
6327      @Override
6328      public Base addChild(String name) throws FHIRException {
6329        if (name.equals("entityCodeableConcept")) {
6330          this.entity = new CodeableConcept();
6331          return this.entity;
6332        }
6333        else if (name.equals("entityReference")) {
6334          this.entity = new Reference();
6335          return this.entity;
6336        }
6337        else if (name.equals("identifier")) {
6338          this.identifier = new Identifier();
6339          return this.identifier;
6340        }
6341        else if (name.equals("effectiveTime")) {
6342          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
6343        }
6344        else if (name.equals("quantity")) {
6345          this.quantity = new Quantity();
6346          return this.quantity;
6347        }
6348        else if (name.equals("unitPrice")) {
6349          this.unitPrice = new Money();
6350          return this.unitPrice;
6351        }
6352        else if (name.equals("factor")) {
6353          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
6354        }
6355        else if (name.equals("points")) {
6356          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
6357        }
6358        else if (name.equals("net")) {
6359          this.net = new Money();
6360          return this.net;
6361        }
6362        else if (name.equals("payment")) {
6363          throw new FHIRException("Cannot call addChild on a primitive type Contract.payment");
6364        }
6365        else if (name.equals("paymentDate")) {
6366          throw new FHIRException("Cannot call addChild on a primitive type Contract.paymentDate");
6367        }
6368        else if (name.equals("responsible")) {
6369          this.responsible = new Reference();
6370          return this.responsible;
6371        }
6372        else if (name.equals("recipient")) {
6373          this.recipient = new Reference();
6374          return this.recipient;
6375        }
6376        else if (name.equals("linkId")) {
6377          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
6378        }
6379        else if (name.equals("securityLabelNumber")) {
6380          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
6381        }
6382        else
6383          return super.addChild(name);
6384      }
6385
6386      public ValuedItemComponent copy() {
6387        ValuedItemComponent dst = new ValuedItemComponent();
6388        copyValues(dst);
6389        return dst;
6390      }
6391
6392      public void copyValues(ValuedItemComponent dst) {
6393        super.copyValues(dst);
6394        dst.entity = entity == null ? null : entity.copy();
6395        dst.identifier = identifier == null ? null : identifier.copy();
6396        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
6397        dst.quantity = quantity == null ? null : quantity.copy();
6398        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6399        dst.factor = factor == null ? null : factor.copy();
6400        dst.points = points == null ? null : points.copy();
6401        dst.net = net == null ? null : net.copy();
6402        dst.payment = payment == null ? null : payment.copy();
6403        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
6404        dst.responsible = responsible == null ? null : responsible.copy();
6405        dst.recipient = recipient == null ? null : recipient.copy();
6406        if (linkId != null) {
6407          dst.linkId = new ArrayList<StringType>();
6408          for (StringType i : linkId)
6409            dst.linkId.add(i.copy());
6410        };
6411        if (securityLabelNumber != null) {
6412          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6413          for (UnsignedIntType i : securityLabelNumber)
6414            dst.securityLabelNumber.add(i.copy());
6415        };
6416      }
6417
6418      @Override
6419      public boolean equalsDeep(Base other_) {
6420        if (!super.equalsDeep(other_))
6421          return false;
6422        if (!(other_ instanceof ValuedItemComponent))
6423          return false;
6424        ValuedItemComponent o = (ValuedItemComponent) other_;
6425        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
6426           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6427           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(payment, o.payment, true)
6428           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(responsible, o.responsible, true)
6429           && compareDeep(recipient, o.recipient, true) && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6430          ;
6431      }
6432
6433      @Override
6434      public boolean equalsShallow(Base other_) {
6435        if (!super.equalsShallow(other_))
6436          return false;
6437        if (!(other_ instanceof ValuedItemComponent))
6438          return false;
6439        ValuedItemComponent o = (ValuedItemComponent) other_;
6440        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
6441           && compareValues(points, o.points, true) && compareValues(payment, o.payment, true) && compareValues(paymentDate, o.paymentDate, true)
6442           && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
6443          ;
6444      }
6445
6446      public boolean isEmpty() {
6447        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime
6448          , quantity, unitPrice, factor, points, net, payment, paymentDate, responsible
6449          , recipient, linkId, securityLabelNumber);
6450      }
6451
6452  public String fhirType() {
6453    return "Contract.term.asset.valuedItem";
6454
6455  }
6456
6457  }
6458
6459    @Block()
6460    public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
6461        /**
6462         * True if the term prohibits the  action.
6463         */
6464        @Child(name = "doNotPerform", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=false)
6465        @Description(shortDefinition="True if the term prohibits the  action", formalDefinition="True if the term prohibits the  action." )
6466        protected BooleanType doNotPerform;
6467
6468        /**
6469         * Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.
6470         */
6471        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
6472        @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." )
6473        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-action")
6474        protected CodeableConcept type;
6475
6476        /**
6477         * Entity of the action.
6478         */
6479        @Child(name = "subject", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6480        @Description(shortDefinition="Entity of the action", formalDefinition="Entity of the action." )
6481        protected List<ActionSubjectComponent> subject;
6482
6483        /**
6484         * Reason or purpose for the action stipulated by this Contract Provision.
6485         */
6486        @Child(name = "intent", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6487        @Description(shortDefinition="Purpose for the Contract Term Action", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
6488        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6489        protected CodeableConcept intent;
6490
6491        /**
6492         * Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.
6493         */
6494        @Child(name = "linkId", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6495        @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." )
6496        protected List<StringType> linkId;
6497
6498        /**
6499         * Current state of the term action.
6500         */
6501        @Child(name = "status", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=false, summary=false)
6502        @Description(shortDefinition="State of the action", formalDefinition="Current state of the term action." )
6503        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actionstatus")
6504        protected CodeableConcept status;
6505
6506        /**
6507         * Encounter or Episode with primary association to specified term activity.
6508         */
6509        @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=false)
6510        @Description(shortDefinition="Episode associated with action", formalDefinition="Encounter or Episode with primary association to specified term activity." )
6511        protected Reference context;
6512
6513        /**
6514         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6515         */
6516        @Child(name = "contextLinkId", type = {StringType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6517        @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." )
6518        protected List<StringType> contextLinkId;
6519
6520        /**
6521         * When action happens.
6522         */
6523        @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=9, min=0, max=1, modifier=false, summary=false)
6524        @Description(shortDefinition="When action happens", formalDefinition="When action happens." )
6525        protected Type occurrence;
6526
6527        /**
6528         * Who or what initiated the action and has responsibility for its activation.
6529         */
6530        @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)
6531        @Description(shortDefinition="Who asked for action", formalDefinition="Who or what initiated the action and has responsibility for its activation." )
6532        protected List<Reference> requester;
6533
6534        /**
6535         * Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.
6536         */
6537        @Child(name = "requesterLinkId", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6538        @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." )
6539        protected List<StringType> requesterLinkId;
6540
6541        /**
6542         * The type of individual that is desired or required to perform or not perform the action.
6543         */
6544        @Child(name = "performerType", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6545        @Description(shortDefinition="Kind of service performer", formalDefinition="The type of individual that is desired or required to perform or not perform the action." )
6546        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-type")
6547        protected List<CodeableConcept> performerType;
6548
6549        /**
6550         * The type of role or competency of an individual desired or required to perform or not perform the action.
6551         */
6552        @Child(name = "performerRole", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
6553        @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." )
6554        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-role")
6555        protected CodeableConcept performerRole;
6556
6557        /**
6558         * Indicates who or what is being asked to perform (or not perform) the ction.
6559         */
6560        @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)
6561        @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." )
6562        protected Reference performer;
6563
6564        /**
6565         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6566         */
6567        @Child(name = "performerLinkId", type = {StringType.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6568        @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." )
6569        protected List<StringType> performerLinkId;
6570
6571        /**
6572         * Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.
6573         */
6574        @Child(name = "reasonCode", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6575        @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." )
6576        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
6577        protected List<CodeableConcept> reasonCode;
6578
6579        /**
6580         * Indicates another resource whose existence justifies permitting or not permitting this action.
6581         */
6582        @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class, Questionnaire.class, QuestionnaireResponse.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6583        @Description(shortDefinition="Why is action (not) needed?", formalDefinition="Indicates another resource whose existence justifies permitting or not permitting this action." )
6584        protected List<Reference> reasonReference;
6585
6586        /**
6587         * Describes why the action is to be performed or not performed in textual form.
6588         */
6589        @Child(name = "reason", type = {StringType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6590        @Description(shortDefinition="Why action is to be performed", formalDefinition="Describes why the action is to be performed or not performed in textual form." )
6591        protected List<StringType> reason;
6592
6593        /**
6594         * Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.
6595         */
6596        @Child(name = "reasonLinkId", type = {StringType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6597        @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." )
6598        protected List<StringType> reasonLinkId;
6599
6600        /**
6601         * Comments made about the term action made by the requester, performer, subject or other participants.
6602         */
6603        @Child(name = "note", type = {Annotation.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6604        @Description(shortDefinition="Comments about the action", formalDefinition="Comments made about the term action made by the requester, performer, subject or other participants." )
6605        protected List<Annotation> note;
6606
6607        /**
6608         * Security labels that protects the action.
6609         */
6610        @Child(name = "securityLabelNumber", type = {UnsignedIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6611        @Description(shortDefinition="Action restriction numbers", formalDefinition="Security labels that protects the action." )
6612        protected List<UnsignedIntType> securityLabelNumber;
6613
6614        private static final long serialVersionUID = 2009887830L;
6615
6616    /**
6617     * Constructor
6618     */
6619      public ActionComponent() {
6620        super();
6621      }
6622
6623    /**
6624     * Constructor
6625     */
6626      public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
6627        super();
6628        this.type = type;
6629        this.intent = intent;
6630        this.status = status;
6631      }
6632
6633        /**
6634         * @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
6635         */
6636        public BooleanType getDoNotPerformElement() { 
6637          if (this.doNotPerform == null)
6638            if (Configuration.errorOnAutoCreate())
6639              throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
6640            else if (Configuration.doAutoCreate())
6641              this.doNotPerform = new BooleanType(); // bb
6642          return this.doNotPerform;
6643        }
6644
6645        public boolean hasDoNotPerformElement() { 
6646          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6647        }
6648
6649        public boolean hasDoNotPerform() { 
6650          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
6651        }
6652
6653        /**
6654         * @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
6655         */
6656        public ActionComponent setDoNotPerformElement(BooleanType value) { 
6657          this.doNotPerform = value;
6658          return this;
6659        }
6660
6661        /**
6662         * @return True if the term prohibits the  action.
6663         */
6664        public boolean getDoNotPerform() { 
6665          return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
6666        }
6667
6668        /**
6669         * @param value True if the term prohibits the  action.
6670         */
6671        public ActionComponent setDoNotPerform(boolean value) { 
6672            if (this.doNotPerform == null)
6673              this.doNotPerform = new BooleanType();
6674            this.doNotPerform.setValue(value);
6675          return this;
6676        }
6677
6678        /**
6679         * @return {@link #type} (Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.)
6680         */
6681        public CodeableConcept getType() { 
6682          if (this.type == null)
6683            if (Configuration.errorOnAutoCreate())
6684              throw new Error("Attempt to auto-create ActionComponent.type");
6685            else if (Configuration.doAutoCreate())
6686              this.type = new CodeableConcept(); // cc
6687          return this.type;
6688        }
6689
6690        public boolean hasType() { 
6691          return this.type != null && !this.type.isEmpty();
6692        }
6693
6694        /**
6695         * @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.)
6696         */
6697        public ActionComponent setType(CodeableConcept value) { 
6698          this.type = value;
6699          return this;
6700        }
6701
6702        /**
6703         * @return {@link #subject} (Entity of the action.)
6704         */
6705        public List<ActionSubjectComponent> getSubject() { 
6706          if (this.subject == null)
6707            this.subject = new ArrayList<ActionSubjectComponent>();
6708          return this.subject;
6709        }
6710
6711        /**
6712         * @return Returns a reference to <code>this</code> for easy method chaining
6713         */
6714        public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) { 
6715          this.subject = theSubject;
6716          return this;
6717        }
6718
6719        public boolean hasSubject() { 
6720          if (this.subject == null)
6721            return false;
6722          for (ActionSubjectComponent item : this.subject)
6723            if (!item.isEmpty())
6724              return true;
6725          return false;
6726        }
6727
6728        public ActionSubjectComponent addSubject() { //3
6729          ActionSubjectComponent t = new ActionSubjectComponent();
6730          if (this.subject == null)
6731            this.subject = new ArrayList<ActionSubjectComponent>();
6732          this.subject.add(t);
6733          return t;
6734        }
6735
6736        public ActionComponent addSubject(ActionSubjectComponent t) { //3
6737          if (t == null)
6738            return this;
6739          if (this.subject == null)
6740            this.subject = new ArrayList<ActionSubjectComponent>();
6741          this.subject.add(t);
6742          return this;
6743        }
6744
6745        /**
6746         * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
6747         */
6748        public ActionSubjectComponent getSubjectFirstRep() { 
6749          if (getSubject().isEmpty()) {
6750            addSubject();
6751          }
6752          return getSubject().get(0);
6753        }
6754
6755        /**
6756         * @return {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6757         */
6758        public CodeableConcept getIntent() { 
6759          if (this.intent == null)
6760            if (Configuration.errorOnAutoCreate())
6761              throw new Error("Attempt to auto-create ActionComponent.intent");
6762            else if (Configuration.doAutoCreate())
6763              this.intent = new CodeableConcept(); // cc
6764          return this.intent;
6765        }
6766
6767        public boolean hasIntent() { 
6768          return this.intent != null && !this.intent.isEmpty();
6769        }
6770
6771        /**
6772         * @param value {@link #intent} (Reason or purpose for the action stipulated by this Contract Provision.)
6773         */
6774        public ActionComponent setIntent(CodeableConcept value) { 
6775          this.intent = value;
6776          return this;
6777        }
6778
6779        /**
6780         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6781         */
6782        public List<StringType> getLinkId() { 
6783          if (this.linkId == null)
6784            this.linkId = new ArrayList<StringType>();
6785          return this.linkId;
6786        }
6787
6788        /**
6789         * @return Returns a reference to <code>this</code> for easy method chaining
6790         */
6791        public ActionComponent setLinkId(List<StringType> theLinkId) { 
6792          this.linkId = theLinkId;
6793          return this;
6794        }
6795
6796        public boolean hasLinkId() { 
6797          if (this.linkId == null)
6798            return false;
6799          for (StringType item : this.linkId)
6800            if (!item.isEmpty())
6801              return true;
6802          return false;
6803        }
6804
6805        /**
6806         * @return {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6807         */
6808        public StringType addLinkIdElement() {//2 
6809          StringType t = new StringType();
6810          if (this.linkId == null)
6811            this.linkId = new ArrayList<StringType>();
6812          this.linkId.add(t);
6813          return t;
6814        }
6815
6816        /**
6817         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6818         */
6819        public ActionComponent addLinkId(String value) { //1
6820          StringType t = new StringType();
6821          t.setValue(value);
6822          if (this.linkId == null)
6823            this.linkId = new ArrayList<StringType>();
6824          this.linkId.add(t);
6825          return this;
6826        }
6827
6828        /**
6829         * @param value {@link #linkId} (Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.)
6830         */
6831        public boolean hasLinkId(String value) { 
6832          if (this.linkId == null)
6833            return false;
6834          for (StringType v : this.linkId)
6835            if (v.getValue().equals(value)) // string
6836              return true;
6837          return false;
6838        }
6839
6840        /**
6841         * @return {@link #status} (Current state of the term action.)
6842         */
6843        public CodeableConcept getStatus() { 
6844          if (this.status == null)
6845            if (Configuration.errorOnAutoCreate())
6846              throw new Error("Attempt to auto-create ActionComponent.status");
6847            else if (Configuration.doAutoCreate())
6848              this.status = new CodeableConcept(); // cc
6849          return this.status;
6850        }
6851
6852        public boolean hasStatus() { 
6853          return this.status != null && !this.status.isEmpty();
6854        }
6855
6856        /**
6857         * @param value {@link #status} (Current state of the term action.)
6858         */
6859        public ActionComponent setStatus(CodeableConcept value) { 
6860          this.status = value;
6861          return this;
6862        }
6863
6864        /**
6865         * @return {@link #context} (Encounter or Episode with primary association to specified term activity.)
6866         */
6867        public Reference getContext() { 
6868          if (this.context == null)
6869            if (Configuration.errorOnAutoCreate())
6870              throw new Error("Attempt to auto-create ActionComponent.context");
6871            else if (Configuration.doAutoCreate())
6872              this.context = new Reference(); // cc
6873          return this.context;
6874        }
6875
6876        public boolean hasContext() { 
6877          return this.context != null && !this.context.isEmpty();
6878        }
6879
6880        /**
6881         * @param value {@link #context} (Encounter or Episode with primary association to specified term activity.)
6882         */
6883        public ActionComponent setContext(Reference value) { 
6884          this.context = value;
6885          return this;
6886        }
6887
6888        /**
6889         * @return {@link #contextLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
6890         */
6891        public List<StringType> getContextLinkId() { 
6892          if (this.contextLinkId == null)
6893            this.contextLinkId = new ArrayList<StringType>();
6894          return this.contextLinkId;
6895        }
6896
6897        /**
6898         * @return Returns a reference to <code>this</code> for easy method chaining
6899         */
6900        public ActionComponent setContextLinkId(List<StringType> theContextLinkId) { 
6901          this.contextLinkId = theContextLinkId;
6902          return this;
6903        }
6904
6905        public boolean hasContextLinkId() { 
6906          if (this.contextLinkId == null)
6907            return false;
6908          for (StringType item : this.contextLinkId)
6909            if (!item.isEmpty())
6910              return true;
6911          return false;
6912        }
6913
6914        /**
6915         * @return {@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 StringType addContextLinkIdElement() {//2 
6918          StringType t = new StringType();
6919          if (this.contextLinkId == null)
6920            this.contextLinkId = new ArrayList<StringType>();
6921          this.contextLinkId.add(t);
6922          return t;
6923        }
6924
6925        /**
6926         * @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.)
6927         */
6928        public ActionComponent addContextLinkId(String value) { //1
6929          StringType t = new StringType();
6930          t.setValue(value);
6931          if (this.contextLinkId == null)
6932            this.contextLinkId = new ArrayList<StringType>();
6933          this.contextLinkId.add(t);
6934          return this;
6935        }
6936
6937        /**
6938         * @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.)
6939         */
6940        public boolean hasContextLinkId(String value) { 
6941          if (this.contextLinkId == null)
6942            return false;
6943          for (StringType v : this.contextLinkId)
6944            if (v.getValue().equals(value)) // string
6945              return true;
6946          return false;
6947        }
6948
6949        /**
6950         * @return {@link #occurrence} (When action happens.)
6951         */
6952        public Type getOccurrence() { 
6953          return this.occurrence;
6954        }
6955
6956        /**
6957         * @return {@link #occurrence} (When action happens.)
6958         */
6959        public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
6960          if (this.occurrence == null)
6961            this.occurrence = new DateTimeType();
6962          if (!(this.occurrence instanceof DateTimeType))
6963            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6964          return (DateTimeType) this.occurrence;
6965        }
6966
6967        public boolean hasOccurrenceDateTimeType() { 
6968          return this != null && this.occurrence instanceof DateTimeType;
6969        }
6970
6971        /**
6972         * @return {@link #occurrence} (When action happens.)
6973         */
6974        public Period getOccurrencePeriod() throws FHIRException { 
6975          if (this.occurrence == null)
6976            this.occurrence = new Period();
6977          if (!(this.occurrence instanceof Period))
6978            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6979          return (Period) this.occurrence;
6980        }
6981
6982        public boolean hasOccurrencePeriod() { 
6983          return this != null && this.occurrence instanceof Period;
6984        }
6985
6986        /**
6987         * @return {@link #occurrence} (When action happens.)
6988         */
6989        public Timing getOccurrenceTiming() throws FHIRException { 
6990          if (this.occurrence == null)
6991            this.occurrence = new Timing();
6992          if (!(this.occurrence instanceof Timing))
6993            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
6994          return (Timing) this.occurrence;
6995        }
6996
6997        public boolean hasOccurrenceTiming() { 
6998          return this != null && this.occurrence instanceof Timing;
6999        }
7000
7001        public boolean hasOccurrence() { 
7002          return this.occurrence != null && !this.occurrence.isEmpty();
7003        }
7004
7005        /**
7006         * @param value {@link #occurrence} (When action happens.)
7007         */
7008        public ActionComponent setOccurrence(Type value) { 
7009          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
7010            throw new Error("Not the right type for Contract.term.action.occurrence[x]: "+value.fhirType());
7011          this.occurrence = value;
7012          return this;
7013        }
7014
7015        /**
7016         * @return {@link #requester} (Who or what initiated the action and has responsibility for its activation.)
7017         */
7018        public List<Reference> getRequester() { 
7019          if (this.requester == null)
7020            this.requester = new ArrayList<Reference>();
7021          return this.requester;
7022        }
7023
7024        /**
7025         * @return Returns a reference to <code>this</code> for easy method chaining
7026         */
7027        public ActionComponent setRequester(List<Reference> theRequester) { 
7028          this.requester = theRequester;
7029          return this;
7030        }
7031
7032        public boolean hasRequester() { 
7033          if (this.requester == null)
7034            return false;
7035          for (Reference item : this.requester)
7036            if (!item.isEmpty())
7037              return true;
7038          return false;
7039        }
7040
7041        public Reference addRequester() { //3
7042          Reference t = new Reference();
7043          if (this.requester == null)
7044            this.requester = new ArrayList<Reference>();
7045          this.requester.add(t);
7046          return t;
7047        }
7048
7049        public ActionComponent addRequester(Reference t) { //3
7050          if (t == null)
7051            return this;
7052          if (this.requester == null)
7053            this.requester = new ArrayList<Reference>();
7054          this.requester.add(t);
7055          return this;
7056        }
7057
7058        /**
7059         * @return The first repetition of repeating field {@link #requester}, creating it if it does not already exist
7060         */
7061        public Reference getRequesterFirstRep() { 
7062          if (getRequester().isEmpty()) {
7063            addRequester();
7064          }
7065          return getRequester().get(0);
7066        }
7067
7068        /**
7069         * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.)
7070         */
7071        public List<StringType> getRequesterLinkId() { 
7072          if (this.requesterLinkId == null)
7073            this.requesterLinkId = new ArrayList<StringType>();
7074          return this.requesterLinkId;
7075        }
7076
7077        /**
7078         * @return Returns a reference to <code>this</code> for easy method chaining
7079         */
7080        public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) { 
7081          this.requesterLinkId = theRequesterLinkId;
7082          return this;
7083        }
7084
7085        public boolean hasRequesterLinkId() { 
7086          if (this.requesterLinkId == null)
7087            return false;
7088          for (StringType item : this.requesterLinkId)
7089            if (!item.isEmpty())
7090              return true;
7091          return false;
7092        }
7093
7094        /**
7095         * @return {@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 StringType addRequesterLinkIdElement() {//2 
7098          StringType t = new StringType();
7099          if (this.requesterLinkId == null)
7100            this.requesterLinkId = new ArrayList<StringType>();
7101          this.requesterLinkId.add(t);
7102          return t;
7103        }
7104
7105        /**
7106         * @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.)
7107         */
7108        public ActionComponent addRequesterLinkId(String value) { //1
7109          StringType t = new StringType();
7110          t.setValue(value);
7111          if (this.requesterLinkId == null)
7112            this.requesterLinkId = new ArrayList<StringType>();
7113          this.requesterLinkId.add(t);
7114          return this;
7115        }
7116
7117        /**
7118         * @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.)
7119         */
7120        public boolean hasRequesterLinkId(String value) { 
7121          if (this.requesterLinkId == null)
7122            return false;
7123          for (StringType v : this.requesterLinkId)
7124            if (v.getValue().equals(value)) // string
7125              return true;
7126          return false;
7127        }
7128
7129        /**
7130         * @return {@link #performerType} (The type of individual that is desired or required to perform or not perform the action.)
7131         */
7132        public List<CodeableConcept> getPerformerType() { 
7133          if (this.performerType == null)
7134            this.performerType = new ArrayList<CodeableConcept>();
7135          return this.performerType;
7136        }
7137
7138        /**
7139         * @return Returns a reference to <code>this</code> for easy method chaining
7140         */
7141        public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) { 
7142          this.performerType = thePerformerType;
7143          return this;
7144        }
7145
7146        public boolean hasPerformerType() { 
7147          if (this.performerType == null)
7148            return false;
7149          for (CodeableConcept item : this.performerType)
7150            if (!item.isEmpty())
7151              return true;
7152          return false;
7153        }
7154
7155        public CodeableConcept addPerformerType() { //3
7156          CodeableConcept t = new CodeableConcept();
7157          if (this.performerType == null)
7158            this.performerType = new ArrayList<CodeableConcept>();
7159          this.performerType.add(t);
7160          return t;
7161        }
7162
7163        public ActionComponent addPerformerType(CodeableConcept t) { //3
7164          if (t == null)
7165            return this;
7166          if (this.performerType == null)
7167            this.performerType = new ArrayList<CodeableConcept>();
7168          this.performerType.add(t);
7169          return this;
7170        }
7171
7172        /**
7173         * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist
7174         */
7175        public CodeableConcept getPerformerTypeFirstRep() { 
7176          if (getPerformerType().isEmpty()) {
7177            addPerformerType();
7178          }
7179          return getPerformerType().get(0);
7180        }
7181
7182        /**
7183         * @return {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7184         */
7185        public CodeableConcept getPerformerRole() { 
7186          if (this.performerRole == null)
7187            if (Configuration.errorOnAutoCreate())
7188              throw new Error("Attempt to auto-create ActionComponent.performerRole");
7189            else if (Configuration.doAutoCreate())
7190              this.performerRole = new CodeableConcept(); // cc
7191          return this.performerRole;
7192        }
7193
7194        public boolean hasPerformerRole() { 
7195          return this.performerRole != null && !this.performerRole.isEmpty();
7196        }
7197
7198        /**
7199         * @param value {@link #performerRole} (The type of role or competency of an individual desired or required to perform or not perform the action.)
7200         */
7201        public ActionComponent setPerformerRole(CodeableConcept value) { 
7202          this.performerRole = value;
7203          return this;
7204        }
7205
7206        /**
7207         * @return {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7208         */
7209        public Reference getPerformer() { 
7210          if (this.performer == null)
7211            if (Configuration.errorOnAutoCreate())
7212              throw new Error("Attempt to auto-create ActionComponent.performer");
7213            else if (Configuration.doAutoCreate())
7214              this.performer = new Reference(); // cc
7215          return this.performer;
7216        }
7217
7218        public boolean hasPerformer() { 
7219          return this.performer != null && !this.performer.isEmpty();
7220        }
7221
7222        /**
7223         * @param value {@link #performer} (Indicates who or what is being asked to perform (or not perform) the ction.)
7224         */
7225        public ActionComponent setPerformer(Reference value) { 
7226          this.performer = value;
7227          return this;
7228        }
7229
7230        /**
7231         * @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.)
7232         */
7233        public List<StringType> getPerformerLinkId() { 
7234          if (this.performerLinkId == null)
7235            this.performerLinkId = new ArrayList<StringType>();
7236          return this.performerLinkId;
7237        }
7238
7239        /**
7240         * @return Returns a reference to <code>this</code> for easy method chaining
7241         */
7242        public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) { 
7243          this.performerLinkId = thePerformerLinkId;
7244          return this;
7245        }
7246
7247        public boolean hasPerformerLinkId() { 
7248          if (this.performerLinkId == null)
7249            return false;
7250          for (StringType item : this.performerLinkId)
7251            if (!item.isEmpty())
7252              return true;
7253          return false;
7254        }
7255
7256        /**
7257         * @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.)
7258         */
7259        public StringType addPerformerLinkIdElement() {//2 
7260          StringType t = new StringType();
7261          if (this.performerLinkId == null)
7262            this.performerLinkId = new ArrayList<StringType>();
7263          this.performerLinkId.add(t);
7264          return t;
7265        }
7266
7267        /**
7268         * @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.)
7269         */
7270        public ActionComponent addPerformerLinkId(String value) { //1
7271          StringType t = new StringType();
7272          t.setValue(value);
7273          if (this.performerLinkId == null)
7274            this.performerLinkId = new ArrayList<StringType>();
7275          this.performerLinkId.add(t);
7276          return this;
7277        }
7278
7279        /**
7280         * @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.)
7281         */
7282        public boolean hasPerformerLinkId(String value) { 
7283          if (this.performerLinkId == null)
7284            return false;
7285          for (StringType v : this.performerLinkId)
7286            if (v.getValue().equals(value)) // string
7287              return true;
7288          return false;
7289        }
7290
7291        /**
7292         * @return {@link #reasonCode} (Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.)
7293         */
7294        public List<CodeableConcept> getReasonCode() { 
7295          if (this.reasonCode == null)
7296            this.reasonCode = new ArrayList<CodeableConcept>();
7297          return this.reasonCode;
7298        }
7299
7300        /**
7301         * @return Returns a reference to <code>this</code> for easy method chaining
7302         */
7303        public ActionComponent setReasonCode(List<CodeableConcept> theReasonCode) { 
7304          this.reasonCode = theReasonCode;
7305          return this;
7306        }
7307
7308        public boolean hasReasonCode() { 
7309          if (this.reasonCode == null)
7310            return false;
7311          for (CodeableConcept item : this.reasonCode)
7312            if (!item.isEmpty())
7313              return true;
7314          return false;
7315        }
7316
7317        public CodeableConcept addReasonCode() { //3
7318          CodeableConcept t = new CodeableConcept();
7319          if (this.reasonCode == null)
7320            this.reasonCode = new ArrayList<CodeableConcept>();
7321          this.reasonCode.add(t);
7322          return t;
7323        }
7324
7325        public ActionComponent addReasonCode(CodeableConcept t) { //3
7326          if (t == null)
7327            return this;
7328          if (this.reasonCode == null)
7329            this.reasonCode = new ArrayList<CodeableConcept>();
7330          this.reasonCode.add(t);
7331          return this;
7332        }
7333
7334        /**
7335         * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
7336         */
7337        public CodeableConcept getReasonCodeFirstRep() { 
7338          if (getReasonCode().isEmpty()) {
7339            addReasonCode();
7340          }
7341          return getReasonCode().get(0);
7342        }
7343
7344        /**
7345         * @return {@link #reasonReference} (Indicates another resource whose existence justifies permitting or not permitting this action.)
7346         */
7347        public List<Reference> getReasonReference() { 
7348          if (this.reasonReference == null)
7349            this.reasonReference = new ArrayList<Reference>();
7350          return this.reasonReference;
7351        }
7352
7353        /**
7354         * @return Returns a reference to <code>this</code> for easy method chaining
7355         */
7356        public ActionComponent setReasonReference(List<Reference> theReasonReference) { 
7357          this.reasonReference = theReasonReference;
7358          return this;
7359        }
7360
7361        public boolean hasReasonReference() { 
7362          if (this.reasonReference == null)
7363            return false;
7364          for (Reference item : this.reasonReference)
7365            if (!item.isEmpty())
7366              return true;
7367          return false;
7368        }
7369
7370        public Reference addReasonReference() { //3
7371          Reference t = new Reference();
7372          if (this.reasonReference == null)
7373            this.reasonReference = new ArrayList<Reference>();
7374          this.reasonReference.add(t);
7375          return t;
7376        }
7377
7378        public ActionComponent addReasonReference(Reference t) { //3
7379          if (t == null)
7380            return this;
7381          if (this.reasonReference == null)
7382            this.reasonReference = new ArrayList<Reference>();
7383          this.reasonReference.add(t);
7384          return this;
7385        }
7386
7387        /**
7388         * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
7389         */
7390        public Reference getReasonReferenceFirstRep() { 
7391          if (getReasonReference().isEmpty()) {
7392            addReasonReference();
7393          }
7394          return getReasonReference().get(0);
7395        }
7396
7397        /**
7398         * @return {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7399         */
7400        public List<StringType> getReason() { 
7401          if (this.reason == null)
7402            this.reason = new ArrayList<StringType>();
7403          return this.reason;
7404        }
7405
7406        /**
7407         * @return Returns a reference to <code>this</code> for easy method chaining
7408         */
7409        public ActionComponent setReason(List<StringType> theReason) { 
7410          this.reason = theReason;
7411          return this;
7412        }
7413
7414        public boolean hasReason() { 
7415          if (this.reason == null)
7416            return false;
7417          for (StringType item : this.reason)
7418            if (!item.isEmpty())
7419              return true;
7420          return false;
7421        }
7422
7423        /**
7424         * @return {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7425         */
7426        public StringType addReasonElement() {//2 
7427          StringType t = new StringType();
7428          if (this.reason == null)
7429            this.reason = new ArrayList<StringType>();
7430          this.reason.add(t);
7431          return t;
7432        }
7433
7434        /**
7435         * @param value {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7436         */
7437        public ActionComponent addReason(String value) { //1
7438          StringType t = new StringType();
7439          t.setValue(value);
7440          if (this.reason == null)
7441            this.reason = new ArrayList<StringType>();
7442          this.reason.add(t);
7443          return this;
7444        }
7445
7446        /**
7447         * @param value {@link #reason} (Describes why the action is to be performed or not performed in textual form.)
7448         */
7449        public boolean hasReason(String value) { 
7450          if (this.reason == null)
7451            return false;
7452          for (StringType v : this.reason)
7453            if (v.getValue().equals(value)) // string
7454              return true;
7455          return false;
7456        }
7457
7458        /**
7459         * @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.)
7460         */
7461        public List<StringType> getReasonLinkId() { 
7462          if (this.reasonLinkId == null)
7463            this.reasonLinkId = new ArrayList<StringType>();
7464          return this.reasonLinkId;
7465        }
7466
7467        /**
7468         * @return Returns a reference to <code>this</code> for easy method chaining
7469         */
7470        public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) { 
7471          this.reasonLinkId = theReasonLinkId;
7472          return this;
7473        }
7474
7475        public boolean hasReasonLinkId() { 
7476          if (this.reasonLinkId == null)
7477            return false;
7478          for (StringType item : this.reasonLinkId)
7479            if (!item.isEmpty())
7480              return true;
7481          return false;
7482        }
7483
7484        /**
7485         * @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.)
7486         */
7487        public StringType addReasonLinkIdElement() {//2 
7488          StringType t = new StringType();
7489          if (this.reasonLinkId == null)
7490            this.reasonLinkId = new ArrayList<StringType>();
7491          this.reasonLinkId.add(t);
7492          return t;
7493        }
7494
7495        /**
7496         * @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.)
7497         */
7498        public ActionComponent addReasonLinkId(String value) { //1
7499          StringType t = new StringType();
7500          t.setValue(value);
7501          if (this.reasonLinkId == null)
7502            this.reasonLinkId = new ArrayList<StringType>();
7503          this.reasonLinkId.add(t);
7504          return this;
7505        }
7506
7507        /**
7508         * @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.)
7509         */
7510        public boolean hasReasonLinkId(String value) { 
7511          if (this.reasonLinkId == null)
7512            return false;
7513          for (StringType v : this.reasonLinkId)
7514            if (v.getValue().equals(value)) // string
7515              return true;
7516          return false;
7517        }
7518
7519        /**
7520         * @return {@link #note} (Comments made about the term action made by the requester, performer, subject or other participants.)
7521         */
7522        public List<Annotation> getNote() { 
7523          if (this.note == null)
7524            this.note = new ArrayList<Annotation>();
7525          return this.note;
7526        }
7527
7528        /**
7529         * @return Returns a reference to <code>this</code> for easy method chaining
7530         */
7531        public ActionComponent setNote(List<Annotation> theNote) { 
7532          this.note = theNote;
7533          return this;
7534        }
7535
7536        public boolean hasNote() { 
7537          if (this.note == null)
7538            return false;
7539          for (Annotation item : this.note)
7540            if (!item.isEmpty())
7541              return true;
7542          return false;
7543        }
7544
7545        public Annotation addNote() { //3
7546          Annotation t = new Annotation();
7547          if (this.note == null)
7548            this.note = new ArrayList<Annotation>();
7549          this.note.add(t);
7550          return t;
7551        }
7552
7553        public ActionComponent addNote(Annotation t) { //3
7554          if (t == null)
7555            return this;
7556          if (this.note == null)
7557            this.note = new ArrayList<Annotation>();
7558          this.note.add(t);
7559          return this;
7560        }
7561
7562        /**
7563         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
7564         */
7565        public Annotation getNoteFirstRep() { 
7566          if (getNote().isEmpty()) {
7567            addNote();
7568          }
7569          return getNote().get(0);
7570        }
7571
7572        /**
7573         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7574         */
7575        public List<UnsignedIntType> getSecurityLabelNumber() { 
7576          if (this.securityLabelNumber == null)
7577            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7578          return this.securityLabelNumber;
7579        }
7580
7581        /**
7582         * @return Returns a reference to <code>this</code> for easy method chaining
7583         */
7584        public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) { 
7585          this.securityLabelNumber = theSecurityLabelNumber;
7586          return this;
7587        }
7588
7589        public boolean hasSecurityLabelNumber() { 
7590          if (this.securityLabelNumber == null)
7591            return false;
7592          for (UnsignedIntType item : this.securityLabelNumber)
7593            if (!item.isEmpty())
7594              return true;
7595          return false;
7596        }
7597
7598        /**
7599         * @return {@link #securityLabelNumber} (Security labels that protects the action.)
7600         */
7601        public UnsignedIntType addSecurityLabelNumberElement() {//2 
7602          UnsignedIntType t = new UnsignedIntType();
7603          if (this.securityLabelNumber == null)
7604            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7605          this.securityLabelNumber.add(t);
7606          return t;
7607        }
7608
7609        /**
7610         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7611         */
7612        public ActionComponent addSecurityLabelNumber(int value) { //1
7613          UnsignedIntType t = new UnsignedIntType();
7614          t.setValue(value);
7615          if (this.securityLabelNumber == null)
7616            this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7617          this.securityLabelNumber.add(t);
7618          return this;
7619        }
7620
7621        /**
7622         * @param value {@link #securityLabelNumber} (Security labels that protects the action.)
7623         */
7624        public boolean hasSecurityLabelNumber(int value) { 
7625          if (this.securityLabelNumber == null)
7626            return false;
7627          for (UnsignedIntType v : this.securityLabelNumber)
7628            if (v.getValue().equals(value)) // unsignedInt
7629              return true;
7630          return false;
7631        }
7632
7633        protected void listChildren(List<Property> children) {
7634          super.listChildren(children);
7635          children.add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
7636          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));
7637          children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
7638          children.add(new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
7639          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));
7640          children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
7641          children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
7642          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));
7643          children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
7644          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));
7645          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));
7646          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));
7647          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));
7648          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));
7649          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));
7650          children.add(new Property("reasonCode", "CodeableConcept", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
7651          children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Indicates another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
7652          children.add(new Property("reason", "string", "Describes why the action is to be performed or not performed in textual form.", 0, java.lang.Integer.MAX_VALUE, reason));
7653          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));
7654          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));
7655          children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber));
7656        }
7657
7658        @Override
7659        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7660          switch (_hash) {
7661          case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform);
7662          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);
7663          case -1867885268: /*subject*/  return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject);
7664          case -1183762788: /*intent*/  return new Property("intent", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
7665          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);
7666          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status);
7667          case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
7668          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);
7669          case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7670          case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7671          case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7672          case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7673          case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence);
7674          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);
7675          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);
7676          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);
7677          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);
7678          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);
7679          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);
7680          case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
7681          case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)", "Indicates another resource whose existence justifies permitting or not permitting this action.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
7682          case -934964668: /*reason*/  return new Property("reason", "string", "Describes why the action is to be performed or not performed in textual form.", 0, java.lang.Integer.MAX_VALUE, reason);
7683          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);
7684          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);
7685          case -149460995: /*securityLabelNumber*/  return new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
7686          default: return super.getNamedProperty(_hash, _name, _checkValid);
7687          }
7688
7689        }
7690
7691      @Override
7692      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7693        switch (hash) {
7694        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
7695        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
7696        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
7697        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // CodeableConcept
7698        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7699        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
7700        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
7701        case -288783036: /*contextLinkId*/ return this.contextLinkId == null ? new Base[0] : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
7702        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
7703        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : this.requester.toArray(new Base[this.requester.size()]); // Reference
7704        case -1468032687: /*requesterLinkId*/ return this.requesterLinkId == null ? new Base[0] : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
7705        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
7706        case -901513884: /*performerRole*/ return this.performerRole == null ? new Base[0] : new Base[] {this.performerRole}; // CodeableConcept
7707        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
7708        case 1051302947: /*performerLinkId*/ return this.performerLinkId == null ? new Base[0] : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
7709        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
7710        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
7711        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // StringType
7712        case -1557963239: /*reasonLinkId*/ return this.reasonLinkId == null ? new Base[0] : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
7713        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
7714        case -149460995: /*securityLabelNumber*/ return this.securityLabelNumber == null ? new Base[0] : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7715        default: return super.getProperty(hash, name, checkValid);
7716        }
7717
7718      }
7719
7720      @Override
7721      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7722        switch (hash) {
7723        case -1788508167: // doNotPerform
7724          this.doNotPerform = castToBoolean(value); // BooleanType
7725          return value;
7726        case 3575610: // type
7727          this.type = castToCodeableConcept(value); // CodeableConcept
7728          return value;
7729        case -1867885268: // subject
7730          this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
7731          return value;
7732        case -1183762788: // intent
7733          this.intent = castToCodeableConcept(value); // CodeableConcept
7734          return value;
7735        case -1102667083: // linkId
7736          this.getLinkId().add(castToString(value)); // StringType
7737          return value;
7738        case -892481550: // status
7739          this.status = castToCodeableConcept(value); // CodeableConcept
7740          return value;
7741        case 951530927: // context
7742          this.context = castToReference(value); // Reference
7743          return value;
7744        case -288783036: // contextLinkId
7745          this.getContextLinkId().add(castToString(value)); // StringType
7746          return value;
7747        case 1687874001: // occurrence
7748          this.occurrence = castToType(value); // Type
7749          return value;
7750        case 693933948: // requester
7751          this.getRequester().add(castToReference(value)); // Reference
7752          return value;
7753        case -1468032687: // requesterLinkId
7754          this.getRequesterLinkId().add(castToString(value)); // StringType
7755          return value;
7756        case -901444568: // performerType
7757          this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
7758          return value;
7759        case -901513884: // performerRole
7760          this.performerRole = castToCodeableConcept(value); // CodeableConcept
7761          return value;
7762        case 481140686: // performer
7763          this.performer = castToReference(value); // Reference
7764          return value;
7765        case 1051302947: // performerLinkId
7766          this.getPerformerLinkId().add(castToString(value)); // StringType
7767          return value;
7768        case 722137681: // reasonCode
7769          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
7770          return value;
7771        case -1146218137: // reasonReference
7772          this.getReasonReference().add(castToReference(value)); // Reference
7773          return value;
7774        case -934964668: // reason
7775          this.getReason().add(castToString(value)); // StringType
7776          return value;
7777        case -1557963239: // reasonLinkId
7778          this.getReasonLinkId().add(castToString(value)); // StringType
7779          return value;
7780        case 3387378: // note
7781          this.getNote().add(castToAnnotation(value)); // Annotation
7782          return value;
7783        case -149460995: // securityLabelNumber
7784          this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
7785          return value;
7786        default: return super.setProperty(hash, name, value);
7787        }
7788
7789      }
7790
7791      @Override
7792      public Base setProperty(String name, Base value) throws FHIRException {
7793        if (name.equals("doNotPerform")) {
7794          this.doNotPerform = castToBoolean(value); // BooleanType
7795        } else if (name.equals("type")) {
7796          this.type = castToCodeableConcept(value); // CodeableConcept
7797        } else if (name.equals("subject")) {
7798          this.getSubject().add((ActionSubjectComponent) value);
7799        } else if (name.equals("intent")) {
7800          this.intent = castToCodeableConcept(value); // CodeableConcept
7801        } else if (name.equals("linkId")) {
7802          this.getLinkId().add(castToString(value));
7803        } else if (name.equals("status")) {
7804          this.status = castToCodeableConcept(value); // CodeableConcept
7805        } else if (name.equals("context")) {
7806          this.context = castToReference(value); // Reference
7807        } else if (name.equals("contextLinkId")) {
7808          this.getContextLinkId().add(castToString(value));
7809        } else if (name.equals("occurrence[x]")) {
7810          this.occurrence = castToType(value); // Type
7811        } else if (name.equals("requester")) {
7812          this.getRequester().add(castToReference(value));
7813        } else if (name.equals("requesterLinkId")) {
7814          this.getRequesterLinkId().add(castToString(value));
7815        } else if (name.equals("performerType")) {
7816          this.getPerformerType().add(castToCodeableConcept(value));
7817        } else if (name.equals("performerRole")) {
7818          this.performerRole = castToCodeableConcept(value); // CodeableConcept
7819        } else if (name.equals("performer")) {
7820          this.performer = castToReference(value); // Reference
7821        } else if (name.equals("performerLinkId")) {
7822          this.getPerformerLinkId().add(castToString(value));
7823        } else if (name.equals("reasonCode")) {
7824          this.getReasonCode().add(castToCodeableConcept(value));
7825        } else if (name.equals("reasonReference")) {
7826          this.getReasonReference().add(castToReference(value));
7827        } else if (name.equals("reason")) {
7828          this.getReason().add(castToString(value));
7829        } else if (name.equals("reasonLinkId")) {
7830          this.getReasonLinkId().add(castToString(value));
7831        } else if (name.equals("note")) {
7832          this.getNote().add(castToAnnotation(value));
7833        } else if (name.equals("securityLabelNumber")) {
7834          this.getSecurityLabelNumber().add(castToUnsignedInt(value));
7835        } else
7836          return super.setProperty(name, value);
7837        return value;
7838      }
7839
7840      @Override
7841      public Base makeProperty(int hash, String name) throws FHIRException {
7842        switch (hash) {
7843        case -1788508167:  return getDoNotPerformElement();
7844        case 3575610:  return getType();
7845        case -1867885268:  return addSubject(); 
7846        case -1183762788:  return getIntent();
7847        case -1102667083:  return addLinkIdElement();
7848        case -892481550:  return getStatus();
7849        case 951530927:  return getContext();
7850        case -288783036:  return addContextLinkIdElement();
7851        case -2022646513:  return getOccurrence();
7852        case 1687874001:  return getOccurrence();
7853        case 693933948:  return addRequester(); 
7854        case -1468032687:  return addRequesterLinkIdElement();
7855        case -901444568:  return addPerformerType(); 
7856        case -901513884:  return getPerformerRole();
7857        case 481140686:  return getPerformer();
7858        case 1051302947:  return addPerformerLinkIdElement();
7859        case 722137681:  return addReasonCode(); 
7860        case -1146218137:  return addReasonReference(); 
7861        case -934964668:  return addReasonElement();
7862        case -1557963239:  return addReasonLinkIdElement();
7863        case 3387378:  return addNote(); 
7864        case -149460995:  return addSecurityLabelNumberElement();
7865        default: return super.makeProperty(hash, name);
7866        }
7867
7868      }
7869
7870      @Override
7871      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7872        switch (hash) {
7873        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
7874        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7875        case -1867885268: /*subject*/ return new String[] {};
7876        case -1183762788: /*intent*/ return new String[] {"CodeableConcept"};
7877        case -1102667083: /*linkId*/ return new String[] {"string"};
7878        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
7879        case 951530927: /*context*/ return new String[] {"Reference"};
7880        case -288783036: /*contextLinkId*/ return new String[] {"string"};
7881        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
7882        case 693933948: /*requester*/ return new String[] {"Reference"};
7883        case -1468032687: /*requesterLinkId*/ return new String[] {"string"};
7884        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
7885        case -901513884: /*performerRole*/ return new String[] {"CodeableConcept"};
7886        case 481140686: /*performer*/ return new String[] {"Reference"};
7887        case 1051302947: /*performerLinkId*/ return new String[] {"string"};
7888        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
7889        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
7890        case -934964668: /*reason*/ return new String[] {"string"};
7891        case -1557963239: /*reasonLinkId*/ return new String[] {"string"};
7892        case 3387378: /*note*/ return new String[] {"Annotation"};
7893        case -149460995: /*securityLabelNumber*/ return new String[] {"unsignedInt"};
7894        default: return super.getTypesForProperty(hash, name);
7895        }
7896
7897      }
7898
7899      @Override
7900      public Base addChild(String name) throws FHIRException {
7901        if (name.equals("doNotPerform")) {
7902          throw new FHIRException("Cannot call addChild on a primitive type Contract.doNotPerform");
7903        }
7904        else if (name.equals("type")) {
7905          this.type = new CodeableConcept();
7906          return this.type;
7907        }
7908        else if (name.equals("subject")) {
7909          return addSubject();
7910        }
7911        else if (name.equals("intent")) {
7912          this.intent = new CodeableConcept();
7913          return this.intent;
7914        }
7915        else if (name.equals("linkId")) {
7916          throw new FHIRException("Cannot call addChild on a primitive type Contract.linkId");
7917        }
7918        else if (name.equals("status")) {
7919          this.status = new CodeableConcept();
7920          return this.status;
7921        }
7922        else if (name.equals("context")) {
7923          this.context = new Reference();
7924          return this.context;
7925        }
7926        else if (name.equals("contextLinkId")) {
7927          throw new FHIRException("Cannot call addChild on a primitive type Contract.contextLinkId");
7928        }
7929        else if (name.equals("occurrenceDateTime")) {
7930          this.occurrence = new DateTimeType();
7931          return this.occurrence;
7932        }
7933        else if (name.equals("occurrencePeriod")) {
7934          this.occurrence = new Period();
7935          return this.occurrence;
7936        }
7937        else if (name.equals("occurrenceTiming")) {
7938          this.occurrence = new Timing();
7939          return this.occurrence;
7940        }
7941        else if (name.equals("requester")) {
7942          return addRequester();
7943        }
7944        else if (name.equals("requesterLinkId")) {
7945          throw new FHIRException("Cannot call addChild on a primitive type Contract.requesterLinkId");
7946        }
7947        else if (name.equals("performerType")) {
7948          return addPerformerType();
7949        }
7950        else if (name.equals("performerRole")) {
7951          this.performerRole = new CodeableConcept();
7952          return this.performerRole;
7953        }
7954        else if (name.equals("performer")) {
7955          this.performer = new Reference();
7956          return this.performer;
7957        }
7958        else if (name.equals("performerLinkId")) {
7959          throw new FHIRException("Cannot call addChild on a primitive type Contract.performerLinkId");
7960        }
7961        else if (name.equals("reasonCode")) {
7962          return addReasonCode();
7963        }
7964        else if (name.equals("reasonReference")) {
7965          return addReasonReference();
7966        }
7967        else if (name.equals("reason")) {
7968          throw new FHIRException("Cannot call addChild on a primitive type Contract.reason");
7969        }
7970        else if (name.equals("reasonLinkId")) {
7971          throw new FHIRException("Cannot call addChild on a primitive type Contract.reasonLinkId");
7972        }
7973        else if (name.equals("note")) {
7974          return addNote();
7975        }
7976        else if (name.equals("securityLabelNumber")) {
7977          throw new FHIRException("Cannot call addChild on a primitive type Contract.securityLabelNumber");
7978        }
7979        else
7980          return super.addChild(name);
7981      }
7982
7983      public ActionComponent copy() {
7984        ActionComponent dst = new ActionComponent();
7985        copyValues(dst);
7986        return dst;
7987      }
7988
7989      public void copyValues(ActionComponent dst) {
7990        super.copyValues(dst);
7991        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
7992        dst.type = type == null ? null : type.copy();
7993        if (subject != null) {
7994          dst.subject = new ArrayList<ActionSubjectComponent>();
7995          for (ActionSubjectComponent i : subject)
7996            dst.subject.add(i.copy());
7997        };
7998        dst.intent = intent == null ? null : intent.copy();
7999        if (linkId != null) {
8000          dst.linkId = new ArrayList<StringType>();
8001          for (StringType i : linkId)
8002            dst.linkId.add(i.copy());
8003        };
8004        dst.status = status == null ? null : status.copy();
8005        dst.context = context == null ? null : context.copy();
8006        if (contextLinkId != null) {
8007          dst.contextLinkId = new ArrayList<StringType>();
8008          for (StringType i : contextLinkId)
8009            dst.contextLinkId.add(i.copy());
8010        };
8011        dst.occurrence = occurrence == null ? null : occurrence.copy();
8012        if (requester != null) {
8013          dst.requester = new ArrayList<Reference>();
8014          for (Reference i : requester)
8015            dst.requester.add(i.copy());
8016        };
8017        if (requesterLinkId != null) {
8018          dst.requesterLinkId = new ArrayList<StringType>();
8019          for (StringType i : requesterLinkId)
8020            dst.requesterLinkId.add(i.copy());
8021        };
8022        if (performerType != null) {
8023          dst.performerType = new ArrayList<CodeableConcept>();
8024          for (CodeableConcept i : performerType)
8025            dst.performerType.add(i.copy());
8026        };
8027        dst.performerRole = performerRole == null ? null : performerRole.copy();
8028        dst.performer = performer == null ? null : performer.copy();
8029        if (performerLinkId != null) {
8030          dst.performerLinkId = new ArrayList<StringType>();
8031          for (StringType i : performerLinkId)
8032            dst.performerLinkId.add(i.copy());
8033        };
8034        if (reasonCode != null) {
8035          dst.reasonCode = new ArrayList<CodeableConcept>();
8036          for (CodeableConcept i : reasonCode)
8037            dst.reasonCode.add(i.copy());
8038        };
8039        if (reasonReference != null) {
8040          dst.reasonReference = new ArrayList<Reference>();
8041          for (Reference i : reasonReference)
8042            dst.reasonReference.add(i.copy());
8043        };
8044        if (reason != null) {
8045          dst.reason = new ArrayList<StringType>();
8046          for (StringType i : reason)
8047            dst.reason.add(i.copy());
8048        };
8049        if (reasonLinkId != null) {
8050          dst.reasonLinkId = new ArrayList<StringType>();
8051          for (StringType i : reasonLinkId)
8052            dst.reasonLinkId.add(i.copy());
8053        };
8054        if (note != null) {
8055          dst.note = new ArrayList<Annotation>();
8056          for (Annotation i : note)
8057            dst.note.add(i.copy());
8058        };
8059        if (securityLabelNumber != null) {
8060          dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
8061          for (UnsignedIntType i : securityLabelNumber)
8062            dst.securityLabelNumber.add(i.copy());
8063        };
8064      }
8065
8066      @Override
8067      public boolean equalsDeep(Base other_) {
8068        if (!super.equalsDeep(other_))
8069          return false;
8070        if (!(other_ instanceof ActionComponent))
8071          return false;
8072        ActionComponent o = (ActionComponent) other_;
8073        return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
8074           && compareDeep(intent, o.intent, true) && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
8075           && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true) && compareDeep(occurrence, o.occurrence, true)
8076           && compareDeep(requester, o.requester, true) && compareDeep(requesterLinkId, o.requesterLinkId, true)
8077           && compareDeep(performerType, o.performerType, true) && compareDeep(performerRole, o.performerRole, true)
8078           && compareDeep(performer, o.performer, true) && compareDeep(performerLinkId, o.performerLinkId, true)
8079           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
8080           && compareDeep(reason, o.reason, true) && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
8081           && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
8082      }
8083
8084      @Override
8085      public boolean equalsShallow(Base other_) {
8086        if (!super.equalsShallow(other_))
8087          return false;
8088        if (!(other_ instanceof ActionComponent))
8089          return false;
8090        ActionComponent o = (ActionComponent) other_;
8091        return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true) && compareValues(contextLinkId, o.contextLinkId, true)
8092           && compareValues(requesterLinkId, o.requesterLinkId, true) && compareValues(performerLinkId, o.performerLinkId, true)
8093           && compareValues(reason, o.reason, true) && compareValues(reasonLinkId, o.reasonLinkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true)
8094          ;
8095      }
8096
8097      public boolean isEmpty() {
8098        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject
8099          , intent, linkId, status, context, contextLinkId, occurrence, requester, requesterLinkId
8100          , performerType, performerRole, performer, performerLinkId, reasonCode, reasonReference
8101          , reason, reasonLinkId, note, securityLabelNumber);
8102      }
8103
8104  public String fhirType() {
8105    return "Contract.term.action";
8106
8107  }
8108
8109  }
8110
8111    @Block()
8112    public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
8113        /**
8114         * The entity the action is performed or not performed on or for.
8115         */
8116        @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)
8117        @Description(shortDefinition="Entity of the action", formalDefinition="The entity the action is performed or not performed on or for." )
8118        protected List<Reference> reference;
8119
8120        /**
8121         * Role type of agent assigned roles in this Contract.
8122         */
8123        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
8124        @Description(shortDefinition="Role type of the agent", formalDefinition="Role type of agent assigned roles in this Contract." )
8125        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-actorrole")
8126        protected CodeableConcept role;
8127
8128        private static final long serialVersionUID = -1599592477L;
8129
8130    /**
8131     * Constructor
8132     */
8133      public ActionSubjectComponent() {
8134        super();
8135      }
8136
8137        /**
8138         * @return {@link #reference} (The entity the action is performed or not performed on or for.)
8139         */
8140        public List<Reference> getReference() { 
8141          if (this.reference == null)
8142            this.reference = new ArrayList<Reference>();
8143          return this.reference;
8144        }
8145
8146        /**
8147         * @return Returns a reference to <code>this</code> for easy method chaining
8148         */
8149        public ActionSubjectComponent setReference(List<Reference> theReference) { 
8150          this.reference = theReference;
8151          return this;
8152        }
8153
8154        public boolean hasReference() { 
8155          if (this.reference == null)
8156            return false;
8157          for (Reference item : this.reference)
8158            if (!item.isEmpty())
8159              return true;
8160          return false;
8161        }
8162
8163        public Reference addReference() { //3
8164          Reference t = new Reference();
8165          if (this.reference == null)
8166            this.reference = new ArrayList<Reference>();
8167          this.reference.add(t);
8168          return t;
8169        }
8170
8171        public ActionSubjectComponent addReference(Reference t) { //3
8172          if (t == null)
8173            return this;
8174          if (this.reference == null)
8175            this.reference = new ArrayList<Reference>();
8176          this.reference.add(t);
8177          return this;
8178        }
8179
8180        /**
8181         * @return The first repetition of repeating field {@link #reference}, creating it if it does not already exist
8182         */
8183        public Reference getReferenceFirstRep() { 
8184          if (getReference().isEmpty()) {
8185            addReference();
8186          }
8187          return getReference().get(0);
8188        }
8189
8190        /**
8191         * @return {@link #role} (Role type of agent assigned roles in this Contract.)
8192         */
8193        public CodeableConcept getRole() { 
8194          if (this.role == null)
8195            if (Configuration.errorOnAutoCreate())
8196              throw new Error("Attempt to auto-create ActionSubjectComponent.role");
8197            else if (Configuration.doAutoCreate())
8198              this.role = new CodeableConcept(); // cc
8199          return this.role;
8200        }
8201
8202        public boolean hasRole() { 
8203          return this.role != null && !this.role.isEmpty();
8204        }
8205
8206        /**
8207         * @param value {@link #role} (Role type of agent assigned roles in this Contract.)
8208         */
8209        public ActionSubjectComponent setRole(CodeableConcept value) { 
8210          this.role = value;
8211          return this;
8212        }
8213
8214        protected void listChildren(List<Property> children) {
8215          super.listChildren(children);
8216          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));
8217          children.add(new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
8218        }
8219
8220        @Override
8221        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8222          switch (_hash) {
8223          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);
8224          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role);
8225          default: return super.getNamedProperty(_hash, _name, _checkValid);
8226          }
8227
8228        }
8229
8230      @Override
8231      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8232        switch (hash) {
8233        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : this.reference.toArray(new Base[this.reference.size()]); // Reference
8234        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
8235        default: return super.getProperty(hash, name, checkValid);
8236        }
8237
8238      }
8239
8240      @Override
8241      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8242        switch (hash) {
8243        case -925155509: // reference
8244          this.getReference().add(castToReference(value)); // Reference
8245          return value;
8246        case 3506294: // role
8247          this.role = castToCodeableConcept(value); // CodeableConcept
8248          return value;
8249        default: return super.setProperty(hash, name, value);
8250        }
8251
8252      }
8253
8254      @Override
8255      public Base setProperty(String name, Base value) throws FHIRException {
8256        if (name.equals("reference")) {
8257          this.getReference().add(castToReference(value));
8258        } else if (name.equals("role")) {
8259          this.role = castToCodeableConcept(value); // CodeableConcept
8260        } else
8261          return super.setProperty(name, value);
8262        return value;
8263      }
8264
8265      @Override
8266      public Base makeProperty(int hash, String name) throws FHIRException {
8267        switch (hash) {
8268        case -925155509:  return addReference(); 
8269        case 3506294:  return getRole();
8270        default: return super.makeProperty(hash, name);
8271        }
8272
8273      }
8274
8275      @Override
8276      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8277        switch (hash) {
8278        case -925155509: /*reference*/ return new String[] {"Reference"};
8279        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
8280        default: return super.getTypesForProperty(hash, name);
8281        }
8282
8283      }
8284
8285      @Override
8286      public Base addChild(String name) throws FHIRException {
8287        if (name.equals("reference")) {
8288          return addReference();
8289        }
8290        else if (name.equals("role")) {
8291          this.role = new CodeableConcept();
8292          return this.role;
8293        }
8294        else
8295          return super.addChild(name);
8296      }
8297
8298      public ActionSubjectComponent copy() {
8299        ActionSubjectComponent dst = new ActionSubjectComponent();
8300        copyValues(dst);
8301        return dst;
8302      }
8303
8304      public void copyValues(ActionSubjectComponent dst) {
8305        super.copyValues(dst);
8306        if (reference != null) {
8307          dst.reference = new ArrayList<Reference>();
8308          for (Reference i : reference)
8309            dst.reference.add(i.copy());
8310        };
8311        dst.role = role == null ? null : role.copy();
8312      }
8313
8314      @Override
8315      public boolean equalsDeep(Base other_) {
8316        if (!super.equalsDeep(other_))
8317          return false;
8318        if (!(other_ instanceof ActionSubjectComponent))
8319          return false;
8320        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8321        return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
8322      }
8323
8324      @Override
8325      public boolean equalsShallow(Base other_) {
8326        if (!super.equalsShallow(other_))
8327          return false;
8328        if (!(other_ instanceof ActionSubjectComponent))
8329          return false;
8330        ActionSubjectComponent o = (ActionSubjectComponent) other_;
8331        return true;
8332      }
8333
8334      public boolean isEmpty() {
8335        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
8336      }
8337
8338  public String fhirType() {
8339    return "Contract.term.action.subject";
8340
8341  }
8342
8343  }
8344
8345    @Block()
8346    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
8347        /**
8348         * Role of this Contract signer, e.g. notary, grantee.
8349         */
8350        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
8351        @Description(shortDefinition="Contract Signatory Role", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
8352        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-signer-type")
8353        protected Coding type;
8354
8355        /**
8356         * Party which is a signator to this Contract.
8357         */
8358        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
8359        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
8360        protected Reference party;
8361
8362        /**
8363         * Legally binding Contract DSIG signature contents in Base64.
8364         */
8365        @Child(name = "signature", type = {Signature.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8366        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
8367        protected List<Signature> signature;
8368
8369        private static final long serialVersionUID = 1384929729L;
8370
8371    /**
8372     * Constructor
8373     */
8374      public SignatoryComponent() {
8375        super();
8376      }
8377
8378    /**
8379     * Constructor
8380     */
8381      public SignatoryComponent(Coding type, Reference party) {
8382        super();
8383        this.type = type;
8384        this.party = party;
8385      }
8386
8387        /**
8388         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8389         */
8390        public Coding getType() { 
8391          if (this.type == null)
8392            if (Configuration.errorOnAutoCreate())
8393              throw new Error("Attempt to auto-create SignatoryComponent.type");
8394            else if (Configuration.doAutoCreate())
8395              this.type = new Coding(); // cc
8396          return this.type;
8397        }
8398
8399        public boolean hasType() { 
8400          return this.type != null && !this.type.isEmpty();
8401        }
8402
8403        /**
8404         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
8405         */
8406        public SignatoryComponent setType(Coding value) { 
8407          this.type = value;
8408          return this;
8409        }
8410
8411        /**
8412         * @return {@link #party} (Party which is a signator to this Contract.)
8413         */
8414        public Reference getParty() { 
8415          if (this.party == null)
8416            if (Configuration.errorOnAutoCreate())
8417              throw new Error("Attempt to auto-create SignatoryComponent.party");
8418            else if (Configuration.doAutoCreate())
8419              this.party = new Reference(); // cc
8420          return this.party;
8421        }
8422
8423        public boolean hasParty() { 
8424          return this.party != null && !this.party.isEmpty();
8425        }
8426
8427        /**
8428         * @param value {@link #party} (Party which is a signator to this Contract.)
8429         */
8430        public SignatoryComponent setParty(Reference value) { 
8431          this.party = value;
8432          return this;
8433        }
8434
8435        /**
8436         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.)
8437         */
8438        public List<Signature> getSignature() { 
8439          if (this.signature == null)
8440            this.signature = new ArrayList<Signature>();
8441          return this.signature;
8442        }
8443
8444        /**
8445         * @return Returns a reference to <code>this</code> for easy method chaining
8446         */
8447        public SignatoryComponent setSignature(List<Signature> theSignature) { 
8448          this.signature = theSignature;
8449          return this;
8450        }
8451
8452        public boolean hasSignature() { 
8453          if (this.signature == null)
8454            return false;
8455          for (Signature item : this.signature)
8456            if (!item.isEmpty())
8457              return true;
8458          return false;
8459        }
8460
8461        public Signature addSignature() { //3
8462          Signature t = new Signature();
8463          if (this.signature == null)
8464            this.signature = new ArrayList<Signature>();
8465          this.signature.add(t);
8466          return t;
8467        }
8468
8469        public SignatoryComponent addSignature(Signature t) { //3
8470          if (t == null)
8471            return this;
8472          if (this.signature == null)
8473            this.signature = new ArrayList<Signature>();
8474          this.signature.add(t);
8475          return this;
8476        }
8477
8478        /**
8479         * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist
8480         */
8481        public Signature getSignatureFirstRep() { 
8482          if (getSignature().isEmpty()) {
8483            addSignature();
8484          }
8485          return getSignature().get(0);
8486        }
8487
8488        protected void listChildren(List<Property> children) {
8489          super.listChildren(children);
8490          children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
8491          children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party));
8492          children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
8493        }
8494
8495        @Override
8496        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8497          switch (_hash) {
8498          case 3575610: /*type*/  return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type);
8499          case 106437350: /*party*/  return new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Party which is a signator to this Contract.", 0, 1, party);
8500          case 1073584312: /*signature*/  return new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
8501          default: return super.getNamedProperty(_hash, _name, _checkValid);
8502          }
8503
8504        }
8505
8506      @Override
8507      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8508        switch (hash) {
8509        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8510        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
8511        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
8512        default: return super.getProperty(hash, name, checkValid);
8513        }
8514
8515      }
8516
8517      @Override
8518      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8519        switch (hash) {
8520        case 3575610: // type
8521          this.type = castToCoding(value); // Coding
8522          return value;
8523        case 106437350: // party
8524          this.party = castToReference(value); // Reference
8525          return value;
8526        case 1073584312: // signature
8527          this.getSignature().add(castToSignature(value)); // Signature
8528          return value;
8529        default: return super.setProperty(hash, name, value);
8530        }
8531
8532      }
8533
8534      @Override
8535      public Base setProperty(String name, Base value) throws FHIRException {
8536        if (name.equals("type")) {
8537          this.type = castToCoding(value); // Coding
8538        } else if (name.equals("party")) {
8539          this.party = castToReference(value); // Reference
8540        } else if (name.equals("signature")) {
8541          this.getSignature().add(castToSignature(value));
8542        } else
8543          return super.setProperty(name, value);
8544        return value;
8545      }
8546
8547      @Override
8548      public Base makeProperty(int hash, String name) throws FHIRException {
8549        switch (hash) {
8550        case 3575610:  return getType();
8551        case 106437350:  return getParty();
8552        case 1073584312:  return addSignature(); 
8553        default: return super.makeProperty(hash, name);
8554        }
8555
8556      }
8557
8558      @Override
8559      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8560        switch (hash) {
8561        case 3575610: /*type*/ return new String[] {"Coding"};
8562        case 106437350: /*party*/ return new String[] {"Reference"};
8563        case 1073584312: /*signature*/ return new String[] {"Signature"};
8564        default: return super.getTypesForProperty(hash, name);
8565        }
8566
8567      }
8568
8569      @Override
8570      public Base addChild(String name) throws FHIRException {
8571        if (name.equals("type")) {
8572          this.type = new Coding();
8573          return this.type;
8574        }
8575        else if (name.equals("party")) {
8576          this.party = new Reference();
8577          return this.party;
8578        }
8579        else if (name.equals("signature")) {
8580          return addSignature();
8581        }
8582        else
8583          return super.addChild(name);
8584      }
8585
8586      public SignatoryComponent copy() {
8587        SignatoryComponent dst = new SignatoryComponent();
8588        copyValues(dst);
8589        return dst;
8590      }
8591
8592      public void copyValues(SignatoryComponent dst) {
8593        super.copyValues(dst);
8594        dst.type = type == null ? null : type.copy();
8595        dst.party = party == null ? null : party.copy();
8596        if (signature != null) {
8597          dst.signature = new ArrayList<Signature>();
8598          for (Signature i : signature)
8599            dst.signature.add(i.copy());
8600        };
8601      }
8602
8603      @Override
8604      public boolean equalsDeep(Base other_) {
8605        if (!super.equalsDeep(other_))
8606          return false;
8607        if (!(other_ instanceof SignatoryComponent))
8608          return false;
8609        SignatoryComponent o = (SignatoryComponent) other_;
8610        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
8611          ;
8612      }
8613
8614      @Override
8615      public boolean equalsShallow(Base other_) {
8616        if (!super.equalsShallow(other_))
8617          return false;
8618        if (!(other_ instanceof SignatoryComponent))
8619          return false;
8620        SignatoryComponent o = (SignatoryComponent) other_;
8621        return true;
8622      }
8623
8624      public boolean isEmpty() {
8625        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
8626      }
8627
8628  public String fhirType() {
8629    return "Contract.signer";
8630
8631  }
8632
8633  }
8634
8635    @Block()
8636    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8637        /**
8638         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
8639         */
8640        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8641        @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." )
8642        protected Type content;
8643
8644        private static final long serialVersionUID = -1763459053L;
8645
8646    /**
8647     * Constructor
8648     */
8649      public FriendlyLanguageComponent() {
8650        super();
8651      }
8652
8653    /**
8654     * Constructor
8655     */
8656      public FriendlyLanguageComponent(Type content) {
8657        super();
8658        this.content = content;
8659      }
8660
8661        /**
8662         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8663         */
8664        public Type getContent() { 
8665          return this.content;
8666        }
8667
8668        /**
8669         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8670         */
8671        public Attachment getContentAttachment() throws FHIRException { 
8672          if (this.content == null)
8673            this.content = new Attachment();
8674          if (!(this.content instanceof Attachment))
8675            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8676          return (Attachment) this.content;
8677        }
8678
8679        public boolean hasContentAttachment() { 
8680          return this != null && this.content instanceof Attachment;
8681        }
8682
8683        /**
8684         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8685         */
8686        public Reference getContentReference() throws FHIRException { 
8687          if (this.content == null)
8688            this.content = new Reference();
8689          if (!(this.content instanceof Reference))
8690            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8691          return (Reference) this.content;
8692        }
8693
8694        public boolean hasContentReference() { 
8695          return this != null && this.content instanceof Reference;
8696        }
8697
8698        public boolean hasContent() { 
8699          return this.content != null && !this.content.isEmpty();
8700        }
8701
8702        /**
8703         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
8704         */
8705        public FriendlyLanguageComponent setContent(Type value) { 
8706          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8707            throw new Error("Not the right type for Contract.friendly.content[x]: "+value.fhirType());
8708          this.content = value;
8709          return this;
8710        }
8711
8712        protected void listChildren(List<Property> children) {
8713          super.listChildren(children);
8714          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));
8715        }
8716
8717        @Override
8718        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8719          switch (_hash) {
8720          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);
8721          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);
8722          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
8723          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, 1, content);
8724          default: return super.getNamedProperty(_hash, _name, _checkValid);
8725          }
8726
8727        }
8728
8729      @Override
8730      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8731        switch (hash) {
8732        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
8733        default: return super.getProperty(hash, name, checkValid);
8734        }
8735
8736      }
8737
8738      @Override
8739      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8740        switch (hash) {
8741        case 951530617: // content
8742          this.content = castToType(value); // Type
8743          return value;
8744        default: return super.setProperty(hash, name, value);
8745        }
8746
8747      }
8748
8749      @Override
8750      public Base setProperty(String name, Base value) throws FHIRException {
8751        if (name.equals("content[x]")) {
8752          this.content = castToType(value); // Type
8753        } else
8754          return super.setProperty(name, value);
8755        return value;
8756      }
8757
8758      @Override
8759      public Base makeProperty(int hash, String name) throws FHIRException {
8760        switch (hash) {
8761        case 264548711:  return getContent();
8762        case 951530617:  return getContent();
8763        default: return super.makeProperty(hash, name);
8764        }
8765
8766      }
8767
8768      @Override
8769      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8770        switch (hash) {
8771        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8772        default: return super.getTypesForProperty(hash, name);
8773        }
8774
8775      }
8776
8777      @Override
8778      public Base addChild(String name) throws FHIRException {
8779        if (name.equals("contentAttachment")) {
8780          this.content = new Attachment();
8781          return this.content;
8782        }
8783        else if (name.equals("contentReference")) {
8784          this.content = new Reference();
8785          return this.content;
8786        }
8787        else
8788          return super.addChild(name);
8789      }
8790
8791      public FriendlyLanguageComponent copy() {
8792        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
8793        copyValues(dst);
8794        return dst;
8795      }
8796
8797      public void copyValues(FriendlyLanguageComponent dst) {
8798        super.copyValues(dst);
8799        dst.content = content == null ? null : content.copy();
8800      }
8801
8802      @Override
8803      public boolean equalsDeep(Base other_) {
8804        if (!super.equalsDeep(other_))
8805          return false;
8806        if (!(other_ instanceof FriendlyLanguageComponent))
8807          return false;
8808        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8809        return compareDeep(content, o.content, true);
8810      }
8811
8812      @Override
8813      public boolean equalsShallow(Base other_) {
8814        if (!super.equalsShallow(other_))
8815          return false;
8816        if (!(other_ instanceof FriendlyLanguageComponent))
8817          return false;
8818        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
8819        return true;
8820      }
8821
8822      public boolean isEmpty() {
8823        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
8824      }
8825
8826  public String fhirType() {
8827    return "Contract.friendly";
8828
8829  }
8830
8831  }
8832
8833    @Block()
8834    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
8835        /**
8836         * Contract legal text in human renderable form.
8837         */
8838        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
8839        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
8840        protected Type content;
8841
8842        private static final long serialVersionUID = -1763459053L;
8843
8844    /**
8845     * Constructor
8846     */
8847      public LegalLanguageComponent() {
8848        super();
8849      }
8850
8851    /**
8852     * Constructor
8853     */
8854      public LegalLanguageComponent(Type content) {
8855        super();
8856        this.content = content;
8857      }
8858
8859        /**
8860         * @return {@link #content} (Contract legal text in human renderable form.)
8861         */
8862        public Type getContent() { 
8863          return this.content;
8864        }
8865
8866        /**
8867         * @return {@link #content} (Contract legal text in human renderable form.)
8868         */
8869        public Attachment getContentAttachment() throws FHIRException { 
8870          if (this.content == null)
8871            this.content = new Attachment();
8872          if (!(this.content instanceof Attachment))
8873            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
8874          return (Attachment) this.content;
8875        }
8876
8877        public boolean hasContentAttachment() { 
8878          return this != null && this.content instanceof Attachment;
8879        }
8880
8881        /**
8882         * @return {@link #content} (Contract legal text in human renderable form.)
8883         */
8884        public Reference getContentReference() throws FHIRException { 
8885          if (this.content == null)
8886            this.content = new Reference();
8887          if (!(this.content instanceof Reference))
8888            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
8889          return (Reference) this.content;
8890        }
8891
8892        public boolean hasContentReference() { 
8893          return this != null && this.content instanceof Reference;
8894        }
8895
8896        public boolean hasContent() { 
8897          return this.content != null && !this.content.isEmpty();
8898        }
8899
8900        /**
8901         * @param value {@link #content} (Contract legal text in human renderable form.)
8902         */
8903        public LegalLanguageComponent setContent(Type value) { 
8904          if (value != null && !(value instanceof Attachment || value instanceof Reference))
8905            throw new Error("Not the right type for Contract.legal.content[x]: "+value.fhirType());
8906          this.content = value;
8907          return this;
8908        }
8909
8910        protected void listChildren(List<Property> children) {
8911          super.listChildren(children);
8912          children.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content));
8913        }
8914
8915        @Override
8916        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8917          switch (_hash) {
8918          case 264548711: /*content[x]*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8919          case 951530617: /*content*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8920          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8921          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, 1, content);
8922          default: return super.getNamedProperty(_hash, _name, _checkValid);
8923          }
8924
8925        }
8926
8927      @Override
8928      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8929        switch (hash) {
8930        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
8931        default: return super.getProperty(hash, name, checkValid);
8932        }
8933
8934      }
8935
8936      @Override
8937      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8938        switch (hash) {
8939        case 951530617: // content
8940          this.content = castToType(value); // Type
8941          return value;
8942        default: return super.setProperty(hash, name, value);
8943        }
8944
8945      }
8946
8947      @Override
8948      public Base setProperty(String name, Base value) throws FHIRException {
8949        if (name.equals("content[x]")) {
8950          this.content = castToType(value); // Type
8951        } else
8952          return super.setProperty(name, value);
8953        return value;
8954      }
8955
8956      @Override
8957      public Base makeProperty(int hash, String name) throws FHIRException {
8958        switch (hash) {
8959        case 264548711:  return getContent();
8960        case 951530617:  return getContent();
8961        default: return super.makeProperty(hash, name);
8962        }
8963
8964      }
8965
8966      @Override
8967      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8968        switch (hash) {
8969        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
8970        default: return super.getTypesForProperty(hash, name);
8971        }
8972
8973      }
8974
8975      @Override
8976      public Base addChild(String name) throws FHIRException {
8977        if (name.equals("contentAttachment")) {
8978          this.content = new Attachment();
8979          return this.content;
8980        }
8981        else if (name.equals("contentReference")) {
8982          this.content = new Reference();
8983          return this.content;
8984        }
8985        else
8986          return super.addChild(name);
8987      }
8988
8989      public LegalLanguageComponent copy() {
8990        LegalLanguageComponent dst = new LegalLanguageComponent();
8991        copyValues(dst);
8992        return dst;
8993      }
8994
8995      public void copyValues(LegalLanguageComponent dst) {
8996        super.copyValues(dst);
8997        dst.content = content == null ? null : content.copy();
8998      }
8999
9000      @Override
9001      public boolean equalsDeep(Base other_) {
9002        if (!super.equalsDeep(other_))
9003          return false;
9004        if (!(other_ instanceof LegalLanguageComponent))
9005          return false;
9006        LegalLanguageComponent o = (LegalLanguageComponent) other_;
9007        return compareDeep(content, o.content, true);
9008      }
9009
9010      @Override
9011      public boolean equalsShallow(Base other_) {
9012        if (!super.equalsShallow(other_))
9013          return false;
9014        if (!(other_ instanceof LegalLanguageComponent))
9015          return false;
9016        LegalLanguageComponent o = (LegalLanguageComponent) other_;
9017        return true;
9018      }
9019
9020      public boolean isEmpty() {
9021        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9022      }
9023
9024  public String fhirType() {
9025    return "Contract.legal";
9026
9027  }
9028
9029  }
9030
9031    @Block()
9032    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
9033        /**
9034         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
9035         */
9036        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
9037        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
9038        protected Type content;
9039
9040        private static final long serialVersionUID = -1763459053L;
9041
9042    /**
9043     * Constructor
9044     */
9045      public ComputableLanguageComponent() {
9046        super();
9047      }
9048
9049    /**
9050     * Constructor
9051     */
9052      public ComputableLanguageComponent(Type content) {
9053        super();
9054        this.content = content;
9055      }
9056
9057        /**
9058         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9059         */
9060        public Type getContent() { 
9061          return this.content;
9062        }
9063
9064        /**
9065         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9066         */
9067        public Attachment getContentAttachment() throws FHIRException { 
9068          if (this.content == null)
9069            this.content = new Attachment();
9070          if (!(this.content instanceof Attachment))
9071            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
9072          return (Attachment) this.content;
9073        }
9074
9075        public boolean hasContentAttachment() { 
9076          return this != null && this.content instanceof Attachment;
9077        }
9078
9079        /**
9080         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9081         */
9082        public Reference getContentReference() throws FHIRException { 
9083          if (this.content == null)
9084            this.content = new Reference();
9085          if (!(this.content instanceof Reference))
9086            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
9087          return (Reference) this.content;
9088        }
9089
9090        public boolean hasContentReference() { 
9091          return this != null && this.content instanceof Reference;
9092        }
9093
9094        public boolean hasContent() { 
9095          return this.content != null && !this.content.isEmpty();
9096        }
9097
9098        /**
9099         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
9100         */
9101        public ComputableLanguageComponent setContent(Type value) { 
9102          if (value != null && !(value instanceof Attachment || value instanceof Reference))
9103            throw new Error("Not the right type for Contract.rule.content[x]: "+value.fhirType());
9104          this.content = value;
9105          return this;
9106        }
9107
9108        protected void listChildren(List<Property> children) {
9109          super.listChildren(children);
9110          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));
9111        }
9112
9113        @Override
9114        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9115          switch (_hash) {
9116          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);
9117          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);
9118          case -702028164: /*contentAttachment*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
9119          case 1193747154: /*contentReference*/  return new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
9120          default: return super.getNamedProperty(_hash, _name, _checkValid);
9121          }
9122
9123        }
9124
9125      @Override
9126      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9127        switch (hash) {
9128        case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type
9129        default: return super.getProperty(hash, name, checkValid);
9130        }
9131
9132      }
9133
9134      @Override
9135      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9136        switch (hash) {
9137        case 951530617: // content
9138          this.content = castToType(value); // Type
9139          return value;
9140        default: return super.setProperty(hash, name, value);
9141        }
9142
9143      }
9144
9145      @Override
9146      public Base setProperty(String name, Base value) throws FHIRException {
9147        if (name.equals("content[x]")) {
9148          this.content = castToType(value); // Type
9149        } else
9150          return super.setProperty(name, value);
9151        return value;
9152      }
9153
9154      @Override
9155      public Base makeProperty(int hash, String name) throws FHIRException {
9156        switch (hash) {
9157        case 264548711:  return getContent();
9158        case 951530617:  return getContent();
9159        default: return super.makeProperty(hash, name);
9160        }
9161
9162      }
9163
9164      @Override
9165      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9166        switch (hash) {
9167        case 951530617: /*content*/ return new String[] {"Attachment", "Reference"};
9168        default: return super.getTypesForProperty(hash, name);
9169        }
9170
9171      }
9172
9173      @Override
9174      public Base addChild(String name) throws FHIRException {
9175        if (name.equals("contentAttachment")) {
9176          this.content = new Attachment();
9177          return this.content;
9178        }
9179        else if (name.equals("contentReference")) {
9180          this.content = new Reference();
9181          return this.content;
9182        }
9183        else
9184          return super.addChild(name);
9185      }
9186
9187      public ComputableLanguageComponent copy() {
9188        ComputableLanguageComponent dst = new ComputableLanguageComponent();
9189        copyValues(dst);
9190        return dst;
9191      }
9192
9193      public void copyValues(ComputableLanguageComponent dst) {
9194        super.copyValues(dst);
9195        dst.content = content == null ? null : content.copy();
9196      }
9197
9198      @Override
9199      public boolean equalsDeep(Base other_) {
9200        if (!super.equalsDeep(other_))
9201          return false;
9202        if (!(other_ instanceof ComputableLanguageComponent))
9203          return false;
9204        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9205        return compareDeep(content, o.content, true);
9206      }
9207
9208      @Override
9209      public boolean equalsShallow(Base other_) {
9210        if (!super.equalsShallow(other_))
9211          return false;
9212        if (!(other_ instanceof ComputableLanguageComponent))
9213          return false;
9214        ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
9215        return true;
9216      }
9217
9218      public boolean isEmpty() {
9219        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
9220      }
9221
9222  public String fhirType() {
9223    return "Contract.rule";
9224
9225  }
9226
9227  }
9228
9229    /**
9230     * Unique identifier for this Contract or a derivative that references a Source Contract.
9231     */
9232    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9233    @Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract or a derivative that references a Source Contract." )
9234    protected List<Identifier> identifier;
9235
9236    /**
9237     * Canonical identifier for this contract, represented as a URI (globally unique).
9238     */
9239    @Child(name = "url", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
9240    @Description(shortDefinition="Basal definition", formalDefinition="Canonical identifier for this contract, represented as a URI (globally unique)." )
9241    protected UriType url;
9242
9243    /**
9244     * An edition identifier used for business purposes to label business significant variants.
9245     */
9246    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
9247    @Description(shortDefinition="Business edition", formalDefinition="An edition identifier used for business purposes to label business significant variants." )
9248    protected StringType version;
9249
9250    /**
9251     * The status of the resource instance.
9252     */
9253    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
9254    @Description(shortDefinition="amended | appended | cancelled | disputed | entered-in-error | executable +", formalDefinition="The status of the resource instance." )
9255    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-status")
9256    protected Enumeration<ContractStatus> status;
9257
9258    /**
9259     * 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.
9260     */
9261    @Child(name = "legalState", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
9262    @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." )
9263    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-legalstate")
9264    protected CodeableConcept legalState;
9265
9266    /**
9267     * The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.
9268     */
9269    @Child(name = "instantiatesCanonical", type = {Contract.class}, order=5, min=0, max=1, modifier=false, summary=false)
9270    @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." )
9271    protected Reference instantiatesCanonical;
9272
9273    /**
9274     * The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9275     */
9276    @Child(name = "instantiatesUri", type = {UriType.class}, order=6, min=0, max=1, modifier=false, summary=false)
9277    @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." )
9278    protected UriType instantiatesUri;
9279
9280    /**
9281     * The minimal content derived from the basal information source at a specific stage in its lifecycle.
9282     */
9283    @Child(name = "contentDerivative", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9284    @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." )
9285    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-content-derivative")
9286    protected CodeableConcept contentDerivative;
9287
9288    /**
9289     * When this  Contract was issued.
9290     */
9291    @Child(name = "issued", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
9292    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
9293    protected DateTimeType issued;
9294
9295    /**
9296     * Relevant time or time-period when this Contract is applicable.
9297     */
9298    @Child(name = "applies", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
9299    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
9300    protected Period applies;
9301
9302    /**
9303     * Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.
9304     */
9305    @Child(name = "expirationType", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false)
9306    @Description(shortDefinition="Contract cessation cause", formalDefinition="Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract." )
9307    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-expiration-type")
9308    protected CodeableConcept expirationType;
9309
9310    /**
9311     * The target entity impacted by or of interest to parties to the agreement.
9312     */
9313    @Child(name = "subject", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9314    @Description(shortDefinition="Contract Target Entity", formalDefinition="The target entity impacted by or of interest to parties to the agreement." )
9315    protected List<Reference> subject;
9316
9317    /**
9318     * 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.
9319     */
9320    @Child(name = "authority", type = {Organization.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9321    @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." )
9322    protected List<Reference> authority;
9323
9324    /**
9325     * 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.
9326     */
9327    @Child(name = "domain", type = {Location.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9328    @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." )
9329    protected List<Reference> domain;
9330
9331    /**
9332     * Sites in which the contract is complied with,  exercised, or in force.
9333     */
9334    @Child(name = "site", type = {Location.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9335    @Description(shortDefinition="Specific Location", formalDefinition="Sites in which the contract is complied with,  exercised, or in force." )
9336    protected List<Reference> site;
9337
9338    /**
9339     * 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.
9340     */
9341    @Child(name = "name", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
9342    @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." )
9343    protected StringType name;
9344
9345    /**
9346     * A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.
9347     */
9348    @Child(name = "title", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=true)
9349    @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." )
9350    protected StringType title;
9351
9352    /**
9353     * 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.
9354     */
9355    @Child(name = "subtitle", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
9356    @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." )
9357    protected StringType subtitle;
9358
9359    /**
9360     * 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.
9361     */
9362    @Child(name = "alias", type = {StringType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9363    @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." )
9364    protected List<StringType> alias;
9365
9366    /**
9367     * The individual or organization that authored the Contract definition, derivative, or instance in any legal state.
9368     */
9369    @Child(name = "author", type = {Patient.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
9370    @Description(shortDefinition="Source of Contract", formalDefinition="The individual or organization that authored the Contract definition, derivative, or instance in any legal state." )
9371    protected Reference author;
9372
9373    /**
9374     * A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.
9375     */
9376    @Child(name = "scope", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
9377    @Description(shortDefinition="Range of Legal Concerns", formalDefinition="A selector of legal concerns for this Contract definition, derivative, or instance in any legal state." )
9378    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-scope")
9379    protected CodeableConcept scope;
9380
9381    /**
9382     * Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.
9383     */
9384    @Child(name = "topic", type = {CodeableConcept.class, Reference.class}, order=21, min=0, max=1, modifier=false, summary=false)
9385    @Description(shortDefinition="Focus of contract interest", formalDefinition="Narrows the range of legal concerns to focus on the achievement of specific contractual objectives." )
9386    protected Type topic;
9387
9388    /**
9389     * 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.
9390     */
9391    @Child(name = "type", type = {CodeableConcept.class}, order=22, min=0, max=1, modifier=false, summary=true)
9392    @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." )
9393    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-type")
9394    protected CodeableConcept type;
9395
9396    /**
9397     * 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.
9398     */
9399    @Child(name = "subType", type = {CodeableConcept.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
9400    @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." )
9401    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contract-subtype")
9402    protected List<CodeableConcept> subType;
9403
9404    /**
9405     * 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.
9406     */
9407    @Child(name = "contentDefinition", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
9408    @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." )
9409    protected ContentDefinitionComponent contentDefinition;
9410
9411    /**
9412     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
9413     */
9414    @Child(name = "term", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9415    @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." )
9416    protected List<TermComponent> term;
9417
9418    /**
9419     * Information that may be needed by/relevant to the performer in their execution of this term action.
9420     */
9421    @Child(name = "supportingInfo", type = {Reference.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9422    @Description(shortDefinition="Extra Information", formalDefinition="Information that may be needed by/relevant to the performer in their execution of this term action." )
9423    protected List<Reference> supportingInfo;
9424
9425    /**
9426     * 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.
9427     */
9428    @Child(name = "relevantHistory", type = {Provenance.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9429    @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." )
9430    protected List<Reference> relevantHistory;
9431
9432    /**
9433     * 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.
9434     */
9435    @Child(name = "signer", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9436    @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." )
9437    protected List<SignatoryComponent> signer;
9438
9439    /**
9440     * 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.
9441     */
9442    @Child(name = "friendly", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9443    @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." )
9444    protected List<FriendlyLanguageComponent> friendly;
9445
9446    /**
9447     * List of Legal expressions or representations of this Contract.
9448     */
9449    @Child(name = "legal", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9450    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
9451    protected List<LegalLanguageComponent> legal;
9452
9453    /**
9454     * List of Computable Policy Rule Language Representations of this Contract.
9455     */
9456    @Child(name = "rule", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9457    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
9458    protected List<ComputableLanguageComponent> rule;
9459
9460    /**
9461     * 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.
9462     */
9463    @Child(name = "legallyBinding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class, Contract.class}, order=32, min=0, max=1, modifier=false, summary=false)
9464    @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." )
9465    protected Type legallyBinding;
9466
9467    private static final long serialVersionUID = 1448103871L;
9468
9469  /**
9470   * Constructor
9471   */
9472    public Contract() {
9473      super();
9474    }
9475
9476    /**
9477     * @return {@link #identifier} (Unique identifier for this Contract or a derivative that references a Source Contract.)
9478     */
9479    public List<Identifier> getIdentifier() { 
9480      if (this.identifier == null)
9481        this.identifier = new ArrayList<Identifier>();
9482      return this.identifier;
9483    }
9484
9485    /**
9486     * @return Returns a reference to <code>this</code> for easy method chaining
9487     */
9488    public Contract setIdentifier(List<Identifier> theIdentifier) { 
9489      this.identifier = theIdentifier;
9490      return this;
9491    }
9492
9493    public boolean hasIdentifier() { 
9494      if (this.identifier == null)
9495        return false;
9496      for (Identifier item : this.identifier)
9497        if (!item.isEmpty())
9498          return true;
9499      return false;
9500    }
9501
9502    public Identifier addIdentifier() { //3
9503      Identifier t = new Identifier();
9504      if (this.identifier == null)
9505        this.identifier = new ArrayList<Identifier>();
9506      this.identifier.add(t);
9507      return t;
9508    }
9509
9510    public Contract addIdentifier(Identifier t) { //3
9511      if (t == null)
9512        return this;
9513      if (this.identifier == null)
9514        this.identifier = new ArrayList<Identifier>();
9515      this.identifier.add(t);
9516      return this;
9517    }
9518
9519    /**
9520     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
9521     */
9522    public Identifier getIdentifierFirstRep() { 
9523      if (getIdentifier().isEmpty()) {
9524        addIdentifier();
9525      }
9526      return getIdentifier().get(0);
9527    }
9528
9529    /**
9530     * @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
9531     */
9532    public UriType getUrlElement() { 
9533      if (this.url == null)
9534        if (Configuration.errorOnAutoCreate())
9535          throw new Error("Attempt to auto-create Contract.url");
9536        else if (Configuration.doAutoCreate())
9537          this.url = new UriType(); // bb
9538      return this.url;
9539    }
9540
9541    public boolean hasUrlElement() { 
9542      return this.url != null && !this.url.isEmpty();
9543    }
9544
9545    public boolean hasUrl() { 
9546      return this.url != null && !this.url.isEmpty();
9547    }
9548
9549    /**
9550     * @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
9551     */
9552    public Contract setUrlElement(UriType value) { 
9553      this.url = value;
9554      return this;
9555    }
9556
9557    /**
9558     * @return Canonical identifier for this contract, represented as a URI (globally unique).
9559     */
9560    public String getUrl() { 
9561      return this.url == null ? null : this.url.getValue();
9562    }
9563
9564    /**
9565     * @param value Canonical identifier for this contract, represented as a URI (globally unique).
9566     */
9567    public Contract setUrl(String value) { 
9568      if (Utilities.noString(value))
9569        this.url = null;
9570      else {
9571        if (this.url == null)
9572          this.url = new UriType();
9573        this.url.setValue(value);
9574      }
9575      return this;
9576    }
9577
9578    /**
9579     * @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
9580     */
9581    public StringType getVersionElement() { 
9582      if (this.version == null)
9583        if (Configuration.errorOnAutoCreate())
9584          throw new Error("Attempt to auto-create Contract.version");
9585        else if (Configuration.doAutoCreate())
9586          this.version = new StringType(); // bb
9587      return this.version;
9588    }
9589
9590    public boolean hasVersionElement() { 
9591      return this.version != null && !this.version.isEmpty();
9592    }
9593
9594    public boolean hasVersion() { 
9595      return this.version != null && !this.version.isEmpty();
9596    }
9597
9598    /**
9599     * @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
9600     */
9601    public Contract setVersionElement(StringType value) { 
9602      this.version = value;
9603      return this;
9604    }
9605
9606    /**
9607     * @return An edition identifier used for business purposes to label business significant variants.
9608     */
9609    public String getVersion() { 
9610      return this.version == null ? null : this.version.getValue();
9611    }
9612
9613    /**
9614     * @param value An edition identifier used for business purposes to label business significant variants.
9615     */
9616    public Contract setVersion(String value) { 
9617      if (Utilities.noString(value))
9618        this.version = null;
9619      else {
9620        if (this.version == null)
9621          this.version = new StringType();
9622        this.version.setValue(value);
9623      }
9624      return this;
9625    }
9626
9627    /**
9628     * @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
9629     */
9630    public Enumeration<ContractStatus> getStatusElement() { 
9631      if (this.status == null)
9632        if (Configuration.errorOnAutoCreate())
9633          throw new Error("Attempt to auto-create Contract.status");
9634        else if (Configuration.doAutoCreate())
9635          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
9636      return this.status;
9637    }
9638
9639    public boolean hasStatusElement() { 
9640      return this.status != null && !this.status.isEmpty();
9641    }
9642
9643    public boolean hasStatus() { 
9644      return this.status != null && !this.status.isEmpty();
9645    }
9646
9647    /**
9648     * @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
9649     */
9650    public Contract setStatusElement(Enumeration<ContractStatus> value) { 
9651      this.status = value;
9652      return this;
9653    }
9654
9655    /**
9656     * @return The status of the resource instance.
9657     */
9658    public ContractStatus getStatus() { 
9659      return this.status == null ? null : this.status.getValue();
9660    }
9661
9662    /**
9663     * @param value The status of the resource instance.
9664     */
9665    public Contract setStatus(ContractStatus value) { 
9666      if (value == null)
9667        this.status = null;
9668      else {
9669        if (this.status == null)
9670          this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
9671        this.status.setValue(value);
9672      }
9673      return this;
9674    }
9675
9676    /**
9677     * @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.)
9678     */
9679    public CodeableConcept getLegalState() { 
9680      if (this.legalState == null)
9681        if (Configuration.errorOnAutoCreate())
9682          throw new Error("Attempt to auto-create Contract.legalState");
9683        else if (Configuration.doAutoCreate())
9684          this.legalState = new CodeableConcept(); // cc
9685      return this.legalState;
9686    }
9687
9688    public boolean hasLegalState() { 
9689      return this.legalState != null && !this.legalState.isEmpty();
9690    }
9691
9692    /**
9693     * @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.)
9694     */
9695    public Contract setLegalState(CodeableConcept value) { 
9696      this.legalState = value;
9697      return this;
9698    }
9699
9700    /**
9701     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9702     */
9703    public Reference getInstantiatesCanonical() { 
9704      if (this.instantiatesCanonical == null)
9705        if (Configuration.errorOnAutoCreate())
9706          throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
9707        else if (Configuration.doAutoCreate())
9708          this.instantiatesCanonical = new Reference(); // cc
9709      return this.instantiatesCanonical;
9710    }
9711
9712    public boolean hasInstantiatesCanonical() { 
9713      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
9714    }
9715
9716    /**
9717     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.)
9718     */
9719    public Contract setInstantiatesCanonical(Reference value) { 
9720      this.instantiatesCanonical = value;
9721      return this;
9722    }
9723
9724    /**
9725     * @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
9726     */
9727    public UriType getInstantiatesUriElement() { 
9728      if (this.instantiatesUri == null)
9729        if (Configuration.errorOnAutoCreate())
9730          throw new Error("Attempt to auto-create Contract.instantiatesUri");
9731        else if (Configuration.doAutoCreate())
9732          this.instantiatesUri = new UriType(); // bb
9733      return this.instantiatesUri;
9734    }
9735
9736    public boolean hasInstantiatesUriElement() { 
9737      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
9738    }
9739
9740    public boolean hasInstantiatesUri() { 
9741      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
9742    }
9743
9744    /**
9745     * @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
9746     */
9747    public Contract setInstantiatesUriElement(UriType value) { 
9748      this.instantiatesUri = value;
9749      return this;
9750    }
9751
9752    /**
9753     * @return The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9754     */
9755    public String getInstantiatesUri() { 
9756      return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
9757    }
9758
9759    /**
9760     * @param value The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.
9761     */
9762    public Contract setInstantiatesUri(String value) { 
9763      if (Utilities.noString(value))
9764        this.instantiatesUri = null;
9765      else {
9766        if (this.instantiatesUri == null)
9767          this.instantiatesUri = new UriType();
9768        this.instantiatesUri.setValue(value);
9769      }
9770      return this;
9771    }
9772
9773    /**
9774     * @return {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
9775     */
9776    public CodeableConcept getContentDerivative() { 
9777      if (this.contentDerivative == null)
9778        if (Configuration.errorOnAutoCreate())
9779          throw new Error("Attempt to auto-create Contract.contentDerivative");
9780        else if (Configuration.doAutoCreate())
9781          this.contentDerivative = new CodeableConcept(); // cc
9782      return this.contentDerivative;
9783    }
9784
9785    public boolean hasContentDerivative() { 
9786      return this.contentDerivative != null && !this.contentDerivative.isEmpty();
9787    }
9788
9789    /**
9790     * @param value {@link #contentDerivative} (The minimal content derived from the basal information source at a specific stage in its lifecycle.)
9791     */
9792    public Contract setContentDerivative(CodeableConcept value) { 
9793      this.contentDerivative = value;
9794      return this;
9795    }
9796
9797    /**
9798     * @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
9799     */
9800    public DateTimeType getIssuedElement() { 
9801      if (this.issued == null)
9802        if (Configuration.errorOnAutoCreate())
9803          throw new Error("Attempt to auto-create Contract.issued");
9804        else if (Configuration.doAutoCreate())
9805          this.issued = new DateTimeType(); // bb
9806      return this.issued;
9807    }
9808
9809    public boolean hasIssuedElement() { 
9810      return this.issued != null && !this.issued.isEmpty();
9811    }
9812
9813    public boolean hasIssued() { 
9814      return this.issued != null && !this.issued.isEmpty();
9815    }
9816
9817    /**
9818     * @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
9819     */
9820    public Contract setIssuedElement(DateTimeType value) { 
9821      this.issued = value;
9822      return this;
9823    }
9824
9825    /**
9826     * @return When this  Contract was issued.
9827     */
9828    public Date getIssued() { 
9829      return this.issued == null ? null : this.issued.getValue();
9830    }
9831
9832    /**
9833     * @param value When this  Contract was issued.
9834     */
9835    public Contract setIssued(Date value) { 
9836      if (value == null)
9837        this.issued = null;
9838      else {
9839        if (this.issued == null)
9840          this.issued = new DateTimeType();
9841        this.issued.setValue(value);
9842      }
9843      return this;
9844    }
9845
9846    /**
9847     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
9848     */
9849    public Period getApplies() { 
9850      if (this.applies == null)
9851        if (Configuration.errorOnAutoCreate())
9852          throw new Error("Attempt to auto-create Contract.applies");
9853        else if (Configuration.doAutoCreate())
9854          this.applies = new Period(); // cc
9855      return this.applies;
9856    }
9857
9858    public boolean hasApplies() { 
9859      return this.applies != null && !this.applies.isEmpty();
9860    }
9861
9862    /**
9863     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
9864     */
9865    public Contract setApplies(Period value) { 
9866      this.applies = value;
9867      return this;
9868    }
9869
9870    /**
9871     * @return {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
9872     */
9873    public CodeableConcept getExpirationType() { 
9874      if (this.expirationType == null)
9875        if (Configuration.errorOnAutoCreate())
9876          throw new Error("Attempt to auto-create Contract.expirationType");
9877        else if (Configuration.doAutoCreate())
9878          this.expirationType = new CodeableConcept(); // cc
9879      return this.expirationType;
9880    }
9881
9882    public boolean hasExpirationType() { 
9883      return this.expirationType != null && !this.expirationType.isEmpty();
9884    }
9885
9886    /**
9887     * @param value {@link #expirationType} (Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.)
9888     */
9889    public Contract setExpirationType(CodeableConcept value) { 
9890      this.expirationType = value;
9891      return this;
9892    }
9893
9894    /**
9895     * @return {@link #subject} (The target entity impacted by or of interest to parties to the agreement.)
9896     */
9897    public List<Reference> getSubject() { 
9898      if (this.subject == null)
9899        this.subject = new ArrayList<Reference>();
9900      return this.subject;
9901    }
9902
9903    /**
9904     * @return Returns a reference to <code>this</code> for easy method chaining
9905     */
9906    public Contract setSubject(List<Reference> theSubject) { 
9907      this.subject = theSubject;
9908      return this;
9909    }
9910
9911    public boolean hasSubject() { 
9912      if (this.subject == null)
9913        return false;
9914      for (Reference item : this.subject)
9915        if (!item.isEmpty())
9916          return true;
9917      return false;
9918    }
9919
9920    public Reference addSubject() { //3
9921      Reference t = new Reference();
9922      if (this.subject == null)
9923        this.subject = new ArrayList<Reference>();
9924      this.subject.add(t);
9925      return t;
9926    }
9927
9928    public Contract addSubject(Reference t) { //3
9929      if (t == null)
9930        return this;
9931      if (this.subject == null)
9932        this.subject = new ArrayList<Reference>();
9933      this.subject.add(t);
9934      return this;
9935    }
9936
9937    /**
9938     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
9939     */
9940    public Reference getSubjectFirstRep() { 
9941      if (getSubject().isEmpty()) {
9942        addSubject();
9943      }
9944      return getSubject().get(0);
9945    }
9946
9947    /**
9948     * @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.)
9949     */
9950    public List<Reference> getAuthority() { 
9951      if (this.authority == null)
9952        this.authority = new ArrayList<Reference>();
9953      return this.authority;
9954    }
9955
9956    /**
9957     * @return Returns a reference to <code>this</code> for easy method chaining
9958     */
9959    public Contract setAuthority(List<Reference> theAuthority) { 
9960      this.authority = theAuthority;
9961      return this;
9962    }
9963
9964    public boolean hasAuthority() { 
9965      if (this.authority == null)
9966        return false;
9967      for (Reference item : this.authority)
9968        if (!item.isEmpty())
9969          return true;
9970      return false;
9971    }
9972
9973    public Reference addAuthority() { //3
9974      Reference t = new Reference();
9975      if (this.authority == null)
9976        this.authority = new ArrayList<Reference>();
9977      this.authority.add(t);
9978      return t;
9979    }
9980
9981    public Contract addAuthority(Reference t) { //3
9982      if (t == null)
9983        return this;
9984      if (this.authority == null)
9985        this.authority = new ArrayList<Reference>();
9986      this.authority.add(t);
9987      return this;
9988    }
9989
9990    /**
9991     * @return The first repetition of repeating field {@link #authority}, creating it if it does not already exist
9992     */
9993    public Reference getAuthorityFirstRep() { 
9994      if (getAuthority().isEmpty()) {
9995        addAuthority();
9996      }
9997      return getAuthority().get(0);
9998    }
9999
10000    /**
10001     * @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.)
10002     */
10003    public List<Reference> getDomain() { 
10004      if (this.domain == null)
10005        this.domain = new ArrayList<Reference>();
10006      return this.domain;
10007    }
10008
10009    /**
10010     * @return Returns a reference to <code>this</code> for easy method chaining
10011     */
10012    public Contract setDomain(List<Reference> theDomain) { 
10013      this.domain = theDomain;
10014      return this;
10015    }
10016
10017    public boolean hasDomain() { 
10018      if (this.domain == null)
10019        return false;
10020      for (Reference item : this.domain)
10021        if (!item.isEmpty())
10022          return true;
10023      return false;
10024    }
10025
10026    public Reference addDomain() { //3
10027      Reference t = new Reference();
10028      if (this.domain == null)
10029        this.domain = new ArrayList<Reference>();
10030      this.domain.add(t);
10031      return t;
10032    }
10033
10034    public Contract addDomain(Reference t) { //3
10035      if (t == null)
10036        return this;
10037      if (this.domain == null)
10038        this.domain = new ArrayList<Reference>();
10039      this.domain.add(t);
10040      return this;
10041    }
10042
10043    /**
10044     * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist
10045     */
10046    public Reference getDomainFirstRep() { 
10047      if (getDomain().isEmpty()) {
10048        addDomain();
10049      }
10050      return getDomain().get(0);
10051    }
10052
10053    /**
10054     * @return {@link #site} (Sites in which the contract is complied with,  exercised, or in force.)
10055     */
10056    public List<Reference> getSite() { 
10057      if (this.site == null)
10058        this.site = new ArrayList<Reference>();
10059      return this.site;
10060    }
10061
10062    /**
10063     * @return Returns a reference to <code>this</code> for easy method chaining
10064     */
10065    public Contract setSite(List<Reference> theSite) { 
10066      this.site = theSite;
10067      return this;
10068    }
10069
10070    public boolean hasSite() { 
10071      if (this.site == null)
10072        return false;
10073      for (Reference item : this.site)
10074        if (!item.isEmpty())
10075          return true;
10076      return false;
10077    }
10078
10079    public Reference addSite() { //3
10080      Reference t = new Reference();
10081      if (this.site == null)
10082        this.site = new ArrayList<Reference>();
10083      this.site.add(t);
10084      return t;
10085    }
10086
10087    public Contract addSite(Reference t) { //3
10088      if (t == null)
10089        return this;
10090      if (this.site == null)
10091        this.site = new ArrayList<Reference>();
10092      this.site.add(t);
10093      return this;
10094    }
10095
10096    /**
10097     * @return The first repetition of repeating field {@link #site}, creating it if it does not already exist
10098     */
10099    public Reference getSiteFirstRep() { 
10100      if (getSite().isEmpty()) {
10101        addSite();
10102      }
10103      return getSite().get(0);
10104    }
10105
10106    /**
10107     * @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
10108     */
10109    public StringType getNameElement() { 
10110      if (this.name == null)
10111        if (Configuration.errorOnAutoCreate())
10112          throw new Error("Attempt to auto-create Contract.name");
10113        else if (Configuration.doAutoCreate())
10114          this.name = new StringType(); // bb
10115      return this.name;
10116    }
10117
10118    public boolean hasNameElement() { 
10119      return this.name != null && !this.name.isEmpty();
10120    }
10121
10122    public boolean hasName() { 
10123      return this.name != null && !this.name.isEmpty();
10124    }
10125
10126    /**
10127     * @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
10128     */
10129    public Contract setNameElement(StringType value) { 
10130      this.name = value;
10131      return this;
10132    }
10133
10134    /**
10135     * @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.
10136     */
10137    public String getName() { 
10138      return this.name == null ? null : this.name.getValue();
10139    }
10140
10141    /**
10142     * @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.
10143     */
10144    public Contract setName(String value) { 
10145      if (Utilities.noString(value))
10146        this.name = null;
10147      else {
10148        if (this.name == null)
10149          this.name = new StringType();
10150        this.name.setValue(value);
10151      }
10152      return this;
10153    }
10154
10155    /**
10156     * @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
10157     */
10158    public StringType getTitleElement() { 
10159      if (this.title == null)
10160        if (Configuration.errorOnAutoCreate())
10161          throw new Error("Attempt to auto-create Contract.title");
10162        else if (Configuration.doAutoCreate())
10163          this.title = new StringType(); // bb
10164      return this.title;
10165    }
10166
10167    public boolean hasTitleElement() { 
10168      return this.title != null && !this.title.isEmpty();
10169    }
10170
10171    public boolean hasTitle() { 
10172      return this.title != null && !this.title.isEmpty();
10173    }
10174
10175    /**
10176     * @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
10177     */
10178    public Contract setTitleElement(StringType value) { 
10179      this.title = value;
10180      return this;
10181    }
10182
10183    /**
10184     * @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.
10185     */
10186    public String getTitle() { 
10187      return this.title == null ? null : this.title.getValue();
10188    }
10189
10190    /**
10191     * @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.
10192     */
10193    public Contract setTitle(String value) { 
10194      if (Utilities.noString(value))
10195        this.title = null;
10196      else {
10197        if (this.title == null)
10198          this.title = new StringType();
10199        this.title.setValue(value);
10200      }
10201      return this;
10202    }
10203
10204    /**
10205     * @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
10206     */
10207    public StringType getSubtitleElement() { 
10208      if (this.subtitle == null)
10209        if (Configuration.errorOnAutoCreate())
10210          throw new Error("Attempt to auto-create Contract.subtitle");
10211        else if (Configuration.doAutoCreate())
10212          this.subtitle = new StringType(); // bb
10213      return this.subtitle;
10214    }
10215
10216    public boolean hasSubtitleElement() { 
10217      return this.subtitle != null && !this.subtitle.isEmpty();
10218    }
10219
10220    public boolean hasSubtitle() { 
10221      return this.subtitle != null && !this.subtitle.isEmpty();
10222    }
10223
10224    /**
10225     * @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
10226     */
10227    public Contract setSubtitleElement(StringType value) { 
10228      this.subtitle = value;
10229      return this;
10230    }
10231
10232    /**
10233     * @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.
10234     */
10235    public String getSubtitle() { 
10236      return this.subtitle == null ? null : this.subtitle.getValue();
10237    }
10238
10239    /**
10240     * @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.
10241     */
10242    public Contract setSubtitle(String value) { 
10243      if (Utilities.noString(value))
10244        this.subtitle = null;
10245      else {
10246        if (this.subtitle == null)
10247          this.subtitle = new StringType();
10248        this.subtitle.setValue(value);
10249      }
10250      return this;
10251    }
10252
10253    /**
10254     * @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.)
10255     */
10256    public List<StringType> getAlias() { 
10257      if (this.alias == null)
10258        this.alias = new ArrayList<StringType>();
10259      return this.alias;
10260    }
10261
10262    /**
10263     * @return Returns a reference to <code>this</code> for easy method chaining
10264     */
10265    public Contract setAlias(List<StringType> theAlias) { 
10266      this.alias = theAlias;
10267      return this;
10268    }
10269
10270    public boolean hasAlias() { 
10271      if (this.alias == null)
10272        return false;
10273      for (StringType item : this.alias)
10274        if (!item.isEmpty())
10275          return true;
10276      return false;
10277    }
10278
10279    /**
10280     * @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.)
10281     */
10282    public StringType addAliasElement() {//2 
10283      StringType t = new StringType();
10284      if (this.alias == null)
10285        this.alias = new ArrayList<StringType>();
10286      this.alias.add(t);
10287      return t;
10288    }
10289
10290    /**
10291     * @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.)
10292     */
10293    public Contract addAlias(String value) { //1
10294      StringType t = new StringType();
10295      t.setValue(value);
10296      if (this.alias == null)
10297        this.alias = new ArrayList<StringType>();
10298      this.alias.add(t);
10299      return this;
10300    }
10301
10302    /**
10303     * @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.)
10304     */
10305    public boolean hasAlias(String value) { 
10306      if (this.alias == null)
10307        return false;
10308      for (StringType v : this.alias)
10309        if (v.getValue().equals(value)) // string
10310          return true;
10311      return false;
10312    }
10313
10314    /**
10315     * @return {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10316     */
10317    public Reference getAuthor() { 
10318      if (this.author == null)
10319        if (Configuration.errorOnAutoCreate())
10320          throw new Error("Attempt to auto-create Contract.author");
10321        else if (Configuration.doAutoCreate())
10322          this.author = new Reference(); // cc
10323      return this.author;
10324    }
10325
10326    public boolean hasAuthor() { 
10327      return this.author != null && !this.author.isEmpty();
10328    }
10329
10330    /**
10331     * @param value {@link #author} (The individual or organization that authored the Contract definition, derivative, or instance in any legal state.)
10332     */
10333    public Contract setAuthor(Reference value) { 
10334      this.author = value;
10335      return this;
10336    }
10337
10338    /**
10339     * @return {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10340     */
10341    public CodeableConcept getScope() { 
10342      if (this.scope == null)
10343        if (Configuration.errorOnAutoCreate())
10344          throw new Error("Attempt to auto-create Contract.scope");
10345        else if (Configuration.doAutoCreate())
10346          this.scope = new CodeableConcept(); // cc
10347      return this.scope;
10348    }
10349
10350    public boolean hasScope() { 
10351      return this.scope != null && !this.scope.isEmpty();
10352    }
10353
10354    /**
10355     * @param value {@link #scope} (A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.)
10356     */
10357    public Contract setScope(CodeableConcept value) { 
10358      this.scope = value;
10359      return this;
10360    }
10361
10362    /**
10363     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10364     */
10365    public Type getTopic() { 
10366      return this.topic;
10367    }
10368
10369    /**
10370     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10371     */
10372    public CodeableConcept getTopicCodeableConcept() throws FHIRException { 
10373      if (this.topic == null)
10374        this.topic = new CodeableConcept();
10375      if (!(this.topic instanceof CodeableConcept))
10376        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.topic.getClass().getName()+" was encountered");
10377      return (CodeableConcept) this.topic;
10378    }
10379
10380    public boolean hasTopicCodeableConcept() { 
10381      return this != null && this.topic instanceof CodeableConcept;
10382    }
10383
10384    /**
10385     * @return {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10386     */
10387    public Reference getTopicReference() throws FHIRException { 
10388      if (this.topic == null)
10389        this.topic = new Reference();
10390      if (!(this.topic instanceof Reference))
10391        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.topic.getClass().getName()+" was encountered");
10392      return (Reference) this.topic;
10393    }
10394
10395    public boolean hasTopicReference() { 
10396      return this != null && this.topic instanceof Reference;
10397    }
10398
10399    public boolean hasTopic() { 
10400      return this.topic != null && !this.topic.isEmpty();
10401    }
10402
10403    /**
10404     * @param value {@link #topic} (Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.)
10405     */
10406    public Contract setTopic(Type value) { 
10407      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
10408        throw new Error("Not the right type for Contract.topic[x]: "+value.fhirType());
10409      this.topic = value;
10410      return this;
10411    }
10412
10413    /**
10414     * @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.)
10415     */
10416    public CodeableConcept getType() { 
10417      if (this.type == null)
10418        if (Configuration.errorOnAutoCreate())
10419          throw new Error("Attempt to auto-create Contract.type");
10420        else if (Configuration.doAutoCreate())
10421          this.type = new CodeableConcept(); // cc
10422      return this.type;
10423    }
10424
10425    public boolean hasType() { 
10426      return this.type != null && !this.type.isEmpty();
10427    }
10428
10429    /**
10430     * @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.)
10431     */
10432    public Contract setType(CodeableConcept value) { 
10433      this.type = value;
10434      return this;
10435    }
10436
10437    /**
10438     * @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.)
10439     */
10440    public List<CodeableConcept> getSubType() { 
10441      if (this.subType == null)
10442        this.subType = new ArrayList<CodeableConcept>();
10443      return this.subType;
10444    }
10445
10446    /**
10447     * @return Returns a reference to <code>this</code> for easy method chaining
10448     */
10449    public Contract setSubType(List<CodeableConcept> theSubType) { 
10450      this.subType = theSubType;
10451      return this;
10452    }
10453
10454    public boolean hasSubType() { 
10455      if (this.subType == null)
10456        return false;
10457      for (CodeableConcept item : this.subType)
10458        if (!item.isEmpty())
10459          return true;
10460      return false;
10461    }
10462
10463    public CodeableConcept addSubType() { //3
10464      CodeableConcept t = new CodeableConcept();
10465      if (this.subType == null)
10466        this.subType = new ArrayList<CodeableConcept>();
10467      this.subType.add(t);
10468      return t;
10469    }
10470
10471    public Contract addSubType(CodeableConcept t) { //3
10472      if (t == null)
10473        return this;
10474      if (this.subType == null)
10475        this.subType = new ArrayList<CodeableConcept>();
10476      this.subType.add(t);
10477      return this;
10478    }
10479
10480    /**
10481     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10482     */
10483    public CodeableConcept getSubTypeFirstRep() { 
10484      if (getSubType().isEmpty()) {
10485        addSubType();
10486      }
10487      return getSubType().get(0);
10488    }
10489
10490    /**
10491     * @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.)
10492     */
10493    public ContentDefinitionComponent getContentDefinition() { 
10494      if (this.contentDefinition == null)
10495        if (Configuration.errorOnAutoCreate())
10496          throw new Error("Attempt to auto-create Contract.contentDefinition");
10497        else if (Configuration.doAutoCreate())
10498          this.contentDefinition = new ContentDefinitionComponent(); // cc
10499      return this.contentDefinition;
10500    }
10501
10502    public boolean hasContentDefinition() { 
10503      return this.contentDefinition != null && !this.contentDefinition.isEmpty();
10504    }
10505
10506    /**
10507     * @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.)
10508     */
10509    public Contract setContentDefinition(ContentDefinitionComponent value) { 
10510      this.contentDefinition = value;
10511      return this;
10512    }
10513
10514    /**
10515     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
10516     */
10517    public List<TermComponent> getTerm() { 
10518      if (this.term == null)
10519        this.term = new ArrayList<TermComponent>();
10520      return this.term;
10521    }
10522
10523    /**
10524     * @return Returns a reference to <code>this</code> for easy method chaining
10525     */
10526    public Contract setTerm(List<TermComponent> theTerm) { 
10527      this.term = theTerm;
10528      return this;
10529    }
10530
10531    public boolean hasTerm() { 
10532      if (this.term == null)
10533        return false;
10534      for (TermComponent item : this.term)
10535        if (!item.isEmpty())
10536          return true;
10537      return false;
10538    }
10539
10540    public TermComponent addTerm() { //3
10541      TermComponent t = new TermComponent();
10542      if (this.term == null)
10543        this.term = new ArrayList<TermComponent>();
10544      this.term.add(t);
10545      return t;
10546    }
10547
10548    public Contract addTerm(TermComponent t) { //3
10549      if (t == null)
10550        return this;
10551      if (this.term == null)
10552        this.term = new ArrayList<TermComponent>();
10553      this.term.add(t);
10554      return this;
10555    }
10556
10557    /**
10558     * @return The first repetition of repeating field {@link #term}, creating it if it does not already exist
10559     */
10560    public TermComponent getTermFirstRep() { 
10561      if (getTerm().isEmpty()) {
10562        addTerm();
10563      }
10564      return getTerm().get(0);
10565    }
10566
10567    /**
10568     * @return {@link #supportingInfo} (Information that may be needed by/relevant to the performer in their execution of this term action.)
10569     */
10570    public List<Reference> getSupportingInfo() { 
10571      if (this.supportingInfo == null)
10572        this.supportingInfo = new ArrayList<Reference>();
10573      return this.supportingInfo;
10574    }
10575
10576    /**
10577     * @return Returns a reference to <code>this</code> for easy method chaining
10578     */
10579    public Contract setSupportingInfo(List<Reference> theSupportingInfo) { 
10580      this.supportingInfo = theSupportingInfo;
10581      return this;
10582    }
10583
10584    public boolean hasSupportingInfo() { 
10585      if (this.supportingInfo == null)
10586        return false;
10587      for (Reference item : this.supportingInfo)
10588        if (!item.isEmpty())
10589          return true;
10590      return false;
10591    }
10592
10593    public Reference addSupportingInfo() { //3
10594      Reference t = new Reference();
10595      if (this.supportingInfo == null)
10596        this.supportingInfo = new ArrayList<Reference>();
10597      this.supportingInfo.add(t);
10598      return t;
10599    }
10600
10601    public Contract addSupportingInfo(Reference t) { //3
10602      if (t == null)
10603        return this;
10604      if (this.supportingInfo == null)
10605        this.supportingInfo = new ArrayList<Reference>();
10606      this.supportingInfo.add(t);
10607      return this;
10608    }
10609
10610    /**
10611     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
10612     */
10613    public Reference getSupportingInfoFirstRep() { 
10614      if (getSupportingInfo().isEmpty()) {
10615        addSupportingInfo();
10616      }
10617      return getSupportingInfo().get(0);
10618    }
10619
10620    /**
10621     * @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.)
10622     */
10623    public List<Reference> getRelevantHistory() { 
10624      if (this.relevantHistory == null)
10625        this.relevantHistory = new ArrayList<Reference>();
10626      return this.relevantHistory;
10627    }
10628
10629    /**
10630     * @return Returns a reference to <code>this</code> for easy method chaining
10631     */
10632    public Contract setRelevantHistory(List<Reference> theRelevantHistory) { 
10633      this.relevantHistory = theRelevantHistory;
10634      return this;
10635    }
10636
10637    public boolean hasRelevantHistory() { 
10638      if (this.relevantHistory == null)
10639        return false;
10640      for (Reference item : this.relevantHistory)
10641        if (!item.isEmpty())
10642          return true;
10643      return false;
10644    }
10645
10646    public Reference addRelevantHistory() { //3
10647      Reference t = new Reference();
10648      if (this.relevantHistory == null)
10649        this.relevantHistory = new ArrayList<Reference>();
10650      this.relevantHistory.add(t);
10651      return t;
10652    }
10653
10654    public Contract addRelevantHistory(Reference t) { //3
10655      if (t == null)
10656        return this;
10657      if (this.relevantHistory == null)
10658        this.relevantHistory = new ArrayList<Reference>();
10659      this.relevantHistory.add(t);
10660      return this;
10661    }
10662
10663    /**
10664     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
10665     */
10666    public Reference getRelevantHistoryFirstRep() { 
10667      if (getRelevantHistory().isEmpty()) {
10668        addRelevantHistory();
10669      }
10670      return getRelevantHistory().get(0);
10671    }
10672
10673    /**
10674     * @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.)
10675     */
10676    public List<SignatoryComponent> getSigner() { 
10677      if (this.signer == null)
10678        this.signer = new ArrayList<SignatoryComponent>();
10679      return this.signer;
10680    }
10681
10682    /**
10683     * @return Returns a reference to <code>this</code> for easy method chaining
10684     */
10685    public Contract setSigner(List<SignatoryComponent> theSigner) { 
10686      this.signer = theSigner;
10687      return this;
10688    }
10689
10690    public boolean hasSigner() { 
10691      if (this.signer == null)
10692        return false;
10693      for (SignatoryComponent item : this.signer)
10694        if (!item.isEmpty())
10695          return true;
10696      return false;
10697    }
10698
10699    public SignatoryComponent addSigner() { //3
10700      SignatoryComponent t = new SignatoryComponent();
10701      if (this.signer == null)
10702        this.signer = new ArrayList<SignatoryComponent>();
10703      this.signer.add(t);
10704      return t;
10705    }
10706
10707    public Contract addSigner(SignatoryComponent t) { //3
10708      if (t == null)
10709        return this;
10710      if (this.signer == null)
10711        this.signer = new ArrayList<SignatoryComponent>();
10712      this.signer.add(t);
10713      return this;
10714    }
10715
10716    /**
10717     * @return The first repetition of repeating field {@link #signer}, creating it if it does not already exist
10718     */
10719    public SignatoryComponent getSignerFirstRep() { 
10720      if (getSigner().isEmpty()) {
10721        addSigner();
10722      }
10723      return getSigner().get(0);
10724    }
10725
10726    /**
10727     * @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.)
10728     */
10729    public List<FriendlyLanguageComponent> getFriendly() { 
10730      if (this.friendly == null)
10731        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10732      return this.friendly;
10733    }
10734
10735    /**
10736     * @return Returns a reference to <code>this</code> for easy method chaining
10737     */
10738    public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) { 
10739      this.friendly = theFriendly;
10740      return this;
10741    }
10742
10743    public boolean hasFriendly() { 
10744      if (this.friendly == null)
10745        return false;
10746      for (FriendlyLanguageComponent item : this.friendly)
10747        if (!item.isEmpty())
10748          return true;
10749      return false;
10750    }
10751
10752    public FriendlyLanguageComponent addFriendly() { //3
10753      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
10754      if (this.friendly == null)
10755        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10756      this.friendly.add(t);
10757      return t;
10758    }
10759
10760    public Contract addFriendly(FriendlyLanguageComponent t) { //3
10761      if (t == null)
10762        return this;
10763      if (this.friendly == null)
10764        this.friendly = new ArrayList<FriendlyLanguageComponent>();
10765      this.friendly.add(t);
10766      return this;
10767    }
10768
10769    /**
10770     * @return The first repetition of repeating field {@link #friendly}, creating it if it does not already exist
10771     */
10772    public FriendlyLanguageComponent getFriendlyFirstRep() { 
10773      if (getFriendly().isEmpty()) {
10774        addFriendly();
10775      }
10776      return getFriendly().get(0);
10777    }
10778
10779    /**
10780     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
10781     */
10782    public List<LegalLanguageComponent> getLegal() { 
10783      if (this.legal == null)
10784        this.legal = new ArrayList<LegalLanguageComponent>();
10785      return this.legal;
10786    }
10787
10788    /**
10789     * @return Returns a reference to <code>this</code> for easy method chaining
10790     */
10791    public Contract setLegal(List<LegalLanguageComponent> theLegal) { 
10792      this.legal = theLegal;
10793      return this;
10794    }
10795
10796    public boolean hasLegal() { 
10797      if (this.legal == null)
10798        return false;
10799      for (LegalLanguageComponent item : this.legal)
10800        if (!item.isEmpty())
10801          return true;
10802      return false;
10803    }
10804
10805    public LegalLanguageComponent addLegal() { //3
10806      LegalLanguageComponent t = new LegalLanguageComponent();
10807      if (this.legal == null)
10808        this.legal = new ArrayList<LegalLanguageComponent>();
10809      this.legal.add(t);
10810      return t;
10811    }
10812
10813    public Contract addLegal(LegalLanguageComponent t) { //3
10814      if (t == null)
10815        return this;
10816      if (this.legal == null)
10817        this.legal = new ArrayList<LegalLanguageComponent>();
10818      this.legal.add(t);
10819      return this;
10820    }
10821
10822    /**
10823     * @return The first repetition of repeating field {@link #legal}, creating it if it does not already exist
10824     */
10825    public LegalLanguageComponent getLegalFirstRep() { 
10826      if (getLegal().isEmpty()) {
10827        addLegal();
10828      }
10829      return getLegal().get(0);
10830    }
10831
10832    /**
10833     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
10834     */
10835    public List<ComputableLanguageComponent> getRule() { 
10836      if (this.rule == null)
10837        this.rule = new ArrayList<ComputableLanguageComponent>();
10838      return this.rule;
10839    }
10840
10841    /**
10842     * @return Returns a reference to <code>this</code> for easy method chaining
10843     */
10844    public Contract setRule(List<ComputableLanguageComponent> theRule) { 
10845      this.rule = theRule;
10846      return this;
10847    }
10848
10849    public boolean hasRule() { 
10850      if (this.rule == null)
10851        return false;
10852      for (ComputableLanguageComponent item : this.rule)
10853        if (!item.isEmpty())
10854          return true;
10855      return false;
10856    }
10857
10858    public ComputableLanguageComponent addRule() { //3
10859      ComputableLanguageComponent t = new ComputableLanguageComponent();
10860      if (this.rule == null)
10861        this.rule = new ArrayList<ComputableLanguageComponent>();
10862      this.rule.add(t);
10863      return t;
10864    }
10865
10866    public Contract addRule(ComputableLanguageComponent t) { //3
10867      if (t == null)
10868        return this;
10869      if (this.rule == null)
10870        this.rule = new ArrayList<ComputableLanguageComponent>();
10871      this.rule.add(t);
10872      return this;
10873    }
10874
10875    /**
10876     * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
10877     */
10878    public ComputableLanguageComponent getRuleFirstRep() { 
10879      if (getRule().isEmpty()) {
10880        addRule();
10881      }
10882      return getRule().get(0);
10883    }
10884
10885    /**
10886     * @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.)
10887     */
10888    public Type getLegallyBinding() { 
10889      return this.legallyBinding;
10890    }
10891
10892    /**
10893     * @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.)
10894     */
10895    public Attachment getLegallyBindingAttachment() throws FHIRException { 
10896      if (this.legallyBinding == null)
10897        this.legallyBinding = new Attachment();
10898      if (!(this.legallyBinding instanceof Attachment))
10899        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
10900      return (Attachment) this.legallyBinding;
10901    }
10902
10903    public boolean hasLegallyBindingAttachment() { 
10904      return this != null && this.legallyBinding instanceof Attachment;
10905    }
10906
10907    /**
10908     * @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.)
10909     */
10910    public Reference getLegallyBindingReference() throws FHIRException { 
10911      if (this.legallyBinding == null)
10912        this.legallyBinding = new Reference();
10913      if (!(this.legallyBinding instanceof Reference))
10914        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.legallyBinding.getClass().getName()+" was encountered");
10915      return (Reference) this.legallyBinding;
10916    }
10917
10918    public boolean hasLegallyBindingReference() { 
10919      return this != null && this.legallyBinding instanceof Reference;
10920    }
10921
10922    public boolean hasLegallyBinding() { 
10923      return this.legallyBinding != null && !this.legallyBinding.isEmpty();
10924    }
10925
10926    /**
10927     * @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.)
10928     */
10929    public Contract setLegallyBinding(Type value) { 
10930      if (value != null && !(value instanceof Attachment || value instanceof Reference))
10931        throw new Error("Not the right type for Contract.legallyBinding[x]: "+value.fhirType());
10932      this.legallyBinding = value;
10933      return this;
10934    }
10935
10936      protected void listChildren(List<Property> children) {
10937        super.listChildren(children);
10938        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));
10939        children.add(new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url));
10940        children.add(new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version));
10941        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
10942        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));
10943        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));
10944        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));
10945        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));
10946        children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
10947        children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies));
10948        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));
10949        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));
10950        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));
10951        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));
10952        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));
10953        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));
10954        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));
10955        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));
10956        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));
10957        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));
10958        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));
10959        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));
10960        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));
10961        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));
10962        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));
10963        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));
10964        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));
10965        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));
10966        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));
10967        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));
10968        children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
10969        children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
10970        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));
10971      }
10972
10973      @Override
10974      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10975        switch (_hash) {
10976        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);
10977        case 116079: /*url*/  return new Property("url", "uri", "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url);
10978        case 351608024: /*version*/  return new Property("version", "string", "An edition identifier used for business purposes to label business significant variants.", 0, 1, version);
10979        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
10980        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);
10981        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);
10982        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);
10983        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);
10984        case -1179159893: /*issued*/  return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
10985        case -793235316: /*applies*/  return new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
10986        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);
10987        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);
10988        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);
10989        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);
10990        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);
10991        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);
10992        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);
10993        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);
10994        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);
10995        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);
10996        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);
10997        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);
10998        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);
10999        case 777778802: /*topicCodeableConcept*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11000        case -343345444: /*topicReference*/  return new Property("topic[x]", "CodeableConcept|Reference(Any)", "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1, topic);
11001        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);
11002        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);
11003        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);
11004        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);
11005        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);
11006        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);
11007        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);
11008        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);
11009        case 102851257: /*legal*/  return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal);
11010        case 3512060: /*rule*/  return new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule);
11011        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);
11012        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);
11013        case 344057890: /*legallyBindingAttachment*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
11014        case -296528788: /*legallyBindingReference*/  return new Property("legallyBinding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, 1, legallyBinding);
11015        default: return super.getNamedProperty(_hash, _name, _checkValid);
11016        }
11017
11018      }
11019
11020      @Override
11021      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11022        switch (hash) {
11023        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
11024        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
11025        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
11026        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractStatus>
11027        case 568606040: /*legalState*/ return this.legalState == null ? new Base[0] : new Base[] {this.legalState}; // CodeableConcept
11028        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : new Base[] {this.instantiatesCanonical}; // Reference
11029        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : new Base[] {this.instantiatesUri}; // UriType
11030        case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
11031        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
11032        case -793235316: /*applies*/ return this.applies == null ? new Base[0] : new Base[] {this.applies}; // Period
11033        case -668311927: /*expirationType*/ return this.expirationType == null ? new Base[0] : new Base[] {this.expirationType}; // CodeableConcept
11034        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
11035        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : this.authority.toArray(new Base[this.authority.size()]); // Reference
11036        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
11037        case 3530567: /*site*/ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
11038        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11039        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
11040        case -2060497896: /*subtitle*/ return this.subtitle == null ? new Base[0] : new Base[] {this.subtitle}; // StringType
11041        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
11042        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
11043        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
11044        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : new Base[] {this.topic}; // Type
11045        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11046        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
11047        case 247055020: /*contentDefinition*/ return this.contentDefinition == null ? new Base[0] : new Base[] {this.contentDefinition}; // ContentDefinitionComponent
11048        case 3556460: /*term*/ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
11049        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
11050        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
11051        case -902467798: /*signer*/ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
11052        case -1423054677: /*friendly*/ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
11053        case 102851257: /*legal*/ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
11054        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
11055        case -126751329: /*legallyBinding*/ return this.legallyBinding == null ? new Base[0] : new Base[] {this.legallyBinding}; // Type
11056        default: return super.getProperty(hash, name, checkValid);
11057        }
11058
11059      }
11060
11061      @Override
11062      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11063        switch (hash) {
11064        case -1618432855: // identifier
11065          this.getIdentifier().add(castToIdentifier(value)); // Identifier
11066          return value;
11067        case 116079: // url
11068          this.url = castToUri(value); // UriType
11069          return value;
11070        case 351608024: // version
11071          this.version = castToString(value); // StringType
11072          return value;
11073        case -892481550: // status
11074          value = new ContractStatusEnumFactory().fromType(castToCode(value));
11075          this.status = (Enumeration) value; // Enumeration<ContractStatus>
11076          return value;
11077        case 568606040: // legalState
11078          this.legalState = castToCodeableConcept(value); // CodeableConcept
11079          return value;
11080        case 8911915: // instantiatesCanonical
11081          this.instantiatesCanonical = castToReference(value); // Reference
11082          return value;
11083        case -1926393373: // instantiatesUri
11084          this.instantiatesUri = castToUri(value); // UriType
11085          return value;
11086        case -92412192: // contentDerivative
11087          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
11088          return value;
11089        case -1179159893: // issued
11090          this.issued = castToDateTime(value); // DateTimeType
11091          return value;
11092        case -793235316: // applies
11093          this.applies = castToPeriod(value); // Period
11094          return value;
11095        case -668311927: // expirationType
11096          this.expirationType = castToCodeableConcept(value); // CodeableConcept
11097          return value;
11098        case -1867885268: // subject
11099          this.getSubject().add(castToReference(value)); // Reference
11100          return value;
11101        case 1475610435: // authority
11102          this.getAuthority().add(castToReference(value)); // Reference
11103          return value;
11104        case -1326197564: // domain
11105          this.getDomain().add(castToReference(value)); // Reference
11106          return value;
11107        case 3530567: // site
11108          this.getSite().add(castToReference(value)); // Reference
11109          return value;
11110        case 3373707: // name
11111          this.name = castToString(value); // StringType
11112          return value;
11113        case 110371416: // title
11114          this.title = castToString(value); // StringType
11115          return value;
11116        case -2060497896: // subtitle
11117          this.subtitle = castToString(value); // StringType
11118          return value;
11119        case 92902992: // alias
11120          this.getAlias().add(castToString(value)); // StringType
11121          return value;
11122        case -1406328437: // author
11123          this.author = castToReference(value); // Reference
11124          return value;
11125        case 109264468: // scope
11126          this.scope = castToCodeableConcept(value); // CodeableConcept
11127          return value;
11128        case 110546223: // topic
11129          this.topic = castToType(value); // Type
11130          return value;
11131        case 3575610: // type
11132          this.type = castToCodeableConcept(value); // CodeableConcept
11133          return value;
11134        case -1868521062: // subType
11135          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
11136          return value;
11137        case 247055020: // contentDefinition
11138          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
11139          return value;
11140        case 3556460: // term
11141          this.getTerm().add((TermComponent) value); // TermComponent
11142          return value;
11143        case 1922406657: // supportingInfo
11144          this.getSupportingInfo().add(castToReference(value)); // Reference
11145          return value;
11146        case 1538891575: // relevantHistory
11147          this.getRelevantHistory().add(castToReference(value)); // Reference
11148          return value;
11149        case -902467798: // signer
11150          this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
11151          return value;
11152        case -1423054677: // friendly
11153          this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
11154          return value;
11155        case 102851257: // legal
11156          this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
11157          return value;
11158        case 3512060: // rule
11159          this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
11160          return value;
11161        case -126751329: // legallyBinding
11162          this.legallyBinding = castToType(value); // Type
11163          return value;
11164        default: return super.setProperty(hash, name, value);
11165        }
11166
11167      }
11168
11169      @Override
11170      public Base setProperty(String name, Base value) throws FHIRException {
11171        if (name.equals("identifier")) {
11172          this.getIdentifier().add(castToIdentifier(value));
11173        } else if (name.equals("url")) {
11174          this.url = castToUri(value); // UriType
11175        } else if (name.equals("version")) {
11176          this.version = castToString(value); // StringType
11177        } else if (name.equals("status")) {
11178          value = new ContractStatusEnumFactory().fromType(castToCode(value));
11179          this.status = (Enumeration) value; // Enumeration<ContractStatus>
11180        } else if (name.equals("legalState")) {
11181          this.legalState = castToCodeableConcept(value); // CodeableConcept
11182        } else if (name.equals("instantiatesCanonical")) {
11183          this.instantiatesCanonical = castToReference(value); // Reference
11184        } else if (name.equals("instantiatesUri")) {
11185          this.instantiatesUri = castToUri(value); // UriType
11186        } else if (name.equals("contentDerivative")) {
11187          this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
11188        } else if (name.equals("issued")) {
11189          this.issued = castToDateTime(value); // DateTimeType
11190        } else if (name.equals("applies")) {
11191          this.applies = castToPeriod(value); // Period
11192        } else if (name.equals("expirationType")) {
11193          this.expirationType = castToCodeableConcept(value); // CodeableConcept
11194        } else if (name.equals("subject")) {
11195          this.getSubject().add(castToReference(value));
11196        } else if (name.equals("authority")) {
11197          this.getAuthority().add(castToReference(value));
11198        } else if (name.equals("domain")) {
11199          this.getDomain().add(castToReference(value));
11200        } else if (name.equals("site")) {
11201          this.getSite().add(castToReference(value));
11202        } else if (name.equals("name")) {
11203          this.name = castToString(value); // StringType
11204        } else if (name.equals("title")) {
11205          this.title = castToString(value); // StringType
11206        } else if (name.equals("subtitle")) {
11207          this.subtitle = castToString(value); // StringType
11208        } else if (name.equals("alias")) {
11209          this.getAlias().add(castToString(value));
11210        } else if (name.equals("author")) {
11211          this.author = castToReference(value); // Reference
11212        } else if (name.equals("scope")) {
11213          this.scope = castToCodeableConcept(value); // CodeableConcept
11214        } else if (name.equals("topic[x]")) {
11215          this.topic = castToType(value); // Type
11216        } else if (name.equals("type")) {
11217          this.type = castToCodeableConcept(value); // CodeableConcept
11218        } else if (name.equals("subType")) {
11219          this.getSubType().add(castToCodeableConcept(value));
11220        } else if (name.equals("contentDefinition")) {
11221          this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
11222        } else if (name.equals("term")) {
11223          this.getTerm().add((TermComponent) value);
11224        } else if (name.equals("supportingInfo")) {
11225          this.getSupportingInfo().add(castToReference(value));
11226        } else if (name.equals("relevantHistory")) {
11227          this.getRelevantHistory().add(castToReference(value));
11228        } else if (name.equals("signer")) {
11229          this.getSigner().add((SignatoryComponent) value);
11230        } else if (name.equals("friendly")) {
11231          this.getFriendly().add((FriendlyLanguageComponent) value);
11232        } else if (name.equals("legal")) {
11233          this.getLegal().add((LegalLanguageComponent) value);
11234        } else if (name.equals("rule")) {
11235          this.getRule().add((ComputableLanguageComponent) value);
11236        } else if (name.equals("legallyBinding[x]")) {
11237          this.legallyBinding = castToType(value); // Type
11238        } else
11239          return super.setProperty(name, value);
11240        return value;
11241      }
11242
11243      @Override
11244      public Base makeProperty(int hash, String name) throws FHIRException {
11245        switch (hash) {
11246        case -1618432855:  return addIdentifier(); 
11247        case 116079:  return getUrlElement();
11248        case 351608024:  return getVersionElement();
11249        case -892481550:  return getStatusElement();
11250        case 568606040:  return getLegalState();
11251        case 8911915:  return getInstantiatesCanonical();
11252        case -1926393373:  return getInstantiatesUriElement();
11253        case -92412192:  return getContentDerivative();
11254        case -1179159893:  return getIssuedElement();
11255        case -793235316:  return getApplies();
11256        case -668311927:  return getExpirationType();
11257        case -1867885268:  return addSubject(); 
11258        case 1475610435:  return addAuthority(); 
11259        case -1326197564:  return addDomain(); 
11260        case 3530567:  return addSite(); 
11261        case 3373707:  return getNameElement();
11262        case 110371416:  return getTitleElement();
11263        case -2060497896:  return getSubtitleElement();
11264        case 92902992:  return addAliasElement();
11265        case -1406328437:  return getAuthor();
11266        case 109264468:  return getScope();
11267        case -957295375:  return getTopic();
11268        case 110546223:  return getTopic();
11269        case 3575610:  return getType();
11270        case -1868521062:  return addSubType(); 
11271        case 247055020:  return getContentDefinition();
11272        case 3556460:  return addTerm(); 
11273        case 1922406657:  return addSupportingInfo(); 
11274        case 1538891575:  return addRelevantHistory(); 
11275        case -902467798:  return addSigner(); 
11276        case -1423054677:  return addFriendly(); 
11277        case 102851257:  return addLegal(); 
11278        case 3512060:  return addRule(); 
11279        case -772497791:  return getLegallyBinding();
11280        case -126751329:  return getLegallyBinding();
11281        default: return super.makeProperty(hash, name);
11282        }
11283
11284      }
11285
11286      @Override
11287      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11288        switch (hash) {
11289        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11290        case 116079: /*url*/ return new String[] {"uri"};
11291        case 351608024: /*version*/ return new String[] {"string"};
11292        case -892481550: /*status*/ return new String[] {"code"};
11293        case 568606040: /*legalState*/ return new String[] {"CodeableConcept"};
11294        case 8911915: /*instantiatesCanonical*/ return new String[] {"Reference"};
11295        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
11296        case -92412192: /*contentDerivative*/ return new String[] {"CodeableConcept"};
11297        case -1179159893: /*issued*/ return new String[] {"dateTime"};
11298        case -793235316: /*applies*/ return new String[] {"Period"};
11299        case -668311927: /*expirationType*/ return new String[] {"CodeableConcept"};
11300        case -1867885268: /*subject*/ return new String[] {"Reference"};
11301        case 1475610435: /*authority*/ return new String[] {"Reference"};
11302        case -1326197564: /*domain*/ return new String[] {"Reference"};
11303        case 3530567: /*site*/ return new String[] {"Reference"};
11304        case 3373707: /*name*/ return new String[] {"string"};
11305        case 110371416: /*title*/ return new String[] {"string"};
11306        case -2060497896: /*subtitle*/ return new String[] {"string"};
11307        case 92902992: /*alias*/ return new String[] {"string"};
11308        case -1406328437: /*author*/ return new String[] {"Reference"};
11309        case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
11310        case 110546223: /*topic*/ return new String[] {"CodeableConcept", "Reference"};
11311        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11312        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
11313        case 247055020: /*contentDefinition*/ return new String[] {};
11314        case 3556460: /*term*/ return new String[] {};
11315        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
11316        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
11317        case -902467798: /*signer*/ return new String[] {};
11318        case -1423054677: /*friendly*/ return new String[] {};
11319        case 102851257: /*legal*/ return new String[] {};
11320        case 3512060: /*rule*/ return new String[] {};
11321        case -126751329: /*legallyBinding*/ return new String[] {"Attachment", "Reference"};
11322        default: return super.getTypesForProperty(hash, name);
11323        }
11324
11325      }
11326
11327      @Override
11328      public Base addChild(String name) throws FHIRException {
11329        if (name.equals("identifier")) {
11330          return addIdentifier();
11331        }
11332        else if (name.equals("url")) {
11333          throw new FHIRException("Cannot call addChild on a primitive type Contract.url");
11334        }
11335        else if (name.equals("version")) {
11336          throw new FHIRException("Cannot call addChild on a primitive type Contract.version");
11337        }
11338        else if (name.equals("status")) {
11339          throw new FHIRException("Cannot call addChild on a primitive type Contract.status");
11340        }
11341        else if (name.equals("legalState")) {
11342          this.legalState = new CodeableConcept();
11343          return this.legalState;
11344        }
11345        else if (name.equals("instantiatesCanonical")) {
11346          this.instantiatesCanonical = new Reference();
11347          return this.instantiatesCanonical;
11348        }
11349        else if (name.equals("instantiatesUri")) {
11350          throw new FHIRException("Cannot call addChild on a primitive type Contract.instantiatesUri");
11351        }
11352        else if (name.equals("contentDerivative")) {
11353          this.contentDerivative = new CodeableConcept();
11354          return this.contentDerivative;
11355        }
11356        else if (name.equals("issued")) {
11357          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
11358        }
11359        else if (name.equals("applies")) {
11360          this.applies = new Period();
11361          return this.applies;
11362        }
11363        else if (name.equals("expirationType")) {
11364          this.expirationType = new CodeableConcept();
11365          return this.expirationType;
11366        }
11367        else if (name.equals("subject")) {
11368          return addSubject();
11369        }
11370        else if (name.equals("authority")) {
11371          return addAuthority();
11372        }
11373        else if (name.equals("domain")) {
11374          return addDomain();
11375        }
11376        else if (name.equals("site")) {
11377          return addSite();
11378        }
11379        else if (name.equals("name")) {
11380          throw new FHIRException("Cannot call addChild on a primitive type Contract.name");
11381        }
11382        else if (name.equals("title")) {
11383          throw new FHIRException("Cannot call addChild on a primitive type Contract.title");
11384        }
11385        else if (name.equals("subtitle")) {
11386          throw new FHIRException("Cannot call addChild on a primitive type Contract.subtitle");
11387        }
11388        else if (name.equals("alias")) {
11389          throw new FHIRException("Cannot call addChild on a primitive type Contract.alias");
11390        }
11391        else if (name.equals("author")) {
11392          this.author = new Reference();
11393          return this.author;
11394        }
11395        else if (name.equals("scope")) {
11396          this.scope = new CodeableConcept();
11397          return this.scope;
11398        }
11399        else if (name.equals("topicCodeableConcept")) {
11400          this.topic = new CodeableConcept();
11401          return this.topic;
11402        }
11403        else if (name.equals("topicReference")) {
11404          this.topic = new Reference();
11405          return this.topic;
11406        }
11407        else if (name.equals("type")) {
11408          this.type = new CodeableConcept();
11409          return this.type;
11410        }
11411        else if (name.equals("subType")) {
11412          return addSubType();
11413        }
11414        else if (name.equals("contentDefinition")) {
11415          this.contentDefinition = new ContentDefinitionComponent();
11416          return this.contentDefinition;
11417        }
11418        else if (name.equals("term")) {
11419          return addTerm();
11420        }
11421        else if (name.equals("supportingInfo")) {
11422          return addSupportingInfo();
11423        }
11424        else if (name.equals("relevantHistory")) {
11425          return addRelevantHistory();
11426        }
11427        else if (name.equals("signer")) {
11428          return addSigner();
11429        }
11430        else if (name.equals("friendly")) {
11431          return addFriendly();
11432        }
11433        else if (name.equals("legal")) {
11434          return addLegal();
11435        }
11436        else if (name.equals("rule")) {
11437          return addRule();
11438        }
11439        else if (name.equals("legallyBindingAttachment")) {
11440          this.legallyBinding = new Attachment();
11441          return this.legallyBinding;
11442        }
11443        else if (name.equals("legallyBindingReference")) {
11444          this.legallyBinding = new Reference();
11445          return this.legallyBinding;
11446        }
11447        else
11448          return super.addChild(name);
11449      }
11450
11451  public String fhirType() {
11452    return "Contract";
11453
11454  }
11455
11456      public Contract copy() {
11457        Contract dst = new Contract();
11458        copyValues(dst);
11459        return dst;
11460      }
11461
11462      public void copyValues(Contract dst) {
11463        super.copyValues(dst);
11464        if (identifier != null) {
11465          dst.identifier = new ArrayList<Identifier>();
11466          for (Identifier i : identifier)
11467            dst.identifier.add(i.copy());
11468        };
11469        dst.url = url == null ? null : url.copy();
11470        dst.version = version == null ? null : version.copy();
11471        dst.status = status == null ? null : status.copy();
11472        dst.legalState = legalState == null ? null : legalState.copy();
11473        dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
11474        dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
11475        dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
11476        dst.issued = issued == null ? null : issued.copy();
11477        dst.applies = applies == null ? null : applies.copy();
11478        dst.expirationType = expirationType == null ? null : expirationType.copy();
11479        if (subject != null) {
11480          dst.subject = new ArrayList<Reference>();
11481          for (Reference i : subject)
11482            dst.subject.add(i.copy());
11483        };
11484        if (authority != null) {
11485          dst.authority = new ArrayList<Reference>();
11486          for (Reference i : authority)
11487            dst.authority.add(i.copy());
11488        };
11489        if (domain != null) {
11490          dst.domain = new ArrayList<Reference>();
11491          for (Reference i : domain)
11492            dst.domain.add(i.copy());
11493        };
11494        if (site != null) {
11495          dst.site = new ArrayList<Reference>();
11496          for (Reference i : site)
11497            dst.site.add(i.copy());
11498        };
11499        dst.name = name == null ? null : name.copy();
11500        dst.title = title == null ? null : title.copy();
11501        dst.subtitle = subtitle == null ? null : subtitle.copy();
11502        if (alias != null) {
11503          dst.alias = new ArrayList<StringType>();
11504          for (StringType i : alias)
11505            dst.alias.add(i.copy());
11506        };
11507        dst.author = author == null ? null : author.copy();
11508        dst.scope = scope == null ? null : scope.copy();
11509        dst.topic = topic == null ? null : topic.copy();
11510        dst.type = type == null ? null : type.copy();
11511        if (subType != null) {
11512          dst.subType = new ArrayList<CodeableConcept>();
11513          for (CodeableConcept i : subType)
11514            dst.subType.add(i.copy());
11515        };
11516        dst.contentDefinition = contentDefinition == null ? null : contentDefinition.copy();
11517        if (term != null) {
11518          dst.term = new ArrayList<TermComponent>();
11519          for (TermComponent i : term)
11520            dst.term.add(i.copy());
11521        };
11522        if (supportingInfo != null) {
11523          dst.supportingInfo = new ArrayList<Reference>();
11524          for (Reference i : supportingInfo)
11525            dst.supportingInfo.add(i.copy());
11526        };
11527        if (relevantHistory != null) {
11528          dst.relevantHistory = new ArrayList<Reference>();
11529          for (Reference i : relevantHistory)
11530            dst.relevantHistory.add(i.copy());
11531        };
11532        if (signer != null) {
11533          dst.signer = new ArrayList<SignatoryComponent>();
11534          for (SignatoryComponent i : signer)
11535            dst.signer.add(i.copy());
11536        };
11537        if (friendly != null) {
11538          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
11539          for (FriendlyLanguageComponent i : friendly)
11540            dst.friendly.add(i.copy());
11541        };
11542        if (legal != null) {
11543          dst.legal = new ArrayList<LegalLanguageComponent>();
11544          for (LegalLanguageComponent i : legal)
11545            dst.legal.add(i.copy());
11546        };
11547        if (rule != null) {
11548          dst.rule = new ArrayList<ComputableLanguageComponent>();
11549          for (ComputableLanguageComponent i : rule)
11550            dst.rule.add(i.copy());
11551        };
11552        dst.legallyBinding = legallyBinding == null ? null : legallyBinding.copy();
11553      }
11554
11555      protected Contract typedCopy() {
11556        return copy();
11557      }
11558
11559      @Override
11560      public boolean equalsDeep(Base other_) {
11561        if (!super.equalsDeep(other_))
11562          return false;
11563        if (!(other_ instanceof Contract))
11564          return false;
11565        Contract o = (Contract) other_;
11566        return compareDeep(identifier, o.identifier, true) && compareDeep(url, o.url, true) && compareDeep(version, o.version, true)
11567           && compareDeep(status, o.status, true) && compareDeep(legalState, o.legalState, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
11568           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(contentDerivative, o.contentDerivative, true)
11569           && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true) && compareDeep(expirationType, o.expirationType, true)
11570           && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true)
11571           && compareDeep(site, o.site, true) && compareDeep(name, o.name, true) && compareDeep(title, o.title, true)
11572           && compareDeep(subtitle, o.subtitle, true) && compareDeep(alias, o.alias, true) && compareDeep(author, o.author, true)
11573           && compareDeep(scope, o.scope, true) && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true)
11574           && compareDeep(subType, o.subType, true) && compareDeep(contentDefinition, o.contentDefinition, true)
11575           && compareDeep(term, o.term, true) && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(relevantHistory, o.relevantHistory, true)
11576           && compareDeep(signer, o.signer, true) && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true)
11577           && compareDeep(rule, o.rule, true) && compareDeep(legallyBinding, o.legallyBinding, true);
11578      }
11579
11580      @Override
11581      public boolean equalsShallow(Base other_) {
11582        if (!super.equalsShallow(other_))
11583          return false;
11584        if (!(other_ instanceof Contract))
11585          return false;
11586        Contract o = (Contract) other_;
11587        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(status, o.status, true)
11588           && compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(issued, o.issued, true)
11589           && compareValues(name, o.name, true) && compareValues(title, o.title, true) && compareValues(subtitle, o.subtitle, true)
11590           && compareValues(alias, o.alias, true);
11591      }
11592
11593      public boolean isEmpty() {
11594        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, url, version
11595          , status, legalState, instantiatesCanonical, instantiatesUri, contentDerivative, issued
11596          , applies, expirationType, subject, authority, domain, site, name, title, subtitle
11597          , alias, author, scope, topic, type, subType, contentDefinition, term, supportingInfo
11598          , relevantHistory, signer, friendly, legal, rule, legallyBinding);
11599      }
11600
11601  @Override
11602  public ResourceType getResourceType() {
11603    return ResourceType.Contract;
11604   }
11605
11606 /**
11607   * Search parameter: <b>identifier</b>
11608   * <p>
11609   * Description: <b>The identity of the contract</b><br>
11610   * Type: <b>token</b><br>
11611   * Path: <b>Contract.identifier</b><br>
11612   * </p>
11613   */
11614  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
11615  public static final String SP_IDENTIFIER = "identifier";
11616 /**
11617   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
11618   * <p>
11619   * Description: <b>The identity of the contract</b><br>
11620   * Type: <b>token</b><br>
11621   * Path: <b>Contract.identifier</b><br>
11622   * </p>
11623   */
11624  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
11625
11626 /**
11627   * Search parameter: <b>instantiates</b>
11628   * <p>
11629   * Description: <b>A source definition of the contract</b><br>
11630   * Type: <b>uri</b><br>
11631   * Path: <b>Contract.instantiatesUri</b><br>
11632   * </p>
11633   */
11634  @SearchParamDefinition(name="instantiates", path="Contract.instantiatesUri", description="A source definition of the contract", type="uri" )
11635  public static final String SP_INSTANTIATES = "instantiates";
11636 /**
11637   * <b>Fluent Client</b> search parameter constant for <b>instantiates</b>
11638   * <p>
11639   * Description: <b>A source definition of the contract</b><br>
11640   * Type: <b>uri</b><br>
11641   * Path: <b>Contract.instantiatesUri</b><br>
11642   * </p>
11643   */
11644  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES);
11645
11646 /**
11647   * Search parameter: <b>patient</b>
11648   * <p>
11649   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
11650   * Type: <b>reference</b><br>
11651   * Path: <b>Contract.subject</b><br>
11652   * </p>
11653   */
11654  @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 } )
11655  public static final String SP_PATIENT = "patient";
11656 /**
11657   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
11658   * <p>
11659   * Description: <b>The identity of the subject of the contract (if a patient)</b><br>
11660   * Type: <b>reference</b><br>
11661   * Path: <b>Contract.subject</b><br>
11662   * </p>
11663   */
11664  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
11665
11666/**
11667   * Constant for fluent queries to be used to add include statements. Specifies
11668   * the path value of "<b>Contract:patient</b>".
11669   */
11670  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Contract:patient").toLocked();
11671
11672 /**
11673   * Search parameter: <b>subject</b>
11674   * <p>
11675   * Description: <b>The identity of the subject of the contract</b><br>
11676   * Type: <b>reference</b><br>
11677   * Path: <b>Contract.subject</b><br>
11678   * </p>
11679   */
11680  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the subject of the contract", type="reference" )
11681  public static final String SP_SUBJECT = "subject";
11682 /**
11683   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
11684   * <p>
11685   * Description: <b>The identity of the subject of the contract</b><br>
11686   * Type: <b>reference</b><br>
11687   * Path: <b>Contract.subject</b><br>
11688   * </p>
11689   */
11690  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
11691
11692/**
11693   * Constant for fluent queries to be used to add include statements. Specifies
11694   * the path value of "<b>Contract:subject</b>".
11695   */
11696  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Contract:subject").toLocked();
11697
11698 /**
11699   * Search parameter: <b>authority</b>
11700   * <p>
11701   * Description: <b>The authority of the contract</b><br>
11702   * Type: <b>reference</b><br>
11703   * Path: <b>Contract.authority</b><br>
11704   * </p>
11705   */
11706  @SearchParamDefinition(name="authority", path="Contract.authority", description="The authority of the contract", type="reference", target={Organization.class } )
11707  public static final String SP_AUTHORITY = "authority";
11708 /**
11709   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
11710   * <p>
11711   * Description: <b>The authority of the contract</b><br>
11712   * Type: <b>reference</b><br>
11713   * Path: <b>Contract.authority</b><br>
11714   * </p>
11715   */
11716  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHORITY);
11717
11718/**
11719   * Constant for fluent queries to be used to add include statements. Specifies
11720   * the path value of "<b>Contract:authority</b>".
11721   */
11722  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include("Contract:authority").toLocked();
11723
11724 /**
11725   * Search parameter: <b>domain</b>
11726   * <p>
11727   * Description: <b>The domain of the contract</b><br>
11728   * Type: <b>reference</b><br>
11729   * Path: <b>Contract.domain</b><br>
11730   * </p>
11731   */
11732  @SearchParamDefinition(name="domain", path="Contract.domain", description="The domain of the contract", type="reference", target={Location.class } )
11733  public static final String SP_DOMAIN = "domain";
11734 /**
11735   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
11736   * <p>
11737   * Description: <b>The domain of the contract</b><br>
11738   * Type: <b>reference</b><br>
11739   * Path: <b>Contract.domain</b><br>
11740   * </p>
11741   */
11742  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DOMAIN);
11743
11744/**
11745   * Constant for fluent queries to be used to add include statements. Specifies
11746   * the path value of "<b>Contract:domain</b>".
11747   */
11748  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include("Contract:domain").toLocked();
11749
11750 /**
11751   * Search parameter: <b>issued</b>
11752   * <p>
11753   * Description: <b>The date/time the contract was issued</b><br>
11754   * Type: <b>date</b><br>
11755   * Path: <b>Contract.issued</b><br>
11756   * </p>
11757   */
11758  @SearchParamDefinition(name="issued", path="Contract.issued", description="The date/time the contract was issued", type="date" )
11759  public static final String SP_ISSUED = "issued";
11760 /**
11761   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
11762   * <p>
11763   * Description: <b>The date/time the contract was issued</b><br>
11764   * Type: <b>date</b><br>
11765   * Path: <b>Contract.issued</b><br>
11766   * </p>
11767   */
11768  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ISSUED);
11769
11770 /**
11771   * Search parameter: <b>url</b>
11772   * <p>
11773   * Description: <b>The basal contract definition</b><br>
11774   * Type: <b>uri</b><br>
11775   * Path: <b>Contract.url</b><br>
11776   * </p>
11777   */
11778  @SearchParamDefinition(name="url", path="Contract.url", description="The basal contract definition", type="uri" )
11779  public static final String SP_URL = "url";
11780 /**
11781   * <b>Fluent Client</b> search parameter constant for <b>url</b>
11782   * <p>
11783   * Description: <b>The basal contract definition</b><br>
11784   * Type: <b>uri</b><br>
11785   * Path: <b>Contract.url</b><br>
11786   * </p>
11787   */
11788  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
11789
11790 /**
11791   * Search parameter: <b>signer</b>
11792   * <p>
11793   * Description: <b>Contract Signatory Party</b><br>
11794   * Type: <b>reference</b><br>
11795   * Path: <b>Contract.signer.party</b><br>
11796   * </p>
11797   */
11798  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference", target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
11799  public static final String SP_SIGNER = "signer";
11800 /**
11801   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
11802   * <p>
11803   * Description: <b>Contract Signatory Party</b><br>
11804   * Type: <b>reference</b><br>
11805   * Path: <b>Contract.signer.party</b><br>
11806   * </p>
11807   */
11808  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SIGNER);
11809
11810/**
11811   * Constant for fluent queries to be used to add include statements. Specifies
11812   * the path value of "<b>Contract:signer</b>".
11813   */
11814  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include("Contract:signer").toLocked();
11815
11816 /**
11817   * Search parameter: <b>status</b>
11818   * <p>
11819   * Description: <b>The status of the contract</b><br>
11820   * Type: <b>token</b><br>
11821   * Path: <b>Contract.status</b><br>
11822   * </p>
11823   */
11824  @SearchParamDefinition(name="status", path="Contract.status", description="The status of the contract", type="token" )
11825  public static final String SP_STATUS = "status";
11826 /**
11827   * <b>Fluent Client</b> search parameter constant for <b>status</b>
11828   * <p>
11829   * Description: <b>The status of the contract</b><br>
11830   * Type: <b>token</b><br>
11831   * Path: <b>Contract.status</b><br>
11832   * </p>
11833   */
11834  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
11835
11836
11837}
11838