/** * @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; }
public ManufacturerDetails getBGDataWithMfg( final String supplierID, final String partNumber, final String orderNumber) throws CatalogException, IOException { BGCatalog bgCatalog = new BGCatalog( EpicoreConstants.HOST_IP, EpicoreConstants.DOMAIN_ID, EpicoreConstants.USER_NAME, EpicoreConstants.PASSWORD, supplierID, EpicoreConstants.SERVICE_TYPE); List<?> bgcataloglist = bgCatalog.GetBuyersGuideDataByVehEnhanced( "0", "0", "0", "0", "0", null, partNumber, null, orderNumber); List<CompatibilityInfo> bgDataInfos = new ArrayList<CompatibilityInfo>(); ManufacturerDetails mfgDetails = null; for (Object object : bgcataloglist) { if (object instanceof BGDataItemEnhanced) { BGDataItemEnhanced dataItemEnhanced = (BGDataItemEnhanced) object; /** This would remove repetitive data coming from response */ if (mfgDetails == null) { mfgDetails = new ManufacturerDetails(); mfgDetails.setManufacturer(dataItemEnhanced.getManufacturerName()); mfgDetails.setGroupText(dataItemEnhanced.getGroupText()); mfgDetails.setGroupNumber(dataItemEnhanced.getGroupNumber()); mfgDetails.setPartDescText(dataItemEnhanced.getPartDescriptionText()); mfgDetails.setPartDescID(dataItemEnhanced.getPartDescriptionID()); mfgDetails.setLineCode(dataItemEnhanced.getLineCode()); mfgDetails.setOrderNumber(dataItemEnhanced.getOrderNumber()); } CompatibilityInfo dataInfo = populateBGData(dataItemEnhanced); bgDataInfos.add(dataInfo); } } if (mfgDetails == null) { mfgDetails = new ManufacturerDetails(); } mfgDetails.setCompatibilityInfos(bgDataInfos); bgCatalog.DisconnectCatalogServer(); return mfgDetails; }