Search in sources :

Example 1 with FormatException

use of org.kuali.kfs.pdp.service.impl.exception.FormatException in project cu-kfs by CU-CommunityApps.

the class FormatAction method continueFormat.

/**
 * This method performs the format process.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward continueFormat(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    FormatForm formatForm = (FormatForm) form;
    KualiInteger processId = formatForm.getFormatProcessSummary().getProcessId();
    try {
        formatService.performFormat(processId.intValue());
        // remove this
        LOG.info("Formatting done..");
    } catch (FormatException e) {
        // errors added to global message map
        return mapping.findForward(PdpConstants.MAPPING_CONTINUE);
    }
    String lookupUrl = buildUrl(String.valueOf(processId.intValue()));
    // remove this
    LOG.info("Forwarding to lookup");
    return new ActionForward(lookupUrl, true);
}
Also used : KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) FormatException(org.kuali.kfs.pdp.service.impl.exception.FormatException) ActionForward(org.apache.struts.action.ActionForward)

Example 2 with FormatException

use of org.kuali.kfs.pdp.service.impl.exception.FormatException in project cu-kfs by CU-CommunityApps.

the class AchBundlerFormatServiceImpl method performFormat.

/**
 ************************************************************************************************
 *     MODS START HERE
 *************************************************************************************************
 */
/**
 * MOD: Overridden to detect if the Bundle ACH Payments system parameter is on and if so, to
 * call the new helper method
 * @see org.kuali.kfs.pdp.service.FormatService#performFormat(java.lang.Integer)
 */
@Override
public void performFormat(Integer processId) throws FormatException {
    LOG.debug("performFormat() started - ACH Bundler Mod");
    // get the PaymentProcess for the given id
    @SuppressWarnings("rawtypes") Map primaryKeys = new HashMap();
    primaryKeys.put(PdpPropertyConstants.PaymentProcess.PAYMENT_PROCESS_ID, processId);
    PaymentProcess paymentProcess = (PaymentProcess) businessObjectService.findByPrimaryKey(PaymentProcess.class, primaryKeys);
    if (paymentProcess == null) {
        LOG.error("performFormat() Invalid proc ID " + processId);
        throw new RuntimeException("Invalid proc ID");
    }
    String processCampus = paymentProcess.getCampusCode();
    FormatProcessSummary postFormatProcessSummary = new FormatProcessSummary();
    // step 1 get ACH or Check, Bank info, ACH info, sorting
    Iterator<PaymentGroup> paymentGroupIterator = SpringContext.getBean(PaymentGroupService.class).getByProcess(paymentProcess);
    while (paymentGroupIterator.hasNext()) {
        PaymentGroup paymentGroup = paymentGroupIterator.next();
        LOG.debug("performFormat() Step 1 Payment Group ID " + paymentGroup.getId());
        // process payment group data
        boolean groupProcessed = processPaymentGroup(paymentGroup, paymentProcess);
        if (!groupProcessed) {
            throw new FormatException("Error encountered during format");
        }
        // save payment group
        businessObjectService.save(paymentGroup);
        // Add to summary information
        postFormatProcessSummary.add(paymentGroup);
    }
    /**
     * MOD: This mod calls a new method that bundles both Checks
     * and ACHs into single disbursements.
     */
    boolean disbursementNumbersAssigned = false;
    if (getAchBundlerHelperService().shouldBundleAchPayments()) {
        LOG.info("ACH BUNDLER MOD: ACTIVE - bundling ACH payments");
        disbursementNumbersAssigned = assignDisbursementNumbersAndBundle(paymentProcess, postFormatProcessSummary);
    } else {
        // KFSPTS-1460: Our method signature for FormatServiceImpl.assignDisbursementNumbersAndCombineChecks did not
        // match this method call: disbursementNumbersAssigned = assignDisbursementNumbersAndCombineChecks(paymentProcess, postFormatProcessSummary);
        // Added parameter "processCampus" so method signatures matched.
        LOG.info("ACH BUNDLER MOD: NOT Active - ACH payments will NOT be bundled");
        disbursementNumbersAssigned = assignDisbursementNumbersAndCombineChecks(paymentProcess, postFormatProcessSummary);
    }
    if (!disbursementNumbersAssigned) {
        throw new FormatException("Error encountered during format");
    }
    // step 3 save the summarizing info
    LOG.debug("performFormat() Save summarizing information");
    postFormatProcessSummary.save();
    // step 4 set formatted indicator to true and save in the db
    paymentProcess.setFormattedIndicator(true);
    businessObjectService.save(paymentProcess);
    // step 5 end the format process for this campus
    LOG.debug("performFormat() End the format process for this campus");
    endFormatProcess(processCampus);
/**
 * MOD: No longer automatically kick off the extractChecks process.  This has to be scheduled in the batch system or run manually there.
 * Otherwise, may conflict with grouping by payee done.
 */
// step 6 tell the extract batch job to start
// LOG.debug("performFormat() Start extract");
// extractChecks();
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) PaymentProcess(org.kuali.kfs.pdp.businessobject.PaymentProcess) FormatProcessSummary(org.kuali.kfs.pdp.businessobject.FormatProcessSummary) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PaymentGroupService(org.kuali.kfs.pdp.service.PaymentGroupService) FormatException(org.kuali.kfs.pdp.service.impl.exception.FormatException)

Aggregations

FormatException (org.kuali.kfs.pdp.service.impl.exception.FormatException)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ActionForward (org.apache.struts.action.ActionForward)1 FormatProcessSummary (org.kuali.kfs.pdp.businessobject.FormatProcessSummary)1 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)1 PaymentProcess (org.kuali.kfs.pdp.businessobject.PaymentProcess)1 PaymentGroupService (org.kuali.kfs.pdp.service.PaymentGroupService)1 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)1