Search in sources :

Example 11 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemExpressionLogicServiceImpl method updateJob.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysExprJobVO> updateJob(SysExprJobVO exprJob, String systemOid, String expressionOid) throws ServiceException, Exception {
    if (null == exprJob || StringUtils.isBlank(exprJob.getOid()) || StringUtils.isBlank(systemOid) || StringUtils.isBlank(expressionOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysVO sys = new SysVO();
    sys.setOid(systemOid);
    DefaultResult<SysVO> sysResult = this.sysService.findObjectByOid(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    SysExpressionVO expression = new SysExpressionVO();
    expression.setOid(expressionOid);
    DefaultResult<SysExpressionVO> expressionResult = this.sysExpressionService.findObjectByOid(expression);
    if (expressionResult.getValue() == null) {
        throw new ServiceException(expressionResult.getSystemMessage().getValue());
    }
    expression = expressionResult.getValue();
    DefaultResult<SysExprJobVO> oldResult = this.sysExprJobService.findObjectByOid(exprJob);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    exprJob.setId(oldResult.getValue().getId());
    exprJob.setSystem(sys.getSysId());
    exprJob.setExprId(expression.getExprId());
    exprJob.setRunStatus(oldResult.getValue().getRunStatus());
    if (super.isBlank(oldResult.getValue().getRunStatus())) {
        exprJob.setRunStatus(ExpressionJobConstants.RUNSTATUS_FAULT);
        logger.warn("Before runStatus flag is blank. Expression Job ID: " + oldResult.getValue().getId());
    }
    this.setStringValueMaxLength(exprJob, "description", MAX_DESCRIPTION_LENGTH);
    return this.sysExprJobService.updateObject(exprJob);
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemBeanHelpLogicServiceImpl method createExpr.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysBeanHelpExprVO> createExpr(SysBeanHelpExprVO beanHelpExpr, String helpOid, String expressionOid) throws ServiceException, Exception {
    if (beanHelpExpr == null || super.isBlank(helpOid) || super.isBlank(expressionOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysBeanHelpVO sysBeanHelp = new SysBeanHelpVO();
    sysBeanHelp.setOid(helpOid);
    DefaultResult<SysBeanHelpVO> mResult = this.sysBeanHelpService.findObjectByOid(sysBeanHelp);
    if (mResult.getValue() == null) {
        throw new ServiceException(mResult.getSystemMessage().getValue());
    }
    // 查看有沒有資料
    sysBeanHelp = mResult.getValue();
    SysExpressionVO sysExpression = new SysExpressionVO();
    sysExpression.setOid(expressionOid);
    DefaultResult<SysExpressionVO> exprResult = this.sysExpressionService.findObjectByOid(sysExpression);
    if (exprResult.getValue() == null) {
        throw new ServiceException(exprResult.getSystemMessage().getValue());
    }
    sysExpression = exprResult.getValue();
    beanHelpExpr.setHelpOid(sysBeanHelp.getOid());
    beanHelpExpr.setExprId(sysExpression.getExprId());
    return this.sysBeanHelpExprService.saveObject(beanHelpExpr);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBeanHelpVO(com.netsteadfast.greenstep.vo.SysBeanHelpVO) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SysExpressionServiceImpl method findExpressionMap.

@Override
public Map<String, String> findExpressionMap(boolean pleaseSelect) throws ServiceException, Exception {
    Map<String, String> dataMap = new LinkedHashMap<String, String>();
    if (pleaseSelect) {
        dataMap.put(Constants.HTML_SELECT_NO_SELECT_ID, Constants.HTML_SELECT_NO_SELECT_NAME);
    }
    List<SysExpressionVO> searchList = this.sysExpressionDAO.findListForSimple();
    for (int i = 0; searchList != null && i < searchList.size(); i++) {
        SysExpressionVO expression = searchList.get(i);
        dataMap.put(expression.getOid(), expression.getExprId() + " - " + expression.getName());
    }
    return dataMap;
}
Also used : SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO) LinkedHashMap(java.util.LinkedHashMap)

Example 14 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemExpressionJobUtils method getExpressionJobForManualMode.

public static ExpressionJobObj getExpressionJobForManualMode(String expressionJobOid) throws ServiceException, Exception {
    if (StringUtils.isBlank(expressionJobOid)) {
        throw new Exception("error, expressionJobId is blank!");
    }
    @SuppressWarnings("unchecked") ISysExprJobService<SysExprJobVO, TbSysExprJob, String> sysExprJobService = (ISysExprJobService<SysExprJobVO, TbSysExprJob, String>) AppContext.getBean("core.service.SysExprJobService");
    @SuppressWarnings("unchecked") ISysExpressionService<SysExpressionVO, TbSysExpression, String> sysExpressionService = (ISysExpressionService<SysExpressionVO, TbSysExpression, String>) AppContext.getBean("core.service.SysExpressionService");
    SysExprJobVO exprJob = new SysExprJobVO();
    exprJob.setOid(expressionJobOid);
    DefaultResult<SysExprJobVO> exprJobResult = sysExprJobService.findObjectByOid(exprJob);
    if (exprJobResult.getValue() == null) {
        throw new ServiceException(exprJobResult.getSystemMessage().getValue());
    }
    exprJob = exprJobResult.getValue();
    SysExpressionVO expr = new SysExpressionVO();
    expr.setExprId(exprJob.getExprId());
    DefaultResult<SysExpressionVO> exprResult = sysExpressionService.findByUK(expr);
    if (exprResult.getValue() == null) {
        throw new ServiceException(exprResult.getSystemMessage().getValue());
    }
    expr = exprResult.getValue();
    ExpressionJobObj jobObj = new ExpressionJobObj();
    jobObj.setSysExprJob(exprJob);
    jobObj.setSysExprJobLog(new SysExprJobLogVO());
    jobObj.setSysExpression(expr);
    return jobObj;
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysExprJobLogVO(com.netsteadfast.greenstep.vo.SysExprJobLogVO) ISysExpressionService(com.netsteadfast.greenstep.service.ISysExpressionService) TbSysExprJob(com.netsteadfast.greenstep.po.hbm.TbSysExprJob) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) TbSysExpression(com.netsteadfast.greenstep.po.hbm.TbSysExpression) ISysExprJobService(com.netsteadfast.greenstep.service.ISysExprJobService) ExpressionJobObj(com.netsteadfast.greenstep.model.ExpressionJobObj) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 15 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemExpressionJobManagementAction method loadSysExprJobData.

private void loadSysExprJobData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysExprJob, new String[] { "oid" });
    DefaultResult<SysExprJobVO> result = this.sysExprJobService.findObjectByOid(this.sysExprJob);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysExprJob = result.getValue();
    SysVO sys = new SysVO();
    sys.setSysId(this.sysExprJob.getSystem());
    DefaultResult<SysVO> sysResult = this.sysService.findByUK(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    this.getFields().put("systemOid", sys.getOid());
    SysExpressionVO expression = new SysExpressionVO();
    expression.setExprId(this.sysExprJob.getExprId());
    DefaultResult<SysExpressionVO> expressionResult = this.sysExpressionService.findByUK(expression);
    if (expressionResult.getValue() == null) {
        throw new ServiceException(expressionResult.getSystemMessage().getValue());
    }
    expression = expressionResult.getValue();
    this.getFields().put("expressionOid", expression.getOid());
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Aggregations

SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)19 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)8 HashMap (java.util.HashMap)6 SysExprJobVO (com.netsteadfast.greenstep.vo.SysExprJobVO)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)3 SysVO (com.netsteadfast.greenstep.vo.SysVO)3 Transactional (org.springframework.transaction.annotation.Transactional)3 ExpressionJobObj (com.netsteadfast.greenstep.model.ExpressionJobObj)2 TbSysExprJob (com.netsteadfast.greenstep.po.hbm.TbSysExprJob)2 TbSysExpression (com.netsteadfast.greenstep.po.hbm.TbSysExpression)2 ISysExprJobService (com.netsteadfast.greenstep.service.ISysExprJobService)2 ISysExpressionService (com.netsteadfast.greenstep.service.ISysExpressionService)2 SysBeanHelpVO (com.netsteadfast.greenstep.vo.SysBeanHelpVO)2 SysExprJobLogVO (com.netsteadfast.greenstep.vo.SysExprJobLogVO)2 LinkedHashMap (java.util.LinkedHashMap)2 TbSysBeanHelpExpr (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExpr)1 TbSysBeanHelpExprMap (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1