/** * @param manufacturer * @return */ private BGManufactureInfo populateManufactureByPartNumber(BGManufacturer manufacturer) { BGManufactureInfo bgManufactureInfo = new BGManufactureInfo(); bgManufactureInfo.setManufactureName(manufacturer.getManufacturer()); bgManufactureInfo.setOrderNumber(manufacturer.getOrderNumber()); bgManufactureInfo.setDiscriptorText(manufacturer.getDescriptionText()); return bgManufactureInfo; }
/** * @param partNumber * @return * @throws CatalogException * @throws UnknownHostException * @throws IOException */ public List<BGManufactureInfo> getAllManufacturerByPartNumber( final String supplierID, final String partNumber) throws CatalogException, IOException { List<BGManufactureInfo> bgManufactureInfos = new ArrayList<BGManufactureInfo>(); BGCatalog bgCatalog = new BGCatalog( EpicoreConstants.HOST_IP, EpicoreConstants.DOMAIN_ID, EpicoreConstants.USER_NAME, EpicoreConstants.PASSWORD, supplierID, EpicoreConstants.SERVICE_TYPE); /** Step 1: Get all the manufacturers for the provided part number. */ List<?> mfgList = bgCatalog.GetBuyersGuideAllLinesManufacturer(partNumber, EpicoreConstants.DEFAULT_DATE); for (Object object : mfgList) { if (object instanceof BGManufacturer) { BGManufacturer manufacturer = (BGManufacturer) object; BGManufactureInfo bgManufactureInfo = populateManufactureByPartNumber(manufacturer); /** Step 2: Fetch coverage for each manufacturer. */ ManufacturerDetails mfgDetails = getBGDataWithMfg(supplierID, partNumber, bgManufactureInfo.getOrderNumber()); /** Step 3: Fetch C2C information */ C2CHelper c2cHelper = new C2CHelper(); LocalCover2Cover cover2Cover = c2cHelper.getCoverToCoverDetailsFromPartNumber( supplierID, partNumber, mfgDetails.getManufacturer(), mfgDetails.getLineCode(), mfgDetails.getOrderNumber()); mfgDetails.setLocalCover2Cover(cover2Cover); /** Step 4: Pricing information */ List<PricePartInfo> pricePartInfos = getPricesByMfgNameAndPartNumber(supplierID, mfgDetails.getManufacturer(), partNumber); mfgDetails.setPricePartInfos(pricePartInfos); bgManufactureInfo.setMfgDetails(mfgDetails); /** Adding the Manufacturer Information in the list. */ bgManufactureInfos.add(bgManufactureInfo); } } bgCatalog.DisconnectCatalogServer(); return bgManufactureInfos; }