/** Business logic to execute. */ public VOResponse deleteLedger(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(); LedgerVO vo = null; for (int i = 0; i < list.size(); i++) { // logically delete the record in ACC01... vo = (LedgerVO) list.get(i); stmt.execute( "update ACC01_LEDGER set ENABLED='N' where COMPANY_CODE_SYS01='" + vo.getCompanyCodeSys01ACC01() + "' and LEDGER_CODE='" + vo.getLedgerCodeACC01() + "'"); } return new VOResponse(new Boolean(true)); } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while deleting existing ledger", 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) { } } }
/** Business logic to execute. */ public VOListResponse updateLedger( ArrayList oldVOs, ArrayList newVOs, String serverLanguageId, String username, ArrayList customizedFields) throws Throwable { Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; LedgerVO oldVO = null; LedgerVO newVO = null; Response res = null; for (int i = 0; i < oldVOs.size(); i++) { oldVO = (LedgerVO) oldVOs.get(i); newVO = (LedgerVO) newVOs.get(i); // update SYS10 table... TranslationUtils.updateTranslation( oldVO.getDescriptionSYS10(), newVO.getDescriptionSYS10(), newVO.getProgressiveSys10ACC01(), serverLanguageId, conn); HashSet pkAttrs = new HashSet(); pkAttrs.add("companyCodeSys01ACC01"); pkAttrs.add("ledgerCodeACC01"); HashMap attribute2dbField = new HashMap(); attribute2dbField.put("ledgerCodeACC01", "LEDGER_CODE"); attribute2dbField.put("progressiveSys10ACC01", "PROGRESSIVE_SYS10"); attribute2dbField.put("enabledACC01", "ENABLED"); attribute2dbField.put("companyCodeSys01ACC01", "COMPANY_CODE_SYS01"); attribute2dbField.put("accountTypeACC01", "ACCOUNT_TYPE"); res = new CustomizeQueryUtil() .updateTable( conn, new UserSessionParameters(username), pkAttrs, oldVO, newVO, "ACC01_LEDGER", attribute2dbField, "Y", "N", null, true, customizedFields); if (res.isError()) { throw new Exception(res.getErrorMessage()); } } return new VOListResponse(newVOs, false, newVOs.size()); } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while updating existing ledger", ex); try { if (this.conn == null && conn != null) // rollback only local connection conn.rollback(); } catch (Exception ex3) { } throw new Exception(ex.getMessage()); } finally { try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }
/** Business logic to execute. */ public VOListResponse insertLedger( ArrayList list, String serverLanguageId, String username, ArrayList companyCodes, ArrayList customizedFields) throws Throwable { Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; String companyCode = companyCodes.get(0).toString(); LedgerVO vo = null; BigDecimal progressiveSYS10 = null; Response res = null; Map attribute2dbField = new HashMap(); attribute2dbField.put("ledgerCodeACC01", "LEDGER_CODE"); attribute2dbField.put("progressiveSys10ACC01", "PROGRESSIVE_SYS10"); attribute2dbField.put("enabledACC01", "ENABLED"); attribute2dbField.put("companyCodeSys01ACC01", "COMPANY_CODE_SYS01"); attribute2dbField.put("accountTypeACC01", "ACCOUNT_TYPE"); for (int i = 0; i < list.size(); i++) { vo = (LedgerVO) list.get(i); vo.setEnabledACC01("Y"); if (vo.getCompanyCodeSys01ACC01() == null) vo.setCompanyCodeSys01ACC01(companyCode); // insert record in SYS10... progressiveSYS10 = TranslationUtils.insertTranslations( vo.getDescriptionSYS10(), vo.getCompanyCodeSys01ACC01(), conn); vo.setProgressiveSys10ACC01(progressiveSYS10); // insert into ACC01... res = CustomizeQueryUtil.insertTable( conn, new UserSessionParameters(username), vo, "ACC01_LEDGER", attribute2dbField, "Y", "N", null, true, customizedFields); if (res.isError()) { throw new Exception(res.getErrorMessage()); } } return new VOListResponse(list, false, list.size()); } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while inserting new ledgers", ex); try { if (this.conn == null && conn != null) // rollback only local connection conn.rollback(); } catch (Exception ex3) { } throw new Exception(ex.getMessage()); } finally { try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }