zoukankan      html  css  js  c++  java
  • flowable通过表达式来获取其值

    背景:当我们在实际开发项目的情况,有很多场景是需要知道表达式里面的值,比方说我们要预先知道节点的信息(审批人等等)。

    如:

    那么如何做呢?

    1、解析所有的节点信息,这里我就不说了,上面的博客里面已经写过了。

    2、解析表达式具体代码

    @Service
    public class ExpressionServiceImpl implements IExpressionService {
        private static Logger logger = Logger.getLogger(ExpressionServiceImpl.class);
        @Autowired
        protected ProcessEngineConfigurationImpl processEngineConfiguration;
        @Autowired
        private RuntimeService runtimeService;
        @Autowired
        private TypeConverter typeConverter;
    
    
        @Override
        public Object getValue(String processInstanceId, String exp) {
            Expression expression = processEngineConfiguration.getExpressionManager().createExpression(exp);
            ExecutionEntity executionEntity = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult();
            return expression.getValue(executionEntity);
        }
    
        @Override
        public <T> T getValue(String processInstanceId, String exp, Class<T> clazz) {
            Object value = this.getValue(processInstanceId, exp);
            return typeConverter.convert(value, clazz);
        }
    }

    这样我们就可以获得自己的表达式的值了

  • 相关阅读:
    Libvirt错误总结
    linux学习
    HMC 命令行登陆设置
    AIX扩VG和扩文件系统
    Bootstrap CSS2
    Bootstrap CSS
    JQuery的实例集合
    JQuery的noConflict()方法
    android的intent实现页面的跳转
    android的activity
  • 原文地址:https://www.cnblogs.com/liuwenjun/p/10766717.html
Copyright © 2011-2022 走看看