调用流程
1 临时保存
ISystemService service = (ISystemService) BeanFactory.findBean(
"system", "systemService");
//模拟登录
User u = service.loadUser("zhangsan");
SessionModel session = new SessionModel();
session.setSessionId("123");
session.setValue(u);
ApplicationContext.set(session);
//业务类赋值
TestBean bean = new TestBean();
bean.setBeginDate(Calendar.getInstance());
bean.setMaker(u.getRelaPerson().getId());
IFlowService flowService = (IFlowService) BeanFactory.findBean(
"workflow", "flowService");
//调用临时保存的业务方法
flowService.saveTestBean(bean);
保存方法的实现
public void saveTestBean(TestBean bean) {
IFlowDAO dao = (IFlowDAO) BeanFactory.findBean("workflow", "flowDAO");
FlowDefine fd=(FlowDefine)this.loadFlowDefineByTypeName("1000").clone();//获得某个类型下的流程定义
FlowInstance fi=fd.newInstance();//实例化流程
dao.saveTestBean(bean);//保存业务数据,生成业务id
fi.loadStartAction().setModelInstance(bean);//向初始点设置业务对象
this.saveFlowInstance(fi);//保存流程实例,生成流程实例id
bean.setFlowInstanceId(fi.getId());//建立业务与流程实例之间的关系
dao.saveTestBean(bean);//更新业务数据
fi.start();//流程启动
this.saveFlowInstance(fi);//更新流程实例
}
2 提交
ISystemService service = (ISystemService) BeanFactory.findBean(
"system", "systemService");
User u = service.loadUser("zhangsan");
SessionModel session = new SessionModel();
session.setSessionId("123");
session.setValue(u);
ApplicationContext.set(session);
ActionInstance ai = (ActionInstance) flowInstance.loadCurrentActions()
.get(0);
//设置活动的实际操作者
ai.setRunner(u);
//设置意见
ai.setAgree(true);
//活动流转
ai.play();
//持久化
flowService.saveFlowInstance(flowInstance);
1 临时保存
ISystemService service = (ISystemService) BeanFactory.findBean(
"system", "systemService");
//模拟登录
User u = service.loadUser("zhangsan");
SessionModel session = new SessionModel();
session.setSessionId("123");
session.setValue(u);
ApplicationContext.set(session);
//业务类赋值
TestBean bean = new TestBean();
bean.setBeginDate(Calendar.getInstance());
bean.setMaker(u.getRelaPerson().getId());
IFlowService flowService = (IFlowService) BeanFactory.findBean(
"workflow", "flowService");
//调用临时保存的业务方法
flowService.saveTestBean(bean);
保存方法的实现
public void saveTestBean(TestBean bean) {
IFlowDAO dao = (IFlowDAO) BeanFactory.findBean("workflow", "flowDAO");
FlowDefine fd=(FlowDefine)this.loadFlowDefineByTypeName("1000").clone();//获得某个类型下的流程定义
FlowInstance fi=fd.newInstance();//实例化流程
dao.saveTestBean(bean);//保存业务数据,生成业务id
fi.loadStartAction().setModelInstance(bean);//向初始点设置业务对象
this.saveFlowInstance(fi);//保存流程实例,生成流程实例id
bean.setFlowInstanceId(fi.getId());//建立业务与流程实例之间的关系
dao.saveTestBean(bean);//更新业务数据
fi.start();//流程启动
this.saveFlowInstance(fi);//更新流程实例
}
2 提交
ISystemService service = (ISystemService) BeanFactory.findBean(
"system", "systemService");
User u = service.loadUser("zhangsan");
SessionModel session = new SessionModel();
session.setSessionId("123");
session.setValue(u);
ApplicationContext.set(session);
ActionInstance ai = (ActionInstance) flowInstance.loadCurrentActions()
.get(0);
//设置活动的实际操作者
ai.setRunner(u);
//设置意见
ai.setAgree(true);
//活动流转
ai.play();
//持久化
flowService.saveFlowInstance(flowInstance);