use of org.kuali.kfs.fp.document.AdvanceDepositDocument in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method createDocuments.
/**
* @see AdvanceDepositService#createDocuments()
*/
public void createDocuments() {
List<AchIncomeTransaction> transactions = (List<AchIncomeTransaction>) businessObjectService.findMatchingOrderBy(AchIncomeTransaction.class, new HashMap<String, Object>(), ACH_TRANSACTION_SEQUENCE_NUMBER, true);
for (AchIncomeTransaction transaction : transactions) {
AdvanceDepositDocument document = createAdvanceDepositDocument(transaction);
saveDocument(document);
createNotes(transaction, document);
}
}
use of org.kuali.kfs.fp.document.AdvanceDepositDocument in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method createAdvanceDepositDocument.
/**
* Creates a AdvanceDepositDocument from the List of transactions given.
*
* @param transaction List of CashReceiptDocument objects to be used for creating the document.
* @return A AdvanceDepositDocument populated with the transactions provided.
*/
protected AdvanceDepositDocument createAdvanceDepositDocument(AchIncomeTransaction transaction) {
AdvanceDepositDocument advanceDepositDocument;
try {
String detailReferenceNumber = parameterService.getParameterValueAsString(GenerateAdvanceDepositDocumentsStep.class, CuFPParameterConstants.AdvanceDepositDocument.DETAIL_REFERENCE_NUMBER);
String detailDescription = parameterService.getParameterValueAsString(GenerateAdvanceDepositDocumentsStep.class, CuFPParameterConstants.AdvanceDepositDocument.DETAIL_DESCRIPTION);
String bankCode = parameterService.getParameterValueAsString(GenerateAdvanceDepositDocumentsStep.class, CuFPParameterConstants.AdvanceDepositDocument.BANK_CODE);
String documentDescription = parameterService.getParameterValueAsString(GenerateAdvanceDepositDocumentsStep.class, CuFPParameterConstants.AdvanceDepositDocument.DOCUMENT_DESCRIPTION);
advanceDepositDocument = (AdvanceDepositDocument) documentService.getNewDocument(KFSConstants.FinancialDocumentTypeCodes.ADVANCE_DEPOSIT);
advanceDepositDocument.getDocumentHeader().setDocumentDescription(documentDescription);
advanceDepositDocument.setCampusLocationCode(CuFPConstants.ADVANCE_DEPOSIT_DEFAULT_CAMPUS_CODE);
advanceDepositDocument.setDepositDate(dateTimeService.convertToSqlDate(transaction.getBankTimestamp()));
createSourceAccountingLine(transaction, advanceDepositDocument);
AdvanceDepositDetail advanceDepositDetail = new AdvanceDepositDetail();
advanceDepositDetail.setDocumentNumber(advanceDepositDocument.getDocumentNumber());
advanceDepositDetail.setFinancialDocumentAdvanceDepositDate(dateTimeService.convertToSqlDate(transaction.getLoadTimestamp()));
advanceDepositDetail.setFinancialDocumentAdvanceDepositAmount(transaction.getTransactionAmount());
advanceDepositDetail.setFinancialDocumentAdvanceDepositReferenceNumber(detailReferenceNumber);
advanceDepositDetail.setFinancialDocumentAdvanceDepositDescription(detailDescription);
advanceDepositDetail.setFinancialDocumentBankCode(bankCode);
Bank bank = bankService.getByPrimaryId(bankCode);
advanceDepositDetail.setBank(bank);
advanceDepositDocument.addAdvanceDeposit(advanceDepositDetail);
} catch (WorkflowException | ParseException e) {
LOG.error("Error creating advance deposit documents: " + e.getMessage(), e);
throw new RuntimeException("Error creating advance deposit documents: " + e.getMessage(), e);
}
return advanceDepositDocument;
}
use of org.kuali.kfs.fp.document.AdvanceDepositDocument in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method routeAdvanceDepositDocuments.
/**
* @see AdvanceDepositService#routeAdvanceDepositDocuments()
*/
public boolean routeAdvanceDepositDocuments() {
List<String> documentIdList;
try {
documentIdList = retrieveAdvanceDepositDocumentsToRoute(KewApiConstants.ROUTE_HEADER_SAVED_CD);
} catch (WorkflowException | RemoteException e) {
LOG.error("Error retrieving advance deposit documents for routing: " + e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
if (LOG.isInfoEnabled()) {
LOG.info("Advance deposit to Route: " + documentIdList);
}
for (String documentId : documentIdList) {
try {
AdvanceDepositDocument advanceDocument = (AdvanceDepositDocument) documentService.getByDocumentHeaderId(documentId);
if (LOG.isInfoEnabled()) {
LOG.info("Routing advance deposit document # " + documentId + ".");
}
documentService.routeDocument(advanceDocument, "document routed by achIncome batch job", null);
} catch (Exception e) {
LOG.error("Error routing document # " + documentId + " due to exception: " + e.getMessage());
logException(e);
}
}
return true;
}
use of org.kuali.kfs.fp.document.AdvanceDepositDocument in project cu-kfs by CU-CommunityApps.
the class CuAdvanceDepositDocumentAuthorizer method addRoleQualification.
@Override
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) {
super.addRoleQualification(dataObject, attributes);
AdvanceDepositDocument advanceDepositDocument = (AdvanceDepositDocument) dataObject;
}
use of org.kuali.kfs.fp.document.AdvanceDepositDocument in project cu-kfs by CU-CommunityApps.
the class CuAdvanceDepositDocumentAuthorizer method addPermissionDetails.
@Override
protected void addPermissionDetails(Object dataObject, Map<String, String> attributes) {
super.addPermissionDetails(dataObject, attributes);
AdvanceDepositDocument advanceDepositDocument = (AdvanceDepositDocument) dataObject;
}
Aggregations