コード例 #1
0
  public ActionForward createBlackListed(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws OperationException, ApplicationException {
    ActionForward fwd = init(mapping, form, request, response);
    if (fwd != null) return fwd;

    Properties ctx = TmkJSPEnv.getCtx(request);
    DefaultForm df = (DefaultForm) form;
    BlackListedBean bean = (BlackListedBean) df.getBean();

    Trx trx = Trx.get(TrxPrefix.getPrefix(), true);

    try {
      trx.start();
      BlackListedManager.createBlackListed(ctx, bean, trx.getTrxName());
      trx.commit();
    } catch (OperationException ex) {
      trx.rollback();
      throw ex;

    } finally {
      trx.close();
    }
    request.setAttribute(Constants.BLACKLISTED_DETAILS, bean);
    return mapping.findForward(CREATE_BLACKLISTED);
  }
コード例 #2
0
  public ActionForward editCheque(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws ApplicationException, OperationException {

    ActionForward fwd = init(mapping, form, request, response);
    if (fwd != null) return fwd;
    Properties ctx = TmkJSPEnv.getCtx(request);
    BlackListForm f = (BlackListForm) form;
    BlackListedBean bean = (BlackListedBean) f.getBean();

    Integer blacklistedID = bean.getBlackListedId();
    if (blacklistedID == null) {
      throw new OperationException(
          "Cannot load Cheque details. Cause BlacklistedId cannot be null!");
    }

    Trx trx = Trx.get(TrxPrefix.getPrefix(), true);
    trx.start();

    try {
      BlackListedManager.editBlackListed(ctx, bean, trx.getTrxName());
      trx.commit();
    } catch (OperationException ex) {
      trx.rollback();
      throw ex;
    } finally {
      trx.close();
    }
    request.getSession().setAttribute(Constants.BLACKLISTED_DETAILS, bean);
    return mapping.findForward(EDIT_CHEQUE);
  }
コード例 #3
0
  public ActionForward deactivateCheque(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws ApplicationException, OperationException {

    ActionForward fwd = init(mapping, form, request, response);
    if (fwd != null) return fwd;
    Properties ctx = TmkJSPEnv.getCtx(request);
    BlackListForm f = (BlackListForm) form;
    f.validate(mapping, request);

    BlackListedBean bean = (BlackListedBean) f.getBean();
    Integer blackListedId = bean.getBlackListedId();

    if (blackListedId == null) {
      throw new OperationException(
          "Cannot deactivate Blacklisted Cheques. Cause BlackListed id cannot be null!");
    }

    Trx trx = Trx.get(TrxPrefix.getPrefix(), true);

    try {
      trx.start();
      BlackListedManager.deactivateBListedCheque(ctx, blackListedId.intValue(), trx.getTrxName());
      trx.commit();
    } catch (OperationException e) {
      trx.rollback();
      postGlobalError("error.deactivate.customer", request);
      mapping.getInputForward();
    } finally {
      trx.close();
    }

    return mapping.findForward(DEACTIVATE_CHEQUE);
  }