iMatrix平台流程引擎中的流向事件处理过程
0
iMatrix平台流向中的事件处理:
表示流程流过时将要执行的处理类在spring中的bean名称。该处理类需要实现的接口为com.norteksoft.wf.engine.client .OnExecutingTransation
代码解析如下:
流向流过时执行的事件处理,是在流向处理的监听类(com.norteksoft.wf.engine.core. GeneralTransitionListener)中运行的。
该监听在xml中配置如下:
<transitionname="transitionUI10" to="一审">
<event-listenerclass="com.norteksoft.wf.engine.core.GeneralTransitionListener"/>
<extend>
<graphic-infor>
<from-joint>bottom</from-joint>
<to-joint>up</to-joint>
<coordinati>291,115:291,147:291,112,100,38:289,129</coordinati>
<line-type>0</line-type>
</graphic-infor>
<flow-execution>expenseReportItemManager</flow-execution>
<basic-properties>
<remark/>
<is-original-user>false</is-original-user>
</basic-properties>
<additional-properties/>
<automatically-filled-fields/>
</extend>
</transition>
代码解析如下:
public void notify(EventListenerExecutionexecution) throws Exception {
… … … …
//流向事件处理
executeFlowing(wi,transtionName);
… … … …
}
/*
* 流向流过时执行
*/
private void executeFlowing(WorkflowInstanceinstance, String activityName){
log.info("开始获取流转时执行的beanName");
String beanName = DefinitionXmlParse.getFlowingExecuteBean(
instance.getProcessDefinitionId(),activityName);
log.info("beanName:" + beanName);
if(!StringUtils.isEmpty(beanName)){
if(beanName.indexOf(",")!=-1){
String[] beans=beanName.split(",");
for(String bean:beans){
executeBean(bean,instance);
}
}else{
executeBean(beanName,instance);
}
}
}
private void executeBean(String beanName,WorkflowInstance instance){
log.info("根据beanName获取bean");
OnExecutingTransation bean =(OnExecutingTransation) ContextUtils.getBean(beanName);
log.info("bean:" + bean);
log.info("开始调用bean");
bean.execute(instance.getDataId());
log.info("bean调用结束");
}
|