cmsContext.setMarketPlaces(marketPlaces);
}
private void buildMarket(CmsContextPojo cmsContext, MarketPlacePojo selectedMarketPlace, MarketPojo selectedMarket){
List<MarketPojo> markets = new ArrayList<MarketPojo>();
MarketPojo masterMarket = new MarketPojo();
masterMarket.setCode("MASTER_MARKET");
masterMarket.setName("Master Market");
if(selectedMarket == null){
masterMarket.setSelected(true);
}
markets.add(masterMarket);
if(selectedMarketPlace != null){
for (Iterator<MarketPojo> iterator = selectedMarketPlace.getMarkets().iterator(); iterator.hasNext();) {
MarketPojo marketPojo = (MarketPojo) iterator.next();
MarketPojo market = marketPojoService.getMarketByCode(marketPojo.getCode());
if(selectedMarket != null
&& market.getCode().equals(selectedMarket.getCode())){
market.setSelected(true);
}
market.setMarketPlace(null);
market.setMarketAreas(null);
markets.add(market);
}
}
cmsContext.setMarkets(markets);