public ActionForward openAwardReports(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String awardNumber = getSelectedAwardNumber(request);
   List<VersionHistory> versions =
       KraServiceLocator.getService(VersionHistoryService.class)
           .loadVersionHistory(Award.class, awardNumber);
   Award newest = null;
   for (VersionHistory version : versions) {
     if (newest == null
         || version.getSequenceOwnerSequenceNumber() > newest.getSequenceNumber()
             && version.getStatus() != VersionStatus.CANCELED) {
       newest = ((Award) version.getSequenceOwner());
     }
   }
   String docNumber = newest.getAwardDocument().getDocumentNumber();
   final AwardDocument awardDocument =
       (AwardDocument) getDocumentService().getByDocumentHeaderId(docNumber);
   String forwardUrl =
       buildForwardUrl(awardDocument.getDocumentHeader().getWorkflowDocument().getDocumentId());
   return new ActionForward(forwardUrl, true);
 }
  @Override
  public List<String> buildListForFYI(AwardDocument awardDocument) throws WorkflowException {

    WorkflowDocument document = awardDocument.getDocumentHeader().getWorkflowDocument();
    RoutingReportCriteria reportCriteria =
        RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId()).build();
    // gather the IDs for action requests that predate the simulation
    DocumentRouteHeaderValue routeHeader =
        KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
    Set<String> preexistingActionRequestIds = getActionRequestIds(routeHeader);

    // run the simulation via WorkflowUtility
    DocumentDetail documentDetail = workflowUtility.executeSimulation(reportCriteria);

    // fabricate our ActionRequestValueS from the results
    List<ActionRequestValue> actionRequests =
        reconstituteActionRequestValues(documentDetail, preexistingActionRequestIds);

    List<String> actionIds = new ArrayList<String>();
    for (ActionRequestValue request : actionRequests) {
      if (request.isGroupRequest()) {
        actionIds.addAll(
            KimApiServiceLocator.getGroupService().getMemberPrincipalIds(request.getGroupId()));
      }
      if (request.isUserRequest()) {
        actionIds.add(request.getPrincipalId());
      }
    }
    return actionIds;
  }
Beispiel #3
0
  private ActionForward getReturnToAwardForward(BudgetForm budgetForm) throws Exception {
    assert budgetForm != null : "the form is null";

    final DocumentService docService = KraServiceLocator.getService(DocumentService.class);
    Award award = ((AwardDocument) budgetForm.getBudgetDocument().getParentDocument()).getAward();

    // find the newest, uncanceled award document to return to
    String docNumber = budgetForm.getBudgetDocument().getParentDocument().getDocumentNumber();
    List<VersionHistory> versions =
        KraServiceLocator.getService(VersionHistoryService.class)
            .loadVersionHistory(Award.class, award.getAwardNumber());
    for (VersionHistory version : versions) {
      if (version.getSequenceOwnerSequenceNumber() > award.getSequenceNumber()
          && version.getStatus() != VersionStatus.CANCELED) {
        docNumber = ((Award) version.getSequenceOwner()).getAwardDocument().getDocumentNumber();
      }
    }
    final AwardDocument awardDocument = (AwardDocument) docService.getByDocumentHeaderId(docNumber);
    String forwardUrl =
        buildForwardUrl(awardDocument.getDocumentHeader().getWorkflowDocument().getRouteHeaderId());
    if (budgetForm.isAuditActivated()) {
      forwardUrl = StringUtils.replace(forwardUrl, "Award.do?", "Actions.do?");
    }
    // add showAllBudgetVersion to the url to persist that flag until they leave the document
    forwardUrl =
        StringUtils.replace(
            forwardUrl,
            ".do?",
            ".do?showAllBudgetVersions=" + budgetForm.isShowAllBudgetVersions() + "&");

    return new ActionForward(forwardUrl, true);
  }