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