/**
*
*/
public EngineSettingViewBean buildViewBeanEngineSetting(final RequestData requestData, final EngineSetting engineSetting) throws Exception {
final EngineSettingViewBean engineSettingViewBean = new EngineSettingViewBean();
engineSettingViewBean.setName(engineSetting.getName());
engineSettingViewBean.setCode(engineSetting.getCode());
engineSettingViewBean.setDescription(engineSetting.getDescription());
if(StringUtils.isNotEmpty(engineSetting.getDefaultValue())){
engineSettingViewBean.setDefaultValue(engineSetting.getDefaultValue());
} else {
engineSettingViewBean.setDefaultValue(Constants.NOT_AVAILABLE);
}
Set<EngineSettingValue> engineSettingValues = engineSetting.getEngineSettingValues();
if (engineSettingValues != null) {
for (Iterator<EngineSettingValue> iterator = engineSettingValues.iterator(); iterator.hasNext();) {
EngineSettingValue engineSettingValue = (EngineSettingValue) iterator.next();
engineSettingViewBean.getEngineSettingValues().add(buildViewBeanEngineSettingValue(requestData, engineSettingValue));
}
}
DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
Date dateCreate = engineSetting.getDateCreate();
if (dateCreate != null) {
engineSettingViewBean.setDateCreate(dateFormat.format(dateCreate));
} else {
engineSettingViewBean.setDateCreate(Constants.NOT_AVAILABLE);
}
Date dateUpdate = engineSetting.getDateUpdate();
if (dateUpdate != null) {
engineSettingViewBean.setDateUpdate(dateFormat.format(dateUpdate));
} else {
engineSettingViewBean.setDateUpdate(Constants.NOT_AVAILABLE);
}
engineSettingViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.ENGINE_SETTING_DETAILS, requestData, engineSetting));
engineSettingViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.ENGINE_SETTING_EDIT, requestData, engineSetting));
return engineSettingViewBean;
}