cmsContext.setMarketAreas(marketAreas);
}
private void buildRetailer(CmsContextPojo cmsContext, MarketAreaPojo selectedMarketArea, RetailerPojo selectedRetailer){
List<RetailerPojo> retailers = new ArrayList<RetailerPojo>();
RetailerPojo retailer = new RetailerPojo();
retailer.setCode("MASTER_RETAILER");
retailer.setName("Master Retailer");
if(selectedRetailer == null){
retailer.setSelected(true);
}
retailers.add(retailer);
if(selectedMarketArea != null){
List<RetailerPojo> retailersByMarketAreaCode = retailerPojoService.findRetailersByMarketAreaCode(selectedMarketArea.getCode());
for (Iterator<RetailerPojo> iterator = retailersByMarketAreaCode.iterator(); iterator.hasNext();) {
RetailerPojo retailerPojo = (RetailerPojo) iterator.next();
if(selectedRetailer != null
&& retailerPojo.getCode().equals(selectedRetailer.getCode())){
retailerPojo.setSelected(true);
}
retailerPojo.setCustomerComments(null);
retailerPojo.setCustomerRates(null);
retailerPojo.setStores(null);
retailerPojo.setAddresses(null);
retailers.add(retailerPojo);
}
}
cmsContext.setRetailers(retailers);