Exemplo n.º 1
0
  /** Business logic to execute. */
  public VOResponse deleteCharges(ArrayList list, String serverLanguageId, String username)
      throws Throwable {
    Statement stmt = null;
    Connection conn = null;
    try {
      if (this.conn == null) conn = getConn();
      else conn = this.conn;
      stmt = conn.createStatement();

      ChargeVO vo = null;
      for (int i = 0; i < list.size(); i++) {
        // logically delete the record in SAL06...
        vo = (ChargeVO) list.get(i);
        stmt.execute(
            "update SAL06_CHARGES set ENABLED='N' where COMPANY_CODE_SYS01='"
                + vo.getCompanyCodeSys01SAL06()
                + "' and CHARGE_CODE='"
                + vo.getChargeCodeSAL06()
                + "'");
      }

      return new VOResponse(new Boolean(true));
    } catch (Throwable ex) {
      Logger.error(
          username,
          this.getClass().getName(),
          "executeCommand",
          "Error while deleting existing charges",
          ex);
      try {
        if (this.conn == null && conn != null)
          // rollback only local connection
          conn.rollback();
      } catch (Exception ex3) {
      }

      throw new Exception(ex.getMessage());
    } finally {
      try {
        stmt.close();
      } catch (Exception exx) {
      }
      try {
        if (this.conn == null && conn != null) {
          // close only local connection
          conn.commit();
          conn.close();
        }

      } catch (Exception exx) {
      }
    }
  }