/**
* @throws Exception
*
*/
public RuleViewBean buildViewBeanRule(final RequestData requestData, final AbstractRuleReferential rule) throws Exception {
RuleViewBean ruleViewBean = new RuleViewBean();
ruleViewBean.setId(rule.getId());
ruleViewBean.setVersion(rule.getVersion());
ruleViewBean.setCode(rule.getCode());
ruleViewBean.setName(rule.getName());
ruleViewBean.setDescription(rule.getDescription());
ruleViewBean.setSalience(rule.getSalience());
DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
if (rule.getDateCreate() != null) {
ruleViewBean.setDateCreate(dateFormat.format(rule.getDateCreate()));
} else {
ruleViewBean.setDateCreate(Constants.NOT_AVAILABLE);
}
if (rule.getDateUpdate() != null) {
ruleViewBean.setDateUpdate(dateFormat.format(rule.getDateUpdate()));
} else {
ruleViewBean.setDateUpdate(Constants.NOT_AVAILABLE);
}
ruleViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.RULE_DETAILS, requestData, rule));
ruleViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.RULE_EDIT, requestData, rule));
return ruleViewBean;
}