流程流转过程中异构系统交互(Action)
一、开发步骤简述
- 编写接口(action)实现代码
- 配置接口文件(action.xml)
- 流程管理员把action.xml中定义的接口设置为流程节点附加操作后,就可以实现流程到达该节点前(或离开该节点后)执行接口实现代码
- 在流程设置中应用该功能
二、开发说明
1、编写接口(action)实现代码
自己开发接口类,该类必须实现接口weaver.interfaces.workflow.action方法public String execute(RequestInfo request)。如下图所示:
package weaver.interfaces.workflow.action;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import weaver.general.Util; import weaver.soa.workflow.request.Cell; import weaver.soa.workflow.request.DetailTable; import weaver.soa.workflow.request.Property; import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.Row; public class BaseAction implements Action { public String execute(RequestInfo request) { //取主表数据 Property[] properties = request.getMainTableInfo().getProperty();// 获取表单主字段信息 for (int i = 0; i < properties.length; i++) { String name = properties[i].getName();// 主字段名称 String value = Util.null2String(properties[i].getValue());// 主字段对应的值 System.out.println(name + ” ” + value); } //取明细数据 DetailTable[] detailtable = request.getDetailTableInfo() .getDetailTable();// 获取所有明细表 if (detailtable.length > 0) { for (int i = 0; i < detailtable.length; i++) { DetailTable dt = detailtable[i];// 指定明细表 Row[] s = dt.getRow();// 当前明细表的所有数据,按行存储 for (int j = 0; j < s.length; j++) { Row r = s[j];// 指定行 Cell c[] = r.getCell();// 每行数据再按列存储 for (int k = 0; k < c.length; k++) { Cell c1 = c[k];// 指定列 String name = c1.getName();// 明细字段名称 String value = c1.getValue();// 明细字段的值 System.out.println(name + ” ” + value); } } } } return Action.SUCCESS; } |
2、配置接口文件(action.xml)
可通过两种方式配置节点附加action,一种是修改配置文件(此方式需要重新resin服务器),另一种是通过可视化页面进行配置(此方式无需重启resin服务器):
(1)修改配置文件action.xml(该文件位于/ecology/WEB-INF/service/action.xml),配置文件内容如下图所示:
<?xml version=”1.0″ encoding=”UTF-8″?>
<module id=”action” version=”1.0.0″> <service-point id=”WorkflowToDoc” interface=”weaver.interfaces.workflow.action.Action”> <invoke-factory> <construct class=”weaver.interfaces.workflow.action.WorkflowToDoc” /> </invoke-factory> </service-point> <service-point id=”TestAction” interface=”weaver.interfaces.workflow.action.Action”> <invoke-factory> <construct class=”westvalley.demo.action.TestAction” /> </invoke-factory> </service-point> </module> |
其中,数据源配置文件上的各个属性分别表示:
- ID:引用接口的唯一标识,该配置文件中不能重复
- interface:完全类名
(2)通过可视化页面(访问菜单:【设置】=》【设置中心】=》【外部接口设置】=》【节点附加配置】进行访问;也可以直接访问地址/servicesetting/actionsetting.jsp页面进行访问),如下图所示:
右键点击【新建】菜单,即可进入如下界面进行配置:
- 接口动作标识:即xml配置中的id; 这个是引用该接口的唯一标识
- 接口动作类文件:接口类的完全类名
3、管理员配置Action到流程节点上
节点附加分为三种,分别为节点前附加、节点后附加和出口附加,可根据需要在需要的位置配置action类。
3、流程中应用该功能
当配置流程走到触发节点时,即可触发此action类。
转载请注明:赫非域 » Ecology流程流转过程中异构系统集成(Action)