Search in sources :

Example 1 with SysTemplateVO

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;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO)

Example 2 with SysTemplateVO

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;
    }
}
Also used : SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO)

Example 3 with SysTemplateVO

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with SysTemplateVO

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;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO) TbSysTemplateParam(com.netsteadfast.greenstep.po.hbm.TbSysTemplateParam) TemplateResultObj(com.netsteadfast.greenstep.model.TemplateResultObj)

Example 5 with SysTemplateVO

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;
    }
}
Also used : SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO)

Aggregations

SysTemplateVO (com.netsteadfast.greenstep.vo.SysTemplateVO)6 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 TemplateResultObj (com.netsteadfast.greenstep.model.TemplateResultObj)1 TbSysTemplateParam (com.netsteadfast.greenstep.po.hbm.TbSysTemplateParam)1 Transactional (org.springframework.transaction.annotation.Transactional)1