*
*/
public StoreViewBean buildViewBeanStore(final RequestData requestData, final Store store) throws Exception {
final Localization localization = requestData.getMarketAreaLocalization();
final StoreViewBean storeViewBean = new StoreViewBean();
storeViewBean.setCode(store.getCode());
storeViewBean.setName(store.getName());
storeViewBean.setAddress1(store.getAddress1());
storeViewBean.setAddress2(store.getAddress2());
storeViewBean.setAddressAdditionalInformation(store.getAddressAdditionalInformation());
storeViewBean.setPostalCode(store.getPostalCode());
// I18n values
storeViewBean.setCity(store.getCity());
String i18nCityName = store.getI18nCity(localization);
if(StringUtils.isNotEmpty(i18nCityName)){
storeViewBean.setCity(i18nCityName);
}
storeViewBean.setStateCode(store.getStateCode());
storeViewBean.setCountry(store.getCountryCode());
storeViewBean.setCountryCode(store.getCountryCode());
storeViewBean.setEmail(store.getEmail());
storeViewBean.setPhone(store.getPhone());
storeViewBean.setFax(store.getFax());
storeViewBean.setWebsite(store.getWebsite());
storeViewBean.setLongitude(store.getLongitude());
storeViewBean.setLatitude(store.getLatitude());
final Asset defaultPackshotImage = store.getDefaultPackshotImage(ImageSize.SMALL.name());
if (defaultPackshotImage != null) {
final String defaultImage = engineSettingService.getRetailerOrStoreImageWebPath(defaultPackshotImage);
storeViewBean.setDefaultImage(defaultImage);
} else {
storeViewBean.setDefaultImage("");
}
final Asset defaultIconImage = store.getDefaultThumbnailImage();
if (defaultIconImage != null) {
final String iconImage = engineSettingService.getRetailerOrStoreImageWebPath(defaultIconImage);
storeViewBean.setIconImage(iconImage);
} else {
storeViewBean.setIconImage("");
}
DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
if (store.getDateCreate() != null) {
storeViewBean.setDateCreate(dateFormat.format(store.getDateCreate()));
}
if (store.getDateUpdate() != null) {
storeViewBean.setDateUpdate(dateFormat.format(store.getDateUpdate()));
}
final List<Asset> assets = store.getSlideShows();
if(assets != null){
List<String> sliders = new ArrayList<String>();
for(Asset asset : assets ){
final String iconImage = engineSettingService.getRetailerOrStoreImageWebPath(asset);
sliders.add(iconImage);
}
storeViewBean.setSliders(sliders);
}
storeViewBean.setDetailsUrl(urlService.generateUrl(FoUrls.STORE_DETAILS, requestData, store));
return storeViewBean;
}