public ActionForward uploadDocument(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixFilterException, FenixServiceException, IOException {
    CandidacyProcessDocumentUploadBean uploadBean =
        (CandidacyProcessDocumentUploadBean)
            getObjectFromViewState("individualCandidacyProcessBean.document");
    try {
      IndividualCandidacyDocumentFile documentFile =
          createIndividualCandidacyDocumentFile(
              uploadBean,
              uploadBean
                  .getIndividualCandidacyProcess()
                  .getPersonalDetails()
                  .getDocumentIdNumber());
      uploadBean.setDocumentFile(documentFile);

      executeActivity(getProcess(request), "EditDocuments", uploadBean);
    } catch (DomainException e) {
      addActionMessage(request, e.getMessage(), e.getArgs());
    }

    return prepareExecuteEditDocuments(mapping, actionForm, request, response);
  }
  public ActionForward prepareExecuteEditDocuments(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    final IndividualCandidacyProcess process = getProcess(request);
    request.setAttribute(getIndividualCandidacyProcessBeanName(), process);
    CandidacyProcessDocumentUploadBean uploadBean = new CandidacyProcessDocumentUploadBean();
    uploadBean.setIndividualCandidacyProcess(process);
    request.setAttribute("candidacyDocumentUploadBean", uploadBean);

    RenderUtils.invalidateViewState("individualCandidacyProcessBean.document");

    return mapping.findForward("prepare-edit-candidacy-documents");
  }
 @Override
 protected DegreeChangeIndividualCandidacyProcess executeActivity(
     DegreeChangeIndividualCandidacyProcess process, User userView, Object object) {
   ((CandidacyProcessDocumentUploadBean) object)
       .getDocumentFile()
       .setCandidacyFileActive(Boolean.FALSE);
   return process;
 }
  public ActionForward revokeDocumentFile(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixFilterException, FenixServiceException {
    CandidacyProcessDocumentUploadBean uploadBean =
        (CandidacyProcessDocumentUploadBean)
            getObjectFromViewState("individualCandidacyProcessBean.document");
    String documentExternalId = request.getParameter("documentFileOid");
    IndividualCandidacyDocumentFile documentFile =
        IndividualCandidacyDocumentFile.fromExternalId(documentExternalId);
    uploadBean.setDocumentFile(documentFile);

    executeActivity(getProcess(request), "RevokeDocumentFile", uploadBean);

    return prepareExecuteEditDocuments(mapping, form, request, response);
  }
 protected IndividualCandidacyDocumentFile createIndividualCandidacyDocumentFile(
     CandidacyProcessDocumentUploadBean uploadBean, String documentIdNumber) throws IOException {
   return uploadBean.createIndividualCandidacyDocumentFile(
       getParentProcessType(), documentIdNumber);
 }