@Value("${ibt.cnh.initialproductplanning.getseasonalitycollection.url}") private String…
- User
@Value("${ibt.cnh.initialproductplanning.getseasonalitycollection.url}") private String seasonalityCollectionURL;
public List getSeasonalityCollection(Map<String, List> map, List batchIdList, List extractorRequest) { try {
codeParameterizedTypeReference<List<ProductSeasonality>> phasesTypeRef = new ParameterizedTypeReference<List<ProductSeasonality>>() { }; int p = 0; List<ProductSeasonality> productSeasonalityResponseList = new ArrayList<>(); for (Map.Entry entry : map.entrySet()) { String url = seasonalityCollectionURL + "/" + entry.getKey(); List<String> reqProductIds = new ArrayList<>(); reqProductIds.addAll((Collection<? extends String>) entry.getValue()); for (int j = 0; j < reqProductIds.size(); j = j + 400) { int start = j; int end = j + 400; end = end < reqProductIds.size() ? end : reqProductIds.size(); List<String> eachList = reqProductIds.subList(start, end); List<ProductSeasonality> seasonalityCollectionList = (List<ProductSeasonality>) restClient .postRequest(url, eachList, phasesTypeRef, cnhipproductBasicAuthenticationPasscode); if (seasonalityCollectionList != null && !seasonalityCollectionList.isEmpty()) { productSeasonalityResponseList.addAll(p, seasonalityCollectionList); p++; } } } return productSeasonalityResponseList; } catch (Exception e) { RestApiCallException serviceException = new RestApiCallException(e); serviceException.logErrorMessage(); logger.error("Error occured while calling Admin service ", e); if(!extractorRequest.get(0).getBatchId().equals(Constants.LENGOW_INTEGRATOR_BATCHID)) { subscriptionService.updateAuditTableStatus(batchIdList, Constants.PRODUCT_CORE_EXTRACT_STATUS); subscriptionService.updateBatchTableStatus(extractorRequest, Constants.PRODUCT_CORE_EXTRACT_STATUS); } throw serviceException; } } - Assistant