use of com.netsteadfast.greenstep.vo.SysTemplateVO in project bamboobsc by billchen198318.
the class TemplateUtils method loadSysTemplate.
private static SysTemplateVO loadSysTemplate(String templateId) throws ServiceException, Exception {
SysTemplateVO sysTemplate = new SysTemplateVO();
sysTemplate.setTemplateId(templateId);
DefaultResult<SysTemplateVO> result = sysTemplateService.findByUK(sysTemplate);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
sysTemplate = result.getValue();
return sysTemplate;
}
use of com.netsteadfast.greenstep.vo.SysTemplateVO in project bamboobsc by billchen198318.
the class SystemTemplateSaveOrUpdateAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
SysTemplateVO template = new SysTemplateVO();
this.transformFields2ValueObject(template, new String[] { "oid", "title", "message", "description" });
DefaultResult<SysTemplateVO> result = this.systemTemplateLogicService.update(template);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysTemplateVO in project bamboobsc by billchen198318.
the class SystemTemplateLogicServiceImpl method createParam.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysTemplateParamVO> createParam(SysTemplateParamVO sysTemplateParam, String templateOid) throws ServiceException, Exception {
if (sysTemplateParam == null || super.isBlank(templateOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
SysTemplateVO sysTemplate = new SysTemplateVO();
sysTemplate.setOid(templateOid);
DefaultResult<SysTemplateVO> mResult = this.sysTemplateService.findObjectByOid(sysTemplate);
if (mResult.getValue() == null) {
throw new ServiceException(mResult.getSystemMessage().getValue());
}
sysTemplate = mResult.getValue();
sysTemplateParam.setTemplateId(sysTemplate.getTemplateId());
return this.sysTemplateParamService.saveObject(sysTemplateParam);
}
use of com.netsteadfast.greenstep.vo.SysTemplateVO in project bamboobsc by billchen198318.
the class TemplateUtils method getResult.
/**
* 產生 template 結果
* Map 值放入 title 與 message
*
* @param templateId 樣板id
* @param dataObj 資料來源
* @return
* @throws ServiceException
* @throws Exception
*/
public static TemplateResultObj getResult(String templateId, Object dataObj) throws ServiceException, Exception {
if (StringUtils.isBlank(templateId) || null == dataObj) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
TemplateResultObj resultObj = new TemplateResultObj();
SysTemplateVO sysTemplate = loadSysTemplate(templateId);
List<TbSysTemplateParam> sysTemplateParamList = loadSysTemplateParam(templateId);
Map<String, Object> titleParams = getTemplateParamMap(IS_TITLE, sysTemplateParamList, dataObj);
Map<String, Object> msgParams = getTemplateParamMap(IS_MESSAGE, sysTemplateParamList, dataObj);
resultObj.setTitle(processTemplate(sysTemplate.getTitle(), titleParams));
resultObj.setContent(processTemplate(sysTemplate.getMessage(), msgParams));
return resultObj;
}
use of com.netsteadfast.greenstep.vo.SysTemplateVO in project bamboobsc by billchen198318.
the class SystemTemplateSaveOrUpdateAction method delete.
private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
SysTemplateVO template = new SysTemplateVO();
this.transformFields2ValueObject(template, new String[] { "oid" });
DefaultResult<Boolean> result = this.systemTemplateLogicService.delete(template);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null && result.getValue()) {
this.success = IS_YES;
}
}
Aggregations