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