示例#1
0
 public void onCancel(AjaxRequestTarget target) {
   IStageExecution exec = activeInterviewService.getStageExecution((Stage) stageModel.getObject());
   ActionDefinition actionDef = exec.getActionDefinition(ActionType.STOP);
   if (actionDef != null) {
     getActionWindow().show(target, stageModel, actionDef);
   }
 }
示例#2
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);
   }
 }
示例#3
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();");
  }
  public Boolean isDependencySatisfied(Stage stage, ActiveInterviewService activeInterviewService) {
    // every other stages need to be completed except itself
    for (Module module : moduleRegistry.getModules()) {
      for (Stage oneStage : module.getStages()) {
        if (!stage.equals(oneStage)) {
          IStageExecution stageExecution =
              activeInterviewService.getStageExecution(oneStage.getName());
          if (!stageExecution.isCompleted()) {
            // At least one stage is not complete, return null since
            log.debug(
                "Dependendant module {} not complete due to stage {}",
                module.getName(),
                oneStage.getName());
            return null;
          }
        }
      }
    }

    return true;
  }