/** * to load all of the products from MS * * @return */ public HashMap<String, ProductsMS> retrieveProducts() { HashMap<String, ProductsMS> productMap = new HashMap<String, ProductsMS>(); List<ProductsMS> productList = this.getAll(true); for (ProductsMS productsMS : productList) { String key = productsMS.getSerial_number(); productMap.put(key, productsMS); } return productMap; }
/** * TO load the required products from MS * * @param barcodes * @return */ @SuppressWarnings("unchecked") public HashMap<String, ProductsMS> retrieveProducts(Set<String> barcodes) { DetachedCriteria productCriteria = DetachedCriteria.forClass(ProductsMS.class, "p"); productCriteria.add(Restrictions.in("p.serial_number", barcodes)); productCriteria.add(Restrictions.eq("p.deleted", ProductsMS.AVAILABLE_STATUS)); HashMap<String, ProductsMS> productMap = new HashMap<String, ProductsMS>(); List<ProductsMS> productList = this.getByCritera(productCriteria, false); for (ProductsMS productsMS : productList) { String key = productsMS.getSerial_number(); productMap.put(key, productsMS); } return productMap; }