use of org.kuali.kfs.sys.businessobject.TargetAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuAutoDisapproveDocumentsServiceImpl method buildSuccessMessage.
private String buildSuccessMessage(Document document) throws Exception {
StringBuilder headerBuilder = new StringBuilder();
headerBuilder.append(document.getDocumentNumber());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getDocumentDescription());
headerBuilder.append(TAB);
headerBuilder.append(personService.getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(personService.getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDateCreated());
headerBuilder.append(TAB);
ConfigurationService k = KRADServiceLocator.getKualiConfigurationService();
StringBuilder routeBuilder = new StringBuilder();
String url = k.getPropertyValueAsString("workflow.url");
routeBuilder.append(url);
routeBuilder.append("/RouteLog.do?routeHeaderId=");
routeBuilder.append(document.getDocumentNumber());
routeBuilder.append(TAB);
headerBuilder.append(routeBuilder);
List<ActionTaken> actions;
// try {
// actions = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentHeader().getWorkflowDocument().getDocumentId());
actions = KewApiServiceLocator.getWorkflowDocumentService().getAllActionsTaken(document.getDocumentNumber());
ActionTaken max = null;
for (ActionTaken at : actions) {
if (ObjectUtils.isNull(max)) {
max = at;
} else if (at.getActionDate().compareTo(max.getActionDate()) > 0) {
max = at;
}
}
headerBuilder.append(personService.getPerson(max.getPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(personService.getPerson(max.getPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionDate());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionTaken().getLabel());
headerBuilder.append(TAB);
// } catch (WorkflowException e) {
// e.printStackTrace();
// }
String headerString = headerBuilder.toString();
StringBuilder builder = new StringBuilder();
if (document instanceof AccountingDocumentBase) {
for (Object o : ((AccountingDocumentBase) document).getSourceAccountingLines()) {
SourceAccountingLine sal = (SourceAccountingLine) o;
builder.append(headerString);
builder.append(sal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(sal.getAccountNumber());
builder.append(TAB);
builder.append(sal.getAmount());
builder.append(TAB);
builder.append(sal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
for (Object o : ((AccountingDocumentBase) document).getTargetAccountingLines()) {
TargetAccountingLine tal = (TargetAccountingLine) o;
builder.append(headerString);
builder.append(tal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(tal.getAccountNumber());
builder.append(TAB);
builder.append(tal.getAmount());
builder.append(TAB);
builder.append(tal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
}
return builder.toString();
}
use of org.kuali.kfs.sys.businessobject.TargetAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuProcurementCardDocument method getAccountNumberForSearching.
public String getAccountNumberForSearching() {
ProcurementCardTransactionDetail transaction = (ProcurementCardTransactionDetail) transactionEntries.get(0);
TargetAccountingLine tal = (TargetAccountingLine) transaction.getTargetAccountingLines().get(0);
String acctNbr = tal.getAccountNumber();
return acctNbr;
}
use of org.kuali.kfs.sys.businessobject.TargetAccountingLine in project cu-kfs by CU-CommunityApps.
the class AccountingLineAccessibleValidation method onlyObjectCodeChanged.
/**
* Checks to see if the object code is the only difference between the original accounting line and the updated accounting line.
*
* @param accountingLine
* @param updatedAccountingLine
* @return true if only the object code has changed on the accounting line, false otherwise
*/
protected boolean onlyObjectCodeChanged(AccountingLine accountingLine, AccountingLine updatedAccountingLine) {
// no changes, return false
if (accountingLine.isLike(updatedAccountingLine)) {
return false;
}
// copy the updatedAccountLine so we can set the object code on the copy of the updated accounting line
// to be the original value for comparison purposes
AccountingLine updatedLine = null;
if (updatedAccountingLine.isSourceAccountingLine()) {
updatedLine = new SourceAccountingLine();
} else {
updatedLine = new TargetAccountingLine();
}
updatedLine.copyFrom(updatedAccountingLine);
updatedLine.setFinancialObjectCode(accountingLine.getFinancialObjectCode());
// if they're the same, the only change was the object code
return (accountingLine.isLike(updatedLine));
}
use of org.kuali.kfs.sys.businessobject.TargetAccountingLine in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method getTargetAccountingLine.
protected TargetAccountingLine getTargetAccountingLine(ActionForm form, HttpServletRequest request) {
int lineIndex = getSelectedLine(request);
TargetAccountingLine line = (TargetAccountingLine) ((KualiAccountingDocumentFormBase) form).getFinancialDocument().getTargetAccountingLine(lineIndex);
return line;
}
Aggregations