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    }