下面是针对于iMatrix平台的流程引擎事件处理中流向事件处理代码方面的研究如下:
表示流程流过时将要执行的处理类在spring中的bean名称。该处理类需要实现的接口为com.norteksoft.wf.engine.client .OnExecutingTransation
代码解析如下:
流向流过时执行的事件处理,是在流向处理的监听类(com.norteksoft.wf.engine.core. GeneralTransitionListener)中运行的。
该监听在xml中配置如下:
<transition name="transitionUI10" to="一审">
<event-listener class="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(EventListenerExecution execution) throws Exception {
… … … …
//流向事件处理
executeFlowing(wi,transtionName);
… … … …
}
/*
* 流向流过时执行
*/
private void executeFlowing(WorkflowInstance instance, 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调用结束");
}