Search in sources :

Example 1 with SysBeanHelpVO

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

the class ServiceScriptExpressionUtils method needProcess.

public static boolean needProcess(String beanId, String methodName, String system) throws ServiceException, Exception {
    boolean f = false;
    SysBeanHelpVO beanHelp = new SysBeanHelpVO();
    beanHelp.setBeanId(beanId);
    beanHelp.setMethod(methodName);
    beanHelp.setSystem(system);
    if (sysBeanHelpService.countByUK(beanHelp) > 0) {
        f = true;
    }
    beanHelp = null;
    return f;
}
Also used : SysBeanHelpVO(com.netsteadfast.greenstep.vo.SysBeanHelpVO)

Example 2 with SysBeanHelpVO

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

the class ServiceScriptExpressionUtils method process.

private static void process(String runType, String beanId, Method method, String system, Object resultObj, ProceedingJoinPoint pjp) throws ServiceException, Exception {
    SysBeanHelpVO beanHelp = loadSysBeanHelperData(beanId, method.getName(), system);
    if (!YesNo.YES.equals(beanHelp.getEnableFlag())) {
        return;
    }
    List<TbSysBeanHelpExpr> beanHelpExprs = loadSysBeanHelpExprsData(beanHelp);
    if (beanHelpExprs == null || beanHelpExprs.size() < 1) {
        return;
    }
    for (TbSysBeanHelpExpr helpExpr : beanHelpExprs) {
        SysExpressionVO expression = new SysExpressionVO();
        expression.setExprId(helpExpr.getExprId());
        DefaultResult<SysExpressionVO> eResult = sysExpressionService.findByUK(expression);
        if (eResult.getValue() == null) {
            continue;
        }
        expression = eResult.getValue();
        List<TbSysBeanHelpExprMap> exprMaps = loadSysBeanHelpExprMapsData(helpExpr);
        /* 2015-04-14 rem
			try {
				ScriptExpressionUtils.execute(
						expression.getType(), 
						expression.getContent(), 
						null, 
						getParameters(helpExpr, exprMaps, resultObj, pjp));						
			} catch (Exception e) {
				e.printStackTrace();
			}	
			*/
        // 不要 try catch 包起來, 讓外面也能接到 Exception 
        ScriptExpressionUtils.execute(expression.getType(), expression.getContent(), null, getParameters(helpExpr, exprMaps, resultObj, pjp));
    }
}
Also used : TbSysBeanHelpExprMap(com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap) SysBeanHelpVO(com.netsteadfast.greenstep.vo.SysBeanHelpVO) TbSysBeanHelpExpr(com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExpr) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 3 with SysBeanHelpVO

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

the class SystemBeanHelpSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysBeanHelpVO beanHelp = new SysBeanHelpVO();
    this.transformFields2ValueObject(beanHelp, new String[] { "beanId", "method", "description" });
    beanHelp.setEnableFlag(YesNo.NO);
    if ("true".equals(this.getFields().get("enableFlag"))) {
        beanHelp.setEnableFlag(YesNo.YES);
    }
    DefaultResult<SysBeanHelpVO> result = this.systemBeanHelpLogicService.create(beanHelp, this.getFields().get("systemOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysBeanHelpVO(com.netsteadfast.greenstep.vo.SysBeanHelpVO)

Example 4 with SysBeanHelpVO

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

the class SystemBeanHelpManagementAction method loadSysBeanHelpData.

private void loadSysBeanHelpData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysBeanHelp, new String[] { "oid" });
    DefaultResult<SysBeanHelpVO> result = this.sysBeanHelpService.findObjectByOid(sysBeanHelp);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysBeanHelp = result.getValue();
    SysVO sys = new SysVO();
    sys.setSysId(this.sysBeanHelp.getSystem());
    DefaultResult<SysVO> sResult = this.sysService.findByUK(sys);
    if (sResult.getValue() != null) {
        this.selectValue = sResult.getValue().getOid();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBeanHelpVO(com.netsteadfast.greenstep.vo.SysBeanHelpVO) SysVO(com.netsteadfast.greenstep.vo.SysVO)

Example 5 with SysBeanHelpVO

use of com.netsteadfast.greenstep.vo.SysBeanHelpVO 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)

Aggregations

SysBeanHelpVO (com.netsteadfast.greenstep.vo.SysBeanHelpVO)8 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)2 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 TbSysBeanHelpExpr (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExpr)1 TbSysBeanHelpExprMap (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap)1 SysVO (com.netsteadfast.greenstep.vo.SysVO)1 Transactional (org.springframework.transaction.annotation.Transactional)1