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; }
/** * @param dataItemEnhanced * @return */ private CompatibilityInfo populateBGData(BGDataItemEnhanced dataItemEnhanced) { CompatibilityInfo dataInfo = new CompatibilityInfo(); dataInfo.setAddDate(dataItemEnhanced.getAddDate()); dataInfo.setDetailsText(dataItemEnhanced.getDetailsText()); dataInfo.setEngineCode(dataItemEnhanced.getEngineCodeOfVehicle()); dataInfo.setEngineText(dataItemEnhanced.getEngineOfVehicle()); dataInfo.setFromYear(dataItemEnhanced.getFromYear()); dataInfo.setAddDate(dataItemEnhanced.getAddDate()); dataInfo.setLineDescription(dataItemEnhanced.getLineDescription()); dataInfo.setMakeCode(dataItemEnhanced.getMakeCodeOfVehicle()); dataInfo.setMakeText(dataItemEnhanced.getMakeOfVehicle()); dataInfo.setModelCode(dataItemEnhanced.getModelCodeOfVehicle()); dataInfo.setModelText(dataItemEnhanced.getModelOfVehicle()); dataInfo.setNumApps(dataItemEnhanced.getNumberOfApplication()); dataInfo.setPerCarQty(dataItemEnhanced.getPerVehicleQuantity()); dataInfo.setSpecCode1(dataItemEnhanced.getSpecCode1()); dataInfo.setSpecCode2(dataItemEnhanced.getSpecCode2()); dataInfo.setSpecCode3(dataItemEnhanced.getSpecCode3()); dataInfo.setSpecCode4(dataItemEnhanced.getSpecCode4()); dataInfo.setToYear(dataItemEnhanced.getToYear()); return dataInfo; }