Jbpm4环境搭建和集成Spring

Jbpm4环境搭建和集成Spring,这里关于jbpm4的数据库表和jar导入就不说了,主要讲一下关键点配置文件[@more@]

jbpm.cfg.xml配置文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>







<!--使用spring的事务管理器--&gt




<!--


--&gt

<!-- Job executor is excluded for running the example test cases. --&gt
<!--



--&gt

spring配置文件applicationContext.xml中hibernate配置添加:




classpath:jbpm.repository.hbm.xml
classpath:jbpm.execution.hbm.xml
classpath:jbpm.history.hbm.xml
classpath:jbpm.task.hbm.xml
classpath:jbpm.identity.hbm.xml


然后配置jbpm4的工厂bean


<!--工作流统一service接口,业务封装用--&gt




jbpmService的实现类如下

package net.uni.ap.jbpm.bo;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.ZipInputStream;

import net.uni.ap.exp.BOException;
import net.uni.ap.exp.DAOException;
import net.uni.ap.jbpm.BaseJbpmTask;
import net.uni.ap.jbpm.BaseJbpmVar;
import net.uni.ap.jbpm.JbpmConstants;
import net.uni.ap.jbpm.dao.IJbpmDAO;
import net.uni.ap.jbpm.handle.CountJoinsignTaskCmd;
import net.uni.ap.jbpm.model.Deploy;
import net.uni.ap.jbpm.model.JbpmTask;
import net.uni.in1.BaseDictConstants;
import net.uni.in1.bo.IBaseUserRoleBO;
import net.uni.in1.model.BaseUserRole;
import net.uni.in1.model.User;
import net.uni.util.Page;

import org.jbpm.api.Execution;
import org.jbpm.api.ExecutionService;
import org.jbpm.api.HistoryService;
import org.jbpm.api.JbpmException;
import org.jbpm.api.ManagementService;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.ProcessInstanceQuery;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.TaskService;
import org.jbpm.api.history.HistoryActivityInstance;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.api.model.ActivityCoordinates;
import org.jbpm.api.task.Task;

/**
* 处理内容:jbpm统一接口实现类
* @version: 1.0
* @see:net.uni.ap.jbpm.bo.JbpmBOImpl.java
* @date:2012-2-21
* @author:孙伟
*/
public class JbpmBOImpl implements IJbpmBO {

private ProcessEngine processEngineService;
private RepositoryService repositoryService = null;
private ExecutionService executionService = null;
private TaskService taskService = null;
private HistoryService historyService = null;
private ManagementService managementService = null;
private IJbpmDAO jbpmDAO;
private IBaseUserRoleBO baseUserRoleService;

public JbpmBOImpl(ProcessEngine processEngineService) {
super();
this.processEngineService = processEngineService;
this.repositoryService = processEngineService.getRepositoryService();
this.executionService = processEngineService.getExecutionService();
this.taskService = processEngineService.getTaskService();
this.historyService = processEngineService.getHistoryService();
this.managementService = processEngineService.getManagementService();
}
public JbpmBOImpl() {
super();
}

/**
* @return the processEngineService
*/
public ProcessEngine getProcessEngineService() {
return processEngineService;
}
/**
* @param processEngineService the processEngineService to set
*/
public void setProcessEngineService(ProcessEngine processEngineService) {
this.processEngineService = processEngineService;
this.repositoryService = processEngineService.getRepositoryService();
this.executionService = processEngineService.getExecutionService();
this.taskService = processEngineService.getTaskService();
this.historyService = processEngineService.getHistoryService();
this.managementService = processEngineService.getManagementService();
}
/**
* @return the repositoryService
*/
public RepositoryService getRepositoryService() {
return repositoryService;
}
/**
* @param repositoryService the repositoryService to set
*/
public void setRepositoryService(RepositoryService repositoryService) {
this.repositoryService = repositoryService;
}
/**
* @return the executionService
*/
public ExecutionService getExecutionService() {
return executionService;
}
/**
* @param executionService the executionService to set
*/
public void setExecutionService(ExecutionService executionService) {
this.executionService = executionService;
}
/**
* @return the taskService
*/
public TaskService getTaskService() {
return taskService;
}
/**
* @param taskService the taskService to set
*/
public void setTaskService(TaskService taskService) {
this.taskService = taskService;
}
/**
* @return the historyService
*/
public HistoryService getHistoryService() {
return historyService;
}
/**
* @param historyService the historyService to set
*/
public void setHistoryService(HistoryService historyService) {
this.historyService = historyService;
}
/**
* @return the managementService
*/
public ManagementService getManagementService() {
return managementService;
}
/**
* @param managementService the managementService to set
*/
public void setManagementService(ManagementService managementService) {
this.managementService = managementService;
}
public IJbpmDAO getJbpmDAO() {
return jbpmDAO;
}
public void setJbpmDAO(IJbpmDAO jbpmDAO) {
this.jbpmDAO = jbpmDAO;
}
@Override
public Map getTaskVariableByTaskId(String taskId) throws BOException {
return taskService.getVariables(taskId, taskService.getVariableNames(taskId));
}
public IBaseUserRoleBO getBaseUserRoleService() {
return baseUserRoleService;
}
public void setBaseUserRoleService(IBaseUserRoleBO baseUserRoleService) {
this.baseUserRoleService = baseUserRoleService;
}
}
到这里,Jbpm4的环境搭建基本完成,后续的接口调用都通过业务jbpmService来完成,因为这个注入了所有jbpm的service

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25261409/viewspace-1059010/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25261409/viewspace-1059010/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值