osworkflow,transientVars的传递

本文详细解析了osworkflow中如何通过Configuration获取workflowStore等信息,并解释了为何可以在pre-function、beanshell、post-function等环节中随意调用context、store等变量。
 

 

以前一直对于为什么 osworkflow在pre-function, beanshell,post-function等里面可以随便调用context,store,等信息

表示不解。

我们do一个action的步骤是先 new BasicWorkflow(username), username会被 用来constructer 一个BasicWorkflowContext, 目前为止BasicWorkflowContext类中只有一个caller属性。BasicWorkflow  extends  AbstractWorkflow, 在AbstractWorkflow中有 protected Configuration configuration;
    protected ThreadLocal stateCache = new ThreadLocal();
    protected WorkflowContext context;
    private TypeResolver typeResolver;  这些属性。因此BasicWorkflowContext会被 赋值给context。我们注意到第一个attribute is Configuration ,因此我们可以通过Configuration 得到 workflowStor等信息。

因此也就可以在doAction(long id, int actionId, Map inputs)中有下列代码,

。。。。。。。

transientVars.put("context", context);
        transientVars.put("entry", entry);
        transientVars.put("store", getPersistence());
        transientVars.put("configuration", getConfiguration());
        transientVars.put("descriptor", getConfiguration().getWorkflow(entry.getWorkflowName())); 

。。。。。。

到时我们就可以在pre-function,post-function等功能 中取出 它们。 之所以可以取出它们 是在处理<action>中的每个功能时,都会把transientVars做为参数传过去。

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值