Search in sources :

Example 1 with AdvanceDepositDocument

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);
    }
}
Also used : AchIncomeTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeTransaction) HashMap(java.util.HashMap) AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with AdvanceDepositDocument

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;
}
Also used : AdvanceDepositDetail(org.kuali.kfs.fp.businessobject.AdvanceDepositDetail) Bank(org.kuali.kfs.sys.businessobject.Bank) AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) ParseException(java.text.ParseException)

Example 3 with 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;
}
Also used : WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument) RemoteException(java.rmi.RemoteException) ValidationException(org.kuali.kfs.krad.exception.ValidationException) MessagingException(javax.mail.MessagingException) ParseException(java.text.ParseException) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) FormatException(org.kuali.rice.core.web.format.FormatException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException) InvalidAddressException(org.kuali.kfs.krad.exception.InvalidAddressException) IOException(java.io.IOException)

Example 4 with AdvanceDepositDocument

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;
}
Also used : AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument)

Example 5 with AdvanceDepositDocument

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;
}
Also used : AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument)

Aggregations

AdvanceDepositDocument (org.kuali.kfs.fp.document.AdvanceDepositDocument)6 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)2 AchIncomeTransaction (edu.cornell.kfs.fp.businessobject.AchIncomeTransaction)1 IncomingWireAchMapping (edu.cornell.kfs.fp.businessobject.IncomingWireAchMapping)1 MockParameterServiceImpl (edu.cornell.kfs.sys.service.mock.MockParameterServiceImpl)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 RemoteException (java.rmi.RemoteException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 MessagingException (javax.mail.MessagingException)1 Before (org.junit.Before)1 AdvanceDepositDetail (org.kuali.kfs.fp.businessobject.AdvanceDepositDetail)1 InvalidAddressException (org.kuali.kfs.krad.exception.InvalidAddressException)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 Bank (org.kuali.kfs.sys.businessobject.Bank)1 DateTimeServiceImpl (org.kuali.rice.core.impl.datetime.DateTimeServiceImpl)1