/**
*
*/
public CustomerAddressViewBean buildViewBeanCustomeAddress(final RequestData requestData, final CustomerAddress customerAddress) throws Exception {
final Locale locale = requestData.getLocale();
final CustomerAddressViewBean customerAddressViewBean = new CustomerAddressViewBean();
customerAddressViewBean.setId(customerAddress.getId());
String addressName = customerAddress.getAddressName();
if (StringUtils.isNotEmpty(addressName)) {
customerAddressViewBean.setAddressName(addressName);
} else {
customerAddressViewBean.setAddressName(customerAddress.getCity());
}
customerAddressViewBean.setTitleCode(customerAddress.getTitle());
String titleLabel = referentialDataService.getTitleByLocale(customerAddress.getTitle(), locale);
customerAddressViewBean.setTitleLabel(titleLabel);
customerAddressViewBean.setLastname(customerAddress.getLastname());
customerAddressViewBean.setFirstname(customerAddress.getFirstname());
customerAddressViewBean.setAddress1(customerAddress.getAddress1());
customerAddressViewBean.setAddress2(customerAddress.getAddress2());
customerAddressViewBean.setAddressAdditionalInformation(customerAddress.getAddressAdditionalInformation());
customerAddressViewBean.setPostalCode(customerAddress.getPostalCode());
customerAddressViewBean.setCity(customerAddress.getCity());
customerAddressViewBean.setStateCode(customerAddress.getStateCode());
customerAddressViewBean.setAreaCode(customerAddress.getAreaCode());
customerAddressViewBean.setCountryCode(customerAddress.getCountryCode());
String coutryLabel = referentialDataService.getCountryByLocale(customerAddress.getCountryCode(), locale);
customerAddressViewBean.setCountryLabel(coutryLabel);
customerAddressViewBean.setDefaultBilling(customerAddress.isDefaultBilling());
customerAddressViewBean.setDefaultShipping(customerAddress.isDefaultShipping());
Long customerAddressId = customerAddress.getId();
Map<String, String> urlParams = new HashMap<String, String>();
urlParams.put(RequestConstants.REQUEST_PARAMETER_CUSTOMER_ADDRESS_GUID, customerAddressId.toString());
customerAddressViewBean.setEditUrl(urlService.generateUrl(FoUrls.PERSONAL_EDIT_ADDRESS, requestData, urlParams));
customerAddressViewBean.setDeleteUrl(urlService.generateUrl(FoUrls.PERSONAL_DELETE_ADDRESS, requestData, urlParams));
return customerAddressViewBean;
}