protected CFAccFeeDetailBuff unpackFeeDetailResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackFeeDetailResultSetToBuff"; int idxcol = 1; CFAccFeeDetailBuff buff = schema.getFactoryFeeDetail().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAccSybaseSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFAccSybaseSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredFeeId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredFeeDetailId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredAmountCharged(resultSet.getBigDecimal(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
/** * Test importing string, int, and decimal values work successfully * * @throws Exception */ @Test public void testImportSimple() throws Exception { ConnectionProperties p = getConnectionProperties(); Connection cn = DatabaseConnection.getConnection(p); try { List<Field> verifiedFields = new Vector<Field>(); String[] fields = "ListingId, Title, StartPrice".split(","); String tableName = "Listings"; DatabaseConnection.verifyTable(p, tableName, fields, verifiedFields); Collection<JsonNode> importNodes = new LinkedList<JsonNode>(); JsonNodeFactory f = JsonNodeFactory.instance; int listingId = 1559350; String title = "Product Pro1-Beta-0066"; BigDecimal startPrice = BigDecimal.valueOf(20.64); ObjectNode n; n = new ObjectNode(f); n.put("ListingId", listingId); n.put("Title", title); n.put("StartPrice", startPrice); importNodes.add(n); JsonArrayImporter importer = new JsonArrayImporter(p); importer.doImport(tableName, verifiedFields, importNodes); Statement st = cn.createStatement(); ResultSet rs = st.executeQuery("SELECT ListingId, Title, StartPrice FROM Listings"); assertTrue("Expected result set to contain a record", rs.next()); assertEquals(listingId, rs.getInt("ListingId")); assertEquals(title, rs.getString("Title")); assertEquals(startPrice, rs.getBigDecimal("StartPrice")); assertFalse("Expect result set to only contain one record", rs.next()); } finally { cn.close(); } }
/** Business logic to execute. */ public VOListResponse loadCharges( GridParams gridParams, String serverLanguageId, String username, ArrayList companiesList, ArrayList customizedFields) throws Throwable { PreparedStatement pstmt = null; Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; // retrieve companies list... String companies = (String) gridParams .getOtherGridParams() .get(ApplicationConsts.COMPANY_CODE_SYS01); // used in lookup grid... if (companies == null) { companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); } else companies = "'" + companies + "'"; String sql = "select SAL06_CHARGES.COMPANY_CODE_SYS01,SAL06_CHARGES.CHARGE_CODE,SAL06_CHARGES.PROGRESSIVE_SYS10," + "SYS10_TRANSLATIONS.DESCRIPTION,SAL06_CHARGES.VALUE,SAL06_CHARGES.PERC,SAL06_CHARGES.VAT_CODE_REG01," + "SAL06_CHARGES.CURRENCY_CODE_REG03,SAL06_CHARGES.ENABLED" + " from SAL06_CHARGES,SYS10_TRANSLATIONS where " + "SAL06_CHARGES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "SAL06_CHARGES.ENABLED='Y' and " + "SAL06_CHARGES.COMPANY_CODE_SYS01 in (" + companies + ")"; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01SAL06", "SAL06_CHARGES.COMPANY_CODE_SYS01"); attribute2dbField.put("chargeCodeSAL06", "SAL06_CHARGES.CHARGE_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveSys10SAL06", "SAL06_CHARGES.PROGRESSIVE_SYS10"); attribute2dbField.put("valueSAL06", "SAL06_CHARGES.VALUE"); attribute2dbField.put("percSAL06", "SAL06_CHARGES.PERC"); attribute2dbField.put("vatCodeReg01SAL06", "SAL06_CHARGES.VAT_CODE_REG01"); attribute2dbField.put("currencyCodeReg03SAL06", "SAL06_CHARGES.CURRENCY_CODE_REG03"); attribute2dbField.put("enabledSAL06", "SAL06_CHARGES.ENABLED"); ArrayList values = new ArrayList(); values.add(serverLanguageId); // read from SAL06 table... Response res = CustomizeQueryUtil.getQuery( conn, new UserSessionParameters(username), sql, values, attribute2dbField, ChargeVO.class, "Y", "N", null, gridParams, 50, true, customizedFields); if (res.isError()) throw new Exception(res.getErrorMessage()); java.util.List list = ((VOListResponse) res).getRows(); ChargeVO vo = null; sql = "select SYS10_TRANSLATIONS.DESCRIPTION,REG01_VATS.VALUE,REG01_VATS.DEDUCTIBLE " + "from SYS10_TRANSLATIONS,REG01_VATS where " + "REG01_VATS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "REG01_VATS.VAT_CODE=?"; pstmt = conn.prepareStatement(sql); ResultSet rset = null; for (int i = 0; i < list.size(); i++) { vo = (ChargeVO) list.get(i); if (vo.getVatCodeReg01SAL06() != null) { // retrieve vat data from REG01... pstmt.setString(1, serverLanguageId); pstmt.setString(2, vo.getVatCodeReg01SAL06()); rset = pstmt.executeQuery(); if (rset.next()) { vo.setVatDescriptionSYS10(rset.getString(1)); vo.setVatValueREG01(rset.getBigDecimal(2)); vo.setVatDeductibleREG01(rset.getBigDecimal(3)); } rset.close(); } } Response answer = res; if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOListResponse) answer; } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while fetching charges list", ex); throw new Exception(ex.getMessage()); } finally { try { pstmt.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 loadSupplierPriceItems( GridParams pars, String serverLanguageId, String username, ArrayList customizedFields) throws Throwable { PreparedStatement pstmt = null; Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; BigDecimal rootProgressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.ROOT_PROGRESSIVE_HIE01); BigDecimal progressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE01); BigDecimal progressiveHIE02 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE02); BigDecimal progressiveREG04 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_REG04); String companyCodeSYS01 = (String) pars.getOtherGridParams().get(ApplicationConsts.COMPANY_CODE_SYS01); String pricelistCodePUR03 = (String) pars.getOtherGridParams().get(ApplicationConsts.PRICELIST); CompanyHierarchyLevelVO vo = (CompanyHierarchyLevelVO) pars.getOtherGridParams().get(ApplicationConsts.TREE_FILTER); if (vo != null) { progressiveHIE01 = vo.getProgressiveHIE01(); progressiveHIE02 = vo.getProgressiveHie02HIE01(); } String sql = "select PUR02_SUPPLIER_ITEMS.COMPANY_CODE_SYS01,PUR02_SUPPLIER_ITEMS.ITEM_CODE_ITM01,PUR02_SUPPLIER_ITEMS.SUPPLIER_ITEM_CODE,PUR02_SUPPLIER_ITEMS.PROGRESSIVE_REG04," + "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE02,PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE01,PUR02_SUPPLIER_ITEMS.MIN_PURCHASE_QTY,PUR02_SUPPLIER_ITEMS.MULTIPLE_QTY," + "PUR02_SUPPLIER_ITEMS.UM_CODE_REG02,PUR02_SUPPLIER_ITEMS.ENABLED,SYS10_COMPANY_TRANSLATIONS.DESCRIPTION,REG02_MEASURE_UNITS.DECIMALS," + "ITM01_ITEMS.VAT_CODE_REG01,SYS10_VAT.DESCRIPTION,REG01_VATS.DEDUCTIBLE,REG01_VATS.VALUE," + "PUR04_SUPPLIER_PRICES.VALUE,PUR04_SUPPLIER_PRICES.START_DATE,PUR04_SUPPLIER_PRICES.END_DATE," + "ITM01_ITEMS.USE_VARIANT_1,ITM01_ITEMS.USE_VARIANT_2,ITM01_ITEMS.USE_VARIANT_3,ITM01_ITEMS.USE_VARIANT_4,ITM01_ITEMS.USE_VARIANT_5, " + "ITM01_ITEMS.NO_WAREHOUSE_MOV " + " from PUR02_SUPPLIER_ITEMS,SYS10_COMPANY_TRANSLATIONS,ITM01_ITEMS,REG02_MEASURE_UNITS,SYS10_TRANSLATIONS SYS10_VAT,REG01_VATS,PUR04_SUPPLIER_PRICES where " + "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE02=? and " + "PUR02_SUPPLIER_ITEMS.UM_CODE_REG02=REG02_MEASURE_UNITS.UM_CODE and " + "PUR02_SUPPLIER_ITEMS.COMPANY_CODE_SYS01=ITM01_ITEMS.COMPANY_CODE_SYS01 and " + "PUR02_SUPPLIER_ITEMS.ITEM_CODE_ITM01=ITM01_ITEMS.ITEM_CODE and " + "ITM01_ITEMS.COMPANY_CODE_SYS01=SYS10_COMPANY_TRANSLATIONS.COMPANY_CODE_SYS01 and " + "ITM01_ITEMS.PROGRESSIVE_SYS10=SYS10_COMPANY_TRANSLATIONS.PROGRESSIVE and " + "SYS10_COMPANY_TRANSLATIONS.LANGUAGE_CODE=? and " + "PUR02_SUPPLIER_ITEMS.COMPANY_CODE_SYS01 = ? and " + "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_REG04=? and " + "PUR02_SUPPLIER_ITEMS.ENABLED='Y' and " + "ITM01_ITEMS.VAT_CODE_REG01=REG01_VATS.VAT_CODE and " + "REG01_VATS.PROGRESSIVE_SYS10=SYS10_VAT.PROGRESSIVE and " + "SYS10_VAT.LANGUAGE_CODE=? and " + "PUR02_SUPPLIER_ITEMS.COMPANY_CODE_SYS01=PUR04_SUPPLIER_PRICES.COMPANY_CODE_SYS01 and " + "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_REG04=PUR04_SUPPLIER_PRICES.PROGRESSIVE_REG04 and " + "PUR02_SUPPLIER_ITEMS.ITEM_CODE_ITM01=PUR04_SUPPLIER_PRICES.ITEM_CODE_ITM01 and " + "PUR04_SUPPLIER_PRICES.PRICELIST_CODE_PUR03=? and " + "PUR04_SUPPLIER_PRICES.START_DATE<=? and " + "PUR04_SUPPLIER_PRICES.END_DATE>? "; if (rootProgressiveHIE01 == null || !rootProgressiveHIE01.equals(progressiveHIE01)) { // retrieve all subnodes of the specified node... pstmt = conn.prepareStatement( "select HIE01_COMPANY_LEVELS.PROGRESSIVE,HIE01_COMPANY_LEVELS.PROGRESSIVE_HIE01,HIE01_COMPANY_LEVELS.LEV from HIE01_COMPANY_LEVELS " + "where COMPANY_CODE_SYS01='" + companyCodeSYS01 + "' and ENABLED='Y' and PROGRESSIVE_HIE02=? and PROGRESSIVE>=? " + "order by LEV,PROGRESSIVE_HIE01,PROGRESSIVE"); pstmt.setBigDecimal(1, progressiveHIE02); pstmt.setBigDecimal(2, progressiveHIE01); ResultSet rset = pstmt.executeQuery(); HashSet currentLevelNodes = new HashSet(); HashSet newLevelNodes = new HashSet(); String nodes = ""; int currentLevel = -1; while (rset.next()) { if (currentLevel != rset.getInt(3)) { // next level... currentLevel = rset.getInt(3); currentLevelNodes = newLevelNodes; newLevelNodes = new HashSet(); } if (rset.getBigDecimal(1).equals(progressiveHIE01)) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } else if (currentLevelNodes.contains(rset.getBigDecimal(2))) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } } rset.close(); pstmt.close(); if (nodes.length() > 0) nodes = nodes.substring(0, nodes.length() - 1); if (rootProgressiveHIE01 != null || nodes.length() > 0) sql += " and PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE01 in (" + nodes + ")"; } Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01PUR02", "PUR02_SUPPLIER_ITEMS.COMPANY_CODE_SYS01"); attribute2dbField.put("itemCodeItm01PUR02", "PUR02_SUPPLIER_ITEMS.ITEM_CODE_ITM01"); attribute2dbField.put("supplierItemCodePUR02", "PUR02_SUPPLIER_ITEMS.SUPPLIER_ITEM_CODE"); attribute2dbField.put("progressiveReg04PUR02", "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_REG04"); attribute2dbField.put("progressiveHie02PUR02", "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE02"); attribute2dbField.put("progressiveHie01PUR02", "PUR02_SUPPLIER_ITEMS.PROGRESSIVE_HIE01"); attribute2dbField.put("minPurchaseQtyPUR02", "PUR02_SUPPLIER_ITEMS.MIN_PURCHASE_QTY"); attribute2dbField.put("multipleQtyPUR02", "PUR02_SUPPLIER_ITEMS.MULTIPLE_QTY"); attribute2dbField.put("umCodeReg02PUR02", "PUR02_SUPPLIER_ITEMS.UM_CODE_REG02"); attribute2dbField.put("enabledPUR02", "PUR02_SUPPLIER_ITEMS.ENABLED"); attribute2dbField.put("descriptionSYS10", "SYS10_COMPANY_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("decimalsREG02", "REG02_MEASURE_UNITS.DECIMALS"); attribute2dbField.put("vatCodeReg01ITM01", "ITM01_ITEMS.VAT_CODE_REG01"); attribute2dbField.put("vatDescriptionSYS10", "SYS10_VAT.DESCRIPTION"); attribute2dbField.put("deductibleREG01", "REG01_VATS.DEDUCTIBLE"); attribute2dbField.put("valueREG01", "REG01_VATS.VALUE"); attribute2dbField.put("valuePUR04", "PUR04_SUPPLIER_PRICES.VALUE"); attribute2dbField.put("startDatePUR04", "PUR04_SUPPLIER_PRICES.START_DATE"); attribute2dbField.put("endDatePUR04", "PUR04_SUPPLIER_PRICES.END_DATE"); attribute2dbField.put("useVariant1ITM01", "ITM01_ITEMS.USE_VARIANT_1"); attribute2dbField.put("useVariant2ITM01", "ITM01_ITEMS.USE_VARIANT_2"); attribute2dbField.put("useVariant3ITM01", "ITM01_ITEMS.USE_VARIANT_3"); attribute2dbField.put("useVariant4ITM01", "ITM01_ITEMS.USE_VARIANT_4"); attribute2dbField.put("useVariant5ITM01", "ITM01_ITEMS.USE_VARIANT_5"); attribute2dbField.put("noWarehouseMovITM01", "ITM01_ITEMS.NO_WAREHOUSE_MOV"); ArrayList values = new ArrayList(); values.add(progressiveHIE02); values.add(serverLanguageId); values.add(companyCodeSYS01); values.add(progressiveREG04); values.add(serverLanguageId); values.add(pricelistCodePUR03); values.add(new java.sql.Date(System.currentTimeMillis())); values.add(new java.sql.Date(System.currentTimeMillis())); // read from PUR02 table... Response answer = CustomizeQueryUtil.getQuery( conn, new UserSessionParameters(username), sql, values, attribute2dbField, SupplierPriceItemVO.class, "Y", "N", null, pars, 50, true, customizedFields); if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOListResponse) answer; } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while fetching supplier items list", ex); throw new Exception(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception exx) { } try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }
/** * This method must be overridden by the subclass to retrieve data and return the valorized value * object. * * @param valueObjectClass value object class * @return a VOResponse object if data loading is successfully completed, or an ErrorResponse * object if an error occours */ public Response loadData(Class valueObjectClass) { Statement stmt = null; try { // since this method could be invoked also when selecting another row on the linked grid, // the pk attribute must be recalculated from the grid... int row = gridFrame.getGrid().getSelectedRow(); if (row != -1) { TestVO gridVO = (TestVO) gridFrame.getGrid().getVOListTableModel().getObjectForRow(row); pk = gridVO.getStringValue(); } stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "select DEMO4.TEXT,DEMO4.DECNUM,DEMO4.CURRNUM,DEMO4.THEDATE,DEMO4.COMBO,DEMO4.CHECK_BOX,DEMO4.RADIO,DEMO4.CODE," + "DEMO4_LOOKUP.DESCRCODE,DEMO4.TA,DEMO4.FORMATTED_TEXT,DEMO4.URI,DEMO4.LINK_LABEL,DEMO4.YEAR,DEMO4.FILENAME " + "from DEMO4,DEMO4_LOOKUP where TEXT='" + pk + "' and DEMO4.CODE=DEMO4_LOOKUP.CODE"); if (rset.next()) { DetailTestVO vo = new DetailTestVO(); vo.setCheckValue( rset.getObject(6) == null || !rset.getObject(6).equals("Y") ? Boolean.FALSE : Boolean.TRUE); vo.setCombo(new ComboVO()); vo.getCombo().setCode(rset.getString(5)); // this is a simplification: in a real situation combo v.o. will be retrieved from the // database... Domain d = ClientSettings.getInstance().getDomain("ORDERSTATE"); if (vo.getCombo().getCode().equals("O")) vo.getCombo().setDescription("opened"); else if (vo.getCombo().getCode().equals("S")) vo.getCombo().setDescription("sospended"); else if (vo.getCombo().getCode().equals("D")) vo.getCombo().setDescription("delivered"); else if (vo.getCombo().getCode().equals("C")) vo.getCombo().setDescription("closed"); vo.setCurrencyValue(rset.getBigDecimal(3)); vo.setDateValue(rset.getDate(4)); vo.setNumericValue(rset.getBigDecimal(2)); vo.setRadioButtonValue( rset.getObject(7) == null || !rset.getObject(7).equals("Y") ? Boolean.FALSE : Boolean.TRUE); vo.setStringValue(rset.getString(1)); vo.setLookupValue(rset.getString(8)); vo.setDescrLookupValue(rset.getString(9)); vo.setTaValue(rset.getString(10)); vo.setFormattedTextValue(rset.getString(11)); vo.setUri(rset.getString(12)); vo.setLinkLabel(rset.getString(13)); vo.setYear(rset.getBigDecimal(14)); vo.setFilename(rset.getString(15)); vo.setTooltipURI(vo.getUri()); try { if (vo.getFilename() != null) { File f = new File(vo.getFilename()); BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); byte[] bytes = new byte[(int) f.length()]; in.read(bytes); in.close(); vo.setFile(bytes); } } catch (Exception ex) { ex.printStackTrace(); } stmt.close(); stmt = conn.createStatement(); rset = stmt.executeQuery( "select DEMO4_LIST_VALUES.CODE from DEMO4_LIST_VALUES where TEXT='" + pk + "'"); ArrayList codes = new ArrayList(); while (rset.next()) { codes.add(rset.getString(1)); } vo.setListValues(codes); return new VOResponse(vo); } else return new ErrorResponse("No data found."); } catch (SQLException ex) { ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { stmt.close(); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); // retrieve companies list... GridParams gridParams = (GridParams) inputPar; String companies = (String) gridParams .getOtherGridParams() .get(ApplicationConsts.COMPANY_CODE_SYS01); // used in lookup grid... if (companies == null) { ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("SAL06"); companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); } else companies = "'" + companies + "'"; String sql = "select SAL06_CHARGES.COMPANY_CODE_SYS01,SAL06_CHARGES.CHARGE_CODE,SAL06_CHARGES.PROGRESSIVE_SYS10," + "SYS10_TRANSLATIONS.DESCRIPTION,SAL06_CHARGES.VALUE,SAL06_CHARGES.PERC,SAL06_CHARGES.VAT_CODE_REG01," + "SAL06_CHARGES.CURRENCY_CODE_REG03,SAL06_CHARGES.ENABLED" + " from SAL06_CHARGES,SYS10_TRANSLATIONS where " + "SAL06_CHARGES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "SAL06_CHARGES.ENABLED='Y' and " + "SAL06_CHARGES.COMPANY_CODE_SYS01 in (" + companies + ")"; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01SAL06", "SAL06_CHARGES.COMPANY_CODE_SYS01"); attribute2dbField.put("chargeCodeSAL06", "SAL06_CHARGES.CHARGE_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveSys10SAL06", "SAL06_CHARGES.PROGRESSIVE_SYS10"); attribute2dbField.put("valueSAL06", "SAL06_CHARGES.VALUE"); attribute2dbField.put("percSAL06", "SAL06_CHARGES.PERC"); attribute2dbField.put("vatCodeReg01SAL06", "SAL06_CHARGES.VAT_CODE_REG01"); attribute2dbField.put("currencyCodeReg03SAL06", "SAL06_CHARGES.CURRENCY_CODE_REG03"); attribute2dbField.put("enabledSAL06", "SAL06_CHARGES.ENABLED"); ArrayList values = new ArrayList(); values.add(serverLanguageId); // read from SAL06 table... Response res = CustomizeQueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, ChargeVO.class, "Y", "N", context, gridParams, 50, true, new BigDecimal(292) // window identifier... ); if (res.isError()) return res; ArrayList list = ((VOListResponse) res).getRows(); ChargeVO vo = null; sql = "select SYS10_TRANSLATIONS.DESCRIPTION,REG01_VATS.VALUE,REG01_VATS.DEDUCTIBLE " + "from SYS10_TRANSLATIONS,REG01_VATS where " + "REG01_VATS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "REG01_VATS.VAT_CODE=?"; pstmt = conn.prepareStatement(sql); ResultSet rset = null; for (int i = 0; i < list.size(); i++) { vo = (ChargeVO) list.get(i); if (vo.getVatCodeReg01SAL06() != null) { // retrieve vat data from REG01... pstmt.setString(1, serverLanguageId); pstmt.setString(2, vo.getVatCodeReg01SAL06()); rset = pstmt.executeQuery(); if (rset.next()) { vo.setVatDescriptionSYS10(rset.getString(1)); vo.setVatValueREG01(rset.getBigDecimal(2)); vo.setVatDeductibleREG01(rset.getBigDecimal(3)); } rset.close(); } } Response answer = res; // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching charges list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); PreparedStatement pstmt = null; Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); GridParams pars = (GridParams) inputPar; BigDecimal rootProgressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.ROOT_PROGRESSIVE_HIE01); BigDecimal progressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE01); BigDecimal progressiveHIE02 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE02); Boolean productsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.PRODUCTS_ONLY); Boolean compsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.COMPONENTS_ONLY); HierarchyLevelVO vo = (HierarchyLevelVO) pars.getOtherGridParams().get(ApplicationConsts.TREE_FILTER); if (vo != null) { progressiveHIE01 = vo.getProgressiveHIE01(); progressiveHIE02 = vo.getProgressiveHie02HIE01(); } // retrieve companies list... ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("ITM01"); String companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); String sql = "select ITM01_ITEMS.COMPANY_CODE_SYS01,ITM01_ITEMS.ITEM_CODE,SYS10_TRANSLATIONS.DESCRIPTION,ITM01_ITEMS.PROGRESSIVE_HIE02,ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02," + "ITM01_ITEMS.PROGRESSIVE_HIE01,ITM01_ITEMS.SERIAL_NUMBER_REQUIRED,REG02_MEASURE_UNITS.DECIMALS " + " from ITM01_ITEMS,SYS10_TRANSLATIONS,REG02_MEASURE_UNITS where " + "ITM01_ITEMS.PROGRESSIVE_HIE02=? and " + "ITM01_ITEMS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "ITM01_ITEMS.COMPANY_CODE_SYS01 in (" + companies + ") and " + "ITM01_ITEMS.ENABLED='Y' and " + "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02=REG02_MEASURE_UNITS.UM_CODE "; if (productsOnly != null && productsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is not null "; if (compsOnly != null && compsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is null "; if (rootProgressiveHIE01 == null || !rootProgressiveHIE01.equals(progressiveHIE01)) { // retrieve all subnodes of the specified node... pstmt = conn.prepareStatement( "select HIE01_LEVELS.PROGRESSIVE,HIE01_LEVELS.PROGRESSIVE_HIE01,HIE01_LEVELS.LEV from HIE01_LEVELS " + "where ENABLED='Y' and PROGRESSIVE_HIE02=? and PROGRESSIVE>=? " + "order by LEV,PROGRESSIVE_HIE01,PROGRESSIVE"); pstmt.setBigDecimal(1, progressiveHIE02); pstmt.setBigDecimal(2, progressiveHIE01); ResultSet rset = pstmt.executeQuery(); HashSet currentLevelNodes = new HashSet(); HashSet newLevelNodes = new HashSet(); String nodes = ""; int currentLevel = -1; while (rset.next()) { if (currentLevel != rset.getInt(3)) { // next level... currentLevel = rset.getInt(3); currentLevelNodes = newLevelNodes; newLevelNodes = new HashSet(); } if (rset.getBigDecimal(1).equals(progressiveHIE01)) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } else if (currentLevelNodes.contains(rset.getBigDecimal(2))) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } } rset.close(); pstmt.close(); if (nodes.length() > 0) nodes = nodes.substring(0, nodes.length() - 1); sql += " and PROGRESSIVE_HIE01 in (" + nodes + ")"; } Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01ITM01", "ITM01_ITEMS.COMPANY_CODE_SYS01"); attribute2dbField.put("itemCodeITM01", "ITM01_ITEMS.ITEM_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveHie02ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE02"); attribute2dbField.put( "minSellingQtyUmCodeReg02ITM01", "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02"); attribute2dbField.put("progressiveHie01ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE01"); attribute2dbField.put("serialNumberRequiredITM01", "ITM01_ITEMS.SERIAL_NUMBER_REQUIRED"); attribute2dbField.put("decimalsREG02", "REG02_MEASURE_UNITS.DECIMALS"); ArrayList values = new ArrayList(); values.add(progressiveHIE02); values.add(serverLanguageId); // read from ITM01 table... Response answer = QueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, GridItemVO.class, "Y", "N", context, pars, 50, true); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching items list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public VOListResponse loadOutDeliveryNotesForSaleDoc( GridParams pars, String serverLanguageId, String username, ArrayList companiesList) throws Throwable { PreparedStatement pstmt = null; Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; // retrieve companies list... String companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); String sql = "select DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01,DOC08_DELIVERY_NOTES.DOC_TYPE," + "DOC08_DELIVERY_NOTES.DOC_YEAR,DOC08_DELIVERY_NOTES.DOC_NUMBER,DOC08_DELIVERY_NOTES.DOC_DATE, " + "DOC08_DELIVERY_NOTES.DESTINATION_CODE_REG18,DOC08_DELIVERY_NOTES.DESCRIPTION," + "DOC08_DELIVERY_NOTES.DOC_SEQUENCE " + " from DOC08_DELIVERY_NOTES where " + "DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01 in (" + companies + ") and " + "DOC08_DELIVERY_NOTES.ENABLED='Y' and " + "DOC08_DELIVERY_NOTES.DOC_TYPE=? and " + "DOC08_DELIVERY_NOTES.DOC_STATE=? and " + "(DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01,DOC08_DELIVERY_NOTES.DOC_TYPE,DOC08_DELIVERY_NOTES.DOC_YEAR,DOC08_DELIVERY_NOTES.DOC_NUMBER) " + " in (select DOC10_OUT_DELIVERY_NOTE_ITEMS.COMPANY_CODE_SYS01,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_TYPE,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_YEAR,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_NUMBER " + " from DOC10_OUT_DELIVERY_NOTE_ITEMS where " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.COMPANY_CODE_SYS01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_TYPE_DOC01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_YEAR_DOC01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_NUMBER_DOC01=? "; DetailSaleDocVO docVO = (DetailSaleDocVO) pars.getOtherGridParams().get(ApplicationConsts.SALE_DOC_VO); // invoice document... if (docVO.getDocNumberDOC01() == null) sql += " and DOC10_OUT_DELIVERY_NOTE_ITEMS.QTY-DOC10_OUT_DELIVERY_NOTE_ITEMS.INVOICE_QTY>0)"; else sql += ")"; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01DOC08", "DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01"); attribute2dbField.put("docTypeDOC08", "DOC08_DELIVERY_NOTES.DOC_TYPE"); attribute2dbField.put("docYearDOC08", "DOC08_DELIVERY_NOTES.DOC_YEAR"); attribute2dbField.put("docNumberDOC08", "DOC08_DELIVERY_NOTES.DOC_NUMBER"); attribute2dbField.put("docDateDOC08", "DOC08_DELIVERY_NOTES.DOC_DATE"); attribute2dbField.put( "destinationCodeReg18DOC08", "DOC08_DELIVERY_NOTES.DESTINATION_CODE_REG18"); attribute2dbField.put("descriptionDOC08", "DOC08_DELIVERY_NOTES.DESCRIPTION"); attribute2dbField.put("docSequenceDOC08", "DOC08_DELIVERY_NOTES.DOC_SEQUENCE"); ArrayList values = new ArrayList(); values.add(ApplicationConsts.OUT_DELIVERY_NOTE_DOC_TYPE); values.add(ApplicationConsts.CLOSED); values.add(docVO.getCompanyCodeSys01DOC01()); values.add(docVO.getDocTypeDoc01DOC01()); values.add(docVO.getDocYearDoc01DOC01()); values.add(docVO.getDocNumberDoc01DOC01()); // read from DOC08 table... Response res = QueryUtil.getQuery( conn, new UserSessionParameters(username), sql, values, attribute2dbField, OutDeliveryNotesVO.class, "Y", "N", null, pars, true); if (res.isError()) throw new Exception(res.getErrorMessage()); // check if the invoice document has been already created and there exists delivery notes // linked to it... if (docVO.getDocNumberDOC01() != null) { pstmt = conn.prepareStatement( "select DOC08_DELIVERY_NOTES.DOC_NUMBER from DOC08_DELIVERY_NOTES where " + "DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01 in (" + companies + ") and " + "DOC08_DELIVERY_NOTES.ENABLED='Y' and " + "DOC08_DELIVERY_NOTES.DOC_TYPE=? and " + "DOC08_DELIVERY_NOTES.DOC_STATE=? and " + "(DOC08_DELIVERY_NOTES.COMPANY_CODE_SYS01,DOC08_DELIVERY_NOTES.DOC_TYPE,DOC08_DELIVERY_NOTES.DOC_YEAR,DOC08_DELIVERY_NOTES.DOC_NUMBER) " + " in (select DOC10_OUT_DELIVERY_NOTE_ITEMS.COMPANY_CODE_SYS01,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_TYPE,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_YEAR,DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_NUMBER " + " from DOC10_OUT_DELIVERY_NOTE_ITEMS,DOC02_SELLING_ITEMS where " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.COMPANY_CODE_SYS01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_TYPE_DOC01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_YEAR_DOC01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.DOC_NUMBER_DOC01=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.COMPANY_CODE_SYS01=DOC02_SELLING_ITEMS.COMPANY_CODE_SYS01 and " + " DOC02_SELLING_ITEMS.DOC_TYPE=? and " + " DOC02_SELLING_ITEMS.DOC_YEAR=? and " + " DOC02_SELLING_ITEMS.DOC_NUMBER=? and " + " DOC10_OUT_DELIVERY_NOTE_ITEMS.ITEM_CODE_ITM01=DOC02_SELLING_ITEMS.ITEM_CODE_ITM01)"); pstmt.setString(1, ApplicationConsts.OUT_DELIVERY_NOTE_DOC_TYPE); pstmt.setString(2, ApplicationConsts.CLOSED); pstmt.setString(3, docVO.getCompanyCodeSys01DOC01()); pstmt.setString(4, docVO.getDocTypeDoc01DOC01()); pstmt.setBigDecimal(5, docVO.getDocYearDoc01DOC01()); pstmt.setBigDecimal(6, docVO.getDocNumberDoc01DOC01()); pstmt.setString(7, docVO.getDocTypeDOC01()); pstmt.setBigDecimal(8, docVO.getDocYearDOC01()); pstmt.setBigDecimal(9, docVO.getDocNumberDOC01()); HashSet docNumberDOC08s = new HashSet(); ResultSet rset = pstmt.executeQuery(); while (rset.next()) docNumberDOC08s.add(rset.getBigDecimal(1)); rset.close(); java.util.List rows = ((VOListResponse) res).getRows(); OutDeliveryNotesVO vo = null; for (int i = 0; i < rows.size(); i++) { vo = (OutDeliveryNotesVO) rows.get(i); if (docNumberDOC08s.contains(vo.getDocNumberDOC08())) vo.setSelected(Boolean.TRUE); } } Response answer = res; if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOListResponse) answer; } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "executeCommand", "Error while fetching out delivery notes list, related to the specified sale document", ex); throw new Exception(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception exx) { } try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }
@Override public String execute() throws Exception { Connection conn = null; PreparedStatement cStmt = null; String query; try { conn = Constants.DATASOURCE.getConnection(); Long step = (super.cF.getTimeInMillis() - super.cI.getTimeInMillis()) / 1000; step = step / super.spansNumber + (step % super.spansNumber == 0L ? 0 : 1); // round up cI.add(Calendar.SECOND, (int) (start * step)); Calendar c = null; if (limit != null && limit <= super.spansNumber) (c = (Calendar) cI.clone()).add(Calendar.SECOND, (int) (limit * step)); else c = (Calendar) cF.clone(); if (c.before(cF)) cF = c; // CallableStatement cStmt = conn.prepareCall(SqlQuery.SP_RTT_CHART.getSql()); // cStmt.setInt(1, super.idServiceInstance); // cStmt.setTimestamp(2, new Timestamp(super.cI.getTimeInMillis())); // cStmt.setTimestamp(3, new Timestamp(super.cF.getTimeInMillis())); // cStmt.setLong(4, step); table = new ActivityTable(); List<ActivityRecord> records = new LinkedList<ActivityRecord>(); DateFormat formatter = new DateFormat(getLocale().getLanguage()); c = (Calendar) cI.clone(); // boolean hadResults = cStmt.execute(); boolean fullTime = step < 60; if (step > 0) { while (c.getTimeInMillis() < cF.getTimeInMillis()) { query = "SELECT AVG(elapsedTime) as avgRtt FROM esgf_dashboard.service_status WHERE idServiceInstance="; query = query + super.idServiceInstance; query = query + " AND timestamp between '"; query = query + new Timestamp(c.getTimeInMillis()) + "' AND '"; // while(hadResults) { // ResultSet rs = cStmt.getResultSet(); ActivityRecord record = new ActivityRecord(); record.setStartDate(formatter.formatDate(c)); record.setStartTime(formatter.formatTime(c, fullTime)); c.add(Calendar.SECOND, step.intValue()); query = query + new Timestamp(c.getTimeInMillis()) + "'"; // System.out.println("|||->>> RTTTableAction Query = "+query); cStmt = conn.prepareStatement(query); ResultSet rs = cStmt.executeQuery(); record.setEndDate(formatter.formatDate(c)); record.setEndTime(formatter.formatTime(c, fullTime)); record.setValues(new LinkedList<Number>()); if (rs.next() && rs.getBigDecimal("avgRtt") != null) record .getValues() .add(Math.round(rs.getBigDecimal("avgRtt").doubleValue() / 10.) / 100.); else record.getValues().add(null); records.add(record); // hadResults = cStmt.getMoreResults(); } // endwhile } // endif cStmt.close(); table.setActivityRecords(records); table.setTotalCount(super.spansNumber); } catch (SQLException e) { return ERROR; } finally { if (conn != null) conn.close(); } return SUCCESS; }
protected ReportParameterValue[] getParamValuesFromDataSource( ReportParameter param, Map<String, Object> parameters) throws ProviderException { Connection conn = null; PreparedStatement pStmt = null; ResultSet rs = null; try { ReportDataSource dataSource = param.getDataSource(); conn = dataSourceProvider.getConnection(dataSource.getId()); if (parameters == null || parameters.isEmpty()) { pStmt = conn.prepareStatement(param.getData()); } else { } rs = pStmt.executeQuery(); ResultSetMetaData rsMetaData = rs.getMetaData(); boolean multipleColumns = false; if (rsMetaData.getColumnCount() > 1) multipleColumns = true; ArrayList<ReportParameterValue> v = new ArrayList<ReportParameterValue>(); while (rs.next()) { ReportParameterValue value = new ReportParameterValue(); if (param.getClassName().equals("java.lang.String")) { value.setId(rs.getString(1)); } else if (param.getClassName().equals("java.lang.Double")) { value.setId(new Double(rs.getDouble(1))); } else if (param.getClassName().equals("java.lang.Integer")) { value.setId(new Integer(rs.getInt(1))); } else if (param.getClassName().equals("java.lang.Long")) { value.setId(new Long(rs.getLong(1))); } else if (param.getClassName().equals("java.math.BigDecimal")) { value.setId(rs.getBigDecimal(1)); } else if (param.getClassName().equals("java.util.Date")) { value.setId(rs.getDate(1)); } else if (param.getClassName().equals("java.sql.Date")) { value.setId(rs.getDate(1)); } else if (param.getClassName().equals("java.sql.Timestamp")) { value.setId(rs.getTimestamp(1)); } if (multipleColumns) { value.setDescription(rs.getString(2)); } v.add(value); } rs.close(); ReportParameterValue[] values = new ReportParameterValue[v.size()]; v.toArray(values); return values; } catch (Exception e) { throw new ProviderException("Error retreiving param values from database: " + e.getMessage()); } finally { try { if (pStmt != null) pStmt.close(); if (conn != null) conn.close(); } catch (Exception c) { log.error("Error closing"); } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); String username = ((JAIOUserSessionParameters) userSessionPars).getUsername(); Connection conn = null; Statement stmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "select SYS04_ROLES.PROGRESSIVE,SYS04_ROLES.PROGRESSIVE_SYS10,SYS10_TRANSLATIONS.DESCRIPTION from " + "SYS14_USER_ROLES,SYS04_ROLES,SYS10_TRANSLATIONS where " + "SYS14_USER_ROLES.PROGRESSIVE_SYS04=SYS04_ROLES.PROGRESSIVE and " + "SYS04_ROLES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE='" + serverLanguageId + "' and " + "SYS14_USER_ROLES.USERNAME_SYS03='" + username + "' and " + "SYS04_ROLES.ENABLED='Y'"); RoleVO vo = null; ArrayList list = new ArrayList(); while (rset.next()) { vo = new RoleVO(); vo.setDescriptionSYS10(rset.getString(3)); vo.setEnabledSYS04("Y"); vo.setProgressiveSYS04(rset.getBigDecimal(1)); vo.setProgressiveSys10SYS04(rset.getBigDecimal(2)); list.add(vo); } rset.close(); Response answer = new VOListResponse(list, false, list.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching user roles list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { stmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }