Example #1
0
 @Override
 public void onFinish(AjaxRequestTarget target, Form form) {
   IStageExecution exec = activeInterviewService.getStageExecution((Stage) stageModel.getObject());
   ActionDefinition actionDef = exec.getSystemActionDefinition(ActionType.COMPLETE);
   if (actionDef != null) {
     getActionWindow().show(target, stageModel, actionDef);
   }
 }
Example #2
0
  public void onFinish(AjaxRequestTarget target, Form form) {
    Boolean consentIsSubmitted = activeConsentService.isConsentFormSubmitted();
    Boolean consentIsAccepted = activeConsentService.getConsent().isAccepted();
    Boolean consentIsElectronic =
        activeConsentService.getConsent().getMode() == ConsentMode.ELECTRONIC ? true : false;

    // Consent not submitted, inform the user that the submit button (PDF form) has to be clicked.
    if (!consentIsSubmitted) {
      error(getString("MissingConsentForm"));
      onError(target, form);

      // Invalid electronic consent.
    } else if (consentIsAccepted
        && consentIsElectronic
        && !activeConsentService.validateElectronicConsent()) {
      error(getString("InvalidConsentForm"));
      getElectronicConsentStep().setNextStep(null);
      gotoNext(target);
      this.changeWizardFormStyle("wizard-consent");
      onError(target, form);

      // Valid electronic consent, refused electronic consent, or manual consent.
    } else {
      IStageExecution exec =
          activeInterviewService.getStageExecution((Stage) stageModel.getObject());
      ActionDefinition actionDef = exec.getSystemActionDefinition(ActionType.COMPLETE);

      // Delete previous consent (if exist) for that interview
      Consent existingConsent = consentService.getConsent(activeInterviewService.getInterview());
      if (existingConsent != null) {
        consentService.deletePreviousConsent(activeInterviewService.getInterview());
      }

      // Save the consent
      consentService.saveConsent(activeConsentService.getConsent());

      if (actionDef != null) {
        getActionWindow().show(target, stageModel, actionDef);
      }
    }

    target.appendJavascript("Resizer.resizeWizard();");
    target.appendJavascript("Resizer.resizeConsentFrame();");
  }