MAVEN JBPM4+Hibernate+Spring+Struts2整合之道(未完)

想研究JBPM4,有一段日子了。可一直就没真正的静下心来看看。如果一个工作多年JAVA程序员,如果不认识工作流感觉挺丢人的。我个人就是这么认为的。大概花了2天时间,快速的看了看官方文档,在网上看了些入门视频。看视频,最大的好处,能够让你快速入门,但坏处也很大,让你脑子懒惰,容易忘。

其实讲JBPM4 与SSH 进行整合,是我在网上搜JBPM WEB例子的时候,无心直接找到的。源代码下载下来,我看了看内容很完整,就是没有JAR。于是,就借助MAVEN这个工具,把下载下来的例子,进行整合。

原文链接:

http://blog.csdn.net/centre10/article/details/6361104

有些东西,这个地方都阐述了。我在这里,仅仅说明一下自己遇到的问题和想法。

step1 : 上maven pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jbpm</groupId>
<artifactId>jbpm4ssh</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<java.version>1.6</java.version>
<java.encoding>UTF-8</java.encoding>
<java.home>D:\Java\jdk1.6.0_10</java.home>
</properties>
<repositories>
<repository>
<id>maven</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-api</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-bpmn</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-db</artifactId>
<version>4.4</version>
<exclusions>
<exclusion>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</exclusion>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
<exclusion>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.5.Final</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.1.8.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>jasper</artifactId>
<version>6.0.13</version>
</dependency>
</dependencies>
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webXml>.\src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>

迷恋maven的朋友,知道maven的

我的数据库是orace,个人看情况定。

我发现,<s:debug>在jetty运行,报错。这个问题一直没有解决。网上说是jetty的原因。在tomcat下没问题。对这个问题,我没有深究。在这里,仅仅关注JBPM.

运行起来,效果是这样子。

wKioJlLCzW7x4YKnAAH2xxmF9Yg591.jpg

 

对于工作流,和人员权限有非常密切的关系,是在程序里写死的。如果在实际环境中,可以通过查询数据库实现。

LoginAction.java 片段。

虚拟了3个角色,分别对应请假流程的三个节点。

申请,经理审批,老板审批。

String manager = "admin,centre,xie";
String boss = "god,oo,test,boss";
String roleName = "";// 要按此名去查找它所在的节点
System.out.println(userName);
if (userName==null) {
return "login";
}else if (manager.contains(userName)) {
// 经理登陆
roleName = "manager";
} else if (boss.contains(userName)) {
// 老板登陆
roleName = "boss";
} else {
// 普通用户
roleName = userName;
}
Map<String, Object> map = ActionContext.getContext().getSession();
map.put("user", userName);
map.put("role", roleName);
..

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(Web,ssh,jbpm4)