/**
*
*/
public WarehouseViewBean buildViewBeanWarehouse(final RequestData requestData, final Warehouse warehouse) throws Exception {
final WarehouseViewBean warehouseViewBean = new WarehouseViewBean();
if (warehouse != null) {
warehouseViewBean.setCode(warehouse.getCode());
warehouseViewBean.setName(warehouse.getName());
warehouseViewBean.setDescription(warehouse.getDescription());
warehouseViewBean.setAddress1(warehouse.getAddress1());
warehouseViewBean.setAddress2(warehouse.getAddress2());
warehouseViewBean.setAddressAdditionalInformation(warehouse.getAddressAdditionalInformation());
warehouseViewBean.setPostalCode(warehouse.getPostalCode());
// I18n values
warehouseViewBean.setCity(warehouse.getCity());
warehouseViewBean.setStateCode(warehouse.getStateCode());
warehouseViewBean.setCountry(warehouse.getCountryCode());
warehouseViewBean.setCountryCode(warehouse.getCountryCode());
warehouseViewBean.setLongitude(warehouse.getLongitude());
warehouseViewBean.setLatitude(warehouse.getLatitude());
DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
Date dateCreate = warehouse.getDateCreate();
if (dateCreate != null) {
warehouseViewBean.setDateCreate(dateFormat.format(dateCreate));
} else {
warehouseViewBean.setDateCreate(Constants.NOT_AVAILABLE);
}
Date dateUpdate = warehouse.getDateUpdate();
if (dateUpdate != null) {
warehouseViewBean.setDateUpdate(dateFormat.format(dateUpdate));
} else {
warehouseViewBean.setDateUpdate(Constants.NOT_AVAILABLE);
}
warehouseViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.WAREHOUSE_DETAILS, requestData, warehouse));
warehouseViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.WAREHOUSE_EDIT, requestData, warehouse));
}
return warehouseViewBean;
}