001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * Legally enforceable, formally recorded unilateral or bilateral directive
051 * i.e., a policy or agreement.
052 */
053@ResourceDef(name = "Contract", profile = "http://hl7.org/fhir/StructureDefinition/Contract")
054public class Contract extends DomainResource {
055
056  public enum ContractStatus {
057    /**
058     * Contract is augmented with additional information to correct errors in a
059     * predecessor or to updated values in a predecessor. Usage: Contract altered
060     * within effective time. Precedence Order = 9. Comparable FHIR and v.3 status
061     * codes: revised; replaced.
062     */
063    AMENDED,
064    /**
065     * Contract is augmented with additional information that was missing from a
066     * predecessor Contract. Usage: Contract altered within effective time.
067     * Precedence Order = 9. Comparable FHIR and v.3 status codes: updated,
068     * replaced.
069     */
070    APPENDED,
071    /**
072     * Contract is terminated due to failure of the Grantor and/or the Grantee to
073     * fulfil one or more contract provisions. Usage: Abnormal contract termination.
074     * Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed;
075     * aborted.
076     */
077    CANCELLED,
078    /**
079     * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil
080     * contract provision(s). E.g., Grantee complaint about Grantor's failure to
081     * comply with contract provisions. Usage: Contract pended. Precedence Order =
082     * 7. Comparable FHIR and v.3 status codes: on hold; pended; suspended.
083     */
084    DISPUTED,
085    /**
086     * Contract was created in error. No Precedence Order. Status may be applied to
087     * a Contract with any status.
088     */
089    ENTEREDINERROR,
090    /**
091     * Contract execution pending; may be executed when either the Grantor or the
092     * Grantee accepts the contract provisions by signing. I.e., where either the
093     * Grantor or the Grantee has signed, but not both. E.g., when an insurance
094     * applicant signs the insurers application, which references the policy. Usage:
095     * Optional first step of contract execution activity. May be skipped and
096     * contracting activity moves directly to executed state. Precedence Order = 3.
097     * Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended;
098     * active.
099     */
100    EXECUTABLE,
101    /**
102     * Contract is activated for period stipulated when both the Grantor and Grantee
103     * have signed it. Usage: Required state for normal completion of contracting
104     * activity. Precedence Order = 6. Comparable FHIR and v.3 status codes:
105     * accepted; completed.
106     */
107    EXECUTED,
108    /**
109     * Contract execution is suspended while either or both the Grantor and Grantee
110     * propose and consider new or revised contract provisions. I.e., where the
111     * party which has not signed proposes changes to the terms. E .g., a life
112     * insurer declines to agree to the signed application because the life insurer
113     * has evidence that the applicant, who asserted to being younger or a
114     * non-smoker to get a lower premium rate - but offers instead to agree to a
115     * higher premium based on the applicants actual age or smoking status. Usage:
116     * Optional contract activity between executable and executed state. Precedence
117     * Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
118     */
119    NEGOTIABLE,
120    /**
121     * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract
122     * hard copy or electronic 'template', 'form' or 'application'. E.g., health
123     * insurance application; consent directive form. Usage: Beginning of contract
124     * negotiation, which may have been completed as a precondition because used for
125     * 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes:
126     * requested; new.
127     */
128    OFFERED,
129    /**
130     * Contract template is available as the basis for an application or offer by
131     * the Grantor or Grantee. E.g., health insurance policy; consent directive
132     * policy. Usage: Required initial contract activity, which may have been
133     * completed as a precondition because used for 0..* contracts. Precedence Order
134     * = 1. Comparable FHIR and v.3 status codes: proposed; intended.
135     */
136    POLICY,
137    /**
138     * Execution of the Contract is not completed because either or both the Grantor
139     * and Grantee decline to accept some or all of the contract provisions. Usage:
140     * Optional contract activity between executable and abnormal termination.
141     * Precedence Order = 5. Comparable FHIR and v.3 status codes: stopped;
142     * cancelled.
143     */
144    REJECTED,
145    /**
146     * Beginning of a successor Contract at the termination of predecessor Contract
147     * lifecycle. Usage: Follows termination of a preceding Contract that has
148     * reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3
149     * status codes: superseded.
150     */
151    RENEWED,
152    /**
153     * A Contract that is rescinded. May be required prior to replacing with an
154     * updated Contract. Comparable FHIR and v.3 status codes: nullified.
155     */
156    REVOKED,
157    /**
158     * Contract is reactivated after being pended because of faulty execution.
159     * *E.g., competency of the signer(s), or where the policy is substantially
160     * different from and did not accompany the application/form so that the
161     * applicant could not compare them. Aka - ''reactivated''. Usage: Optional
162     * stage where a pended contract is reactivated. Precedence Order = 8.
163     * Comparable FHIR and v.3 status codes: reactivated.
164     */
165    RESOLVED,
166    /**
167     * Contract reaches its expiry date. It might or might not be renewed or
168     * renegotiated. Usage: Normal end of contract period. Precedence Order = 12.
169     * Comparable FHIR and v.3 status codes: Obsoleted.
170     */
171    TERMINATED,
172    /**
173     * added to help the parsers with the generic types
174     */
175    NULL;
176
177    public static ContractStatus fromCode(String codeString) throws FHIRException {
178      if (codeString == null || "".equals(codeString))
179        return null;
180      if ("amended".equals(codeString))
181        return AMENDED;
182      if ("appended".equals(codeString))
183        return APPENDED;
184      if ("cancelled".equals(codeString))
185        return CANCELLED;
186      if ("disputed".equals(codeString))
187        return DISPUTED;
188      if ("entered-in-error".equals(codeString))
189        return ENTEREDINERROR;
190      if ("executable".equals(codeString))
191        return EXECUTABLE;
192      if ("executed".equals(codeString))
193        return EXECUTED;
194      if ("negotiable".equals(codeString))
195        return NEGOTIABLE;
196      if ("offered".equals(codeString))
197        return OFFERED;
198      if ("policy".equals(codeString))
199        return POLICY;
200      if ("rejected".equals(codeString))
201        return REJECTED;
202      if ("renewed".equals(codeString))
203        return RENEWED;
204      if ("revoked".equals(codeString))
205        return REVOKED;
206      if ("resolved".equals(codeString))
207        return RESOLVED;
208      if ("terminated".equals(codeString))
209        return TERMINATED;
210      if (Configuration.isAcceptInvalidEnums())
211        return null;
212      else
213        throw new FHIRException("Unknown ContractStatus code '" + codeString + "'");
214    }
215
216    public String toCode() {
217      switch (this) {
218      case AMENDED:
219        return "amended";
220      case APPENDED:
221        return "appended";
222      case CANCELLED:
223        return "cancelled";
224      case DISPUTED:
225        return "disputed";
226      case ENTEREDINERROR:
227        return "entered-in-error";
228      case EXECUTABLE:
229        return "executable";
230      case EXECUTED:
231        return "executed";
232      case NEGOTIABLE:
233        return "negotiable";
234      case OFFERED:
235        return "offered";
236      case POLICY:
237        return "policy";
238      case REJECTED:
239        return "rejected";
240      case RENEWED:
241        return "renewed";
242      case REVOKED:
243        return "revoked";
244      case RESOLVED:
245        return "resolved";
246      case TERMINATED:
247        return "terminated";
248      case NULL:
249        return null;
250      default:
251        return "?";
252      }
253    }
254
255    public String getSystem() {
256      switch (this) {
257      case AMENDED:
258        return "http://hl7.org/fhir/contract-status";
259      case APPENDED:
260        return "http://hl7.org/fhir/contract-status";
261      case CANCELLED:
262        return "http://hl7.org/fhir/contract-status";
263      case DISPUTED:
264        return "http://hl7.org/fhir/contract-status";
265      case ENTEREDINERROR:
266        return "http://hl7.org/fhir/contract-status";
267      case EXECUTABLE:
268        return "http://hl7.org/fhir/contract-status";
269      case EXECUTED:
270        return "http://hl7.org/fhir/contract-status";
271      case NEGOTIABLE:
272        return "http://hl7.org/fhir/contract-status";
273      case OFFERED:
274        return "http://hl7.org/fhir/contract-status";
275      case POLICY:
276        return "http://hl7.org/fhir/contract-status";
277      case REJECTED:
278        return "http://hl7.org/fhir/contract-status";
279      case RENEWED:
280        return "http://hl7.org/fhir/contract-status";
281      case REVOKED:
282        return "http://hl7.org/fhir/contract-status";
283      case RESOLVED:
284        return "http://hl7.org/fhir/contract-status";
285      case TERMINATED:
286        return "http://hl7.org/fhir/contract-status";
287      case NULL:
288        return null;
289      default:
290        return "?";
291      }
292    }
293
294    public String getDefinition() {
295      switch (this) {
296      case AMENDED:
297        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.";
298      case APPENDED:
299        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.";
300      case CANCELLED:
301        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.";
302      case DISPUTED:
303        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.";
304      case ENTEREDINERROR:
305        return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
306      case EXECUTABLE:
307        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.";
308      case EXECUTED:
309        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.";
310      case NEGOTIABLE:
311        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.";
312      case OFFERED:
313        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.";
314      case POLICY:
315        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.";
316      case REJECTED:
317        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.";
318      case RENEWED:
319        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.";
320      case REVOKED:
321        return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
322      case RESOLVED:
323        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.";
324      case TERMINATED:
325        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.";
326      case NULL:
327        return null;
328      default:
329        return "?";
330      }
331    }
332
333    public String getDisplay() {
334      switch (this) {
335      case AMENDED:
336        return "Amended";
337      case APPENDED:
338        return "Appended";
339      case CANCELLED:
340        return "Cancelled";
341      case DISPUTED:
342        return "Disputed";
343      case ENTEREDINERROR:
344        return "Entered in Error";
345      case EXECUTABLE:
346        return "Executable";
347      case EXECUTED:
348        return "Executed";
349      case NEGOTIABLE:
350        return "Negotiable";
351      case OFFERED:
352        return "Offered";
353      case POLICY:
354        return "Policy";
355      case REJECTED:
356        return "Rejected";
357      case RENEWED:
358        return "Renewed";
359      case REVOKED:
360        return "Revoked";
361      case RESOLVED:
362        return "Resolved";
363      case TERMINATED:
364        return "Terminated";
365      case NULL:
366        return null;
367      default:
368        return "?";
369      }
370    }
371  }
372
373  public static class ContractStatusEnumFactory implements EnumFactory<ContractStatus> {
374    public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
375      if (codeString == null || "".equals(codeString))
376        if (codeString == null || "".equals(codeString))
377          return null;
378      if ("amended".equals(codeString))
379        return ContractStatus.AMENDED;
380      if ("appended".equals(codeString))
381        return ContractStatus.APPENDED;
382      if ("cancelled".equals(codeString))
383        return ContractStatus.CANCELLED;
384      if ("disputed".equals(codeString))
385        return ContractStatus.DISPUTED;
386      if ("entered-in-error".equals(codeString))
387        return ContractStatus.ENTEREDINERROR;
388      if ("executable".equals(codeString))
389        return ContractStatus.EXECUTABLE;
390      if ("executed".equals(codeString))
391        return ContractStatus.EXECUTED;
392      if ("negotiable".equals(codeString))
393        return ContractStatus.NEGOTIABLE;
394      if ("offered".equals(codeString))
395        return ContractStatus.OFFERED;
396      if ("policy".equals(codeString))
397        return ContractStatus.POLICY;
398      if ("rejected".equals(codeString))
399        return ContractStatus.REJECTED;
400      if ("renewed".equals(codeString))
401        return ContractStatus.RENEWED;
402      if ("revoked".equals(codeString))
403        return ContractStatus.REVOKED;
404      if ("resolved".equals(codeString))
405        return ContractStatus.RESOLVED;
406      if ("terminated".equals(codeString))
407        return ContractStatus.TERMINATED;
408      throw new IllegalArgumentException("Unknown ContractStatus code '" + codeString + "'");
409    }
410
411    public Enumeration<ContractStatus> fromType(PrimitiveType<?> code) throws FHIRException {
412      if (code == null)
413        return null;
414      if (code.isEmpty())
415        return new Enumeration<ContractStatus>(this, ContractStatus.NULL, code);
416      String codeString = code.asStringValue();
417      if (codeString == null || "".equals(codeString))
418        return new Enumeration<ContractStatus>(this, ContractStatus.NULL, code);
419      if ("amended".equals(codeString))
420        return new Enumeration<ContractStatus>(this, ContractStatus.AMENDED, code);
421      if ("appended".equals(codeString))
422        return new Enumeration<ContractStatus>(this, ContractStatus.APPENDED, code);
423      if ("cancelled".equals(codeString))
424        return new Enumeration<ContractStatus>(this, ContractStatus.CANCELLED, code);
425      if ("disputed".equals(codeString))
426        return new Enumeration<ContractStatus>(this, ContractStatus.DISPUTED, code);
427      if ("entered-in-error".equals(codeString))
428        return new Enumeration<ContractStatus>(this, ContractStatus.ENTEREDINERROR, code);
429      if ("executable".equals(codeString))
430        return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTABLE, code);
431      if ("executed".equals(codeString))
432        return new Enumeration<ContractStatus>(this, ContractStatus.EXECUTED, code);
433      if ("negotiable".equals(codeString))
434        return new Enumeration<ContractStatus>(this, ContractStatus.NEGOTIABLE, code);
435      if ("offered".equals(codeString))
436        return new Enumeration<ContractStatus>(this, ContractStatus.OFFERED, code);
437      if ("policy".equals(codeString))
438        return new Enumeration<ContractStatus>(this, ContractStatus.POLICY, code);
439      if ("rejected".equals(codeString))
440        return new Enumeration<ContractStatus>(this, ContractStatus.REJECTED, code);
441      if ("renewed".equals(codeString))
442        return new Enumeration<ContractStatus>(this, ContractStatus.RENEWED, code);
443      if ("revoked".equals(codeString))
444        return new Enumeration<ContractStatus>(this, ContractStatus.REVOKED, code);
445      if ("resolved".equals(codeString))
446        return new Enumeration<ContractStatus>(this, ContractStatus.RESOLVED, code);
447      if ("terminated".equals(codeString))
448        return new Enumeration<ContractStatus>(this, ContractStatus.TERMINATED, code);
449      throw new FHIRException("Unknown ContractStatus code '" + codeString + "'");
450    }
451
452    public String toCode(ContractStatus code) {
453      if (code == ContractStatus.AMENDED)
454        return "amended";
455      if (code == ContractStatus.APPENDED)
456        return "appended";
457      if (code == ContractStatus.CANCELLED)
458        return "cancelled";
459      if (code == ContractStatus.DISPUTED)
460        return "disputed";
461      if (code == ContractStatus.ENTEREDINERROR)
462        return "entered-in-error";
463      if (code == ContractStatus.EXECUTABLE)
464        return "executable";
465      if (code == ContractStatus.EXECUTED)
466        return "executed";
467      if (code == ContractStatus.NEGOTIABLE)
468        return "negotiable";
469      if (code == ContractStatus.OFFERED)
470        return "offered";
471      if (code == ContractStatus.POLICY)
472        return "policy";
473      if (code == ContractStatus.REJECTED)
474        return "rejected";
475      if (code == ContractStatus.RENEWED)
476        return "renewed";
477      if (code == ContractStatus.REVOKED)
478        return "revoked";
479      if (code == ContractStatus.RESOLVED)
480        return "resolved";
481      if (code == ContractStatus.TERMINATED)
482        return "terminated";
483      return "?";
484    }
485
486    public String toSystem(ContractStatus code) {
487      return code.getSystem();
488    }
489  }
490
491  public enum ContractPublicationStatus {
492    /**
493     * Contract is augmented with additional information to correct errors in a
494     * predecessor or to updated values in a predecessor. Usage: Contract altered
495     * within effective time. Precedence Order = 9. Comparable FHIR and v.3 status
496     * codes: revised; replaced.
497     */
498    AMENDED,
499    /**
500     * Contract is augmented with additional information that was missing from a
501     * predecessor Contract. Usage: Contract altered within effective time.
502     * Precedence Order = 9. Comparable FHIR and v.3 status codes: updated,
503     * replaced.
504     */
505    APPENDED,
506    /**
507     * Contract is terminated due to failure of the Grantor and/or the Grantee to
508     * fulfil one or more contract provisions. Usage: Abnormal contract termination.
509     * Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed;
510     * aborted.
511     */
512    CANCELLED,
513    /**
514     * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil
515     * contract provision(s). E.g., Grantee complaint about Grantor's failure to
516     * comply with contract provisions. Usage: Contract pended. Precedence Order =
517     * 7. Comparable FHIR and v.3 status codes: on hold; pended; suspended.
518     */
519    DISPUTED,
520    /**
521     * Contract was created in error. No Precedence Order. Status may be applied to
522     * a Contract with any status.
523     */
524    ENTEREDINERROR,
525    /**
526     * Contract execution pending; may be executed when either the Grantor or the
527     * Grantee accepts the contract provisions by signing. I.e., where either the
528     * Grantor or the Grantee has signed, but not both. E.g., when an insurance
529     * applicant signs the insurers application, which references the policy. Usage:
530     * Optional first step of contract execution activity. May be skipped and
531     * contracting activity moves directly to executed state. Precedence Order = 3.
532     * Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended;
533     * active.
534     */
535    EXECUTABLE,
536    /**
537     * Contract is activated for period stipulated when both the Grantor and Grantee
538     * have signed it. Usage: Required state for normal completion of contracting
539     * activity. Precedence Order = 6. Comparable FHIR and v.3 status codes:
540     * accepted; completed.
541     */
542    EXECUTED,
543    /**
544     * Contract execution is suspended while either or both the Grantor and Grantee
545     * propose and consider new or revised contract provisions. I.e., where the
546     * party which has not signed proposes changes to the terms. E .g., a life
547     * insurer declines to agree to the signed application because the life insurer
548     * has evidence that the applicant, who asserted to being younger or a
549     * non-smoker to get a lower premium rate - but offers instead to agree to a
550     * higher premium based on the applicants actual age or smoking status. Usage:
551     * Optional contract activity between executable and executed state. Precedence
552     * Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
553     */
554    NEGOTIABLE,
555    /**
556     * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract
557     * hard copy or electronic 'template', 'form' or 'application'. E.g., health
558     * insurance application; consent directive form. Usage: Beginning of contract
559     * negotiation, which may have been completed as a precondition because used for
560     * 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes:
561     * requested; new.
562     */
563    OFFERED,
564    /**
565     * Contract template is available as the basis for an application or offer by
566     * the Grantor or Grantee. E.g., health insurance policy; consent directive
567     * policy. Usage: Required initial contract activity, which may have been
568     * completed as a precondition because used for 0..* contracts. Precedence Order
569     * = 1. Comparable FHIR and v.3 status codes: proposed; intended.
570     */
571    POLICY,
572    /**
573     * Execution of the Contract is not completed because either or both the Grantor
574     * and Grantee decline to accept some or all of the contract provisions. Usage:
575     * Optional contract activity between executable and abnormal termination.
576     * Precedence Order = 5. Comparable FHIR and v.3 status codes: stopped;
577     * cancelled.
578     */
579    REJECTED,
580    /**
581     * Beginning of a successor Contract at the termination of predecessor Contract
582     * lifecycle. Usage: Follows termination of a preceding Contract that has
583     * reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3
584     * status codes: superseded.
585     */
586    RENEWED,
587    /**
588     * A Contract that is rescinded. May be required prior to replacing with an
589     * updated Contract. Comparable FHIR and v.3 status codes: nullified.
590     */
591    REVOKED,
592    /**
593     * Contract is reactivated after being pended because of faulty execution.
594     * *E.g., competency of the signer(s), or where the policy is substantially
595     * different from and did not accompany the application/form so that the
596     * applicant could not compare them. Aka - ''reactivated''. Usage: Optional
597     * stage where a pended contract is reactivated. Precedence Order = 8.
598     * Comparable FHIR and v.3 status codes: reactivated.
599     */
600    RESOLVED,
601    /**
602     * Contract reaches its expiry date. It might or might not be renewed or
603     * renegotiated. Usage: Normal end of contract period. Precedence Order = 12.
604     * Comparable FHIR and v.3 status codes: Obsoleted.
605     */
606    TERMINATED,
607    /**
608     * added to help the parsers with the generic types
609     */
610    NULL;
611
612    public static ContractPublicationStatus fromCode(String codeString) throws FHIRException {
613      if (codeString == null || "".equals(codeString))
614        return null;
615      if ("amended".equals(codeString))
616        return AMENDED;
617      if ("appended".equals(codeString))
618        return APPENDED;
619      if ("cancelled".equals(codeString))
620        return CANCELLED;
621      if ("disputed".equals(codeString))
622        return DISPUTED;
623      if ("entered-in-error".equals(codeString))
624        return ENTEREDINERROR;
625      if ("executable".equals(codeString))
626        return EXECUTABLE;
627      if ("executed".equals(codeString))
628        return EXECUTED;
629      if ("negotiable".equals(codeString))
630        return NEGOTIABLE;
631      if ("offered".equals(codeString))
632        return OFFERED;
633      if ("policy".equals(codeString))
634        return POLICY;
635      if ("rejected".equals(codeString))
636        return REJECTED;
637      if ("renewed".equals(codeString))
638        return RENEWED;
639      if ("revoked".equals(codeString))
640        return REVOKED;
641      if ("resolved".equals(codeString))
642        return RESOLVED;
643      if ("terminated".equals(codeString))
644        return TERMINATED;
645      if (Configuration.isAcceptInvalidEnums())
646        return null;
647      else
648        throw new FHIRException("Unknown ContractPublicationStatus code '" + codeString + "'");
649    }
650
651    public String toCode() {
652      switch (this) {
653      case AMENDED:
654        return "amended";
655      case APPENDED:
656        return "appended";
657      case CANCELLED:
658        return "cancelled";
659      case DISPUTED:
660        return "disputed";
661      case ENTEREDINERROR:
662        return "entered-in-error";
663      case EXECUTABLE:
664        return "executable";
665      case EXECUTED:
666        return "executed";
667      case NEGOTIABLE:
668        return "negotiable";
669      case OFFERED:
670        return "offered";
671      case POLICY:
672        return "policy";
673      case REJECTED:
674        return "rejected";
675      case RENEWED:
676        return "renewed";
677      case REVOKED:
678        return "revoked";
679      case RESOLVED:
680        return "resolved";
681      case TERMINATED:
682        return "terminated";
683      case NULL:
684        return null;
685      default:
686        return "?";
687      }
688    }
689
690    public String getSystem() {
691      switch (this) {
692      case AMENDED:
693        return "http://hl7.org/fhir/contract-publicationstatus";
694      case APPENDED:
695        return "http://hl7.org/fhir/contract-publicationstatus";
696      case CANCELLED:
697        return "http://hl7.org/fhir/contract-publicationstatus";
698      case DISPUTED:
699        return "http://hl7.org/fhir/contract-publicationstatus";
700      case ENTEREDINERROR:
701        return "http://hl7.org/fhir/contract-publicationstatus";
702      case EXECUTABLE:
703        return "http://hl7.org/fhir/contract-publicationstatus";
704      case EXECUTED:
705        return "http://hl7.org/fhir/contract-publicationstatus";
706      case NEGOTIABLE:
707        return "http://hl7.org/fhir/contract-publicationstatus";
708      case OFFERED:
709        return "http://hl7.org/fhir/contract-publicationstatus";
710      case POLICY:
711        return "http://hl7.org/fhir/contract-publicationstatus";
712      case REJECTED:
713        return "http://hl7.org/fhir/contract-publicationstatus";
714      case RENEWED:
715        return "http://hl7.org/fhir/contract-publicationstatus";
716      case REVOKED:
717        return "http://hl7.org/fhir/contract-publicationstatus";
718      case RESOLVED:
719        return "http://hl7.org/fhir/contract-publicationstatus";
720      case TERMINATED:
721        return "http://hl7.org/fhir/contract-publicationstatus";
722      case NULL:
723        return null;
724      default:
725        return "?";
726      }
727    }
728
729    public String getDefinition() {
730      switch (this) {
731      case AMENDED:
732        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.";
733      case APPENDED:
734        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.";
735      case CANCELLED:
736        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.";
737      case DISPUTED:
738        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.";
739      case ENTEREDINERROR:
740        return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
741      case EXECUTABLE:
742        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.";
743      case EXECUTED:
744        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.";
745      case NEGOTIABLE:
746        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.";
747      case OFFERED:
748        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.";
749      case POLICY:
750        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.";
751      case REJECTED:
752        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.";
753      case RENEWED:
754        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.";
755      case REVOKED:
756        return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
757      case RESOLVED:
758        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.";
759      case TERMINATED:
760        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.";
761      case NULL:
762        return null;
763      default:
764        return "?";
765      }
766    }
767
768    public String getDisplay() {
769      switch (this) {
770      case AMENDED:
771        return "Amended";
772      case APPENDED:
773        return "Appended";
774      case CANCELLED:
775        return "Cancelled";
776      case DISPUTED:
777        return "Disputed";
778      case ENTEREDINERROR:
779        return "Entered in Error";
780      case EXECUTABLE:
781        return "Executable";
782      case EXECUTED:
783        return "Executed";
784      case NEGOTIABLE:
785        return "Negotiable";
786      case OFFERED:
787        return "Offered";
788      case POLICY:
789        return "Policy";
790      case REJECTED:
791        return "Rejected";
792      case RENEWED:
793        return "Renewed";
794      case REVOKED:
795        return "Revoked";
796      case RESOLVED:
797        return "Resolved";
798      case TERMINATED:
799        return "Terminated";
800      case NULL:
801        return null;
802      default:
803        return "?";
804      }
805    }
806  }
807
808  public static class ContractPublicationStatusEnumFactory implements EnumFactory<ContractPublicationStatus> {
809    public ContractPublicationStatus fromCode(String codeString) throws IllegalArgumentException {
810      if (codeString == null || "".equals(codeString))
811        if (codeString == null || "".equals(codeString))
812          return null;
813      if ("amended".equals(codeString))
814        return ContractPublicationStatus.AMENDED;
815      if ("appended".equals(codeString))
816        return ContractPublicationStatus.APPENDED;
817      if ("cancelled".equals(codeString))
818        return ContractPublicationStatus.CANCELLED;
819      if ("disputed".equals(codeString))
820        return ContractPublicationStatus.DISPUTED;
821      if ("entered-in-error".equals(codeString))
822        return ContractPublicationStatus.ENTEREDINERROR;
823      if ("executable".equals(codeString))
824        return ContractPublicationStatus.EXECUTABLE;
825      if ("executed".equals(codeString))
826        return ContractPublicationStatus.EXECUTED;
827      if ("negotiable".equals(codeString))
828        return ContractPublicationStatus.NEGOTIABLE;
829      if ("offered".equals(codeString))
830        return ContractPublicationStatus.OFFERED;
831      if ("policy".equals(codeString))
832        return ContractPublicationStatus.POLICY;
833      if ("rejected".equals(codeString))
834        return ContractPublicationStatus.REJECTED;
835      if ("renewed".equals(codeString))
836        return ContractPublicationStatus.RENEWED;
837      if ("revoked".equals(codeString))
838        return ContractPublicationStatus.REVOKED;
839      if ("resolved".equals(codeString))
840        return ContractPublicationStatus.RESOLVED;
841      if ("terminated".equals(codeString))
842        return ContractPublicationStatus.TERMINATED;
843      throw new IllegalArgumentException("Unknown ContractPublicationStatus code '" + codeString + "'");
844    }
845
846    public Enumeration<ContractPublicationStatus> fromType(PrimitiveType<?> code) throws FHIRException {
847      if (code == null)
848        return null;
849      if (code.isEmpty())
850        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NULL, code);
851      String codeString = code.asStringValue();
852      if (codeString == null || "".equals(codeString))
853        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NULL, code);
854      if ("amended".equals(codeString))
855        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.AMENDED, code);
856      if ("appended".equals(codeString))
857        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.APPENDED, code);
858      if ("cancelled".equals(codeString))
859        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.CANCELLED, code);
860      if ("disputed".equals(codeString))
861        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.DISPUTED, code);
862      if ("entered-in-error".equals(codeString))
863        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.ENTEREDINERROR, code);
864      if ("executable".equals(codeString))
865        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTABLE, code);
866      if ("executed".equals(codeString))
867        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.EXECUTED, code);
868      if ("negotiable".equals(codeString))
869        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.NEGOTIABLE, code);
870      if ("offered".equals(codeString))
871        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.OFFERED, code);
872      if ("policy".equals(codeString))
873        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.POLICY, code);
874      if ("rejected".equals(codeString))
875        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REJECTED, code);
876      if ("renewed".equals(codeString))
877        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RENEWED, code);
878      if ("revoked".equals(codeString))
879        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.REVOKED, code);
880      if ("resolved".equals(codeString))
881        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.RESOLVED, code);
882      if ("terminated".equals(codeString))
883        return new Enumeration<ContractPublicationStatus>(this, ContractPublicationStatus.TERMINATED, code);
884      throw new FHIRException("Unknown ContractPublicationStatus code '" + codeString + "'");
885    }
886
887    public String toCode(ContractPublicationStatus code) {
888      if (code == ContractPublicationStatus.AMENDED)
889        return "amended";
890      if (code == ContractPublicationStatus.APPENDED)
891        return "appended";
892      if (code == ContractPublicationStatus.CANCELLED)
893        return "cancelled";
894      if (code == ContractPublicationStatus.DISPUTED)
895        return "disputed";
896      if (code == ContractPublicationStatus.ENTEREDINERROR)
897        return "entered-in-error";
898      if (code == ContractPublicationStatus.EXECUTABLE)
899        return "executable";
900      if (code == ContractPublicationStatus.EXECUTED)
901        return "executed";
902      if (code == ContractPublicationStatus.NEGOTIABLE)
903        return "negotiable";
904      if (code == ContractPublicationStatus.OFFERED)
905        return "offered";
906      if (code == ContractPublicationStatus.POLICY)
907        return "policy";
908      if (code == ContractPublicationStatus.REJECTED)
909        return "rejected";
910      if (code == ContractPublicationStatus.RENEWED)
911        return "renewed";
912      if (code == ContractPublicationStatus.REVOKED)
913        return "revoked";
914      if (code == ContractPublicationStatus.RESOLVED)
915        return "resolved";
916      if (code == ContractPublicationStatus.TERMINATED)
917        return "terminated";
918      return "?";
919    }
920
921    public String toSystem(ContractPublicationStatus code) {
922      return code.getSystem();
923    }
924  }
925
926  @Block()
927  public static class ContentDefinitionComponent extends BackboneElement implements IBaseBackboneElement {
928    /**
929     * Precusory content structure and use, i.e., a boilerplate, template,
930     * application for a contract such as an insurance policy or benefits under a
931     * program, e.g., workers compensation.
932     */
933    @Child(name = "type", type = {
934        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
935    @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.")
936    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-definition-type")
937    protected CodeableConcept type;
938
939    /**
940     * Detailed Precusory content type.
941     */
942    @Child(name = "subType", type = {
943        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
944    @Description(shortDefinition = "Detailed Content Type Definition", formalDefinition = "Detailed Precusory content type.")
945    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-definition-subtype")
946    protected CodeableConcept subType;
947
948    /**
949     * The individual or organization that published the Contract precursor content.
950     */
951    @Child(name = "publisher", type = { Practitioner.class, PractitionerRole.class,
952        Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
953    @Description(shortDefinition = "Publisher Entity", formalDefinition = "The  individual or organization that published the Contract precursor content.")
954    protected Reference publisher;
955
956    /**
957     * The actual object that is the target of the reference (The individual or
958     * organization that published the Contract precursor content.)
959     */
960    protected Resource publisherTarget;
961
962    /**
963     * The date (and optionally time) when the contract was published. The date must
964     * change when the business version changes and it must change if the status
965     * code changes. In addition, it should change when the substantive content of
966     * the contract changes.
967     */
968    @Child(name = "publicationDate", type = {
969        DateTimeType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
970    @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.")
971    protected DateTimeType publicationDate;
972
973    /**
974     * amended | appended | cancelled | disputed | entered-in-error | executable |
975     * executed | negotiable | offered | policy | rejected | renewed | revoked |
976     * resolved | terminated.
977     */
978    @Child(name = "publicationStatus", type = {
979        CodeType.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
980    @Description(shortDefinition = "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition = "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.")
981    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-publicationstatus")
982    protected Enumeration<ContractPublicationStatus> publicationStatus;
983
984    /**
985     * A copyright statement relating to Contract precursor content. Copyright
986     * statements are generally legal restrictions on the use and publishing of the
987     * Contract precursor content.
988     */
989    @Child(name = "copyright", type = {
990        MarkdownType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
991    @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.")
992    protected MarkdownType copyright;
993
994    private static final long serialVersionUID = -699592864L;
995
996    /**
997     * Constructor
998     */
999    public ContentDefinitionComponent() {
1000      super();
1001    }
1002
1003    /**
1004     * Constructor
1005     */
1006    public ContentDefinitionComponent(CodeableConcept type, Enumeration<ContractPublicationStatus> publicationStatus) {
1007      super();
1008      this.type = type;
1009      this.publicationStatus = publicationStatus;
1010    }
1011
1012    /**
1013     * @return {@link #type} (Precusory content structure and use, i.e., a
1014     *         boilerplate, template, application for a contract such as an
1015     *         insurance policy or benefits under a program, e.g., workers
1016     *         compensation.)
1017     */
1018    public CodeableConcept getType() {
1019      if (this.type == null)
1020        if (Configuration.errorOnAutoCreate())
1021          throw new Error("Attempt to auto-create ContentDefinitionComponent.type");
1022        else if (Configuration.doAutoCreate())
1023          this.type = new CodeableConcept(); // cc
1024      return this.type;
1025    }
1026
1027    public boolean hasType() {
1028      return this.type != null && !this.type.isEmpty();
1029    }
1030
1031    /**
1032     * @param value {@link #type} (Precusory content structure and use, i.e., a
1033     *              boilerplate, template, application for a contract such as an
1034     *              insurance policy or benefits under a program, e.g., workers
1035     *              compensation.)
1036     */
1037    public ContentDefinitionComponent setType(CodeableConcept value) {
1038      this.type = value;
1039      return this;
1040    }
1041
1042    /**
1043     * @return {@link #subType} (Detailed Precusory content type.)
1044     */
1045    public CodeableConcept getSubType() {
1046      if (this.subType == null)
1047        if (Configuration.errorOnAutoCreate())
1048          throw new Error("Attempt to auto-create ContentDefinitionComponent.subType");
1049        else if (Configuration.doAutoCreate())
1050          this.subType = new CodeableConcept(); // cc
1051      return this.subType;
1052    }
1053
1054    public boolean hasSubType() {
1055      return this.subType != null && !this.subType.isEmpty();
1056    }
1057
1058    /**
1059     * @param value {@link #subType} (Detailed Precusory content type.)
1060     */
1061    public ContentDefinitionComponent setSubType(CodeableConcept value) {
1062      this.subType = value;
1063      return this;
1064    }
1065
1066    /**
1067     * @return {@link #publisher} (The individual or organization that published the
1068     *         Contract precursor content.)
1069     */
1070    public Reference getPublisher() {
1071      if (this.publisher == null)
1072        if (Configuration.errorOnAutoCreate())
1073          throw new Error("Attempt to auto-create ContentDefinitionComponent.publisher");
1074        else if (Configuration.doAutoCreate())
1075          this.publisher = new Reference(); // cc
1076      return this.publisher;
1077    }
1078
1079    public boolean hasPublisher() {
1080      return this.publisher != null && !this.publisher.isEmpty();
1081    }
1082
1083    /**
1084     * @param value {@link #publisher} (The individual or organization that
1085     *              published the Contract precursor content.)
1086     */
1087    public ContentDefinitionComponent setPublisher(Reference value) {
1088      this.publisher = value;
1089      return this;
1090    }
1091
1092    /**
1093     * @return {@link #publisher} The actual object that is the target of the
1094     *         reference. The reference library doesn't populate this, but you can
1095     *         use it to hold the resource if you resolve it. (The individual or
1096     *         organization that published the Contract precursor content.)
1097     */
1098    public Resource getPublisherTarget() {
1099      return this.publisherTarget;
1100    }
1101
1102    /**
1103     * @param value {@link #publisher} The actual object that is the target of the
1104     *              reference. The reference library doesn't use these, but you can
1105     *              use it to hold the resource if you resolve it. (The individual
1106     *              or organization that published the Contract precursor content.)
1107     */
1108    public ContentDefinitionComponent setPublisherTarget(Resource value) {
1109      this.publisherTarget = value;
1110      return this;
1111    }
1112
1113    /**
1114     * @return {@link #publicationDate} (The date (and optionally time) when the
1115     *         contract was published. The date must change when the business
1116     *         version changes and it must change if the status code changes. In
1117     *         addition, it should change when the substantive content of the
1118     *         contract changes.). This is the underlying object with id, value and
1119     *         extensions. The accessor "getPublicationDate" gives direct access to
1120     *         the value
1121     */
1122    public DateTimeType getPublicationDateElement() {
1123      if (this.publicationDate == null)
1124        if (Configuration.errorOnAutoCreate())
1125          throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationDate");
1126        else if (Configuration.doAutoCreate())
1127          this.publicationDate = new DateTimeType(); // bb
1128      return this.publicationDate;
1129    }
1130
1131    public boolean hasPublicationDateElement() {
1132      return this.publicationDate != null && !this.publicationDate.isEmpty();
1133    }
1134
1135    public boolean hasPublicationDate() {
1136      return this.publicationDate != null && !this.publicationDate.isEmpty();
1137    }
1138
1139    /**
1140     * @param value {@link #publicationDate} (The date (and optionally time) when
1141     *              the contract was published. The date must change when the
1142     *              business version changes and it must change if the status code
1143     *              changes. In addition, it should change when the substantive
1144     *              content of the contract changes.). This is the underlying object
1145     *              with id, value and extensions. The accessor "getPublicationDate"
1146     *              gives direct access to the value
1147     */
1148    public ContentDefinitionComponent setPublicationDateElement(DateTimeType value) {
1149      this.publicationDate = value;
1150      return this;
1151    }
1152
1153    /**
1154     * @return The date (and optionally time) when the contract was published. The
1155     *         date must change when the business version changes and it must change
1156     *         if the status code changes. In addition, it should change when the
1157     *         substantive content of the contract changes.
1158     */
1159    public Date getPublicationDate() {
1160      return this.publicationDate == null ? null : this.publicationDate.getValue();
1161    }
1162
1163    /**
1164     * @param value The date (and optionally time) when the contract was published.
1165     *              The date must change when the business version changes and it
1166     *              must change if the status code changes. In addition, it should
1167     *              change when the substantive content of the contract changes.
1168     */
1169    public ContentDefinitionComponent setPublicationDate(Date value) {
1170      if (value == null)
1171        this.publicationDate = null;
1172      else {
1173        if (this.publicationDate == null)
1174          this.publicationDate = new DateTimeType();
1175        this.publicationDate.setValue(value);
1176      }
1177      return this;
1178    }
1179
1180    /**
1181     * @return {@link #publicationStatus} (amended | appended | cancelled | disputed
1182     *         | entered-in-error | executable | executed | negotiable | offered |
1183     *         policy | rejected | renewed | revoked | resolved | terminated.). This
1184     *         is the underlying object with id, value and extensions. The accessor
1185     *         "getPublicationStatus" gives direct access to the value
1186     */
1187    public Enumeration<ContractPublicationStatus> getPublicationStatusElement() {
1188      if (this.publicationStatus == null)
1189        if (Configuration.errorOnAutoCreate())
1190          throw new Error("Attempt to auto-create ContentDefinitionComponent.publicationStatus");
1191        else if (Configuration.doAutoCreate())
1192          this.publicationStatus = new Enumeration<ContractPublicationStatus>(
1193              new ContractPublicationStatusEnumFactory()); // bb
1194      return this.publicationStatus;
1195    }
1196
1197    public boolean hasPublicationStatusElement() {
1198      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1199    }
1200
1201    public boolean hasPublicationStatus() {
1202      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1203    }
1204
1205    /**
1206     * @param value {@link #publicationStatus} (amended | appended | cancelled |
1207     *              disputed | entered-in-error | executable | executed | negotiable
1208     *              | offered | policy | rejected | renewed | revoked | resolved |
1209     *              terminated.). This is the underlying object with id, value and
1210     *              extensions. The accessor "getPublicationStatus" gives direct
1211     *              access to the value
1212     */
1213    public ContentDefinitionComponent setPublicationStatusElement(Enumeration<ContractPublicationStatus> value) {
1214      this.publicationStatus = value;
1215      return this;
1216    }
1217
1218    /**
1219     * @return amended | appended | cancelled | disputed | entered-in-error |
1220     *         executable | executed | negotiable | offered | policy | rejected |
1221     *         renewed | revoked | resolved | terminated.
1222     */
1223    public ContractPublicationStatus getPublicationStatus() {
1224      return this.publicationStatus == null ? null : this.publicationStatus.getValue();
1225    }
1226
1227    /**
1228     * @param value amended | appended | cancelled | disputed | entered-in-error |
1229     *              executable | executed | negotiable | offered | policy | rejected
1230     *              | renewed | revoked | resolved | terminated.
1231     */
1232    public ContentDefinitionComponent setPublicationStatus(ContractPublicationStatus value) {
1233      if (this.publicationStatus == null)
1234        this.publicationStatus = new Enumeration<ContractPublicationStatus>(new ContractPublicationStatusEnumFactory());
1235      this.publicationStatus.setValue(value);
1236      return this;
1237    }
1238
1239    /**
1240     * @return {@link #copyright} (A copyright statement relating to Contract
1241     *         precursor content. Copyright statements are generally legal
1242     *         restrictions on the use and publishing of the Contract precursor
1243     *         content.). This is the underlying object with id, value and
1244     *         extensions. The accessor "getCopyright" gives direct access to the
1245     *         value
1246     */
1247    public MarkdownType getCopyrightElement() {
1248      if (this.copyright == null)
1249        if (Configuration.errorOnAutoCreate())
1250          throw new Error("Attempt to auto-create ContentDefinitionComponent.copyright");
1251        else if (Configuration.doAutoCreate())
1252          this.copyright = new MarkdownType(); // bb
1253      return this.copyright;
1254    }
1255
1256    public boolean hasCopyrightElement() {
1257      return this.copyright != null && !this.copyright.isEmpty();
1258    }
1259
1260    public boolean hasCopyright() {
1261      return this.copyright != null && !this.copyright.isEmpty();
1262    }
1263
1264    /**
1265     * @param value {@link #copyright} (A copyright statement relating to Contract
1266     *              precursor content. Copyright statements are generally legal
1267     *              restrictions on the use and publishing of the Contract precursor
1268     *              content.). This is the underlying object with id, value and
1269     *              extensions. The accessor "getCopyright" gives direct access to
1270     *              the value
1271     */
1272    public ContentDefinitionComponent setCopyrightElement(MarkdownType value) {
1273      this.copyright = value;
1274      return this;
1275    }
1276
1277    /**
1278     * @return A copyright statement relating to Contract precursor content.
1279     *         Copyright statements are generally legal restrictions on the use and
1280     *         publishing of the Contract precursor content.
1281     */
1282    public String getCopyright() {
1283      return this.copyright == null ? null : this.copyright.getValue();
1284    }
1285
1286    /**
1287     * @param value A copyright statement relating to Contract precursor content.
1288     *              Copyright statements are generally legal restrictions on the use
1289     *              and publishing of the Contract precursor content.
1290     */
1291    public ContentDefinitionComponent setCopyright(String value) {
1292      if (value == null)
1293        this.copyright = null;
1294      else {
1295        if (this.copyright == null)
1296          this.copyright = new MarkdownType();
1297        this.copyright.setValue(value);
1298      }
1299      return this;
1300    }
1301
1302    protected void listChildren(List<Property> children) {
1303      super.listChildren(children);
1304      children.add(new Property("type", "CodeableConcept",
1305          "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.",
1306          0, 1, type));
1307      children.add(new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1, subType));
1308      children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)",
1309          "The  individual or organization that published the Contract precursor content.", 0, 1, publisher));
1310      children.add(new Property("publicationDate", "dateTime",
1311          "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.",
1312          0, 1, publicationDate));
1313      children.add(new Property("publicationStatus", "code",
1314          "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.",
1315          0, 1, publicationStatus));
1316      children.add(new Property("copyright", "markdown",
1317          "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.",
1318          0, 1, copyright));
1319    }
1320
1321    @Override
1322    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1323      switch (_hash) {
1324      case 3575610:
1325        /* type */ return new Property("type", "CodeableConcept",
1326            "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.",
1327            0, 1, type);
1328      case -1868521062:
1329        /* subType */ return new Property("subType", "CodeableConcept", "Detailed Precusory content type.", 0, 1,
1330            subType);
1331      case 1447404028:
1332        /* publisher */ return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)",
1333            "The  individual or organization that published the Contract precursor content.", 0, 1, publisher);
1334      case 1470566394:
1335        /* publicationDate */ return new Property("publicationDate", "dateTime",
1336            "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.",
1337            0, 1, publicationDate);
1338      case 616500542:
1339        /* publicationStatus */ return new Property("publicationStatus", "code",
1340            "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated.",
1341            0, 1, publicationStatus);
1342      case 1522889671:
1343        /* copyright */ return new Property("copyright", "markdown",
1344            "A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.",
1345            0, 1, copyright);
1346      default:
1347        return super.getNamedProperty(_hash, _name, _checkValid);
1348      }
1349
1350    }
1351
1352    @Override
1353    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1354      switch (hash) {
1355      case 3575610:
1356        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1357      case -1868521062:
1358        /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
1359      case 1447404028:
1360        /* publisher */ return this.publisher == null ? new Base[0] : new Base[] { this.publisher }; // Reference
1361      case 1470566394:
1362        /* publicationDate */ return this.publicationDate == null ? new Base[0] : new Base[] { this.publicationDate }; // DateTimeType
1363      case 616500542:
1364        /* publicationStatus */ return this.publicationStatus == null ? new Base[0]
1365            : new Base[] { this.publicationStatus }; // Enumeration<ContractPublicationStatus>
1366      case 1522889671:
1367        /* copyright */ return this.copyright == null ? new Base[0] : new Base[] { this.copyright }; // MarkdownType
1368      default:
1369        return super.getProperty(hash, name, checkValid);
1370      }
1371
1372    }
1373
1374    @Override
1375    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1376      switch (hash) {
1377      case 3575610: // type
1378        this.type = castToCodeableConcept(value); // CodeableConcept
1379        return value;
1380      case -1868521062: // subType
1381        this.subType = castToCodeableConcept(value); // CodeableConcept
1382        return value;
1383      case 1447404028: // publisher
1384        this.publisher = castToReference(value); // Reference
1385        return value;
1386      case 1470566394: // publicationDate
1387        this.publicationDate = castToDateTime(value); // DateTimeType
1388        return value;
1389      case 616500542: // publicationStatus
1390        value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1391        this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1392        return value;
1393      case 1522889671: // copyright
1394        this.copyright = castToMarkdown(value); // MarkdownType
1395        return value;
1396      default:
1397        return super.setProperty(hash, name, value);
1398      }
1399
1400    }
1401
1402    @Override
1403    public Base setProperty(String name, Base value) throws FHIRException {
1404      if (name.equals("type")) {
1405        this.type = castToCodeableConcept(value); // CodeableConcept
1406      } else if (name.equals("subType")) {
1407        this.subType = castToCodeableConcept(value); // CodeableConcept
1408      } else if (name.equals("publisher")) {
1409        this.publisher = castToReference(value); // Reference
1410      } else if (name.equals("publicationDate")) {
1411        this.publicationDate = castToDateTime(value); // DateTimeType
1412      } else if (name.equals("publicationStatus")) {
1413        value = new ContractPublicationStatusEnumFactory().fromType(castToCode(value));
1414        this.publicationStatus = (Enumeration) value; // Enumeration<ContractPublicationStatus>
1415      } else if (name.equals("copyright")) {
1416        this.copyright = castToMarkdown(value); // MarkdownType
1417      } else
1418        return super.setProperty(name, value);
1419      return value;
1420    }
1421
1422  @Override
1423  public void removeChild(String name, Base value) throws FHIRException {
1424      if (name.equals("type")) {
1425        this.type = null;
1426      } else if (name.equals("subType")) {
1427        this.subType = null;
1428      } else if (name.equals("publisher")) {
1429        this.publisher = null;
1430      } else if (name.equals("publicationDate")) {
1431        this.publicationDate = null;
1432      } else if (name.equals("publicationStatus")) {
1433        this.publicationStatus = null;
1434      } else if (name.equals("copyright")) {
1435        this.copyright = null;
1436      } else
1437        super.removeChild(name, value);
1438      
1439    }
1440
1441    @Override
1442    public Base makeProperty(int hash, String name) throws FHIRException {
1443      switch (hash) {
1444      case 3575610:
1445        return getType();
1446      case -1868521062:
1447        return getSubType();
1448      case 1447404028:
1449        return getPublisher();
1450      case 1470566394:
1451        return getPublicationDateElement();
1452      case 616500542:
1453        return getPublicationStatusElement();
1454      case 1522889671:
1455        return getCopyrightElement();
1456      default:
1457        return super.makeProperty(hash, name);
1458      }
1459
1460    }
1461
1462    @Override
1463    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1464      switch (hash) {
1465      case 3575610:
1466        /* type */ return new String[] { "CodeableConcept" };
1467      case -1868521062:
1468        /* subType */ return new String[] { "CodeableConcept" };
1469      case 1447404028:
1470        /* publisher */ return new String[] { "Reference" };
1471      case 1470566394:
1472        /* publicationDate */ return new String[] { "dateTime" };
1473      case 616500542:
1474        /* publicationStatus */ return new String[] { "code" };
1475      case 1522889671:
1476        /* copyright */ return new String[] { "markdown" };
1477      default:
1478        return super.getTypesForProperty(hash, name);
1479      }
1480
1481    }
1482
1483    @Override
1484    public Base addChild(String name) throws FHIRException {
1485      if (name.equals("type")) {
1486        this.type = new CodeableConcept();
1487        return this.type;
1488      } else if (name.equals("subType")) {
1489        this.subType = new CodeableConcept();
1490        return this.subType;
1491      } else if (name.equals("publisher")) {
1492        this.publisher = new Reference();
1493        return this.publisher;
1494      } else if (name.equals("publicationDate")) {
1495        throw new FHIRException("Cannot call addChild on a singleton property Contract.publicationDate");
1496      } else if (name.equals("publicationStatus")) {
1497        throw new FHIRException("Cannot call addChild on a singleton property Contract.publicationStatus");
1498      } else if (name.equals("copyright")) {
1499        throw new FHIRException("Cannot call addChild on a singleton property Contract.copyright");
1500      } else
1501        return super.addChild(name);
1502    }
1503
1504    public ContentDefinitionComponent copy() {
1505      ContentDefinitionComponent dst = new ContentDefinitionComponent();
1506      copyValues(dst);
1507      return dst;
1508    }
1509
1510    public void copyValues(ContentDefinitionComponent dst) {
1511      super.copyValues(dst);
1512      dst.type = type == null ? null : type.copy();
1513      dst.subType = subType == null ? null : subType.copy();
1514      dst.publisher = publisher == null ? null : publisher.copy();
1515      dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1516      dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1517      dst.copyright = copyright == null ? null : copyright.copy();
1518    }
1519
1520    @Override
1521    public boolean equalsDeep(Base other_) {
1522      if (!super.equalsDeep(other_))
1523        return false;
1524      if (!(other_ instanceof ContentDefinitionComponent))
1525        return false;
1526      ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1527      return compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
1528          && compareDeep(publisher, o.publisher, true) && compareDeep(publicationDate, o.publicationDate, true)
1529          && compareDeep(publicationStatus, o.publicationStatus, true) && compareDeep(copyright, o.copyright, true);
1530    }
1531
1532    @Override
1533    public boolean equalsShallow(Base other_) {
1534      if (!super.equalsShallow(other_))
1535        return false;
1536      if (!(other_ instanceof ContentDefinitionComponent))
1537        return false;
1538      ContentDefinitionComponent o = (ContentDefinitionComponent) other_;
1539      return compareValues(publicationDate, o.publicationDate, true)
1540          && compareValues(publicationStatus, o.publicationStatus, true) && compareValues(copyright, o.copyright, true);
1541    }
1542
1543    public boolean isEmpty() {
1544      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subType, publisher, publicationDate,
1545          publicationStatus, copyright);
1546    }
1547
1548    public String fhirType() {
1549      return "Contract.contentDefinition";
1550
1551    }
1552
1553  }
1554
1555  @Block()
1556  public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
1557    /**
1558     * Unique identifier for this particular Contract Provision.
1559     */
1560    @Child(name = "identifier", type = {
1561        Identifier.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1562    @Description(shortDefinition = "Contract Term Number", formalDefinition = "Unique identifier for this particular Contract Provision.")
1563    protected Identifier identifier;
1564
1565    /**
1566     * When this Contract Provision was issued.
1567     */
1568    @Child(name = "issued", type = {
1569        DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1570    @Description(shortDefinition = "Contract Term Issue Date Time", formalDefinition = "When this Contract Provision was issued.")
1571    protected DateTimeType issued;
1572
1573    /**
1574     * Relevant time or time-period when this Contract Provision is applicable.
1575     */
1576    @Child(name = "applies", type = { Period.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1577    @Description(shortDefinition = "Contract Term Effective Time", formalDefinition = "Relevant time or time-period when this Contract Provision is applicable.")
1578    protected Period applies;
1579
1580    /**
1581     * The entity that the term applies to.
1582     */
1583    @Child(name = "topic", type = { CodeableConcept.class,
1584        Reference.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1585    @Description(shortDefinition = "Term Concern", formalDefinition = "The entity that the term applies to.")
1586    protected Type topic;
1587
1588    /**
1589     * A legal clause or condition contained within a contract that requires one or
1590     * both parties to perform a particular requirement by some specified time or
1591     * prevents one or both parties from performing a particular requirement by some
1592     * specified time.
1593     */
1594    @Child(name = "type", type = {
1595        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1596    @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.")
1597    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-type")
1598    protected CodeableConcept type;
1599
1600    /**
1601     * A specialized legal clause or condition based on overarching contract type.
1602     */
1603    @Child(name = "subType", type = {
1604        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1605    @Description(shortDefinition = "Contract Term Type specific classification", formalDefinition = "A specialized legal clause or condition based on overarching contract type.")
1606    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-subtype")
1607    protected CodeableConcept subType;
1608
1609    /**
1610     * Statement of a provision in a policy or a contract.
1611     */
1612    @Child(name = "text", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1613    @Description(shortDefinition = "Term Statement", formalDefinition = "Statement of a provision in a policy or a contract.")
1614    protected StringType text;
1615
1616    /**
1617     * Security labels that protect the handling of information about the term and
1618     * its elements, which may be specifically identified..
1619     */
1620    @Child(name = "securityLabel", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1621    @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..")
1622    protected List<SecurityLabelComponent> securityLabel;
1623
1624    /**
1625     * The matter of concern in the context of this provision of the agrement.
1626     */
1627    @Child(name = "offer", type = {}, order = 9, min = 1, max = 1, modifier = false, summary = false)
1628    @Description(shortDefinition = "Context of the Contract term", formalDefinition = "The matter of concern in the context of this provision of the agrement.")
1629    protected ContractOfferComponent offer;
1630
1631    /**
1632     * Contract Term Asset List.
1633     */
1634    @Child(name = "asset", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1635    @Description(shortDefinition = "Contract Term Asset List", formalDefinition = "Contract Term Asset List.")
1636    protected List<ContractAssetComponent> asset;
1637
1638    /**
1639     * An actor taking a role in an activity for which it can be assigned some
1640     * degree of responsibility for the activity taking place.
1641     */
1642    @Child(name = "action", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1643    @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.")
1644    protected List<ActionComponent> action;
1645
1646    /**
1647     * Nested group of Contract Provisions.
1648     */
1649    @Child(name = "group", type = {
1650        TermComponent.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1651    @Description(shortDefinition = "Nested Contract Term Group", formalDefinition = "Nested group of Contract Provisions.")
1652    protected List<TermComponent> group;
1653
1654    private static final long serialVersionUID = -460907186L;
1655
1656    /**
1657     * Constructor
1658     */
1659    public TermComponent() {
1660      super();
1661    }
1662
1663    /**
1664     * Constructor
1665     */
1666    public TermComponent(ContractOfferComponent offer) {
1667      super();
1668      this.offer = offer;
1669    }
1670
1671    /**
1672     * @return {@link #identifier} (Unique identifier for this particular Contract
1673     *         Provision.)
1674     */
1675    public Identifier getIdentifier() {
1676      if (this.identifier == null)
1677        if (Configuration.errorOnAutoCreate())
1678          throw new Error("Attempt to auto-create TermComponent.identifier");
1679        else if (Configuration.doAutoCreate())
1680          this.identifier = new Identifier(); // cc
1681      return this.identifier;
1682    }
1683
1684    public boolean hasIdentifier() {
1685      return this.identifier != null && !this.identifier.isEmpty();
1686    }
1687
1688    /**
1689     * @param value {@link #identifier} (Unique identifier for this particular
1690     *              Contract Provision.)
1691     */
1692    public TermComponent setIdentifier(Identifier value) {
1693      this.identifier = value;
1694      return this;
1695    }
1696
1697    /**
1698     * @return {@link #issued} (When this Contract Provision was issued.). This is
1699     *         the underlying object with id, value and extensions. The accessor
1700     *         "getIssued" gives direct access to the value
1701     */
1702    public DateTimeType getIssuedElement() {
1703      if (this.issued == null)
1704        if (Configuration.errorOnAutoCreate())
1705          throw new Error("Attempt to auto-create TermComponent.issued");
1706        else if (Configuration.doAutoCreate())
1707          this.issued = new DateTimeType(); // bb
1708      return this.issued;
1709    }
1710
1711    public boolean hasIssuedElement() {
1712      return this.issued != null && !this.issued.isEmpty();
1713    }
1714
1715    public boolean hasIssued() {
1716      return this.issued != null && !this.issued.isEmpty();
1717    }
1718
1719    /**
1720     * @param value {@link #issued} (When this Contract Provision was issued.). This
1721     *              is the underlying object with id, value and extensions. The
1722     *              accessor "getIssued" gives direct access to the value
1723     */
1724    public TermComponent setIssuedElement(DateTimeType value) {
1725      this.issued = value;
1726      return this;
1727    }
1728
1729    /**
1730     * @return When this Contract Provision was issued.
1731     */
1732    public Date getIssued() {
1733      return this.issued == null ? null : this.issued.getValue();
1734    }
1735
1736    /**
1737     * @param value When this Contract Provision was issued.
1738     */
1739    public TermComponent setIssued(Date value) {
1740      if (value == null)
1741        this.issued = null;
1742      else {
1743        if (this.issued == null)
1744          this.issued = new DateTimeType();
1745        this.issued.setValue(value);
1746      }
1747      return this;
1748    }
1749
1750    /**
1751     * @return {@link #applies} (Relevant time or time-period when this Contract
1752     *         Provision is applicable.)
1753     */
1754    public Period getApplies() {
1755      if (this.applies == null)
1756        if (Configuration.errorOnAutoCreate())
1757          throw new Error("Attempt to auto-create TermComponent.applies");
1758        else if (Configuration.doAutoCreate())
1759          this.applies = new Period(); // cc
1760      return this.applies;
1761    }
1762
1763    public boolean hasApplies() {
1764      return this.applies != null && !this.applies.isEmpty();
1765    }
1766
1767    /**
1768     * @param value {@link #applies} (Relevant time or time-period when this
1769     *              Contract Provision is applicable.)
1770     */
1771    public TermComponent setApplies(Period value) {
1772      this.applies = value;
1773      return this;
1774    }
1775
1776    /**
1777     * @return {@link #topic} (The entity that the term applies to.)
1778     */
1779    public Type getTopic() {
1780      return this.topic;
1781    }
1782
1783    /**
1784     * @return {@link #topic} (The entity that the term applies to.)
1785     */
1786    public CodeableConcept getTopicCodeableConcept() throws FHIRException {
1787      if (this.topic == null)
1788        this.topic = new CodeableConcept();
1789      if (!(this.topic instanceof CodeableConcept))
1790        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1791            + this.topic.getClass().getName() + " was encountered");
1792      return (CodeableConcept) this.topic;
1793    }
1794
1795    public boolean hasTopicCodeableConcept() {
1796      return this != null && this.topic instanceof CodeableConcept;
1797    }
1798
1799    /**
1800     * @return {@link #topic} (The entity that the term applies to.)
1801     */
1802    public Reference getTopicReference() throws FHIRException {
1803      if (this.topic == null)
1804        this.topic = new Reference();
1805      if (!(this.topic instanceof Reference))
1806        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.topic.getClass().getName()
1807            + " was encountered");
1808      return (Reference) this.topic;
1809    }
1810
1811    public boolean hasTopicReference() {
1812      return this != null && this.topic instanceof Reference;
1813    }
1814
1815    public boolean hasTopic() {
1816      return this.topic != null && !this.topic.isEmpty();
1817    }
1818
1819    /**
1820     * @param value {@link #topic} (The entity that the term applies to.)
1821     */
1822    public TermComponent setTopic(Type value) {
1823      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1824        throw new Error("Not the right type for Contract.term.topic[x]: " + value.fhirType());
1825      this.topic = value;
1826      return this;
1827    }
1828
1829    /**
1830     * @return {@link #type} (A legal clause or condition contained within a
1831     *         contract that requires one or both parties to perform a particular
1832     *         requirement by some specified time or prevents one or both parties
1833     *         from performing a particular requirement by some specified time.)
1834     */
1835    public CodeableConcept getType() {
1836      if (this.type == null)
1837        if (Configuration.errorOnAutoCreate())
1838          throw new Error("Attempt to auto-create TermComponent.type");
1839        else if (Configuration.doAutoCreate())
1840          this.type = new CodeableConcept(); // cc
1841      return this.type;
1842    }
1843
1844    public boolean hasType() {
1845      return this.type != null && !this.type.isEmpty();
1846    }
1847
1848    /**
1849     * @param value {@link #type} (A legal clause or condition contained within a
1850     *              contract that requires one or both parties to perform a
1851     *              particular requirement by some specified time or prevents one or
1852     *              both parties from performing a particular requirement by some
1853     *              specified time.)
1854     */
1855    public TermComponent setType(CodeableConcept value) {
1856      this.type = value;
1857      return this;
1858    }
1859
1860    /**
1861     * @return {@link #subType} (A specialized legal clause or condition based on
1862     *         overarching contract type.)
1863     */
1864    public CodeableConcept getSubType() {
1865      if (this.subType == null)
1866        if (Configuration.errorOnAutoCreate())
1867          throw new Error("Attempt to auto-create TermComponent.subType");
1868        else if (Configuration.doAutoCreate())
1869          this.subType = new CodeableConcept(); // cc
1870      return this.subType;
1871    }
1872
1873    public boolean hasSubType() {
1874      return this.subType != null && !this.subType.isEmpty();
1875    }
1876
1877    /**
1878     * @param value {@link #subType} (A specialized legal clause or condition based
1879     *              on overarching contract type.)
1880     */
1881    public TermComponent setSubType(CodeableConcept value) {
1882      this.subType = value;
1883      return this;
1884    }
1885
1886    /**
1887     * @return {@link #text} (Statement of a provision in a policy or a contract.).
1888     *         This is the underlying object with id, value and extensions. The
1889     *         accessor "getText" gives direct access to the value
1890     */
1891    public StringType getTextElement() {
1892      if (this.text == null)
1893        if (Configuration.errorOnAutoCreate())
1894          throw new Error("Attempt to auto-create TermComponent.text");
1895        else if (Configuration.doAutoCreate())
1896          this.text = new StringType(); // bb
1897      return this.text;
1898    }
1899
1900    public boolean hasTextElement() {
1901      return this.text != null && !this.text.isEmpty();
1902    }
1903
1904    public boolean hasText() {
1905      return this.text != null && !this.text.isEmpty();
1906    }
1907
1908    /**
1909     * @param value {@link #text} (Statement of a provision in a policy or a
1910     *              contract.). This is the underlying object with id, value and
1911     *              extensions. The accessor "getText" gives direct access to the
1912     *              value
1913     */
1914    public TermComponent setTextElement(StringType value) {
1915      this.text = value;
1916      return this;
1917    }
1918
1919    /**
1920     * @return Statement of a provision in a policy or a contract.
1921     */
1922    public String getText() {
1923      return this.text == null ? null : this.text.getValue();
1924    }
1925
1926    /**
1927     * @param value Statement of a provision in a policy or a contract.
1928     */
1929    public TermComponent setText(String value) {
1930      if (Utilities.noString(value))
1931        this.text = null;
1932      else {
1933        if (this.text == null)
1934          this.text = new StringType();
1935        this.text.setValue(value);
1936      }
1937      return this;
1938    }
1939
1940    /**
1941     * @return {@link #securityLabel} (Security labels that protect the handling of
1942     *         information about the term and its elements, which may be
1943     *         specifically identified..)
1944     */
1945    public List<SecurityLabelComponent> getSecurityLabel() {
1946      if (this.securityLabel == null)
1947        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1948      return this.securityLabel;
1949    }
1950
1951    /**
1952     * @return Returns a reference to <code>this</code> for easy method chaining
1953     */
1954    public TermComponent setSecurityLabel(List<SecurityLabelComponent> theSecurityLabel) {
1955      this.securityLabel = theSecurityLabel;
1956      return this;
1957    }
1958
1959    public boolean hasSecurityLabel() {
1960      if (this.securityLabel == null)
1961        return false;
1962      for (SecurityLabelComponent item : this.securityLabel)
1963        if (!item.isEmpty())
1964          return true;
1965      return false;
1966    }
1967
1968    public SecurityLabelComponent addSecurityLabel() { // 3
1969      SecurityLabelComponent t = new SecurityLabelComponent();
1970      if (this.securityLabel == null)
1971        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1972      this.securityLabel.add(t);
1973      return t;
1974    }
1975
1976    public TermComponent addSecurityLabel(SecurityLabelComponent t) { // 3
1977      if (t == null)
1978        return this;
1979      if (this.securityLabel == null)
1980        this.securityLabel = new ArrayList<SecurityLabelComponent>();
1981      this.securityLabel.add(t);
1982      return this;
1983    }
1984
1985    /**
1986     * @return The first repetition of repeating field {@link #securityLabel},
1987     *         creating it if it does not already exist
1988     */
1989    public SecurityLabelComponent getSecurityLabelFirstRep() {
1990      if (getSecurityLabel().isEmpty()) {
1991        addSecurityLabel();
1992      }
1993      return getSecurityLabel().get(0);
1994    }
1995
1996    /**
1997     * @return {@link #offer} (The matter of concern in the context of this
1998     *         provision of the agrement.)
1999     */
2000    public ContractOfferComponent getOffer() {
2001      if (this.offer == null)
2002        if (Configuration.errorOnAutoCreate())
2003          throw new Error("Attempt to auto-create TermComponent.offer");
2004        else if (Configuration.doAutoCreate())
2005          this.offer = new ContractOfferComponent(); // cc
2006      return this.offer;
2007    }
2008
2009    public boolean hasOffer() {
2010      return this.offer != null && !this.offer.isEmpty();
2011    }
2012
2013    /**
2014     * @param value {@link #offer} (The matter of concern in the context of this
2015     *              provision of the agrement.)
2016     */
2017    public TermComponent setOffer(ContractOfferComponent value) {
2018      this.offer = value;
2019      return this;
2020    }
2021
2022    /**
2023     * @return {@link #asset} (Contract Term Asset List.)
2024     */
2025    public List<ContractAssetComponent> getAsset() {
2026      if (this.asset == null)
2027        this.asset = new ArrayList<ContractAssetComponent>();
2028      return this.asset;
2029    }
2030
2031    /**
2032     * @return Returns a reference to <code>this</code> for easy method chaining
2033     */
2034    public TermComponent setAsset(List<ContractAssetComponent> theAsset) {
2035      this.asset = theAsset;
2036      return this;
2037    }
2038
2039    public boolean hasAsset() {
2040      if (this.asset == null)
2041        return false;
2042      for (ContractAssetComponent item : this.asset)
2043        if (!item.isEmpty())
2044          return true;
2045      return false;
2046    }
2047
2048    public ContractAssetComponent addAsset() { // 3
2049      ContractAssetComponent t = new ContractAssetComponent();
2050      if (this.asset == null)
2051        this.asset = new ArrayList<ContractAssetComponent>();
2052      this.asset.add(t);
2053      return t;
2054    }
2055
2056    public TermComponent addAsset(ContractAssetComponent t) { // 3
2057      if (t == null)
2058        return this;
2059      if (this.asset == null)
2060        this.asset = new ArrayList<ContractAssetComponent>();
2061      this.asset.add(t);
2062      return this;
2063    }
2064
2065    /**
2066     * @return The first repetition of repeating field {@link #asset}, creating it
2067     *         if it does not already exist
2068     */
2069    public ContractAssetComponent getAssetFirstRep() {
2070      if (getAsset().isEmpty()) {
2071        addAsset();
2072      }
2073      return getAsset().get(0);
2074    }
2075
2076    /**
2077     * @return {@link #action} (An actor taking a role in an activity for which it
2078     *         can be assigned some degree of responsibility for the activity taking
2079     *         place.)
2080     */
2081    public List<ActionComponent> getAction() {
2082      if (this.action == null)
2083        this.action = new ArrayList<ActionComponent>();
2084      return this.action;
2085    }
2086
2087    /**
2088     * @return Returns a reference to <code>this</code> for easy method chaining
2089     */
2090    public TermComponent setAction(List<ActionComponent> theAction) {
2091      this.action = theAction;
2092      return this;
2093    }
2094
2095    public boolean hasAction() {
2096      if (this.action == null)
2097        return false;
2098      for (ActionComponent item : this.action)
2099        if (!item.isEmpty())
2100          return true;
2101      return false;
2102    }
2103
2104    public ActionComponent addAction() { // 3
2105      ActionComponent t = new ActionComponent();
2106      if (this.action == null)
2107        this.action = new ArrayList<ActionComponent>();
2108      this.action.add(t);
2109      return t;
2110    }
2111
2112    public TermComponent addAction(ActionComponent t) { // 3
2113      if (t == null)
2114        return this;
2115      if (this.action == null)
2116        this.action = new ArrayList<ActionComponent>();
2117      this.action.add(t);
2118      return this;
2119    }
2120
2121    /**
2122     * @return The first repetition of repeating field {@link #action}, creating it
2123     *         if it does not already exist
2124     */
2125    public ActionComponent getActionFirstRep() {
2126      if (getAction().isEmpty()) {
2127        addAction();
2128      }
2129      return getAction().get(0);
2130    }
2131
2132    /**
2133     * @return {@link #group} (Nested group of Contract Provisions.)
2134     */
2135    public List<TermComponent> getGroup() {
2136      if (this.group == null)
2137        this.group = new ArrayList<TermComponent>();
2138      return this.group;
2139    }
2140
2141    /**
2142     * @return Returns a reference to <code>this</code> for easy method chaining
2143     */
2144    public TermComponent setGroup(List<TermComponent> theGroup) {
2145      this.group = theGroup;
2146      return this;
2147    }
2148
2149    public boolean hasGroup() {
2150      if (this.group == null)
2151        return false;
2152      for (TermComponent item : this.group)
2153        if (!item.isEmpty())
2154          return true;
2155      return false;
2156    }
2157
2158    public TermComponent addGroup() { // 3
2159      TermComponent t = new TermComponent();
2160      if (this.group == null)
2161        this.group = new ArrayList<TermComponent>();
2162      this.group.add(t);
2163      return t;
2164    }
2165
2166    public TermComponent addGroup(TermComponent t) { // 3
2167      if (t == null)
2168        return this;
2169      if (this.group == null)
2170        this.group = new ArrayList<TermComponent>();
2171      this.group.add(t);
2172      return this;
2173    }
2174
2175    /**
2176     * @return The first repetition of repeating field {@link #group}, creating it
2177     *         if it does not already exist
2178     */
2179    public TermComponent getGroupFirstRep() {
2180      if (getGroup().isEmpty()) {
2181        addGroup();
2182      }
2183      return getGroup().get(0);
2184    }
2185
2186    protected void listChildren(List<Property> children) {
2187      super.listChildren(children);
2188      children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.",
2189          0, 1, identifier));
2190      children.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1, issued));
2191      children.add(new Property("applies", "Period",
2192          "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies));
2193      children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)", "The entity that the term applies to.", 0,
2194          1, topic));
2195      children.add(new Property("type", "CodeableConcept",
2196          "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.",
2197          0, 1, type));
2198      children.add(new Property("subType", "CodeableConcept",
2199          "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType));
2200      children.add(new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1, text));
2201      children.add(new Property("securityLabel", "",
2202          "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..",
2203          0, java.lang.Integer.MAX_VALUE, securityLabel));
2204      children.add(new Property("offer", "", "The matter of concern in the context of this provision of the agrement.",
2205          0, 1, offer));
2206      children.add(new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE, asset));
2207      children.add(new Property("action", "",
2208          "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.",
2209          0, java.lang.Integer.MAX_VALUE, action));
2210      children.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0,
2211          java.lang.Integer.MAX_VALUE, group));
2212    }
2213
2214    @Override
2215    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2216      switch (_hash) {
2217      case -1618432855:
2218        /* identifier */ return new Property("identifier", "Identifier",
2219            "Unique identifier for this particular Contract Provision.", 0, 1, identifier);
2220      case -1179159893:
2221        /* issued */ return new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, 1,
2222            issued);
2223      case -793235316:
2224        /* applies */ return new Property("applies", "Period",
2225            "Relevant time or time-period when this Contract Provision is applicable.", 0, 1, applies);
2226      case -957295375:
2227        /* topic[x] */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2228            "The entity that the term applies to.", 0, 1, topic);
2229      case 110546223:
2230        /* topic */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2231            "The entity that the term applies to.", 0, 1, topic);
2232      case 777778802:
2233        /* topicCodeableConcept */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2234            "The entity that the term applies to.", 0, 1, topic);
2235      case -343345444:
2236        /* topicReference */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
2237            "The entity that the term applies to.", 0, 1, topic);
2238      case 3575610:
2239        /* type */ return new Property("type", "CodeableConcept",
2240            "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.",
2241            0, 1, type);
2242      case -1868521062:
2243        /* subType */ return new Property("subType", "CodeableConcept",
2244            "A specialized legal clause or condition based on overarching contract type.", 0, 1, subType);
2245      case 3556653:
2246        /* text */ return new Property("text", "string", "Statement of a provision in a policy or a contract.", 0, 1,
2247            text);
2248      case -722296940:
2249        /* securityLabel */ return new Property("securityLabel", "",
2250            "Security labels that protect the handling of information about the term and its elements, which may be specifically identified..",
2251            0, java.lang.Integer.MAX_VALUE, securityLabel);
2252      case 105650780:
2253        /* offer */ return new Property("offer", "",
2254            "The matter of concern in the context of this provision of the agrement.", 0, 1, offer);
2255      case 93121264:
2256        /* asset */ return new Property("asset", "", "Contract Term Asset List.", 0, java.lang.Integer.MAX_VALUE,
2257            asset);
2258      case -1422950858:
2259        /* action */ return new Property("action", "",
2260            "An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.",
2261            0, java.lang.Integer.MAX_VALUE, action);
2262      case 98629247:
2263        /* group */ return new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0,
2264            java.lang.Integer.MAX_VALUE, group);
2265      default:
2266        return super.getNamedProperty(_hash, _name, _checkValid);
2267      }
2268
2269    }
2270
2271    @Override
2272    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2273      switch (hash) {
2274      case -1618432855:
2275        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
2276      case -1179159893:
2277        /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // DateTimeType
2278      case -793235316:
2279        /* applies */ return this.applies == null ? new Base[0] : new Base[] { this.applies }; // Period
2280      case 110546223:
2281        /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Type
2282      case 3575610:
2283        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2284      case -1868521062:
2285        /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
2286      case 3556653:
2287        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
2288      case -722296940:
2289        /* securityLabel */ return this.securityLabel == null ? new Base[0]
2290            : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // SecurityLabelComponent
2291      case 105650780:
2292        /* offer */ return this.offer == null ? new Base[0] : new Base[] { this.offer }; // ContractOfferComponent
2293      case 93121264:
2294        /* asset */ return this.asset == null ? new Base[0] : this.asset.toArray(new Base[this.asset.size()]); // ContractAssetComponent
2295      case -1422950858:
2296        /* action */ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionComponent
2297      case 98629247:
2298        /* group */ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // TermComponent
2299      default:
2300        return super.getProperty(hash, name, checkValid);
2301      }
2302
2303    }
2304
2305    @Override
2306    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2307      switch (hash) {
2308      case -1618432855: // identifier
2309        this.identifier = castToIdentifier(value); // Identifier
2310        return value;
2311      case -1179159893: // issued
2312        this.issued = castToDateTime(value); // DateTimeType
2313        return value;
2314      case -793235316: // applies
2315        this.applies = castToPeriod(value); // Period
2316        return value;
2317      case 110546223: // topic
2318        this.topic = castToType(value); // Type
2319        return value;
2320      case 3575610: // type
2321        this.type = castToCodeableConcept(value); // CodeableConcept
2322        return value;
2323      case -1868521062: // subType
2324        this.subType = castToCodeableConcept(value); // CodeableConcept
2325        return value;
2326      case 3556653: // text
2327        this.text = castToString(value); // StringType
2328        return value;
2329      case -722296940: // securityLabel
2330        this.getSecurityLabel().add((SecurityLabelComponent) value); // SecurityLabelComponent
2331        return value;
2332      case 105650780: // offer
2333        this.offer = (ContractOfferComponent) value; // ContractOfferComponent
2334        return value;
2335      case 93121264: // asset
2336        this.getAsset().add((ContractAssetComponent) value); // ContractAssetComponent
2337        return value;
2338      case -1422950858: // action
2339        this.getAction().add((ActionComponent) value); // ActionComponent
2340        return value;
2341      case 98629247: // group
2342        this.getGroup().add((TermComponent) value); // TermComponent
2343        return value;
2344      default:
2345        return super.setProperty(hash, name, value);
2346      }
2347
2348    }
2349
2350    @Override
2351    public Base setProperty(String name, Base value) throws FHIRException {
2352      if (name.equals("identifier")) {
2353        this.identifier = castToIdentifier(value); // Identifier
2354      } else if (name.equals("issued")) {
2355        this.issued = castToDateTime(value); // DateTimeType
2356      } else if (name.equals("applies")) {
2357        this.applies = castToPeriod(value); // Period
2358      } else if (name.equals("topic[x]")) {
2359        this.topic = castToType(value); // Type
2360      } else if (name.equals("type")) {
2361        this.type = castToCodeableConcept(value); // CodeableConcept
2362      } else if (name.equals("subType")) {
2363        this.subType = castToCodeableConcept(value); // CodeableConcept
2364      } else if (name.equals("text")) {
2365        this.text = castToString(value); // StringType
2366      } else if (name.equals("securityLabel")) {
2367        this.getSecurityLabel().add((SecurityLabelComponent) value);
2368      } else if (name.equals("offer")) {
2369        this.offer = (ContractOfferComponent) value; // ContractOfferComponent
2370      } else if (name.equals("asset")) {
2371        this.getAsset().add((ContractAssetComponent) value);
2372      } else if (name.equals("action")) {
2373        this.getAction().add((ActionComponent) value);
2374      } else if (name.equals("group")) {
2375        this.getGroup().add((TermComponent) value);
2376      } else
2377        return super.setProperty(name, value);
2378      return value;
2379    }
2380
2381  @Override
2382  public void removeChild(String name, Base value) throws FHIRException {
2383      if (name.equals("identifier")) {
2384        this.identifier = null;
2385      } else if (name.equals("issued")) {
2386        this.issued = null;
2387      } else if (name.equals("applies")) {
2388        this.applies = null;
2389      } else if (name.equals("topic[x]")) {
2390        this.topic = null;
2391      } else if (name.equals("type")) {
2392        this.type = null;
2393      } else if (name.equals("subType")) {
2394        this.subType = null;
2395      } else if (name.equals("text")) {
2396        this.text = null;
2397      } else if (name.equals("securityLabel")) {
2398        this.getSecurityLabel().remove((SecurityLabelComponent) value);
2399      } else if (name.equals("offer")) {
2400        this.offer = (ContractOfferComponent) value; // ContractOfferComponent
2401      } else if (name.equals("asset")) {
2402        this.getAsset().remove((ContractAssetComponent) value);
2403      } else if (name.equals("action")) {
2404        this.getAction().remove((ActionComponent) value);
2405      } else if (name.equals("group")) {
2406        this.getGroup().remove((TermComponent) value);
2407      } else
2408        super.removeChild(name, value);
2409      
2410    }
2411
2412    @Override
2413    public Base makeProperty(int hash, String name) throws FHIRException {
2414      switch (hash) {
2415      case -1618432855:
2416        return getIdentifier();
2417      case -1179159893:
2418        return getIssuedElement();
2419      case -793235316:
2420        return getApplies();
2421      case -957295375:
2422        return getTopic();
2423      case 110546223:
2424        return getTopic();
2425      case 3575610:
2426        return getType();
2427      case -1868521062:
2428        return getSubType();
2429      case 3556653:
2430        return getTextElement();
2431      case -722296940:
2432        return addSecurityLabel();
2433      case 105650780:
2434        return getOffer();
2435      case 93121264:
2436        return addAsset();
2437      case -1422950858:
2438        return addAction();
2439      case 98629247:
2440        return addGroup();
2441      default:
2442        return super.makeProperty(hash, name);
2443      }
2444
2445    }
2446
2447    @Override
2448    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2449      switch (hash) {
2450      case -1618432855:
2451        /* identifier */ return new String[] { "Identifier" };
2452      case -1179159893:
2453        /* issued */ return new String[] { "dateTime" };
2454      case -793235316:
2455        /* applies */ return new String[] { "Period" };
2456      case 110546223:
2457        /* topic */ return new String[] { "CodeableConcept", "Reference" };
2458      case 3575610:
2459        /* type */ return new String[] { "CodeableConcept" };
2460      case -1868521062:
2461        /* subType */ return new String[] { "CodeableConcept" };
2462      case 3556653:
2463        /* text */ return new String[] { "string" };
2464      case -722296940:
2465        /* securityLabel */ return new String[] {};
2466      case 105650780:
2467        /* offer */ return new String[] {};
2468      case 93121264:
2469        /* asset */ return new String[] {};
2470      case -1422950858:
2471        /* action */ return new String[] {};
2472      case 98629247:
2473        /* group */ return new String[] { "@Contract.term" };
2474      default:
2475        return super.getTypesForProperty(hash, name);
2476      }
2477
2478    }
2479
2480    @Override
2481    public Base addChild(String name) throws FHIRException {
2482      if (name.equals("identifier")) {
2483        this.identifier = new Identifier();
2484        return this.identifier;
2485      } else if (name.equals("issued")) {
2486        throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
2487      } else if (name.equals("applies")) {
2488        this.applies = new Period();
2489        return this.applies;
2490      } else if (name.equals("topicCodeableConcept")) {
2491        this.topic = new CodeableConcept();
2492        return this.topic;
2493      } else if (name.equals("topicReference")) {
2494        this.topic = new Reference();
2495        return this.topic;
2496      } else if (name.equals("type")) {
2497        this.type = new CodeableConcept();
2498        return this.type;
2499      } else if (name.equals("subType")) {
2500        this.subType = new CodeableConcept();
2501        return this.subType;
2502      } else if (name.equals("text")) {
2503        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
2504      } else if (name.equals("securityLabel")) {
2505        return addSecurityLabel();
2506      } else if (name.equals("offer")) {
2507        this.offer = new ContractOfferComponent();
2508        return this.offer;
2509      } else if (name.equals("asset")) {
2510        return addAsset();
2511      } else if (name.equals("action")) {
2512        return addAction();
2513      } else if (name.equals("group")) {
2514        return addGroup();
2515      } else
2516        return super.addChild(name);
2517    }
2518
2519    public TermComponent copy() {
2520      TermComponent dst = new TermComponent();
2521      copyValues(dst);
2522      return dst;
2523    }
2524
2525    public void copyValues(TermComponent dst) {
2526      super.copyValues(dst);
2527      dst.identifier = identifier == null ? null : identifier.copy();
2528      dst.issued = issued == null ? null : issued.copy();
2529      dst.applies = applies == null ? null : applies.copy();
2530      dst.topic = topic == null ? null : topic.copy();
2531      dst.type = type == null ? null : type.copy();
2532      dst.subType = subType == null ? null : subType.copy();
2533      dst.text = text == null ? null : text.copy();
2534      if (securityLabel != null) {
2535        dst.securityLabel = new ArrayList<SecurityLabelComponent>();
2536        for (SecurityLabelComponent i : securityLabel)
2537          dst.securityLabel.add(i.copy());
2538      }
2539      ;
2540      dst.offer = offer == null ? null : offer.copy();
2541      if (asset != null) {
2542        dst.asset = new ArrayList<ContractAssetComponent>();
2543        for (ContractAssetComponent i : asset)
2544          dst.asset.add(i.copy());
2545      }
2546      ;
2547      if (action != null) {
2548        dst.action = new ArrayList<ActionComponent>();
2549        for (ActionComponent i : action)
2550          dst.action.add(i.copy());
2551      }
2552      ;
2553      if (group != null) {
2554        dst.group = new ArrayList<TermComponent>();
2555        for (TermComponent i : group)
2556          dst.group.add(i.copy());
2557      }
2558      ;
2559    }
2560
2561    @Override
2562    public boolean equalsDeep(Base other_) {
2563      if (!super.equalsDeep(other_))
2564        return false;
2565      if (!(other_ instanceof TermComponent))
2566        return false;
2567      TermComponent o = (TermComponent) other_;
2568      return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true)
2569          && compareDeep(applies, o.applies, true) && compareDeep(topic, o.topic, true)
2570          && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(text, o.text, true)
2571          && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(offer, o.offer, true)
2572          && compareDeep(asset, o.asset, true) && compareDeep(action, o.action, true)
2573          && compareDeep(group, o.group, true);
2574    }
2575
2576    @Override
2577    public boolean equalsShallow(Base other_) {
2578      if (!super.equalsShallow(other_))
2579        return false;
2580      if (!(other_ instanceof TermComponent))
2581        return false;
2582      TermComponent o = (TermComponent) other_;
2583      return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
2584    }
2585
2586    public boolean isEmpty() {
2587      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, issued, applies, topic, type, subType,
2588          text, securityLabel, offer, asset, action, group);
2589    }
2590
2591    public String fhirType() {
2592      return "Contract.term";
2593
2594    }
2595
2596  }
2597
2598  @Block()
2599  public static class SecurityLabelComponent extends BackboneElement implements IBaseBackboneElement {
2600    /**
2601     * Number used to link this term or term element to the applicable Security
2602     * Label.
2603     */
2604    @Child(name = "number", type = {
2605        UnsignedIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2606    @Description(shortDefinition = "Link to Security Labels", formalDefinition = "Number used to link this term or term element to the applicable Security Label.")
2607    protected List<UnsignedIntType> number;
2608
2609    /**
2610     * Security label privacy tag that species the level of confidentiality
2611     * protection required for this term and/or term elements.
2612     */
2613    @Child(name = "classification", type = {
2614        Coding.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2615    @Description(shortDefinition = "Confidentiality Protection", formalDefinition = "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.")
2616    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-classification")
2617    protected Coding classification;
2618
2619    /**
2620     * Security label privacy tag that species the applicable privacy and security
2621     * policies governing this term and/or term elements.
2622     */
2623    @Child(name = "category", type = {
2624        Coding.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2625    @Description(shortDefinition = "Applicable Policy", formalDefinition = "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.")
2626    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-category")
2627    protected List<Coding> category;
2628
2629    /**
2630     * Security label privacy tag that species the manner in which term and/or term
2631     * elements are to be protected.
2632     */
2633    @Child(name = "control", type = {
2634        Coding.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2635    @Description(shortDefinition = "Handling Instructions", formalDefinition = "Security label privacy tag that species the manner in which term and/or term elements are to be protected.")
2636    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-security-control")
2637    protected List<Coding> control;
2638
2639    private static final long serialVersionUID = 788281758L;
2640
2641    /**
2642     * Constructor
2643     */
2644    public SecurityLabelComponent() {
2645      super();
2646    }
2647
2648    /**
2649     * Constructor
2650     */
2651    public SecurityLabelComponent(Coding classification) {
2652      super();
2653      this.classification = classification;
2654    }
2655
2656    /**
2657     * @return {@link #number} (Number used to link this term or term element to the
2658     *         applicable Security Label.)
2659     */
2660    public List<UnsignedIntType> getNumber() {
2661      if (this.number == null)
2662        this.number = new ArrayList<UnsignedIntType>();
2663      return this.number;
2664    }
2665
2666    /**
2667     * @return Returns a reference to <code>this</code> for easy method chaining
2668     */
2669    public SecurityLabelComponent setNumber(List<UnsignedIntType> theNumber) {
2670      this.number = theNumber;
2671      return this;
2672    }
2673
2674    public boolean hasNumber() {
2675      if (this.number == null)
2676        return false;
2677      for (UnsignedIntType item : this.number)
2678        if (!item.isEmpty())
2679          return true;
2680      return false;
2681    }
2682
2683    /**
2684     * @return {@link #number} (Number used to link this term or term element to the
2685     *         applicable Security Label.)
2686     */
2687    public UnsignedIntType addNumberElement() {// 2
2688      UnsignedIntType t = new UnsignedIntType();
2689      if (this.number == null)
2690        this.number = new ArrayList<UnsignedIntType>();
2691      this.number.add(t);
2692      return t;
2693    }
2694
2695    /**
2696     * @param value {@link #number} (Number used to link this term or term element
2697     *              to the applicable Security Label.)
2698     */
2699    public SecurityLabelComponent addNumber(int value) { // 1
2700      UnsignedIntType t = new UnsignedIntType();
2701      t.setValue(value);
2702      if (this.number == null)
2703        this.number = new ArrayList<UnsignedIntType>();
2704      this.number.add(t);
2705      return this;
2706    }
2707
2708    /**
2709     * @param value {@link #number} (Number used to link this term or term element
2710     *              to the applicable Security Label.)
2711     */
2712    public boolean hasNumber(int value) {
2713      if (this.number == null)
2714        return false;
2715      for (UnsignedIntType v : this.number)
2716        if (v.getValue().equals(value)) // unsignedInt
2717          return true;
2718      return false;
2719    }
2720
2721    /**
2722     * @return {@link #classification} (Security label privacy tag that species the
2723     *         level of confidentiality protection required for this term and/or
2724     *         term elements.)
2725     */
2726    public Coding getClassification() {
2727      if (this.classification == null)
2728        if (Configuration.errorOnAutoCreate())
2729          throw new Error("Attempt to auto-create SecurityLabelComponent.classification");
2730        else if (Configuration.doAutoCreate())
2731          this.classification = new Coding(); // cc
2732      return this.classification;
2733    }
2734
2735    public boolean hasClassification() {
2736      return this.classification != null && !this.classification.isEmpty();
2737    }
2738
2739    /**
2740     * @param value {@link #classification} (Security label privacy tag that species
2741     *              the level of confidentiality protection required for this term
2742     *              and/or term elements.)
2743     */
2744    public SecurityLabelComponent setClassification(Coding value) {
2745      this.classification = value;
2746      return this;
2747    }
2748
2749    /**
2750     * @return {@link #category} (Security label privacy tag that species the
2751     *         applicable privacy and security policies governing this term and/or
2752     *         term elements.)
2753     */
2754    public List<Coding> getCategory() {
2755      if (this.category == null)
2756        this.category = new ArrayList<Coding>();
2757      return this.category;
2758    }
2759
2760    /**
2761     * @return Returns a reference to <code>this</code> for easy method chaining
2762     */
2763    public SecurityLabelComponent setCategory(List<Coding> theCategory) {
2764      this.category = theCategory;
2765      return this;
2766    }
2767
2768    public boolean hasCategory() {
2769      if (this.category == null)
2770        return false;
2771      for (Coding item : this.category)
2772        if (!item.isEmpty())
2773          return true;
2774      return false;
2775    }
2776
2777    public Coding addCategory() { // 3
2778      Coding t = new Coding();
2779      if (this.category == null)
2780        this.category = new ArrayList<Coding>();
2781      this.category.add(t);
2782      return t;
2783    }
2784
2785    public SecurityLabelComponent addCategory(Coding t) { // 3
2786      if (t == null)
2787        return this;
2788      if (this.category == null)
2789        this.category = new ArrayList<Coding>();
2790      this.category.add(t);
2791      return this;
2792    }
2793
2794    /**
2795     * @return The first repetition of repeating field {@link #category}, creating
2796     *         it if it does not already exist
2797     */
2798    public Coding getCategoryFirstRep() {
2799      if (getCategory().isEmpty()) {
2800        addCategory();
2801      }
2802      return getCategory().get(0);
2803    }
2804
2805    /**
2806     * @return {@link #control} (Security label privacy tag that species the manner
2807     *         in which term and/or term elements are to be protected.)
2808     */
2809    public List<Coding> getControl() {
2810      if (this.control == null)
2811        this.control = new ArrayList<Coding>();
2812      return this.control;
2813    }
2814
2815    /**
2816     * @return Returns a reference to <code>this</code> for easy method chaining
2817     */
2818    public SecurityLabelComponent setControl(List<Coding> theControl) {
2819      this.control = theControl;
2820      return this;
2821    }
2822
2823    public boolean hasControl() {
2824      if (this.control == null)
2825        return false;
2826      for (Coding item : this.control)
2827        if (!item.isEmpty())
2828          return true;
2829      return false;
2830    }
2831
2832    public Coding addControl() { // 3
2833      Coding t = new Coding();
2834      if (this.control == null)
2835        this.control = new ArrayList<Coding>();
2836      this.control.add(t);
2837      return t;
2838    }
2839
2840    public SecurityLabelComponent addControl(Coding t) { // 3
2841      if (t == null)
2842        return this;
2843      if (this.control == null)
2844        this.control = new ArrayList<Coding>();
2845      this.control.add(t);
2846      return this;
2847    }
2848
2849    /**
2850     * @return The first repetition of repeating field {@link #control}, creating it
2851     *         if it does not already exist
2852     */
2853    public Coding getControlFirstRep() {
2854      if (getControl().isEmpty()) {
2855        addControl();
2856      }
2857      return getControl().get(0);
2858    }
2859
2860    protected void listChildren(List<Property> children) {
2861      super.listChildren(children);
2862      children.add(new Property("number", "unsignedInt",
2863          "Number used to link this term or term element to the applicable Security Label.", 0,
2864          java.lang.Integer.MAX_VALUE, number));
2865      children.add(new Property("classification", "Coding",
2866          "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.",
2867          0, 1, classification));
2868      children.add(new Property("category", "Coding",
2869          "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.",
2870          0, java.lang.Integer.MAX_VALUE, category));
2871      children.add(new Property("control", "Coding",
2872          "Security label privacy tag that species the manner in which term and/or term elements are to be protected.",
2873          0, java.lang.Integer.MAX_VALUE, control));
2874    }
2875
2876    @Override
2877    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2878      switch (_hash) {
2879      case -1034364087:
2880        /* number */ return new Property("number", "unsignedInt",
2881            "Number used to link this term or term element to the applicable Security Label.", 0,
2882            java.lang.Integer.MAX_VALUE, number);
2883      case 382350310:
2884        /* classification */ return new Property("classification", "Coding",
2885            "Security label privacy tag that species the level of confidentiality protection required for this term and/or term elements.",
2886            0, 1, classification);
2887      case 50511102:
2888        /* category */ return new Property("category", "Coding",
2889            "Security label privacy tag that species the applicable privacy and security policies governing this term and/or term elements.",
2890            0, java.lang.Integer.MAX_VALUE, category);
2891      case 951543133:
2892        /* control */ return new Property("control", "Coding",
2893            "Security label privacy tag that species the manner in which term and/or term elements are to be protected.",
2894            0, java.lang.Integer.MAX_VALUE, control);
2895      default:
2896        return super.getNamedProperty(_hash, _name, _checkValid);
2897      }
2898
2899    }
2900
2901    @Override
2902    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2903      switch (hash) {
2904      case -1034364087:
2905        /* number */ return this.number == null ? new Base[0] : this.number.toArray(new Base[this.number.size()]); // UnsignedIntType
2906      case 382350310:
2907        /* classification */ return this.classification == null ? new Base[0] : new Base[] { this.classification }; // Coding
2908      case 50511102:
2909        /* category */ return this.category == null ? new Base[0]
2910            : this.category.toArray(new Base[this.category.size()]); // Coding
2911      case 951543133:
2912        /* control */ return this.control == null ? new Base[0] : this.control.toArray(new Base[this.control.size()]); // Coding
2913      default:
2914        return super.getProperty(hash, name, checkValid);
2915      }
2916
2917    }
2918
2919    @Override
2920    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2921      switch (hash) {
2922      case -1034364087: // number
2923        this.getNumber().add(castToUnsignedInt(value)); // UnsignedIntType
2924        return value;
2925      case 382350310: // classification
2926        this.classification = castToCoding(value); // Coding
2927        return value;
2928      case 50511102: // category
2929        this.getCategory().add(castToCoding(value)); // Coding
2930        return value;
2931      case 951543133: // control
2932        this.getControl().add(castToCoding(value)); // Coding
2933        return value;
2934      default:
2935        return super.setProperty(hash, name, value);
2936      }
2937
2938    }
2939
2940    @Override
2941    public Base setProperty(String name, Base value) throws FHIRException {
2942      if (name.equals("number")) {
2943        this.getNumber().add(castToUnsignedInt(value));
2944      } else if (name.equals("classification")) {
2945        this.classification = castToCoding(value); // Coding
2946      } else if (name.equals("category")) {
2947        this.getCategory().add(castToCoding(value));
2948      } else if (name.equals("control")) {
2949        this.getControl().add(castToCoding(value));
2950      } else
2951        return super.setProperty(name, value);
2952      return value;
2953    }
2954
2955  @Override
2956  public void removeChild(String name, Base value) throws FHIRException {
2957      if (name.equals("number")) {
2958        this.getNumber().remove(castToUnsignedInt(value));
2959      } else if (name.equals("classification")) {
2960        this.classification = null;
2961      } else if (name.equals("category")) {
2962        this.getCategory().remove(castToCoding(value));
2963      } else if (name.equals("control")) {
2964        this.getControl().remove(castToCoding(value));
2965      } else
2966        super.removeChild(name, value);
2967      
2968    }
2969
2970    @Override
2971    public Base makeProperty(int hash, String name) throws FHIRException {
2972      switch (hash) {
2973      case -1034364087:
2974        return addNumberElement();
2975      case 382350310:
2976        return getClassification();
2977      case 50511102:
2978        return addCategory();
2979      case 951543133:
2980        return addControl();
2981      default:
2982        return super.makeProperty(hash, name);
2983      }
2984
2985    }
2986
2987    @Override
2988    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2989      switch (hash) {
2990      case -1034364087:
2991        /* number */ return new String[] { "unsignedInt" };
2992      case 382350310:
2993        /* classification */ return new String[] { "Coding" };
2994      case 50511102:
2995        /* category */ return new String[] { "Coding" };
2996      case 951543133:
2997        /* control */ return new String[] { "Coding" };
2998      default:
2999        return super.getTypesForProperty(hash, name);
3000      }
3001
3002    }
3003
3004    @Override
3005    public Base addChild(String name) throws FHIRException {
3006      if (name.equals("number")) {
3007        throw new FHIRException("Cannot call addChild on a singleton property Contract.number");
3008      } else if (name.equals("classification")) {
3009        this.classification = new Coding();
3010        return this.classification;
3011      } else if (name.equals("category")) {
3012        return addCategory();
3013      } else if (name.equals("control")) {
3014        return addControl();
3015      } else
3016        return super.addChild(name);
3017    }
3018
3019    public SecurityLabelComponent copy() {
3020      SecurityLabelComponent dst = new SecurityLabelComponent();
3021      copyValues(dst);
3022      return dst;
3023    }
3024
3025    public void copyValues(SecurityLabelComponent dst) {
3026      super.copyValues(dst);
3027      if (number != null) {
3028        dst.number = new ArrayList<UnsignedIntType>();
3029        for (UnsignedIntType i : number)
3030          dst.number.add(i.copy());
3031      }
3032      ;
3033      dst.classification = classification == null ? null : classification.copy();
3034      if (category != null) {
3035        dst.category = new ArrayList<Coding>();
3036        for (Coding i : category)
3037          dst.category.add(i.copy());
3038      }
3039      ;
3040      if (control != null) {
3041        dst.control = new ArrayList<Coding>();
3042        for (Coding i : control)
3043          dst.control.add(i.copy());
3044      }
3045      ;
3046    }
3047
3048    @Override
3049    public boolean equalsDeep(Base other_) {
3050      if (!super.equalsDeep(other_))
3051        return false;
3052      if (!(other_ instanceof SecurityLabelComponent))
3053        return false;
3054      SecurityLabelComponent o = (SecurityLabelComponent) other_;
3055      return compareDeep(number, o.number, true) && compareDeep(classification, o.classification, true)
3056          && compareDeep(category, o.category, true) && compareDeep(control, o.control, true);
3057    }
3058
3059    @Override
3060    public boolean equalsShallow(Base other_) {
3061      if (!super.equalsShallow(other_))
3062        return false;
3063      if (!(other_ instanceof SecurityLabelComponent))
3064        return false;
3065      SecurityLabelComponent o = (SecurityLabelComponent) other_;
3066      return compareValues(number, o.number, true);
3067    }
3068
3069    public boolean isEmpty() {
3070      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, classification, category, control);
3071    }
3072
3073    public String fhirType() {
3074      return "Contract.term.securityLabel";
3075
3076    }
3077
3078  }
3079
3080  @Block()
3081  public static class ContractOfferComponent extends BackboneElement implements IBaseBackboneElement {
3082    /**
3083     * Unique identifier for this particular Contract Provision.
3084     */
3085    @Child(name = "identifier", type = {
3086        Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3087    @Description(shortDefinition = "Offer business ID", formalDefinition = "Unique identifier for this particular Contract Provision.")
3088    protected List<Identifier> identifier;
3089
3090    /**
3091     * Offer Recipient.
3092     */
3093    @Child(name = "party", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3094    @Description(shortDefinition = "Offer Recipient", formalDefinition = "Offer Recipient.")
3095    protected List<ContractPartyComponent> party;
3096
3097    /**
3098     * The owner of an asset has the residual control rights over the asset: the
3099     * right to decide all usages of the asset in any way not inconsistent with a
3100     * prior contract, custom, or law (Hart, 1995, p. 30).
3101     */
3102    @Child(name = "topic", type = { Reference.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
3103    @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).")
3104    protected Reference topic;
3105
3106    /**
3107     * The actual object that is the target of the reference (The owner of an asset
3108     * has the residual control rights over the asset: the right to decide all
3109     * usages of the asset in any way not inconsistent with a prior contract,
3110     * custom, or law (Hart, 1995, p. 30).)
3111     */
3112    protected Resource topicTarget;
3113
3114    /**
3115     * Type of Contract Provision such as specific requirements, purposes for
3116     * actions, obligations, prohibitions, e.g. life time maximum benefit.
3117     */
3118    @Child(name = "type", type = {
3119        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
3120    @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.")
3121    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-term-type")
3122    protected CodeableConcept type;
3123
3124    /**
3125     * Type of choice made by accepting party with respect to an offer made by an
3126     * offeror/ grantee.
3127     */
3128    @Child(name = "decision", type = {
3129        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3130    @Description(shortDefinition = "Accepting party choice", formalDefinition = "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.")
3131    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActConsentDirective")
3132    protected CodeableConcept decision;
3133
3134    /**
3135     * How the decision about a Contract was conveyed.
3136     */
3137    @Child(name = "decisionMode", type = {
3138        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3139    @Description(shortDefinition = "How decision is conveyed", formalDefinition = "How the decision about a Contract was conveyed.")
3140    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-decision-mode")
3141    protected List<CodeableConcept> decisionMode;
3142
3143    /**
3144     * Response to offer text.
3145     */
3146    @Child(name = "answer", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3147    @Description(shortDefinition = "Response to offer text", formalDefinition = "Response to offer text.")
3148    protected List<AnswerComponent> answer;
3149
3150    /**
3151     * Human readable form of this Contract Offer.
3152     */
3153    @Child(name = "text", type = { StringType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
3154    @Description(shortDefinition = "Human readable offer text", formalDefinition = "Human readable form of this Contract Offer.")
3155    protected StringType text;
3156
3157    /**
3158     * The id of the clause or question text of the offer in the referenced
3159     * questionnaire/response.
3160     */
3161    @Child(name = "linkId", type = {
3162        StringType.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3163    @Description(shortDefinition = "Pointer to text", formalDefinition = "The id of the clause or question text of the offer in the referenced questionnaire/response.")
3164    protected List<StringType> linkId;
3165
3166    /**
3167     * Security labels that protects the offer.
3168     */
3169    @Child(name = "securityLabelNumber", type = {
3170        UnsignedIntType.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3171    @Description(shortDefinition = "Offer restriction numbers", formalDefinition = "Security labels that protects the offer.")
3172    protected List<UnsignedIntType> securityLabelNumber;
3173
3174    private static final long serialVersionUID = -395674449L;
3175
3176    /**
3177     * Constructor
3178     */
3179    public ContractOfferComponent() {
3180      super();
3181    }
3182
3183    /**
3184     * @return {@link #identifier} (Unique identifier for this particular Contract
3185     *         Provision.)
3186     */
3187    public List<Identifier> getIdentifier() {
3188      if (this.identifier == null)
3189        this.identifier = new ArrayList<Identifier>();
3190      return this.identifier;
3191    }
3192
3193    /**
3194     * @return Returns a reference to <code>this</code> for easy method chaining
3195     */
3196    public ContractOfferComponent setIdentifier(List<Identifier> theIdentifier) {
3197      this.identifier = theIdentifier;
3198      return this;
3199    }
3200
3201    public boolean hasIdentifier() {
3202      if (this.identifier == null)
3203        return false;
3204      for (Identifier item : this.identifier)
3205        if (!item.isEmpty())
3206          return true;
3207      return false;
3208    }
3209
3210    public Identifier addIdentifier() { // 3
3211      Identifier t = new Identifier();
3212      if (this.identifier == null)
3213        this.identifier = new ArrayList<Identifier>();
3214      this.identifier.add(t);
3215      return t;
3216    }
3217
3218    public ContractOfferComponent addIdentifier(Identifier t) { // 3
3219      if (t == null)
3220        return this;
3221      if (this.identifier == null)
3222        this.identifier = new ArrayList<Identifier>();
3223      this.identifier.add(t);
3224      return this;
3225    }
3226
3227    /**
3228     * @return The first repetition of repeating field {@link #identifier}, creating
3229     *         it if it does not already exist
3230     */
3231    public Identifier getIdentifierFirstRep() {
3232      if (getIdentifier().isEmpty()) {
3233        addIdentifier();
3234      }
3235      return getIdentifier().get(0);
3236    }
3237
3238    /**
3239     * @return {@link #party} (Offer Recipient.)
3240     */
3241    public List<ContractPartyComponent> getParty() {
3242      if (this.party == null)
3243        this.party = new ArrayList<ContractPartyComponent>();
3244      return this.party;
3245    }
3246
3247    /**
3248     * @return Returns a reference to <code>this</code> for easy method chaining
3249     */
3250    public ContractOfferComponent setParty(List<ContractPartyComponent> theParty) {
3251      this.party = theParty;
3252      return this;
3253    }
3254
3255    public boolean hasParty() {
3256      if (this.party == null)
3257        return false;
3258      for (ContractPartyComponent item : this.party)
3259        if (!item.isEmpty())
3260          return true;
3261      return false;
3262    }
3263
3264    public ContractPartyComponent addParty() { // 3
3265      ContractPartyComponent t = new ContractPartyComponent();
3266      if (this.party == null)
3267        this.party = new ArrayList<ContractPartyComponent>();
3268      this.party.add(t);
3269      return t;
3270    }
3271
3272    public ContractOfferComponent addParty(ContractPartyComponent t) { // 3
3273      if (t == null)
3274        return this;
3275      if (this.party == null)
3276        this.party = new ArrayList<ContractPartyComponent>();
3277      this.party.add(t);
3278      return this;
3279    }
3280
3281    /**
3282     * @return The first repetition of repeating field {@link #party}, creating it
3283     *         if it does not already exist
3284     */
3285    public ContractPartyComponent getPartyFirstRep() {
3286      if (getParty().isEmpty()) {
3287        addParty();
3288      }
3289      return getParty().get(0);
3290    }
3291
3292    /**
3293     * @return {@link #topic} (The owner of an asset has the residual control rights
3294     *         over the asset: the right to decide all usages of the asset in any
3295     *         way not inconsistent with a prior contract, custom, or law (Hart,
3296     *         1995, p. 30).)
3297     */
3298    public Reference getTopic() {
3299      if (this.topic == null)
3300        if (Configuration.errorOnAutoCreate())
3301          throw new Error("Attempt to auto-create ContractOfferComponent.topic");
3302        else if (Configuration.doAutoCreate())
3303          this.topic = new Reference(); // cc
3304      return this.topic;
3305    }
3306
3307    public boolean hasTopic() {
3308      return this.topic != null && !this.topic.isEmpty();
3309    }
3310
3311    /**
3312     * @param value {@link #topic} (The owner of an asset has the residual control
3313     *              rights over the asset: the right to decide all usages of the
3314     *              asset in any way not inconsistent with a prior contract, custom,
3315     *              or law (Hart, 1995, p. 30).)
3316     */
3317    public ContractOfferComponent setTopic(Reference value) {
3318      this.topic = value;
3319      return this;
3320    }
3321
3322    /**
3323     * @return {@link #topic} The actual object that is the target of the reference.
3324     *         The reference library doesn't populate this, but you can use it to
3325     *         hold the resource if you resolve it. (The owner of an asset has the
3326     *         residual control rights over the asset: the right to decide all
3327     *         usages of the asset in any way not inconsistent with a prior
3328     *         contract, custom, or law (Hart, 1995, p. 30).)
3329     */
3330    public Resource getTopicTarget() {
3331      return this.topicTarget;
3332    }
3333
3334    /**
3335     * @param value {@link #topic} The actual object that is the target of the
3336     *              reference. The reference library doesn't use these, but you can
3337     *              use it to hold the resource if you resolve it. (The owner of an
3338     *              asset has the residual control rights over the asset: the right
3339     *              to decide all usages of the asset in any way not inconsistent
3340     *              with a prior contract, custom, or law (Hart, 1995, p. 30).)
3341     */
3342    public ContractOfferComponent setTopicTarget(Resource value) {
3343      this.topicTarget = value;
3344      return this;
3345    }
3346
3347    /**
3348     * @return {@link #type} (Type of Contract Provision such as specific
3349     *         requirements, purposes for actions, obligations, prohibitions, e.g.
3350     *         life time maximum benefit.)
3351     */
3352    public CodeableConcept getType() {
3353      if (this.type == null)
3354        if (Configuration.errorOnAutoCreate())
3355          throw new Error("Attempt to auto-create ContractOfferComponent.type");
3356        else if (Configuration.doAutoCreate())
3357          this.type = new CodeableConcept(); // cc
3358      return this.type;
3359    }
3360
3361    public boolean hasType() {
3362      return this.type != null && !this.type.isEmpty();
3363    }
3364
3365    /**
3366     * @param value {@link #type} (Type of Contract Provision such as specific
3367     *              requirements, purposes for actions, obligations, prohibitions,
3368     *              e.g. life time maximum benefit.)
3369     */
3370    public ContractOfferComponent setType(CodeableConcept value) {
3371      this.type = value;
3372      return this;
3373    }
3374
3375    /**
3376     * @return {@link #decision} (Type of choice made by accepting party with
3377     *         respect to an offer made by an offeror/ grantee.)
3378     */
3379    public CodeableConcept getDecision() {
3380      if (this.decision == null)
3381        if (Configuration.errorOnAutoCreate())
3382          throw new Error("Attempt to auto-create ContractOfferComponent.decision");
3383        else if (Configuration.doAutoCreate())
3384          this.decision = new CodeableConcept(); // cc
3385      return this.decision;
3386    }
3387
3388    public boolean hasDecision() {
3389      return this.decision != null && !this.decision.isEmpty();
3390    }
3391
3392    /**
3393     * @param value {@link #decision} (Type of choice made by accepting party with
3394     *              respect to an offer made by an offeror/ grantee.)
3395     */
3396    public ContractOfferComponent setDecision(CodeableConcept value) {
3397      this.decision = value;
3398      return this;
3399    }
3400
3401    /**
3402     * @return {@link #decisionMode} (How the decision about a Contract was
3403     *         conveyed.)
3404     */
3405    public List<CodeableConcept> getDecisionMode() {
3406      if (this.decisionMode == null)
3407        this.decisionMode = new ArrayList<CodeableConcept>();
3408      return this.decisionMode;
3409    }
3410
3411    /**
3412     * @return Returns a reference to <code>this</code> for easy method chaining
3413     */
3414    public ContractOfferComponent setDecisionMode(List<CodeableConcept> theDecisionMode) {
3415      this.decisionMode = theDecisionMode;
3416      return this;
3417    }
3418
3419    public boolean hasDecisionMode() {
3420      if (this.decisionMode == null)
3421        return false;
3422      for (CodeableConcept item : this.decisionMode)
3423        if (!item.isEmpty())
3424          return true;
3425      return false;
3426    }
3427
3428    public CodeableConcept addDecisionMode() { // 3
3429      CodeableConcept t = new CodeableConcept();
3430      if (this.decisionMode == null)
3431        this.decisionMode = new ArrayList<CodeableConcept>();
3432      this.decisionMode.add(t);
3433      return t;
3434    }
3435
3436    public ContractOfferComponent addDecisionMode(CodeableConcept t) { // 3
3437      if (t == null)
3438        return this;
3439      if (this.decisionMode == null)
3440        this.decisionMode = new ArrayList<CodeableConcept>();
3441      this.decisionMode.add(t);
3442      return this;
3443    }
3444
3445    /**
3446     * @return The first repetition of repeating field {@link #decisionMode},
3447     *         creating it if it does not already exist
3448     */
3449    public CodeableConcept getDecisionModeFirstRep() {
3450      if (getDecisionMode().isEmpty()) {
3451        addDecisionMode();
3452      }
3453      return getDecisionMode().get(0);
3454    }
3455
3456    /**
3457     * @return {@link #answer} (Response to offer text.)
3458     */
3459    public List<AnswerComponent> getAnswer() {
3460      if (this.answer == null)
3461        this.answer = new ArrayList<AnswerComponent>();
3462      return this.answer;
3463    }
3464
3465    /**
3466     * @return Returns a reference to <code>this</code> for easy method chaining
3467     */
3468    public ContractOfferComponent setAnswer(List<AnswerComponent> theAnswer) {
3469      this.answer = theAnswer;
3470      return this;
3471    }
3472
3473    public boolean hasAnswer() {
3474      if (this.answer == null)
3475        return false;
3476      for (AnswerComponent item : this.answer)
3477        if (!item.isEmpty())
3478          return true;
3479      return false;
3480    }
3481
3482    public AnswerComponent addAnswer() { // 3
3483      AnswerComponent t = new AnswerComponent();
3484      if (this.answer == null)
3485        this.answer = new ArrayList<AnswerComponent>();
3486      this.answer.add(t);
3487      return t;
3488    }
3489
3490    public ContractOfferComponent addAnswer(AnswerComponent t) { // 3
3491      if (t == null)
3492        return this;
3493      if (this.answer == null)
3494        this.answer = new ArrayList<AnswerComponent>();
3495      this.answer.add(t);
3496      return this;
3497    }
3498
3499    /**
3500     * @return The first repetition of repeating field {@link #answer}, creating it
3501     *         if it does not already exist
3502     */
3503    public AnswerComponent getAnswerFirstRep() {
3504      if (getAnswer().isEmpty()) {
3505        addAnswer();
3506      }
3507      return getAnswer().get(0);
3508    }
3509
3510    /**
3511     * @return {@link #text} (Human readable form of this Contract Offer.). This is
3512     *         the underlying object with id, value and extensions. The accessor
3513     *         "getText" gives direct access to the value
3514     */
3515    public StringType getTextElement() {
3516      if (this.text == null)
3517        if (Configuration.errorOnAutoCreate())
3518          throw new Error("Attempt to auto-create ContractOfferComponent.text");
3519        else if (Configuration.doAutoCreate())
3520          this.text = new StringType(); // bb
3521      return this.text;
3522    }
3523
3524    public boolean hasTextElement() {
3525      return this.text != null && !this.text.isEmpty();
3526    }
3527
3528    public boolean hasText() {
3529      return this.text != null && !this.text.isEmpty();
3530    }
3531
3532    /**
3533     * @param value {@link #text} (Human readable form of this Contract Offer.).
3534     *              This is the underlying object with id, value and extensions. The
3535     *              accessor "getText" gives direct access to the value
3536     */
3537    public ContractOfferComponent setTextElement(StringType value) {
3538      this.text = value;
3539      return this;
3540    }
3541
3542    /**
3543     * @return Human readable form of this Contract Offer.
3544     */
3545    public String getText() {
3546      return this.text == null ? null : this.text.getValue();
3547    }
3548
3549    /**
3550     * @param value Human readable form of this Contract Offer.
3551     */
3552    public ContractOfferComponent setText(String value) {
3553      if (Utilities.noString(value))
3554        this.text = null;
3555      else {
3556        if (this.text == null)
3557          this.text = new StringType();
3558        this.text.setValue(value);
3559      }
3560      return this;
3561    }
3562
3563    /**
3564     * @return {@link #linkId} (The id of the clause or question text of the offer
3565     *         in the referenced questionnaire/response.)
3566     */
3567    public List<StringType> getLinkId() {
3568      if (this.linkId == null)
3569        this.linkId = new ArrayList<StringType>();
3570      return this.linkId;
3571    }
3572
3573    /**
3574     * @return Returns a reference to <code>this</code> for easy method chaining
3575     */
3576    public ContractOfferComponent setLinkId(List<StringType> theLinkId) {
3577      this.linkId = theLinkId;
3578      return this;
3579    }
3580
3581    public boolean hasLinkId() {
3582      if (this.linkId == null)
3583        return false;
3584      for (StringType item : this.linkId)
3585        if (!item.isEmpty())
3586          return true;
3587      return false;
3588    }
3589
3590    /**
3591     * @return {@link #linkId} (The id of the clause or question text of the offer
3592     *         in the referenced questionnaire/response.)
3593     */
3594    public StringType addLinkIdElement() {// 2
3595      StringType t = new StringType();
3596      if (this.linkId == null)
3597        this.linkId = new ArrayList<StringType>();
3598      this.linkId.add(t);
3599      return t;
3600    }
3601
3602    /**
3603     * @param value {@link #linkId} (The id of the clause or question text of the
3604     *              offer in the referenced questionnaire/response.)
3605     */
3606    public ContractOfferComponent addLinkId(String value) { // 1
3607      StringType t = new StringType();
3608      t.setValue(value);
3609      if (this.linkId == null)
3610        this.linkId = new ArrayList<StringType>();
3611      this.linkId.add(t);
3612      return this;
3613    }
3614
3615    /**
3616     * @param value {@link #linkId} (The id of the clause or question text of the
3617     *              offer in the referenced questionnaire/response.)
3618     */
3619    public boolean hasLinkId(String value) {
3620      if (this.linkId == null)
3621        return false;
3622      for (StringType v : this.linkId)
3623        if (v.getValue().equals(value)) // string
3624          return true;
3625      return false;
3626    }
3627
3628    /**
3629     * @return {@link #securityLabelNumber} (Security labels that protects the
3630     *         offer.)
3631     */
3632    public List<UnsignedIntType> getSecurityLabelNumber() {
3633      if (this.securityLabelNumber == null)
3634        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3635      return this.securityLabelNumber;
3636    }
3637
3638    /**
3639     * @return Returns a reference to <code>this</code> for easy method chaining
3640     */
3641    public ContractOfferComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
3642      this.securityLabelNumber = theSecurityLabelNumber;
3643      return this;
3644    }
3645
3646    public boolean hasSecurityLabelNumber() {
3647      if (this.securityLabelNumber == null)
3648        return false;
3649      for (UnsignedIntType item : this.securityLabelNumber)
3650        if (!item.isEmpty())
3651          return true;
3652      return false;
3653    }
3654
3655    /**
3656     * @return {@link #securityLabelNumber} (Security labels that protects the
3657     *         offer.)
3658     */
3659    public UnsignedIntType addSecurityLabelNumberElement() {// 2
3660      UnsignedIntType t = new UnsignedIntType();
3661      if (this.securityLabelNumber == null)
3662        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3663      this.securityLabelNumber.add(t);
3664      return t;
3665    }
3666
3667    /**
3668     * @param value {@link #securityLabelNumber} (Security labels that protects the
3669     *              offer.)
3670     */
3671    public ContractOfferComponent addSecurityLabelNumber(int value) { // 1
3672      UnsignedIntType t = new UnsignedIntType();
3673      t.setValue(value);
3674      if (this.securityLabelNumber == null)
3675        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
3676      this.securityLabelNumber.add(t);
3677      return this;
3678    }
3679
3680    /**
3681     * @param value {@link #securityLabelNumber} (Security labels that protects the
3682     *              offer.)
3683     */
3684    public boolean hasSecurityLabelNumber(int value) {
3685      if (this.securityLabelNumber == null)
3686        return false;
3687      for (UnsignedIntType v : this.securityLabelNumber)
3688        if (v.getValue().equals(value)) // unsignedInt
3689          return true;
3690      return false;
3691    }
3692
3693    protected void listChildren(List<Property> children) {
3694      super.listChildren(children);
3695      children.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.",
3696          0, java.lang.Integer.MAX_VALUE, identifier));
3697      children.add(new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party));
3698      children.add(new Property("topic", "Reference(Any)",
3699          "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).",
3700          0, 1, topic));
3701      children.add(new Property("type", "CodeableConcept",
3702          "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.",
3703          0, 1, type));
3704      children.add(new Property("decision", "CodeableConcept",
3705          "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1,
3706          decision));
3707      children.add(new Property("decisionMode", "CodeableConcept", "How the decision about a Contract was conveyed.", 0,
3708          java.lang.Integer.MAX_VALUE, decisionMode));
3709      children.add(new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE, answer));
3710      children.add(new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text));
3711      children.add(new Property("linkId", "string",
3712          "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0,
3713          java.lang.Integer.MAX_VALUE, linkId));
3714      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the offer.", 0,
3715          java.lang.Integer.MAX_VALUE, securityLabelNumber));
3716    }
3717
3718    @Override
3719    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3720      switch (_hash) {
3721      case -1618432855:
3722        /* identifier */ return new Property("identifier", "Identifier",
3723            "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier);
3724      case 106437350:
3725        /* party */ return new Property("party", "", "Offer Recipient.", 0, java.lang.Integer.MAX_VALUE, party);
3726      case 110546223:
3727        /* topic */ return new Property("topic", "Reference(Any)",
3728            "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).",
3729            0, 1, topic);
3730      case 3575610:
3731        /* type */ return new Property("type", "CodeableConcept",
3732            "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.",
3733            0, 1, type);
3734      case 565719004:
3735        /* decision */ return new Property("decision", "CodeableConcept",
3736            "Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.", 0, 1,
3737            decision);
3738      case 675909535:
3739        /* decisionMode */ return new Property("decisionMode", "CodeableConcept",
3740            "How the decision about a Contract was conveyed.", 0, java.lang.Integer.MAX_VALUE, decisionMode);
3741      case -1412808770:
3742        /* answer */ return new Property("answer", "", "Response to offer text.", 0, java.lang.Integer.MAX_VALUE,
3743            answer);
3744      case 3556653:
3745        /* text */ return new Property("text", "string", "Human readable form of this Contract Offer.", 0, 1, text);
3746      case -1102667083:
3747        /* linkId */ return new Property("linkId", "string",
3748            "The id of the clause or question text of the offer in the referenced questionnaire/response.", 0,
3749            java.lang.Integer.MAX_VALUE, linkId);
3750      case -149460995:
3751        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
3752            "Security labels that protects the offer.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
3753      default:
3754        return super.getNamedProperty(_hash, _name, _checkValid);
3755      }
3756
3757    }
3758
3759    @Override
3760    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3761      switch (hash) {
3762      case -1618432855:
3763        /* identifier */ return this.identifier == null ? new Base[0]
3764            : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3765      case 106437350:
3766        /* party */ return this.party == null ? new Base[0] : this.party.toArray(new Base[this.party.size()]); // ContractPartyComponent
3767      case 110546223:
3768        /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Reference
3769      case 3575610:
3770        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3771      case 565719004:
3772        /* decision */ return this.decision == null ? new Base[0] : new Base[] { this.decision }; // CodeableConcept
3773      case 675909535:
3774        /* decisionMode */ return this.decisionMode == null ? new Base[0]
3775            : this.decisionMode.toArray(new Base[this.decisionMode.size()]); // CodeableConcept
3776      case -1412808770:
3777        /* answer */ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
3778      case 3556653:
3779        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
3780      case -1102667083:
3781        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
3782      case -149460995:
3783        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
3784            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
3785      default:
3786        return super.getProperty(hash, name, checkValid);
3787      }
3788
3789    }
3790
3791    @Override
3792    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3793      switch (hash) {
3794      case -1618432855: // identifier
3795        this.getIdentifier().add(castToIdentifier(value)); // Identifier
3796        return value;
3797      case 106437350: // party
3798        this.getParty().add((ContractPartyComponent) value); // ContractPartyComponent
3799        return value;
3800      case 110546223: // topic
3801        this.topic = castToReference(value); // Reference
3802        return value;
3803      case 3575610: // type
3804        this.type = castToCodeableConcept(value); // CodeableConcept
3805        return value;
3806      case 565719004: // decision
3807        this.decision = castToCodeableConcept(value); // CodeableConcept
3808        return value;
3809      case 675909535: // decisionMode
3810        this.getDecisionMode().add(castToCodeableConcept(value)); // CodeableConcept
3811        return value;
3812      case -1412808770: // answer
3813        this.getAnswer().add((AnswerComponent) value); // AnswerComponent
3814        return value;
3815      case 3556653: // text
3816        this.text = castToString(value); // StringType
3817        return value;
3818      case -1102667083: // linkId
3819        this.getLinkId().add(castToString(value)); // StringType
3820        return value;
3821      case -149460995: // securityLabelNumber
3822        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
3823        return value;
3824      default:
3825        return super.setProperty(hash, name, value);
3826      }
3827
3828    }
3829
3830    @Override
3831    public Base setProperty(String name, Base value) throws FHIRException {
3832      if (name.equals("identifier")) {
3833        this.getIdentifier().add(castToIdentifier(value));
3834      } else if (name.equals("party")) {
3835        this.getParty().add((ContractPartyComponent) value);
3836      } else if (name.equals("topic")) {
3837        this.topic = castToReference(value); // Reference
3838      } else if (name.equals("type")) {
3839        this.type = castToCodeableConcept(value); // CodeableConcept
3840      } else if (name.equals("decision")) {
3841        this.decision = castToCodeableConcept(value); // CodeableConcept
3842      } else if (name.equals("decisionMode")) {
3843        this.getDecisionMode().add(castToCodeableConcept(value));
3844      } else if (name.equals("answer")) {
3845        this.getAnswer().add((AnswerComponent) value);
3846      } else if (name.equals("text")) {
3847        this.text = castToString(value); // StringType
3848      } else if (name.equals("linkId")) {
3849        this.getLinkId().add(castToString(value));
3850      } else if (name.equals("securityLabelNumber")) {
3851        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
3852      } else
3853        return super.setProperty(name, value);
3854      return value;
3855    }
3856
3857  @Override
3858  public void removeChild(String name, Base value) throws FHIRException {
3859      if (name.equals("identifier")) {
3860        this.getIdentifier().remove(castToIdentifier(value));
3861      } else if (name.equals("party")) {
3862        this.getParty().remove((ContractPartyComponent) value);
3863      } else if (name.equals("topic")) {
3864        this.topic = null;
3865      } else if (name.equals("type")) {
3866        this.type = null;
3867      } else if (name.equals("decision")) {
3868        this.decision = null;
3869      } else if (name.equals("decisionMode")) {
3870        this.getDecisionMode().remove(castToCodeableConcept(value));
3871      } else if (name.equals("answer")) {
3872        this.getAnswer().remove((AnswerComponent) value);
3873      } else if (name.equals("text")) {
3874        this.text = null;
3875      } else if (name.equals("linkId")) {
3876        this.getLinkId().remove(castToString(value));
3877      } else if (name.equals("securityLabelNumber")) {
3878        this.getSecurityLabelNumber().remove(castToUnsignedInt(value));
3879      } else
3880        super.removeChild(name, value);
3881      
3882    }
3883
3884    @Override
3885    public Base makeProperty(int hash, String name) throws FHIRException {
3886      switch (hash) {
3887      case -1618432855:
3888        return addIdentifier();
3889      case 106437350:
3890        return addParty();
3891      case 110546223:
3892        return getTopic();
3893      case 3575610:
3894        return getType();
3895      case 565719004:
3896        return getDecision();
3897      case 675909535:
3898        return addDecisionMode();
3899      case -1412808770:
3900        return addAnswer();
3901      case 3556653:
3902        return getTextElement();
3903      case -1102667083:
3904        return addLinkIdElement();
3905      case -149460995:
3906        return addSecurityLabelNumberElement();
3907      default:
3908        return super.makeProperty(hash, name);
3909      }
3910
3911    }
3912
3913    @Override
3914    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3915      switch (hash) {
3916      case -1618432855:
3917        /* identifier */ return new String[] { "Identifier" };
3918      case 106437350:
3919        /* party */ return new String[] {};
3920      case 110546223:
3921        /* topic */ return new String[] { "Reference" };
3922      case 3575610:
3923        /* type */ return new String[] { "CodeableConcept" };
3924      case 565719004:
3925        /* decision */ return new String[] { "CodeableConcept" };
3926      case 675909535:
3927        /* decisionMode */ return new String[] { "CodeableConcept" };
3928      case -1412808770:
3929        /* answer */ return new String[] {};
3930      case 3556653:
3931        /* text */ return new String[] { "string" };
3932      case -1102667083:
3933        /* linkId */ return new String[] { "string" };
3934      case -149460995:
3935        /* securityLabelNumber */ return new String[] { "unsignedInt" };
3936      default:
3937        return super.getTypesForProperty(hash, name);
3938      }
3939
3940    }
3941
3942    @Override
3943    public Base addChild(String name) throws FHIRException {
3944      if (name.equals("identifier")) {
3945        return addIdentifier();
3946      } else if (name.equals("party")) {
3947        return addParty();
3948      } else if (name.equals("topic")) {
3949        this.topic = new Reference();
3950        return this.topic;
3951      } else if (name.equals("type")) {
3952        this.type = new CodeableConcept();
3953        return this.type;
3954      } else if (name.equals("decision")) {
3955        this.decision = new CodeableConcept();
3956        return this.decision;
3957      } else if (name.equals("decisionMode")) {
3958        return addDecisionMode();
3959      } else if (name.equals("answer")) {
3960        return addAnswer();
3961      } else if (name.equals("text")) {
3962        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
3963      } else if (name.equals("linkId")) {
3964        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
3965      } else if (name.equals("securityLabelNumber")) {
3966        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
3967      } else
3968        return super.addChild(name);
3969    }
3970
3971    public ContractOfferComponent copy() {
3972      ContractOfferComponent dst = new ContractOfferComponent();
3973      copyValues(dst);
3974      return dst;
3975    }
3976
3977    public void copyValues(ContractOfferComponent dst) {
3978      super.copyValues(dst);
3979      if (identifier != null) {
3980        dst.identifier = new ArrayList<Identifier>();
3981        for (Identifier i : identifier)
3982          dst.identifier.add(i.copy());
3983      }
3984      ;
3985      if (party != null) {
3986        dst.party = new ArrayList<ContractPartyComponent>();
3987        for (ContractPartyComponent i : party)
3988          dst.party.add(i.copy());
3989      }
3990      ;
3991      dst.topic = topic == null ? null : topic.copy();
3992      dst.type = type == null ? null : type.copy();
3993      dst.decision = decision == null ? null : decision.copy();
3994      if (decisionMode != null) {
3995        dst.decisionMode = new ArrayList<CodeableConcept>();
3996        for (CodeableConcept i : decisionMode)
3997          dst.decisionMode.add(i.copy());
3998      }
3999      ;
4000      if (answer != null) {
4001        dst.answer = new ArrayList<AnswerComponent>();
4002        for (AnswerComponent i : answer)
4003          dst.answer.add(i.copy());
4004      }
4005      ;
4006      dst.text = text == null ? null : text.copy();
4007      if (linkId != null) {
4008        dst.linkId = new ArrayList<StringType>();
4009        for (StringType i : linkId)
4010          dst.linkId.add(i.copy());
4011      }
4012      ;
4013      if (securityLabelNumber != null) {
4014        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
4015        for (UnsignedIntType i : securityLabelNumber)
4016          dst.securityLabelNumber.add(i.copy());
4017      }
4018      ;
4019    }
4020
4021    @Override
4022    public boolean equalsDeep(Base other_) {
4023      if (!super.equalsDeep(other_))
4024        return false;
4025      if (!(other_ instanceof ContractOfferComponent))
4026        return false;
4027      ContractOfferComponent o = (ContractOfferComponent) other_;
4028      return compareDeep(identifier, o.identifier, true) && compareDeep(party, o.party, true)
4029          && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true)
4030          && compareDeep(decision, o.decision, true) && compareDeep(decisionMode, o.decisionMode, true)
4031          && compareDeep(answer, o.answer, true) && compareDeep(text, o.text, true)
4032          && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
4033    }
4034
4035    @Override
4036    public boolean equalsShallow(Base other_) {
4037      if (!super.equalsShallow(other_))
4038        return false;
4039      if (!(other_ instanceof ContractOfferComponent))
4040        return false;
4041      ContractOfferComponent o = (ContractOfferComponent) other_;
4042      return compareValues(text, o.text, true) && compareValues(linkId, o.linkId, true)
4043          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
4044    }
4045
4046    public boolean isEmpty() {
4047      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, party, topic, type, decision,
4048          decisionMode, answer, text, linkId, securityLabelNumber);
4049    }
4050
4051    public String fhirType() {
4052      return "Contract.term.offer";
4053
4054    }
4055
4056  }
4057
4058  @Block()
4059  public static class ContractPartyComponent extends BackboneElement implements IBaseBackboneElement {
4060    /**
4061     * Participant in the offer.
4062     */
4063    @Child(name = "reference", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
4064        Device.class, Group.class,
4065        Organization.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4066    @Description(shortDefinition = "Referenced entity", formalDefinition = "Participant in the offer.")
4067    protected List<Reference> reference;
4068    /**
4069     * The actual objects that are the target of the reference (Participant in the
4070     * offer.)
4071     */
4072    protected List<Resource> referenceTarget;
4073
4074    /**
4075     * How the party participates in the offer.
4076     */
4077    @Child(name = "role", type = {
4078        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
4079    @Description(shortDefinition = "Participant engagement type", formalDefinition = "How the party participates in the offer.")
4080    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-party-role")
4081    protected CodeableConcept role;
4082
4083    private static final long serialVersionUID = 128949255L;
4084
4085    /**
4086     * Constructor
4087     */
4088    public ContractPartyComponent() {
4089      super();
4090    }
4091
4092    /**
4093     * Constructor
4094     */
4095    public ContractPartyComponent(CodeableConcept role) {
4096      super();
4097      this.role = role;
4098    }
4099
4100    /**
4101     * @return {@link #reference} (Participant in the offer.)
4102     */
4103    public List<Reference> getReference() {
4104      if (this.reference == null)
4105        this.reference = new ArrayList<Reference>();
4106      return this.reference;
4107    }
4108
4109    /**
4110     * @return Returns a reference to <code>this</code> for easy method chaining
4111     */
4112    public ContractPartyComponent setReference(List<Reference> theReference) {
4113      this.reference = theReference;
4114      return this;
4115    }
4116
4117    public boolean hasReference() {
4118      if (this.reference == null)
4119        return false;
4120      for (Reference item : this.reference)
4121        if (!item.isEmpty())
4122          return true;
4123      return false;
4124    }
4125
4126    public Reference addReference() { // 3
4127      Reference t = new Reference();
4128      if (this.reference == null)
4129        this.reference = new ArrayList<Reference>();
4130      this.reference.add(t);
4131      return t;
4132    }
4133
4134    public ContractPartyComponent addReference(Reference t) { // 3
4135      if (t == null)
4136        return this;
4137      if (this.reference == null)
4138        this.reference = new ArrayList<Reference>();
4139      this.reference.add(t);
4140      return this;
4141    }
4142
4143    /**
4144     * @return The first repetition of repeating field {@link #reference}, creating
4145     *         it if it does not already exist
4146     */
4147    public Reference getReferenceFirstRep() {
4148      if (getReference().isEmpty()) {
4149        addReference();
4150      }
4151      return getReference().get(0);
4152    }
4153
4154    /**
4155     * @deprecated Use Reference#setResource(IBaseResource) instead
4156     */
4157    @Deprecated
4158    public List<Resource> getReferenceTarget() {
4159      if (this.referenceTarget == null)
4160        this.referenceTarget = new ArrayList<Resource>();
4161      return this.referenceTarget;
4162    }
4163
4164    /**
4165     * @return {@link #role} (How the party participates in the offer.)
4166     */
4167    public CodeableConcept getRole() {
4168      if (this.role == null)
4169        if (Configuration.errorOnAutoCreate())
4170          throw new Error("Attempt to auto-create ContractPartyComponent.role");
4171        else if (Configuration.doAutoCreate())
4172          this.role = new CodeableConcept(); // cc
4173      return this.role;
4174    }
4175
4176    public boolean hasRole() {
4177      return this.role != null && !this.role.isEmpty();
4178    }
4179
4180    /**
4181     * @param value {@link #role} (How the party participates in the offer.)
4182     */
4183    public ContractPartyComponent setRole(CodeableConcept value) {
4184      this.role = value;
4185      return this;
4186    }
4187
4188    protected void listChildren(List<Property> children) {
4189      super.listChildren(children);
4190      children.add(new Property("reference",
4191          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
4192          "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference));
4193      children.add(new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1, role));
4194    }
4195
4196    @Override
4197    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4198      switch (_hash) {
4199      case -925155509:
4200        /* reference */ return new Property("reference",
4201            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
4202            "Participant in the offer.", 0, java.lang.Integer.MAX_VALUE, reference);
4203      case 3506294:
4204        /* role */ return new Property("role", "CodeableConcept", "How the party participates in the offer.", 0, 1,
4205            role);
4206      default:
4207        return super.getNamedProperty(_hash, _name, _checkValid);
4208      }
4209
4210    }
4211
4212    @Override
4213    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4214      switch (hash) {
4215      case -925155509:
4216        /* reference */ return this.reference == null ? new Base[0]
4217            : this.reference.toArray(new Base[this.reference.size()]); // Reference
4218      case 3506294:
4219        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
4220      default:
4221        return super.getProperty(hash, name, checkValid);
4222      }
4223
4224    }
4225
4226    @Override
4227    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4228      switch (hash) {
4229      case -925155509: // reference
4230        this.getReference().add(castToReference(value)); // Reference
4231        return value;
4232      case 3506294: // role
4233        this.role = castToCodeableConcept(value); // CodeableConcept
4234        return value;
4235      default:
4236        return super.setProperty(hash, name, value);
4237      }
4238
4239    }
4240
4241    @Override
4242    public Base setProperty(String name, Base value) throws FHIRException {
4243      if (name.equals("reference")) {
4244        this.getReference().add(castToReference(value));
4245      } else if (name.equals("role")) {
4246        this.role = castToCodeableConcept(value); // CodeableConcept
4247      } else
4248        return super.setProperty(name, value);
4249      return value;
4250    }
4251
4252  @Override
4253  public void removeChild(String name, Base value) throws FHIRException {
4254      if (name.equals("reference")) {
4255        this.getReference().remove(castToReference(value));
4256      } else if (name.equals("role")) {
4257        this.role = null;
4258      } else
4259        super.removeChild(name, value);
4260      
4261    }
4262
4263    @Override
4264    public Base makeProperty(int hash, String name) throws FHIRException {
4265      switch (hash) {
4266      case -925155509:
4267        return addReference();
4268      case 3506294:
4269        return getRole();
4270      default:
4271        return super.makeProperty(hash, name);
4272      }
4273
4274    }
4275
4276    @Override
4277    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4278      switch (hash) {
4279      case -925155509:
4280        /* reference */ return new String[] { "Reference" };
4281      case 3506294:
4282        /* role */ return new String[] { "CodeableConcept" };
4283      default:
4284        return super.getTypesForProperty(hash, name);
4285      }
4286
4287    }
4288
4289    @Override
4290    public Base addChild(String name) throws FHIRException {
4291      if (name.equals("reference")) {
4292        return addReference();
4293      } else if (name.equals("role")) {
4294        this.role = new CodeableConcept();
4295        return this.role;
4296      } else
4297        return super.addChild(name);
4298    }
4299
4300    public ContractPartyComponent copy() {
4301      ContractPartyComponent dst = new ContractPartyComponent();
4302      copyValues(dst);
4303      return dst;
4304    }
4305
4306    public void copyValues(ContractPartyComponent dst) {
4307      super.copyValues(dst);
4308      if (reference != null) {
4309        dst.reference = new ArrayList<Reference>();
4310        for (Reference i : reference)
4311          dst.reference.add(i.copy());
4312      }
4313      ;
4314      dst.role = role == null ? null : role.copy();
4315    }
4316
4317    @Override
4318    public boolean equalsDeep(Base other_) {
4319      if (!super.equalsDeep(other_))
4320        return false;
4321      if (!(other_ instanceof ContractPartyComponent))
4322        return false;
4323      ContractPartyComponent o = (ContractPartyComponent) other_;
4324      return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
4325    }
4326
4327    @Override
4328    public boolean equalsShallow(Base other_) {
4329      if (!super.equalsShallow(other_))
4330        return false;
4331      if (!(other_ instanceof ContractPartyComponent))
4332        return false;
4333      ContractPartyComponent o = (ContractPartyComponent) other_;
4334      return true;
4335    }
4336
4337    public boolean isEmpty() {
4338      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
4339    }
4340
4341    public String fhirType() {
4342      return "Contract.term.offer.party";
4343
4344    }
4345
4346  }
4347
4348  @Block()
4349  public static class AnswerComponent extends BackboneElement implements IBaseBackboneElement {
4350    /**
4351     * Response to an offer clause or question text, which enables selection of
4352     * values to be agreed to, e.g., the period of participation, the date of
4353     * occupancy of a rental, warrently duration, or whether biospecimen may be used
4354     * for further research.
4355     */
4356    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
4357        DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class,
4358        Quantity.class, Reference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4359    @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.")
4360    protected Type value;
4361
4362    private static final long serialVersionUID = -732981989L;
4363
4364    /**
4365     * Constructor
4366     */
4367    public AnswerComponent() {
4368      super();
4369    }
4370
4371    /**
4372     * Constructor
4373     */
4374    public AnswerComponent(Type value) {
4375      super();
4376      this.value = value;
4377    }
4378
4379    /**
4380     * @return {@link #value} (Response to an offer clause or question text, which
4381     *         enables selection of values to be agreed to, e.g., the period of
4382     *         participation, the date of occupancy of a rental, warrently duration,
4383     *         or whether biospecimen may be used for further research.)
4384     */
4385    public Type getValue() {
4386      return this.value;
4387    }
4388
4389    /**
4390     * @return {@link #value} (Response to an offer clause or question text, which
4391     *         enables selection of values to be agreed to, e.g., the period of
4392     *         participation, the date of occupancy of a rental, warrently duration,
4393     *         or whether biospecimen may be used for further research.)
4394     */
4395    public BooleanType getValueBooleanType() throws FHIRException {
4396      if (this.value == null)
4397        this.value = new BooleanType();
4398      if (!(this.value instanceof BooleanType))
4399        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
4400            + this.value.getClass().getName() + " was encountered");
4401      return (BooleanType) this.value;
4402    }
4403
4404    public boolean hasValueBooleanType() {
4405      return this != null && this.value instanceof BooleanType;
4406    }
4407
4408    /**
4409     * @return {@link #value} (Response to an offer clause or question text, which
4410     *         enables selection of values to be agreed to, e.g., the period of
4411     *         participation, the date of occupancy of a rental, warrently duration,
4412     *         or whether biospecimen may be used for further research.)
4413     */
4414    public DecimalType getValueDecimalType() throws FHIRException {
4415      if (this.value == null)
4416        this.value = new DecimalType();
4417      if (!(this.value instanceof DecimalType))
4418        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
4419            + this.value.getClass().getName() + " was encountered");
4420      return (DecimalType) this.value;
4421    }
4422
4423    public boolean hasValueDecimalType() {
4424      return this != null && this.value instanceof DecimalType;
4425    }
4426
4427    /**
4428     * @return {@link #value} (Response to an offer clause or question text, which
4429     *         enables selection of values to be agreed to, e.g., the period of
4430     *         participation, the date of occupancy of a rental, warrently duration,
4431     *         or whether biospecimen may be used for further research.)
4432     */
4433    public IntegerType getValueIntegerType() throws FHIRException {
4434      if (this.value == null)
4435        this.value = new IntegerType();
4436      if (!(this.value instanceof IntegerType))
4437        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
4438            + this.value.getClass().getName() + " was encountered");
4439      return (IntegerType) this.value;
4440    }
4441
4442    public boolean hasValueIntegerType() {
4443      return this != null && this.value instanceof IntegerType;
4444    }
4445
4446    /**
4447     * @return {@link #value} (Response to an offer clause or question text, which
4448     *         enables selection of values to be agreed to, e.g., the period of
4449     *         participation, the date of occupancy of a rental, warrently duration,
4450     *         or whether biospecimen may be used for further research.)
4451     */
4452    public DateType getValueDateType() throws FHIRException {
4453      if (this.value == null)
4454        this.value = new DateType();
4455      if (!(this.value instanceof DateType))
4456        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
4457            + " was encountered");
4458      return (DateType) this.value;
4459    }
4460
4461    public boolean hasValueDateType() {
4462      return this != null && this.value instanceof DateType;
4463    }
4464
4465    /**
4466     * @return {@link #value} (Response to an offer clause or question text, which
4467     *         enables selection of values to be agreed to, e.g., the period of
4468     *         participation, the date of occupancy of a rental, warrently duration,
4469     *         or whether biospecimen may be used for further research.)
4470     */
4471    public DateTimeType getValueDateTimeType() throws FHIRException {
4472      if (this.value == null)
4473        this.value = new DateTimeType();
4474      if (!(this.value instanceof DateTimeType))
4475        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
4476            + this.value.getClass().getName() + " was encountered");
4477      return (DateTimeType) this.value;
4478    }
4479
4480    public boolean hasValueDateTimeType() {
4481      return this != null && this.value instanceof DateTimeType;
4482    }
4483
4484    /**
4485     * @return {@link #value} (Response to an offer clause or question text, which
4486     *         enables selection of values to be agreed to, e.g., the period of
4487     *         participation, the date of occupancy of a rental, warrently duration,
4488     *         or whether biospecimen may be used for further research.)
4489     */
4490    public TimeType getValueTimeType() throws FHIRException {
4491      if (this.value == null)
4492        this.value = new TimeType();
4493      if (!(this.value instanceof TimeType))
4494        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
4495            + " was encountered");
4496      return (TimeType) this.value;
4497    }
4498
4499    public boolean hasValueTimeType() {
4500      return this != null && this.value instanceof TimeType;
4501    }
4502
4503    /**
4504     * @return {@link #value} (Response to an offer clause or question text, which
4505     *         enables selection of values to be agreed to, e.g., the period of
4506     *         participation, the date of occupancy of a rental, warrently duration,
4507     *         or whether biospecimen may be used for further research.)
4508     */
4509    public StringType getValueStringType() throws FHIRException {
4510      if (this.value == null)
4511        this.value = new StringType();
4512      if (!(this.value instanceof StringType))
4513        throw new FHIRException("Type mismatch: the type StringType was expected, but "
4514            + this.value.getClass().getName() + " was encountered");
4515      return (StringType) this.value;
4516    }
4517
4518    public boolean hasValueStringType() {
4519      return this != null && this.value instanceof StringType;
4520    }
4521
4522    /**
4523     * @return {@link #value} (Response to an offer clause or question text, which
4524     *         enables selection of values to be agreed to, e.g., the period of
4525     *         participation, the date of occupancy of a rental, warrently duration,
4526     *         or whether biospecimen may be used for further research.)
4527     */
4528    public UriType getValueUriType() throws FHIRException {
4529      if (this.value == null)
4530        this.value = new UriType();
4531      if (!(this.value instanceof UriType))
4532        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
4533            + " was encountered");
4534      return (UriType) this.value;
4535    }
4536
4537    public boolean hasValueUriType() {
4538      return this != null && this.value instanceof UriType;
4539    }
4540
4541    /**
4542     * @return {@link #value} (Response to an offer clause or question text, which
4543     *         enables selection of values to be agreed to, e.g., the period of
4544     *         participation, the date of occupancy of a rental, warrently duration,
4545     *         or whether biospecimen may be used for further research.)
4546     */
4547    public Attachment getValueAttachment() throws FHIRException {
4548      if (this.value == null)
4549        this.value = new Attachment();
4550      if (!(this.value instanceof Attachment))
4551        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
4552            + this.value.getClass().getName() + " was encountered");
4553      return (Attachment) this.value;
4554    }
4555
4556    public boolean hasValueAttachment() {
4557      return this != null && this.value instanceof Attachment;
4558    }
4559
4560    /**
4561     * @return {@link #value} (Response to an offer clause or question text, which
4562     *         enables selection of values to be agreed to, e.g., the period of
4563     *         participation, the date of occupancy of a rental, warrently duration,
4564     *         or whether biospecimen may be used for further research.)
4565     */
4566    public Coding getValueCoding() throws FHIRException {
4567      if (this.value == null)
4568        this.value = new Coding();
4569      if (!(this.value instanceof Coding))
4570        throw new FHIRException(
4571            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
4572      return (Coding) this.value;
4573    }
4574
4575    public boolean hasValueCoding() {
4576      return this != null && this.value instanceof Coding;
4577    }
4578
4579    /**
4580     * @return {@link #value} (Response to an offer clause or question text, which
4581     *         enables selection of values to be agreed to, e.g., the period of
4582     *         participation, the date of occupancy of a rental, warrently duration,
4583     *         or whether biospecimen may be used for further research.)
4584     */
4585    public Quantity getValueQuantity() throws FHIRException {
4586      if (this.value == null)
4587        this.value = new Quantity();
4588      if (!(this.value instanceof Quantity))
4589        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
4590            + " was encountered");
4591      return (Quantity) this.value;
4592    }
4593
4594    public boolean hasValueQuantity() {
4595      return this != null && this.value instanceof Quantity;
4596    }
4597
4598    /**
4599     * @return {@link #value} (Response to an offer clause or question text, which
4600     *         enables selection of values to be agreed to, e.g., the period of
4601     *         participation, the date of occupancy of a rental, warrently duration,
4602     *         or whether biospecimen may be used for further research.)
4603     */
4604    public Reference getValueReference() throws FHIRException {
4605      if (this.value == null)
4606        this.value = new Reference();
4607      if (!(this.value instanceof Reference))
4608        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
4609            + " was encountered");
4610      return (Reference) this.value;
4611    }
4612
4613    public boolean hasValueReference() {
4614      return this != null && this.value instanceof Reference;
4615    }
4616
4617    public boolean hasValue() {
4618      return this.value != null && !this.value.isEmpty();
4619    }
4620
4621    /**
4622     * @param value {@link #value} (Response to an offer clause or question text,
4623     *              which enables selection of values to be agreed to, e.g., the
4624     *              period of participation, the date of occupancy of a rental,
4625     *              warrently duration, or whether biospecimen may be used for
4626     *              further research.)
4627     */
4628    public AnswerComponent setValue(Type value) {
4629      if (value != null
4630          && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType
4631              || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType
4632              || value instanceof StringType || value instanceof UriType || value instanceof Attachment
4633              || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
4634        throw new Error("Not the right type for Contract.term.offer.answer.value[x]: " + value.fhirType());
4635      this.value = value;
4636      return this;
4637    }
4638
4639    protected void listChildren(List<Property> children) {
4640      super.listChildren(children);
4641      children.add(new Property("value[x]",
4642          "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4643          "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.",
4644          0, 1, value));
4645    }
4646
4647    @Override
4648    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4649      switch (_hash) {
4650      case -1410166417:
4651        /* value[x] */ return new Property("value[x]",
4652            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4653            "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.",
4654            0, 1, value);
4655      case 111972721:
4656        /* value */ return new Property("value[x]",
4657            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4658            "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.",
4659            0, 1, value);
4660      case 733421943:
4661        /* valueBoolean */ return new Property("value[x]",
4662            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4663            "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.",
4664            0, 1, value);
4665      case -2083993440:
4666        /* valueDecimal */ return new Property("value[x]",
4667            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4668            "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.",
4669            0, 1, value);
4670      case -1668204915:
4671        /* valueInteger */ return new Property("value[x]",
4672            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4673            "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.",
4674            0, 1, value);
4675      case -766192449:
4676        /* valueDate */ return new Property("value[x]",
4677            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4678            "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.",
4679            0, 1, value);
4680      case 1047929900:
4681        /* valueDateTime */ return new Property("value[x]",
4682            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4683            "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.",
4684            0, 1, value);
4685      case -765708322:
4686        /* valueTime */ return new Property("value[x]",
4687            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4688            "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.",
4689            0, 1, value);
4690      case -1424603934:
4691        /* valueString */ return new Property("value[x]",
4692            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4693            "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.",
4694            0, 1, value);
4695      case -1410172357:
4696        /* valueUri */ return new Property("value[x]",
4697            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4698            "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.",
4699            0, 1, value);
4700      case -475566732:
4701        /* valueAttachment */ return new Property("value[x]",
4702            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4703            "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.",
4704            0, 1, value);
4705      case -1887705029:
4706        /* valueCoding */ return new Property("value[x]",
4707            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4708            "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.",
4709            0, 1, value);
4710      case -2029823716:
4711        /* valueQuantity */ return new Property("value[x]",
4712            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4713            "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.",
4714            0, 1, value);
4715      case 1755241690:
4716        /* valueReference */ return new Property("value[x]",
4717            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
4718            "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.",
4719            0, 1, value);
4720      default:
4721        return super.getNamedProperty(_hash, _name, _checkValid);
4722      }
4723
4724    }
4725
4726    @Override
4727    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4728      switch (hash) {
4729      case 111972721:
4730        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
4731      default:
4732        return super.getProperty(hash, name, checkValid);
4733      }
4734
4735    }
4736
4737    @Override
4738    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4739      switch (hash) {
4740      case 111972721: // value
4741        this.value = castToType(value); // Type
4742        return value;
4743      default:
4744        return super.setProperty(hash, name, value);
4745      }
4746
4747    }
4748
4749    @Override
4750    public Base setProperty(String name, Base value) throws FHIRException {
4751      if (name.equals("value[x]")) {
4752        this.value = castToType(value); // Type
4753      } else
4754        return super.setProperty(name, value);
4755      return value;
4756    }
4757
4758  @Override
4759  public void removeChild(String name, Base value) throws FHIRException {
4760      if (name.equals("value[x]")) {
4761        this.value = null;
4762      } else
4763        super.removeChild(name, value);
4764      
4765    }
4766
4767    @Override
4768    public Base makeProperty(int hash, String name) throws FHIRException {
4769      switch (hash) {
4770      case -1410166417:
4771        return getValue();
4772      case 111972721:
4773        return getValue();
4774      default:
4775        return super.makeProperty(hash, name);
4776      }
4777
4778    }
4779
4780    @Override
4781    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4782      switch (hash) {
4783      case 111972721:
4784        /* value */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri",
4785            "Attachment", "Coding", "Quantity", "Reference" };
4786      default:
4787        return super.getTypesForProperty(hash, name);
4788      }
4789
4790    }
4791
4792    @Override
4793    public Base addChild(String name) throws FHIRException {
4794      if (name.equals("valueBoolean")) {
4795        this.value = new BooleanType();
4796        return this.value;
4797      } else if (name.equals("valueDecimal")) {
4798        this.value = new DecimalType();
4799        return this.value;
4800      } else if (name.equals("valueInteger")) {
4801        this.value = new IntegerType();
4802        return this.value;
4803      } else if (name.equals("valueDate")) {
4804        this.value = new DateType();
4805        return this.value;
4806      } else if (name.equals("valueDateTime")) {
4807        this.value = new DateTimeType();
4808        return this.value;
4809      } else if (name.equals("valueTime")) {
4810        this.value = new TimeType();
4811        return this.value;
4812      } else if (name.equals("valueString")) {
4813        this.value = new StringType();
4814        return this.value;
4815      } else if (name.equals("valueUri")) {
4816        this.value = new UriType();
4817        return this.value;
4818      } else if (name.equals("valueAttachment")) {
4819        this.value = new Attachment();
4820        return this.value;
4821      } else if (name.equals("valueCoding")) {
4822        this.value = new Coding();
4823        return this.value;
4824      } else if (name.equals("valueQuantity")) {
4825        this.value = new Quantity();
4826        return this.value;
4827      } else if (name.equals("valueReference")) {
4828        this.value = new Reference();
4829        return this.value;
4830      } else
4831        return super.addChild(name);
4832    }
4833
4834    public AnswerComponent copy() {
4835      AnswerComponent dst = new AnswerComponent();
4836      copyValues(dst);
4837      return dst;
4838    }
4839
4840    public void copyValues(AnswerComponent dst) {
4841      super.copyValues(dst);
4842      dst.value = value == null ? null : value.copy();
4843    }
4844
4845    @Override
4846    public boolean equalsDeep(Base other_) {
4847      if (!super.equalsDeep(other_))
4848        return false;
4849      if (!(other_ instanceof AnswerComponent))
4850        return false;
4851      AnswerComponent o = (AnswerComponent) other_;
4852      return compareDeep(value, o.value, true);
4853    }
4854
4855    @Override
4856    public boolean equalsShallow(Base other_) {
4857      if (!super.equalsShallow(other_))
4858        return false;
4859      if (!(other_ instanceof AnswerComponent))
4860        return false;
4861      AnswerComponent o = (AnswerComponent) other_;
4862      return true;
4863    }
4864
4865    public boolean isEmpty() {
4866      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
4867    }
4868
4869    public String fhirType() {
4870      return "Contract.term.offer.answer";
4871
4872    }
4873
4874  }
4875
4876  @Block()
4877  public static class ContractAssetComponent extends BackboneElement implements IBaseBackboneElement {
4878    /**
4879     * Differentiates the kind of the asset .
4880     */
4881    @Child(name = "scope", type = {
4882        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
4883    @Description(shortDefinition = "Range of asset", formalDefinition = "Differentiates the kind of the asset .")
4884    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetscope")
4885    protected CodeableConcept scope;
4886
4887    /**
4888     * Target entity type about which the term may be concerned.
4889     */
4890    @Child(name = "type", type = {
4891        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4892    @Description(shortDefinition = "Asset category", formalDefinition = "Target entity type about which the term may be concerned.")
4893    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assettype")
4894    protected List<CodeableConcept> type;
4895
4896    /**
4897     * Associated entities.
4898     */
4899    @Child(name = "typeReference", type = {
4900        Reference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4901    @Description(shortDefinition = "Associated entities", formalDefinition = "Associated entities.")
4902    protected List<Reference> typeReference;
4903    /**
4904     * The actual objects that are the target of the reference (Associated
4905     * entities.)
4906     */
4907    protected List<Resource> typeReferenceTarget;
4908
4909    /**
4910     * May be a subtype or part of an offered asset.
4911     */
4912    @Child(name = "subtype", type = {
4913        CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4914    @Description(shortDefinition = "Asset sub-category", formalDefinition = "May be a subtype or part of an offered asset.")
4915    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetsubtype")
4916    protected List<CodeableConcept> subtype;
4917
4918    /**
4919     * Specifies the applicability of the term to an asset resource instance, and
4920     * instances it refers to orinstances that refer to it, and/or are owned by the
4921     * offeree.
4922     */
4923    @Child(name = "relationship", type = {
4924        Coding.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
4925    @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.")
4926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/consent-content-class")
4927    protected Coding relationship;
4928
4929    /**
4930     * Circumstance of the asset.
4931     */
4932    @Child(name = "context", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4933    @Description(shortDefinition = "Circumstance of the asset", formalDefinition = "Circumstance of the asset.")
4934    protected List<AssetContextComponent> context;
4935
4936    /**
4937     * Description of the quality and completeness of the asset that imay be a
4938     * factor in its valuation.
4939     */
4940    @Child(name = "condition", type = {
4941        StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4942    @Description(shortDefinition = "Quality desctiption of asset", formalDefinition = "Description of the quality and completeness of the asset that imay be a factor in its valuation.")
4943    protected StringType condition;
4944
4945    /**
4946     * Type of Asset availability for use or ownership.
4947     */
4948    @Child(name = "periodType", type = {
4949        CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4950    @Description(shortDefinition = "Asset availability types", formalDefinition = "Type of Asset availability for use or ownership.")
4951    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/asset-availability")
4952    protected List<CodeableConcept> periodType;
4953
4954    /**
4955     * Asset relevant contractual time period.
4956     */
4957    @Child(name = "period", type = {
4958        Period.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4959    @Description(shortDefinition = "Time period of the asset", formalDefinition = "Asset relevant contractual time period.")
4960    protected List<Period> period;
4961
4962    /**
4963     * Time period of asset use.
4964     */
4965    @Child(name = "usePeriod", type = {
4966        Period.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4967    @Description(shortDefinition = "Time period", formalDefinition = "Time period of asset use.")
4968    protected List<Period> usePeriod;
4969
4970    /**
4971     * Clause or question text (Prose Object) concerning the asset in a linked form,
4972     * such as a QuestionnaireResponse used in the formation of the contract.
4973     */
4974    @Child(name = "text", type = { StringType.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4975    @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.")
4976    protected StringType text;
4977
4978    /**
4979     * Id [identifier??] of the clause or question text about the asset in the
4980     * referenced form or QuestionnaireResponse.
4981     */
4982    @Child(name = "linkId", type = {
4983        StringType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4984    @Description(shortDefinition = "Pointer to asset text", formalDefinition = "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.")
4985    protected List<StringType> linkId;
4986
4987    /**
4988     * Response to assets.
4989     */
4990    @Child(name = "answer", type = {
4991        AnswerComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4992    @Description(shortDefinition = "Response to assets", formalDefinition = "Response to assets.")
4993    protected List<AnswerComponent> answer;
4994
4995    /**
4996     * Security labels that protects the asset.
4997     */
4998    @Child(name = "securityLabelNumber", type = {
4999        UnsignedIntType.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5000    @Description(shortDefinition = "Asset restriction numbers", formalDefinition = "Security labels that protects the asset.")
5001    protected List<UnsignedIntType> securityLabelNumber;
5002
5003    /**
5004     * Contract Valued Item List.
5005     */
5006    @Child(name = "valuedItem", type = {}, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5007    @Description(shortDefinition = "Contract Valued Item List", formalDefinition = "Contract Valued Item List.")
5008    protected List<ValuedItemComponent> valuedItem;
5009
5010    private static final long serialVersionUID = -1080398792L;
5011
5012    /**
5013     * Constructor
5014     */
5015    public ContractAssetComponent() {
5016      super();
5017    }
5018
5019    /**
5020     * @return {@link #scope} (Differentiates the kind of the asset .)
5021     */
5022    public CodeableConcept getScope() {
5023      if (this.scope == null)
5024        if (Configuration.errorOnAutoCreate())
5025          throw new Error("Attempt to auto-create ContractAssetComponent.scope");
5026        else if (Configuration.doAutoCreate())
5027          this.scope = new CodeableConcept(); // cc
5028      return this.scope;
5029    }
5030
5031    public boolean hasScope() {
5032      return this.scope != null && !this.scope.isEmpty();
5033    }
5034
5035    /**
5036     * @param value {@link #scope} (Differentiates the kind of the asset .)
5037     */
5038    public ContractAssetComponent setScope(CodeableConcept value) {
5039      this.scope = value;
5040      return this;
5041    }
5042
5043    /**
5044     * @return {@link #type} (Target entity type about which the term may be
5045     *         concerned.)
5046     */
5047    public List<CodeableConcept> getType() {
5048      if (this.type == null)
5049        this.type = new ArrayList<CodeableConcept>();
5050      return this.type;
5051    }
5052
5053    /**
5054     * @return Returns a reference to <code>this</code> for easy method chaining
5055     */
5056    public ContractAssetComponent setType(List<CodeableConcept> theType) {
5057      this.type = theType;
5058      return this;
5059    }
5060
5061    public boolean hasType() {
5062      if (this.type == null)
5063        return false;
5064      for (CodeableConcept item : this.type)
5065        if (!item.isEmpty())
5066          return true;
5067      return false;
5068    }
5069
5070    public CodeableConcept addType() { // 3
5071      CodeableConcept t = new CodeableConcept();
5072      if (this.type == null)
5073        this.type = new ArrayList<CodeableConcept>();
5074      this.type.add(t);
5075      return t;
5076    }
5077
5078    public ContractAssetComponent addType(CodeableConcept t) { // 3
5079      if (t == null)
5080        return this;
5081      if (this.type == null)
5082        this.type = new ArrayList<CodeableConcept>();
5083      this.type.add(t);
5084      return this;
5085    }
5086
5087    /**
5088     * @return The first repetition of repeating field {@link #type}, creating it if
5089     *         it does not already exist
5090     */
5091    public CodeableConcept getTypeFirstRep() {
5092      if (getType().isEmpty()) {
5093        addType();
5094      }
5095      return getType().get(0);
5096    }
5097
5098    /**
5099     * @return {@link #typeReference} (Associated entities.)
5100     */
5101    public List<Reference> getTypeReference() {
5102      if (this.typeReference == null)
5103        this.typeReference = new ArrayList<Reference>();
5104      return this.typeReference;
5105    }
5106
5107    /**
5108     * @return Returns a reference to <code>this</code> for easy method chaining
5109     */
5110    public ContractAssetComponent setTypeReference(List<Reference> theTypeReference) {
5111      this.typeReference = theTypeReference;
5112      return this;
5113    }
5114
5115    public boolean hasTypeReference() {
5116      if (this.typeReference == null)
5117        return false;
5118      for (Reference item : this.typeReference)
5119        if (!item.isEmpty())
5120          return true;
5121      return false;
5122    }
5123
5124    public Reference addTypeReference() { // 3
5125      Reference t = new Reference();
5126      if (this.typeReference == null)
5127        this.typeReference = new ArrayList<Reference>();
5128      this.typeReference.add(t);
5129      return t;
5130    }
5131
5132    public ContractAssetComponent addTypeReference(Reference t) { // 3
5133      if (t == null)
5134        return this;
5135      if (this.typeReference == null)
5136        this.typeReference = new ArrayList<Reference>();
5137      this.typeReference.add(t);
5138      return this;
5139    }
5140
5141    /**
5142     * @return The first repetition of repeating field {@link #typeReference},
5143     *         creating it if it does not already exist
5144     */
5145    public Reference getTypeReferenceFirstRep() {
5146      if (getTypeReference().isEmpty()) {
5147        addTypeReference();
5148      }
5149      return getTypeReference().get(0);
5150    }
5151
5152    /**
5153     * @deprecated Use Reference#setResource(IBaseResource) instead
5154     */
5155    @Deprecated
5156    public List<Resource> getTypeReferenceTarget() {
5157      if (this.typeReferenceTarget == null)
5158        this.typeReferenceTarget = new ArrayList<Resource>();
5159      return this.typeReferenceTarget;
5160    }
5161
5162    /**
5163     * @return {@link #subtype} (May be a subtype or part of an offered asset.)
5164     */
5165    public List<CodeableConcept> getSubtype() {
5166      if (this.subtype == null)
5167        this.subtype = new ArrayList<CodeableConcept>();
5168      return this.subtype;
5169    }
5170
5171    /**
5172     * @return Returns a reference to <code>this</code> for easy method chaining
5173     */
5174    public ContractAssetComponent setSubtype(List<CodeableConcept> theSubtype) {
5175      this.subtype = theSubtype;
5176      return this;
5177    }
5178
5179    public boolean hasSubtype() {
5180      if (this.subtype == null)
5181        return false;
5182      for (CodeableConcept item : this.subtype)
5183        if (!item.isEmpty())
5184          return true;
5185      return false;
5186    }
5187
5188    public CodeableConcept addSubtype() { // 3
5189      CodeableConcept t = new CodeableConcept();
5190      if (this.subtype == null)
5191        this.subtype = new ArrayList<CodeableConcept>();
5192      this.subtype.add(t);
5193      return t;
5194    }
5195
5196    public ContractAssetComponent addSubtype(CodeableConcept t) { // 3
5197      if (t == null)
5198        return this;
5199      if (this.subtype == null)
5200        this.subtype = new ArrayList<CodeableConcept>();
5201      this.subtype.add(t);
5202      return this;
5203    }
5204
5205    /**
5206     * @return The first repetition of repeating field {@link #subtype}, creating it
5207     *         if it does not already exist
5208     */
5209    public CodeableConcept getSubtypeFirstRep() {
5210      if (getSubtype().isEmpty()) {
5211        addSubtype();
5212      }
5213      return getSubtype().get(0);
5214    }
5215
5216    /**
5217     * @return {@link #relationship} (Specifies the applicability of the term to an
5218     *         asset resource instance, and instances it refers to orinstances that
5219     *         refer to it, and/or are owned by the offeree.)
5220     */
5221    public Coding getRelationship() {
5222      if (this.relationship == null)
5223        if (Configuration.errorOnAutoCreate())
5224          throw new Error("Attempt to auto-create ContractAssetComponent.relationship");
5225        else if (Configuration.doAutoCreate())
5226          this.relationship = new Coding(); // cc
5227      return this.relationship;
5228    }
5229
5230    public boolean hasRelationship() {
5231      return this.relationship != null && !this.relationship.isEmpty();
5232    }
5233
5234    /**
5235     * @param value {@link #relationship} (Specifies the applicability of the term
5236     *              to an asset resource instance, and instances it refers to
5237     *              orinstances that refer to it, and/or are owned by the offeree.)
5238     */
5239    public ContractAssetComponent setRelationship(Coding value) {
5240      this.relationship = value;
5241      return this;
5242    }
5243
5244    /**
5245     * @return {@link #context} (Circumstance of the asset.)
5246     */
5247    public List<AssetContextComponent> getContext() {
5248      if (this.context == null)
5249        this.context = new ArrayList<AssetContextComponent>();
5250      return this.context;
5251    }
5252
5253    /**
5254     * @return Returns a reference to <code>this</code> for easy method chaining
5255     */
5256    public ContractAssetComponent setContext(List<AssetContextComponent> theContext) {
5257      this.context = theContext;
5258      return this;
5259    }
5260
5261    public boolean hasContext() {
5262      if (this.context == null)
5263        return false;
5264      for (AssetContextComponent item : this.context)
5265        if (!item.isEmpty())
5266          return true;
5267      return false;
5268    }
5269
5270    public AssetContextComponent addContext() { // 3
5271      AssetContextComponent t = new AssetContextComponent();
5272      if (this.context == null)
5273        this.context = new ArrayList<AssetContextComponent>();
5274      this.context.add(t);
5275      return t;
5276    }
5277
5278    public ContractAssetComponent addContext(AssetContextComponent t) { // 3
5279      if (t == null)
5280        return this;
5281      if (this.context == null)
5282        this.context = new ArrayList<AssetContextComponent>();
5283      this.context.add(t);
5284      return this;
5285    }
5286
5287    /**
5288     * @return The first repetition of repeating field {@link #context}, creating it
5289     *         if it does not already exist
5290     */
5291    public AssetContextComponent getContextFirstRep() {
5292      if (getContext().isEmpty()) {
5293        addContext();
5294      }
5295      return getContext().get(0);
5296    }
5297
5298    /**
5299     * @return {@link #condition} (Description of the quality and completeness of
5300     *         the asset that imay be a factor in its valuation.). This is the
5301     *         underlying object with id, value and extensions. The accessor
5302     *         "getCondition" gives direct access to the value
5303     */
5304    public StringType getConditionElement() {
5305      if (this.condition == null)
5306        if (Configuration.errorOnAutoCreate())
5307          throw new Error("Attempt to auto-create ContractAssetComponent.condition");
5308        else if (Configuration.doAutoCreate())
5309          this.condition = new StringType(); // bb
5310      return this.condition;
5311    }
5312
5313    public boolean hasConditionElement() {
5314      return this.condition != null && !this.condition.isEmpty();
5315    }
5316
5317    public boolean hasCondition() {
5318      return this.condition != null && !this.condition.isEmpty();
5319    }
5320
5321    /**
5322     * @param value {@link #condition} (Description of the quality and completeness
5323     *              of the asset that imay be a factor in its valuation.). This is
5324     *              the underlying object with id, value and extensions. The
5325     *              accessor "getCondition" gives direct access to the value
5326     */
5327    public ContractAssetComponent setConditionElement(StringType value) {
5328      this.condition = value;
5329      return this;
5330    }
5331
5332    /**
5333     * @return Description of the quality and completeness of the asset that imay be
5334     *         a factor in its valuation.
5335     */
5336    public String getCondition() {
5337      return this.condition == null ? null : this.condition.getValue();
5338    }
5339
5340    /**
5341     * @param value Description of the quality and completeness of the asset that
5342     *              imay be a factor in its valuation.
5343     */
5344    public ContractAssetComponent setCondition(String value) {
5345      if (Utilities.noString(value))
5346        this.condition = null;
5347      else {
5348        if (this.condition == null)
5349          this.condition = new StringType();
5350        this.condition.setValue(value);
5351      }
5352      return this;
5353    }
5354
5355    /**
5356     * @return {@link #periodType} (Type of Asset availability for use or
5357     *         ownership.)
5358     */
5359    public List<CodeableConcept> getPeriodType() {
5360      if (this.periodType == null)
5361        this.periodType = new ArrayList<CodeableConcept>();
5362      return this.periodType;
5363    }
5364
5365    /**
5366     * @return Returns a reference to <code>this</code> for easy method chaining
5367     */
5368    public ContractAssetComponent setPeriodType(List<CodeableConcept> thePeriodType) {
5369      this.periodType = thePeriodType;
5370      return this;
5371    }
5372
5373    public boolean hasPeriodType() {
5374      if (this.periodType == null)
5375        return false;
5376      for (CodeableConcept item : this.periodType)
5377        if (!item.isEmpty())
5378          return true;
5379      return false;
5380    }
5381
5382    public CodeableConcept addPeriodType() { // 3
5383      CodeableConcept t = new CodeableConcept();
5384      if (this.periodType == null)
5385        this.periodType = new ArrayList<CodeableConcept>();
5386      this.periodType.add(t);
5387      return t;
5388    }
5389
5390    public ContractAssetComponent addPeriodType(CodeableConcept t) { // 3
5391      if (t == null)
5392        return this;
5393      if (this.periodType == null)
5394        this.periodType = new ArrayList<CodeableConcept>();
5395      this.periodType.add(t);
5396      return this;
5397    }
5398
5399    /**
5400     * @return The first repetition of repeating field {@link #periodType}, creating
5401     *         it if it does not already exist
5402     */
5403    public CodeableConcept getPeriodTypeFirstRep() {
5404      if (getPeriodType().isEmpty()) {
5405        addPeriodType();
5406      }
5407      return getPeriodType().get(0);
5408    }
5409
5410    /**
5411     * @return {@link #period} (Asset relevant contractual time period.)
5412     */
5413    public List<Period> getPeriod() {
5414      if (this.period == null)
5415        this.period = new ArrayList<Period>();
5416      return this.period;
5417    }
5418
5419    /**
5420     * @return Returns a reference to <code>this</code> for easy method chaining
5421     */
5422    public ContractAssetComponent setPeriod(List<Period> thePeriod) {
5423      this.period = thePeriod;
5424      return this;
5425    }
5426
5427    public boolean hasPeriod() {
5428      if (this.period == null)
5429        return false;
5430      for (Period item : this.period)
5431        if (!item.isEmpty())
5432          return true;
5433      return false;
5434    }
5435
5436    public Period addPeriod() { // 3
5437      Period t = new Period();
5438      if (this.period == null)
5439        this.period = new ArrayList<Period>();
5440      this.period.add(t);
5441      return t;
5442    }
5443
5444    public ContractAssetComponent addPeriod(Period t) { // 3
5445      if (t == null)
5446        return this;
5447      if (this.period == null)
5448        this.period = new ArrayList<Period>();
5449      this.period.add(t);
5450      return this;
5451    }
5452
5453    /**
5454     * @return The first repetition of repeating field {@link #period}, creating it
5455     *         if it does not already exist
5456     */
5457    public Period getPeriodFirstRep() {
5458      if (getPeriod().isEmpty()) {
5459        addPeriod();
5460      }
5461      return getPeriod().get(0);
5462    }
5463
5464    /**
5465     * @return {@link #usePeriod} (Time period of asset use.)
5466     */
5467    public List<Period> getUsePeriod() {
5468      if (this.usePeriod == null)
5469        this.usePeriod = new ArrayList<Period>();
5470      return this.usePeriod;
5471    }
5472
5473    /**
5474     * @return Returns a reference to <code>this</code> for easy method chaining
5475     */
5476    public ContractAssetComponent setUsePeriod(List<Period> theUsePeriod) {
5477      this.usePeriod = theUsePeriod;
5478      return this;
5479    }
5480
5481    public boolean hasUsePeriod() {
5482      if (this.usePeriod == null)
5483        return false;
5484      for (Period item : this.usePeriod)
5485        if (!item.isEmpty())
5486          return true;
5487      return false;
5488    }
5489
5490    public Period addUsePeriod() { // 3
5491      Period t = new Period();
5492      if (this.usePeriod == null)
5493        this.usePeriod = new ArrayList<Period>();
5494      this.usePeriod.add(t);
5495      return t;
5496    }
5497
5498    public ContractAssetComponent addUsePeriod(Period t) { // 3
5499      if (t == null)
5500        return this;
5501      if (this.usePeriod == null)
5502        this.usePeriod = new ArrayList<Period>();
5503      this.usePeriod.add(t);
5504      return this;
5505    }
5506
5507    /**
5508     * @return The first repetition of repeating field {@link #usePeriod}, creating
5509     *         it if it does not already exist
5510     */
5511    public Period getUsePeriodFirstRep() {
5512      if (getUsePeriod().isEmpty()) {
5513        addUsePeriod();
5514      }
5515      return getUsePeriod().get(0);
5516    }
5517
5518    /**
5519     * @return {@link #text} (Clause or question text (Prose Object) concerning the
5520     *         asset in a linked form, such as a QuestionnaireResponse used in the
5521     *         formation of the contract.). This is the underlying object with id,
5522     *         value and extensions. The accessor "getText" gives direct access to
5523     *         the value
5524     */
5525    public StringType getTextElement() {
5526      if (this.text == null)
5527        if (Configuration.errorOnAutoCreate())
5528          throw new Error("Attempt to auto-create ContractAssetComponent.text");
5529        else if (Configuration.doAutoCreate())
5530          this.text = new StringType(); // bb
5531      return this.text;
5532    }
5533
5534    public boolean hasTextElement() {
5535      return this.text != null && !this.text.isEmpty();
5536    }
5537
5538    public boolean hasText() {
5539      return this.text != null && !this.text.isEmpty();
5540    }
5541
5542    /**
5543     * @param value {@link #text} (Clause or question text (Prose Object) concerning
5544     *              the asset in a linked form, such as a QuestionnaireResponse used
5545     *              in the formation of the contract.). This is the underlying
5546     *              object with id, value and extensions. The accessor "getText"
5547     *              gives direct access to the value
5548     */
5549    public ContractAssetComponent setTextElement(StringType value) {
5550      this.text = value;
5551      return this;
5552    }
5553
5554    /**
5555     * @return Clause or question text (Prose Object) concerning the asset in a
5556     *         linked form, such as a QuestionnaireResponse used in the formation of
5557     *         the contract.
5558     */
5559    public String getText() {
5560      return this.text == null ? null : this.text.getValue();
5561    }
5562
5563    /**
5564     * @param value Clause or question text (Prose Object) concerning the asset in a
5565     *              linked form, such as a QuestionnaireResponse used in the
5566     *              formation of the contract.
5567     */
5568    public ContractAssetComponent setText(String value) {
5569      if (Utilities.noString(value))
5570        this.text = null;
5571      else {
5572        if (this.text == null)
5573          this.text = new StringType();
5574        this.text.setValue(value);
5575      }
5576      return this;
5577    }
5578
5579    /**
5580     * @return {@link #linkId} (Id [identifier??] of the clause or question text
5581     *         about the asset in the referenced form or QuestionnaireResponse.)
5582     */
5583    public List<StringType> getLinkId() {
5584      if (this.linkId == null)
5585        this.linkId = new ArrayList<StringType>();
5586      return this.linkId;
5587    }
5588
5589    /**
5590     * @return Returns a reference to <code>this</code> for easy method chaining
5591     */
5592    public ContractAssetComponent setLinkId(List<StringType> theLinkId) {
5593      this.linkId = theLinkId;
5594      return this;
5595    }
5596
5597    public boolean hasLinkId() {
5598      if (this.linkId == null)
5599        return false;
5600      for (StringType item : this.linkId)
5601        if (!item.isEmpty())
5602          return true;
5603      return false;
5604    }
5605
5606    /**
5607     * @return {@link #linkId} (Id [identifier??] of the clause or question text
5608     *         about the asset in the referenced form or QuestionnaireResponse.)
5609     */
5610    public StringType addLinkIdElement() {// 2
5611      StringType t = new StringType();
5612      if (this.linkId == null)
5613        this.linkId = new ArrayList<StringType>();
5614      this.linkId.add(t);
5615      return t;
5616    }
5617
5618    /**
5619     * @param value {@link #linkId} (Id [identifier??] of the clause or question
5620     *              text about the asset in the referenced form or
5621     *              QuestionnaireResponse.)
5622     */
5623    public ContractAssetComponent addLinkId(String value) { // 1
5624      StringType t = new StringType();
5625      t.setValue(value);
5626      if (this.linkId == null)
5627        this.linkId = new ArrayList<StringType>();
5628      this.linkId.add(t);
5629      return this;
5630    }
5631
5632    /**
5633     * @param value {@link #linkId} (Id [identifier??] of the clause or question
5634     *              text about the asset in the referenced form or
5635     *              QuestionnaireResponse.)
5636     */
5637    public boolean hasLinkId(String value) {
5638      if (this.linkId == null)
5639        return false;
5640      for (StringType v : this.linkId)
5641        if (v.getValue().equals(value)) // string
5642          return true;
5643      return false;
5644    }
5645
5646    /**
5647     * @return {@link #answer} (Response to assets.)
5648     */
5649    public List<AnswerComponent> getAnswer() {
5650      if (this.answer == null)
5651        this.answer = new ArrayList<AnswerComponent>();
5652      return this.answer;
5653    }
5654
5655    /**
5656     * @return Returns a reference to <code>this</code> for easy method chaining
5657     */
5658    public ContractAssetComponent setAnswer(List<AnswerComponent> theAnswer) {
5659      this.answer = theAnswer;
5660      return this;
5661    }
5662
5663    public boolean hasAnswer() {
5664      if (this.answer == null)
5665        return false;
5666      for (AnswerComponent item : this.answer)
5667        if (!item.isEmpty())
5668          return true;
5669      return false;
5670    }
5671
5672    public AnswerComponent addAnswer() { // 3
5673      AnswerComponent t = new AnswerComponent();
5674      if (this.answer == null)
5675        this.answer = new ArrayList<AnswerComponent>();
5676      this.answer.add(t);
5677      return t;
5678    }
5679
5680    public ContractAssetComponent addAnswer(AnswerComponent t) { // 3
5681      if (t == null)
5682        return this;
5683      if (this.answer == null)
5684        this.answer = new ArrayList<AnswerComponent>();
5685      this.answer.add(t);
5686      return this;
5687    }
5688
5689    /**
5690     * @return The first repetition of repeating field {@link #answer}, creating it
5691     *         if it does not already exist
5692     */
5693    public AnswerComponent getAnswerFirstRep() {
5694      if (getAnswer().isEmpty()) {
5695        addAnswer();
5696      }
5697      return getAnswer().get(0);
5698    }
5699
5700    /**
5701     * @return {@link #securityLabelNumber} (Security labels that protects the
5702     *         asset.)
5703     */
5704    public List<UnsignedIntType> getSecurityLabelNumber() {
5705      if (this.securityLabelNumber == null)
5706        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5707      return this.securityLabelNumber;
5708    }
5709
5710    /**
5711     * @return Returns a reference to <code>this</code> for easy method chaining
5712     */
5713    public ContractAssetComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
5714      this.securityLabelNumber = theSecurityLabelNumber;
5715      return this;
5716    }
5717
5718    public boolean hasSecurityLabelNumber() {
5719      if (this.securityLabelNumber == null)
5720        return false;
5721      for (UnsignedIntType item : this.securityLabelNumber)
5722        if (!item.isEmpty())
5723          return true;
5724      return false;
5725    }
5726
5727    /**
5728     * @return {@link #securityLabelNumber} (Security labels that protects the
5729     *         asset.)
5730     */
5731    public UnsignedIntType addSecurityLabelNumberElement() {// 2
5732      UnsignedIntType t = new UnsignedIntType();
5733      if (this.securityLabelNumber == null)
5734        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5735      this.securityLabelNumber.add(t);
5736      return t;
5737    }
5738
5739    /**
5740     * @param value {@link #securityLabelNumber} (Security labels that protects the
5741     *              asset.)
5742     */
5743    public ContractAssetComponent addSecurityLabelNumber(int value) { // 1
5744      UnsignedIntType t = new UnsignedIntType();
5745      t.setValue(value);
5746      if (this.securityLabelNumber == null)
5747        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
5748      this.securityLabelNumber.add(t);
5749      return this;
5750    }
5751
5752    /**
5753     * @param value {@link #securityLabelNumber} (Security labels that protects the
5754     *              asset.)
5755     */
5756    public boolean hasSecurityLabelNumber(int value) {
5757      if (this.securityLabelNumber == null)
5758        return false;
5759      for (UnsignedIntType v : this.securityLabelNumber)
5760        if (v.getValue().equals(value)) // unsignedInt
5761          return true;
5762      return false;
5763    }
5764
5765    /**
5766     * @return {@link #valuedItem} (Contract Valued Item List.)
5767     */
5768    public List<ValuedItemComponent> getValuedItem() {
5769      if (this.valuedItem == null)
5770        this.valuedItem = new ArrayList<ValuedItemComponent>();
5771      return this.valuedItem;
5772    }
5773
5774    /**
5775     * @return Returns a reference to <code>this</code> for easy method chaining
5776     */
5777    public ContractAssetComponent setValuedItem(List<ValuedItemComponent> theValuedItem) {
5778      this.valuedItem = theValuedItem;
5779      return this;
5780    }
5781
5782    public boolean hasValuedItem() {
5783      if (this.valuedItem == null)
5784        return false;
5785      for (ValuedItemComponent item : this.valuedItem)
5786        if (!item.isEmpty())
5787          return true;
5788      return false;
5789    }
5790
5791    public ValuedItemComponent addValuedItem() { // 3
5792      ValuedItemComponent t = new ValuedItemComponent();
5793      if (this.valuedItem == null)
5794        this.valuedItem = new ArrayList<ValuedItemComponent>();
5795      this.valuedItem.add(t);
5796      return t;
5797    }
5798
5799    public ContractAssetComponent addValuedItem(ValuedItemComponent t) { // 3
5800      if (t == null)
5801        return this;
5802      if (this.valuedItem == null)
5803        this.valuedItem = new ArrayList<ValuedItemComponent>();
5804      this.valuedItem.add(t);
5805      return this;
5806    }
5807
5808    /**
5809     * @return The first repetition of repeating field {@link #valuedItem}, creating
5810     *         it if it does not already exist
5811     */
5812    public ValuedItemComponent getValuedItemFirstRep() {
5813      if (getValuedItem().isEmpty()) {
5814        addValuedItem();
5815      }
5816      return getValuedItem().get(0);
5817    }
5818
5819    protected void listChildren(List<Property> children) {
5820      super.listChildren(children);
5821      children.add(new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1, scope));
5822      children.add(new Property("type", "CodeableConcept", "Target entity type about which the term may be concerned.",
5823          0, java.lang.Integer.MAX_VALUE, type));
5824      children.add(new Property("typeReference", "Reference(Any)", "Associated entities.", 0,
5825          java.lang.Integer.MAX_VALUE, typeReference));
5826      children.add(new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.", 0,
5827          java.lang.Integer.MAX_VALUE, subtype));
5828      children.add(new Property("relationship", "Coding",
5829          "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.",
5830          0, 1, relationship));
5831      children.add(new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE, context));
5832      children.add(new Property("condition", "string",
5833          "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1,
5834          condition));
5835      children.add(new Property("periodType", "CodeableConcept", "Type of Asset availability for use or ownership.", 0,
5836          java.lang.Integer.MAX_VALUE, periodType));
5837      children.add(new Property("period", "Period", "Asset relevant contractual time period.", 0,
5838          java.lang.Integer.MAX_VALUE, period));
5839      children.add(
5840          new Property("usePeriod", "Period", "Time period of asset use.", 0, java.lang.Integer.MAX_VALUE, usePeriod));
5841      children.add(new Property("text", "string",
5842          "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.",
5843          0, 1, text));
5844      children.add(new Property("linkId", "string",
5845          "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.",
5846          0, java.lang.Integer.MAX_VALUE, linkId));
5847      children.add(new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0,
5848          java.lang.Integer.MAX_VALUE, answer));
5849      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the asset.", 0,
5850          java.lang.Integer.MAX_VALUE, securityLabelNumber));
5851      children.add(
5852          new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
5853    }
5854
5855    @Override
5856    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5857      switch (_hash) {
5858      case 109264468:
5859        /* scope */ return new Property("scope", "CodeableConcept", "Differentiates the kind of the asset .", 0, 1,
5860            scope);
5861      case 3575610:
5862        /* type */ return new Property("type", "CodeableConcept",
5863            "Target entity type about which the term may be concerned.", 0, java.lang.Integer.MAX_VALUE, type);
5864      case 2074825009:
5865        /* typeReference */ return new Property("typeReference", "Reference(Any)", "Associated entities.", 0,
5866            java.lang.Integer.MAX_VALUE, typeReference);
5867      case -1867567750:
5868        /* subtype */ return new Property("subtype", "CodeableConcept", "May be a subtype or part of an offered asset.",
5869            0, java.lang.Integer.MAX_VALUE, subtype);
5870      case -261851592:
5871        /* relationship */ return new Property("relationship", "Coding",
5872            "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.",
5873            0, 1, relationship);
5874      case 951530927:
5875        /* context */ return new Property("context", "", "Circumstance of the asset.", 0, java.lang.Integer.MAX_VALUE,
5876            context);
5877      case -861311717:
5878        /* condition */ return new Property("condition", "string",
5879            "Description of the quality and completeness of the asset that imay be a factor in its valuation.", 0, 1,
5880            condition);
5881      case 384348315:
5882        /* periodType */ return new Property("periodType", "CodeableConcept",
5883            "Type of Asset availability for use or ownership.", 0, java.lang.Integer.MAX_VALUE, periodType);
5884      case -991726143:
5885        /* period */ return new Property("period", "Period", "Asset relevant contractual time period.", 0,
5886            java.lang.Integer.MAX_VALUE, period);
5887      case -628382168:
5888        /* usePeriod */ return new Property("usePeriod", "Period", "Time period of asset use.", 0,
5889            java.lang.Integer.MAX_VALUE, usePeriod);
5890      case 3556653:
5891        /* text */ return new Property("text", "string",
5892            "Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.",
5893            0, 1, text);
5894      case -1102667083:
5895        /* linkId */ return new Property("linkId", "string",
5896            "Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.",
5897            0, java.lang.Integer.MAX_VALUE, linkId);
5898      case -1412808770:
5899        /* answer */ return new Property("answer", "@Contract.term.offer.answer", "Response to assets.", 0,
5900            java.lang.Integer.MAX_VALUE, answer);
5901      case -149460995:
5902        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
5903            "Security labels that protects the asset.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
5904      case 2046675654:
5905        /* valuedItem */ return new Property("valuedItem", "", "Contract Valued Item List.", 0,
5906            java.lang.Integer.MAX_VALUE, valuedItem);
5907      default:
5908        return super.getNamedProperty(_hash, _name, _checkValid);
5909      }
5910
5911    }
5912
5913    @Override
5914    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5915      switch (hash) {
5916      case 109264468:
5917        /* scope */ return this.scope == null ? new Base[0] : new Base[] { this.scope }; // CodeableConcept
5918      case 3575610:
5919        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
5920      case 2074825009:
5921        /* typeReference */ return this.typeReference == null ? new Base[0]
5922            : this.typeReference.toArray(new Base[this.typeReference.size()]); // Reference
5923      case -1867567750:
5924        /* subtype */ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
5925      case -261851592:
5926        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // Coding
5927      case 951530927:
5928        /* context */ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // AssetContextComponent
5929      case -861311717:
5930        /* condition */ return this.condition == null ? new Base[0] : new Base[] { this.condition }; // StringType
5931      case 384348315:
5932        /* periodType */ return this.periodType == null ? new Base[0]
5933            : this.periodType.toArray(new Base[this.periodType.size()]); // CodeableConcept
5934      case -991726143:
5935        /* period */ return this.period == null ? new Base[0] : this.period.toArray(new Base[this.period.size()]); // Period
5936      case -628382168:
5937        /* usePeriod */ return this.usePeriod == null ? new Base[0]
5938            : this.usePeriod.toArray(new Base[this.usePeriod.size()]); // Period
5939      case 3556653:
5940        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
5941      case -1102667083:
5942        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
5943      case -1412808770:
5944        /* answer */ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // AnswerComponent
5945      case -149460995:
5946        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
5947            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
5948      case 2046675654:
5949        /* valuedItem */ return this.valuedItem == null ? new Base[0]
5950            : this.valuedItem.toArray(new Base[this.valuedItem.size()]); // ValuedItemComponent
5951      default:
5952        return super.getProperty(hash, name, checkValid);
5953      }
5954
5955    }
5956
5957    @Override
5958    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5959      switch (hash) {
5960      case 109264468: // scope
5961        this.scope = castToCodeableConcept(value); // CodeableConcept
5962        return value;
5963      case 3575610: // type
5964        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
5965        return value;
5966      case 2074825009: // typeReference
5967        this.getTypeReference().add(castToReference(value)); // Reference
5968        return value;
5969      case -1867567750: // subtype
5970        this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
5971        return value;
5972      case -261851592: // relationship
5973        this.relationship = castToCoding(value); // Coding
5974        return value;
5975      case 951530927: // context
5976        this.getContext().add((AssetContextComponent) value); // AssetContextComponent
5977        return value;
5978      case -861311717: // condition
5979        this.condition = castToString(value); // StringType
5980        return value;
5981      case 384348315: // periodType
5982        this.getPeriodType().add(castToCodeableConcept(value)); // CodeableConcept
5983        return value;
5984      case -991726143: // period
5985        this.getPeriod().add(castToPeriod(value)); // Period
5986        return value;
5987      case -628382168: // usePeriod
5988        this.getUsePeriod().add(castToPeriod(value)); // Period
5989        return value;
5990      case 3556653: // text
5991        this.text = castToString(value); // StringType
5992        return value;
5993      case -1102667083: // linkId
5994        this.getLinkId().add(castToString(value)); // StringType
5995        return value;
5996      case -1412808770: // answer
5997        this.getAnswer().add((AnswerComponent) value); // AnswerComponent
5998        return value;
5999      case -149460995: // securityLabelNumber
6000        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
6001        return value;
6002      case 2046675654: // valuedItem
6003        this.getValuedItem().add((ValuedItemComponent) value); // ValuedItemComponent
6004        return value;
6005      default:
6006        return super.setProperty(hash, name, value);
6007      }
6008
6009    }
6010
6011    @Override
6012    public Base setProperty(String name, Base value) throws FHIRException {
6013      if (name.equals("scope")) {
6014        this.scope = castToCodeableConcept(value); // CodeableConcept
6015      } else if (name.equals("type")) {
6016        this.getType().add(castToCodeableConcept(value));
6017      } else if (name.equals("typeReference")) {
6018        this.getTypeReference().add(castToReference(value));
6019      } else if (name.equals("subtype")) {
6020        this.getSubtype().add(castToCodeableConcept(value));
6021      } else if (name.equals("relationship")) {
6022        this.relationship = castToCoding(value); // Coding
6023      } else if (name.equals("context")) {
6024        this.getContext().add((AssetContextComponent) value);
6025      } else if (name.equals("condition")) {
6026        this.condition = castToString(value); // StringType
6027      } else if (name.equals("periodType")) {
6028        this.getPeriodType().add(castToCodeableConcept(value));
6029      } else if (name.equals("period")) {
6030        this.getPeriod().add(castToPeriod(value));
6031      } else if (name.equals("usePeriod")) {
6032        this.getUsePeriod().add(castToPeriod(value));
6033      } else if (name.equals("text")) {
6034        this.text = castToString(value); // StringType
6035      } else if (name.equals("linkId")) {
6036        this.getLinkId().add(castToString(value));
6037      } else if (name.equals("answer")) {
6038        this.getAnswer().add((AnswerComponent) value);
6039      } else if (name.equals("securityLabelNumber")) {
6040        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
6041      } else if (name.equals("valuedItem")) {
6042        this.getValuedItem().add((ValuedItemComponent) value);
6043      } else
6044        return super.setProperty(name, value);
6045      return value;
6046    }
6047
6048  @Override
6049  public void removeChild(String name, Base value) throws FHIRException {
6050      if (name.equals("scope")) {
6051        this.scope = null;
6052      } else if (name.equals("type")) {
6053        this.getType().remove(castToCodeableConcept(value));
6054      } else if (name.equals("typeReference")) {
6055        this.getTypeReference().remove(castToReference(value));
6056      } else if (name.equals("subtype")) {
6057        this.getSubtype().remove(castToCodeableConcept(value));
6058      } else if (name.equals("relationship")) {
6059        this.relationship = null;
6060      } else if (name.equals("context")) {
6061        this.getContext().remove((AssetContextComponent) value);
6062      } else if (name.equals("condition")) {
6063        this.condition = null;
6064      } else if (name.equals("periodType")) {
6065        this.getPeriodType().remove(castToCodeableConcept(value));
6066      } else if (name.equals("period")) {
6067        this.getPeriod().remove(castToPeriod(value));
6068      } else if (name.equals("usePeriod")) {
6069        this.getUsePeriod().remove(castToPeriod(value));
6070      } else if (name.equals("text")) {
6071        this.text = null;
6072      } else if (name.equals("linkId")) {
6073        this.getLinkId().remove(castToString(value));
6074      } else if (name.equals("answer")) {
6075        this.getAnswer().remove((AnswerComponent) value);
6076      } else if (name.equals("securityLabelNumber")) {
6077        this.getSecurityLabelNumber().remove(castToUnsignedInt(value));
6078      } else if (name.equals("valuedItem")) {
6079        this.getValuedItem().remove((ValuedItemComponent) value);
6080      } else
6081        super.removeChild(name, value);
6082      
6083    }
6084
6085    @Override
6086    public Base makeProperty(int hash, String name) throws FHIRException {
6087      switch (hash) {
6088      case 109264468:
6089        return getScope();
6090      case 3575610:
6091        return addType();
6092      case 2074825009:
6093        return addTypeReference();
6094      case -1867567750:
6095        return addSubtype();
6096      case -261851592:
6097        return getRelationship();
6098      case 951530927:
6099        return addContext();
6100      case -861311717:
6101        return getConditionElement();
6102      case 384348315:
6103        return addPeriodType();
6104      case -991726143:
6105        return addPeriod();
6106      case -628382168:
6107        return addUsePeriod();
6108      case 3556653:
6109        return getTextElement();
6110      case -1102667083:
6111        return addLinkIdElement();
6112      case -1412808770:
6113        return addAnswer();
6114      case -149460995:
6115        return addSecurityLabelNumberElement();
6116      case 2046675654:
6117        return addValuedItem();
6118      default:
6119        return super.makeProperty(hash, name);
6120      }
6121
6122    }
6123
6124    @Override
6125    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6126      switch (hash) {
6127      case 109264468:
6128        /* scope */ return new String[] { "CodeableConcept" };
6129      case 3575610:
6130        /* type */ return new String[] { "CodeableConcept" };
6131      case 2074825009:
6132        /* typeReference */ return new String[] { "Reference" };
6133      case -1867567750:
6134        /* subtype */ return new String[] { "CodeableConcept" };
6135      case -261851592:
6136        /* relationship */ return new String[] { "Coding" };
6137      case 951530927:
6138        /* context */ return new String[] {};
6139      case -861311717:
6140        /* condition */ return new String[] { "string" };
6141      case 384348315:
6142        /* periodType */ return new String[] { "CodeableConcept" };
6143      case -991726143:
6144        /* period */ return new String[] { "Period" };
6145      case -628382168:
6146        /* usePeriod */ return new String[] { "Period" };
6147      case 3556653:
6148        /* text */ return new String[] { "string" };
6149      case -1102667083:
6150        /* linkId */ return new String[] { "string" };
6151      case -1412808770:
6152        /* answer */ return new String[] { "@Contract.term.offer.answer" };
6153      case -149460995:
6154        /* securityLabelNumber */ return new String[] { "unsignedInt" };
6155      case 2046675654:
6156        /* valuedItem */ return new String[] {};
6157      default:
6158        return super.getTypesForProperty(hash, name);
6159      }
6160
6161    }
6162
6163    @Override
6164    public Base addChild(String name) throws FHIRException {
6165      if (name.equals("scope")) {
6166        this.scope = new CodeableConcept();
6167        return this.scope;
6168      } else if (name.equals("type")) {
6169        return addType();
6170      } else if (name.equals("typeReference")) {
6171        return addTypeReference();
6172      } else if (name.equals("subtype")) {
6173        return addSubtype();
6174      } else if (name.equals("relationship")) {
6175        this.relationship = new Coding();
6176        return this.relationship;
6177      } else if (name.equals("context")) {
6178        return addContext();
6179      } else if (name.equals("condition")) {
6180        throw new FHIRException("Cannot call addChild on a singleton property Contract.condition");
6181      } else if (name.equals("periodType")) {
6182        return addPeriodType();
6183      } else if (name.equals("period")) {
6184        return addPeriod();
6185      } else if (name.equals("usePeriod")) {
6186        return addUsePeriod();
6187      } else if (name.equals("text")) {
6188        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
6189      } else if (name.equals("linkId")) {
6190        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
6191      } else if (name.equals("answer")) {
6192        return addAnswer();
6193      } else if (name.equals("securityLabelNumber")) {
6194        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
6195      } else if (name.equals("valuedItem")) {
6196        return addValuedItem();
6197      } else
6198        return super.addChild(name);
6199    }
6200
6201    public ContractAssetComponent copy() {
6202      ContractAssetComponent dst = new ContractAssetComponent();
6203      copyValues(dst);
6204      return dst;
6205    }
6206
6207    public void copyValues(ContractAssetComponent dst) {
6208      super.copyValues(dst);
6209      dst.scope = scope == null ? null : scope.copy();
6210      if (type != null) {
6211        dst.type = new ArrayList<CodeableConcept>();
6212        for (CodeableConcept i : type)
6213          dst.type.add(i.copy());
6214      }
6215      ;
6216      if (typeReference != null) {
6217        dst.typeReference = new ArrayList<Reference>();
6218        for (Reference i : typeReference)
6219          dst.typeReference.add(i.copy());
6220      }
6221      ;
6222      if (subtype != null) {
6223        dst.subtype = new ArrayList<CodeableConcept>();
6224        for (CodeableConcept i : subtype)
6225          dst.subtype.add(i.copy());
6226      }
6227      ;
6228      dst.relationship = relationship == null ? null : relationship.copy();
6229      if (context != null) {
6230        dst.context = new ArrayList<AssetContextComponent>();
6231        for (AssetContextComponent i : context)
6232          dst.context.add(i.copy());
6233      }
6234      ;
6235      dst.condition = condition == null ? null : condition.copy();
6236      if (periodType != null) {
6237        dst.periodType = new ArrayList<CodeableConcept>();
6238        for (CodeableConcept i : periodType)
6239          dst.periodType.add(i.copy());
6240      }
6241      ;
6242      if (period != null) {
6243        dst.period = new ArrayList<Period>();
6244        for (Period i : period)
6245          dst.period.add(i.copy());
6246      }
6247      ;
6248      if (usePeriod != null) {
6249        dst.usePeriod = new ArrayList<Period>();
6250        for (Period i : usePeriod)
6251          dst.usePeriod.add(i.copy());
6252      }
6253      ;
6254      dst.text = text == null ? null : text.copy();
6255      if (linkId != null) {
6256        dst.linkId = new ArrayList<StringType>();
6257        for (StringType i : linkId)
6258          dst.linkId.add(i.copy());
6259      }
6260      ;
6261      if (answer != null) {
6262        dst.answer = new ArrayList<AnswerComponent>();
6263        for (AnswerComponent i : answer)
6264          dst.answer.add(i.copy());
6265      }
6266      ;
6267      if (securityLabelNumber != null) {
6268        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
6269        for (UnsignedIntType i : securityLabelNumber)
6270          dst.securityLabelNumber.add(i.copy());
6271      }
6272      ;
6273      if (valuedItem != null) {
6274        dst.valuedItem = new ArrayList<ValuedItemComponent>();
6275        for (ValuedItemComponent i : valuedItem)
6276          dst.valuedItem.add(i.copy());
6277      }
6278      ;
6279    }
6280
6281    @Override
6282    public boolean equalsDeep(Base other_) {
6283      if (!super.equalsDeep(other_))
6284        return false;
6285      if (!(other_ instanceof ContractAssetComponent))
6286        return false;
6287      ContractAssetComponent o = (ContractAssetComponent) other_;
6288      return compareDeep(scope, o.scope, true) && compareDeep(type, o.type, true)
6289          && compareDeep(typeReference, o.typeReference, true) && compareDeep(subtype, o.subtype, true)
6290          && compareDeep(relationship, o.relationship, true) && compareDeep(context, o.context, true)
6291          && compareDeep(condition, o.condition, true) && compareDeep(periodType, o.periodType, true)
6292          && compareDeep(period, o.period, true) && compareDeep(usePeriod, o.usePeriod, true)
6293          && compareDeep(text, o.text, true) && compareDeep(linkId, o.linkId, true)
6294          && compareDeep(answer, o.answer, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true)
6295          && compareDeep(valuedItem, o.valuedItem, true);
6296    }
6297
6298    @Override
6299    public boolean equalsShallow(Base other_) {
6300      if (!super.equalsShallow(other_))
6301        return false;
6302      if (!(other_ instanceof ContractAssetComponent))
6303        return false;
6304      ContractAssetComponent o = (ContractAssetComponent) other_;
6305      return compareValues(condition, o.condition, true) && compareValues(text, o.text, true)
6306          && compareValues(linkId, o.linkId, true) && compareValues(securityLabelNumber, o.securityLabelNumber, true);
6307    }
6308
6309    public boolean isEmpty() {
6310      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(scope, type, typeReference, subtype, relationship,
6311          context, condition, periodType, period, usePeriod, text, linkId, answer, securityLabelNumber, valuedItem);
6312    }
6313
6314    public String fhirType() {
6315      return "Contract.term.asset";
6316
6317    }
6318
6319  }
6320
6321  @Block()
6322  public static class AssetContextComponent extends BackboneElement implements IBaseBackboneElement {
6323    /**
6324     * Asset context reference may include the creator, custodian, or owning Person
6325     * or Organization (e.g., bank, repository), location held, e.g., building,
6326     * jurisdiction.
6327     */
6328    @Child(name = "reference", type = {
6329        Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
6330    @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.")
6331    protected Reference reference;
6332
6333    /**
6334     * The actual object that is the target of the reference (Asset context
6335     * reference may include the creator, custodian, or owning Person or
6336     * Organization (e.g., bank, repository), location held, e.g., building,
6337     * jurisdiction.)
6338     */
6339    protected Resource referenceTarget;
6340
6341    /**
6342     * Coded representation of the context generally or of the Referenced entity,
6343     * such as the asset holder type or location.
6344     */
6345    @Child(name = "code", type = {
6346        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6347    @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.")
6348    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-assetcontext")
6349    protected List<CodeableConcept> code;
6350
6351    /**
6352     * Context description.
6353     */
6354    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6355    @Description(shortDefinition = "Context description", formalDefinition = "Context description.")
6356    protected StringType text;
6357
6358    private static final long serialVersionUID = -634115628L;
6359
6360    /**
6361     * Constructor
6362     */
6363    public AssetContextComponent() {
6364      super();
6365    }
6366
6367    /**
6368     * @return {@link #reference} (Asset context reference may include the creator,
6369     *         custodian, or owning Person or Organization (e.g., bank, repository),
6370     *         location held, e.g., building, jurisdiction.)
6371     */
6372    public Reference getReference() {
6373      if (this.reference == null)
6374        if (Configuration.errorOnAutoCreate())
6375          throw new Error("Attempt to auto-create AssetContextComponent.reference");
6376        else if (Configuration.doAutoCreate())
6377          this.reference = new Reference(); // cc
6378      return this.reference;
6379    }
6380
6381    public boolean hasReference() {
6382      return this.reference != null && !this.reference.isEmpty();
6383    }
6384
6385    /**
6386     * @param value {@link #reference} (Asset context reference may include the
6387     *              creator, custodian, or owning Person or Organization (e.g.,
6388     *              bank, repository), location held, e.g., building, jurisdiction.)
6389     */
6390    public AssetContextComponent setReference(Reference value) {
6391      this.reference = value;
6392      return this;
6393    }
6394
6395    /**
6396     * @return {@link #reference} The actual object that is the target of the
6397     *         reference. The reference library doesn't populate this, but you can
6398     *         use it to hold the resource if you resolve it. (Asset context
6399     *         reference may include the creator, custodian, or owning Person or
6400     *         Organization (e.g., bank, repository), location held, e.g., building,
6401     *         jurisdiction.)
6402     */
6403    public Resource getReferenceTarget() {
6404      return this.referenceTarget;
6405    }
6406
6407    /**
6408     * @param value {@link #reference} The actual object that is the target of the
6409     *              reference. The reference library doesn't use these, but you can
6410     *              use it to hold the resource if you resolve it. (Asset context
6411     *              reference may include the creator, custodian, or owning Person
6412     *              or Organization (e.g., bank, repository), location held, e.g.,
6413     *              building, jurisdiction.)
6414     */
6415    public AssetContextComponent setReferenceTarget(Resource value) {
6416      this.referenceTarget = value;
6417      return this;
6418    }
6419
6420    /**
6421     * @return {@link #code} (Coded representation of the context generally or of
6422     *         the Referenced entity, such as the asset holder type or location.)
6423     */
6424    public List<CodeableConcept> getCode() {
6425      if (this.code == null)
6426        this.code = new ArrayList<CodeableConcept>();
6427      return this.code;
6428    }
6429
6430    /**
6431     * @return Returns a reference to <code>this</code> for easy method chaining
6432     */
6433    public AssetContextComponent setCode(List<CodeableConcept> theCode) {
6434      this.code = theCode;
6435      return this;
6436    }
6437
6438    public boolean hasCode() {
6439      if (this.code == null)
6440        return false;
6441      for (CodeableConcept item : this.code)
6442        if (!item.isEmpty())
6443          return true;
6444      return false;
6445    }
6446
6447    public CodeableConcept addCode() { // 3
6448      CodeableConcept t = new CodeableConcept();
6449      if (this.code == null)
6450        this.code = new ArrayList<CodeableConcept>();
6451      this.code.add(t);
6452      return t;
6453    }
6454
6455    public AssetContextComponent addCode(CodeableConcept t) { // 3
6456      if (t == null)
6457        return this;
6458      if (this.code == null)
6459        this.code = new ArrayList<CodeableConcept>();
6460      this.code.add(t);
6461      return this;
6462    }
6463
6464    /**
6465     * @return The first repetition of repeating field {@link #code}, creating it if
6466     *         it does not already exist
6467     */
6468    public CodeableConcept getCodeFirstRep() {
6469      if (getCode().isEmpty()) {
6470        addCode();
6471      }
6472      return getCode().get(0);
6473    }
6474
6475    /**
6476     * @return {@link #text} (Context description.). This is the underlying object
6477     *         with id, value and extensions. The accessor "getText" gives direct
6478     *         access to the value
6479     */
6480    public StringType getTextElement() {
6481      if (this.text == null)
6482        if (Configuration.errorOnAutoCreate())
6483          throw new Error("Attempt to auto-create AssetContextComponent.text");
6484        else if (Configuration.doAutoCreate())
6485          this.text = new StringType(); // bb
6486      return this.text;
6487    }
6488
6489    public boolean hasTextElement() {
6490      return this.text != null && !this.text.isEmpty();
6491    }
6492
6493    public boolean hasText() {
6494      return this.text != null && !this.text.isEmpty();
6495    }
6496
6497    /**
6498     * @param value {@link #text} (Context description.). This is the underlying
6499     *              object with id, value and extensions. The accessor "getText"
6500     *              gives direct access to the value
6501     */
6502    public AssetContextComponent setTextElement(StringType value) {
6503      this.text = value;
6504      return this;
6505    }
6506
6507    /**
6508     * @return Context description.
6509     */
6510    public String getText() {
6511      return this.text == null ? null : this.text.getValue();
6512    }
6513
6514    /**
6515     * @param value Context description.
6516     */
6517    public AssetContextComponent setText(String value) {
6518      if (Utilities.noString(value))
6519        this.text = null;
6520      else {
6521        if (this.text == null)
6522          this.text = new StringType();
6523        this.text.setValue(value);
6524      }
6525      return this;
6526    }
6527
6528    protected void listChildren(List<Property> children) {
6529      super.listChildren(children);
6530      children.add(new Property("reference", "Reference(Any)",
6531          "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.",
6532          0, 1, reference));
6533      children.add(new Property("code", "CodeableConcept",
6534          "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.",
6535          0, java.lang.Integer.MAX_VALUE, code));
6536      children.add(new Property("text", "string", "Context description.", 0, 1, text));
6537    }
6538
6539    @Override
6540    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6541      switch (_hash) {
6542      case -925155509:
6543        /* reference */ return new Property("reference", "Reference(Any)",
6544            "Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.",
6545            0, 1, reference);
6546      case 3059181:
6547        /* code */ return new Property("code", "CodeableConcept",
6548            "Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.",
6549            0, java.lang.Integer.MAX_VALUE, code);
6550      case 3556653:
6551        /* text */ return new Property("text", "string", "Context description.", 0, 1, text);
6552      default:
6553        return super.getNamedProperty(_hash, _name, _checkValid);
6554      }
6555
6556    }
6557
6558    @Override
6559    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6560      switch (hash) {
6561      case -925155509:
6562        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Reference
6563      case 3059181:
6564        /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
6565      case 3556653:
6566        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
6567      default:
6568        return super.getProperty(hash, name, checkValid);
6569      }
6570
6571    }
6572
6573    @Override
6574    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6575      switch (hash) {
6576      case -925155509: // reference
6577        this.reference = castToReference(value); // Reference
6578        return value;
6579      case 3059181: // code
6580        this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
6581        return value;
6582      case 3556653: // text
6583        this.text = castToString(value); // StringType
6584        return value;
6585      default:
6586        return super.setProperty(hash, name, value);
6587      }
6588
6589    }
6590
6591    @Override
6592    public Base setProperty(String name, Base value) throws FHIRException {
6593      if (name.equals("reference")) {
6594        this.reference = castToReference(value); // Reference
6595      } else if (name.equals("code")) {
6596        this.getCode().add(castToCodeableConcept(value));
6597      } else if (name.equals("text")) {
6598        this.text = castToString(value); // StringType
6599      } else
6600        return super.setProperty(name, value);
6601      return value;
6602    }
6603
6604  @Override
6605  public void removeChild(String name, Base value) throws FHIRException {
6606      if (name.equals("reference")) {
6607        this.reference = null;
6608      } else if (name.equals("code")) {
6609        this.getCode().remove(castToCodeableConcept(value));
6610      } else if (name.equals("text")) {
6611        this.text = null;
6612      } else
6613        super.removeChild(name, value);
6614      
6615    }
6616
6617    @Override
6618    public Base makeProperty(int hash, String name) throws FHIRException {
6619      switch (hash) {
6620      case -925155509:
6621        return getReference();
6622      case 3059181:
6623        return addCode();
6624      case 3556653:
6625        return getTextElement();
6626      default:
6627        return super.makeProperty(hash, name);
6628      }
6629
6630    }
6631
6632    @Override
6633    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6634      switch (hash) {
6635      case -925155509:
6636        /* reference */ return new String[] { "Reference" };
6637      case 3059181:
6638        /* code */ return new String[] { "CodeableConcept" };
6639      case 3556653:
6640        /* text */ return new String[] { "string" };
6641      default:
6642        return super.getTypesForProperty(hash, name);
6643      }
6644
6645    }
6646
6647    @Override
6648    public Base addChild(String name) throws FHIRException {
6649      if (name.equals("reference")) {
6650        this.reference = new Reference();
6651        return this.reference;
6652      } else if (name.equals("code")) {
6653        return addCode();
6654      } else if (name.equals("text")) {
6655        throw new FHIRException("Cannot call addChild on a singleton property Contract.text");
6656      } else
6657        return super.addChild(name);
6658    }
6659
6660    public AssetContextComponent copy() {
6661      AssetContextComponent dst = new AssetContextComponent();
6662      copyValues(dst);
6663      return dst;
6664    }
6665
6666    public void copyValues(AssetContextComponent dst) {
6667      super.copyValues(dst);
6668      dst.reference = reference == null ? null : reference.copy();
6669      if (code != null) {
6670        dst.code = new ArrayList<CodeableConcept>();
6671        for (CodeableConcept i : code)
6672          dst.code.add(i.copy());
6673      }
6674      ;
6675      dst.text = text == null ? null : text.copy();
6676    }
6677
6678    @Override
6679    public boolean equalsDeep(Base other_) {
6680      if (!super.equalsDeep(other_))
6681        return false;
6682      if (!(other_ instanceof AssetContextComponent))
6683        return false;
6684      AssetContextComponent o = (AssetContextComponent) other_;
6685      return compareDeep(reference, o.reference, true) && compareDeep(code, o.code, true)
6686          && compareDeep(text, o.text, true);
6687    }
6688
6689    @Override
6690    public boolean equalsShallow(Base other_) {
6691      if (!super.equalsShallow(other_))
6692        return false;
6693      if (!(other_ instanceof AssetContextComponent))
6694        return false;
6695      AssetContextComponent o = (AssetContextComponent) other_;
6696      return compareValues(text, o.text, true);
6697    }
6698
6699    public boolean isEmpty() {
6700      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, code, text);
6701    }
6702
6703    public String fhirType() {
6704      return "Contract.term.asset.context";
6705
6706    }
6707
6708  }
6709
6710  @Block()
6711  public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
6712    /**
6713     * Specific type of Contract Valued Item that may be priced.
6714     */
6715    @Child(name = "entity", type = { CodeableConcept.class,
6716        Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
6717    @Description(shortDefinition = "Contract Valued Item Type", formalDefinition = "Specific type of Contract Valued Item that may be priced.")
6718    protected Type entity;
6719
6720    /**
6721     * Identifies a Contract Valued Item instance.
6722     */
6723    @Child(name = "identifier", type = {
6724        Identifier.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6725    @Description(shortDefinition = "Contract Valued Item Number", formalDefinition = "Identifies a Contract Valued Item instance.")
6726    protected Identifier identifier;
6727
6728    /**
6729     * Indicates the time during which this Contract ValuedItem information is
6730     * effective.
6731     */
6732    @Child(name = "effectiveTime", type = {
6733        DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6734    @Description(shortDefinition = "Contract Valued Item Effective Tiem", formalDefinition = "Indicates the time during which this Contract ValuedItem information is effective.")
6735    protected DateTimeType effectiveTime;
6736
6737    /**
6738     * Specifies the units by which the Contract Valued Item is measured or counted,
6739     * and quantifies the countable or measurable Contract Valued Item instances.
6740     */
6741    @Child(name = "quantity", type = { Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6742    @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.")
6743    protected Quantity quantity;
6744
6745    /**
6746     * A Contract Valued Item unit valuation measure.
6747     */
6748    @Child(name = "unitPrice", type = { Money.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
6749    @Description(shortDefinition = "Contract Valued Item fee, charge, or cost", formalDefinition = "A Contract Valued Item unit valuation measure.")
6750    protected Money unitPrice;
6751
6752    /**
6753     * A real number that represents a multiplier used in determining the overall
6754     * value of the Contract Valued Item delivered. The concept of a Factor allows
6755     * for a discount or surcharge multiplier to be applied to a monetary amount.
6756     */
6757    @Child(name = "factor", type = {
6758        DecimalType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
6759    @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.")
6760    protected DecimalType factor;
6761
6762    /**
6763     * An amount that expresses the weighting (based on difficulty, cost and/or
6764     * resource intensiveness) associated with the Contract Valued Item delivered.
6765     * The concept of Points allows for assignment of point values for a Contract
6766     * Valued Item, such that a monetary amount can be assigned to each point.
6767     */
6768    @Child(name = "points", type = {
6769        DecimalType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6770    @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.")
6771    protected DecimalType points;
6772
6773    /**
6774     * Expresses the product of the Contract Valued Item unitQuantity and the
6775     * unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per
6776     * Point) * factor Number * points = net Amount. Quantity, factor and points are
6777     * assumed to be 1 if not supplied.
6778     */
6779    @Child(name = "net", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6780    @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.")
6781    protected Money net;
6782
6783    /**
6784     * Terms of valuation.
6785     */
6786    @Child(name = "payment", type = {
6787        StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6788    @Description(shortDefinition = "Terms of valuation", formalDefinition = "Terms of valuation.")
6789    protected StringType payment;
6790
6791    /**
6792     * When payment is due.
6793     */
6794    @Child(name = "paymentDate", type = {
6795        DateTimeType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6796    @Description(shortDefinition = "When payment is due", formalDefinition = "When payment is due.")
6797    protected DateTimeType paymentDate;
6798
6799    /**
6800     * Who will make payment.
6801     */
6802    @Child(name = "responsible", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
6803        RelatedPerson.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
6804    @Description(shortDefinition = "Who will make payment", formalDefinition = "Who will make payment.")
6805    protected Reference responsible;
6806
6807    /**
6808     * The actual object that is the target of the reference (Who will make
6809     * payment.)
6810     */
6811    protected Resource responsibleTarget;
6812
6813    /**
6814     * Who will receive payment.
6815     */
6816    @Child(name = "recipient", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
6817        RelatedPerson.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
6818    @Description(shortDefinition = "Who will receive payment", formalDefinition = "Who will receive payment.")
6819    protected Reference recipient;
6820
6821    /**
6822     * The actual object that is the target of the reference (Who will receive
6823     * payment.)
6824     */
6825    protected Resource recipientTarget;
6826
6827    /**
6828     * Id of the clause or question text related to the context of this valuedItem
6829     * in the referenced form or QuestionnaireResponse.
6830     */
6831    @Child(name = "linkId", type = {
6832        StringType.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6833    @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.")
6834    protected List<StringType> linkId;
6835
6836    /**
6837     * A set of security labels that define which terms are controlled by this
6838     * condition.
6839     */
6840    @Child(name = "securityLabelNumber", type = {
6841        UnsignedIntType.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6842    @Description(shortDefinition = "Security Labels that define affected terms", formalDefinition = "A set of security labels that define which terms are controlled by this condition.")
6843    protected List<UnsignedIntType> securityLabelNumber;
6844
6845    private static final long serialVersionUID = 1894951601L;
6846
6847    /**
6848     * Constructor
6849     */
6850    public ValuedItemComponent() {
6851      super();
6852    }
6853
6854    /**
6855     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6856     *         priced.)
6857     */
6858    public Type getEntity() {
6859      return this.entity;
6860    }
6861
6862    /**
6863     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6864     *         priced.)
6865     */
6866    public CodeableConcept getEntityCodeableConcept() throws FHIRException {
6867      if (this.entity == null)
6868        this.entity = new CodeableConcept();
6869      if (!(this.entity instanceof CodeableConcept))
6870        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
6871            + this.entity.getClass().getName() + " was encountered");
6872      return (CodeableConcept) this.entity;
6873    }
6874
6875    public boolean hasEntityCodeableConcept() {
6876      return this != null && this.entity instanceof CodeableConcept;
6877    }
6878
6879    /**
6880     * @return {@link #entity} (Specific type of Contract Valued Item that may be
6881     *         priced.)
6882     */
6883    public Reference getEntityReference() throws FHIRException {
6884      if (this.entity == null)
6885        this.entity = new Reference();
6886      if (!(this.entity instanceof Reference))
6887        throw new FHIRException("Type mismatch: the type Reference was expected, but "
6888            + this.entity.getClass().getName() + " was encountered");
6889      return (Reference) this.entity;
6890    }
6891
6892    public boolean hasEntityReference() {
6893      return this != null && this.entity instanceof Reference;
6894    }
6895
6896    public boolean hasEntity() {
6897      return this.entity != null && !this.entity.isEmpty();
6898    }
6899
6900    /**
6901     * @param value {@link #entity} (Specific type of Contract Valued Item that may
6902     *              be priced.)
6903     */
6904    public ValuedItemComponent setEntity(Type value) {
6905      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
6906        throw new Error("Not the right type for Contract.term.asset.valuedItem.entity[x]: " + value.fhirType());
6907      this.entity = value;
6908      return this;
6909    }
6910
6911    /**
6912     * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
6913     */
6914    public Identifier getIdentifier() {
6915      if (this.identifier == null)
6916        if (Configuration.errorOnAutoCreate())
6917          throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
6918        else if (Configuration.doAutoCreate())
6919          this.identifier = new Identifier(); // cc
6920      return this.identifier;
6921    }
6922
6923    public boolean hasIdentifier() {
6924      return this.identifier != null && !this.identifier.isEmpty();
6925    }
6926
6927    /**
6928     * @param value {@link #identifier} (Identifies a Contract Valued Item
6929     *              instance.)
6930     */
6931    public ValuedItemComponent setIdentifier(Identifier value) {
6932      this.identifier = value;
6933      return this;
6934    }
6935
6936    /**
6937     * @return {@link #effectiveTime} (Indicates the time during which this Contract
6938     *         ValuedItem information is effective.). This is the underlying object
6939     *         with id, value and extensions. The accessor "getEffectiveTime" gives
6940     *         direct access to the value
6941     */
6942    public DateTimeType getEffectiveTimeElement() {
6943      if (this.effectiveTime == null)
6944        if (Configuration.errorOnAutoCreate())
6945          throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
6946        else if (Configuration.doAutoCreate())
6947          this.effectiveTime = new DateTimeType(); // bb
6948      return this.effectiveTime;
6949    }
6950
6951    public boolean hasEffectiveTimeElement() {
6952      return this.effectiveTime != null && !this.effectiveTime.isEmpty();
6953    }
6954
6955    public boolean hasEffectiveTime() {
6956      return this.effectiveTime != null && !this.effectiveTime.isEmpty();
6957    }
6958
6959    /**
6960     * @param value {@link #effectiveTime} (Indicates the time during which this
6961     *              Contract ValuedItem information is effective.). This is the
6962     *              underlying object with id, value and extensions. The accessor
6963     *              "getEffectiveTime" gives direct access to the value
6964     */
6965    public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) {
6966      this.effectiveTime = value;
6967      return this;
6968    }
6969
6970    /**
6971     * @return Indicates the time during which this Contract ValuedItem information
6972     *         is effective.
6973     */
6974    public Date getEffectiveTime() {
6975      return this.effectiveTime == null ? null : this.effectiveTime.getValue();
6976    }
6977
6978    /**
6979     * @param value Indicates the time during which this Contract ValuedItem
6980     *              information is effective.
6981     */
6982    public ValuedItemComponent setEffectiveTime(Date value) {
6983      if (value == null)
6984        this.effectiveTime = null;
6985      else {
6986        if (this.effectiveTime == null)
6987          this.effectiveTime = new DateTimeType();
6988        this.effectiveTime.setValue(value);
6989      }
6990      return this;
6991    }
6992
6993    /**
6994     * @return {@link #quantity} (Specifies the units by which the Contract Valued
6995     *         Item is measured or counted, and quantifies the countable or
6996     *         measurable Contract Valued Item instances.)
6997     */
6998    public Quantity getQuantity() {
6999      if (this.quantity == null)
7000        if (Configuration.errorOnAutoCreate())
7001          throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
7002        else if (Configuration.doAutoCreate())
7003          this.quantity = new Quantity(); // cc
7004      return this.quantity;
7005    }
7006
7007    public boolean hasQuantity() {
7008      return this.quantity != null && !this.quantity.isEmpty();
7009    }
7010
7011    /**
7012     * @param value {@link #quantity} (Specifies the units by which the Contract
7013     *              Valued Item is measured or counted, and quantifies the countable
7014     *              or measurable Contract Valued Item instances.)
7015     */
7016    public ValuedItemComponent setQuantity(Quantity value) {
7017      this.quantity = value;
7018      return this;
7019    }
7020
7021    /**
7022     * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
7023     */
7024    public Money getUnitPrice() {
7025      if (this.unitPrice == null)
7026        if (Configuration.errorOnAutoCreate())
7027          throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
7028        else if (Configuration.doAutoCreate())
7029          this.unitPrice = new Money(); // cc
7030      return this.unitPrice;
7031    }
7032
7033    public boolean hasUnitPrice() {
7034      return this.unitPrice != null && !this.unitPrice.isEmpty();
7035    }
7036
7037    /**
7038     * @param value {@link #unitPrice} (A Contract Valued Item unit valuation
7039     *              measure.)
7040     */
7041    public ValuedItemComponent setUnitPrice(Money value) {
7042      this.unitPrice = value;
7043      return this;
7044    }
7045
7046    /**
7047     * @return {@link #factor} (A real number that represents a multiplier used in
7048     *         determining the overall value of the Contract Valued Item delivered.
7049     *         The concept of a Factor allows for a discount or surcharge multiplier
7050     *         to be applied to a monetary amount.). This is the underlying object
7051     *         with id, value and extensions. The accessor "getFactor" gives direct
7052     *         access to the value
7053     */
7054    public DecimalType getFactorElement() {
7055      if (this.factor == null)
7056        if (Configuration.errorOnAutoCreate())
7057          throw new Error("Attempt to auto-create ValuedItemComponent.factor");
7058        else if (Configuration.doAutoCreate())
7059          this.factor = new DecimalType(); // bb
7060      return this.factor;
7061    }
7062
7063    public boolean hasFactorElement() {
7064      return this.factor != null && !this.factor.isEmpty();
7065    }
7066
7067    public boolean hasFactor() {
7068      return this.factor != null && !this.factor.isEmpty();
7069    }
7070
7071    /**
7072     * @param value {@link #factor} (A real number that represents a multiplier used
7073     *              in determining the overall value of the Contract Valued Item
7074     *              delivered. The concept of a Factor allows for a discount or
7075     *              surcharge multiplier to be applied to a monetary amount.). This
7076     *              is the underlying object with id, value and extensions. The
7077     *              accessor "getFactor" gives direct access to the value
7078     */
7079    public ValuedItemComponent setFactorElement(DecimalType value) {
7080      this.factor = value;
7081      return this;
7082    }
7083
7084    /**
7085     * @return A real number that represents a multiplier used in determining the
7086     *         overall value of the Contract Valued Item delivered. The concept of a
7087     *         Factor allows for a discount or surcharge multiplier to be applied to
7088     *         a monetary amount.
7089     */
7090    public BigDecimal getFactor() {
7091      return this.factor == null ? null : this.factor.getValue();
7092    }
7093
7094    /**
7095     * @param value A real number that represents a multiplier used in determining
7096     *              the overall value of the Contract Valued Item delivered. The
7097     *              concept of a Factor allows for a discount or surcharge
7098     *              multiplier to be applied to a monetary amount.
7099     */
7100    public ValuedItemComponent setFactor(BigDecimal value) {
7101      if (value == null)
7102        this.factor = null;
7103      else {
7104        if (this.factor == null)
7105          this.factor = new DecimalType();
7106        this.factor.setValue(value);
7107      }
7108      return this;
7109    }
7110
7111    /**
7112     * @param value A real number that represents a multiplier used in determining
7113     *              the overall value of the Contract Valued Item delivered. The
7114     *              concept of a Factor allows for a discount or surcharge
7115     *              multiplier to be applied to a monetary amount.
7116     */
7117    public ValuedItemComponent setFactor(long value) {
7118      this.factor = new DecimalType();
7119      this.factor.setValue(value);
7120      return this;
7121    }
7122
7123    /**
7124     * @param value A real number that represents a multiplier used in determining
7125     *              the overall value of the Contract Valued Item delivered. The
7126     *              concept of a Factor allows for a discount or surcharge
7127     *              multiplier to be applied to a monetary amount.
7128     */
7129    public ValuedItemComponent setFactor(double value) {
7130      this.factor = new DecimalType();
7131      this.factor.setValue(value);
7132      return this;
7133    }
7134
7135    /**
7136     * @return {@link #points} (An amount that expresses the weighting (based on
7137     *         difficulty, cost and/or resource intensiveness) associated with the
7138     *         Contract Valued Item delivered. The concept of Points allows for
7139     *         assignment of point values for a Contract Valued Item, such that a
7140     *         monetary amount can be assigned to each point.). This is the
7141     *         underlying object with id, value and extensions. The accessor
7142     *         "getPoints" gives direct access to the value
7143     */
7144    public DecimalType getPointsElement() {
7145      if (this.points == null)
7146        if (Configuration.errorOnAutoCreate())
7147          throw new Error("Attempt to auto-create ValuedItemComponent.points");
7148        else if (Configuration.doAutoCreate())
7149          this.points = new DecimalType(); // bb
7150      return this.points;
7151    }
7152
7153    public boolean hasPointsElement() {
7154      return this.points != null && !this.points.isEmpty();
7155    }
7156
7157    public boolean hasPoints() {
7158      return this.points != null && !this.points.isEmpty();
7159    }
7160
7161    /**
7162     * @param value {@link #points} (An amount that expresses the weighting (based
7163     *              on difficulty, cost and/or resource intensiveness) associated
7164     *              with the Contract Valued Item delivered. The concept of Points
7165     *              allows for assignment of point values for a Contract Valued
7166     *              Item, such that a monetary amount can be assigned to each
7167     *              point.). This is the underlying object with id, value and
7168     *              extensions. The accessor "getPoints" gives direct access to the
7169     *              value
7170     */
7171    public ValuedItemComponent setPointsElement(DecimalType value) {
7172      this.points = value;
7173      return this;
7174    }
7175
7176    /**
7177     * @return An amount that expresses the weighting (based on difficulty, cost
7178     *         and/or resource intensiveness) associated with the Contract Valued
7179     *         Item delivered. The concept of Points allows for assignment of point
7180     *         values for a Contract Valued Item, such that a monetary amount can be
7181     *         assigned to each point.
7182     */
7183    public BigDecimal getPoints() {
7184      return this.points == null ? null : this.points.getValue();
7185    }
7186
7187    /**
7188     * @param value An amount that expresses the weighting (based on difficulty,
7189     *              cost and/or resource intensiveness) associated with the Contract
7190     *              Valued Item delivered. The concept of Points allows for
7191     *              assignment of point values for a Contract Valued Item, such that
7192     *              a monetary amount can be assigned to each point.
7193     */
7194    public ValuedItemComponent setPoints(BigDecimal value) {
7195      if (value == null)
7196        this.points = null;
7197      else {
7198        if (this.points == null)
7199          this.points = new DecimalType();
7200        this.points.setValue(value);
7201      }
7202      return this;
7203    }
7204
7205    /**
7206     * @param value An amount that expresses the weighting (based on difficulty,
7207     *              cost and/or resource intensiveness) associated with the Contract
7208     *              Valued Item delivered. The concept of Points allows for
7209     *              assignment of point values for a Contract Valued Item, such that
7210     *              a monetary amount can be assigned to each point.
7211     */
7212    public ValuedItemComponent setPoints(long value) {
7213      this.points = new DecimalType();
7214      this.points.setValue(value);
7215      return this;
7216    }
7217
7218    /**
7219     * @param value An amount that expresses the weighting (based on difficulty,
7220     *              cost and/or resource intensiveness) associated with the Contract
7221     *              Valued Item delivered. The concept of Points allows for
7222     *              assignment of point values for a Contract Valued Item, such that
7223     *              a monetary amount can be assigned to each point.
7224     */
7225    public ValuedItemComponent setPoints(double value) {
7226      this.points = new DecimalType();
7227      this.points.setValue(value);
7228      return this;
7229    }
7230
7231    /**
7232     * @return {@link #net} (Expresses the product of the Contract Valued Item
7233     *         unitQuantity and the unitPriceAmt. For example, the formula: unit
7234     *         Quantity * unit Price (Cost per Point) * factor Number * points = net
7235     *         Amount. Quantity, factor and points are assumed to be 1 if not
7236     *         supplied.)
7237     */
7238    public Money getNet() {
7239      if (this.net == null)
7240        if (Configuration.errorOnAutoCreate())
7241          throw new Error("Attempt to auto-create ValuedItemComponent.net");
7242        else if (Configuration.doAutoCreate())
7243          this.net = new Money(); // cc
7244      return this.net;
7245    }
7246
7247    public boolean hasNet() {
7248      return this.net != null && !this.net.isEmpty();
7249    }
7250
7251    /**
7252     * @param value {@link #net} (Expresses the product of the Contract Valued Item
7253     *              unitQuantity and the unitPriceAmt. For example, the formula:
7254     *              unit Quantity * unit Price (Cost per Point) * factor Number *
7255     *              points = net Amount. Quantity, factor and points are assumed to
7256     *              be 1 if not supplied.)
7257     */
7258    public ValuedItemComponent setNet(Money value) {
7259      this.net = value;
7260      return this;
7261    }
7262
7263    /**
7264     * @return {@link #payment} (Terms of valuation.). This is the underlying object
7265     *         with id, value and extensions. The accessor "getPayment" gives direct
7266     *         access to the value
7267     */
7268    public StringType getPaymentElement() {
7269      if (this.payment == null)
7270        if (Configuration.errorOnAutoCreate())
7271          throw new Error("Attempt to auto-create ValuedItemComponent.payment");
7272        else if (Configuration.doAutoCreate())
7273          this.payment = new StringType(); // bb
7274      return this.payment;
7275    }
7276
7277    public boolean hasPaymentElement() {
7278      return this.payment != null && !this.payment.isEmpty();
7279    }
7280
7281    public boolean hasPayment() {
7282      return this.payment != null && !this.payment.isEmpty();
7283    }
7284
7285    /**
7286     * @param value {@link #payment} (Terms of valuation.). This is the underlying
7287     *              object with id, value and extensions. The accessor "getPayment"
7288     *              gives direct access to the value
7289     */
7290    public ValuedItemComponent setPaymentElement(StringType value) {
7291      this.payment = value;
7292      return this;
7293    }
7294
7295    /**
7296     * @return Terms of valuation.
7297     */
7298    public String getPayment() {
7299      return this.payment == null ? null : this.payment.getValue();
7300    }
7301
7302    /**
7303     * @param value Terms of valuation.
7304     */
7305    public ValuedItemComponent setPayment(String value) {
7306      if (Utilities.noString(value))
7307        this.payment = null;
7308      else {
7309        if (this.payment == null)
7310          this.payment = new StringType();
7311        this.payment.setValue(value);
7312      }
7313      return this;
7314    }
7315
7316    /**
7317     * @return {@link #paymentDate} (When payment is due.). This is the underlying
7318     *         object with id, value and extensions. The accessor "getPaymentDate"
7319     *         gives direct access to the value
7320     */
7321    public DateTimeType getPaymentDateElement() {
7322      if (this.paymentDate == null)
7323        if (Configuration.errorOnAutoCreate())
7324          throw new Error("Attempt to auto-create ValuedItemComponent.paymentDate");
7325        else if (Configuration.doAutoCreate())
7326          this.paymentDate = new DateTimeType(); // bb
7327      return this.paymentDate;
7328    }
7329
7330    public boolean hasPaymentDateElement() {
7331      return this.paymentDate != null && !this.paymentDate.isEmpty();
7332    }
7333
7334    public boolean hasPaymentDate() {
7335      return this.paymentDate != null && !this.paymentDate.isEmpty();
7336    }
7337
7338    /**
7339     * @param value {@link #paymentDate} (When payment is due.). This is the
7340     *              underlying object with id, value and extensions. The accessor
7341     *              "getPaymentDate" gives direct access to the value
7342     */
7343    public ValuedItemComponent setPaymentDateElement(DateTimeType value) {
7344      this.paymentDate = value;
7345      return this;
7346    }
7347
7348    /**
7349     * @return When payment is due.
7350     */
7351    public Date getPaymentDate() {
7352      return this.paymentDate == null ? null : this.paymentDate.getValue();
7353    }
7354
7355    /**
7356     * @param value When payment is due.
7357     */
7358    public ValuedItemComponent setPaymentDate(Date value) {
7359      if (value == null)
7360        this.paymentDate = null;
7361      else {
7362        if (this.paymentDate == null)
7363          this.paymentDate = new DateTimeType();
7364        this.paymentDate.setValue(value);
7365      }
7366      return this;
7367    }
7368
7369    /**
7370     * @return {@link #responsible} (Who will make payment.)
7371     */
7372    public Reference getResponsible() {
7373      if (this.responsible == null)
7374        if (Configuration.errorOnAutoCreate())
7375          throw new Error("Attempt to auto-create ValuedItemComponent.responsible");
7376        else if (Configuration.doAutoCreate())
7377          this.responsible = new Reference(); // cc
7378      return this.responsible;
7379    }
7380
7381    public boolean hasResponsible() {
7382      return this.responsible != null && !this.responsible.isEmpty();
7383    }
7384
7385    /**
7386     * @param value {@link #responsible} (Who will make payment.)
7387     */
7388    public ValuedItemComponent setResponsible(Reference value) {
7389      this.responsible = value;
7390      return this;
7391    }
7392
7393    /**
7394     * @return {@link #responsible} The actual object that is the target of the
7395     *         reference. The reference library doesn't populate this, but you can
7396     *         use it to hold the resource if you resolve it. (Who will make
7397     *         payment.)
7398     */
7399    public Resource getResponsibleTarget() {
7400      return this.responsibleTarget;
7401    }
7402
7403    /**
7404     * @param value {@link #responsible} The actual object that is the target of the
7405     *              reference. The reference library doesn't use these, but you can
7406     *              use it to hold the resource if you resolve it. (Who will make
7407     *              payment.)
7408     */
7409    public ValuedItemComponent setResponsibleTarget(Resource value) {
7410      this.responsibleTarget = value;
7411      return this;
7412    }
7413
7414    /**
7415     * @return {@link #recipient} (Who will receive payment.)
7416     */
7417    public Reference getRecipient() {
7418      if (this.recipient == null)
7419        if (Configuration.errorOnAutoCreate())
7420          throw new Error("Attempt to auto-create ValuedItemComponent.recipient");
7421        else if (Configuration.doAutoCreate())
7422          this.recipient = new Reference(); // cc
7423      return this.recipient;
7424    }
7425
7426    public boolean hasRecipient() {
7427      return this.recipient != null && !this.recipient.isEmpty();
7428    }
7429
7430    /**
7431     * @param value {@link #recipient} (Who will receive payment.)
7432     */
7433    public ValuedItemComponent setRecipient(Reference value) {
7434      this.recipient = value;
7435      return this;
7436    }
7437
7438    /**
7439     * @return {@link #recipient} The actual object that is the target of the
7440     *         reference. The reference library doesn't populate this, but you can
7441     *         use it to hold the resource if you resolve it. (Who will receive
7442     *         payment.)
7443     */
7444    public Resource getRecipientTarget() {
7445      return this.recipientTarget;
7446    }
7447
7448    /**
7449     * @param value {@link #recipient} The actual object that is the target of the
7450     *              reference. The reference library doesn't use these, but you can
7451     *              use it to hold the resource if you resolve it. (Who will receive
7452     *              payment.)
7453     */
7454    public ValuedItemComponent setRecipientTarget(Resource value) {
7455      this.recipientTarget = value;
7456      return this;
7457    }
7458
7459    /**
7460     * @return {@link #linkId} (Id of the clause or question text related to the
7461     *         context of this valuedItem in the referenced form or
7462     *         QuestionnaireResponse.)
7463     */
7464    public List<StringType> getLinkId() {
7465      if (this.linkId == null)
7466        this.linkId = new ArrayList<StringType>();
7467      return this.linkId;
7468    }
7469
7470    /**
7471     * @return Returns a reference to <code>this</code> for easy method chaining
7472     */
7473    public ValuedItemComponent setLinkId(List<StringType> theLinkId) {
7474      this.linkId = theLinkId;
7475      return this;
7476    }
7477
7478    public boolean hasLinkId() {
7479      if (this.linkId == null)
7480        return false;
7481      for (StringType item : this.linkId)
7482        if (!item.isEmpty())
7483          return true;
7484      return false;
7485    }
7486
7487    /**
7488     * @return {@link #linkId} (Id of the clause or question text related to the
7489     *         context of this valuedItem in the referenced form or
7490     *         QuestionnaireResponse.)
7491     */
7492    public StringType addLinkIdElement() {// 2
7493      StringType t = new StringType();
7494      if (this.linkId == null)
7495        this.linkId = new ArrayList<StringType>();
7496      this.linkId.add(t);
7497      return t;
7498    }
7499
7500    /**
7501     * @param value {@link #linkId} (Id of the clause or question text related to
7502     *              the context of this valuedItem in the referenced form or
7503     *              QuestionnaireResponse.)
7504     */
7505    public ValuedItemComponent addLinkId(String value) { // 1
7506      StringType t = new StringType();
7507      t.setValue(value);
7508      if (this.linkId == null)
7509        this.linkId = new ArrayList<StringType>();
7510      this.linkId.add(t);
7511      return this;
7512    }
7513
7514    /**
7515     * @param value {@link #linkId} (Id of the clause or question text related to
7516     *              the context of this valuedItem in the referenced form or
7517     *              QuestionnaireResponse.)
7518     */
7519    public boolean hasLinkId(String value) {
7520      if (this.linkId == null)
7521        return false;
7522      for (StringType v : this.linkId)
7523        if (v.getValue().equals(value)) // string
7524          return true;
7525      return false;
7526    }
7527
7528    /**
7529     * @return {@link #securityLabelNumber} (A set of security labels that define
7530     *         which terms are controlled by this condition.)
7531     */
7532    public List<UnsignedIntType> getSecurityLabelNumber() {
7533      if (this.securityLabelNumber == null)
7534        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7535      return this.securityLabelNumber;
7536    }
7537
7538    /**
7539     * @return Returns a reference to <code>this</code> for easy method chaining
7540     */
7541    public ValuedItemComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
7542      this.securityLabelNumber = theSecurityLabelNumber;
7543      return this;
7544    }
7545
7546    public boolean hasSecurityLabelNumber() {
7547      if (this.securityLabelNumber == null)
7548        return false;
7549      for (UnsignedIntType item : this.securityLabelNumber)
7550        if (!item.isEmpty())
7551          return true;
7552      return false;
7553    }
7554
7555    /**
7556     * @return {@link #securityLabelNumber} (A set of security labels that define
7557     *         which terms are controlled by this condition.)
7558     */
7559    public UnsignedIntType addSecurityLabelNumberElement() {// 2
7560      UnsignedIntType t = new UnsignedIntType();
7561      if (this.securityLabelNumber == null)
7562        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7563      this.securityLabelNumber.add(t);
7564      return t;
7565    }
7566
7567    /**
7568     * @param value {@link #securityLabelNumber} (A set of security labels that
7569     *              define which terms are controlled by this condition.)
7570     */
7571    public ValuedItemComponent addSecurityLabelNumber(int value) { // 1
7572      UnsignedIntType t = new UnsignedIntType();
7573      t.setValue(value);
7574      if (this.securityLabelNumber == null)
7575        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
7576      this.securityLabelNumber.add(t);
7577      return this;
7578    }
7579
7580    /**
7581     * @param value {@link #securityLabelNumber} (A set of security labels that
7582     *              define which terms are controlled by this condition.)
7583     */
7584    public boolean hasSecurityLabelNumber(int value) {
7585      if (this.securityLabelNumber == null)
7586        return false;
7587      for (UnsignedIntType v : this.securityLabelNumber)
7588        if (v.getValue().equals(value)) // unsignedInt
7589          return true;
7590      return false;
7591    }
7592
7593    protected void listChildren(List<Property> children) {
7594      super.listChildren(children);
7595      children.add(new Property("entity[x]", "CodeableConcept|Reference(Any)",
7596          "Specific type of Contract Valued Item that may be priced.", 0, 1, entity));
7597      children.add(
7598          new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, 1, identifier));
7599      children.add(new Property("effectiveTime", "dateTime",
7600          "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime));
7601      children.add(new Property("quantity", "SimpleQuantity",
7602          "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.",
7603          0, 1, quantity));
7604      children
7605          .add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, 1, unitPrice));
7606      children.add(new Property("factor", "decimal",
7607          "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.",
7608          0, 1, factor));
7609      children.add(new Property("points", "decimal",
7610          "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.",
7611          0, 1, points));
7612      children.add(new Property("net", "Money",
7613          "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.",
7614          0, 1, net));
7615      children.add(new Property("payment", "string", "Terms of valuation.", 0, 1, payment));
7616      children.add(new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate));
7617      children.add(
7618          new Property("responsible", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
7619              "Who will make payment.", 0, 1, responsible));
7620      children
7621          .add(new Property("recipient", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
7622              "Who will receive payment.", 0, 1, recipient));
7623      children.add(new Property("linkId", "string",
7624          "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.",
7625          0, java.lang.Integer.MAX_VALUE, linkId));
7626      children.add(new Property("securityLabelNumber", "unsignedInt",
7627          "A set of security labels that define which terms are controlled by this condition.", 0,
7628          java.lang.Integer.MAX_VALUE, securityLabelNumber));
7629    }
7630
7631    @Override
7632    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7633      switch (_hash) {
7634      case -740568643:
7635        /* entity[x] */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7636            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7637      case -1298275357:
7638        /* entity */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7639            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7640      case 924197182:
7641        /* entityCodeableConcept */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7642            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7643      case -356635992:
7644        /* entityReference */ return new Property("entity[x]", "CodeableConcept|Reference(Any)",
7645            "Specific type of Contract Valued Item that may be priced.", 0, 1, entity);
7646      case -1618432855:
7647        /* identifier */ return new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.",
7648            0, 1, identifier);
7649      case -929905388:
7650        /* effectiveTime */ return new Property("effectiveTime", "dateTime",
7651            "Indicates the time during which this Contract ValuedItem information is effective.", 0, 1, effectiveTime);
7652      case -1285004149:
7653        /* quantity */ return new Property("quantity", "SimpleQuantity",
7654            "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.",
7655            0, 1, quantity);
7656      case -486196699:
7657        /* unitPrice */ return new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0,
7658            1, unitPrice);
7659      case -1282148017:
7660        /* factor */ return new Property("factor", "decimal",
7661            "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.",
7662            0, 1, factor);
7663      case -982754077:
7664        /* points */ return new Property("points", "decimal",
7665            "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.",
7666            0, 1, points);
7667      case 108957:
7668        /* net */ return new Property("net", "Money",
7669            "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.",
7670            0, 1, net);
7671      case -786681338:
7672        /* payment */ return new Property("payment", "string", "Terms of valuation.", 0, 1, payment);
7673      case -1540873516:
7674        /* paymentDate */ return new Property("paymentDate", "dateTime", "When payment is due.", 0, 1, paymentDate);
7675      case 1847674614:
7676        /* responsible */ return new Property("responsible",
7677            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will make payment.", 0,
7678            1, responsible);
7679      case 820081177:
7680        /* recipient */ return new Property("recipient",
7681            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who will receive payment.",
7682            0, 1, recipient);
7683      case -1102667083:
7684        /* linkId */ return new Property("linkId", "string",
7685            "Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.",
7686            0, java.lang.Integer.MAX_VALUE, linkId);
7687      case -149460995:
7688        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
7689            "A set of security labels that define which terms are controlled by this condition.", 0,
7690            java.lang.Integer.MAX_VALUE, securityLabelNumber);
7691      default:
7692        return super.getNamedProperty(_hash, _name, _checkValid);
7693      }
7694
7695    }
7696
7697    @Override
7698    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7699      switch (hash) {
7700      case -1298275357:
7701        /* entity */ return this.entity == null ? new Base[0] : new Base[] { this.entity }; // Type
7702      case -1618432855:
7703        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
7704      case -929905388:
7705        /* effectiveTime */ return this.effectiveTime == null ? new Base[0] : new Base[] { this.effectiveTime }; // DateTimeType
7706      case -1285004149:
7707        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7708      case -486196699:
7709        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7710      case -1282148017:
7711        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7712      case -982754077:
7713        /* points */ return this.points == null ? new Base[0] : new Base[] { this.points }; // DecimalType
7714      case 108957:
7715        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7716      case -786681338:
7717        /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // StringType
7718      case -1540873516:
7719        /* paymentDate */ return this.paymentDate == null ? new Base[0] : new Base[] { this.paymentDate }; // DateTimeType
7720      case 1847674614:
7721        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // Reference
7722      case 820081177:
7723        /* recipient */ return this.recipient == null ? new Base[0] : new Base[] { this.recipient }; // Reference
7724      case -1102667083:
7725        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
7726      case -149460995:
7727        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
7728            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
7729      default:
7730        return super.getProperty(hash, name, checkValid);
7731      }
7732
7733    }
7734
7735    @Override
7736    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7737      switch (hash) {
7738      case -1298275357: // entity
7739        this.entity = castToType(value); // Type
7740        return value;
7741      case -1618432855: // identifier
7742        this.identifier = castToIdentifier(value); // Identifier
7743        return value;
7744      case -929905388: // effectiveTime
7745        this.effectiveTime = castToDateTime(value); // DateTimeType
7746        return value;
7747      case -1285004149: // quantity
7748        this.quantity = castToQuantity(value); // Quantity
7749        return value;
7750      case -486196699: // unitPrice
7751        this.unitPrice = castToMoney(value); // Money
7752        return value;
7753      case -1282148017: // factor
7754        this.factor = castToDecimal(value); // DecimalType
7755        return value;
7756      case -982754077: // points
7757        this.points = castToDecimal(value); // DecimalType
7758        return value;
7759      case 108957: // net
7760        this.net = castToMoney(value); // Money
7761        return value;
7762      case -786681338: // payment
7763        this.payment = castToString(value); // StringType
7764        return value;
7765      case -1540873516: // paymentDate
7766        this.paymentDate = castToDateTime(value); // DateTimeType
7767        return value;
7768      case 1847674614: // responsible
7769        this.responsible = castToReference(value); // Reference
7770        return value;
7771      case 820081177: // recipient
7772        this.recipient = castToReference(value); // Reference
7773        return value;
7774      case -1102667083: // linkId
7775        this.getLinkId().add(castToString(value)); // StringType
7776        return value;
7777      case -149460995: // securityLabelNumber
7778        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
7779        return value;
7780      default:
7781        return super.setProperty(hash, name, value);
7782      }
7783
7784    }
7785
7786    @Override
7787    public Base setProperty(String name, Base value) throws FHIRException {
7788      if (name.equals("entity[x]")) {
7789        this.entity = castToType(value); // Type
7790      } else if (name.equals("identifier")) {
7791        this.identifier = castToIdentifier(value); // Identifier
7792      } else if (name.equals("effectiveTime")) {
7793        this.effectiveTime = castToDateTime(value); // DateTimeType
7794      } else if (name.equals("quantity")) {
7795        this.quantity = castToQuantity(value); // Quantity
7796      } else if (name.equals("unitPrice")) {
7797        this.unitPrice = castToMoney(value); // Money
7798      } else if (name.equals("factor")) {
7799        this.factor = castToDecimal(value); // DecimalType
7800      } else if (name.equals("points")) {
7801        this.points = castToDecimal(value); // DecimalType
7802      } else if (name.equals("net")) {
7803        this.net = castToMoney(value); // Money
7804      } else if (name.equals("payment")) {
7805        this.payment = castToString(value); // StringType
7806      } else if (name.equals("paymentDate")) {
7807        this.paymentDate = castToDateTime(value); // DateTimeType
7808      } else if (name.equals("responsible")) {
7809        this.responsible = castToReference(value); // Reference
7810      } else if (name.equals("recipient")) {
7811        this.recipient = castToReference(value); // Reference
7812      } else if (name.equals("linkId")) {
7813        this.getLinkId().add(castToString(value));
7814      } else if (name.equals("securityLabelNumber")) {
7815        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
7816      } else
7817        return super.setProperty(name, value);
7818      return value;
7819    }
7820
7821  @Override
7822  public void removeChild(String name, Base value) throws FHIRException {
7823      if (name.equals("entity[x]")) {
7824        this.entity = null;
7825      } else if (name.equals("identifier")) {
7826        this.identifier = null;
7827      } else if (name.equals("effectiveTime")) {
7828        this.effectiveTime = null;
7829      } else if (name.equals("quantity")) {
7830        this.quantity = null;
7831      } else if (name.equals("unitPrice")) {
7832        this.unitPrice = null;
7833      } else if (name.equals("factor")) {
7834        this.factor = null;
7835      } else if (name.equals("points")) {
7836        this.points = null;
7837      } else if (name.equals("net")) {
7838        this.net = null;
7839      } else if (name.equals("payment")) {
7840        this.payment = null;
7841      } else if (name.equals("paymentDate")) {
7842        this.paymentDate = null;
7843      } else if (name.equals("responsible")) {
7844        this.responsible = null;
7845      } else if (name.equals("recipient")) {
7846        this.recipient = null;
7847      } else if (name.equals("linkId")) {
7848        this.getLinkId().remove(castToString(value));
7849      } else if (name.equals("securityLabelNumber")) {
7850        this.getSecurityLabelNumber().remove(castToUnsignedInt(value));
7851      } else
7852        super.removeChild(name, value);
7853      
7854    }
7855
7856    @Override
7857    public Base makeProperty(int hash, String name) throws FHIRException {
7858      switch (hash) {
7859      case -740568643:
7860        return getEntity();
7861      case -1298275357:
7862        return getEntity();
7863      case -1618432855:
7864        return getIdentifier();
7865      case -929905388:
7866        return getEffectiveTimeElement();
7867      case -1285004149:
7868        return getQuantity();
7869      case -486196699:
7870        return getUnitPrice();
7871      case -1282148017:
7872        return getFactorElement();
7873      case -982754077:
7874        return getPointsElement();
7875      case 108957:
7876        return getNet();
7877      case -786681338:
7878        return getPaymentElement();
7879      case -1540873516:
7880        return getPaymentDateElement();
7881      case 1847674614:
7882        return getResponsible();
7883      case 820081177:
7884        return getRecipient();
7885      case -1102667083:
7886        return addLinkIdElement();
7887      case -149460995:
7888        return addSecurityLabelNumberElement();
7889      default:
7890        return super.makeProperty(hash, name);
7891      }
7892
7893    }
7894
7895    @Override
7896    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7897      switch (hash) {
7898      case -1298275357:
7899        /* entity */ return new String[] { "CodeableConcept", "Reference" };
7900      case -1618432855:
7901        /* identifier */ return new String[] { "Identifier" };
7902      case -929905388:
7903        /* effectiveTime */ return new String[] { "dateTime" };
7904      case -1285004149:
7905        /* quantity */ return new String[] { "SimpleQuantity" };
7906      case -486196699:
7907        /* unitPrice */ return new String[] { "Money" };
7908      case -1282148017:
7909        /* factor */ return new String[] { "decimal" };
7910      case -982754077:
7911        /* points */ return new String[] { "decimal" };
7912      case 108957:
7913        /* net */ return new String[] { "Money" };
7914      case -786681338:
7915        /* payment */ return new String[] { "string" };
7916      case -1540873516:
7917        /* paymentDate */ return new String[] { "dateTime" };
7918      case 1847674614:
7919        /* responsible */ return new String[] { "Reference" };
7920      case 820081177:
7921        /* recipient */ return new String[] { "Reference" };
7922      case -1102667083:
7923        /* linkId */ return new String[] { "string" };
7924      case -149460995:
7925        /* securityLabelNumber */ return new String[] { "unsignedInt" };
7926      default:
7927        return super.getTypesForProperty(hash, name);
7928      }
7929
7930    }
7931
7932    @Override
7933    public Base addChild(String name) throws FHIRException {
7934      if (name.equals("entityCodeableConcept")) {
7935        this.entity = new CodeableConcept();
7936        return this.entity;
7937      } else if (name.equals("entityReference")) {
7938        this.entity = new Reference();
7939        return this.entity;
7940      } else if (name.equals("identifier")) {
7941        this.identifier = new Identifier();
7942        return this.identifier;
7943      } else if (name.equals("effectiveTime")) {
7944        throw new FHIRException("Cannot call addChild on a singleton property Contract.effectiveTime");
7945      } else if (name.equals("quantity")) {
7946        this.quantity = new Quantity();
7947        return this.quantity;
7948      } else if (name.equals("unitPrice")) {
7949        this.unitPrice = new Money();
7950        return this.unitPrice;
7951      } else if (name.equals("factor")) {
7952        throw new FHIRException("Cannot call addChild on a singleton property Contract.factor");
7953      } else if (name.equals("points")) {
7954        throw new FHIRException("Cannot call addChild on a singleton property Contract.points");
7955      } else if (name.equals("net")) {
7956        this.net = new Money();
7957        return this.net;
7958      } else if (name.equals("payment")) {
7959        throw new FHIRException("Cannot call addChild on a singleton property Contract.payment");
7960      } else if (name.equals("paymentDate")) {
7961        throw new FHIRException("Cannot call addChild on a singleton property Contract.paymentDate");
7962      } else if (name.equals("responsible")) {
7963        this.responsible = new Reference();
7964        return this.responsible;
7965      } else if (name.equals("recipient")) {
7966        this.recipient = new Reference();
7967        return this.recipient;
7968      } else if (name.equals("linkId")) {
7969        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
7970      } else if (name.equals("securityLabelNumber")) {
7971        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
7972      } else
7973        return super.addChild(name);
7974    }
7975
7976    public ValuedItemComponent copy() {
7977      ValuedItemComponent dst = new ValuedItemComponent();
7978      copyValues(dst);
7979      return dst;
7980    }
7981
7982    public void copyValues(ValuedItemComponent dst) {
7983      super.copyValues(dst);
7984      dst.entity = entity == null ? null : entity.copy();
7985      dst.identifier = identifier == null ? null : identifier.copy();
7986      dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
7987      dst.quantity = quantity == null ? null : quantity.copy();
7988      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7989      dst.factor = factor == null ? null : factor.copy();
7990      dst.points = points == null ? null : points.copy();
7991      dst.net = net == null ? null : net.copy();
7992      dst.payment = payment == null ? null : payment.copy();
7993      dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
7994      dst.responsible = responsible == null ? null : responsible.copy();
7995      dst.recipient = recipient == null ? null : recipient.copy();
7996      if (linkId != null) {
7997        dst.linkId = new ArrayList<StringType>();
7998        for (StringType i : linkId)
7999          dst.linkId.add(i.copy());
8000      }
8001      ;
8002      if (securityLabelNumber != null) {
8003        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
8004        for (UnsignedIntType i : securityLabelNumber)
8005          dst.securityLabelNumber.add(i.copy());
8006      }
8007      ;
8008    }
8009
8010    @Override
8011    public boolean equalsDeep(Base other_) {
8012      if (!super.equalsDeep(other_))
8013        return false;
8014      if (!(other_ instanceof ValuedItemComponent))
8015        return false;
8016      ValuedItemComponent o = (ValuedItemComponent) other_;
8017      return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true)
8018          && compareDeep(effectiveTime, o.effectiveTime, true) && compareDeep(quantity, o.quantity, true)
8019          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
8020          && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
8021          && compareDeep(payment, o.payment, true) && compareDeep(paymentDate, o.paymentDate, true)
8022          && compareDeep(responsible, o.responsible, true) && compareDeep(recipient, o.recipient, true)
8023          && compareDeep(linkId, o.linkId, true) && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
8024    }
8025
8026    @Override
8027    public boolean equalsShallow(Base other_) {
8028      if (!super.equalsShallow(other_))
8029        return false;
8030      if (!(other_ instanceof ValuedItemComponent))
8031        return false;
8032      ValuedItemComponent o = (ValuedItemComponent) other_;
8033      return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
8034          && compareValues(points, o.points, true) && compareValues(payment, o.payment, true)
8035          && compareValues(paymentDate, o.paymentDate, true) && compareValues(linkId, o.linkId, true)
8036          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
8037    }
8038
8039    public boolean isEmpty() {
8040      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, identifier, effectiveTime, quantity,
8041          unitPrice, factor, points, net, payment, paymentDate, responsible, recipient, linkId, securityLabelNumber);
8042    }
8043
8044    public String fhirType() {
8045      return "Contract.term.asset.valuedItem";
8046
8047    }
8048
8049  }
8050
8051  @Block()
8052  public static class ActionComponent extends BackboneElement implements IBaseBackboneElement {
8053    /**
8054     * True if the term prohibits the action.
8055     */
8056    @Child(name = "doNotPerform", type = {
8057        BooleanType.class }, order = 1, min = 0, max = 1, modifier = true, summary = false)
8058    @Description(shortDefinition = "True if the term prohibits the  action", formalDefinition = "True if the term prohibits the  action.")
8059    protected BooleanType doNotPerform;
8060
8061    /**
8062     * Activity or service obligation to be done or not done, performed or not
8063     * performed, effectuated or not by this Contract term.
8064     */
8065    @Child(name = "type", type = {
8066        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
8067    @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.")
8068    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-action")
8069    protected CodeableConcept type;
8070
8071    /**
8072     * Entity of the action.
8073     */
8074    @Child(name = "subject", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8075    @Description(shortDefinition = "Entity of the action", formalDefinition = "Entity of the action.")
8076    protected List<ActionSubjectComponent> subject;
8077
8078    /**
8079     * Reason or purpose for the action stipulated by this Contract Provision.
8080     */
8081    @Child(name = "intent", type = {
8082        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
8083    @Description(shortDefinition = "Purpose for the Contract Term Action", formalDefinition = "Reason or purpose for the action stipulated by this Contract Provision.")
8084    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
8085    protected CodeableConcept intent;
8086
8087    /**
8088     * Id [identifier??] of the clause or question text related to this action in
8089     * the referenced form or QuestionnaireResponse.
8090     */
8091    @Child(name = "linkId", type = {
8092        StringType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8093    @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.")
8094    protected List<StringType> linkId;
8095
8096    /**
8097     * Current state of the term action.
8098     */
8099    @Child(name = "status", type = {
8100        CodeableConcept.class }, order = 6, min = 1, max = 1, modifier = false, summary = false)
8101    @Description(shortDefinition = "State of the action", formalDefinition = "Current state of the term action.")
8102    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-actionstatus")
8103    protected CodeableConcept status;
8104
8105    /**
8106     * Encounter or Episode with primary association to specified term activity.
8107     */
8108    @Child(name = "context", type = { Encounter.class,
8109        EpisodeOfCare.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
8110    @Description(shortDefinition = "Episode associated with action", formalDefinition = "Encounter or Episode with primary association to specified term activity.")
8111    protected Reference context;
8112
8113    /**
8114     * The actual object that is the target of the reference (Encounter or Episode
8115     * with primary association to specified term activity.)
8116     */
8117    protected Resource contextTarget;
8118
8119    /**
8120     * Id [identifier??] of the clause or question text related to the requester of
8121     * this action in the referenced form or QuestionnaireResponse.
8122     */
8123    @Child(name = "contextLinkId", type = {
8124        StringType.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8125    @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.")
8126    protected List<StringType> contextLinkId;
8127
8128    /**
8129     * When action happens.
8130     */
8131    @Child(name = "occurrence", type = { DateTimeType.class, Period.class,
8132        Timing.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
8133    @Description(shortDefinition = "When action happens", formalDefinition = "When action happens.")
8134    protected Type occurrence;
8135
8136    /**
8137     * Who or what initiated the action and has responsibility for its activation.
8138     */
8139    @Child(name = "requester", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
8140        Device.class, Group.class,
8141        Organization.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8142    @Description(shortDefinition = "Who asked for action", formalDefinition = "Who or what initiated the action and has responsibility for its activation.")
8143    protected List<Reference> requester;
8144    /**
8145     * The actual objects that are the target of the reference (Who or what
8146     * initiated the action and has responsibility for its activation.)
8147     */
8148    protected List<Resource> requesterTarget;
8149
8150    /**
8151     * Id [identifier??] of the clause or question text related to the requester of
8152     * this action in the referenced form or QuestionnaireResponse.
8153     */
8154    @Child(name = "requesterLinkId", type = {
8155        StringType.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8156    @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.")
8157    protected List<StringType> requesterLinkId;
8158
8159    /**
8160     * The type of individual that is desired or required to perform or not perform
8161     * the action.
8162     */
8163    @Child(name = "performerType", type = {
8164        CodeableConcept.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8165    @Description(shortDefinition = "Kind of service performer", formalDefinition = "The type of individual that is desired or required to perform or not perform the action.")
8166    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provenance-agent-type")
8167    protected List<CodeableConcept> performerType;
8168
8169    /**
8170     * The type of role or competency of an individual desired or required to
8171     * perform or not perform the action.
8172     */
8173    @Child(name = "performerRole", type = {
8174        CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
8175    @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.")
8176    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provenance-agent-role")
8177    protected CodeableConcept performerRole;
8178
8179    /**
8180     * Indicates who or what is being asked to perform (or not perform) the ction.
8181     */
8182    @Child(name = "performer", type = { RelatedPerson.class, Patient.class, Practitioner.class, PractitionerRole.class,
8183        CareTeam.class, Device.class, Substance.class, Organization.class,
8184        Location.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
8185    @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.")
8186    protected Reference performer;
8187
8188    /**
8189     * The actual object that is the target of the reference (Indicates who or what
8190     * is being asked to perform (or not perform) the ction.)
8191     */
8192    protected Resource performerTarget;
8193
8194    /**
8195     * Id [identifier??] of the clause or question text related to the reason type
8196     * or reference of this action in the referenced form or QuestionnaireResponse.
8197     */
8198    @Child(name = "performerLinkId", type = {
8199        StringType.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8200    @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.")
8201    protected List<StringType> performerLinkId;
8202
8203    /**
8204     * Rationale for the action to be performed or not performed. Describes why the
8205     * action is permitted or prohibited.
8206     */
8207    @Child(name = "reasonCode", type = {
8208        CodeableConcept.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8209    @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.")
8210    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
8211    protected List<CodeableConcept> reasonCode;
8212
8213    /**
8214     * Indicates another resource whose existence justifies permitting or not
8215     * permitting this action.
8216     */
8217    @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
8218        DocumentReference.class, Questionnaire.class,
8219        QuestionnaireResponse.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8220    @Description(shortDefinition = "Why is action (not) needed?", formalDefinition = "Indicates another resource whose existence justifies permitting or not permitting this action.")
8221    protected List<Reference> reasonReference;
8222    /**
8223     * The actual objects that are the target of the reference (Indicates another
8224     * resource whose existence justifies permitting or not permitting this action.)
8225     */
8226    protected List<Resource> reasonReferenceTarget;
8227
8228    /**
8229     * Describes why the action is to be performed or not performed in textual form.
8230     */
8231    @Child(name = "reason", type = {
8232        StringType.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8233    @Description(shortDefinition = "Why action is to be performed", formalDefinition = "Describes why the action is to be performed or not performed in textual form.")
8234    protected List<StringType> reason;
8235
8236    /**
8237     * Id [identifier??] of the clause or question text related to the reason type
8238     * or reference of this action in the referenced form or QuestionnaireResponse.
8239     */
8240    @Child(name = "reasonLinkId", type = {
8241        StringType.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8242    @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.")
8243    protected List<StringType> reasonLinkId;
8244
8245    /**
8246     * Comments made about the term action made by the requester, performer, subject
8247     * or other participants.
8248     */
8249    @Child(name = "note", type = {
8250        Annotation.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8251    @Description(shortDefinition = "Comments about the action", formalDefinition = "Comments made about the term action made by the requester, performer, subject or other participants.")
8252    protected List<Annotation> note;
8253
8254    /**
8255     * Security labels that protects the action.
8256     */
8257    @Child(name = "securityLabelNumber", type = {
8258        UnsignedIntType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8259    @Description(shortDefinition = "Action restriction numbers", formalDefinition = "Security labels that protects the action.")
8260    protected List<UnsignedIntType> securityLabelNumber;
8261
8262    private static final long serialVersionUID = -178728180L;
8263
8264    /**
8265     * Constructor
8266     */
8267    public ActionComponent() {
8268      super();
8269    }
8270
8271    /**
8272     * Constructor
8273     */
8274    public ActionComponent(CodeableConcept type, CodeableConcept intent, CodeableConcept status) {
8275      super();
8276      this.type = type;
8277      this.intent = intent;
8278      this.status = status;
8279    }
8280
8281    /**
8282     * @return {@link #doNotPerform} (True if the term prohibits the action.). This
8283     *         is the underlying object with id, value and extensions. The accessor
8284     *         "getDoNotPerform" gives direct access to the value
8285     */
8286    public BooleanType getDoNotPerformElement() {
8287      if (this.doNotPerform == null)
8288        if (Configuration.errorOnAutoCreate())
8289          throw new Error("Attempt to auto-create ActionComponent.doNotPerform");
8290        else if (Configuration.doAutoCreate())
8291          this.doNotPerform = new BooleanType(); // bb
8292      return this.doNotPerform;
8293    }
8294
8295    public boolean hasDoNotPerformElement() {
8296      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
8297    }
8298
8299    public boolean hasDoNotPerform() {
8300      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
8301    }
8302
8303    /**
8304     * @param value {@link #doNotPerform} (True if the term prohibits the action.).
8305     *              This is the underlying object with id, value and extensions. The
8306     *              accessor "getDoNotPerform" gives direct access to the value
8307     */
8308    public ActionComponent setDoNotPerformElement(BooleanType value) {
8309      this.doNotPerform = value;
8310      return this;
8311    }
8312
8313    /**
8314     * @return True if the term prohibits the action.
8315     */
8316    public boolean getDoNotPerform() {
8317      return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
8318    }
8319
8320    /**
8321     * @param value True if the term prohibits the action.
8322     */
8323    public ActionComponent setDoNotPerform(boolean value) {
8324      if (this.doNotPerform == null)
8325        this.doNotPerform = new BooleanType();
8326      this.doNotPerform.setValue(value);
8327      return this;
8328    }
8329
8330    /**
8331     * @return {@link #type} (Activity or service obligation to be done or not done,
8332     *         performed or not performed, effectuated or not by this Contract
8333     *         term.)
8334     */
8335    public CodeableConcept getType() {
8336      if (this.type == null)
8337        if (Configuration.errorOnAutoCreate())
8338          throw new Error("Attempt to auto-create ActionComponent.type");
8339        else if (Configuration.doAutoCreate())
8340          this.type = new CodeableConcept(); // cc
8341      return this.type;
8342    }
8343
8344    public boolean hasType() {
8345      return this.type != null && !this.type.isEmpty();
8346    }
8347
8348    /**
8349     * @param value {@link #type} (Activity or service obligation to be done or not
8350     *              done, performed or not performed, effectuated or not by this
8351     *              Contract term.)
8352     */
8353    public ActionComponent setType(CodeableConcept value) {
8354      this.type = value;
8355      return this;
8356    }
8357
8358    /**
8359     * @return {@link #subject} (Entity of the action.)
8360     */
8361    public List<ActionSubjectComponent> getSubject() {
8362      if (this.subject == null)
8363        this.subject = new ArrayList<ActionSubjectComponent>();
8364      return this.subject;
8365    }
8366
8367    /**
8368     * @return Returns a reference to <code>this</code> for easy method chaining
8369     */
8370    public ActionComponent setSubject(List<ActionSubjectComponent> theSubject) {
8371      this.subject = theSubject;
8372      return this;
8373    }
8374
8375    public boolean hasSubject() {
8376      if (this.subject == null)
8377        return false;
8378      for (ActionSubjectComponent item : this.subject)
8379        if (!item.isEmpty())
8380          return true;
8381      return false;
8382    }
8383
8384    public ActionSubjectComponent addSubject() { // 3
8385      ActionSubjectComponent t = new ActionSubjectComponent();
8386      if (this.subject == null)
8387        this.subject = new ArrayList<ActionSubjectComponent>();
8388      this.subject.add(t);
8389      return t;
8390    }
8391
8392    public ActionComponent addSubject(ActionSubjectComponent t) { // 3
8393      if (t == null)
8394        return this;
8395      if (this.subject == null)
8396        this.subject = new ArrayList<ActionSubjectComponent>();
8397      this.subject.add(t);
8398      return this;
8399    }
8400
8401    /**
8402     * @return The first repetition of repeating field {@link #subject}, creating it
8403     *         if it does not already exist
8404     */
8405    public ActionSubjectComponent getSubjectFirstRep() {
8406      if (getSubject().isEmpty()) {
8407        addSubject();
8408      }
8409      return getSubject().get(0);
8410    }
8411
8412    /**
8413     * @return {@link #intent} (Reason or purpose for the action stipulated by this
8414     *         Contract Provision.)
8415     */
8416    public CodeableConcept getIntent() {
8417      if (this.intent == null)
8418        if (Configuration.errorOnAutoCreate())
8419          throw new Error("Attempt to auto-create ActionComponent.intent");
8420        else if (Configuration.doAutoCreate())
8421          this.intent = new CodeableConcept(); // cc
8422      return this.intent;
8423    }
8424
8425    public boolean hasIntent() {
8426      return this.intent != null && !this.intent.isEmpty();
8427    }
8428
8429    /**
8430     * @param value {@link #intent} (Reason or purpose for the action stipulated by
8431     *              this Contract Provision.)
8432     */
8433    public ActionComponent setIntent(CodeableConcept value) {
8434      this.intent = value;
8435      return this;
8436    }
8437
8438    /**
8439     * @return {@link #linkId} (Id [identifier??] of the clause or question text
8440     *         related to this action in the referenced form or
8441     *         QuestionnaireResponse.)
8442     */
8443    public List<StringType> getLinkId() {
8444      if (this.linkId == null)
8445        this.linkId = new ArrayList<StringType>();
8446      return this.linkId;
8447    }
8448
8449    /**
8450     * @return Returns a reference to <code>this</code> for easy method chaining
8451     */
8452    public ActionComponent setLinkId(List<StringType> theLinkId) {
8453      this.linkId = theLinkId;
8454      return this;
8455    }
8456
8457    public boolean hasLinkId() {
8458      if (this.linkId == null)
8459        return false;
8460      for (StringType item : this.linkId)
8461        if (!item.isEmpty())
8462          return true;
8463      return false;
8464    }
8465
8466    /**
8467     * @return {@link #linkId} (Id [identifier??] of the clause or question text
8468     *         related to this action in the referenced form or
8469     *         QuestionnaireResponse.)
8470     */
8471    public StringType addLinkIdElement() {// 2
8472      StringType t = new StringType();
8473      if (this.linkId == null)
8474        this.linkId = new ArrayList<StringType>();
8475      this.linkId.add(t);
8476      return t;
8477    }
8478
8479    /**
8480     * @param value {@link #linkId} (Id [identifier??] of the clause or question
8481     *              text related to this action in the referenced form or
8482     *              QuestionnaireResponse.)
8483     */
8484    public ActionComponent addLinkId(String value) { // 1
8485      StringType t = new StringType();
8486      t.setValue(value);
8487      if (this.linkId == null)
8488        this.linkId = new ArrayList<StringType>();
8489      this.linkId.add(t);
8490      return this;
8491    }
8492
8493    /**
8494     * @param value {@link #linkId} (Id [identifier??] of the clause or question
8495     *              text related to this action in the referenced form or
8496     *              QuestionnaireResponse.)
8497     */
8498    public boolean hasLinkId(String value) {
8499      if (this.linkId == null)
8500        return false;
8501      for (StringType v : this.linkId)
8502        if (v.getValue().equals(value)) // string
8503          return true;
8504      return false;
8505    }
8506
8507    /**
8508     * @return {@link #status} (Current state of the term action.)
8509     */
8510    public CodeableConcept getStatus() {
8511      if (this.status == null)
8512        if (Configuration.errorOnAutoCreate())
8513          throw new Error("Attempt to auto-create ActionComponent.status");
8514        else if (Configuration.doAutoCreate())
8515          this.status = new CodeableConcept(); // cc
8516      return this.status;
8517    }
8518
8519    public boolean hasStatus() {
8520      return this.status != null && !this.status.isEmpty();
8521    }
8522
8523    /**
8524     * @param value {@link #status} (Current state of the term action.)
8525     */
8526    public ActionComponent setStatus(CodeableConcept value) {
8527      this.status = value;
8528      return this;
8529    }
8530
8531    /**
8532     * @return {@link #context} (Encounter or Episode with primary association to
8533     *         specified term activity.)
8534     */
8535    public Reference getContext() {
8536      if (this.context == null)
8537        if (Configuration.errorOnAutoCreate())
8538          throw new Error("Attempt to auto-create ActionComponent.context");
8539        else if (Configuration.doAutoCreate())
8540          this.context = new Reference(); // cc
8541      return this.context;
8542    }
8543
8544    public boolean hasContext() {
8545      return this.context != null && !this.context.isEmpty();
8546    }
8547
8548    /**
8549     * @param value {@link #context} (Encounter or Episode with primary association
8550     *              to specified term activity.)
8551     */
8552    public ActionComponent setContext(Reference value) {
8553      this.context = value;
8554      return this;
8555    }
8556
8557    /**
8558     * @return {@link #context} The actual object that is the target of the
8559     *         reference. The reference library doesn't populate this, but you can
8560     *         use it to hold the resource if you resolve it. (Encounter or Episode
8561     *         with primary association to specified term activity.)
8562     */
8563    public Resource getContextTarget() {
8564      return this.contextTarget;
8565    }
8566
8567    /**
8568     * @param value {@link #context} The actual object that is the target of the
8569     *              reference. The reference library doesn't use these, but you can
8570     *              use it to hold the resource if you resolve it. (Encounter or
8571     *              Episode with primary association to specified term activity.)
8572     */
8573    public ActionComponent setContextTarget(Resource value) {
8574      this.contextTarget = value;
8575      return this;
8576    }
8577
8578    /**
8579     * @return {@link #contextLinkId} (Id [identifier??] of the clause or question
8580     *         text related to the requester of this action in the referenced form
8581     *         or QuestionnaireResponse.)
8582     */
8583    public List<StringType> getContextLinkId() {
8584      if (this.contextLinkId == null)
8585        this.contextLinkId = new ArrayList<StringType>();
8586      return this.contextLinkId;
8587    }
8588
8589    /**
8590     * @return Returns a reference to <code>this</code> for easy method chaining
8591     */
8592    public ActionComponent setContextLinkId(List<StringType> theContextLinkId) {
8593      this.contextLinkId = theContextLinkId;
8594      return this;
8595    }
8596
8597    public boolean hasContextLinkId() {
8598      if (this.contextLinkId == null)
8599        return false;
8600      for (StringType item : this.contextLinkId)
8601        if (!item.isEmpty())
8602          return true;
8603      return false;
8604    }
8605
8606    /**
8607     * @return {@link #contextLinkId} (Id [identifier??] of the clause or question
8608     *         text related to the requester of this action in the referenced form
8609     *         or QuestionnaireResponse.)
8610     */
8611    public StringType addContextLinkIdElement() {// 2
8612      StringType t = new StringType();
8613      if (this.contextLinkId == null)
8614        this.contextLinkId = new ArrayList<StringType>();
8615      this.contextLinkId.add(t);
8616      return t;
8617    }
8618
8619    /**
8620     * @param value {@link #contextLinkId} (Id [identifier??] of the clause or
8621     *              question text related to the requester of this action in the
8622     *              referenced form or QuestionnaireResponse.)
8623     */
8624    public ActionComponent addContextLinkId(String value) { // 1
8625      StringType t = new StringType();
8626      t.setValue(value);
8627      if (this.contextLinkId == null)
8628        this.contextLinkId = new ArrayList<StringType>();
8629      this.contextLinkId.add(t);
8630      return this;
8631    }
8632
8633    /**
8634     * @param value {@link #contextLinkId} (Id [identifier??] of the clause or
8635     *              question text related to the requester of this action in the
8636     *              referenced form or QuestionnaireResponse.)
8637     */
8638    public boolean hasContextLinkId(String value) {
8639      if (this.contextLinkId == null)
8640        return false;
8641      for (StringType v : this.contextLinkId)
8642        if (v.getValue().equals(value)) // string
8643          return true;
8644      return false;
8645    }
8646
8647    /**
8648     * @return {@link #occurrence} (When action happens.)
8649     */
8650    public Type getOccurrence() {
8651      return this.occurrence;
8652    }
8653
8654    /**
8655     * @return {@link #occurrence} (When action happens.)
8656     */
8657    public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
8658      if (this.occurrence == null)
8659        this.occurrence = new DateTimeType();
8660      if (!(this.occurrence instanceof DateTimeType))
8661        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
8662            + this.occurrence.getClass().getName() + " was encountered");
8663      return (DateTimeType) this.occurrence;
8664    }
8665
8666    public boolean hasOccurrenceDateTimeType() {
8667      return this != null && this.occurrence instanceof DateTimeType;
8668    }
8669
8670    /**
8671     * @return {@link #occurrence} (When action happens.)
8672     */
8673    public Period getOccurrencePeriod() throws FHIRException {
8674      if (this.occurrence == null)
8675        this.occurrence = new Period();
8676      if (!(this.occurrence instanceof Period))
8677        throw new FHIRException("Type mismatch: the type Period was expected, but "
8678            + this.occurrence.getClass().getName() + " was encountered");
8679      return (Period) this.occurrence;
8680    }
8681
8682    public boolean hasOccurrencePeriod() {
8683      return this != null && this.occurrence instanceof Period;
8684    }
8685
8686    /**
8687     * @return {@link #occurrence} (When action happens.)
8688     */
8689    public Timing getOccurrenceTiming() throws FHIRException {
8690      if (this.occurrence == null)
8691        this.occurrence = new Timing();
8692      if (!(this.occurrence instanceof Timing))
8693        throw new FHIRException("Type mismatch: the type Timing was expected, but "
8694            + this.occurrence.getClass().getName() + " was encountered");
8695      return (Timing) this.occurrence;
8696    }
8697
8698    public boolean hasOccurrenceTiming() {
8699      return this != null && this.occurrence instanceof Timing;
8700    }
8701
8702    public boolean hasOccurrence() {
8703      return this.occurrence != null && !this.occurrence.isEmpty();
8704    }
8705
8706    /**
8707     * @param value {@link #occurrence} (When action happens.)
8708     */
8709    public ActionComponent setOccurrence(Type value) {
8710      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
8711        throw new Error("Not the right type for Contract.term.action.occurrence[x]: " + value.fhirType());
8712      this.occurrence = value;
8713      return this;
8714    }
8715
8716    /**
8717     * @return {@link #requester} (Who or what initiated the action and has
8718     *         responsibility for its activation.)
8719     */
8720    public List<Reference> getRequester() {
8721      if (this.requester == null)
8722        this.requester = new ArrayList<Reference>();
8723      return this.requester;
8724    }
8725
8726    /**
8727     * @return Returns a reference to <code>this</code> for easy method chaining
8728     */
8729    public ActionComponent setRequester(List<Reference> theRequester) {
8730      this.requester = theRequester;
8731      return this;
8732    }
8733
8734    public boolean hasRequester() {
8735      if (this.requester == null)
8736        return false;
8737      for (Reference item : this.requester)
8738        if (!item.isEmpty())
8739          return true;
8740      return false;
8741    }
8742
8743    public Reference addRequester() { // 3
8744      Reference t = new Reference();
8745      if (this.requester == null)
8746        this.requester = new ArrayList<Reference>();
8747      this.requester.add(t);
8748      return t;
8749    }
8750
8751    public ActionComponent addRequester(Reference t) { // 3
8752      if (t == null)
8753        return this;
8754      if (this.requester == null)
8755        this.requester = new ArrayList<Reference>();
8756      this.requester.add(t);
8757      return this;
8758    }
8759
8760    /**
8761     * @return The first repetition of repeating field {@link #requester}, creating
8762     *         it if it does not already exist
8763     */
8764    public Reference getRequesterFirstRep() {
8765      if (getRequester().isEmpty()) {
8766        addRequester();
8767      }
8768      return getRequester().get(0);
8769    }
8770
8771    /**
8772     * @deprecated Use Reference#setResource(IBaseResource) instead
8773     */
8774    @Deprecated
8775    public List<Resource> getRequesterTarget() {
8776      if (this.requesterTarget == null)
8777        this.requesterTarget = new ArrayList<Resource>();
8778      return this.requesterTarget;
8779    }
8780
8781    /**
8782     * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question
8783     *         text related to the requester of this action in the referenced form
8784     *         or QuestionnaireResponse.)
8785     */
8786    public List<StringType> getRequesterLinkId() {
8787      if (this.requesterLinkId == null)
8788        this.requesterLinkId = new ArrayList<StringType>();
8789      return this.requesterLinkId;
8790    }
8791
8792    /**
8793     * @return Returns a reference to <code>this</code> for easy method chaining
8794     */
8795    public ActionComponent setRequesterLinkId(List<StringType> theRequesterLinkId) {
8796      this.requesterLinkId = theRequesterLinkId;
8797      return this;
8798    }
8799
8800    public boolean hasRequesterLinkId() {
8801      if (this.requesterLinkId == null)
8802        return false;
8803      for (StringType item : this.requesterLinkId)
8804        if (!item.isEmpty())
8805          return true;
8806      return false;
8807    }
8808
8809    /**
8810     * @return {@link #requesterLinkId} (Id [identifier??] of the clause or question
8811     *         text related to the requester of this action in the referenced form
8812     *         or QuestionnaireResponse.)
8813     */
8814    public StringType addRequesterLinkIdElement() {// 2
8815      StringType t = new StringType();
8816      if (this.requesterLinkId == null)
8817        this.requesterLinkId = new ArrayList<StringType>();
8818      this.requesterLinkId.add(t);
8819      return t;
8820    }
8821
8822    /**
8823     * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or
8824     *              question text related to the requester of this action in the
8825     *              referenced form or QuestionnaireResponse.)
8826     */
8827    public ActionComponent addRequesterLinkId(String value) { // 1
8828      StringType t = new StringType();
8829      t.setValue(value);
8830      if (this.requesterLinkId == null)
8831        this.requesterLinkId = new ArrayList<StringType>();
8832      this.requesterLinkId.add(t);
8833      return this;
8834    }
8835
8836    /**
8837     * @param value {@link #requesterLinkId} (Id [identifier??] of the clause or
8838     *              question text related to the requester of this action in the
8839     *              referenced form or QuestionnaireResponse.)
8840     */
8841    public boolean hasRequesterLinkId(String value) {
8842      if (this.requesterLinkId == null)
8843        return false;
8844      for (StringType v : this.requesterLinkId)
8845        if (v.getValue().equals(value)) // string
8846          return true;
8847      return false;
8848    }
8849
8850    /**
8851     * @return {@link #performerType} (The type of individual that is desired or
8852     *         required to perform or not perform the action.)
8853     */
8854    public List<CodeableConcept> getPerformerType() {
8855      if (this.performerType == null)
8856        this.performerType = new ArrayList<CodeableConcept>();
8857      return this.performerType;
8858    }
8859
8860    /**
8861     * @return Returns a reference to <code>this</code> for easy method chaining
8862     */
8863    public ActionComponent setPerformerType(List<CodeableConcept> thePerformerType) {
8864      this.performerType = thePerformerType;
8865      return this;
8866    }
8867
8868    public boolean hasPerformerType() {
8869      if (this.performerType == null)
8870        return false;
8871      for (CodeableConcept item : this.performerType)
8872        if (!item.isEmpty())
8873          return true;
8874      return false;
8875    }
8876
8877    public CodeableConcept addPerformerType() { // 3
8878      CodeableConcept t = new CodeableConcept();
8879      if (this.performerType == null)
8880        this.performerType = new ArrayList<CodeableConcept>();
8881      this.performerType.add(t);
8882      return t;
8883    }
8884
8885    public ActionComponent addPerformerType(CodeableConcept t) { // 3
8886      if (t == null)
8887        return this;
8888      if (this.performerType == null)
8889        this.performerType = new ArrayList<CodeableConcept>();
8890      this.performerType.add(t);
8891      return this;
8892    }
8893
8894    /**
8895     * @return The first repetition of repeating field {@link #performerType},
8896     *         creating it if it does not already exist
8897     */
8898    public CodeableConcept getPerformerTypeFirstRep() {
8899      if (getPerformerType().isEmpty()) {
8900        addPerformerType();
8901      }
8902      return getPerformerType().get(0);
8903    }
8904
8905    /**
8906     * @return {@link #performerRole} (The type of role or competency of an
8907     *         individual desired or required to perform or not perform the action.)
8908     */
8909    public CodeableConcept getPerformerRole() {
8910      if (this.performerRole == null)
8911        if (Configuration.errorOnAutoCreate())
8912          throw new Error("Attempt to auto-create ActionComponent.performerRole");
8913        else if (Configuration.doAutoCreate())
8914          this.performerRole = new CodeableConcept(); // cc
8915      return this.performerRole;
8916    }
8917
8918    public boolean hasPerformerRole() {
8919      return this.performerRole != null && !this.performerRole.isEmpty();
8920    }
8921
8922    /**
8923     * @param value {@link #performerRole} (The type of role or competency of an
8924     *              individual desired or required to perform or not perform the
8925     *              action.)
8926     */
8927    public ActionComponent setPerformerRole(CodeableConcept value) {
8928      this.performerRole = value;
8929      return this;
8930    }
8931
8932    /**
8933     * @return {@link #performer} (Indicates who or what is being asked to perform
8934     *         (or not perform) the ction.)
8935     */
8936    public Reference getPerformer() {
8937      if (this.performer == null)
8938        if (Configuration.errorOnAutoCreate())
8939          throw new Error("Attempt to auto-create ActionComponent.performer");
8940        else if (Configuration.doAutoCreate())
8941          this.performer = new Reference(); // cc
8942      return this.performer;
8943    }
8944
8945    public boolean hasPerformer() {
8946      return this.performer != null && !this.performer.isEmpty();
8947    }
8948
8949    /**
8950     * @param value {@link #performer} (Indicates who or what is being asked to
8951     *              perform (or not perform) the ction.)
8952     */
8953    public ActionComponent setPerformer(Reference value) {
8954      this.performer = value;
8955      return this;
8956    }
8957
8958    /**
8959     * @return {@link #performer} The actual object that is the target of the
8960     *         reference. The reference library doesn't populate this, but you can
8961     *         use it to hold the resource if you resolve it. (Indicates who or what
8962     *         is being asked to perform (or not perform) the ction.)
8963     */
8964    public Resource getPerformerTarget() {
8965      return this.performerTarget;
8966    }
8967
8968    /**
8969     * @param value {@link #performer} The actual object that is the target of the
8970     *              reference. The reference library doesn't use these, but you can
8971     *              use it to hold the resource if you resolve it. (Indicates who or
8972     *              what is being asked to perform (or not perform) the ction.)
8973     */
8974    public ActionComponent setPerformerTarget(Resource value) {
8975      this.performerTarget = value;
8976      return this;
8977    }
8978
8979    /**
8980     * @return {@link #performerLinkId} (Id [identifier??] of the clause or question
8981     *         text related to the reason type or reference of this action in the
8982     *         referenced form or QuestionnaireResponse.)
8983     */
8984    public List<StringType> getPerformerLinkId() {
8985      if (this.performerLinkId == null)
8986        this.performerLinkId = new ArrayList<StringType>();
8987      return this.performerLinkId;
8988    }
8989
8990    /**
8991     * @return Returns a reference to <code>this</code> for easy method chaining
8992     */
8993    public ActionComponent setPerformerLinkId(List<StringType> thePerformerLinkId) {
8994      this.performerLinkId = thePerformerLinkId;
8995      return this;
8996    }
8997
8998    public boolean hasPerformerLinkId() {
8999      if (this.performerLinkId == null)
9000        return false;
9001      for (StringType item : this.performerLinkId)
9002        if (!item.isEmpty())
9003          return true;
9004      return false;
9005    }
9006
9007    /**
9008     * @return {@link #performerLinkId} (Id [identifier??] of the clause or question
9009     *         text related to the reason type or reference of this action in the
9010     *         referenced form or QuestionnaireResponse.)
9011     */
9012    public StringType addPerformerLinkIdElement() {// 2
9013      StringType t = new StringType();
9014      if (this.performerLinkId == null)
9015        this.performerLinkId = new ArrayList<StringType>();
9016      this.performerLinkId.add(t);
9017      return t;
9018    }
9019
9020    /**
9021     * @param value {@link #performerLinkId} (Id [identifier??] of the clause or
9022     *              question text related to the reason type or reference of this
9023     *              action in the referenced form or QuestionnaireResponse.)
9024     */
9025    public ActionComponent addPerformerLinkId(String value) { // 1
9026      StringType t = new StringType();
9027      t.setValue(value);
9028      if (this.performerLinkId == null)
9029        this.performerLinkId = new ArrayList<StringType>();
9030      this.performerLinkId.add(t);
9031      return this;
9032    }
9033
9034    /**
9035     * @param value {@link #performerLinkId} (Id [identifier??] of the clause or
9036     *              question text related to the reason type or reference of this
9037     *              action in the referenced form or QuestionnaireResponse.)
9038     */
9039    public boolean hasPerformerLinkId(String value) {
9040      if (this.performerLinkId == null)
9041        return false;
9042      for (StringType v : this.performerLinkId)
9043        if (v.getValue().equals(value)) // string
9044          return true;
9045      return false;
9046    }
9047
9048    /**
9049     * @return {@link #reasonCode} (Rationale for the action to be performed or not
9050     *         performed. Describes why the action is permitted or prohibited.)
9051     */
9052    public List<CodeableConcept> getReasonCode() {
9053      if (this.reasonCode == null)
9054        this.reasonCode = new ArrayList<CodeableConcept>();
9055      return this.reasonCode;
9056    }
9057
9058    /**
9059     * @return Returns a reference to <code>this</code> for easy method chaining
9060     */
9061    public ActionComponent setReasonCode(List<CodeableConcept> theReasonCode) {
9062      this.reasonCode = theReasonCode;
9063      return this;
9064    }
9065
9066    public boolean hasReasonCode() {
9067      if (this.reasonCode == null)
9068        return false;
9069      for (CodeableConcept item : this.reasonCode)
9070        if (!item.isEmpty())
9071          return true;
9072      return false;
9073    }
9074
9075    public CodeableConcept addReasonCode() { // 3
9076      CodeableConcept t = new CodeableConcept();
9077      if (this.reasonCode == null)
9078        this.reasonCode = new ArrayList<CodeableConcept>();
9079      this.reasonCode.add(t);
9080      return t;
9081    }
9082
9083    public ActionComponent addReasonCode(CodeableConcept t) { // 3
9084      if (t == null)
9085        return this;
9086      if (this.reasonCode == null)
9087        this.reasonCode = new ArrayList<CodeableConcept>();
9088      this.reasonCode.add(t);
9089      return this;
9090    }
9091
9092    /**
9093     * @return The first repetition of repeating field {@link #reasonCode}, creating
9094     *         it if it does not already exist
9095     */
9096    public CodeableConcept getReasonCodeFirstRep() {
9097      if (getReasonCode().isEmpty()) {
9098        addReasonCode();
9099      }
9100      return getReasonCode().get(0);
9101    }
9102
9103    /**
9104     * @return {@link #reasonReference} (Indicates another resource whose existence
9105     *         justifies permitting or not permitting this action.)
9106     */
9107    public List<Reference> getReasonReference() {
9108      if (this.reasonReference == null)
9109        this.reasonReference = new ArrayList<Reference>();
9110      return this.reasonReference;
9111    }
9112
9113    /**
9114     * @return Returns a reference to <code>this</code> for easy method chaining
9115     */
9116    public ActionComponent setReasonReference(List<Reference> theReasonReference) {
9117      this.reasonReference = theReasonReference;
9118      return this;
9119    }
9120
9121    public boolean hasReasonReference() {
9122      if (this.reasonReference == null)
9123        return false;
9124      for (Reference item : this.reasonReference)
9125        if (!item.isEmpty())
9126          return true;
9127      return false;
9128    }
9129
9130    public Reference addReasonReference() { // 3
9131      Reference t = new Reference();
9132      if (this.reasonReference == null)
9133        this.reasonReference = new ArrayList<Reference>();
9134      this.reasonReference.add(t);
9135      return t;
9136    }
9137
9138    public ActionComponent addReasonReference(Reference t) { // 3
9139      if (t == null)
9140        return this;
9141      if (this.reasonReference == null)
9142        this.reasonReference = new ArrayList<Reference>();
9143      this.reasonReference.add(t);
9144      return this;
9145    }
9146
9147    /**
9148     * @return The first repetition of repeating field {@link #reasonReference},
9149     *         creating it if it does not already exist
9150     */
9151    public Reference getReasonReferenceFirstRep() {
9152      if (getReasonReference().isEmpty()) {
9153        addReasonReference();
9154      }
9155      return getReasonReference().get(0);
9156    }
9157
9158    /**
9159     * @deprecated Use Reference#setResource(IBaseResource) instead
9160     */
9161    @Deprecated
9162    public List<Resource> getReasonReferenceTarget() {
9163      if (this.reasonReferenceTarget == null)
9164        this.reasonReferenceTarget = new ArrayList<Resource>();
9165      return this.reasonReferenceTarget;
9166    }
9167
9168    /**
9169     * @return {@link #reason} (Describes why the action is to be performed or not
9170     *         performed in textual form.)
9171     */
9172    public List<StringType> getReason() {
9173      if (this.reason == null)
9174        this.reason = new ArrayList<StringType>();
9175      return this.reason;
9176    }
9177
9178    /**
9179     * @return Returns a reference to <code>this</code> for easy method chaining
9180     */
9181    public ActionComponent setReason(List<StringType> theReason) {
9182      this.reason = theReason;
9183      return this;
9184    }
9185
9186    public boolean hasReason() {
9187      if (this.reason == null)
9188        return false;
9189      for (StringType item : this.reason)
9190        if (!item.isEmpty())
9191          return true;
9192      return false;
9193    }
9194
9195    /**
9196     * @return {@link #reason} (Describes why the action is to be performed or not
9197     *         performed in textual form.)
9198     */
9199    public StringType addReasonElement() {// 2
9200      StringType t = new StringType();
9201      if (this.reason == null)
9202        this.reason = new ArrayList<StringType>();
9203      this.reason.add(t);
9204      return t;
9205    }
9206
9207    /**
9208     * @param value {@link #reason} (Describes why the action is to be performed or
9209     *              not performed in textual form.)
9210     */
9211    public ActionComponent addReason(String value) { // 1
9212      StringType t = new StringType();
9213      t.setValue(value);
9214      if (this.reason == null)
9215        this.reason = new ArrayList<StringType>();
9216      this.reason.add(t);
9217      return this;
9218    }
9219
9220    /**
9221     * @param value {@link #reason} (Describes why the action is to be performed or
9222     *              not performed in textual form.)
9223     */
9224    public boolean hasReason(String value) {
9225      if (this.reason == null)
9226        return false;
9227      for (StringType v : this.reason)
9228        if (v.getValue().equals(value)) // string
9229          return true;
9230      return false;
9231    }
9232
9233    /**
9234     * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question
9235     *         text related to the reason type or reference of this action in the
9236     *         referenced form or QuestionnaireResponse.)
9237     */
9238    public List<StringType> getReasonLinkId() {
9239      if (this.reasonLinkId == null)
9240        this.reasonLinkId = new ArrayList<StringType>();
9241      return this.reasonLinkId;
9242    }
9243
9244    /**
9245     * @return Returns a reference to <code>this</code> for easy method chaining
9246     */
9247    public ActionComponent setReasonLinkId(List<StringType> theReasonLinkId) {
9248      this.reasonLinkId = theReasonLinkId;
9249      return this;
9250    }
9251
9252    public boolean hasReasonLinkId() {
9253      if (this.reasonLinkId == null)
9254        return false;
9255      for (StringType item : this.reasonLinkId)
9256        if (!item.isEmpty())
9257          return true;
9258      return false;
9259    }
9260
9261    /**
9262     * @return {@link #reasonLinkId} (Id [identifier??] of the clause or question
9263     *         text related to the reason type or reference of this action in the
9264     *         referenced form or QuestionnaireResponse.)
9265     */
9266    public StringType addReasonLinkIdElement() {// 2
9267      StringType t = new StringType();
9268      if (this.reasonLinkId == null)
9269        this.reasonLinkId = new ArrayList<StringType>();
9270      this.reasonLinkId.add(t);
9271      return t;
9272    }
9273
9274    /**
9275     * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or
9276     *              question text related to the reason type or reference of this
9277     *              action in the referenced form or QuestionnaireResponse.)
9278     */
9279    public ActionComponent addReasonLinkId(String value) { // 1
9280      StringType t = new StringType();
9281      t.setValue(value);
9282      if (this.reasonLinkId == null)
9283        this.reasonLinkId = new ArrayList<StringType>();
9284      this.reasonLinkId.add(t);
9285      return this;
9286    }
9287
9288    /**
9289     * @param value {@link #reasonLinkId} (Id [identifier??] of the clause or
9290     *              question text related to the reason type or reference of this
9291     *              action in the referenced form or QuestionnaireResponse.)
9292     */
9293    public boolean hasReasonLinkId(String value) {
9294      if (this.reasonLinkId == null)
9295        return false;
9296      for (StringType v : this.reasonLinkId)
9297        if (v.getValue().equals(value)) // string
9298          return true;
9299      return false;
9300    }
9301
9302    /**
9303     * @return {@link #note} (Comments made about the term action made by the
9304     *         requester, performer, subject or other participants.)
9305     */
9306    public List<Annotation> getNote() {
9307      if (this.note == null)
9308        this.note = new ArrayList<Annotation>();
9309      return this.note;
9310    }
9311
9312    /**
9313     * @return Returns a reference to <code>this</code> for easy method chaining
9314     */
9315    public ActionComponent setNote(List<Annotation> theNote) {
9316      this.note = theNote;
9317      return this;
9318    }
9319
9320    public boolean hasNote() {
9321      if (this.note == null)
9322        return false;
9323      for (Annotation item : this.note)
9324        if (!item.isEmpty())
9325          return true;
9326      return false;
9327    }
9328
9329    public Annotation addNote() { // 3
9330      Annotation t = new Annotation();
9331      if (this.note == null)
9332        this.note = new ArrayList<Annotation>();
9333      this.note.add(t);
9334      return t;
9335    }
9336
9337    public ActionComponent addNote(Annotation t) { // 3
9338      if (t == null)
9339        return this;
9340      if (this.note == null)
9341        this.note = new ArrayList<Annotation>();
9342      this.note.add(t);
9343      return this;
9344    }
9345
9346    /**
9347     * @return The first repetition of repeating field {@link #note}, creating it if
9348     *         it does not already exist
9349     */
9350    public Annotation getNoteFirstRep() {
9351      if (getNote().isEmpty()) {
9352        addNote();
9353      }
9354      return getNote().get(0);
9355    }
9356
9357    /**
9358     * @return {@link #securityLabelNumber} (Security labels that protects the
9359     *         action.)
9360     */
9361    public List<UnsignedIntType> getSecurityLabelNumber() {
9362      if (this.securityLabelNumber == null)
9363        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9364      return this.securityLabelNumber;
9365    }
9366
9367    /**
9368     * @return Returns a reference to <code>this</code> for easy method chaining
9369     */
9370    public ActionComponent setSecurityLabelNumber(List<UnsignedIntType> theSecurityLabelNumber) {
9371      this.securityLabelNumber = theSecurityLabelNumber;
9372      return this;
9373    }
9374
9375    public boolean hasSecurityLabelNumber() {
9376      if (this.securityLabelNumber == null)
9377        return false;
9378      for (UnsignedIntType item : this.securityLabelNumber)
9379        if (!item.isEmpty())
9380          return true;
9381      return false;
9382    }
9383
9384    /**
9385     * @return {@link #securityLabelNumber} (Security labels that protects the
9386     *         action.)
9387     */
9388    public UnsignedIntType addSecurityLabelNumberElement() {// 2
9389      UnsignedIntType t = new UnsignedIntType();
9390      if (this.securityLabelNumber == null)
9391        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9392      this.securityLabelNumber.add(t);
9393      return t;
9394    }
9395
9396    /**
9397     * @param value {@link #securityLabelNumber} (Security labels that protects the
9398     *              action.)
9399     */
9400    public ActionComponent addSecurityLabelNumber(int value) { // 1
9401      UnsignedIntType t = new UnsignedIntType();
9402      t.setValue(value);
9403      if (this.securityLabelNumber == null)
9404        this.securityLabelNumber = new ArrayList<UnsignedIntType>();
9405      this.securityLabelNumber.add(t);
9406      return this;
9407    }
9408
9409    /**
9410     * @param value {@link #securityLabelNumber} (Security labels that protects the
9411     *              action.)
9412     */
9413    public boolean hasSecurityLabelNumber(int value) {
9414      if (this.securityLabelNumber == null)
9415        return false;
9416      for (UnsignedIntType v : this.securityLabelNumber)
9417        if (v.getValue().equals(value)) // unsignedInt
9418          return true;
9419      return false;
9420    }
9421
9422    protected void listChildren(List<Property> children) {
9423      super.listChildren(children);
9424      children
9425          .add(new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0, 1, doNotPerform));
9426      children.add(new Property("type", "CodeableConcept",
9427          "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.",
9428          0, 1, type));
9429      children.add(new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE, subject));
9430      children.add(new Property("intent", "CodeableConcept",
9431          "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent));
9432      children.add(new Property("linkId", "string",
9433          "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.",
9434          0, java.lang.Integer.MAX_VALUE, linkId));
9435      children.add(new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1, status));
9436      children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)",
9437          "Encounter or Episode with primary association to specified term activity.", 0, 1, context));
9438      children.add(new Property("contextLinkId", "string",
9439          "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9440          0, java.lang.Integer.MAX_VALUE, contextLinkId));
9441      children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1, occurrence));
9442      children.add(new Property("requester",
9443          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
9444          "Who or what initiated the action and has responsibility for its activation.", 0, java.lang.Integer.MAX_VALUE,
9445          requester));
9446      children.add(new Property("requesterLinkId", "string",
9447          "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9448          0, java.lang.Integer.MAX_VALUE, requesterLinkId));
9449      children.add(new Property("performerType", "CodeableConcept",
9450          "The type of individual that is desired or required to perform or not perform the action.", 0,
9451          java.lang.Integer.MAX_VALUE, performerType));
9452      children.add(new Property("performerRole", "CodeableConcept",
9453          "The type of role or competency of an individual desired or required to perform or not perform the action.",
9454          0, 1, performerRole));
9455      children.add(new Property("performer",
9456          "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)",
9457          "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer));
9458      children.add(new Property("performerLinkId", "string",
9459          "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9460          0, java.lang.Integer.MAX_VALUE, performerLinkId));
9461      children.add(new Property("reasonCode", "CodeableConcept",
9462          "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.",
9463          0, java.lang.Integer.MAX_VALUE, reasonCode));
9464      children.add(new Property("reasonReference",
9465          "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)",
9466          "Indicates another resource whose existence justifies permitting or not permitting this action.", 0,
9467          java.lang.Integer.MAX_VALUE, reasonReference));
9468      children.add(new Property("reason", "string",
9469          "Describes why the action is to be performed or not performed in textual form.", 0,
9470          java.lang.Integer.MAX_VALUE, reason));
9471      children.add(new Property("reasonLinkId", "string",
9472          "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9473          0, java.lang.Integer.MAX_VALUE, reasonLinkId));
9474      children.add(new Property("note", "Annotation",
9475          "Comments made about the term action made by the requester, performer, subject or other participants.", 0,
9476          java.lang.Integer.MAX_VALUE, note));
9477      children.add(new Property("securityLabelNumber", "unsignedInt", "Security labels that protects the action.", 0,
9478          java.lang.Integer.MAX_VALUE, securityLabelNumber));
9479    }
9480
9481    @Override
9482    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9483      switch (_hash) {
9484      case -1788508167:
9485        /* doNotPerform */ return new Property("doNotPerform", "boolean", "True if the term prohibits the  action.", 0,
9486            1, doNotPerform);
9487      case 3575610:
9488        /* type */ return new Property("type", "CodeableConcept",
9489            "Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.",
9490            0, 1, type);
9491      case -1867885268:
9492        /* subject */ return new Property("subject", "", "Entity of the action.", 0, java.lang.Integer.MAX_VALUE,
9493            subject);
9494      case -1183762788:
9495        /* intent */ return new Property("intent", "CodeableConcept",
9496            "Reason or purpose for the action stipulated by this Contract Provision.", 0, 1, intent);
9497      case -1102667083:
9498        /* linkId */ return new Property("linkId", "string",
9499            "Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.",
9500            0, java.lang.Integer.MAX_VALUE, linkId);
9501      case -892481550:
9502        /* status */ return new Property("status", "CodeableConcept", "Current state of the term action.", 0, 1,
9503            status);
9504      case 951530927:
9505        /* context */ return new Property("context", "Reference(Encounter|EpisodeOfCare)",
9506            "Encounter or Episode with primary association to specified term activity.", 0, 1, context);
9507      case -288783036:
9508        /* contextLinkId */ return new Property("contextLinkId", "string",
9509            "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9510            0, java.lang.Integer.MAX_VALUE, contextLinkId);
9511      case -2022646513:
9512        /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1,
9513            occurrence);
9514      case 1687874001:
9515        /* occurrence */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0, 1,
9516            occurrence);
9517      case -298443636:
9518        /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.",
9519            0, 1, occurrence);
9520      case 1397156594:
9521        /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0,
9522            1, occurrence);
9523      case 1515218299:
9524        /* occurrenceTiming */ return new Property("occurrence[x]", "dateTime|Period|Timing", "When action happens.", 0,
9525            1, occurrence);
9526      case 693933948:
9527        /* requester */ return new Property("requester",
9528            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
9529            "Who or what initiated the action and has responsibility for its activation.", 0,
9530            java.lang.Integer.MAX_VALUE, requester);
9531      case -1468032687:
9532        /* requesterLinkId */ return new Property("requesterLinkId", "string",
9533            "Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.",
9534            0, java.lang.Integer.MAX_VALUE, requesterLinkId);
9535      case -901444568:
9536        /* performerType */ return new Property("performerType", "CodeableConcept",
9537            "The type of individual that is desired or required to perform or not perform the action.", 0,
9538            java.lang.Integer.MAX_VALUE, performerType);
9539      case -901513884:
9540        /* performerRole */ return new Property("performerRole", "CodeableConcept",
9541            "The type of role or competency of an individual desired or required to perform or not perform the action.",
9542            0, 1, performerRole);
9543      case 481140686:
9544        /* performer */ return new Property("performer",
9545            "Reference(RelatedPerson|Patient|Practitioner|PractitionerRole|CareTeam|Device|Substance|Organization|Location)",
9546            "Indicates who or what is being asked to perform (or not perform) the ction.", 0, 1, performer);
9547      case 1051302947:
9548        /* performerLinkId */ return new Property("performerLinkId", "string",
9549            "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9550            0, java.lang.Integer.MAX_VALUE, performerLinkId);
9551      case 722137681:
9552        /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
9553            "Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited.",
9554            0, java.lang.Integer.MAX_VALUE, reasonCode);
9555      case -1146218137:
9556        /* reasonReference */ return new Property("reasonReference",
9557            "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Questionnaire|QuestionnaireResponse)",
9558            "Indicates another resource whose existence justifies permitting or not permitting this action.", 0,
9559            java.lang.Integer.MAX_VALUE, reasonReference);
9560      case -934964668:
9561        /* reason */ return new Property("reason", "string",
9562            "Describes why the action is to be performed or not performed in textual form.", 0,
9563            java.lang.Integer.MAX_VALUE, reason);
9564      case -1557963239:
9565        /* reasonLinkId */ return new Property("reasonLinkId", "string",
9566            "Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.",
9567            0, java.lang.Integer.MAX_VALUE, reasonLinkId);
9568      case 3387378:
9569        /* note */ return new Property("note", "Annotation",
9570            "Comments made about the term action made by the requester, performer, subject or other participants.", 0,
9571            java.lang.Integer.MAX_VALUE, note);
9572      case -149460995:
9573        /* securityLabelNumber */ return new Property("securityLabelNumber", "unsignedInt",
9574            "Security labels that protects the action.", 0, java.lang.Integer.MAX_VALUE, securityLabelNumber);
9575      default:
9576        return super.getNamedProperty(_hash, _name, _checkValid);
9577      }
9578
9579    }
9580
9581    @Override
9582    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9583      switch (hash) {
9584      case -1788508167:
9585        /* doNotPerform */ return this.doNotPerform == null ? new Base[0] : new Base[] { this.doNotPerform }; // BooleanType
9586      case 3575610:
9587        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
9588      case -1867885268:
9589        /* subject */ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // ActionSubjectComponent
9590      case -1183762788:
9591        /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // CodeableConcept
9592      case -1102667083:
9593        /* linkId */ return this.linkId == null ? new Base[0] : this.linkId.toArray(new Base[this.linkId.size()]); // StringType
9594      case -892481550:
9595        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // CodeableConcept
9596      case 951530927:
9597        /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // Reference
9598      case -288783036:
9599        /* contextLinkId */ return this.contextLinkId == null ? new Base[0]
9600            : this.contextLinkId.toArray(new Base[this.contextLinkId.size()]); // StringType
9601      case 1687874001:
9602        /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
9603      case 693933948:
9604        /* requester */ return this.requester == null ? new Base[0]
9605            : this.requester.toArray(new Base[this.requester.size()]); // Reference
9606      case -1468032687:
9607        /* requesterLinkId */ return this.requesterLinkId == null ? new Base[0]
9608            : this.requesterLinkId.toArray(new Base[this.requesterLinkId.size()]); // StringType
9609      case -901444568:
9610        /* performerType */ return this.performerType == null ? new Base[0]
9611            : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
9612      case -901513884:
9613        /* performerRole */ return this.performerRole == null ? new Base[0] : new Base[] { this.performerRole }; // CodeableConcept
9614      case 481140686:
9615        /* performer */ return this.performer == null ? new Base[0] : new Base[] { this.performer }; // Reference
9616      case 1051302947:
9617        /* performerLinkId */ return this.performerLinkId == null ? new Base[0]
9618            : this.performerLinkId.toArray(new Base[this.performerLinkId.size()]); // StringType
9619      case 722137681:
9620        /* reasonCode */ return this.reasonCode == null ? new Base[0]
9621            : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
9622      case -1146218137:
9623        /* reasonReference */ return this.reasonReference == null ? new Base[0]
9624            : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
9625      case -934964668:
9626        /* reason */ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // StringType
9627      case -1557963239:
9628        /* reasonLinkId */ return this.reasonLinkId == null ? new Base[0]
9629            : this.reasonLinkId.toArray(new Base[this.reasonLinkId.size()]); // StringType
9630      case 3387378:
9631        /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
9632      case -149460995:
9633        /* securityLabelNumber */ return this.securityLabelNumber == null ? new Base[0]
9634            : this.securityLabelNumber.toArray(new Base[this.securityLabelNumber.size()]); // UnsignedIntType
9635      default:
9636        return super.getProperty(hash, name, checkValid);
9637      }
9638
9639    }
9640
9641    @Override
9642    public Base setProperty(int hash, String name, Base value) throws FHIRException {
9643      switch (hash) {
9644      case -1788508167: // doNotPerform
9645        this.doNotPerform = castToBoolean(value); // BooleanType
9646        return value;
9647      case 3575610: // type
9648        this.type = castToCodeableConcept(value); // CodeableConcept
9649        return value;
9650      case -1867885268: // subject
9651        this.getSubject().add((ActionSubjectComponent) value); // ActionSubjectComponent
9652        return value;
9653      case -1183762788: // intent
9654        this.intent = castToCodeableConcept(value); // CodeableConcept
9655        return value;
9656      case -1102667083: // linkId
9657        this.getLinkId().add(castToString(value)); // StringType
9658        return value;
9659      case -892481550: // status
9660        this.status = castToCodeableConcept(value); // CodeableConcept
9661        return value;
9662      case 951530927: // context
9663        this.context = castToReference(value); // Reference
9664        return value;
9665      case -288783036: // contextLinkId
9666        this.getContextLinkId().add(castToString(value)); // StringType
9667        return value;
9668      case 1687874001: // occurrence
9669        this.occurrence = castToType(value); // Type
9670        return value;
9671      case 693933948: // requester
9672        this.getRequester().add(castToReference(value)); // Reference
9673        return value;
9674      case -1468032687: // requesterLinkId
9675        this.getRequesterLinkId().add(castToString(value)); // StringType
9676        return value;
9677      case -901444568: // performerType
9678        this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
9679        return value;
9680      case -901513884: // performerRole
9681        this.performerRole = castToCodeableConcept(value); // CodeableConcept
9682        return value;
9683      case 481140686: // performer
9684        this.performer = castToReference(value); // Reference
9685        return value;
9686      case 1051302947: // performerLinkId
9687        this.getPerformerLinkId().add(castToString(value)); // StringType
9688        return value;
9689      case 722137681: // reasonCode
9690        this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
9691        return value;
9692      case -1146218137: // reasonReference
9693        this.getReasonReference().add(castToReference(value)); // Reference
9694        return value;
9695      case -934964668: // reason
9696        this.getReason().add(castToString(value)); // StringType
9697        return value;
9698      case -1557963239: // reasonLinkId
9699        this.getReasonLinkId().add(castToString(value)); // StringType
9700        return value;
9701      case 3387378: // note
9702        this.getNote().add(castToAnnotation(value)); // Annotation
9703        return value;
9704      case -149460995: // securityLabelNumber
9705        this.getSecurityLabelNumber().add(castToUnsignedInt(value)); // UnsignedIntType
9706        return value;
9707      default:
9708        return super.setProperty(hash, name, value);
9709      }
9710
9711    }
9712
9713    @Override
9714    public Base setProperty(String name, Base value) throws FHIRException {
9715      if (name.equals("doNotPerform")) {
9716        this.doNotPerform = castToBoolean(value); // BooleanType
9717      } else if (name.equals("type")) {
9718        this.type = castToCodeableConcept(value); // CodeableConcept
9719      } else if (name.equals("subject")) {
9720        this.getSubject().add((ActionSubjectComponent) value);
9721      } else if (name.equals("intent")) {
9722        this.intent = castToCodeableConcept(value); // CodeableConcept
9723      } else if (name.equals("linkId")) {
9724        this.getLinkId().add(castToString(value));
9725      } else if (name.equals("status")) {
9726        this.status = castToCodeableConcept(value); // CodeableConcept
9727      } else if (name.equals("context")) {
9728        this.context = castToReference(value); // Reference
9729      } else if (name.equals("contextLinkId")) {
9730        this.getContextLinkId().add(castToString(value));
9731      } else if (name.equals("occurrence[x]")) {
9732        this.occurrence = castToType(value); // Type
9733      } else if (name.equals("requester")) {
9734        this.getRequester().add(castToReference(value));
9735      } else if (name.equals("requesterLinkId")) {
9736        this.getRequesterLinkId().add(castToString(value));
9737      } else if (name.equals("performerType")) {
9738        this.getPerformerType().add(castToCodeableConcept(value));
9739      } else if (name.equals("performerRole")) {
9740        this.performerRole = castToCodeableConcept(value); // CodeableConcept
9741      } else if (name.equals("performer")) {
9742        this.performer = castToReference(value); // Reference
9743      } else if (name.equals("performerLinkId")) {
9744        this.getPerformerLinkId().add(castToString(value));
9745      } else if (name.equals("reasonCode")) {
9746        this.getReasonCode().add(castToCodeableConcept(value));
9747      } else if (name.equals("reasonReference")) {
9748        this.getReasonReference().add(castToReference(value));
9749      } else if (name.equals("reason")) {
9750        this.getReason().add(castToString(value));
9751      } else if (name.equals("reasonLinkId")) {
9752        this.getReasonLinkId().add(castToString(value));
9753      } else if (name.equals("note")) {
9754        this.getNote().add(castToAnnotation(value));
9755      } else if (name.equals("securityLabelNumber")) {
9756        this.getSecurityLabelNumber().add(castToUnsignedInt(value));
9757      } else
9758        return super.setProperty(name, value);
9759      return value;
9760    }
9761
9762  @Override
9763  public void removeChild(String name, Base value) throws FHIRException {
9764      if (name.equals("doNotPerform")) {
9765        this.doNotPerform = null;
9766      } else if (name.equals("type")) {
9767        this.type = null;
9768      } else if (name.equals("subject")) {
9769        this.getSubject().remove((ActionSubjectComponent) value);
9770      } else if (name.equals("intent")) {
9771        this.intent = null;
9772      } else if (name.equals("linkId")) {
9773        this.getLinkId().remove(castToString(value));
9774      } else if (name.equals("status")) {
9775        this.status = null;
9776      } else if (name.equals("context")) {
9777        this.context = null;
9778      } else if (name.equals("contextLinkId")) {
9779        this.getContextLinkId().remove(castToString(value));
9780      } else if (name.equals("occurrence[x]")) {
9781        this.occurrence = null;
9782      } else if (name.equals("requester")) {
9783        this.getRequester().remove(castToReference(value));
9784      } else if (name.equals("requesterLinkId")) {
9785        this.getRequesterLinkId().remove(castToString(value));
9786      } else if (name.equals("performerType")) {
9787        this.getPerformerType().remove(castToCodeableConcept(value));
9788      } else if (name.equals("performerRole")) {
9789        this.performerRole = null;
9790      } else if (name.equals("performer")) {
9791        this.performer = null;
9792      } else if (name.equals("performerLinkId")) {
9793        this.getPerformerLinkId().remove(castToString(value));
9794      } else if (name.equals("reasonCode")) {
9795        this.getReasonCode().remove(castToCodeableConcept(value));
9796      } else if (name.equals("reasonReference")) {
9797        this.getReasonReference().remove(castToReference(value));
9798      } else if (name.equals("reason")) {
9799        this.getReason().remove(castToString(value));
9800      } else if (name.equals("reasonLinkId")) {
9801        this.getReasonLinkId().remove(castToString(value));
9802      } else if (name.equals("note")) {
9803        this.getNote().remove(castToAnnotation(value));
9804      } else if (name.equals("securityLabelNumber")) {
9805        this.getSecurityLabelNumber().remove(castToUnsignedInt(value));
9806      } else
9807        super.removeChild(name, value);
9808      
9809    }
9810
9811    @Override
9812    public Base makeProperty(int hash, String name) throws FHIRException {
9813      switch (hash) {
9814      case -1788508167:
9815        return getDoNotPerformElement();
9816      case 3575610:
9817        return getType();
9818      case -1867885268:
9819        return addSubject();
9820      case -1183762788:
9821        return getIntent();
9822      case -1102667083:
9823        return addLinkIdElement();
9824      case -892481550:
9825        return getStatus();
9826      case 951530927:
9827        return getContext();
9828      case -288783036:
9829        return addContextLinkIdElement();
9830      case -2022646513:
9831        return getOccurrence();
9832      case 1687874001:
9833        return getOccurrence();
9834      case 693933948:
9835        return addRequester();
9836      case -1468032687:
9837        return addRequesterLinkIdElement();
9838      case -901444568:
9839        return addPerformerType();
9840      case -901513884:
9841        return getPerformerRole();
9842      case 481140686:
9843        return getPerformer();
9844      case 1051302947:
9845        return addPerformerLinkIdElement();
9846      case 722137681:
9847        return addReasonCode();
9848      case -1146218137:
9849        return addReasonReference();
9850      case -934964668:
9851        return addReasonElement();
9852      case -1557963239:
9853        return addReasonLinkIdElement();
9854      case 3387378:
9855        return addNote();
9856      case -149460995:
9857        return addSecurityLabelNumberElement();
9858      default:
9859        return super.makeProperty(hash, name);
9860      }
9861
9862    }
9863
9864    @Override
9865    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9866      switch (hash) {
9867      case -1788508167:
9868        /* doNotPerform */ return new String[] { "boolean" };
9869      case 3575610:
9870        /* type */ return new String[] { "CodeableConcept" };
9871      case -1867885268:
9872        /* subject */ return new String[] {};
9873      case -1183762788:
9874        /* intent */ return new String[] { "CodeableConcept" };
9875      case -1102667083:
9876        /* linkId */ return new String[] { "string" };
9877      case -892481550:
9878        /* status */ return new String[] { "CodeableConcept" };
9879      case 951530927:
9880        /* context */ return new String[] { "Reference" };
9881      case -288783036:
9882        /* contextLinkId */ return new String[] { "string" };
9883      case 1687874001:
9884        /* occurrence */ return new String[] { "dateTime", "Period", "Timing" };
9885      case 693933948:
9886        /* requester */ return new String[] { "Reference" };
9887      case -1468032687:
9888        /* requesterLinkId */ return new String[] { "string" };
9889      case -901444568:
9890        /* performerType */ return new String[] { "CodeableConcept" };
9891      case -901513884:
9892        /* performerRole */ return new String[] { "CodeableConcept" };
9893      case 481140686:
9894        /* performer */ return new String[] { "Reference" };
9895      case 1051302947:
9896        /* performerLinkId */ return new String[] { "string" };
9897      case 722137681:
9898        /* reasonCode */ return new String[] { "CodeableConcept" };
9899      case -1146218137:
9900        /* reasonReference */ return new String[] { "Reference" };
9901      case -934964668:
9902        /* reason */ return new String[] { "string" };
9903      case -1557963239:
9904        /* reasonLinkId */ return new String[] { "string" };
9905      case 3387378:
9906        /* note */ return new String[] { "Annotation" };
9907      case -149460995:
9908        /* securityLabelNumber */ return new String[] { "unsignedInt" };
9909      default:
9910        return super.getTypesForProperty(hash, name);
9911      }
9912
9913    }
9914
9915    @Override
9916    public Base addChild(String name) throws FHIRException {
9917      if (name.equals("doNotPerform")) {
9918        throw new FHIRException("Cannot call addChild on a singleton property Contract.doNotPerform");
9919      } else if (name.equals("type")) {
9920        this.type = new CodeableConcept();
9921        return this.type;
9922      } else if (name.equals("subject")) {
9923        return addSubject();
9924      } else if (name.equals("intent")) {
9925        this.intent = new CodeableConcept();
9926        return this.intent;
9927      } else if (name.equals("linkId")) {
9928        throw new FHIRException("Cannot call addChild on a singleton property Contract.linkId");
9929      } else if (name.equals("status")) {
9930        this.status = new CodeableConcept();
9931        return this.status;
9932      } else if (name.equals("context")) {
9933        this.context = new Reference();
9934        return this.context;
9935      } else if (name.equals("contextLinkId")) {
9936        throw new FHIRException("Cannot call addChild on a singleton property Contract.contextLinkId");
9937      } else if (name.equals("occurrenceDateTime")) {
9938        this.occurrence = new DateTimeType();
9939        return this.occurrence;
9940      } else if (name.equals("occurrencePeriod")) {
9941        this.occurrence = new Period();
9942        return this.occurrence;
9943      } else if (name.equals("occurrenceTiming")) {
9944        this.occurrence = new Timing();
9945        return this.occurrence;
9946      } else if (name.equals("requester")) {
9947        return addRequester();
9948      } else if (name.equals("requesterLinkId")) {
9949        throw new FHIRException("Cannot call addChild on a singleton property Contract.requesterLinkId");
9950      } else if (name.equals("performerType")) {
9951        return addPerformerType();
9952      } else if (name.equals("performerRole")) {
9953        this.performerRole = new CodeableConcept();
9954        return this.performerRole;
9955      } else if (name.equals("performer")) {
9956        this.performer = new Reference();
9957        return this.performer;
9958      } else if (name.equals("performerLinkId")) {
9959        throw new FHIRException("Cannot call addChild on a singleton property Contract.performerLinkId");
9960      } else if (name.equals("reasonCode")) {
9961        return addReasonCode();
9962      } else if (name.equals("reasonReference")) {
9963        return addReasonReference();
9964      } else if (name.equals("reason")) {
9965        throw new FHIRException("Cannot call addChild on a singleton property Contract.reason");
9966      } else if (name.equals("reasonLinkId")) {
9967        throw new FHIRException("Cannot call addChild on a singleton property Contract.reasonLinkId");
9968      } else if (name.equals("note")) {
9969        return addNote();
9970      } else if (name.equals("securityLabelNumber")) {
9971        throw new FHIRException("Cannot call addChild on a singleton property Contract.securityLabelNumber");
9972      } else
9973        return super.addChild(name);
9974    }
9975
9976    public ActionComponent copy() {
9977      ActionComponent dst = new ActionComponent();
9978      copyValues(dst);
9979      return dst;
9980    }
9981
9982    public void copyValues(ActionComponent dst) {
9983      super.copyValues(dst);
9984      dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
9985      dst.type = type == null ? null : type.copy();
9986      if (subject != null) {
9987        dst.subject = new ArrayList<ActionSubjectComponent>();
9988        for (ActionSubjectComponent i : subject)
9989          dst.subject.add(i.copy());
9990      }
9991      ;
9992      dst.intent = intent == null ? null : intent.copy();
9993      if (linkId != null) {
9994        dst.linkId = new ArrayList<StringType>();
9995        for (StringType i : linkId)
9996          dst.linkId.add(i.copy());
9997      }
9998      ;
9999      dst.status = status == null ? null : status.copy();
10000      dst.context = context == null ? null : context.copy();
10001      if (contextLinkId != null) {
10002        dst.contextLinkId = new ArrayList<StringType>();
10003        for (StringType i : contextLinkId)
10004          dst.contextLinkId.add(i.copy());
10005      }
10006      ;
10007      dst.occurrence = occurrence == null ? null : occurrence.copy();
10008      if (requester != null) {
10009        dst.requester = new ArrayList<Reference>();
10010        for (Reference i : requester)
10011          dst.requester.add(i.copy());
10012      }
10013      ;
10014      if (requesterLinkId != null) {
10015        dst.requesterLinkId = new ArrayList<StringType>();
10016        for (StringType i : requesterLinkId)
10017          dst.requesterLinkId.add(i.copy());
10018      }
10019      ;
10020      if (performerType != null) {
10021        dst.performerType = new ArrayList<CodeableConcept>();
10022        for (CodeableConcept i : performerType)
10023          dst.performerType.add(i.copy());
10024      }
10025      ;
10026      dst.performerRole = performerRole == null ? null : performerRole.copy();
10027      dst.performer = performer == null ? null : performer.copy();
10028      if (performerLinkId != null) {
10029        dst.performerLinkId = new ArrayList<StringType>();
10030        for (StringType i : performerLinkId)
10031          dst.performerLinkId.add(i.copy());
10032      }
10033      ;
10034      if (reasonCode != null) {
10035        dst.reasonCode = new ArrayList<CodeableConcept>();
10036        for (CodeableConcept i : reasonCode)
10037          dst.reasonCode.add(i.copy());
10038      }
10039      ;
10040      if (reasonReference != null) {
10041        dst.reasonReference = new ArrayList<Reference>();
10042        for (Reference i : reasonReference)
10043          dst.reasonReference.add(i.copy());
10044      }
10045      ;
10046      if (reason != null) {
10047        dst.reason = new ArrayList<StringType>();
10048        for (StringType i : reason)
10049          dst.reason.add(i.copy());
10050      }
10051      ;
10052      if (reasonLinkId != null) {
10053        dst.reasonLinkId = new ArrayList<StringType>();
10054        for (StringType i : reasonLinkId)
10055          dst.reasonLinkId.add(i.copy());
10056      }
10057      ;
10058      if (note != null) {
10059        dst.note = new ArrayList<Annotation>();
10060        for (Annotation i : note)
10061          dst.note.add(i.copy());
10062      }
10063      ;
10064      if (securityLabelNumber != null) {
10065        dst.securityLabelNumber = new ArrayList<UnsignedIntType>();
10066        for (UnsignedIntType i : securityLabelNumber)
10067          dst.securityLabelNumber.add(i.copy());
10068      }
10069      ;
10070    }
10071
10072    @Override
10073    public boolean equalsDeep(Base other_) {
10074      if (!super.equalsDeep(other_))
10075        return false;
10076      if (!(other_ instanceof ActionComponent))
10077        return false;
10078      ActionComponent o = (ActionComponent) other_;
10079      return compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(type, o.type, true)
10080          && compareDeep(subject, o.subject, true) && compareDeep(intent, o.intent, true)
10081          && compareDeep(linkId, o.linkId, true) && compareDeep(status, o.status, true)
10082          && compareDeep(context, o.context, true) && compareDeep(contextLinkId, o.contextLinkId, true)
10083          && compareDeep(occurrence, o.occurrence, true) && compareDeep(requester, o.requester, true)
10084          && compareDeep(requesterLinkId, o.requesterLinkId, true) && compareDeep(performerType, o.performerType, true)
10085          && compareDeep(performerRole, o.performerRole, true) && compareDeep(performer, o.performer, true)
10086          && compareDeep(performerLinkId, o.performerLinkId, true) && compareDeep(reasonCode, o.reasonCode, true)
10087          && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(reason, o.reason, true)
10088          && compareDeep(reasonLinkId, o.reasonLinkId, true) && compareDeep(note, o.note, true)
10089          && compareDeep(securityLabelNumber, o.securityLabelNumber, true);
10090    }
10091
10092    @Override
10093    public boolean equalsShallow(Base other_) {
10094      if (!super.equalsShallow(other_))
10095        return false;
10096      if (!(other_ instanceof ActionComponent))
10097        return false;
10098      ActionComponent o = (ActionComponent) other_;
10099      return compareValues(doNotPerform, o.doNotPerform, true) && compareValues(linkId, o.linkId, true)
10100          && compareValues(contextLinkId, o.contextLinkId, true)
10101          && compareValues(requesterLinkId, o.requesterLinkId, true)
10102          && compareValues(performerLinkId, o.performerLinkId, true) && compareValues(reason, o.reason, true)
10103          && compareValues(reasonLinkId, o.reasonLinkId, true)
10104          && compareValues(securityLabelNumber, o.securityLabelNumber, true);
10105    }
10106
10107    public boolean isEmpty() {
10108      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(doNotPerform, type, subject, intent, linkId,
10109          status, context, contextLinkId, occurrence, requester, requesterLinkId, performerType, performerRole,
10110          performer, performerLinkId, reasonCode, reasonReference, reason, reasonLinkId, note, securityLabelNumber);
10111    }
10112
10113    public String fhirType() {
10114      return "Contract.term.action";
10115
10116    }
10117
10118  }
10119
10120  @Block()
10121  public static class ActionSubjectComponent extends BackboneElement implements IBaseBackboneElement {
10122    /**
10123     * The entity the action is performed or not performed on or for.
10124     */
10125    @Child(name = "reference", type = { Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class,
10126        Device.class, Group.class,
10127        Organization.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10128    @Description(shortDefinition = "Entity of the action", formalDefinition = "The entity the action is performed or not performed on or for.")
10129    protected List<Reference> reference;
10130    /**
10131     * The actual objects that are the target of the reference (The entity the
10132     * action is performed or not performed on or for.)
10133     */
10134    protected List<Resource> referenceTarget;
10135
10136    /**
10137     * Role type of agent assigned roles in this Contract.
10138     */
10139    @Child(name = "role", type = {
10140        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
10141    @Description(shortDefinition = "Role type of the agent", formalDefinition = "Role type of agent assigned roles in this Contract.")
10142    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-actorrole")
10143    protected CodeableConcept role;
10144
10145    private static final long serialVersionUID = 128949255L;
10146
10147    /**
10148     * Constructor
10149     */
10150    public ActionSubjectComponent() {
10151      super();
10152    }
10153
10154    /**
10155     * @return {@link #reference} (The entity the action is performed or not
10156     *         performed on or for.)
10157     */
10158    public List<Reference> getReference() {
10159      if (this.reference == null)
10160        this.reference = new ArrayList<Reference>();
10161      return this.reference;
10162    }
10163
10164    /**
10165     * @return Returns a reference to <code>this</code> for easy method chaining
10166     */
10167    public ActionSubjectComponent setReference(List<Reference> theReference) {
10168      this.reference = theReference;
10169      return this;
10170    }
10171
10172    public boolean hasReference() {
10173      if (this.reference == null)
10174        return false;
10175      for (Reference item : this.reference)
10176        if (!item.isEmpty())
10177          return true;
10178      return false;
10179    }
10180
10181    public Reference addReference() { // 3
10182      Reference t = new Reference();
10183      if (this.reference == null)
10184        this.reference = new ArrayList<Reference>();
10185      this.reference.add(t);
10186      return t;
10187    }
10188
10189    public ActionSubjectComponent addReference(Reference t) { // 3
10190      if (t == null)
10191        return this;
10192      if (this.reference == null)
10193        this.reference = new ArrayList<Reference>();
10194      this.reference.add(t);
10195      return this;
10196    }
10197
10198    /**
10199     * @return The first repetition of repeating field {@link #reference}, creating
10200     *         it if it does not already exist
10201     */
10202    public Reference getReferenceFirstRep() {
10203      if (getReference().isEmpty()) {
10204        addReference();
10205      }
10206      return getReference().get(0);
10207    }
10208
10209    /**
10210     * @deprecated Use Reference#setResource(IBaseResource) instead
10211     */
10212    @Deprecated
10213    public List<Resource> getReferenceTarget() {
10214      if (this.referenceTarget == null)
10215        this.referenceTarget = new ArrayList<Resource>();
10216      return this.referenceTarget;
10217    }
10218
10219    /**
10220     * @return {@link #role} (Role type of agent assigned roles in this Contract.)
10221     */
10222    public CodeableConcept getRole() {
10223      if (this.role == null)
10224        if (Configuration.errorOnAutoCreate())
10225          throw new Error("Attempt to auto-create ActionSubjectComponent.role");
10226        else if (Configuration.doAutoCreate())
10227          this.role = new CodeableConcept(); // cc
10228      return this.role;
10229    }
10230
10231    public boolean hasRole() {
10232      return this.role != null && !this.role.isEmpty();
10233    }
10234
10235    /**
10236     * @param value {@link #role} (Role type of agent assigned roles in this
10237     *              Contract.)
10238     */
10239    public ActionSubjectComponent setRole(CodeableConcept value) {
10240      this.role = value;
10241      return this;
10242    }
10243
10244    protected void listChildren(List<Property> children) {
10245      super.listChildren(children);
10246      children.add(new Property("reference",
10247          "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
10248          "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE, reference));
10249      children.add(
10250          new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.", 0, 1, role));
10251    }
10252
10253    @Override
10254    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10255      switch (_hash) {
10256      case -925155509:
10257        /* reference */ return new Property("reference",
10258            "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Device|Group|Organization)",
10259            "The entity the action is performed or not performed on or for.", 0, java.lang.Integer.MAX_VALUE,
10260            reference);
10261      case 3506294:
10262        /* role */ return new Property("role", "CodeableConcept", "Role type of agent assigned roles in this Contract.",
10263            0, 1, role);
10264      default:
10265        return super.getNamedProperty(_hash, _name, _checkValid);
10266      }
10267
10268    }
10269
10270    @Override
10271    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10272      switch (hash) {
10273      case -925155509:
10274        /* reference */ return this.reference == null ? new Base[0]
10275            : this.reference.toArray(new Base[this.reference.size()]); // Reference
10276      case 3506294:
10277        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
10278      default:
10279        return super.getProperty(hash, name, checkValid);
10280      }
10281
10282    }
10283
10284    @Override
10285    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10286      switch (hash) {
10287      case -925155509: // reference
10288        this.getReference().add(castToReference(value)); // Reference
10289        return value;
10290      case 3506294: // role
10291        this.role = castToCodeableConcept(value); // CodeableConcept
10292        return value;
10293      default:
10294        return super.setProperty(hash, name, value);
10295      }
10296
10297    }
10298
10299    @Override
10300    public Base setProperty(String name, Base value) throws FHIRException {
10301      if (name.equals("reference")) {
10302        this.getReference().add(castToReference(value));
10303      } else if (name.equals("role")) {
10304        this.role = castToCodeableConcept(value); // CodeableConcept
10305      } else
10306        return super.setProperty(name, value);
10307      return value;
10308    }
10309
10310  @Override
10311  public void removeChild(String name, Base value) throws FHIRException {
10312      if (name.equals("reference")) {
10313        this.getReference().remove(castToReference(value));
10314      } else if (name.equals("role")) {
10315        this.role = null;
10316      } else
10317        super.removeChild(name, value);
10318      
10319    }
10320
10321    @Override
10322    public Base makeProperty(int hash, String name) throws FHIRException {
10323      switch (hash) {
10324      case -925155509:
10325        return addReference();
10326      case 3506294:
10327        return getRole();
10328      default:
10329        return super.makeProperty(hash, name);
10330      }
10331
10332    }
10333
10334    @Override
10335    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10336      switch (hash) {
10337      case -925155509:
10338        /* reference */ return new String[] { "Reference" };
10339      case 3506294:
10340        /* role */ return new String[] { "CodeableConcept" };
10341      default:
10342        return super.getTypesForProperty(hash, name);
10343      }
10344
10345    }
10346
10347    @Override
10348    public Base addChild(String name) throws FHIRException {
10349      if (name.equals("reference")) {
10350        return addReference();
10351      } else if (name.equals("role")) {
10352        this.role = new CodeableConcept();
10353        return this.role;
10354      } else
10355        return super.addChild(name);
10356    }
10357
10358    public ActionSubjectComponent copy() {
10359      ActionSubjectComponent dst = new ActionSubjectComponent();
10360      copyValues(dst);
10361      return dst;
10362    }
10363
10364    public void copyValues(ActionSubjectComponent dst) {
10365      super.copyValues(dst);
10366      if (reference != null) {
10367        dst.reference = new ArrayList<Reference>();
10368        for (Reference i : reference)
10369          dst.reference.add(i.copy());
10370      }
10371      ;
10372      dst.role = role == null ? null : role.copy();
10373    }
10374
10375    @Override
10376    public boolean equalsDeep(Base other_) {
10377      if (!super.equalsDeep(other_))
10378        return false;
10379      if (!(other_ instanceof ActionSubjectComponent))
10380        return false;
10381      ActionSubjectComponent o = (ActionSubjectComponent) other_;
10382      return compareDeep(reference, o.reference, true) && compareDeep(role, o.role, true);
10383    }
10384
10385    @Override
10386    public boolean equalsShallow(Base other_) {
10387      if (!super.equalsShallow(other_))
10388        return false;
10389      if (!(other_ instanceof ActionSubjectComponent))
10390        return false;
10391      ActionSubjectComponent o = (ActionSubjectComponent) other_;
10392      return true;
10393    }
10394
10395    public boolean isEmpty() {
10396      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, role);
10397    }
10398
10399    public String fhirType() {
10400      return "Contract.term.action.subject";
10401
10402    }
10403
10404  }
10405
10406  @Block()
10407  public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
10408    /**
10409     * Role of this Contract signer, e.g. notary, grantee.
10410     */
10411    @Child(name = "type", type = { Coding.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10412    @Description(shortDefinition = "Contract Signatory Role", formalDefinition = "Role of this Contract signer, e.g. notary, grantee.")
10413    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-signer-type")
10414    protected Coding type;
10415
10416    /**
10417     * Party which is a signator to this Contract.
10418     */
10419    @Child(name = "party", type = { Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
10420        RelatedPerson.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
10421    @Description(shortDefinition = "Contract Signatory Party", formalDefinition = "Party which is a signator to this Contract.")
10422    protected Reference party;
10423
10424    /**
10425     * The actual object that is the target of the reference (Party which is a
10426     * signator to this Contract.)
10427     */
10428    protected Resource partyTarget;
10429
10430    /**
10431     * Legally binding Contract DSIG signature contents in Base64.
10432     */
10433    @Child(name = "signature", type = {
10434        Signature.class }, order = 3, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10435    @Description(shortDefinition = "Contract Documentation Signature", formalDefinition = "Legally binding Contract DSIG signature contents in Base64.")
10436    protected List<Signature> signature;
10437
10438    private static final long serialVersionUID = 1948139228L;
10439
10440    /**
10441     * Constructor
10442     */
10443    public SignatoryComponent() {
10444      super();
10445    }
10446
10447    /**
10448     * Constructor
10449     */
10450    public SignatoryComponent(Coding type, Reference party) {
10451      super();
10452      this.type = type;
10453      this.party = party;
10454    }
10455
10456    /**
10457     * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
10458     */
10459    public Coding getType() {
10460      if (this.type == null)
10461        if (Configuration.errorOnAutoCreate())
10462          throw new Error("Attempt to auto-create SignatoryComponent.type");
10463        else if (Configuration.doAutoCreate())
10464          this.type = new Coding(); // cc
10465      return this.type;
10466    }
10467
10468    public boolean hasType() {
10469      return this.type != null && !this.type.isEmpty();
10470    }
10471
10472    /**
10473     * @param value {@link #type} (Role of this Contract signer, e.g. notary,
10474     *              grantee.)
10475     */
10476    public SignatoryComponent setType(Coding value) {
10477      this.type = value;
10478      return this;
10479    }
10480
10481    /**
10482     * @return {@link #party} (Party which is a signator to this Contract.)
10483     */
10484    public Reference getParty() {
10485      if (this.party == null)
10486        if (Configuration.errorOnAutoCreate())
10487          throw new Error("Attempt to auto-create SignatoryComponent.party");
10488        else if (Configuration.doAutoCreate())
10489          this.party = new Reference(); // cc
10490      return this.party;
10491    }
10492
10493    public boolean hasParty() {
10494      return this.party != null && !this.party.isEmpty();
10495    }
10496
10497    /**
10498     * @param value {@link #party} (Party which is a signator to this Contract.)
10499     */
10500    public SignatoryComponent setParty(Reference value) {
10501      this.party = value;
10502      return this;
10503    }
10504
10505    /**
10506     * @return {@link #party} The actual object that is the target of the reference.
10507     *         The reference library doesn't populate this, but you can use it to
10508     *         hold the resource if you resolve it. (Party which is a signator to
10509     *         this Contract.)
10510     */
10511    public Resource getPartyTarget() {
10512      return this.partyTarget;
10513    }
10514
10515    /**
10516     * @param value {@link #party} The actual object that is the target of the
10517     *              reference. The reference library doesn't use these, but you can
10518     *              use it to hold the resource if you resolve it. (Party which is a
10519     *              signator to this Contract.)
10520     */
10521    public SignatoryComponent setPartyTarget(Resource value) {
10522      this.partyTarget = value;
10523      return this;
10524    }
10525
10526    /**
10527     * @return {@link #signature} (Legally binding Contract DSIG signature contents
10528     *         in Base64.)
10529     */
10530    public List<Signature> getSignature() {
10531      if (this.signature == null)
10532        this.signature = new ArrayList<Signature>();
10533      return this.signature;
10534    }
10535
10536    /**
10537     * @return Returns a reference to <code>this</code> for easy method chaining
10538     */
10539    public SignatoryComponent setSignature(List<Signature> theSignature) {
10540      this.signature = theSignature;
10541      return this;
10542    }
10543
10544    public boolean hasSignature() {
10545      if (this.signature == null)
10546        return false;
10547      for (Signature item : this.signature)
10548        if (!item.isEmpty())
10549          return true;
10550      return false;
10551    }
10552
10553    public Signature addSignature() { // 3
10554      Signature t = new Signature();
10555      if (this.signature == null)
10556        this.signature = new ArrayList<Signature>();
10557      this.signature.add(t);
10558      return t;
10559    }
10560
10561    public SignatoryComponent addSignature(Signature t) { // 3
10562      if (t == null)
10563        return this;
10564      if (this.signature == null)
10565        this.signature = new ArrayList<Signature>();
10566      this.signature.add(t);
10567      return this;
10568    }
10569
10570    /**
10571     * @return The first repetition of repeating field {@link #signature}, creating
10572     *         it if it does not already exist
10573     */
10574    public Signature getSignatureFirstRep() {
10575      if (getSignature().isEmpty()) {
10576        addSignature();
10577      }
10578      return getSignature().get(0);
10579    }
10580
10581    protected void listChildren(List<Property> children) {
10582      super.listChildren(children);
10583      children.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1, type));
10584      children.add(new Property("party", "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
10585          "Party which is a signator to this Contract.", 0, 1, party));
10586      children.add(new Property("signature", "Signature", "Legally binding Contract DSIG signature contents in Base64.",
10587          0, java.lang.Integer.MAX_VALUE, signature));
10588    }
10589
10590    @Override
10591    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10592      switch (_hash) {
10593      case 3575610:
10594        /* type */ return new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, 1,
10595            type);
10596      case 106437350:
10597        /* party */ return new Property("party",
10598            "Reference(Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)",
10599            "Party which is a signator to this Contract.", 0, 1, party);
10600      case 1073584312:
10601        /* signature */ return new Property("signature", "Signature",
10602            "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature);
10603      default:
10604        return super.getNamedProperty(_hash, _name, _checkValid);
10605      }
10606
10607    }
10608
10609    @Override
10610    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10611      switch (hash) {
10612      case 3575610:
10613        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Coding
10614      case 106437350:
10615        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
10616      case 1073584312:
10617        /* signature */ return this.signature == null ? new Base[0]
10618            : this.signature.toArray(new Base[this.signature.size()]); // Signature
10619      default:
10620        return super.getProperty(hash, name, checkValid);
10621      }
10622
10623    }
10624
10625    @Override
10626    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10627      switch (hash) {
10628      case 3575610: // type
10629        this.type = castToCoding(value); // Coding
10630        return value;
10631      case 106437350: // party
10632        this.party = castToReference(value); // Reference
10633        return value;
10634      case 1073584312: // signature
10635        this.getSignature().add(castToSignature(value)); // Signature
10636        return value;
10637      default:
10638        return super.setProperty(hash, name, value);
10639      }
10640
10641    }
10642
10643    @Override
10644    public Base setProperty(String name, Base value) throws FHIRException {
10645      if (name.equals("type")) {
10646        this.type = castToCoding(value); // Coding
10647      } else if (name.equals("party")) {
10648        this.party = castToReference(value); // Reference
10649      } else if (name.equals("signature")) {
10650        this.getSignature().add(castToSignature(value));
10651      } else
10652        return super.setProperty(name, value);
10653      return value;
10654    }
10655
10656  @Override
10657  public void removeChild(String name, Base value) throws FHIRException {
10658      if (name.equals("type")) {
10659        this.type = null;
10660      } else if (name.equals("party")) {
10661        this.party = null;
10662      } else if (name.equals("signature")) {
10663        this.getSignature().remove(castToSignature(value));
10664      } else
10665        super.removeChild(name, value);
10666      
10667    }
10668
10669    @Override
10670    public Base makeProperty(int hash, String name) throws FHIRException {
10671      switch (hash) {
10672      case 3575610:
10673        return getType();
10674      case 106437350:
10675        return getParty();
10676      case 1073584312:
10677        return addSignature();
10678      default:
10679        return super.makeProperty(hash, name);
10680      }
10681
10682    }
10683
10684    @Override
10685    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10686      switch (hash) {
10687      case 3575610:
10688        /* type */ return new String[] { "Coding" };
10689      case 106437350:
10690        /* party */ return new String[] { "Reference" };
10691      case 1073584312:
10692        /* signature */ return new String[] { "Signature" };
10693      default:
10694        return super.getTypesForProperty(hash, name);
10695      }
10696
10697    }
10698
10699    @Override
10700    public Base addChild(String name) throws FHIRException {
10701      if (name.equals("type")) {
10702        this.type = new Coding();
10703        return this.type;
10704      } else if (name.equals("party")) {
10705        this.party = new Reference();
10706        return this.party;
10707      } else if (name.equals("signature")) {
10708        return addSignature();
10709      } else
10710        return super.addChild(name);
10711    }
10712
10713    public SignatoryComponent copy() {
10714      SignatoryComponent dst = new SignatoryComponent();
10715      copyValues(dst);
10716      return dst;
10717    }
10718
10719    public void copyValues(SignatoryComponent dst) {
10720      super.copyValues(dst);
10721      dst.type = type == null ? null : type.copy();
10722      dst.party = party == null ? null : party.copy();
10723      if (signature != null) {
10724        dst.signature = new ArrayList<Signature>();
10725        for (Signature i : signature)
10726          dst.signature.add(i.copy());
10727      }
10728      ;
10729    }
10730
10731    @Override
10732    public boolean equalsDeep(Base other_) {
10733      if (!super.equalsDeep(other_))
10734        return false;
10735      if (!(other_ instanceof SignatoryComponent))
10736        return false;
10737      SignatoryComponent o = (SignatoryComponent) other_;
10738      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true)
10739          && compareDeep(signature, o.signature, true);
10740    }
10741
10742    @Override
10743    public boolean equalsShallow(Base other_) {
10744      if (!super.equalsShallow(other_))
10745        return false;
10746      if (!(other_ instanceof SignatoryComponent))
10747        return false;
10748      SignatoryComponent o = (SignatoryComponent) other_;
10749      return true;
10750    }
10751
10752    public boolean isEmpty() {
10753      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party, signature);
10754    }
10755
10756    public String fhirType() {
10757      return "Contract.signer";
10758
10759    }
10760
10761  }
10762
10763  @Block()
10764  public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
10765    /**
10766     * Human readable rendering of this Contract in a format and representation
10767     * intended to enhance comprehension and ensure understandability.
10768     */
10769    @Child(name = "content", type = { Attachment.class, Composition.class, DocumentReference.class,
10770        QuestionnaireResponse.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10771    @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.")
10772    protected Type content;
10773
10774    private static final long serialVersionUID = -1763459053L;
10775
10776    /**
10777     * Constructor
10778     */
10779    public FriendlyLanguageComponent() {
10780      super();
10781    }
10782
10783    /**
10784     * Constructor
10785     */
10786    public FriendlyLanguageComponent(Type content) {
10787      super();
10788      this.content = content;
10789    }
10790
10791    /**
10792     * @return {@link #content} (Human readable rendering of this Contract in a
10793     *         format and representation intended to enhance comprehension and
10794     *         ensure understandability.)
10795     */
10796    public Type getContent() {
10797      return this.content;
10798    }
10799
10800    /**
10801     * @return {@link #content} (Human readable rendering of this Contract in a
10802     *         format and representation intended to enhance comprehension and
10803     *         ensure understandability.)
10804     */
10805    public Attachment getContentAttachment() throws FHIRException {
10806      if (this.content == null)
10807        this.content = new Attachment();
10808      if (!(this.content instanceof Attachment))
10809        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
10810            + this.content.getClass().getName() + " was encountered");
10811      return (Attachment) this.content;
10812    }
10813
10814    public boolean hasContentAttachment() {
10815      return this != null && this.content instanceof Attachment;
10816    }
10817
10818    /**
10819     * @return {@link #content} (Human readable rendering of this Contract in a
10820     *         format and representation intended to enhance comprehension and
10821     *         ensure understandability.)
10822     */
10823    public Reference getContentReference() throws FHIRException {
10824      if (this.content == null)
10825        this.content = new Reference();
10826      if (!(this.content instanceof Reference))
10827        throw new FHIRException("Type mismatch: the type Reference was expected, but "
10828            + this.content.getClass().getName() + " was encountered");
10829      return (Reference) this.content;
10830    }
10831
10832    public boolean hasContentReference() {
10833      return this != null && this.content instanceof Reference;
10834    }
10835
10836    public boolean hasContent() {
10837      return this.content != null && !this.content.isEmpty();
10838    }
10839
10840    /**
10841     * @param value {@link #content} (Human readable rendering of this Contract in a
10842     *              format and representation intended to enhance comprehension and
10843     *              ensure understandability.)
10844     */
10845    public FriendlyLanguageComponent setContent(Type value) {
10846      if (value != null && !(value instanceof Attachment || value instanceof Reference))
10847        throw new Error("Not the right type for Contract.friendly.content[x]: " + value.fhirType());
10848      this.content = value;
10849      return this;
10850    }
10851
10852    protected void listChildren(List<Property> children) {
10853      super.listChildren(children);
10854      children.add(new Property("content[x]",
10855          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10856          "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10857          0, 1, content));
10858    }
10859
10860    @Override
10861    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10862      switch (_hash) {
10863      case 264548711:
10864        /* content[x] */ return new Property("content[x]",
10865            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10866            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10867            0, 1, content);
10868      case 951530617:
10869        /* content */ return new Property("content[x]",
10870            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10871            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10872            0, 1, content);
10873      case -702028164:
10874        /* contentAttachment */ return new Property("content[x]",
10875            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10876            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10877            0, 1, content);
10878      case 1193747154:
10879        /* contentReference */ return new Property("content[x]",
10880            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
10881            "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.",
10882            0, 1, content);
10883      default:
10884        return super.getNamedProperty(_hash, _name, _checkValid);
10885      }
10886
10887    }
10888
10889    @Override
10890    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10891      switch (hash) {
10892      case 951530617:
10893        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
10894      default:
10895        return super.getProperty(hash, name, checkValid);
10896      }
10897
10898    }
10899
10900    @Override
10901    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10902      switch (hash) {
10903      case 951530617: // content
10904        this.content = castToType(value); // Type
10905        return value;
10906      default:
10907        return super.setProperty(hash, name, value);
10908      }
10909
10910    }
10911
10912    @Override
10913    public Base setProperty(String name, Base value) throws FHIRException {
10914      if (name.equals("content[x]")) {
10915        this.content = castToType(value); // Type
10916      } else
10917        return super.setProperty(name, value);
10918      return value;
10919    }
10920
10921  @Override
10922  public void removeChild(String name, Base value) throws FHIRException {
10923      if (name.equals("content[x]")) {
10924        this.content = null;
10925      } else
10926        super.removeChild(name, value);
10927      
10928    }
10929
10930    @Override
10931    public Base makeProperty(int hash, String name) throws FHIRException {
10932      switch (hash) {
10933      case 264548711:
10934        return getContent();
10935      case 951530617:
10936        return getContent();
10937      default:
10938        return super.makeProperty(hash, name);
10939      }
10940
10941    }
10942
10943    @Override
10944    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10945      switch (hash) {
10946      case 951530617:
10947        /* content */ return new String[] { "Attachment", "Reference" };
10948      default:
10949        return super.getTypesForProperty(hash, name);
10950      }
10951
10952    }
10953
10954    @Override
10955    public Base addChild(String name) throws FHIRException {
10956      if (name.equals("contentAttachment")) {
10957        this.content = new Attachment();
10958        return this.content;
10959      } else if (name.equals("contentReference")) {
10960        this.content = new Reference();
10961        return this.content;
10962      } else
10963        return super.addChild(name);
10964    }
10965
10966    public FriendlyLanguageComponent copy() {
10967      FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
10968      copyValues(dst);
10969      return dst;
10970    }
10971
10972    public void copyValues(FriendlyLanguageComponent dst) {
10973      super.copyValues(dst);
10974      dst.content = content == null ? null : content.copy();
10975    }
10976
10977    @Override
10978    public boolean equalsDeep(Base other_) {
10979      if (!super.equalsDeep(other_))
10980        return false;
10981      if (!(other_ instanceof FriendlyLanguageComponent))
10982        return false;
10983      FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
10984      return compareDeep(content, o.content, true);
10985    }
10986
10987    @Override
10988    public boolean equalsShallow(Base other_) {
10989      if (!super.equalsShallow(other_))
10990        return false;
10991      if (!(other_ instanceof FriendlyLanguageComponent))
10992        return false;
10993      FriendlyLanguageComponent o = (FriendlyLanguageComponent) other_;
10994      return true;
10995    }
10996
10997    public boolean isEmpty() {
10998      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
10999    }
11000
11001    public String fhirType() {
11002      return "Contract.friendly";
11003
11004    }
11005
11006  }
11007
11008  @Block()
11009  public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
11010    /**
11011     * Contract legal text in human renderable form.
11012     */
11013    @Child(name = "content", type = { Attachment.class, Composition.class, DocumentReference.class,
11014        QuestionnaireResponse.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11015    @Description(shortDefinition = "Contract Legal Text", formalDefinition = "Contract legal text in human renderable form.")
11016    protected Type content;
11017
11018    private static final long serialVersionUID = -1763459053L;
11019
11020    /**
11021     * Constructor
11022     */
11023    public LegalLanguageComponent() {
11024      super();
11025    }
11026
11027    /**
11028     * Constructor
11029     */
11030    public LegalLanguageComponent(Type content) {
11031      super();
11032      this.content = content;
11033    }
11034
11035    /**
11036     * @return {@link #content} (Contract legal text in human renderable form.)
11037     */
11038    public Type getContent() {
11039      return this.content;
11040    }
11041
11042    /**
11043     * @return {@link #content} (Contract legal text in human renderable form.)
11044     */
11045    public Attachment getContentAttachment() throws FHIRException {
11046      if (this.content == null)
11047        this.content = new Attachment();
11048      if (!(this.content instanceof Attachment))
11049        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
11050            + this.content.getClass().getName() + " was encountered");
11051      return (Attachment) this.content;
11052    }
11053
11054    public boolean hasContentAttachment() {
11055      return this != null && this.content instanceof Attachment;
11056    }
11057
11058    /**
11059     * @return {@link #content} (Contract legal text in human renderable form.)
11060     */
11061    public Reference getContentReference() throws FHIRException {
11062      if (this.content == null)
11063        this.content = new Reference();
11064      if (!(this.content instanceof Reference))
11065        throw new FHIRException("Type mismatch: the type Reference was expected, but "
11066            + this.content.getClass().getName() + " was encountered");
11067      return (Reference) this.content;
11068    }
11069
11070    public boolean hasContentReference() {
11071      return this != null && this.content instanceof Reference;
11072    }
11073
11074    public boolean hasContent() {
11075      return this.content != null && !this.content.isEmpty();
11076    }
11077
11078    /**
11079     * @param value {@link #content} (Contract legal text in human renderable form.)
11080     */
11081    public LegalLanguageComponent setContent(Type value) {
11082      if (value != null && !(value instanceof Attachment || value instanceof Reference))
11083        throw new Error("Not the right type for Contract.legal.content[x]: " + value.fhirType());
11084      this.content = value;
11085      return this;
11086    }
11087
11088    protected void listChildren(List<Property> children) {
11089      super.listChildren(children);
11090      children
11091          .add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
11092              "Contract legal text in human renderable form.", 0, 1, content));
11093    }
11094
11095    @Override
11096    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11097      switch (_hash) {
11098      case 264548711:
11099        /* content[x] */ return new Property("content[x]",
11100            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
11101            "Contract legal text in human renderable form.", 0, 1, content);
11102      case 951530617:
11103        /* content */ return new Property("content[x]",
11104            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
11105            "Contract legal text in human renderable form.", 0, 1, content);
11106      case -702028164:
11107        /* contentAttachment */ return new Property("content[x]",
11108            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
11109            "Contract legal text in human renderable form.", 0, 1, content);
11110      case 1193747154:
11111        /* contentReference */ return new Property("content[x]",
11112            "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)",
11113            "Contract legal text in human renderable form.", 0, 1, content);
11114      default:
11115        return super.getNamedProperty(_hash, _name, _checkValid);
11116      }
11117
11118    }
11119
11120    @Override
11121    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11122      switch (hash) {
11123      case 951530617:
11124        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
11125      default:
11126        return super.getProperty(hash, name, checkValid);
11127      }
11128
11129    }
11130
11131    @Override
11132    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11133      switch (hash) {
11134      case 951530617: // content
11135        this.content = castToType(value); // Type
11136        return value;
11137      default:
11138        return super.setProperty(hash, name, value);
11139      }
11140
11141    }
11142
11143    @Override
11144    public Base setProperty(String name, Base value) throws FHIRException {
11145      if (name.equals("content[x]")) {
11146        this.content = castToType(value); // Type
11147      } else
11148        return super.setProperty(name, value);
11149      return value;
11150    }
11151
11152  @Override
11153  public void removeChild(String name, Base value) throws FHIRException {
11154      if (name.equals("content[x]")) {
11155        this.content = null;
11156      } else
11157        super.removeChild(name, value);
11158      
11159    }
11160
11161    @Override
11162    public Base makeProperty(int hash, String name) throws FHIRException {
11163      switch (hash) {
11164      case 264548711:
11165        return getContent();
11166      case 951530617:
11167        return getContent();
11168      default:
11169        return super.makeProperty(hash, name);
11170      }
11171
11172    }
11173
11174    @Override
11175    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11176      switch (hash) {
11177      case 951530617:
11178        /* content */ return new String[] { "Attachment", "Reference" };
11179      default:
11180        return super.getTypesForProperty(hash, name);
11181      }
11182
11183    }
11184
11185    @Override
11186    public Base addChild(String name) throws FHIRException {
11187      if (name.equals("contentAttachment")) {
11188        this.content = new Attachment();
11189        return this.content;
11190      } else if (name.equals("contentReference")) {
11191        this.content = new Reference();
11192        return this.content;
11193      } else
11194        return super.addChild(name);
11195    }
11196
11197    public LegalLanguageComponent copy() {
11198      LegalLanguageComponent dst = new LegalLanguageComponent();
11199      copyValues(dst);
11200      return dst;
11201    }
11202
11203    public void copyValues(LegalLanguageComponent dst) {
11204      super.copyValues(dst);
11205      dst.content = content == null ? null : content.copy();
11206    }
11207
11208    @Override
11209    public boolean equalsDeep(Base other_) {
11210      if (!super.equalsDeep(other_))
11211        return false;
11212      if (!(other_ instanceof LegalLanguageComponent))
11213        return false;
11214      LegalLanguageComponent o = (LegalLanguageComponent) other_;
11215      return compareDeep(content, o.content, true);
11216    }
11217
11218    @Override
11219    public boolean equalsShallow(Base other_) {
11220      if (!super.equalsShallow(other_))
11221        return false;
11222      if (!(other_ instanceof LegalLanguageComponent))
11223        return false;
11224      LegalLanguageComponent o = (LegalLanguageComponent) other_;
11225      return true;
11226    }
11227
11228    public boolean isEmpty() {
11229      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
11230    }
11231
11232    public String fhirType() {
11233      return "Contract.legal";
11234
11235    }
11236
11237  }
11238
11239  @Block()
11240  public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
11241    /**
11242     * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL,
11243     * SecPal).
11244     */
11245    @Child(name = "content", type = { Attachment.class,
11246        DocumentReference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11247    @Description(shortDefinition = "Computable Contract Rules", formalDefinition = "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).")
11248    protected Type content;
11249
11250    private static final long serialVersionUID = -1763459053L;
11251
11252    /**
11253     * Constructor
11254     */
11255    public ComputableLanguageComponent() {
11256      super();
11257    }
11258
11259    /**
11260     * Constructor
11261     */
11262    public ComputableLanguageComponent(Type content) {
11263      super();
11264      this.content = content;
11265    }
11266
11267    /**
11268     * @return {@link #content} (Computable Contract conveyed using a policy rule
11269     *         language (e.g. XACML, DKAL, SecPal).)
11270     */
11271    public Type getContent() {
11272      return this.content;
11273    }
11274
11275    /**
11276     * @return {@link #content} (Computable Contract conveyed using a policy rule
11277     *         language (e.g. XACML, DKAL, SecPal).)
11278     */
11279    public Attachment getContentAttachment() throws FHIRException {
11280      if (this.content == null)
11281        this.content = new Attachment();
11282      if (!(this.content instanceof Attachment))
11283        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
11284            + this.content.getClass().getName() + " was encountered");
11285      return (Attachment) this.content;
11286    }
11287
11288    public boolean hasContentAttachment() {
11289      return this != null && this.content instanceof Attachment;
11290    }
11291
11292    /**
11293     * @return {@link #content} (Computable Contract conveyed using a policy rule
11294     *         language (e.g. XACML, DKAL, SecPal).)
11295     */
11296    public Reference getContentReference() throws FHIRException {
11297      if (this.content == null)
11298        this.content = new Reference();
11299      if (!(this.content instanceof Reference))
11300        throw new FHIRException("Type mismatch: the type Reference was expected, but "
11301            + this.content.getClass().getName() + " was encountered");
11302      return (Reference) this.content;
11303    }
11304
11305    public boolean hasContentReference() {
11306      return this != null && this.content instanceof Reference;
11307    }
11308
11309    public boolean hasContent() {
11310      return this.content != null && !this.content.isEmpty();
11311    }
11312
11313    /**
11314     * @param value {@link #content} (Computable Contract conveyed using a policy
11315     *              rule language (e.g. XACML, DKAL, SecPal).)
11316     */
11317    public ComputableLanguageComponent setContent(Type value) {
11318      if (value != null && !(value instanceof Attachment || value instanceof Reference))
11319        throw new Error("Not the right type for Contract.rule.content[x]: " + value.fhirType());
11320      this.content = value;
11321      return this;
11322    }
11323
11324    protected void listChildren(List<Property> children) {
11325      super.listChildren(children);
11326      children.add(new Property("content[x]", "Attachment|Reference(DocumentReference)",
11327          "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content));
11328    }
11329
11330    @Override
11331    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11332      switch (_hash) {
11333      case 264548711:
11334        /* content[x] */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11335            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11336      case 951530617:
11337        /* content */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11338            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11339      case -702028164:
11340        /* contentAttachment */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11341            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11342      case 1193747154:
11343        /* contentReference */ return new Property("content[x]", "Attachment|Reference(DocumentReference)",
11344            "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, 1, content);
11345      default:
11346        return super.getNamedProperty(_hash, _name, _checkValid);
11347      }
11348
11349    }
11350
11351    @Override
11352    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11353      switch (hash) {
11354      case 951530617:
11355        /* content */ return this.content == null ? new Base[0] : new Base[] { this.content }; // Type
11356      default:
11357        return super.getProperty(hash, name, checkValid);
11358      }
11359
11360    }
11361
11362    @Override
11363    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11364      switch (hash) {
11365      case 951530617: // content
11366        this.content = castToType(value); // Type
11367        return value;
11368      default:
11369        return super.setProperty(hash, name, value);
11370      }
11371
11372    }
11373
11374    @Override
11375    public Base setProperty(String name, Base value) throws FHIRException {
11376      if (name.equals("content[x]")) {
11377        this.content = castToType(value); // Type
11378      } else
11379        return super.setProperty(name, value);
11380      return value;
11381    }
11382
11383  @Override
11384  public void removeChild(String name, Base value) throws FHIRException {
11385      if (name.equals("content[x]")) {
11386        this.content = null;
11387      } else
11388        super.removeChild(name, value);
11389      
11390    }
11391
11392    @Override
11393    public Base makeProperty(int hash, String name) throws FHIRException {
11394      switch (hash) {
11395      case 264548711:
11396        return getContent();
11397      case 951530617:
11398        return getContent();
11399      default:
11400        return super.makeProperty(hash, name);
11401      }
11402
11403    }
11404
11405    @Override
11406    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11407      switch (hash) {
11408      case 951530617:
11409        /* content */ return new String[] { "Attachment", "Reference" };
11410      default:
11411        return super.getTypesForProperty(hash, name);
11412      }
11413
11414    }
11415
11416    @Override
11417    public Base addChild(String name) throws FHIRException {
11418      if (name.equals("contentAttachment")) {
11419        this.content = new Attachment();
11420        return this.content;
11421      } else if (name.equals("contentReference")) {
11422        this.content = new Reference();
11423        return this.content;
11424      } else
11425        return super.addChild(name);
11426    }
11427
11428    public ComputableLanguageComponent copy() {
11429      ComputableLanguageComponent dst = new ComputableLanguageComponent();
11430      copyValues(dst);
11431      return dst;
11432    }
11433
11434    public void copyValues(ComputableLanguageComponent dst) {
11435      super.copyValues(dst);
11436      dst.content = content == null ? null : content.copy();
11437    }
11438
11439    @Override
11440    public boolean equalsDeep(Base other_) {
11441      if (!super.equalsDeep(other_))
11442        return false;
11443      if (!(other_ instanceof ComputableLanguageComponent))
11444        return false;
11445      ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
11446      return compareDeep(content, o.content, true);
11447    }
11448
11449    @Override
11450    public boolean equalsShallow(Base other_) {
11451      if (!super.equalsShallow(other_))
11452        return false;
11453      if (!(other_ instanceof ComputableLanguageComponent))
11454        return false;
11455      ComputableLanguageComponent o = (ComputableLanguageComponent) other_;
11456      return true;
11457    }
11458
11459    public boolean isEmpty() {
11460      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(content);
11461    }
11462
11463    public String fhirType() {
11464      return "Contract.rule";
11465
11466    }
11467
11468  }
11469
11470  /**
11471   * Unique identifier for this Contract or a derivative that references a Source
11472   * Contract.
11473   */
11474  @Child(name = "identifier", type = {
11475      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11476  @Description(shortDefinition = "Contract number", formalDefinition = "Unique identifier for this Contract or a derivative that references a Source Contract.")
11477  protected List<Identifier> identifier;
11478
11479  /**
11480   * Canonical identifier for this contract, represented as a URI (globally
11481   * unique).
11482   */
11483  @Child(name = "url", type = { UriType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
11484  @Description(shortDefinition = "Basal definition", formalDefinition = "Canonical identifier for this contract, represented as a URI (globally unique).")
11485  protected UriType url;
11486
11487  /**
11488   * An edition identifier used for business purposes to label business
11489   * significant variants.
11490   */
11491  @Child(name = "version", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
11492  @Description(shortDefinition = "Business edition", formalDefinition = "An edition identifier used for business purposes to label business significant variants.")
11493  protected StringType version;
11494
11495  /**
11496   * The status of the resource instance.
11497   */
11498  @Child(name = "status", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = true, summary = true)
11499  @Description(shortDefinition = "amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated", formalDefinition = "The status of the resource instance.")
11500  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-status")
11501  protected Enumeration<ContractStatus> status;
11502
11503  /**
11504   * Legal states of the formation of a legal instrument, which is a formally
11505   * executed written document that can be formally attributed to its author,
11506   * records and formally expresses a legally enforceable act, process, or
11507   * contractual duty, obligation, or right, and therefore evidences that act,
11508   * process, or agreement.
11509   */
11510  @Child(name = "legalState", type = {
11511      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11512  @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.")
11513  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-legalstate")
11514  protected CodeableConcept legalState;
11515
11516  /**
11517   * The URL pointing to a FHIR-defined Contract Definition that is adhered to in
11518   * whole or part by this Contract.
11519   */
11520  @Child(name = "instantiatesCanonical", type = {
11521      Contract.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11522  @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.")
11523  protected Reference instantiatesCanonical;
11524
11525  /**
11526   * The actual object that is the target of the reference (The URL pointing to a
11527   * FHIR-defined Contract Definition that is adhered to in whole or part by this
11528   * Contract.)
11529   */
11530  protected Contract instantiatesCanonicalTarget;
11531
11532  /**
11533   * The URL pointing to an externally maintained definition that is adhered to in
11534   * whole or in part by this Contract.
11535   */
11536  @Child(name = "instantiatesUri", type = {
11537      UriType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11538  @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.")
11539  protected UriType instantiatesUri;
11540
11541  /**
11542   * The minimal content derived from the basal information source at a specific
11543   * stage in its lifecycle.
11544   */
11545  @Child(name = "contentDerivative", type = {
11546      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
11547  @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.")
11548  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-content-derivative")
11549  protected CodeableConcept contentDerivative;
11550
11551  /**
11552   * When this Contract was issued.
11553   */
11554  @Child(name = "issued", type = { DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
11555  @Description(shortDefinition = "When this Contract was issued", formalDefinition = "When this  Contract was issued.")
11556  protected DateTimeType issued;
11557
11558  /**
11559   * Relevant time or time-period when this Contract is applicable.
11560   */
11561  @Child(name = "applies", type = { Period.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
11562  @Description(shortDefinition = "Effective time", formalDefinition = "Relevant time or time-period when this Contract is applicable.")
11563  protected Period applies;
11564
11565  /**
11566   * Event resulting in discontinuation or termination of this Contract instance
11567   * by one or more parties to the contract.
11568   */
11569  @Child(name = "expirationType", type = {
11570      CodeableConcept.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
11571  @Description(shortDefinition = "Contract cessation cause", formalDefinition = "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.")
11572  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-expiration-type")
11573  protected CodeableConcept expirationType;
11574
11575  /**
11576   * The target entity impacted by or of interest to parties to the agreement.
11577   */
11578  @Child(name = "subject", type = {
11579      Reference.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11580  @Description(shortDefinition = "Contract Target Entity", formalDefinition = "The target entity impacted by or of interest to parties to the agreement.")
11581  protected List<Reference> subject;
11582  /**
11583   * The actual objects that are the target of the reference (The target entity
11584   * impacted by or of interest to parties to the agreement.)
11585   */
11586  protected List<Resource> subjectTarget;
11587
11588  /**
11589   * A formally or informally recognized grouping of people, principals,
11590   * organizations, or jurisdictions formed for the purpose of achieving some form
11591   * of collective action such as the promulgation, administration and enforcement
11592   * of contracts and policies.
11593   */
11594  @Child(name = "authority", type = {
11595      Organization.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11596  @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.")
11597  protected List<Reference> authority;
11598  /**
11599   * The actual objects that are the target of the reference (A formally or
11600   * informally recognized grouping of people, principals, organizations, or
11601   * jurisdictions formed for the purpose of achieving some form of collective
11602   * action such as the promulgation, administration and enforcement of contracts
11603   * and policies.)
11604   */
11605  protected List<Organization> authorityTarget;
11606
11607  /**
11608   * Recognized governance framework or system operating with a circumscribed
11609   * scope in accordance with specified principles, policies, processes or
11610   * procedures for managing rights, actions, or behaviors of parties or
11611   * principals relative to resources.
11612   */
11613  @Child(name = "domain", type = {
11614      Location.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11615  @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.")
11616  protected List<Reference> domain;
11617  /**
11618   * The actual objects that are the target of the reference (Recognized
11619   * governance framework or system operating with a circumscribed scope in
11620   * accordance with specified principles, policies, processes or procedures for
11621   * managing rights, actions, or behaviors of parties or principals relative to
11622   * resources.)
11623   */
11624  protected List<Location> domainTarget;
11625
11626  /**
11627   * Sites in which the contract is complied with, exercised, or in force.
11628   */
11629  @Child(name = "site", type = {
11630      Location.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11631  @Description(shortDefinition = "Specific Location", formalDefinition = "Sites in which the contract is complied with,  exercised, or in force.")
11632  protected List<Reference> site;
11633  /**
11634   * The actual objects that are the target of the reference (Sites in which the
11635   * contract is complied with, exercised, or in force.)
11636   */
11637  protected List<Location> siteTarget;
11638
11639  /**
11640   * A natural language name identifying this Contract definition, derivative, or
11641   * instance in any legal state. Provides additional information about its
11642   * content. This name should be usable as an identifier for the module by
11643   * machine processing applications such as code generation.
11644   */
11645  @Child(name = "name", type = { StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = true)
11646  @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.")
11647  protected StringType name;
11648
11649  /**
11650   * A short, descriptive, user-friendly title for this Contract definition,
11651   * derivative, or instance in any legal state.t giving additional information
11652   * about its content.
11653   */
11654  @Child(name = "title", type = { StringType.class }, order = 16, min = 0, max = 1, modifier = false, summary = true)
11655  @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.")
11656  protected StringType title;
11657
11658  /**
11659   * An explanatory or alternate user-friendly title for this Contract definition,
11660   * derivative, or instance in any legal state.t giving additional information
11661   * about its content.
11662   */
11663  @Child(name = "subtitle", type = {
11664      StringType.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
11665  @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.")
11666  protected StringType subtitle;
11667
11668  /**
11669   * Alternative representation of the title for this Contract definition,
11670   * derivative, or instance in any legal state., e.g., a domain specific contract
11671   * number related to legislation.
11672   */
11673  @Child(name = "alias", type = {
11674      StringType.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11675  @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.")
11676  protected List<StringType> alias;
11677
11678  /**
11679   * The individual or organization that authored the Contract definition,
11680   * derivative, or instance in any legal state.
11681   */
11682  @Child(name = "author", type = { Patient.class, Practitioner.class, PractitionerRole.class,
11683      Organization.class }, order = 19, min = 0, max = 1, modifier = false, summary = false)
11684  @Description(shortDefinition = "Source of Contract", formalDefinition = "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.")
11685  protected Reference author;
11686
11687  /**
11688   * The actual object that is the target of the reference (The individual or
11689   * organization that authored the Contract definition, derivative, or instance
11690   * in any legal state.)
11691   */
11692  protected Resource authorTarget;
11693
11694  /**
11695   * A selector of legal concerns for this Contract definition, derivative, or
11696   * instance in any legal state.
11697   */
11698  @Child(name = "scope", type = {
11699      CodeableConcept.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
11700  @Description(shortDefinition = "Range of Legal Concerns", formalDefinition = "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.")
11701  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-scope")
11702  protected CodeableConcept scope;
11703
11704  /**
11705   * Narrows the range of legal concerns to focus on the achievement of specific
11706   * contractual objectives.
11707   */
11708  @Child(name = "topic", type = { CodeableConcept.class,
11709      Reference.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
11710  @Description(shortDefinition = "Focus of contract interest", formalDefinition = "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.")
11711  protected Type topic;
11712
11713  /**
11714   * A high-level category for the legal instrument, whether constructed as a
11715   * Contract definition, derivative, or instance in any legal state. Provides
11716   * additional information about its content within the context of the Contract's
11717   * scope to distinguish the kinds of systems that would be interested in the
11718   * contract.
11719   */
11720  @Child(name = "type", type = {
11721      CodeableConcept.class }, order = 22, min = 0, max = 1, modifier = false, summary = true)
11722  @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.")
11723  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-type")
11724  protected CodeableConcept type;
11725
11726  /**
11727   * Sub-category for the Contract that distinguishes the kinds of systems that
11728   * would be interested in the Contract within the context of the Contract's
11729   * scope.
11730   */
11731  @Child(name = "subType", type = {
11732      CodeableConcept.class }, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
11733  @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.")
11734  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contract-subtype")
11735  protected List<CodeableConcept> subType;
11736
11737  /**
11738   * Precusory content developed with a focus and intent of supporting the
11739   * formation a Contract instance, which may be associated with and transformable
11740   * into a Contract.
11741   */
11742  @Child(name = "contentDefinition", type = {}, order = 24, min = 0, max = 1, modifier = false, summary = false)
11743  @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.")
11744  protected ContentDefinitionComponent contentDefinition;
11745
11746  /**
11747   * One or more Contract Provisions, which may be related and conveyed as a
11748   * group, and may contain nested groups.
11749   */
11750  @Child(name = "term", type = {}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11751  @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.")
11752  protected List<TermComponent> term;
11753
11754  /**
11755   * Information that may be needed by/relevant to the performer in their
11756   * execution of this term action.
11757   */
11758  @Child(name = "supportingInfo", type = {
11759      Reference.class }, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11760  @Description(shortDefinition = "Extra Information", formalDefinition = "Information that may be needed by/relevant to the performer in their execution of this term action.")
11761  protected List<Reference> supportingInfo;
11762  /**
11763   * The actual objects that are the target of the reference (Information that may
11764   * be needed by/relevant to the performer in their execution of this term
11765   * action.)
11766   */
11767  protected List<Resource> supportingInfoTarget;
11768
11769  /**
11770   * Links to Provenance records for past versions of this Contract definition,
11771   * derivative, or instance, which identify key state transitions or updates that
11772   * are likely to be relevant to a user looking at the current version of the
11773   * Contract. The Provence.entity indicates the target that was changed in the
11774   * update. http://build.fhir.org/provenance-definitions.html#Provenance.entity.
11775   */
11776  @Child(name = "relevantHistory", type = {
11777      Provenance.class }, order = 27, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11778  @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.")
11779  protected List<Reference> relevantHistory;
11780  /**
11781   * The actual objects that are the target of the reference (Links to Provenance
11782   * records for past versions of this Contract definition, derivative, or
11783   * instance, which identify key state transitions or updates that are likely to
11784   * be relevant to a user looking at the current version of the Contract. The
11785   * Provence.entity indicates the target that was changed in the update.
11786   * http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
11787   */
11788  protected List<Provenance> relevantHistoryTarget;
11789
11790  /**
11791   * Parties with legal standing in the Contract, including the principal parties,
11792   * the grantor(s) and grantee(s), which are any person or organization bound by
11793   * the contract, and any ancillary parties, which facilitate the execution of
11794   * the contract such as a notary or witness.
11795   */
11796  @Child(name = "signer", type = {}, order = 28, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11797  @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.")
11798  protected List<SignatoryComponent> signer;
11799
11800  /**
11801   * The "patient friendly language" versionof the Contract in whole or in parts.
11802   * "Patient friendly language" means the representation of the Contract and
11803   * Contract Provisions in a manner that is readily accessible and understandable
11804   * by a layperson in accordance with best practices for communication styles
11805   * that ensure that those agreeing to or signing the Contract understand the
11806   * roles, actions, obligations, responsibilities, and implication of the
11807   * agreement.
11808   */
11809  @Child(name = "friendly", type = {}, order = 29, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11810  @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.")
11811  protected List<FriendlyLanguageComponent> friendly;
11812
11813  /**
11814   * List of Legal expressions or representations of this Contract.
11815   */
11816  @Child(name = "legal", type = {}, order = 30, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11817  @Description(shortDefinition = "Contract Legal Language", formalDefinition = "List of Legal expressions or representations of this Contract.")
11818  protected List<LegalLanguageComponent> legal;
11819
11820  /**
11821   * List of Computable Policy Rule Language Representations of this Contract.
11822   */
11823  @Child(name = "rule", type = {}, order = 31, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11824  @Description(shortDefinition = "Computable Contract Language", formalDefinition = "List of Computable Policy Rule Language Representations of this Contract.")
11825  protected List<ComputableLanguageComponent> rule;
11826
11827  /**
11828   * Legally binding Contract: This is the signed and legally recognized
11829   * representation of the Contract, which is considered the "source of truth" and
11830   * which would be the basis for legal action related to enforcement of this
11831   * Contract.
11832   */
11833  @Child(name = "legallyBinding", type = { Attachment.class, Composition.class, DocumentReference.class,
11834      QuestionnaireResponse.class, Contract.class }, order = 32, min = 0, max = 1, modifier = false, summary = false)
11835  @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.")
11836  protected Type legallyBinding;
11837
11838  private static final long serialVersionUID = -1388892487L;
11839
11840  /**
11841   * Constructor
11842   */
11843  public Contract() {
11844    super();
11845  }
11846
11847  /**
11848   * @return {@link #identifier} (Unique identifier for this Contract or a
11849   *         derivative that references a Source Contract.)
11850   */
11851  public List<Identifier> getIdentifier() {
11852    if (this.identifier == null)
11853      this.identifier = new ArrayList<Identifier>();
11854    return this.identifier;
11855  }
11856
11857  /**
11858   * @return Returns a reference to <code>this</code> for easy method chaining
11859   */
11860  public Contract setIdentifier(List<Identifier> theIdentifier) {
11861    this.identifier = theIdentifier;
11862    return this;
11863  }
11864
11865  public boolean hasIdentifier() {
11866    if (this.identifier == null)
11867      return false;
11868    for (Identifier item : this.identifier)
11869      if (!item.isEmpty())
11870        return true;
11871    return false;
11872  }
11873
11874  public Identifier addIdentifier() { // 3
11875    Identifier t = new Identifier();
11876    if (this.identifier == null)
11877      this.identifier = new ArrayList<Identifier>();
11878    this.identifier.add(t);
11879    return t;
11880  }
11881
11882  public Contract addIdentifier(Identifier t) { // 3
11883    if (t == null)
11884      return this;
11885    if (this.identifier == null)
11886      this.identifier = new ArrayList<Identifier>();
11887    this.identifier.add(t);
11888    return this;
11889  }
11890
11891  /**
11892   * @return The first repetition of repeating field {@link #identifier}, creating
11893   *         it if it does not already exist
11894   */
11895  public Identifier getIdentifierFirstRep() {
11896    if (getIdentifier().isEmpty()) {
11897      addIdentifier();
11898    }
11899    return getIdentifier().get(0);
11900  }
11901
11902  /**
11903   * @return {@link #url} (Canonical identifier for this contract, represented as
11904   *         a URI (globally unique).). This is the underlying object with id,
11905   *         value and extensions. The accessor "getUrl" gives direct access to
11906   *         the value
11907   */
11908  public UriType getUrlElement() {
11909    if (this.url == null)
11910      if (Configuration.errorOnAutoCreate())
11911        throw new Error("Attempt to auto-create Contract.url");
11912      else if (Configuration.doAutoCreate())
11913        this.url = new UriType(); // bb
11914    return this.url;
11915  }
11916
11917  public boolean hasUrlElement() {
11918    return this.url != null && !this.url.isEmpty();
11919  }
11920
11921  public boolean hasUrl() {
11922    return this.url != null && !this.url.isEmpty();
11923  }
11924
11925  /**
11926   * @param value {@link #url} (Canonical identifier for this contract,
11927   *              represented as a URI (globally unique).). This is the underlying
11928   *              object with id, value and extensions. The accessor "getUrl"
11929   *              gives direct access to the value
11930   */
11931  public Contract setUrlElement(UriType value) {
11932    this.url = value;
11933    return this;
11934  }
11935
11936  /**
11937   * @return Canonical identifier for this contract, represented as a URI
11938   *         (globally unique).
11939   */
11940  public String getUrl() {
11941    return this.url == null ? null : this.url.getValue();
11942  }
11943
11944  /**
11945   * @param value Canonical identifier for this contract, represented as a URI
11946   *              (globally unique).
11947   */
11948  public Contract setUrl(String value) {
11949    if (Utilities.noString(value))
11950      this.url = null;
11951    else {
11952      if (this.url == null)
11953        this.url = new UriType();
11954      this.url.setValue(value);
11955    }
11956    return this;
11957  }
11958
11959  /**
11960   * @return {@link #version} (An edition identifier used for business purposes to
11961   *         label business significant variants.). This is the underlying object
11962   *         with id, value and extensions. The accessor "getVersion" gives direct
11963   *         access to the value
11964   */
11965  public StringType getVersionElement() {
11966    if (this.version == null)
11967      if (Configuration.errorOnAutoCreate())
11968        throw new Error("Attempt to auto-create Contract.version");
11969      else if (Configuration.doAutoCreate())
11970        this.version = new StringType(); // bb
11971    return this.version;
11972  }
11973
11974  public boolean hasVersionElement() {
11975    return this.version != null && !this.version.isEmpty();
11976  }
11977
11978  public boolean hasVersion() {
11979    return this.version != null && !this.version.isEmpty();
11980  }
11981
11982  /**
11983   * @param value {@link #version} (An edition identifier used for business
11984   *              purposes to label business significant variants.). This is the
11985   *              underlying object with id, value and extensions. The accessor
11986   *              "getVersion" gives direct access to the value
11987   */
11988  public Contract setVersionElement(StringType value) {
11989    this.version = value;
11990    return this;
11991  }
11992
11993  /**
11994   * @return An edition identifier used for business purposes to label business
11995   *         significant variants.
11996   */
11997  public String getVersion() {
11998    return this.version == null ? null : this.version.getValue();
11999  }
12000
12001  /**
12002   * @param value An edition identifier used for business purposes to label
12003   *              business significant variants.
12004   */
12005  public Contract setVersion(String value) {
12006    if (Utilities.noString(value))
12007      this.version = null;
12008    else {
12009      if (this.version == null)
12010        this.version = new StringType();
12011      this.version.setValue(value);
12012    }
12013    return this;
12014  }
12015
12016  /**
12017   * @return {@link #status} (The status of the resource instance.). This is the
12018   *         underlying object with id, value and extensions. The accessor
12019   *         "getStatus" gives direct access to the value
12020   */
12021  public Enumeration<ContractStatus> getStatusElement() {
12022    if (this.status == null)
12023      if (Configuration.errorOnAutoCreate())
12024        throw new Error("Attempt to auto-create Contract.status");
12025      else if (Configuration.doAutoCreate())
12026        this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory()); // bb
12027    return this.status;
12028  }
12029
12030  public boolean hasStatusElement() {
12031    return this.status != null && !this.status.isEmpty();
12032  }
12033
12034  public boolean hasStatus() {
12035    return this.status != null && !this.status.isEmpty();
12036  }
12037
12038  /**
12039   * @param value {@link #status} (The status of the resource instance.). This is
12040   *              the underlying object with id, value and extensions. The
12041   *              accessor "getStatus" gives direct access to the value
12042   */
12043  public Contract setStatusElement(Enumeration<ContractStatus> value) {
12044    this.status = value;
12045    return this;
12046  }
12047
12048  /**
12049   * @return The status of the resource instance.
12050   */
12051  public ContractStatus getStatus() {
12052    return this.status == null ? null : this.status.getValue();
12053  }
12054
12055  /**
12056   * @param value The status of the resource instance.
12057   */
12058  public Contract setStatus(ContractStatus value) {
12059    if (value == null)
12060      this.status = null;
12061    else {
12062      if (this.status == null)
12063        this.status = new Enumeration<ContractStatus>(new ContractStatusEnumFactory());
12064      this.status.setValue(value);
12065    }
12066    return this;
12067  }
12068
12069  /**
12070   * @return {@link #legalState} (Legal states of the formation of a legal
12071   *         instrument, which is a formally executed written document that can be
12072   *         formally attributed to its author, records and formally expresses a
12073   *         legally enforceable act, process, or contractual duty, obligation, or
12074   *         right, and therefore evidences that act, process, or agreement.)
12075   */
12076  public CodeableConcept getLegalState() {
12077    if (this.legalState == null)
12078      if (Configuration.errorOnAutoCreate())
12079        throw new Error("Attempt to auto-create Contract.legalState");
12080      else if (Configuration.doAutoCreate())
12081        this.legalState = new CodeableConcept(); // cc
12082    return this.legalState;
12083  }
12084
12085  public boolean hasLegalState() {
12086    return this.legalState != null && !this.legalState.isEmpty();
12087  }
12088
12089  /**
12090   * @param value {@link #legalState} (Legal states of the formation of a legal
12091   *              instrument, which is a formally executed written document that
12092   *              can be formally attributed to its author, records and formally
12093   *              expresses a legally enforceable act, process, or contractual
12094   *              duty, obligation, or right, and therefore evidences that act,
12095   *              process, or agreement.)
12096   */
12097  public Contract setLegalState(CodeableConcept value) {
12098    this.legalState = value;
12099    return this;
12100  }
12101
12102  /**
12103   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
12104   *         Contract Definition that is adhered to in whole or part by this
12105   *         Contract.)
12106   */
12107  public Reference getInstantiatesCanonical() {
12108    if (this.instantiatesCanonical == null)
12109      if (Configuration.errorOnAutoCreate())
12110        throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
12111      else if (Configuration.doAutoCreate())
12112        this.instantiatesCanonical = new Reference(); // cc
12113    return this.instantiatesCanonical;
12114  }
12115
12116  public boolean hasInstantiatesCanonical() {
12117    return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
12118  }
12119
12120  /**
12121   * @param value {@link #instantiatesCanonical} (The URL pointing to a
12122   *              FHIR-defined Contract Definition that is adhered to in whole or
12123   *              part by this Contract.)
12124   */
12125  public Contract setInstantiatesCanonical(Reference value) {
12126    this.instantiatesCanonical = value;
12127    return this;
12128  }
12129
12130  /**
12131   * @return {@link #instantiatesCanonical} The actual object that is the target
12132   *         of the reference. The reference library doesn't populate this, but
12133   *         you can use it to hold the resource if you resolve it. (The URL
12134   *         pointing to a FHIR-defined Contract Definition that is adhered to in
12135   *         whole or part by this Contract.)
12136   */
12137  public Contract getInstantiatesCanonicalTarget() {
12138    if (this.instantiatesCanonicalTarget == null)
12139      if (Configuration.errorOnAutoCreate())
12140        throw new Error("Attempt to auto-create Contract.instantiatesCanonical");
12141      else if (Configuration.doAutoCreate())
12142        this.instantiatesCanonicalTarget = new Contract(); // aa
12143    return this.instantiatesCanonicalTarget;
12144  }
12145
12146  /**
12147   * @param value {@link #instantiatesCanonical} The actual object that is the
12148   *              target of the reference. The reference library doesn't use
12149   *              these, but you can use it to hold the resource if you resolve
12150   *              it. (The URL pointing to a FHIR-defined Contract Definition that
12151   *              is adhered to in whole or part by this Contract.)
12152   */
12153  public Contract setInstantiatesCanonicalTarget(Contract value) {
12154    this.instantiatesCanonicalTarget = value;
12155    return this;
12156  }
12157
12158  /**
12159   * @return {@link #instantiatesUri} (The URL pointing to an externally
12160   *         maintained definition that is adhered to in whole or in part by this
12161   *         Contract.). This is the underlying object with id, value and
12162   *         extensions. The accessor "getInstantiatesUri" gives direct access to
12163   *         the value
12164   */
12165  public UriType getInstantiatesUriElement() {
12166    if (this.instantiatesUri == null)
12167      if (Configuration.errorOnAutoCreate())
12168        throw new Error("Attempt to auto-create Contract.instantiatesUri");
12169      else if (Configuration.doAutoCreate())
12170        this.instantiatesUri = new UriType(); // bb
12171    return this.instantiatesUri;
12172  }
12173
12174  public boolean hasInstantiatesUriElement() {
12175    return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
12176  }
12177
12178  public boolean hasInstantiatesUri() {
12179    return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
12180  }
12181
12182  /**
12183   * @param value {@link #instantiatesUri} (The URL pointing to an externally
12184   *              maintained definition that is adhered to in whole or in part by
12185   *              this Contract.). This is the underlying object with id, value
12186   *              and extensions. The accessor "getInstantiatesUri" gives direct
12187   *              access to the value
12188   */
12189  public Contract setInstantiatesUriElement(UriType value) {
12190    this.instantiatesUri = value;
12191    return this;
12192  }
12193
12194  /**
12195   * @return The URL pointing to an externally maintained definition that is
12196   *         adhered to in whole or in part by this Contract.
12197   */
12198  public String getInstantiatesUri() {
12199    return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
12200  }
12201
12202  /**
12203   * @param value The URL pointing to an externally maintained definition that is
12204   *              adhered to in whole or in part by this Contract.
12205   */
12206  public Contract setInstantiatesUri(String value) {
12207    if (Utilities.noString(value))
12208      this.instantiatesUri = null;
12209    else {
12210      if (this.instantiatesUri == null)
12211        this.instantiatesUri = new UriType();
12212      this.instantiatesUri.setValue(value);
12213    }
12214    return this;
12215  }
12216
12217  /**
12218   * @return {@link #contentDerivative} (The minimal content derived from the
12219   *         basal information source at a specific stage in its lifecycle.)
12220   */
12221  public CodeableConcept getContentDerivative() {
12222    if (this.contentDerivative == null)
12223      if (Configuration.errorOnAutoCreate())
12224        throw new Error("Attempt to auto-create Contract.contentDerivative");
12225      else if (Configuration.doAutoCreate())
12226        this.contentDerivative = new CodeableConcept(); // cc
12227    return this.contentDerivative;
12228  }
12229
12230  public boolean hasContentDerivative() {
12231    return this.contentDerivative != null && !this.contentDerivative.isEmpty();
12232  }
12233
12234  /**
12235   * @param value {@link #contentDerivative} (The minimal content derived from the
12236   *              basal information source at a specific stage in its lifecycle.)
12237   */
12238  public Contract setContentDerivative(CodeableConcept value) {
12239    this.contentDerivative = value;
12240    return this;
12241  }
12242
12243  /**
12244   * @return {@link #issued} (When this Contract was issued.). This is the
12245   *         underlying object with id, value and extensions. The accessor
12246   *         "getIssued" gives direct access to the value
12247   */
12248  public DateTimeType getIssuedElement() {
12249    if (this.issued == null)
12250      if (Configuration.errorOnAutoCreate())
12251        throw new Error("Attempt to auto-create Contract.issued");
12252      else if (Configuration.doAutoCreate())
12253        this.issued = new DateTimeType(); // bb
12254    return this.issued;
12255  }
12256
12257  public boolean hasIssuedElement() {
12258    return this.issued != null && !this.issued.isEmpty();
12259  }
12260
12261  public boolean hasIssued() {
12262    return this.issued != null && !this.issued.isEmpty();
12263  }
12264
12265  /**
12266   * @param value {@link #issued} (When this Contract was issued.). This is the
12267   *              underlying object with id, value and extensions. The accessor
12268   *              "getIssued" gives direct access to the value
12269   */
12270  public Contract setIssuedElement(DateTimeType value) {
12271    this.issued = value;
12272    return this;
12273  }
12274
12275  /**
12276   * @return When this Contract was issued.
12277   */
12278  public Date getIssued() {
12279    return this.issued == null ? null : this.issued.getValue();
12280  }
12281
12282  /**
12283   * @param value When this Contract was issued.
12284   */
12285  public Contract setIssued(Date value) {
12286    if (value == null)
12287      this.issued = null;
12288    else {
12289      if (this.issued == null)
12290        this.issued = new DateTimeType();
12291      this.issued.setValue(value);
12292    }
12293    return this;
12294  }
12295
12296  /**
12297   * @return {@link #applies} (Relevant time or time-period when this Contract is
12298   *         applicable.)
12299   */
12300  public Period getApplies() {
12301    if (this.applies == null)
12302      if (Configuration.errorOnAutoCreate())
12303        throw new Error("Attempt to auto-create Contract.applies");
12304      else if (Configuration.doAutoCreate())
12305        this.applies = new Period(); // cc
12306    return this.applies;
12307  }
12308
12309  public boolean hasApplies() {
12310    return this.applies != null && !this.applies.isEmpty();
12311  }
12312
12313  /**
12314   * @param value {@link #applies} (Relevant time or time-period when this
12315   *              Contract is applicable.)
12316   */
12317  public Contract setApplies(Period value) {
12318    this.applies = value;
12319    return this;
12320  }
12321
12322  /**
12323   * @return {@link #expirationType} (Event resulting in discontinuation or
12324   *         termination of this Contract instance by one or more parties to the
12325   *         contract.)
12326   */
12327  public CodeableConcept getExpirationType() {
12328    if (this.expirationType == null)
12329      if (Configuration.errorOnAutoCreate())
12330        throw new Error("Attempt to auto-create Contract.expirationType");
12331      else if (Configuration.doAutoCreate())
12332        this.expirationType = new CodeableConcept(); // cc
12333    return this.expirationType;
12334  }
12335
12336  public boolean hasExpirationType() {
12337    return this.expirationType != null && !this.expirationType.isEmpty();
12338  }
12339
12340  /**
12341   * @param value {@link #expirationType} (Event resulting in discontinuation or
12342   *              termination of this Contract instance by one or more parties to
12343   *              the contract.)
12344   */
12345  public Contract setExpirationType(CodeableConcept value) {
12346    this.expirationType = value;
12347    return this;
12348  }
12349
12350  /**
12351   * @return {@link #subject} (The target entity impacted by or of interest to
12352   *         parties to the agreement.)
12353   */
12354  public List<Reference> getSubject() {
12355    if (this.subject == null)
12356      this.subject = new ArrayList<Reference>();
12357    return this.subject;
12358  }
12359
12360  /**
12361   * @return Returns a reference to <code>this</code> for easy method chaining
12362   */
12363  public Contract setSubject(List<Reference> theSubject) {
12364    this.subject = theSubject;
12365    return this;
12366  }
12367
12368  public boolean hasSubject() {
12369    if (this.subject == null)
12370      return false;
12371    for (Reference item : this.subject)
12372      if (!item.isEmpty())
12373        return true;
12374    return false;
12375  }
12376
12377  public Reference addSubject() { // 3
12378    Reference t = new Reference();
12379    if (this.subject == null)
12380      this.subject = new ArrayList<Reference>();
12381    this.subject.add(t);
12382    return t;
12383  }
12384
12385  public Contract addSubject(Reference t) { // 3
12386    if (t == null)
12387      return this;
12388    if (this.subject == null)
12389      this.subject = new ArrayList<Reference>();
12390    this.subject.add(t);
12391    return this;
12392  }
12393
12394  /**
12395   * @return The first repetition of repeating field {@link #subject}, creating it
12396   *         if it does not already exist
12397   */
12398  public Reference getSubjectFirstRep() {
12399    if (getSubject().isEmpty()) {
12400      addSubject();
12401    }
12402    return getSubject().get(0);
12403  }
12404
12405  /**
12406   * @deprecated Use Reference#setResource(IBaseResource) instead
12407   */
12408  @Deprecated
12409  public List<Resource> getSubjectTarget() {
12410    if (this.subjectTarget == null)
12411      this.subjectTarget = new ArrayList<Resource>();
12412    return this.subjectTarget;
12413  }
12414
12415  /**
12416   * @return {@link #authority} (A formally or informally recognized grouping of
12417   *         people, principals, organizations, or jurisdictions formed for the
12418   *         purpose of achieving some form of collective action such as the
12419   *         promulgation, administration and enforcement of contracts and
12420   *         policies.)
12421   */
12422  public List<Reference> getAuthority() {
12423    if (this.authority == null)
12424      this.authority = new ArrayList<Reference>();
12425    return this.authority;
12426  }
12427
12428  /**
12429   * @return Returns a reference to <code>this</code> for easy method chaining
12430   */
12431  public Contract setAuthority(List<Reference> theAuthority) {
12432    this.authority = theAuthority;
12433    return this;
12434  }
12435
12436  public boolean hasAuthority() {
12437    if (this.authority == null)
12438      return false;
12439    for (Reference item : this.authority)
12440      if (!item.isEmpty())
12441        return true;
12442    return false;
12443  }
12444
12445  public Reference addAuthority() { // 3
12446    Reference t = new Reference();
12447    if (this.authority == null)
12448      this.authority = new ArrayList<Reference>();
12449    this.authority.add(t);
12450    return t;
12451  }
12452
12453  public Contract addAuthority(Reference t) { // 3
12454    if (t == null)
12455      return this;
12456    if (this.authority == null)
12457      this.authority = new ArrayList<Reference>();
12458    this.authority.add(t);
12459    return this;
12460  }
12461
12462  /**
12463   * @return The first repetition of repeating field {@link #authority}, creating
12464   *         it if it does not already exist
12465   */
12466  public Reference getAuthorityFirstRep() {
12467    if (getAuthority().isEmpty()) {
12468      addAuthority();
12469    }
12470    return getAuthority().get(0);
12471  }
12472
12473  /**
12474   * @deprecated Use Reference#setResource(IBaseResource) instead
12475   */
12476  @Deprecated
12477  public List<Organization> getAuthorityTarget() {
12478    if (this.authorityTarget == null)
12479      this.authorityTarget = new ArrayList<Organization>();
12480    return this.authorityTarget;
12481  }
12482
12483  /**
12484   * @deprecated Use Reference#setResource(IBaseResource) instead
12485   */
12486  @Deprecated
12487  public Organization addAuthorityTarget() {
12488    Organization r = new Organization();
12489    if (this.authorityTarget == null)
12490      this.authorityTarget = new ArrayList<Organization>();
12491    this.authorityTarget.add(r);
12492    return r;
12493  }
12494
12495  /**
12496   * @return {@link #domain} (Recognized governance framework or system operating
12497   *         with a circumscribed scope in accordance with specified principles,
12498   *         policies, processes or procedures for managing rights, actions, or
12499   *         behaviors of parties or principals relative to resources.)
12500   */
12501  public List<Reference> getDomain() {
12502    if (this.domain == null)
12503      this.domain = new ArrayList<Reference>();
12504    return this.domain;
12505  }
12506
12507  /**
12508   * @return Returns a reference to <code>this</code> for easy method chaining
12509   */
12510  public Contract setDomain(List<Reference> theDomain) {
12511    this.domain = theDomain;
12512    return this;
12513  }
12514
12515  public boolean hasDomain() {
12516    if (this.domain == null)
12517      return false;
12518    for (Reference item : this.domain)
12519      if (!item.isEmpty())
12520        return true;
12521    return false;
12522  }
12523
12524  public Reference addDomain() { // 3
12525    Reference t = new Reference();
12526    if (this.domain == null)
12527      this.domain = new ArrayList<Reference>();
12528    this.domain.add(t);
12529    return t;
12530  }
12531
12532  public Contract addDomain(Reference t) { // 3
12533    if (t == null)
12534      return this;
12535    if (this.domain == null)
12536      this.domain = new ArrayList<Reference>();
12537    this.domain.add(t);
12538    return this;
12539  }
12540
12541  /**
12542   * @return The first repetition of repeating field {@link #domain}, creating it
12543   *         if it does not already exist
12544   */
12545  public Reference getDomainFirstRep() {
12546    if (getDomain().isEmpty()) {
12547      addDomain();
12548    }
12549    return getDomain().get(0);
12550  }
12551
12552  /**
12553   * @deprecated Use Reference#setResource(IBaseResource) instead
12554   */
12555  @Deprecated
12556  public List<Location> getDomainTarget() {
12557    if (this.domainTarget == null)
12558      this.domainTarget = new ArrayList<Location>();
12559    return this.domainTarget;
12560  }
12561
12562  /**
12563   * @deprecated Use Reference#setResource(IBaseResource) instead
12564   */
12565  @Deprecated
12566  public Location addDomainTarget() {
12567    Location r = new Location();
12568    if (this.domainTarget == null)
12569      this.domainTarget = new ArrayList<Location>();
12570    this.domainTarget.add(r);
12571    return r;
12572  }
12573
12574  /**
12575   * @return {@link #site} (Sites in which the contract is complied with,
12576   *         exercised, or in force.)
12577   */
12578  public List<Reference> getSite() {
12579    if (this.site == null)
12580      this.site = new ArrayList<Reference>();
12581    return this.site;
12582  }
12583
12584  /**
12585   * @return Returns a reference to <code>this</code> for easy method chaining
12586   */
12587  public Contract setSite(List<Reference> theSite) {
12588    this.site = theSite;
12589    return this;
12590  }
12591
12592  public boolean hasSite() {
12593    if (this.site == null)
12594      return false;
12595    for (Reference item : this.site)
12596      if (!item.isEmpty())
12597        return true;
12598    return false;
12599  }
12600
12601  public Reference addSite() { // 3
12602    Reference t = new Reference();
12603    if (this.site == null)
12604      this.site = new ArrayList<Reference>();
12605    this.site.add(t);
12606    return t;
12607  }
12608
12609  public Contract addSite(Reference t) { // 3
12610    if (t == null)
12611      return this;
12612    if (this.site == null)
12613      this.site = new ArrayList<Reference>();
12614    this.site.add(t);
12615    return this;
12616  }
12617
12618  /**
12619   * @return The first repetition of repeating field {@link #site}, creating it if
12620   *         it does not already exist
12621   */
12622  public Reference getSiteFirstRep() {
12623    if (getSite().isEmpty()) {
12624      addSite();
12625    }
12626    return getSite().get(0);
12627  }
12628
12629  /**
12630   * @deprecated Use Reference#setResource(IBaseResource) instead
12631   */
12632  @Deprecated
12633  public List<Location> getSiteTarget() {
12634    if (this.siteTarget == null)
12635      this.siteTarget = new ArrayList<Location>();
12636    return this.siteTarget;
12637  }
12638
12639  /**
12640   * @deprecated Use Reference#setResource(IBaseResource) instead
12641   */
12642  @Deprecated
12643  public Location addSiteTarget() {
12644    Location r = new Location();
12645    if (this.siteTarget == null)
12646      this.siteTarget = new ArrayList<Location>();
12647    this.siteTarget.add(r);
12648    return r;
12649  }
12650
12651  /**
12652   * @return {@link #name} (A natural language name identifying this Contract
12653   *         definition, derivative, or instance in any legal state. Provides
12654   *         additional information about its content. This name should be usable
12655   *         as an identifier for the module by machine processing applications
12656   *         such as code generation.). This is the underlying object with id,
12657   *         value and extensions. The accessor "getName" gives direct access to
12658   *         the value
12659   */
12660  public StringType getNameElement() {
12661    if (this.name == null)
12662      if (Configuration.errorOnAutoCreate())
12663        throw new Error("Attempt to auto-create Contract.name");
12664      else if (Configuration.doAutoCreate())
12665        this.name = new StringType(); // bb
12666    return this.name;
12667  }
12668
12669  public boolean hasNameElement() {
12670    return this.name != null && !this.name.isEmpty();
12671  }
12672
12673  public boolean hasName() {
12674    return this.name != null && !this.name.isEmpty();
12675  }
12676
12677  /**
12678   * @param value {@link #name} (A natural language name identifying this Contract
12679   *              definition, derivative, or instance in any legal state. Provides
12680   *              additional information about its content. This name should be
12681   *              usable as an identifier for the module by machine processing
12682   *              applications such as code generation.). This is the underlying
12683   *              object with id, value and extensions. The accessor "getName"
12684   *              gives direct access to the value
12685   */
12686  public Contract setNameElement(StringType value) {
12687    this.name = value;
12688    return this;
12689  }
12690
12691  /**
12692   * @return A natural language name identifying this Contract definition,
12693   *         derivative, or instance in any legal state. Provides additional
12694   *         information about its content. This name should be usable as an
12695   *         identifier for the module by machine processing applications such as
12696   *         code generation.
12697   */
12698  public String getName() {
12699    return this.name == null ? null : this.name.getValue();
12700  }
12701
12702  /**
12703   * @param value A natural language name identifying this Contract definition,
12704   *              derivative, or instance in any legal state. Provides additional
12705   *              information about its content. This name should be usable as an
12706   *              identifier for the module by machine processing applications
12707   *              such as code generation.
12708   */
12709  public Contract setName(String value) {
12710    if (Utilities.noString(value))
12711      this.name = null;
12712    else {
12713      if (this.name == null)
12714        this.name = new StringType();
12715      this.name.setValue(value);
12716    }
12717    return this;
12718  }
12719
12720  /**
12721   * @return {@link #title} (A short, descriptive, user-friendly title for this
12722   *         Contract definition, derivative, or instance in any legal state.t
12723   *         giving additional information about its content.). This is the
12724   *         underlying object with id, value and extensions. The accessor
12725   *         "getTitle" gives direct access to the value
12726   */
12727  public StringType getTitleElement() {
12728    if (this.title == null)
12729      if (Configuration.errorOnAutoCreate())
12730        throw new Error("Attempt to auto-create Contract.title");
12731      else if (Configuration.doAutoCreate())
12732        this.title = new StringType(); // bb
12733    return this.title;
12734  }
12735
12736  public boolean hasTitleElement() {
12737    return this.title != null && !this.title.isEmpty();
12738  }
12739
12740  public boolean hasTitle() {
12741    return this.title != null && !this.title.isEmpty();
12742  }
12743
12744  /**
12745   * @param value {@link #title} (A short, descriptive, user-friendly title for
12746   *              this Contract definition, derivative, or instance in any legal
12747   *              state.t giving additional information about its content.). This
12748   *              is the underlying object with id, value and extensions. The
12749   *              accessor "getTitle" gives direct access to the value
12750   */
12751  public Contract setTitleElement(StringType value) {
12752    this.title = value;
12753    return this;
12754  }
12755
12756  /**
12757   * @return A short, descriptive, user-friendly title for this Contract
12758   *         definition, derivative, or instance in any legal state.t giving
12759   *         additional information about its content.
12760   */
12761  public String getTitle() {
12762    return this.title == null ? null : this.title.getValue();
12763  }
12764
12765  /**
12766   * @param value A short, descriptive, user-friendly title for this Contract
12767   *              definition, derivative, or instance in any legal state.t giving
12768   *              additional information about its content.
12769   */
12770  public Contract setTitle(String value) {
12771    if (Utilities.noString(value))
12772      this.title = null;
12773    else {
12774      if (this.title == null)
12775        this.title = new StringType();
12776      this.title.setValue(value);
12777    }
12778    return this;
12779  }
12780
12781  /**
12782   * @return {@link #subtitle} (An explanatory or alternate user-friendly title
12783   *         for this Contract definition, derivative, or instance in any legal
12784   *         state.t giving additional information about its content.). This is
12785   *         the underlying object with id, value and extensions. The accessor
12786   *         "getSubtitle" gives direct access to the value
12787   */
12788  public StringType getSubtitleElement() {
12789    if (this.subtitle == null)
12790      if (Configuration.errorOnAutoCreate())
12791        throw new Error("Attempt to auto-create Contract.subtitle");
12792      else if (Configuration.doAutoCreate())
12793        this.subtitle = new StringType(); // bb
12794    return this.subtitle;
12795  }
12796
12797  public boolean hasSubtitleElement() {
12798    return this.subtitle != null && !this.subtitle.isEmpty();
12799  }
12800
12801  public boolean hasSubtitle() {
12802    return this.subtitle != null && !this.subtitle.isEmpty();
12803  }
12804
12805  /**
12806   * @param value {@link #subtitle} (An explanatory or alternate user-friendly
12807   *              title for this Contract definition, derivative, or instance in
12808   *              any legal state.t giving additional information about its
12809   *              content.). This is the underlying object with id, value and
12810   *              extensions. The accessor "getSubtitle" gives direct access to
12811   *              the value
12812   */
12813  public Contract setSubtitleElement(StringType value) {
12814    this.subtitle = value;
12815    return this;
12816  }
12817
12818  /**
12819   * @return An explanatory or alternate user-friendly title for this Contract
12820   *         definition, derivative, or instance in any legal state.t giving
12821   *         additional information about its content.
12822   */
12823  public String getSubtitle() {
12824    return this.subtitle == null ? null : this.subtitle.getValue();
12825  }
12826
12827  /**
12828   * @param value An explanatory or alternate user-friendly title for this
12829   *              Contract definition, derivative, or instance in any legal
12830   *              state.t giving additional information about its content.
12831   */
12832  public Contract setSubtitle(String value) {
12833    if (Utilities.noString(value))
12834      this.subtitle = null;
12835    else {
12836      if (this.subtitle == null)
12837        this.subtitle = new StringType();
12838      this.subtitle.setValue(value);
12839    }
12840    return this;
12841  }
12842
12843  /**
12844   * @return {@link #alias} (Alternative representation of the title for this
12845   *         Contract definition, derivative, or instance in any legal state.,
12846   *         e.g., a domain specific contract number related to legislation.)
12847   */
12848  public List<StringType> getAlias() {
12849    if (this.alias == null)
12850      this.alias = new ArrayList<StringType>();
12851    return this.alias;
12852  }
12853
12854  /**
12855   * @return Returns a reference to <code>this</code> for easy method chaining
12856   */
12857  public Contract setAlias(List<StringType> theAlias) {
12858    this.alias = theAlias;
12859    return this;
12860  }
12861
12862  public boolean hasAlias() {
12863    if (this.alias == null)
12864      return false;
12865    for (StringType item : this.alias)
12866      if (!item.isEmpty())
12867        return true;
12868    return false;
12869  }
12870
12871  /**
12872   * @return {@link #alias} (Alternative representation of the title for this
12873   *         Contract definition, derivative, or instance in any legal state.,
12874   *         e.g., a domain specific contract number related to legislation.)
12875   */
12876  public StringType addAliasElement() {// 2
12877    StringType t = new StringType();
12878    if (this.alias == null)
12879      this.alias = new ArrayList<StringType>();
12880    this.alias.add(t);
12881    return t;
12882  }
12883
12884  /**
12885   * @param value {@link #alias} (Alternative representation of the title for this
12886   *              Contract definition, derivative, or instance in any legal
12887   *              state., e.g., a domain specific contract number related to
12888   *              legislation.)
12889   */
12890  public Contract addAlias(String value) { // 1
12891    StringType t = new StringType();
12892    t.setValue(value);
12893    if (this.alias == null)
12894      this.alias = new ArrayList<StringType>();
12895    this.alias.add(t);
12896    return this;
12897  }
12898
12899  /**
12900   * @param value {@link #alias} (Alternative representation of the title for this
12901   *              Contract definition, derivative, or instance in any legal
12902   *              state., e.g., a domain specific contract number related to
12903   *              legislation.)
12904   */
12905  public boolean hasAlias(String value) {
12906    if (this.alias == null)
12907      return false;
12908    for (StringType v : this.alias)
12909      if (v.getValue().equals(value)) // string
12910        return true;
12911    return false;
12912  }
12913
12914  /**
12915   * @return {@link #author} (The individual or organization that authored the
12916   *         Contract definition, derivative, or instance in any legal state.)
12917   */
12918  public Reference getAuthor() {
12919    if (this.author == null)
12920      if (Configuration.errorOnAutoCreate())
12921        throw new Error("Attempt to auto-create Contract.author");
12922      else if (Configuration.doAutoCreate())
12923        this.author = new Reference(); // cc
12924    return this.author;
12925  }
12926
12927  public boolean hasAuthor() {
12928    return this.author != null && !this.author.isEmpty();
12929  }
12930
12931  /**
12932   * @param value {@link #author} (The individual or organization that authored
12933   *              the Contract definition, derivative, or instance in any legal
12934   *              state.)
12935   */
12936  public Contract setAuthor(Reference value) {
12937    this.author = value;
12938    return this;
12939  }
12940
12941  /**
12942   * @return {@link #author} The actual object that is the target of the
12943   *         reference. The reference library doesn't populate this, but you can
12944   *         use it to hold the resource if you resolve it. (The individual or
12945   *         organization that authored the Contract definition, derivative, or
12946   *         instance in any legal state.)
12947   */
12948  public Resource getAuthorTarget() {
12949    return this.authorTarget;
12950  }
12951
12952  /**
12953   * @param value {@link #author} The actual object that is the target of the
12954   *              reference. The reference library doesn't use these, but you can
12955   *              use it to hold the resource if you resolve it. (The individual
12956   *              or organization that authored the Contract definition,
12957   *              derivative, or instance in any legal state.)
12958   */
12959  public Contract setAuthorTarget(Resource value) {
12960    this.authorTarget = value;
12961    return this;
12962  }
12963
12964  /**
12965   * @return {@link #scope} (A selector of legal concerns for this Contract
12966   *         definition, derivative, or instance in any legal state.)
12967   */
12968  public CodeableConcept getScope() {
12969    if (this.scope == null)
12970      if (Configuration.errorOnAutoCreate())
12971        throw new Error("Attempt to auto-create Contract.scope");
12972      else if (Configuration.doAutoCreate())
12973        this.scope = new CodeableConcept(); // cc
12974    return this.scope;
12975  }
12976
12977  public boolean hasScope() {
12978    return this.scope != null && !this.scope.isEmpty();
12979  }
12980
12981  /**
12982   * @param value {@link #scope} (A selector of legal concerns for this Contract
12983   *              definition, derivative, or instance in any legal state.)
12984   */
12985  public Contract setScope(CodeableConcept value) {
12986    this.scope = value;
12987    return this;
12988  }
12989
12990  /**
12991   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
12992   *         achievement of specific contractual objectives.)
12993   */
12994  public Type getTopic() {
12995    return this.topic;
12996  }
12997
12998  /**
12999   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
13000   *         achievement of specific contractual objectives.)
13001   */
13002  public CodeableConcept getTopicCodeableConcept() throws FHIRException {
13003    if (this.topic == null)
13004      this.topic = new CodeableConcept();
13005    if (!(this.topic instanceof CodeableConcept))
13006      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
13007          + this.topic.getClass().getName() + " was encountered");
13008    return (CodeableConcept) this.topic;
13009  }
13010
13011  public boolean hasTopicCodeableConcept() {
13012    return this != null && this.topic instanceof CodeableConcept;
13013  }
13014
13015  /**
13016   * @return {@link #topic} (Narrows the range of legal concerns to focus on the
13017   *         achievement of specific contractual objectives.)
13018   */
13019  public Reference getTopicReference() throws FHIRException {
13020    if (this.topic == null)
13021      this.topic = new Reference();
13022    if (!(this.topic instanceof Reference))
13023      throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.topic.getClass().getName()
13024          + " was encountered");
13025    return (Reference) this.topic;
13026  }
13027
13028  public boolean hasTopicReference() {
13029    return this != null && this.topic instanceof Reference;
13030  }
13031
13032  public boolean hasTopic() {
13033    return this.topic != null && !this.topic.isEmpty();
13034  }
13035
13036  /**
13037   * @param value {@link #topic} (Narrows the range of legal concerns to focus on
13038   *              the achievement of specific contractual objectives.)
13039   */
13040  public Contract setTopic(Type value) {
13041    if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
13042      throw new Error("Not the right type for Contract.topic[x]: " + value.fhirType());
13043    this.topic = value;
13044    return this;
13045  }
13046
13047  /**
13048   * @return {@link #type} (A high-level category for the legal instrument,
13049   *         whether constructed as a Contract definition, derivative, or instance
13050   *         in any legal state. Provides additional information about its content
13051   *         within the context of the Contract's scope to distinguish the kinds
13052   *         of systems that would be interested in the contract.)
13053   */
13054  public CodeableConcept getType() {
13055    if (this.type == null)
13056      if (Configuration.errorOnAutoCreate())
13057        throw new Error("Attempt to auto-create Contract.type");
13058      else if (Configuration.doAutoCreate())
13059        this.type = new CodeableConcept(); // cc
13060    return this.type;
13061  }
13062
13063  public boolean hasType() {
13064    return this.type != null && !this.type.isEmpty();
13065  }
13066
13067  /**
13068   * @param value {@link #type} (A high-level category for the legal instrument,
13069   *              whether constructed as a Contract definition, derivative, or
13070   *              instance in any legal state. Provides additional information
13071   *              about its content within the context of the Contract's scope to
13072   *              distinguish the kinds of systems that would be interested in the
13073   *              contract.)
13074   */
13075  public Contract setType(CodeableConcept value) {
13076    this.type = value;
13077    return this;
13078  }
13079
13080  /**
13081   * @return {@link #subType} (Sub-category for the Contract that distinguishes
13082   *         the kinds of systems that would be interested in the Contract within
13083   *         the context of the Contract's scope.)
13084   */
13085  public List<CodeableConcept> getSubType() {
13086    if (this.subType == null)
13087      this.subType = new ArrayList<CodeableConcept>();
13088    return this.subType;
13089  }
13090
13091  /**
13092   * @return Returns a reference to <code>this</code> for easy method chaining
13093   */
13094  public Contract setSubType(List<CodeableConcept> theSubType) {
13095    this.subType = theSubType;
13096    return this;
13097  }
13098
13099  public boolean hasSubType() {
13100    if (this.subType == null)
13101      return false;
13102    for (CodeableConcept item : this.subType)
13103      if (!item.isEmpty())
13104        return true;
13105    return false;
13106  }
13107
13108  public CodeableConcept addSubType() { // 3
13109    CodeableConcept t = new CodeableConcept();
13110    if (this.subType == null)
13111      this.subType = new ArrayList<CodeableConcept>();
13112    this.subType.add(t);
13113    return t;
13114  }
13115
13116  public Contract addSubType(CodeableConcept t) { // 3
13117    if (t == null)
13118      return this;
13119    if (this.subType == null)
13120      this.subType = new ArrayList<CodeableConcept>();
13121    this.subType.add(t);
13122    return this;
13123  }
13124
13125  /**
13126   * @return The first repetition of repeating field {@link #subType}, creating it
13127   *         if it does not already exist
13128   */
13129  public CodeableConcept getSubTypeFirstRep() {
13130    if (getSubType().isEmpty()) {
13131      addSubType();
13132    }
13133    return getSubType().get(0);
13134  }
13135
13136  /**
13137   * @return {@link #contentDefinition} (Precusory content developed with a focus
13138   *         and intent of supporting the formation a Contract instance, which may
13139   *         be associated with and transformable into a Contract.)
13140   */
13141  public ContentDefinitionComponent getContentDefinition() {
13142    if (this.contentDefinition == null)
13143      if (Configuration.errorOnAutoCreate())
13144        throw new Error("Attempt to auto-create Contract.contentDefinition");
13145      else if (Configuration.doAutoCreate())
13146        this.contentDefinition = new ContentDefinitionComponent(); // cc
13147    return this.contentDefinition;
13148  }
13149
13150  public boolean hasContentDefinition() {
13151    return this.contentDefinition != null && !this.contentDefinition.isEmpty();
13152  }
13153
13154  /**
13155   * @param value {@link #contentDefinition} (Precusory content developed with a
13156   *              focus and intent of supporting the formation a Contract
13157   *              instance, which may be associated with and transformable into a
13158   *              Contract.)
13159   */
13160  public Contract setContentDefinition(ContentDefinitionComponent value) {
13161    this.contentDefinition = value;
13162    return this;
13163  }
13164
13165  /**
13166   * @return {@link #term} (One or more Contract Provisions, which may be related
13167   *         and conveyed as a group, and may contain nested groups.)
13168   */
13169  public List<TermComponent> getTerm() {
13170    if (this.term == null)
13171      this.term = new ArrayList<TermComponent>();
13172    return this.term;
13173  }
13174
13175  /**
13176   * @return Returns a reference to <code>this</code> for easy method chaining
13177   */
13178  public Contract setTerm(List<TermComponent> theTerm) {
13179    this.term = theTerm;
13180    return this;
13181  }
13182
13183  public boolean hasTerm() {
13184    if (this.term == null)
13185      return false;
13186    for (TermComponent item : this.term)
13187      if (!item.isEmpty())
13188        return true;
13189    return false;
13190  }
13191
13192  public TermComponent addTerm() { // 3
13193    TermComponent t = new TermComponent();
13194    if (this.term == null)
13195      this.term = new ArrayList<TermComponent>();
13196    this.term.add(t);
13197    return t;
13198  }
13199
13200  public Contract addTerm(TermComponent t) { // 3
13201    if (t == null)
13202      return this;
13203    if (this.term == null)
13204      this.term = new ArrayList<TermComponent>();
13205    this.term.add(t);
13206    return this;
13207  }
13208
13209  /**
13210   * @return The first repetition of repeating field {@link #term}, creating it if
13211   *         it does not already exist
13212   */
13213  public TermComponent getTermFirstRep() {
13214    if (getTerm().isEmpty()) {
13215      addTerm();
13216    }
13217    return getTerm().get(0);
13218  }
13219
13220  /**
13221   * @return {@link #supportingInfo} (Information that may be needed by/relevant
13222   *         to the performer in their execution of this term action.)
13223   */
13224  public List<Reference> getSupportingInfo() {
13225    if (this.supportingInfo == null)
13226      this.supportingInfo = new ArrayList<Reference>();
13227    return this.supportingInfo;
13228  }
13229
13230  /**
13231   * @return Returns a reference to <code>this</code> for easy method chaining
13232   */
13233  public Contract setSupportingInfo(List<Reference> theSupportingInfo) {
13234    this.supportingInfo = theSupportingInfo;
13235    return this;
13236  }
13237
13238  public boolean hasSupportingInfo() {
13239    if (this.supportingInfo == null)
13240      return false;
13241    for (Reference item : this.supportingInfo)
13242      if (!item.isEmpty())
13243        return true;
13244    return false;
13245  }
13246
13247  public Reference addSupportingInfo() { // 3
13248    Reference t = new Reference();
13249    if (this.supportingInfo == null)
13250      this.supportingInfo = new ArrayList<Reference>();
13251    this.supportingInfo.add(t);
13252    return t;
13253  }
13254
13255  public Contract addSupportingInfo(Reference t) { // 3
13256    if (t == null)
13257      return this;
13258    if (this.supportingInfo == null)
13259      this.supportingInfo = new ArrayList<Reference>();
13260    this.supportingInfo.add(t);
13261    return this;
13262  }
13263
13264  /**
13265   * @return The first repetition of repeating field {@link #supportingInfo},
13266   *         creating it if it does not already exist
13267   */
13268  public Reference getSupportingInfoFirstRep() {
13269    if (getSupportingInfo().isEmpty()) {
13270      addSupportingInfo();
13271    }
13272    return getSupportingInfo().get(0);
13273  }
13274
13275  /**
13276   * @deprecated Use Reference#setResource(IBaseResource) instead
13277   */
13278  @Deprecated
13279  public List<Resource> getSupportingInfoTarget() {
13280    if (this.supportingInfoTarget == null)
13281      this.supportingInfoTarget = new ArrayList<Resource>();
13282    return this.supportingInfoTarget;
13283  }
13284
13285  /**
13286   * @return {@link #relevantHistory} (Links to Provenance records for past
13287   *         versions of this Contract definition, derivative, or instance, which
13288   *         identify key state transitions or updates that are likely to be
13289   *         relevant to a user looking at the current version of the Contract.
13290   *         The Provence.entity indicates the target that was changed in the
13291   *         update.
13292   *         http://build.fhir.org/provenance-definitions.html#Provenance.entity.)
13293   */
13294  public List<Reference> getRelevantHistory() {
13295    if (this.relevantHistory == null)
13296      this.relevantHistory = new ArrayList<Reference>();
13297    return this.relevantHistory;
13298  }
13299
13300  /**
13301   * @return Returns a reference to <code>this</code> for easy method chaining
13302   */
13303  public Contract setRelevantHistory(List<Reference> theRelevantHistory) {
13304    this.relevantHistory = theRelevantHistory;
13305    return this;
13306  }
13307
13308  public boolean hasRelevantHistory() {
13309    if (this.relevantHistory == null)
13310      return false;
13311    for (Reference item : this.relevantHistory)
13312      if (!item.isEmpty())
13313        return true;
13314    return false;
13315  }
13316
13317  public Reference addRelevantHistory() { // 3
13318    Reference t = new Reference();
13319    if (this.relevantHistory == null)
13320      this.relevantHistory = new ArrayList<Reference>();
13321    this.relevantHistory.add(t);
13322    return t;
13323  }
13324
13325  public Contract addRelevantHistory(Reference t) { // 3
13326    if (t == null)
13327      return this;
13328    if (this.relevantHistory == null)
13329      this.relevantHistory = new ArrayList<Reference>();
13330    this.relevantHistory.add(t);
13331    return this;
13332  }
13333
13334  /**
13335   * @return The first repetition of repeating field {@link #relevantHistory},
13336   *         creating it if it does not already exist
13337   */
13338  public Reference getRelevantHistoryFirstRep() {
13339    if (getRelevantHistory().isEmpty()) {
13340      addRelevantHistory();
13341    }
13342    return getRelevantHistory().get(0);
13343  }
13344
13345  /**
13346   * @deprecated Use Reference#setResource(IBaseResource) instead
13347   */
13348  @Deprecated
13349  public List<Provenance> getRelevantHistoryTarget() {
13350    if (this.relevantHistoryTarget == null)
13351      this.relevantHistoryTarget = new ArrayList<Provenance>();
13352    return this.relevantHistoryTarget;
13353  }
13354
13355  /**
13356   * @deprecated Use Reference#setResource(IBaseResource) instead
13357   */
13358  @Deprecated
13359  public Provenance addRelevantHistoryTarget() {
13360    Provenance r = new Provenance();
13361    if (this.relevantHistoryTarget == null)
13362      this.relevantHistoryTarget = new ArrayList<Provenance>();
13363    this.relevantHistoryTarget.add(r);
13364    return r;
13365  }
13366
13367  /**
13368   * @return {@link #signer} (Parties with legal standing in the Contract,
13369   *         including the principal parties, the grantor(s) and grantee(s), which
13370   *         are any person or organization bound by the contract, and any
13371   *         ancillary parties, which facilitate the execution of the contract
13372   *         such as a notary or witness.)
13373   */
13374  public List<SignatoryComponent> getSigner() {
13375    if (this.signer == null)
13376      this.signer = new ArrayList<SignatoryComponent>();
13377    return this.signer;
13378  }
13379
13380  /**
13381   * @return Returns a reference to <code>this</code> for easy method chaining
13382   */
13383  public Contract setSigner(List<SignatoryComponent> theSigner) {
13384    this.signer = theSigner;
13385    return this;
13386  }
13387
13388  public boolean hasSigner() {
13389    if (this.signer == null)
13390      return false;
13391    for (SignatoryComponent item : this.signer)
13392      if (!item.isEmpty())
13393        return true;
13394    return false;
13395  }
13396
13397  public SignatoryComponent addSigner() { // 3
13398    SignatoryComponent t = new SignatoryComponent();
13399    if (this.signer == null)
13400      this.signer = new ArrayList<SignatoryComponent>();
13401    this.signer.add(t);
13402    return t;
13403  }
13404
13405  public Contract addSigner(SignatoryComponent t) { // 3
13406    if (t == null)
13407      return this;
13408    if (this.signer == null)
13409      this.signer = new ArrayList<SignatoryComponent>();
13410    this.signer.add(t);
13411    return this;
13412  }
13413
13414  /**
13415   * @return The first repetition of repeating field {@link #signer}, creating it
13416   *         if it does not already exist
13417   */
13418  public SignatoryComponent getSignerFirstRep() {
13419    if (getSigner().isEmpty()) {
13420      addSigner();
13421    }
13422    return getSigner().get(0);
13423  }
13424
13425  /**
13426   * @return {@link #friendly} (The "patient friendly language" versionof the
13427   *         Contract in whole or in parts. "Patient friendly language" means the
13428   *         representation of the Contract and Contract Provisions in a manner
13429   *         that is readily accessible and understandable by a layperson in
13430   *         accordance with best practices for communication styles that ensure
13431   *         that those agreeing to or signing the Contract understand the roles,
13432   *         actions, obligations, responsibilities, and implication of the
13433   *         agreement.)
13434   */
13435  public List<FriendlyLanguageComponent> getFriendly() {
13436    if (this.friendly == null)
13437      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13438    return this.friendly;
13439  }
13440
13441  /**
13442   * @return Returns a reference to <code>this</code> for easy method chaining
13443   */
13444  public Contract setFriendly(List<FriendlyLanguageComponent> theFriendly) {
13445    this.friendly = theFriendly;
13446    return this;
13447  }
13448
13449  public boolean hasFriendly() {
13450    if (this.friendly == null)
13451      return false;
13452    for (FriendlyLanguageComponent item : this.friendly)
13453      if (!item.isEmpty())
13454        return true;
13455    return false;
13456  }
13457
13458  public FriendlyLanguageComponent addFriendly() { // 3
13459    FriendlyLanguageComponent t = new FriendlyLanguageComponent();
13460    if (this.friendly == null)
13461      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13462    this.friendly.add(t);
13463    return t;
13464  }
13465
13466  public Contract addFriendly(FriendlyLanguageComponent t) { // 3
13467    if (t == null)
13468      return this;
13469    if (this.friendly == null)
13470      this.friendly = new ArrayList<FriendlyLanguageComponent>();
13471    this.friendly.add(t);
13472    return this;
13473  }
13474
13475  /**
13476   * @return The first repetition of repeating field {@link #friendly}, creating
13477   *         it if it does not already exist
13478   */
13479  public FriendlyLanguageComponent getFriendlyFirstRep() {
13480    if (getFriendly().isEmpty()) {
13481      addFriendly();
13482    }
13483    return getFriendly().get(0);
13484  }
13485
13486  /**
13487   * @return {@link #legal} (List of Legal expressions or representations of this
13488   *         Contract.)
13489   */
13490  public List<LegalLanguageComponent> getLegal() {
13491    if (this.legal == null)
13492      this.legal = new ArrayList<LegalLanguageComponent>();
13493    return this.legal;
13494  }
13495
13496  /**
13497   * @return Returns a reference to <code>this</code> for easy method chaining
13498   */
13499  public Contract setLegal(List<LegalLanguageComponent> theLegal) {
13500    this.legal = theLegal;
13501    return this;
13502  }
13503
13504  public boolean hasLegal() {
13505    if (this.legal == null)
13506      return false;
13507    for (LegalLanguageComponent item : this.legal)
13508      if (!item.isEmpty())
13509        return true;
13510    return false;
13511  }
13512
13513  public LegalLanguageComponent addLegal() { // 3
13514    LegalLanguageComponent t = new LegalLanguageComponent();
13515    if (this.legal == null)
13516      this.legal = new ArrayList<LegalLanguageComponent>();
13517    this.legal.add(t);
13518    return t;
13519  }
13520
13521  public Contract addLegal(LegalLanguageComponent t) { // 3
13522    if (t == null)
13523      return this;
13524    if (this.legal == null)
13525      this.legal = new ArrayList<LegalLanguageComponent>();
13526    this.legal.add(t);
13527    return this;
13528  }
13529
13530  /**
13531   * @return The first repetition of repeating field {@link #legal}, creating it
13532   *         if it does not already exist
13533   */
13534  public LegalLanguageComponent getLegalFirstRep() {
13535    if (getLegal().isEmpty()) {
13536      addLegal();
13537    }
13538    return getLegal().get(0);
13539  }
13540
13541  /**
13542   * @return {@link #rule} (List of Computable Policy Rule Language
13543   *         Representations of this Contract.)
13544   */
13545  public List<ComputableLanguageComponent> getRule() {
13546    if (this.rule == null)
13547      this.rule = new ArrayList<ComputableLanguageComponent>();
13548    return this.rule;
13549  }
13550
13551  /**
13552   * @return Returns a reference to <code>this</code> for easy method chaining
13553   */
13554  public Contract setRule(List<ComputableLanguageComponent> theRule) {
13555    this.rule = theRule;
13556    return this;
13557  }
13558
13559  public boolean hasRule() {
13560    if (this.rule == null)
13561      return false;
13562    for (ComputableLanguageComponent item : this.rule)
13563      if (!item.isEmpty())
13564        return true;
13565    return false;
13566  }
13567
13568  public ComputableLanguageComponent addRule() { // 3
13569    ComputableLanguageComponent t = new ComputableLanguageComponent();
13570    if (this.rule == null)
13571      this.rule = new ArrayList<ComputableLanguageComponent>();
13572    this.rule.add(t);
13573    return t;
13574  }
13575
13576  public Contract addRule(ComputableLanguageComponent t) { // 3
13577    if (t == null)
13578      return this;
13579    if (this.rule == null)
13580      this.rule = new ArrayList<ComputableLanguageComponent>();
13581    this.rule.add(t);
13582    return this;
13583  }
13584
13585  /**
13586   * @return The first repetition of repeating field {@link #rule}, creating it if
13587   *         it does not already exist
13588   */
13589  public ComputableLanguageComponent getRuleFirstRep() {
13590    if (getRule().isEmpty()) {
13591      addRule();
13592    }
13593    return getRule().get(0);
13594  }
13595
13596  /**
13597   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13598   *         and legally recognized representation of the Contract, which is
13599   *         considered the "source of truth" and which would be the basis for
13600   *         legal action related to enforcement of this Contract.)
13601   */
13602  public Type getLegallyBinding() {
13603    return this.legallyBinding;
13604  }
13605
13606  /**
13607   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13608   *         and legally recognized representation of the Contract, which is
13609   *         considered the "source of truth" and which would be the basis for
13610   *         legal action related to enforcement of this Contract.)
13611   */
13612  public Attachment getLegallyBindingAttachment() throws FHIRException {
13613    if (this.legallyBinding == null)
13614      this.legallyBinding = new Attachment();
13615    if (!(this.legallyBinding instanceof Attachment))
13616      throw new FHIRException("Type mismatch: the type Attachment was expected, but "
13617          + this.legallyBinding.getClass().getName() + " was encountered");
13618    return (Attachment) this.legallyBinding;
13619  }
13620
13621  public boolean hasLegallyBindingAttachment() {
13622    return this != null && this.legallyBinding instanceof Attachment;
13623  }
13624
13625  /**
13626   * @return {@link #legallyBinding} (Legally binding Contract: This is the signed
13627   *         and legally recognized representation of the Contract, which is
13628   *         considered the "source of truth" and which would be the basis for
13629   *         legal action related to enforcement of this Contract.)
13630   */
13631  public Reference getLegallyBindingReference() throws FHIRException {
13632    if (this.legallyBinding == null)
13633      this.legallyBinding = new Reference();
13634    if (!(this.legallyBinding instanceof Reference))
13635      throw new FHIRException("Type mismatch: the type Reference was expected, but "
13636          + this.legallyBinding.getClass().getName() + " was encountered");
13637    return (Reference) this.legallyBinding;
13638  }
13639
13640  public boolean hasLegallyBindingReference() {
13641    return this != null && this.legallyBinding instanceof Reference;
13642  }
13643
13644  public boolean hasLegallyBinding() {
13645    return this.legallyBinding != null && !this.legallyBinding.isEmpty();
13646  }
13647
13648  /**
13649   * @param value {@link #legallyBinding} (Legally binding Contract: This is the
13650   *              signed and legally recognized representation of the Contract,
13651   *              which is considered the "source of truth" and which would be the
13652   *              basis for legal action related to enforcement of this Contract.)
13653   */
13654  public Contract setLegallyBinding(Type value) {
13655    if (value != null && !(value instanceof Attachment || value instanceof Reference))
13656      throw new Error("Not the right type for Contract.legallyBinding[x]: " + value.fhirType());
13657    this.legallyBinding = value;
13658    return this;
13659  }
13660
13661  protected void listChildren(List<Property> children) {
13662    super.listChildren(children);
13663    children.add(new Property("identifier", "Identifier",
13664        "Unique identifier for this Contract or a derivative that references a Source Contract.", 0,
13665        java.lang.Integer.MAX_VALUE, identifier));
13666    children.add(new Property("url", "uri",
13667        "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url));
13668    children.add(new Property("version", "string",
13669        "An edition identifier used for business purposes to label business significant variants.", 0, 1, version));
13670    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13671    children.add(new Property("legalState", "CodeableConcept",
13672        "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.",
13673        0, 1, legalState));
13674    children.add(new Property("instantiatesCanonical", "Reference(Contract)",
13675        "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.",
13676        0, 1, instantiatesCanonical));
13677    children.add(new Property("instantiatesUri", "uri",
13678        "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.",
13679        0, 1, instantiatesUri));
13680    children.add(new Property("contentDerivative", "CodeableConcept",
13681        "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1,
13682        contentDerivative));
13683    children.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued));
13684    children.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0,
13685        1, applies));
13686    children.add(new Property("expirationType", "CodeableConcept",
13687        "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.",
13688        0, 1, expirationType));
13689    children.add(new Property("subject", "Reference(Any)",
13690        "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE,
13691        subject));
13692    children.add(new Property("authority", "Reference(Organization)",
13693        "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.",
13694        0, java.lang.Integer.MAX_VALUE, authority));
13695    children.add(new Property("domain", "Reference(Location)",
13696        "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.",
13697        0, java.lang.Integer.MAX_VALUE, domain));
13698    children.add(new Property("site", "Reference(Location)",
13699        "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE,
13700        site));
13701    children.add(new Property("name", "string",
13702        "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.",
13703        0, 1, name));
13704    children.add(new Property("title", "string",
13705        "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13706        0, 1, title));
13707    children.add(new Property("subtitle", "string",
13708        "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.",
13709        0, 1, subtitle));
13710    children.add(new Property("alias", "string",
13711        "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.",
13712        0, java.lang.Integer.MAX_VALUE, alias));
13713    children.add(new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)",
13714        "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.",
13715        0, 1, author));
13716    children.add(new Property("scope", "CodeableConcept",
13717        "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0, 1,
13718        scope));
13719    children.add(new Property("topic[x]", "CodeableConcept|Reference(Any)",
13720        "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13721        topic));
13722    children.add(new Property("type", "CodeableConcept",
13723        "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.",
13724        0, 1, type));
13725    children.add(new Property("subType", "CodeableConcept",
13726        "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.",
13727        0, java.lang.Integer.MAX_VALUE, subType));
13728    children.add(new Property("contentDefinition", "",
13729        "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.",
13730        0, 1, contentDefinition));
13731    children.add(new Property("term", "",
13732        "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.",
13733        0, java.lang.Integer.MAX_VALUE, term));
13734    children.add(new Property("supportingInfo", "Reference(Any)",
13735        "Information that may be needed by/relevant to the performer in their execution of this term action.", 0,
13736        java.lang.Integer.MAX_VALUE, supportingInfo));
13737    children.add(new Property("relevantHistory", "Reference(Provenance)",
13738        "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.",
13739        0, java.lang.Integer.MAX_VALUE, relevantHistory));
13740    children.add(new Property("signer", "",
13741        "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.",
13742        0, java.lang.Integer.MAX_VALUE, signer));
13743    children.add(new Property("friendly", "",
13744        "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.",
13745        0, java.lang.Integer.MAX_VALUE, friendly));
13746    children.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0,
13747        java.lang.Integer.MAX_VALUE, legal));
13748    children.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.",
13749        0, java.lang.Integer.MAX_VALUE, rule));
13750    children.add(new Property("legallyBinding[x]",
13751        "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13752        "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.",
13753        0, 1, legallyBinding));
13754  }
13755
13756  @Override
13757  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13758    switch (_hash) {
13759    case -1618432855:
13760      /* identifier */ return new Property("identifier", "Identifier",
13761          "Unique identifier for this Contract or a derivative that references a Source Contract.", 0,
13762          java.lang.Integer.MAX_VALUE, identifier);
13763    case 116079:
13764      /* url */ return new Property("url", "uri",
13765          "Canonical identifier for this contract, represented as a URI (globally unique).", 0, 1, url);
13766    case 351608024:
13767      /* version */ return new Property("version", "string",
13768          "An edition identifier used for business purposes to label business significant variants.", 0, 1, version);
13769    case -892481550:
13770      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
13771    case 568606040:
13772      /* legalState */ return new Property("legalState", "CodeableConcept",
13773          "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.",
13774          0, 1, legalState);
13775    case 8911915:
13776      /* instantiatesCanonical */ return new Property("instantiatesCanonical", "Reference(Contract)",
13777          "The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.",
13778          0, 1, instantiatesCanonical);
13779    case -1926393373:
13780      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
13781          "The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.",
13782          0, 1, instantiatesUri);
13783    case -92412192:
13784      /* contentDerivative */ return new Property("contentDerivative", "CodeableConcept",
13785          "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1,
13786          contentDerivative);
13787    case -1179159893:
13788      /* issued */ return new Property("issued", "dateTime", "When this  Contract was issued.", 0, 1, issued);
13789    case -793235316:
13790      /* applies */ return new Property("applies", "Period",
13791          "Relevant time or time-period when this Contract is applicable.", 0, 1, applies);
13792    case -668311927:
13793      /* expirationType */ return new Property("expirationType", "CodeableConcept",
13794          "Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.",
13795          0, 1, expirationType);
13796    case -1867885268:
13797      /* subject */ return new Property("subject", "Reference(Any)",
13798          "The target entity impacted by or of interest to parties to the agreement.", 0, java.lang.Integer.MAX_VALUE,
13799          subject);
13800    case 1475610435:
13801      /* authority */ return new Property("authority", "Reference(Organization)",
13802          "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.",
13803          0, java.lang.Integer.MAX_VALUE, authority);
13804    case -1326197564:
13805      /* domain */ return new Property("domain", "Reference(Location)",
13806          "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.",
13807          0, java.lang.Integer.MAX_VALUE, domain);
13808    case 3530567:
13809      /* site */ return new Property("site", "Reference(Location)",
13810          "Sites in which the contract is complied with,  exercised, or in force.", 0, java.lang.Integer.MAX_VALUE,
13811          site);
13812    case 3373707:
13813      /* name */ return new Property("name", "string",
13814          "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.",
13815          0, 1, name);
13816    case 110371416:
13817      /* title */ return new Property("title", "string",
13818          "A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.t giving additional information about its content.",
13819          0, 1, title);
13820    case -2060497896:
13821      /* subtitle */ return new Property("subtitle", "string",
13822          "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.",
13823          0, 1, subtitle);
13824    case 92902992:
13825      /* alias */ return new Property("alias", "string",
13826          "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.",
13827          0, java.lang.Integer.MAX_VALUE, alias);
13828    case -1406328437:
13829      /* author */ return new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Organization)",
13830          "The individual or organization that authored the Contract definition, derivative, or instance in any legal state.",
13831          0, 1, author);
13832    case 109264468:
13833      /* scope */ return new Property("scope", "CodeableConcept",
13834          "A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.", 0,
13835          1, scope);
13836    case -957295375:
13837      /* topic[x] */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13838          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13839          topic);
13840    case 110546223:
13841      /* topic */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13842          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13843          topic);
13844    case 777778802:
13845      /* topicCodeableConcept */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13846          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13847          topic);
13848    case -343345444:
13849      /* topicReference */ return new Property("topic[x]", "CodeableConcept|Reference(Any)",
13850          "Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.", 0, 1,
13851          topic);
13852    case 3575610:
13853      /* type */ return new Property("type", "CodeableConcept",
13854          "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.",
13855          0, 1, type);
13856    case -1868521062:
13857      /* subType */ return new Property("subType", "CodeableConcept",
13858          "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.",
13859          0, java.lang.Integer.MAX_VALUE, subType);
13860    case 247055020:
13861      /* contentDefinition */ return new Property("contentDefinition", "",
13862          "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.",
13863          0, 1, contentDefinition);
13864    case 3556460:
13865      /* term */ return new Property("term", "",
13866          "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.",
13867          0, java.lang.Integer.MAX_VALUE, term);
13868    case 1922406657:
13869      /* supportingInfo */ return new Property("supportingInfo", "Reference(Any)",
13870          "Information that may be needed by/relevant to the performer in their execution of this term action.", 0,
13871          java.lang.Integer.MAX_VALUE, supportingInfo);
13872    case 1538891575:
13873      /* relevantHistory */ return new Property("relevantHistory", "Reference(Provenance)",
13874          "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.",
13875          0, java.lang.Integer.MAX_VALUE, relevantHistory);
13876    case -902467798:
13877      /* signer */ return new Property("signer", "",
13878          "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.",
13879          0, java.lang.Integer.MAX_VALUE, signer);
13880    case -1423054677:
13881      /* friendly */ return new Property("friendly", "",
13882          "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.",
13883          0, java.lang.Integer.MAX_VALUE, friendly);
13884    case 102851257:
13885      /* legal */ return new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0,
13886          java.lang.Integer.MAX_VALUE, legal);
13887    case 3512060:
13888      /* rule */ return new Property("rule", "",
13889          "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE,
13890          rule);
13891    case -772497791:
13892      /* legallyBinding[x] */ return new Property("legallyBinding[x]",
13893          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13894          "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.",
13895          0, 1, legallyBinding);
13896    case -126751329:
13897      /* legallyBinding */ return new Property("legallyBinding[x]",
13898          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13899          "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.",
13900          0, 1, legallyBinding);
13901    case 344057890:
13902      /* legallyBindingAttachment */ return new Property("legallyBinding[x]",
13903          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13904          "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.",
13905          0, 1, legallyBinding);
13906    case -296528788:
13907      /* legallyBindingReference */ return new Property("legallyBinding[x]",
13908          "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse|Contract)",
13909          "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.",
13910          0, 1, legallyBinding);
13911    default:
13912      return super.getNamedProperty(_hash, _name, _checkValid);
13913    }
13914
13915  }
13916
13917  @Override
13918  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13919    switch (hash) {
13920    case -1618432855:
13921      /* identifier */ return this.identifier == null ? new Base[0]
13922          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
13923    case 116079:
13924      /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
13925    case 351608024:
13926      /* version */ return this.version == null ? new Base[0] : new Base[] { this.version }; // StringType
13927    case -892481550:
13928      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ContractStatus>
13929    case 568606040:
13930      /* legalState */ return this.legalState == null ? new Base[0] : new Base[] { this.legalState }; // CodeableConcept
13931    case 8911915:
13932      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
13933          : new Base[] { this.instantiatesCanonical }; // Reference
13934    case -1926393373:
13935      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0] : new Base[] { this.instantiatesUri }; // UriType
13936    case -92412192:
13937      /* contentDerivative */ return this.contentDerivative == null ? new Base[0]
13938          : new Base[] { this.contentDerivative }; // CodeableConcept
13939    case -1179159893:
13940      /* issued */ return this.issued == null ? new Base[0] : new Base[] { this.issued }; // DateTimeType
13941    case -793235316:
13942      /* applies */ return this.applies == null ? new Base[0] : new Base[] { this.applies }; // Period
13943    case -668311927:
13944      /* expirationType */ return this.expirationType == null ? new Base[0] : new Base[] { this.expirationType }; // CodeableConcept
13945    case -1867885268:
13946      /* subject */ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
13947    case 1475610435:
13948      /* authority */ return this.authority == null ? new Base[0]
13949          : this.authority.toArray(new Base[this.authority.size()]); // Reference
13950    case -1326197564:
13951      /* domain */ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // Reference
13952    case 3530567:
13953      /* site */ return this.site == null ? new Base[0] : this.site.toArray(new Base[this.site.size()]); // Reference
13954    case 3373707:
13955      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
13956    case 110371416:
13957      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
13958    case -2060497896:
13959      /* subtitle */ return this.subtitle == null ? new Base[0] : new Base[] { this.subtitle }; // StringType
13960    case 92902992:
13961      /* alias */ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
13962    case -1406328437:
13963      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
13964    case 109264468:
13965      /* scope */ return this.scope == null ? new Base[0] : new Base[] { this.scope }; // CodeableConcept
13966    case 110546223:
13967      /* topic */ return this.topic == null ? new Base[0] : new Base[] { this.topic }; // Type
13968    case 3575610:
13969      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
13970    case -1868521062:
13971      /* subType */ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
13972    case 247055020:
13973      /* contentDefinition */ return this.contentDefinition == null ? new Base[0]
13974          : new Base[] { this.contentDefinition }; // ContentDefinitionComponent
13975    case 3556460:
13976      /* term */ return this.term == null ? new Base[0] : this.term.toArray(new Base[this.term.size()]); // TermComponent
13977    case 1922406657:
13978      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
13979          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
13980    case 1538891575:
13981      /* relevantHistory */ return this.relevantHistory == null ? new Base[0]
13982          : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
13983    case -902467798:
13984      /* signer */ return this.signer == null ? new Base[0] : this.signer.toArray(new Base[this.signer.size()]); // SignatoryComponent
13985    case -1423054677:
13986      /* friendly */ return this.friendly == null ? new Base[0] : this.friendly.toArray(new Base[this.friendly.size()]); // FriendlyLanguageComponent
13987    case 102851257:
13988      /* legal */ return this.legal == null ? new Base[0] : this.legal.toArray(new Base[this.legal.size()]); // LegalLanguageComponent
13989    case 3512060:
13990      /* rule */ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // ComputableLanguageComponent
13991    case -126751329:
13992      /* legallyBinding */ return this.legallyBinding == null ? new Base[0] : new Base[] { this.legallyBinding }; // Type
13993    default:
13994      return super.getProperty(hash, name, checkValid);
13995    }
13996
13997  }
13998
13999  @Override
14000  public Base setProperty(int hash, String name, Base value) throws FHIRException {
14001    switch (hash) {
14002    case -1618432855: // identifier
14003      this.getIdentifier().add(castToIdentifier(value)); // Identifier
14004      return value;
14005    case 116079: // url
14006      this.url = castToUri(value); // UriType
14007      return value;
14008    case 351608024: // version
14009      this.version = castToString(value); // StringType
14010      return value;
14011    case -892481550: // status
14012      value = new ContractStatusEnumFactory().fromType(castToCode(value));
14013      this.status = (Enumeration) value; // Enumeration<ContractStatus>
14014      return value;
14015    case 568606040: // legalState
14016      this.legalState = castToCodeableConcept(value); // CodeableConcept
14017      return value;
14018    case 8911915: // instantiatesCanonical
14019      this.instantiatesCanonical = castToReference(value); // Reference
14020      return value;
14021    case -1926393373: // instantiatesUri
14022      this.instantiatesUri = castToUri(value); // UriType
14023      return value;
14024    case -92412192: // contentDerivative
14025      this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
14026      return value;
14027    case -1179159893: // issued
14028      this.issued = castToDateTime(value); // DateTimeType
14029      return value;
14030    case -793235316: // applies
14031      this.applies = castToPeriod(value); // Period
14032      return value;
14033    case -668311927: // expirationType
14034      this.expirationType = castToCodeableConcept(value); // CodeableConcept
14035      return value;
14036    case -1867885268: // subject
14037      this.getSubject().add(castToReference(value)); // Reference
14038      return value;
14039    case 1475610435: // authority
14040      this.getAuthority().add(castToReference(value)); // Reference
14041      return value;
14042    case -1326197564: // domain
14043      this.getDomain().add(castToReference(value)); // Reference
14044      return value;
14045    case 3530567: // site
14046      this.getSite().add(castToReference(value)); // Reference
14047      return value;
14048    case 3373707: // name
14049      this.name = castToString(value); // StringType
14050      return value;
14051    case 110371416: // title
14052      this.title = castToString(value); // StringType
14053      return value;
14054    case -2060497896: // subtitle
14055      this.subtitle = castToString(value); // StringType
14056      return value;
14057    case 92902992: // alias
14058      this.getAlias().add(castToString(value)); // StringType
14059      return value;
14060    case -1406328437: // author
14061      this.author = castToReference(value); // Reference
14062      return value;
14063    case 109264468: // scope
14064      this.scope = castToCodeableConcept(value); // CodeableConcept
14065      return value;
14066    case 110546223: // topic
14067      this.topic = castToType(value); // Type
14068      return value;
14069    case 3575610: // type
14070      this.type = castToCodeableConcept(value); // CodeableConcept
14071      return value;
14072    case -1868521062: // subType
14073      this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
14074      return value;
14075    case 247055020: // contentDefinition
14076      this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
14077      return value;
14078    case 3556460: // term
14079      this.getTerm().add((TermComponent) value); // TermComponent
14080      return value;
14081    case 1922406657: // supportingInfo
14082      this.getSupportingInfo().add(castToReference(value)); // Reference
14083      return value;
14084    case 1538891575: // relevantHistory
14085      this.getRelevantHistory().add(castToReference(value)); // Reference
14086      return value;
14087    case -902467798: // signer
14088      this.getSigner().add((SignatoryComponent) value); // SignatoryComponent
14089      return value;
14090    case -1423054677: // friendly
14091      this.getFriendly().add((FriendlyLanguageComponent) value); // FriendlyLanguageComponent
14092      return value;
14093    case 102851257: // legal
14094      this.getLegal().add((LegalLanguageComponent) value); // LegalLanguageComponent
14095      return value;
14096    case 3512060: // rule
14097      this.getRule().add((ComputableLanguageComponent) value); // ComputableLanguageComponent
14098      return value;
14099    case -126751329: // legallyBinding
14100      this.legallyBinding = castToType(value); // Type
14101      return value;
14102    default:
14103      return super.setProperty(hash, name, value);
14104    }
14105
14106  }
14107
14108  @Override
14109  public Base setProperty(String name, Base value) throws FHIRException {
14110    if (name.equals("identifier")) {
14111      this.getIdentifier().add(castToIdentifier(value));
14112    } else if (name.equals("url")) {
14113      this.url = castToUri(value); // UriType
14114    } else if (name.equals("version")) {
14115      this.version = castToString(value); // StringType
14116    } else if (name.equals("status")) {
14117      value = new ContractStatusEnumFactory().fromType(castToCode(value));
14118      this.status = (Enumeration) value; // Enumeration<ContractStatus>
14119    } else if (name.equals("legalState")) {
14120      this.legalState = castToCodeableConcept(value); // CodeableConcept
14121    } else if (name.equals("instantiatesCanonical")) {
14122      this.instantiatesCanonical = castToReference(value); // Reference
14123    } else if (name.equals("instantiatesUri")) {
14124      this.instantiatesUri = castToUri(value); // UriType
14125    } else if (name.equals("contentDerivative")) {
14126      this.contentDerivative = castToCodeableConcept(value); // CodeableConcept
14127    } else if (name.equals("issued")) {
14128      this.issued = castToDateTime(value); // DateTimeType
14129    } else if (name.equals("applies")) {
14130      this.applies = castToPeriod(value); // Period
14131    } else if (name.equals("expirationType")) {
14132      this.expirationType = castToCodeableConcept(value); // CodeableConcept
14133    } else if (name.equals("subject")) {
14134      this.getSubject().add(castToReference(value));
14135    } else if (name.equals("authority")) {
14136      this.getAuthority().add(castToReference(value));
14137    } else if (name.equals("domain")) {
14138      this.getDomain().add(castToReference(value));
14139    } else if (name.equals("site")) {
14140      this.getSite().add(castToReference(value));
14141    } else if (name.equals("name")) {
14142      this.name = castToString(value); // StringType
14143    } else if (name.equals("title")) {
14144      this.title = castToString(value); // StringType
14145    } else if (name.equals("subtitle")) {
14146      this.subtitle = castToString(value); // StringType
14147    } else if (name.equals("alias")) {
14148      this.getAlias().add(castToString(value));
14149    } else if (name.equals("author")) {
14150      this.author = castToReference(value); // Reference
14151    } else if (name.equals("scope")) {
14152      this.scope = castToCodeableConcept(value); // CodeableConcept
14153    } else if (name.equals("topic[x]")) {
14154      this.topic = castToType(value); // Type
14155    } else if (name.equals("type")) {
14156      this.type = castToCodeableConcept(value); // CodeableConcept
14157    } else if (name.equals("subType")) {
14158      this.getSubType().add(castToCodeableConcept(value));
14159    } else if (name.equals("contentDefinition")) {
14160      this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
14161    } else if (name.equals("term")) {
14162      this.getTerm().add((TermComponent) value);
14163    } else if (name.equals("supportingInfo")) {
14164      this.getSupportingInfo().add(castToReference(value));
14165    } else if (name.equals("relevantHistory")) {
14166      this.getRelevantHistory().add(castToReference(value));
14167    } else if (name.equals("signer")) {
14168      this.getSigner().add((SignatoryComponent) value);
14169    } else if (name.equals("friendly")) {
14170      this.getFriendly().add((FriendlyLanguageComponent) value);
14171    } else if (name.equals("legal")) {
14172      this.getLegal().add((LegalLanguageComponent) value);
14173    } else if (name.equals("rule")) {
14174      this.getRule().add((ComputableLanguageComponent) value);
14175    } else if (name.equals("legallyBinding[x]")) {
14176      this.legallyBinding = castToType(value); // Type
14177    } else
14178      return super.setProperty(name, value);
14179    return value;
14180  }
14181
14182  @Override
14183  public void removeChild(String name, Base value) throws FHIRException {
14184    if (name.equals("identifier")) {
14185      this.getIdentifier().remove(castToIdentifier(value));
14186    } else if (name.equals("url")) {
14187      this.url = null;
14188    } else if (name.equals("version")) {
14189      this.version = null;
14190    } else if (name.equals("status")) {
14191      this.status = null;
14192    } else if (name.equals("legalState")) {
14193      this.legalState = null;
14194    } else if (name.equals("instantiatesCanonical")) {
14195      this.instantiatesCanonical = null;
14196    } else if (name.equals("instantiatesUri")) {
14197      this.instantiatesUri = null;
14198    } else if (name.equals("contentDerivative")) {
14199      this.contentDerivative = null;
14200    } else if (name.equals("issued")) {
14201      this.issued = null;
14202    } else if (name.equals("applies")) {
14203      this.applies = null;
14204    } else if (name.equals("expirationType")) {
14205      this.expirationType = null;
14206    } else if (name.equals("subject")) {
14207      this.getSubject().remove(castToReference(value));
14208    } else if (name.equals("authority")) {
14209      this.getAuthority().remove(castToReference(value));
14210    } else if (name.equals("domain")) {
14211      this.getDomain().remove(castToReference(value));
14212    } else if (name.equals("site")) {
14213      this.getSite().remove(castToReference(value));
14214    } else if (name.equals("name")) {
14215      this.name = null;
14216    } else if (name.equals("title")) {
14217      this.title = null;
14218    } else if (name.equals("subtitle")) {
14219      this.subtitle = null;
14220    } else if (name.equals("alias")) {
14221      this.getAlias().remove(castToString(value));
14222    } else if (name.equals("author")) {
14223      this.author = null;
14224    } else if (name.equals("scope")) {
14225      this.scope = null;
14226    } else if (name.equals("topic[x]")) {
14227      this.topic = null;
14228    } else if (name.equals("type")) {
14229      this.type = null;
14230    } else if (name.equals("subType")) {
14231      this.getSubType().remove(castToCodeableConcept(value));
14232    } else if (name.equals("contentDefinition")) {
14233      this.contentDefinition = (ContentDefinitionComponent) value; // ContentDefinitionComponent
14234    } else if (name.equals("term")) {
14235      this.getTerm().remove((TermComponent) value);
14236    } else if (name.equals("supportingInfo")) {
14237      this.getSupportingInfo().remove(castToReference(value));
14238    } else if (name.equals("relevantHistory")) {
14239      this.getRelevantHistory().remove(castToReference(value));
14240    } else if (name.equals("signer")) {
14241      this.getSigner().remove((SignatoryComponent) value);
14242    } else if (name.equals("friendly")) {
14243      this.getFriendly().remove((FriendlyLanguageComponent) value);
14244    } else if (name.equals("legal")) {
14245      this.getLegal().remove((LegalLanguageComponent) value);
14246    } else if (name.equals("rule")) {
14247      this.getRule().remove((ComputableLanguageComponent) value);
14248    } else if (name.equals("legallyBinding[x]")) {
14249      this.legallyBinding = null;
14250    } else
14251      super.removeChild(name, value);
14252    
14253  }
14254
14255  @Override
14256  public Base makeProperty(int hash, String name) throws FHIRException {
14257    switch (hash) {
14258    case -1618432855:
14259      return addIdentifier();
14260    case 116079:
14261      return getUrlElement();
14262    case 351608024:
14263      return getVersionElement();
14264    case -892481550:
14265      return getStatusElement();
14266    case 568606040:
14267      return getLegalState();
14268    case 8911915:
14269      return getInstantiatesCanonical();
14270    case -1926393373:
14271      return getInstantiatesUriElement();
14272    case -92412192:
14273      return getContentDerivative();
14274    case -1179159893:
14275      return getIssuedElement();
14276    case -793235316:
14277      return getApplies();
14278    case -668311927:
14279      return getExpirationType();
14280    case -1867885268:
14281      return addSubject();
14282    case 1475610435:
14283      return addAuthority();
14284    case -1326197564:
14285      return addDomain();
14286    case 3530567:
14287      return addSite();
14288    case 3373707:
14289      return getNameElement();
14290    case 110371416:
14291      return getTitleElement();
14292    case -2060497896:
14293      return getSubtitleElement();
14294    case 92902992:
14295      return addAliasElement();
14296    case -1406328437:
14297      return getAuthor();
14298    case 109264468:
14299      return getScope();
14300    case -957295375:
14301      return getTopic();
14302    case 110546223:
14303      return getTopic();
14304    case 3575610:
14305      return getType();
14306    case -1868521062:
14307      return addSubType();
14308    case 247055020:
14309      return getContentDefinition();
14310    case 3556460:
14311      return addTerm();
14312    case 1922406657:
14313      return addSupportingInfo();
14314    case 1538891575:
14315      return addRelevantHistory();
14316    case -902467798:
14317      return addSigner();
14318    case -1423054677:
14319      return addFriendly();
14320    case 102851257:
14321      return addLegal();
14322    case 3512060:
14323      return addRule();
14324    case -772497791:
14325      return getLegallyBinding();
14326    case -126751329:
14327      return getLegallyBinding();
14328    default:
14329      return super.makeProperty(hash, name);
14330    }
14331
14332  }
14333
14334  @Override
14335  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14336    switch (hash) {
14337    case -1618432855:
14338      /* identifier */ return new String[] { "Identifier" };
14339    case 116079:
14340      /* url */ return new String[] { "uri" };
14341    case 351608024:
14342      /* version */ return new String[] { "string" };
14343    case -892481550:
14344      /* status */ return new String[] { "code" };
14345    case 568606040:
14346      /* legalState */ return new String[] { "CodeableConcept" };
14347    case 8911915:
14348      /* instantiatesCanonical */ return new String[] { "Reference" };
14349    case -1926393373:
14350      /* instantiatesUri */ return new String[] { "uri" };
14351    case -92412192:
14352      /* contentDerivative */ return new String[] { "CodeableConcept" };
14353    case -1179159893:
14354      /* issued */ return new String[] { "dateTime" };
14355    case -793235316:
14356      /* applies */ return new String[] { "Period" };
14357    case -668311927:
14358      /* expirationType */ return new String[] { "CodeableConcept" };
14359    case -1867885268:
14360      /* subject */ return new String[] { "Reference" };
14361    case 1475610435:
14362      /* authority */ return new String[] { "Reference" };
14363    case -1326197564:
14364      /* domain */ return new String[] { "Reference" };
14365    case 3530567:
14366      /* site */ return new String[] { "Reference" };
14367    case 3373707:
14368      /* name */ return new String[] { "string" };
14369    case 110371416:
14370      /* title */ return new String[] { "string" };
14371    case -2060497896:
14372      /* subtitle */ return new String[] { "string" };
14373    case 92902992:
14374      /* alias */ return new String[] { "string" };
14375    case -1406328437:
14376      /* author */ return new String[] { "Reference" };
14377    case 109264468:
14378      /* scope */ return new String[] { "CodeableConcept" };
14379    case 110546223:
14380      /* topic */ return new String[] { "CodeableConcept", "Reference" };
14381    case 3575610:
14382      /* type */ return new String[] { "CodeableConcept" };
14383    case -1868521062:
14384      /* subType */ return new String[] { "CodeableConcept" };
14385    case 247055020:
14386      /* contentDefinition */ return new String[] {};
14387    case 3556460:
14388      /* term */ return new String[] {};
14389    case 1922406657:
14390      /* supportingInfo */ return new String[] { "Reference" };
14391    case 1538891575:
14392      /* relevantHistory */ return new String[] { "Reference" };
14393    case -902467798:
14394      /* signer */ return new String[] {};
14395    case -1423054677:
14396      /* friendly */ return new String[] {};
14397    case 102851257:
14398      /* legal */ return new String[] {};
14399    case 3512060:
14400      /* rule */ return new String[] {};
14401    case -126751329:
14402      /* legallyBinding */ return new String[] { "Attachment", "Reference" };
14403    default:
14404      return super.getTypesForProperty(hash, name);
14405    }
14406
14407  }
14408
14409  @Override
14410  public Base addChild(String name) throws FHIRException {
14411    if (name.equals("identifier")) {
14412      return addIdentifier();
14413    } else if (name.equals("url")) {
14414      throw new FHIRException("Cannot call addChild on a singleton property Contract.url");
14415    } else if (name.equals("version")) {
14416      throw new FHIRException("Cannot call addChild on a singleton property Contract.version");
14417    } else if (name.equals("status")) {
14418      throw new FHIRException("Cannot call addChild on a singleton property Contract.status");
14419    } else if (name.equals("legalState")) {
14420      this.legalState = new CodeableConcept();
14421      return this.legalState;
14422    } else if (name.equals("instantiatesCanonical")) {
14423      this.instantiatesCanonical = new Reference();
14424      return this.instantiatesCanonical;
14425    } else if (name.equals("instantiatesUri")) {
14426      throw new FHIRException("Cannot call addChild on a singleton property Contract.instantiatesUri");
14427    } else if (name.equals("contentDerivative")) {
14428      this.contentDerivative = new CodeableConcept();
14429      return this.contentDerivative;
14430    } else if (name.equals("issued")) {
14431      throw new FHIRException("Cannot call addChild on a singleton property Contract.issued");
14432    } else if (name.equals("applies")) {
14433      this.applies = new Period();
14434      return this.applies;
14435    } else if (name.equals("expirationType")) {
14436      this.expirationType = new CodeableConcept();
14437      return this.expirationType;
14438    } else if (name.equals("subject")) {
14439      return addSubject();
14440    } else if (name.equals("authority")) {
14441      return addAuthority();
14442    } else if (name.equals("domain")) {
14443      return addDomain();
14444    } else if (name.equals("site")) {
14445      return addSite();
14446    } else if (name.equals("name")) {
14447      throw new FHIRException("Cannot call addChild on a singleton property Contract.name");
14448    } else if (name.equals("title")) {
14449      throw new FHIRException("Cannot call addChild on a singleton property Contract.title");
14450    } else if (name.equals("subtitle")) {
14451      throw new FHIRException("Cannot call addChild on a singleton property Contract.subtitle");
14452    } else if (name.equals("alias")) {
14453      throw new FHIRException("Cannot call addChild on a singleton property Contract.alias");
14454    } else if (name.equals("author")) {
14455      this.author = new Reference();
14456      return this.author;
14457    } else if (name.equals("scope")) {
14458      this.scope = new CodeableConcept();
14459      return this.scope;
14460    } else if (name.equals("topicCodeableConcept")) {
14461      this.topic = new CodeableConcept();
14462      return this.topic;
14463    } else if (name.equals("topicReference")) {
14464      this.topic = new Reference();
14465      return this.topic;
14466    } else if (name.equals("type")) {
14467      this.type = new CodeableConcept();
14468      return this.type;
14469    } else if (name.equals("subType")) {
14470      return addSubType();
14471    } else if (name.equals("contentDefinition")) {
14472      this.contentDefinition = new ContentDefinitionComponent();
14473      return this.contentDefinition;
14474    } else if (name.equals("term")) {
14475      return addTerm();
14476    } else if (name.equals("supportingInfo")) {
14477      return addSupportingInfo();
14478    } else if (name.equals("relevantHistory")) {
14479      return addRelevantHistory();
14480    } else if (name.equals("signer")) {
14481      return addSigner();
14482    } else if (name.equals("friendly")) {
14483      return addFriendly();
14484    } else if (name.equals("legal")) {
14485      return addLegal();
14486    } else if (name.equals("rule")) {
14487      return addRule();
14488    } else if (name.equals("legallyBindingAttachment")) {
14489      this.legallyBinding = new Attachment();
14490      return this.legallyBinding;
14491    } else if (name.equals("legallyBindingReference")) {
14492      this.legallyBinding = new Reference();
14493      return this.legallyBinding;
14494    } else
14495      return super.addChild(name);
14496  }
14497
14498  public String fhirType() {
14499    return "Contract";
14500
14501  }
14502
14503  public Contract copy() {
14504    Contract dst = new Contract();
14505    copyValues(dst);
14506    return dst;
14507  }
14508
14509  public void copyValues(Contract dst) {
14510    super.copyValues(dst);
14511    if (identifier != null) {
14512      dst.identifier = new ArrayList<Identifier>();
14513      for (Identifier i : identifier)
14514        dst.identifier.add(i.copy());
14515    }
14516    ;
14517    dst.url = url == null ? null : url.copy();
14518    dst.version = version == null ? null : version.copy();
14519    dst.status = status == null ? null : status.copy();
14520    dst.legalState = legalState == null ? null : legalState.copy();
14521    dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
14522    dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
14523    dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
14524    dst.issued = issued == null ? null : issued.copy();
14525    dst.applies = applies == null ? null : applies.copy();
14526    dst.expirationType = expirationType == null ? null : expirationType.copy();
14527    if (subject != null) {
14528      dst.subject = new ArrayList<Reference>();
14529      for (Reference i : subject)
14530        dst.subject.add(i.copy());
14531    }
14532    ;
14533    if (authority != null) {
14534      dst.authority = new ArrayList<Reference>();
14535      for (Reference i : authority)
14536        dst.authority.add(i.copy());
14537    }
14538    ;
14539    if (domain != null) {
14540      dst.domain = new ArrayList<Reference>();
14541      for (Reference i : domain)
14542        dst.domain.add(i.copy());
14543    }
14544    ;
14545    if (site != null) {
14546      dst.site = new ArrayList<Reference>();
14547      for (Reference i : site)
14548        dst.site.add(i.copy());
14549    }
14550    ;
14551    dst.name = name == null ? null : name.copy();
14552    dst.title = title == null ? null : title.copy();
14553    dst.subtitle = subtitle == null ? null : subtitle.copy();
14554    if (alias != null) {
14555      dst.alias = new ArrayList<StringType>();
14556      for (StringType i : alias)
14557        dst.alias.add(i.copy());
14558    }
14559    ;
14560    dst.author = author == null ? null : author.copy();
14561    dst.scope = scope == null ? null : scope.copy();
14562    dst.topic = topic == null ? null : topic.copy();
14563    dst.type = type == null ? null : type.copy();
14564    if (subType != null) {
14565      dst.subType = new ArrayList<CodeableConcept>();
14566      for (CodeableConcept i : subType)
14567        dst.subType.add(i.copy());
14568    }
14569    ;
14570    dst.contentDefinition = contentDefinition == null ? null : contentDefinition.copy();
14571    if (term != null) {
14572      dst.term = new ArrayList<TermComponent>();
14573      for (TermComponent i : term)
14574        dst.term.add(i.copy());
14575    }
14576    ;
14577    if (supportingInfo != null) {
14578      dst.supportingInfo = new ArrayList<Reference>();
14579      for (Reference i : supportingInfo)
14580        dst.supportingInfo.add(i.copy());
14581    }
14582    ;
14583    if (relevantHistory != null) {
14584      dst.relevantHistory = new ArrayList<Reference>();
14585      for (Reference i : relevantHistory)
14586        dst.relevantHistory.add(i.copy());
14587    }
14588    ;
14589    if (signer != null) {
14590      dst.signer = new ArrayList<SignatoryComponent>();
14591      for (SignatoryComponent i : signer)
14592        dst.signer.add(i.copy());
14593    }
14594    ;
14595    if (friendly != null) {
14596      dst.friendly = new ArrayList<FriendlyLanguageComponent>();
14597      for (FriendlyLanguageComponent i : friendly)
14598        dst.friendly.add(i.copy());
14599    }
14600    ;
14601    if (legal != null) {
14602      dst.legal = new ArrayList<LegalLanguageComponent>();
14603      for (LegalLanguageComponent i : legal)
14604        dst.legal.add(i.copy());
14605    }
14606    ;
14607    if (rule != null) {
14608      dst.rule = new ArrayList<ComputableLanguageComponent>();
14609      for (ComputableLanguageComponent i : rule)
14610        dst.rule.add(i.copy());
14611    }
14612    ;
14613    dst.legallyBinding = legallyBinding == null ? null : legallyBinding.copy();
14614  }
14615
14616  protected Contract typedCopy() {
14617    return copy();
14618  }
14619
14620  @Override
14621  public boolean equalsDeep(Base other_) {
14622    if (!super.equalsDeep(other_))
14623      return false;
14624    if (!(other_ instanceof Contract))
14625      return false;
14626    Contract o = (Contract) other_;
14627    return compareDeep(identifier, o.identifier, true) && compareDeep(url, o.url, true)
14628        && compareDeep(version, o.version, true) && compareDeep(status, o.status, true)
14629        && compareDeep(legalState, o.legalState, true)
14630        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
14631        && compareDeep(instantiatesUri, o.instantiatesUri, true)
14632        && compareDeep(contentDerivative, o.contentDerivative, true) && compareDeep(issued, o.issued, true)
14633        && compareDeep(applies, o.applies, true) && compareDeep(expirationType, o.expirationType, true)
14634        && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true)
14635        && compareDeep(domain, o.domain, true) && compareDeep(site, o.site, true) && compareDeep(name, o.name, true)
14636        && compareDeep(title, o.title, true) && compareDeep(subtitle, o.subtitle, true)
14637        && compareDeep(alias, o.alias, true) && compareDeep(author, o.author, true) && compareDeep(scope, o.scope, true)
14638        && compareDeep(topic, o.topic, true) && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true)
14639        && compareDeep(contentDefinition, o.contentDefinition, true) && compareDeep(term, o.term, true)
14640        && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(relevantHistory, o.relevantHistory, true)
14641        && compareDeep(signer, o.signer, true) && compareDeep(friendly, o.friendly, true)
14642        && compareDeep(legal, o.legal, true) && compareDeep(rule, o.rule, true)
14643        && compareDeep(legallyBinding, o.legallyBinding, true);
14644  }
14645
14646  @Override
14647  public boolean equalsShallow(Base other_) {
14648    if (!super.equalsShallow(other_))
14649      return false;
14650    if (!(other_ instanceof Contract))
14651      return false;
14652    Contract o = (Contract) other_;
14653    return compareValues(url, o.url, true) && compareValues(version, o.version, true)
14654        && compareValues(status, o.status, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
14655        && compareValues(issued, o.issued, true) && compareValues(name, o.name, true)
14656        && compareValues(title, o.title, true) && compareValues(subtitle, o.subtitle, true)
14657        && compareValues(alias, o.alias, true);
14658  }
14659
14660  public boolean isEmpty() {
14661    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, url, version, status, legalState,
14662        instantiatesCanonical, instantiatesUri, contentDerivative, issued, applies, expirationType, subject, authority,
14663        domain, site, name, title, subtitle, alias, author, scope, topic, type, subType, contentDefinition, term,
14664        supportingInfo, relevantHistory, signer, friendly, legal, rule, legallyBinding);
14665  }
14666
14667  @Override
14668  public ResourceType getResourceType() {
14669    return ResourceType.Contract;
14670  }
14671
14672  /**
14673   * Search parameter: <b>identifier</b>
14674   * <p>
14675   * Description: <b>The identity of the contract</b><br>
14676   * Type: <b>token</b><br>
14677   * Path: <b>Contract.identifier</b><br>
14678   * </p>
14679   */
14680  @SearchParamDefinition(name = "identifier", path = "Contract.identifier", description = "The identity of the contract", type = "token")
14681  public static final String SP_IDENTIFIER = "identifier";
14682  /**
14683   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
14684   * <p>
14685   * Description: <b>The identity of the contract</b><br>
14686   * Type: <b>token</b><br>
14687   * Path: <b>Contract.identifier</b><br>
14688   * </p>
14689   */
14690  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
14691      SP_IDENTIFIER);
14692
14693  /**
14694   * Search parameter: <b>instantiates</b>
14695   * <p>
14696   * Description: <b>A source definition of the contract</b><br>
14697   * Type: <b>uri</b><br>
14698   * Path: <b>Contract.instantiatesUri</b><br>
14699   * </p>
14700   */
14701  @SearchParamDefinition(name = "instantiates", path = "Contract.instantiatesUri", description = "A source definition of the contract", type = "uri")
14702  public static final String SP_INSTANTIATES = "instantiates";
14703  /**
14704   * <b>Fluent Client</b> search parameter constant for <b>instantiates</b>
14705   * <p>
14706   * Description: <b>A source definition of the contract</b><br>
14707   * Type: <b>uri</b><br>
14708   * Path: <b>Contract.instantiatesUri</b><br>
14709   * </p>
14710   */
14711  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES = new ca.uhn.fhir.rest.gclient.UriClientParam(
14712      SP_INSTANTIATES);
14713
14714  /**
14715   * Search parameter: <b>patient</b>
14716   * <p>
14717   * Description: <b>The identity of the subject of the contract (if a
14718   * patient)</b><br>
14719   * Type: <b>reference</b><br>
14720   * Path: <b>Contract.subject</b><br>
14721   * </p>
14722   */
14723  @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 = {
14724      Patient.class })
14725  public static final String SP_PATIENT = "patient";
14726  /**
14727   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
14728   * <p>
14729   * Description: <b>The identity of the subject of the contract (if a
14730   * patient)</b><br>
14731   * Type: <b>reference</b><br>
14732   * Path: <b>Contract.subject</b><br>
14733   * </p>
14734   */
14735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14736      SP_PATIENT);
14737
14738  /**
14739   * Constant for fluent queries to be used to add include statements. Specifies
14740   * the path value of "<b>Contract:patient</b>".
14741   */
14742  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
14743      "Contract:patient").toLocked();
14744
14745  /**
14746   * Search parameter: <b>subject</b>
14747   * <p>
14748   * Description: <b>The identity of the subject of the contract</b><br>
14749   * Type: <b>reference</b><br>
14750   * Path: <b>Contract.subject</b><br>
14751   * </p>
14752   */
14753  @SearchParamDefinition(name = "subject", path = "Contract.subject", description = "The identity of the subject of the contract", type = "reference")
14754  public static final String SP_SUBJECT = "subject";
14755  /**
14756   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
14757   * <p>
14758   * Description: <b>The identity of the subject of the contract</b><br>
14759   * Type: <b>reference</b><br>
14760   * Path: <b>Contract.subject</b><br>
14761   * </p>
14762   */
14763  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14764      SP_SUBJECT);
14765
14766  /**
14767   * Constant for fluent queries to be used to add include statements. Specifies
14768   * the path value of "<b>Contract:subject</b>".
14769   */
14770  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
14771      "Contract:subject").toLocked();
14772
14773  /**
14774   * Search parameter: <b>authority</b>
14775   * <p>
14776   * Description: <b>The authority of the contract</b><br>
14777   * Type: <b>reference</b><br>
14778   * Path: <b>Contract.authority</b><br>
14779   * </p>
14780   */
14781  @SearchParamDefinition(name = "authority", path = "Contract.authority", description = "The authority of the contract", type = "reference", target = {
14782      Organization.class })
14783  public static final String SP_AUTHORITY = "authority";
14784  /**
14785   * <b>Fluent Client</b> search parameter constant for <b>authority</b>
14786   * <p>
14787   * Description: <b>The authority of the contract</b><br>
14788   * Type: <b>reference</b><br>
14789   * Path: <b>Contract.authority</b><br>
14790   * </p>
14791   */
14792  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHORITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14793      SP_AUTHORITY);
14794
14795  /**
14796   * Constant for fluent queries to be used to add include statements. Specifies
14797   * the path value of "<b>Contract:authority</b>".
14798   */
14799  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHORITY = new ca.uhn.fhir.model.api.Include(
14800      "Contract:authority").toLocked();
14801
14802  /**
14803   * Search parameter: <b>domain</b>
14804   * <p>
14805   * Description: <b>The domain of the contract</b><br>
14806   * Type: <b>reference</b><br>
14807   * Path: <b>Contract.domain</b><br>
14808   * </p>
14809   */
14810  @SearchParamDefinition(name = "domain", path = "Contract.domain", description = "The domain of the contract", type = "reference", target = {
14811      Location.class })
14812  public static final String SP_DOMAIN = "domain";
14813  /**
14814   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
14815   * <p>
14816   * Description: <b>The domain of the contract</b><br>
14817   * Type: <b>reference</b><br>
14818   * Path: <b>Contract.domain</b><br>
14819   * </p>
14820   */
14821  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14822      SP_DOMAIN);
14823
14824  /**
14825   * Constant for fluent queries to be used to add include statements. Specifies
14826   * the path value of "<b>Contract:domain</b>".
14827   */
14828  public static final ca.uhn.fhir.model.api.Include INCLUDE_DOMAIN = new ca.uhn.fhir.model.api.Include(
14829      "Contract:domain").toLocked();
14830
14831  /**
14832   * Search parameter: <b>issued</b>
14833   * <p>
14834   * Description: <b>The date/time the contract was issued</b><br>
14835   * Type: <b>date</b><br>
14836   * Path: <b>Contract.issued</b><br>
14837   * </p>
14838   */
14839  @SearchParamDefinition(name = "issued", path = "Contract.issued", description = "The date/time the contract was issued", type = "date")
14840  public static final String SP_ISSUED = "issued";
14841  /**
14842   * <b>Fluent Client</b> search parameter constant for <b>issued</b>
14843   * <p>
14844   * Description: <b>The date/time the contract was issued</b><br>
14845   * Type: <b>date</b><br>
14846   * Path: <b>Contract.issued</b><br>
14847   * </p>
14848   */
14849  public static final ca.uhn.fhir.rest.gclient.DateClientParam ISSUED = new ca.uhn.fhir.rest.gclient.DateClientParam(
14850      SP_ISSUED);
14851
14852  /**
14853   * Search parameter: <b>url</b>
14854   * <p>
14855   * Description: <b>The basal contract definition</b><br>
14856   * Type: <b>uri</b><br>
14857   * Path: <b>Contract.url</b><br>
14858   * </p>
14859   */
14860  @SearchParamDefinition(name = "url", path = "Contract.url", description = "The basal contract definition", type = "uri")
14861  public static final String SP_URL = "url";
14862  /**
14863   * <b>Fluent Client</b> search parameter constant for <b>url</b>
14864   * <p>
14865   * Description: <b>The basal contract definition</b><br>
14866   * Type: <b>uri</b><br>
14867   * Path: <b>Contract.url</b><br>
14868   * </p>
14869   */
14870  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
14871
14872  /**
14873   * Search parameter: <b>signer</b>
14874   * <p>
14875   * Description: <b>Contract Signatory Party</b><br>
14876   * Type: <b>reference</b><br>
14877   * Path: <b>Contract.signer.party</b><br>
14878   * </p>
14879   */
14880  @SearchParamDefinition(name = "signer", path = "Contract.signer.party", description = "Contract Signatory Party", type = "reference", target = {
14881      Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
14882  public static final String SP_SIGNER = "signer";
14883  /**
14884   * <b>Fluent Client</b> search parameter constant for <b>signer</b>
14885   * <p>
14886   * Description: <b>Contract Signatory Party</b><br>
14887   * Type: <b>reference</b><br>
14888   * Path: <b>Contract.signer.party</b><br>
14889   * </p>
14890   */
14891  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SIGNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
14892      SP_SIGNER);
14893
14894  /**
14895   * Constant for fluent queries to be used to add include statements. Specifies
14896   * the path value of "<b>Contract:signer</b>".
14897   */
14898  public static final ca.uhn.fhir.model.api.Include INCLUDE_SIGNER = new ca.uhn.fhir.model.api.Include(
14899      "Contract:signer").toLocked();
14900
14901  /**
14902   * Search parameter: <b>status</b>
14903   * <p>
14904   * Description: <b>The status of the contract</b><br>
14905   * Type: <b>token</b><br>
14906   * Path: <b>Contract.status</b><br>
14907   * </p>
14908   */
14909  @SearchParamDefinition(name = "status", path = "Contract.status", description = "The status of the contract", type = "token")
14910  public static final String SP_STATUS = "status";
14911  /**
14912   * <b>Fluent Client</b> search parameter constant for <b>status</b>
14913   * <p>
14914   * Description: <b>The status of the contract</b><br>
14915   * Type: <b>token</b><br>
14916   * Path: <b>Contract.status</b><br>
14917   * </p>
14918   */
14919  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
14920      SP_STATUS);
14921
14922}