public AwardHierarchyNode getRootAwardNode(Award award) {
   String awardNumber = award.getAwardNumber();
   AwardHierarchyNode awardNode =
       getAwardHierarchyNodes(awardNumber, awardNumber, award.getSequenceNumber().toString())
           .get(awardNumber);
   return awardNode;
 }
 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);
 }
Exemple #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);
  }
  /**
   * @see
   *     org.kuali.kra.service.AwardHierarchyUIService#getAwardRecord(org.kuali.kra.award.home.Award)
   */
  public String getAwardRecord(Award award) throws ParseException {

    String awardNumber = award.getAwardNumber();
    return buildCompleteRecord(
        awardNumber,
        getAwardHierarchyNodes(
                award.getAwardNumber(),
                award.getAwardNumber(),
                award.getSequenceNumber().toString())
            .get(awardNumber));
  }
 /**
  * Searches for all awards with the same award id and grabs all sequence numbers for that award
  * returning the sequence number as both the key and the value for the pair.
  *
  * @return the list of &lt;key, value&gt; pairs of the current award sequence numbers
  * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
  */
 @Override
 public List<KeyValue> getKeyValues() {
   AwardDocument doc = (AwardDocument) getDocument();
   String awardNumber = doc.getAward().getAwardNumber();
   KeyValuesService keyValuesService =
       (KeyValuesService) KcServiceLocator.getService("keyValuesService");
   Map<String, Object> idMatch = new HashMap<String, Object>();
   idMatch.put("awardNumber", awardNumber);
   Collection<Award> awards = keyValuesService.findMatching(Award.class, idMatch);
   List<Integer> sortedList = new ArrayList<Integer>();
   for (Award award : awards) {
     sortedList.add(award.getSequenceNumber());
   }
   Collections.sort(sortedList, Collections.reverseOrder());
   List<KeyValue> keyValues = new ArrayList<KeyValue>();
   for (Integer num : sortedList) {
     keyValues.add(new ConcreteKeyValue(num.toString(), num.toString()));
   }
   return keyValues;
 }