/** Gets all of the various failed data and puts it into the HttpServletRequest object. */ public static ActionErrors getFailedData(HttpServletRequest request) { ActionErrors errors = new ActionErrors(); SystemAgent systemAgentEJB; try { // Get a reference to the admin facade APIAccess factory = new APIAccess(); systemAgentEJB = factory.getSystemAgentAPI(); } catch (Exception e) { e.printStackTrace(); errors.add("SystemManagerLogic", new ActionError("error.genericError", e.getMessage())); // without ejb access we can't proceed any farther return errors; } try { request.setAttribute("freeMemory", new Long(Runtime.getRuntime().freeMemory())); request.setAttribute("totalMemory", new Long(Runtime.getRuntime().totalMemory())); OrderDataVector odv = systemAgentEJB.getFailedOrders(); request.setAttribute("failedOrders", odv); odv = systemAgentEJB.getPendingOrders(); request.setAttribute("pendingOrders", odv); InvoiceCustDataVector icdv = systemAgentEJB.getFailedCustomerInvoices(); request.setAttribute("failedCustInvoice", icdv); InvoiceCustDataVector icdvcit = systemAgentEJB.getFailedCITCustomerInvoices(); request.setAttribute("failedCITCustInvoice", icdvcit); InvoiceDistDataVector iddv = systemAgentEJB.getFailedDistributorInvoices(); request.setAttribute("failedDistInvoice", iddv); OrderBatchLogDataVector obldv = systemAgentEJB.getFailedOrderBatchEntries(); request.setAttribute("failedOrderBatchEntries", obldv); PurchaseOrderDataVector podv = systemAgentEJB.getFailedPurchaseOrders(); request.setAttribute("failedPurchaseOrders", podv); RemittanceDataVector rdv = systemAgentEJB.getFailedRemittanceData(); request.setAttribute("failedRemittanceData", rdv); RemittanceDetailDataVector rddv = systemAgentEJB.getFailedRemittanceDetailData(); request.setAttribute("failedRemittanceDetailData", rddv); RemittancePropertyDataVector rpdv = systemAgentEJB.getUnparsableRemittanceData(); request.setAttribute("unparsableRemittanceData", rpdv); } catch (Exception e) { e.printStackTrace(); errors.add("SystemManagerLogic", new ActionError("error.genericError", e.getMessage())); } return errors; }
/** * Uses the system agent bean to verify that the dao layer is the same as the underlying database. */ public static ActionErrors verifyDaoLayer(HttpServletRequest request) { ActionErrors errors = new ActionErrors(); SystemAgent systemAgentEJB; try { // Get a reference to the admin facade APIAccess factory = new APIAccess(); systemAgentEJB = factory.getSystemAgentAPI(); } catch (Exception e) { e.printStackTrace(); errors.add("SystemManagerLogic", new ActionError("error.genericError", e.getMessage())); // without ejb access we can't proceed any farther return errors; } try { List daoErrors = systemAgentEJB.verifyDaoLayer(); request.setAttribute("daoErrors", daoErrors); } catch (Exception e) { e.printStackTrace(); errors.add("SystemManagerLogic", new ActionError("error.genericError", e.getMessage())); } return errors; }
public static ActionErrors refreshContent(HttpServletRequest request) { ActionErrors errors = new ActionErrors(); HttpSession session = request.getSession(); try { APIAccess factory = (APIAccess) session.getAttribute(Constants.APIACCESS); Content cont = factory.getContentAPI(); cont.refreshBinaryData(false); // APIAccess factory = new APIAccess(); // systemAgentEJB = factory.getSystemAgentAPI(); } catch (Exception e) { e.printStackTrace(); errors.add("SystemManagerLogic", new ActionError("error.genericError", e.getMessage())); return errors; } return errors; }
/** * Process this pipeline. * * @param OrderRequestData the order request object to act upon * @param Connection a active database connection * @param APIAccess */ public OrderPipelineBaton process( OrderPipelineBaton pBaton, OrderPipelineActor pActor, Connection pCon, APIAccess pFactory) throws PipelineException { try { pBaton = PipelineUtil.updateOrder(pBaton, pActor, pCon, pFactory); String orderStatusCd = pBaton.getOrderStatus(); if (orderStatusCd.equals(RefCodeNames.ORDER_STATUS_CD.PENDING_APPROVAL)) { PipelineUtil.sendPendingApprovalEmail(pCon, pBaton); } // Return pBaton.setWhatNext(OrderPipelineBaton.GO_NEXT); return pBaton; } catch (Exception exc) { exc.printStackTrace(); throw new PipelineException(exc.getMessage()); } finally { } }
/* *@param pCriteria List of SearchCriteria objects *@return a set of ItemView objects *@exception RemoteException */ public ItemViewVector searchStoreItems(List pCriteria, boolean pDistInfoFl) throws RemoteException { Connection con = null; try { con = getReportConnection(); Integer storeIdI = new Integer(0); String categCond = ""; String shortDescCond = ""; String manufCond = ""; String manufSkuCond = ""; String distSkuCond = ""; String storeFilter = ""; ///////////////////// // Create a set of filters for (Iterator iter = pCriteria.iterator(); iter.hasNext(); ) { SearchCriteria sc = (SearchCriteria) iter.next(); String name = sc.getName(); Object objValue = sc.getObjectValue(); String strValue = (objValue instanceof String) ? ((String) objValue).trim() : ""; if (SearchCriteria.STORE_ID.equals(name)) { storeIdI = (Integer) objValue; storeFilter = "select STORE_DIM_ID from DW_STORE_DIM \n" + " where STORE_ID = " + storeIdI + " \n"; } else if (SearchCriteria.CATALOG_CATEGORY.equals(name)) { String subStr = " like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n"; categCond = " and (UPPER(JD_CATEGORY1) " + subStr + " or \n" + " UPPER(JD_CATEGORY2) " + subStr + " or \n" + " UPPER(JD_CATEGORY3) " + subStr + ") \n"; } else if (SearchCriteria.PRODUCT_SHORT_DESC.equals(name)) { shortDescCond = " and UPPER(JD_ITEM_DESC) like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n"; } else if (SearchCriteria.MANUFACTURER_SHORT_DESC.equals(name)) { manufCond = " and UPPER(JD_MANUF_NAME) like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n"; } else if (SearchCriteria.MANUFACTURER_SKU_NUMBER.equals(name)) { manufSkuCond = " and UPPER(JD_MANUF_SKU) like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n"; } else if (SearchCriteria.DISTRIBUTOR_SKU_NUMBER.equals(name)) { distSkuCond = " and UPPER(JD_DIST_SKU) like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n"; } } // Get catalog id --------------------------------------------------------// /* int catalogId = 0; String sql = "select distinct STORE_CATALOG_ID from DW_CATEGORY_DIM \n" + " where STORE_DIM_ID IN (" + storeFilter + ")"; log( "DWOperationBean ---------------------------> sql1: " + sql); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); int count = 0; while (rs.next()) { count++; catalogId = rs.getInt(1); } rs.close(); stmt.close(); if (count == 0) { String errorMess = "No catalog for store. Store id: " + storeIdI; throw new Exception(errorMess); } if (count > 1) { String errorMess = "Multiple active catalogs for store. Store id: " + storeIdI; throw new Exception(errorMess); } */ // ---------------------------------------------------------------------// String sql = "select \n" + " id.ITEM_DIM_ID, \n" + " JD_ITEM_DESC , \n" + " JD_ITEM_PACK , \n" + " JD_ITEM_UOM , \n" + " JD_MANUF_SKU, \n" + " JD_MANUF_NAME, \n" + " JD_CATEGORY1 \n"; String fromSql = " from DW_ITEM_DIM id, \n " + " DW_CATEGORY_DIM cd, \n" + " DW_MANUFACTURER_DIM md \n"; String whereSql = " where id.CATEGORY_DIM_ID = cd.CATEGORY_DIM_ID \n" + // " and cd.STORE_CATALOG_ID = " + catalogId + " \n" + " and cd.STORE_DIM_ID IN (" + storeFilter + ") \n" + " and md.MANUFACTURER_DIM_ID = id.MANUFACTURER_DIM_ID \n"; // ---------------------------------------------------------------------// if (pDistInfoFl) { sql += " , JD_DIST_SKU, \n" + " (select JD_DIST_NAME from DW_DISTRIBUTOR_DIM dd \n" + " where DISTRIBUTOR_DIM_ID = did.DISTRIBUTOR_DIM_ID \n" + " ) JD_DIST_NAME \n"; fromSql += " ,DW_ITEM_DISTRIBUTOR did \n"; whereSql += " and id.ITEM_DIM_ID = did.ITEM_DIM_ID (+) \n" + distSkuCond; } sql += fromSql + whereSql; sql += categCond + shortDescCond + manufCond + manufSkuCond; sql += " order by JD_MANUF_SKU "; Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); ItemViewVector itemVwV = new ItemViewVector(); while (rs.next()) { ItemView itemVw = ItemView.createValue(); itemVwV.add(itemVw); itemVw.setStoreId(storeIdI.intValue()); // itemVw.setCatalogId(catalogId); itemVw.setItemId(rs.getInt("ITEM_DIM_ID")); itemVw.setName(Utility.strNN(rs.getString("JD_ITEM_DESC"))); itemVw.setSku(Utility.strNN(rs.getString("JD_MANUF_SKU"))); itemVw.setUom(Utility.strNN(rs.getString("JD_ITEM_UOM"))); itemVw.setPack(Utility.strNN(rs.getString("JD_ITEM_PACK"))); itemVw.setCategory(Utility.strNN(rs.getString("JD_CATEGORY1"))); itemVw.setManufName(Utility.strNN(rs.getString("JD_MANUF_NAME"))); itemVw.setManufSku(Utility.strNN(rs.getString("JD_MANUF_SKU"))); if (pDistInfoFl) { itemVw.setDistId(0); itemVw.setDistName(Utility.strNN(rs.getString("JD_DIST_NAME"))); itemVw.setDistSku(Utility.strNN(rs.getString("JD_DIST_SKU"))); } else { itemVw.setDistId(0); itemVw.setDistName(""); itemVw.setDistSku(""); } itemVw.setSelected(false); } rs.close(); stmt.close(); return itemVwV; } catch (Exception e) { e.printStackTrace(); throw new RemoteException(e.getMessage()); } finally { closeConnection(con); } }