protected void cancelOnlineReviewDocument(
      ProtocolOnlineReviewDocumentBase protocolOnlineReviewDocument,
      ProtocolSubmissionBase submission,
      String annotation) {
    try {

      final String principalId =
          identityManagementService
              .getPrincipalByPrincipalName(KRADConstants.SYSTEM_USER)
              .getPrincipalId();
      WorkflowDocument workflowDocument =
          WorkflowDocumentFactory.loadDocument(
              principalId, protocolOnlineReviewDocument.getDocumentNumber());

      if (workflowDocument.isEnroute()
          || workflowDocument.isInitiated()
          || workflowDocument.isSaved()) {
        workflowDocument.superUserCancel(
            String.format(
                "Review Cancelled from assign reviewers action by %s",
                GlobalVariables.getUserSession().getPrincipalId()));
      }
    } catch (Exception e) {
      String errorMessage =
          String.format(
              "Exception generated while executing superUserCancel on document %s in removeOnlineReviewDocument. Message: %s",
              protocolOnlineReviewDocument.getDocumentNumber(), e.getMessage());
      LOG.error(errorMessage);
      throw new RuntimeException(errorMessage, e);
    }
  }
 /**
  * @see
  *     org.kuali.rice.ken.service.NotificationWorkflowDocumentService#terminateWorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument)
  */
 public void terminateWorkflowDocument(WorkflowDocument document) {
   document.superUserCancel(
       "terminating document: documentId="
           + document.getDocumentId()
           + ", appDocId="
           + document.getApplicationDocumentId());
 }
Example #3
0
  /**
   * Cancel that calls superUserCancel if the document is in route and the current user is the
   * routed by user of the document.
   *
   * @see
   *     org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#cancel(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward cancel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    AwardBudgetDocument awardBudgetDocument = ((AwardBudgetForm) form).getAwardBudgetDocument();
    WorkflowDocument workflowDoc = awardBudgetDocument.getDocumentHeader().getWorkflowDocument();
    if (workflowDoc.isEnroute()
        && StringUtils.equals(
            GlobalVariables.getUserSession().getPrincipalId(),
            workflowDoc.getRoutedByPrincipalId())) {
      workflowDoc.superUserCancel("Cancelled by Routed By User");
      return mapping.findForward(Constants.MAPPING_BASIC);
    } else {
      return super.cancel(mapping, form, request, response);
    }
  }