Beispiel #1
0
  private void search(HttpServletRequest request) throws Exception {
    logger.info("----->PaymentEditAction into Search");
    // Get payment entity
    BudgetActionHelper actionHelper =
        AppContextUtil.getAppContext().getBean("budgetActionHelper", BudgetActionHelper.class);
    PaymentHelper paymentHelper =
        AppContextUtil.getAppContext().getBean("paymentHelper", PaymentHelper.class);
    BudgetHelper budgetHelper =
        AppContextUtil.getAppContext().getBean("budgetHelper", BudgetHelper.class);

    int xID = ParamUtil.getInt(request, "xID");
    //		String borrowFromOther = AppConsts.NO;
    Budget budget = null;
    double borrowAmt = 0.0;
    int borrowDeptId = 0;
    int borrowBudgetId = 0;

    // 1.Get the payment
    logger.info("----->PaymentEditAction into Search  1.Get the payment	");
    Payment payment = paymentHelper.getPayment(xID, true);

    // 2.Get the budget and budget action
    logger.info("----->PaymentEditAction into Search Ready to Get the actionList ");
    List<BudgetAction> actionList =
        actionHelper.getActionByActionTypeAndPaymentID(MessageConsts.BUDGET_TYPE_BORROW_OUT, xID);
    logger.info(
        "----->PaymentEditAction into Search  2.Get the budget and budget action  actionList size"
            + actionList.size());
    if (actionList != null && actionList.size() > 0) {
      logger.info("----->PaymentEditAction into Search  borrow From Other");
      BudgetAction borrowOutAction = actionList.get(0);
      if (borrowOutAction != null) {
        // Set the borrowFromOther == Yes
        //				borrowFromOther = AppConsts.YES;

        // Get the borrow amt
        borrowAmt = borrowOutAction.getxACTION_AMT();

        // Get the borrow dept by budget
        borrowBudgetId = borrowOutAction.getxBUDGET_xID();
        if (borrowBudgetId > 0) {
          budget = budgetHelper.getBudget(borrowBudgetId, false);
          if (budget != null) {
            borrowDeptId = budget.getxDEPT_xID();
          }
        }
      }
    }
    request.setAttribute("xID", xID);
    request.setAttribute("entity", payment);
    //		request.setAttribute("borrowFromOther", borrowFromOther);
    request.setAttribute("borrowAmt", borrowAmt);
    request.setAttribute("borrowDeptId", borrowDeptId);
    logger.info("----->PaymentEditAction ready Go out Search");
  }
Beispiel #2
0
  private void edit(HttpServletRequest request) throws Exception {
    BudgetHelper budgetHelper =
        AppContextUtil.getAppContext().getBean("budgetHelper", BudgetHelper.class);
    BudgetActionHelper actionHelper =
        AppContextUtil.getAppContext().getBean("budgetActionHelper", BudgetActionHelper.class);
    PaymentHelper paymentHelper =
        AppContextUtil.getAppContext().getBean("paymentHelper", PaymentHelper.class);
    // Get payment entity
    // -->
    logger.info("----->PaymentEditAction into edit<-----");

    // Get the  entity
    Payment payment = setEntity(request);
    paymentHelper.saveEntity(payment);
    payment = paymentHelper.getPayment(payment.getxID(), true);

    // Roll back old records
    rollBackPreviousAction(payment);

    // HandleBudget
    handleBudget(request, payment);

    // Past the data to the Jsp
    Budget budget = null;
    double borrowAmt = 0.0;
    int borrowDeptId = 0;
    int borrowBudgetId = 0;
    logger.info("----->PaymentEditAction into Search Ready to Get the actionList ");
    List<BudgetAction> actionList =
        actionHelper.getActionByActionTypeAndPaymentID(
            MessageConsts.BUDGET_TYPE_BORROW_OUT, payment.getxID());
    logger.info(
        "----->PaymentEditAction into Search  2.Get the budget and budget action  actionList size"
            + actionList.size());
    if (actionList != null && actionList.size() > 0) {
      logger.info("----->PaymentEditAction into Search  borrow From Other");
      BudgetAction borrowOutAction = actionList.get(0);
      if (borrowOutAction != null) {
        // Get the borrow amt
        borrowAmt = borrowOutAction.getxACTION_AMT();

        // Get the borrow dept by budget
        borrowBudgetId = borrowOutAction.getxBUDGET_xID();
        if (borrowBudgetId > 0) {
          budget = budgetHelper.getBudget(borrowBudgetId, false);
          if (budget != null) {
            borrowDeptId = budget.getxDEPT_xID();
          }
        }
      }
    }

    request.setAttribute("xID", payment.getxID());
    request.setAttribute("entity", payment);
    //		request.setAttribute("borrowFromOther", borrowFromOther);
    request.setAttribute("borrowAmt", borrowAmt);
    request.setAttribute("borrowDeptId", borrowDeptId);
    request.setAttribute("hasSave", AppConsts.YES);

    logger.info("----->PaymentEditAction End of Edit Method <-----");
  }