Ejemplo n.º 1
0
  protected void setAttribute() {

    AttributeCode attributeCode = (AttributeCode) iterator.next();

    if (attributeCode.equals(currentAttributeCode)) {
      pageContext.setAttribute("selected", "selected");
    } else {
      pageContext.setAttribute("selected", "");
    }

    pageContext.setAttribute("attributeId", attributeCode.getAttributeId());
    pageContext.setAttribute("attributeCode", attributeCode.getAttributeCode());
    pageContext.setAttribute("attributeName", attributeCode.getAttributeName());

    if (attributeCode instanceof EntrySet) {
      if ("receipt".equals(selectedType)) {
        pageContext.setAttribute("receiveFromReceipt", ((EntrySet) attributeCode).getReceiveFrom());
        pageContext.setAttribute("multiPayToReceipt", ((EntrySet) attributeCode).getMultiPayFor());
      }
      if ("receiptTypeList".equals(selectedType)) {
        pageContext.setAttribute("sendToFlag", ((EntrySet) attributeCode).getSendTo());
      } else {
        pageContext.setAttribute("partnerTypePayment", ((EntrySet) attributeCode).getPartnerType());
        pageContext.setAttribute("receiptTypePayment", ((EntrySet) attributeCode).getReceiptType());
        pageContext.setAttribute(
            "voucherTypeCode", ((EntrySet) attributeCode).getVoucherType().getAttributeCode());
      }
    } else if (attributeCode instanceof BankAccount) {
      pageContext.setAttribute("bankAccountNo", ((BankAccount) attributeCode).getAccountNumber());
      pageContext.setAttribute(
          "bankName", ((BankAccount) attributeCode).getBank().getAttributeName());
      pageContext.setAttribute(
          "bankCurrency", ((BankAccount) attributeCode).getCurrency().getAttributeCode());
    }
  }
Ejemplo n.º 2
0
  protected void setAttribute() {

    AttributeCode attributeCode = (AttributeCode) iterator.next();

    if (attributeCode.equals(currentAttributeCode)) {
      pageContext.setAttribute("selected", "selected");
    } else {
      pageContext.setAttribute("selected", "");
    }
    pageContext.setAttribute("attributeId", attributeCode.getAttributeId());
    pageContext.setAttribute("attributeCode", attributeCode.getAttributeCode());
    pageContext.setAttribute("attributeName", attributeCode.getAttributeName());
    pageContext.setAttribute("description", "" + attributeCode.getDescription());
    if (attributeCode instanceof BankBranch) {
      pageContext.setAttribute(
          "orderBankId", ((BankBranch) attributeCode).getBank().getAttributeId());
    }
    //        if(attributeCode instanceof Bank && this.selectedType == null) {
    //            pageContext.setAttribute("bankID",
    // ((com.laconic.fm.bank.component.Bank)attributeCode).getBankID());
    //        }else if(attributeCode instanceof AccountType && this.selectedType == null) {
    //            pageContext.setAttribute("accountTypeID",
    // ((AccountType)attributeCode).getAccountTypeID());
    //        }else if(attributeCode instanceof VoucherType && this.selectedType == null) {
    //            pageContext.setAttribute("voucherTypeID",
    // ((VoucherType)attributeCode).getVoucherTypeID());
    //        }else if(attributeCode instanceof NoteType && this.selectedType == null) {
    //            pageContext.setAttribute("noteTypeID", ((NoteType)attributeCode).getNoteTypeID());
    //        }else if(attributeCode instanceof BankBranch) {
    //            pageContext.setAttribute("orderBankCode",
    // ((BankBranch)attributeCode).getBank().getAttributeCode());
    //            pageContext.setAttribute("orderBankName",
    // ((BankBranch)attributeCode).getBank().getAttributeName());
    //        }
  }
Ejemplo n.º 3
0
  protected void setAttribute() {

    AttributeCode attributeCode = (AttributeCode) iterator.next();

    if (attributeCode.equals(currentAttributeCode)) {
      pageContext.setAttribute("selected", "selected");
    } else {
      pageContext.setAttribute("selected", "");
    }
    pageContext.setAttribute(
        "attributeId",
        attributeCode.getAttributeId() == null ? "" : attributeCode.getAttributeId());
    pageContext.setAttribute(
        "attributeCode",
        attributeCode.getAttributeCode() == null ? "" : attributeCode.getAttributeCode());
    pageContext.setAttribute(
        "attributeName",
        attributeCode.getAttributeName() == null ? "" : attributeCode.getAttributeName());
    pageContext.setAttribute(
        "description",
        attributeCode.getDescription() == null ? "" : attributeCode.getDescription());
  }
Ejemplo n.º 4
0
  public void doService(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException, SQLException {

    Connection conn = null;
    String JSP_PATH = "/jsp/fm/bank/";

    try {

      conn = com.cynosure.common.sql.OracleGate.getConnection();
      String page = request.getParameter("page");
      String actionCode = request.getParameter("actionCode");

      DeBug.print("page : " + page + "  actionCode :  " + actionCode);
      FinanceMaintainMgr financeMaintainMgr =
          (FinanceMaintainMgr) request.getSession().getAttribute("financeMaintainMgr");
      AttributeCode attributeCode = null;
      if (financeMaintainMgr != null) attributeCode = financeMaintainMgr.getCurrentAttributeCode();

      if (actionCode == null) {

      } else {

        if (actionCode.startsWith("view")) {
          financeMaintainMgr = new FinanceMaintainMgr();
          financeMaintainMgr.refreshAttributeCodeList(conn, page);
          request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          financeMaintainMgr.setEntryMode("AttributeCode");
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "view" + page + ".jsp")
              .forward(request, response);

        } else if (actionCode.equals("init")) {
          financeMaintainMgr = new FinanceMaintainMgr();

          /** New object type * */
          if (page.equals("Bank")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new com.laconic.fm.bank.component.Bank();
          } else if (page.equals("VoucherType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new VoucherType();
          } else if (page.equals("NoteType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new NoteType();
            /*}else if (page.equals("NoteStatus")){
               financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new NoteStatus();*/
          } else if (page.equals("AccountType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new AccountType();
          }
          // initialize selection

          financeMaintainMgr.setCurrentAttributeCode(attributeCode);
          financeMaintainMgr.refreshAttributeCodeList(conn, page);
          request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);

        } else if (actionCode.equals("update")) {
          // financeMaintainMgr = new FinanceMaintainMgr();

          /** New object type * */
          if (page.equals("Bank")) {
            financeMaintainMgr.setEntryMode("UPDATE-BANK");
            String bankID = request.getParameter("bankID");
            financeMaintainMgr.setCurrentAttributeCode(financeMaintainMgr.getAttributeCode(bankID));
          } else if (page.equals("AccountType")) {
            financeMaintainMgr.setEntryMode("UPDATE-ACCOUNT-TYPE");
            String accountTypeID = request.getParameter("accountTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(accountTypeID));
          } else if (page.equals("NoteType")) {
            financeMaintainMgr.setEntryMode("UPDATE-NOTE-TYPE");
            String noteTypeID = request.getParameter("noteTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(noteTypeID));
          } else if (page.equals("VoucherType")) {
            financeMaintainMgr.setEntryMode("UPDATE-VOUCHER-TYPE");
            String voucherTypeID = request.getParameter("voucherTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(voucherTypeID));
          }

          // initialize selection

          // financeMaintainMgr.refreshAttributeCodeList(conn, page);
          // request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);

        } else {
          // set common attributes from user input //
          attributeCode.setAttributeCode(request.getParameter("attributeCode"));
          attributeCode.setAttributeName(request.getParameter("attributeName"));
          attributeCode.setDescription(request.getParameter("description"));

          // set additional attributes from user input //
          //   if (attributeCode instanceof Port) {

          //   } else if (attributeCode instanceof OBU) {
          //       OBU obu = (OBU) attributeCode;
          //       obu.setAddress(request.getParameter("address"));
          //   }

          attributeCode.validate();

          if (attributeCode.isValid()) {
            // DeBug.print("*****="+financeMaintainMgr.getEntryMode().equals("UPDATE-BANK"));
            if (financeMaintainMgr.getEntryMode().equals("UPDATE-BANK"))
              ((com.laconic.fm.bank.component.Bank) attributeCode).updateBank(conn);
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-ACCOUNT-TYPE"))
              ((AccountType) attributeCode).updateAccountType(conn);
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-NOTE-TYPE"))
              ((NoteType) attributeCode).saveNoteType();
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-VOUCHER-TYPE"))
              ((VoucherType) attributeCode).saveVoucherType();
            else attributeCode.save();

            if (attributeCode.hasMessage()) {

            } else {

              // save successfully
              // add saved attribute code to list
              ((LinkedList) financeMaintainMgr.getAttributeCodeList()).addFirst(attributeCode);

              // give a new attribute code //

              if (attributeCode instanceof com.laconic.fm.bank.component.Bank) {
                attributeCode = new com.laconic.fm.bank.component.Bank();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof AccountType) {
                attributeCode = new AccountType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof VoucherType) {
                attributeCode = new VoucherType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof NoteType) {
                attributeCode = new NoteType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } /*else if (attributeCode instanceof NoteStatus)
                attributeCode = new NoteStatus();	*/

              financeMaintainMgr.setCurrentAttributeCode(attributeCode);
            }
          }
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);
        }
      }

    } finally {
      if (conn != null) com.cynosure.common.sql.OracleGate.freeConnection(conn);
    }
  }