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); }
protected boolean checkAwardBasisAndMethodOfPayment( AwardDocument document, List<AuditError> errors) { boolean valid = false; if (document.getAward().getAwardTypeCode() != null && document.getAward().getBasisOfPaymentCode() != null) { List<ValidBasisMethodPayment> basisMethodPayments = new ArrayList<ValidBasisMethodPayment>( getAwardPaymentAndInvoicesService() .getValidBasisMethodPaymentByBasisCode( document.getAward().getBasisOfPaymentCode())); for (ValidBasisMethodPayment basisMethodPayment : basisMethodPayments) if (StringUtils.equals( basisMethodPayment.getMethodOfPaymentCode(), document.getAward().getMethodOfPaymentCode())) valid = true; if (!valid) // todo lookup basis of payment description to use instead of code. errors.add( new AuditError( Constants.PAYMENT_AND_INVOICES_AUDIT_RULES_ERROR_KEY, KeyConstants.ERROR_AWARD_INVALID_BASIS_AND_METHOD_OF_PAYMENT, PAYMENTS_INVOICES_URL, new String[] {})); } else { valid = true; } return valid; }
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); }
public boolean processRunAuditBusinessRules(Document document) { boolean retval = true; AwardDocument awardDocument = (AwardDocument) document; if (StringUtils.equalsIgnoreCase( this.getParameterService() .getParameterValueAsString( AwardDocument.class, KeyConstants.ENABLE_AWARD_FNA_VALIDATION), KeyConstants.ENABLED_PARAMETER_VALUE_ONE)) { retval = isFandaRateInputInPairs(awardDocument.getAward().getAwardFandaRate()); } return retval; }
protected void addCopyLink( BusinessObject businessObject, List<String> pkNames, List<HtmlData> htmlDataList, String hrefPattern, String methodToCall) { AnchorHtmlData htmlData = getUrlData(businessObject, methodToCall, pkNames); AwardDocument document = ((Award) businessObject).getAwardDocument(); htmlData.setHref( String.format(hrefPattern, document.getDocumentNumber(), getDocumentTypeName())); htmlDataList.add(htmlData); }
/** * @param award * @return */ protected AnchorHtmlData getOpenLink(Award award, Boolean viewOnly) { AwardDocument awardDocument = award.getAwardDocument(); AnchorHtmlData htmlData = new AnchorHtmlData(); htmlData.setDisplayText("open"); Properties parameters = new Properties(); parameters.put(KNSConstants.DISPATCH_REQUEST_PARAMETER, KNSConstants.DOC_HANDLER_METHOD); parameters.put(KNSConstants.PARAMETER_COMMAND, KEWConstants.DOCSEARCH_COMMAND); parameters.put(KNSConstants.DOCUMENT_TYPE_NAME, getDocumentTypeName()); parameters.put("viewDocument", viewOnly.toString()); parameters.put("docOpenedFromAwardSearch", "true"); parameters.put("docId", awardDocument.getDocumentNumber()); parameters.put("placeHolderAwardId", award.getAwardId().toString()); String href = UrlFactory.parameterizeUrl("../" + getHtmlAction(), parameters); htmlData.setHref(href); return htmlData; }
@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; }
@Override public boolean processRunAuditBusinessRules(Document document) { boolean valid = true; AwardDocument awardDocument = (AwardDocument) document; List<AuditError> auditErrors = new ArrayList<AuditError>(); Award award = awardDocument.getAward(); if (award.getMethodOfPaymentCode() == null) { valid &= false; addErrorToAuditErrors(auditErrors, METHOD_OF_PAYMENT_AUDIT_KEY, PAYMENT_METHOD); } if (award.getBasisOfPaymentCode() == null) { valid &= false; addErrorToAuditErrors(auditErrors, BASIS_OF_PAYMENT_AUDIT_KEY, PAYMENT_BASIS); } valid &= checkAwardBasisOfPayment(awardDocument, auditErrors); valid &= checkAwardBasisAndMethodOfPayment(awardDocument, auditErrors); reportAndCreateAuditCluster(auditErrors); return valid; }
@Override public boolean processRunAuditBusinessRules(Document document) { boolean valid = true; AwardDocument awardDocument = (AwardDocument) document; auditErrors = new ArrayList<AuditError>(); setSponsorTermTypes(); List<AwardSponsorTerm> awardSponsorTerms = awardDocument.getAward().getAwardSponsorTerms(); for (KeyValue sponsorTermType : sponsorTermTypes) { boolean sponsorTermTypeExists = isSponsorTermTypeInAwardSponsorTerms( sponsorTermType.getKey().toString(), awardSponsorTerms); if (!sponsorTermTypeExists) { valid &= false; addErrorToAuditErrors(sponsorTermType.getValue()); } } reportAndCreateAuditCluster(); return valid; }
/** * 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 <key, value> 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; }