pom.xml
-----------------------------------
<?xml version="1.0" encoding="utf-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.jbpm</groupId> <artifactId>jbpm-maven-example</artifactId> <name>jBPM Maven Project</name> <version>1.0-SNAPSHOT</version> <properties> <spring.version>3.1.4.RELEASE</spring.version> <aspectj.version>1.6.2</aspectj.version> <jboss.netty.version>3.2.0.Final</jboss.netty.version> <mysql.version>5.1.10</mysql.version> <hibernate.version>4.2.1.Final</hibernate.version> <hibernateCommAnn.version>3.2.0.Final</hibernateCommAnn.version> <hibernateAnn.version>3.5.6-Final</hibernateAnn.version> <cglib.version>2.2.2</cglib.version> <slf4j.version>1.6.1</slf4j.version> <log4j.version>1.2.16</log4j.version> <jbpm.version>5.4.0.Final</jbpm.version> <drools.version>5.5.0.Final</drools.version> </properties> <repositories> <!-- use this repository for stable releases --> <repository> <id>jboss-public-repository-group</id> <name>JBoss Public Maven Repository Group</name> <url>https://repository.jboss.org/nexus/content/groups/public/</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <!-- use this repository for snapshot releases --> <repository> <id>jboss-snapshot-repository-group</id> <name>JBoss SNAPSHOT Maven Repository Group</name> <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url> <layout>default</layout> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </snapshots> </repository> </repositories> <dependencies> <!-- Spring 3 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <optional>true</optional> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-persistence</artifactId> <version>2.2.2</version> </dependency> <!-- Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>${hibernateCommAnn.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>${hibernateAnn.version}</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>${cglib.version}</version> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <version>1.0.1.Final</version> </dependency> <!-- JBOSS Cache & Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>4.2.1.Final</version> </dependency> <dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>1.8.0.4</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-testing</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>2.4.3</version> </dependency> <!-- JBPM5.4 --> <dependency> <groupId>org.drools</groupId> <artifactId>drools-spring</artifactId> <version>${drools.version}</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-bpmn2</artifactId> <version>${jbpm.version}</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-human-task-core</artifactId> <version>${jbpm.version}</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-persistence-jpa</artifactId> <version>${jbpm.version}</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-bam</artifactId> <version>${jbpm.version}</version> </dependency> <!-- Log4j --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>org.lazyluke</groupId> <artifactId>log4jdbc-remix</artifactId> <version>0.2.7</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> </dependencies> <build> <finalName>JBPM54sh</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <archive> <manifest> <!--<addClasspath>true</addClasspath> --> </manifest> <manifestEntries> <Built-By>org-builder</Built-By> <Build-Jdk>${java.version}</Build-Jdk> </manifestEntries> </archive> </configuration> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.20</version> <configuration> <contextPath>/JBPM54sh</contextPath> <!--<webDefaultXml>webdefault.xml</webDefaultXml> --> <scanIntervalSeconds>0</scanIntervalSeconds> <scanTargetPatterns> <scanTargetPattern> <directory>src/main/webapp/WEB-INF</directory> <excludes> <exclude>**/*.jsp</exclude> </excludes> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> </scanTargetPattern> </scanTargetPatterns> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.0.2</version> <configuration> <archive> <manifest> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest> <manifestEntries> <Implementation-Build>${buildNumber}</Implementation-Build> </manifestEntries> </archive> <dependentWarExcludes> **/jdbc.properties,**/web.xml,WEB-INF/classes/META-INF/** </dependentWarExcludes> </configuration> </plugin> </plugins> </build> </project>
src/main/resources/ehcache.xml
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?> <ehcache> <!--如果缓存中的对象存储超过指定的缓存数量的对象存储的磁盘地址 --> <diskStore path="D:/ehcache" /> <!-- 默认cache:如果没有对应的特定区域的缓存,就使用默认缓存 --> <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false" /> <!-- 指定区域cache:通过name指定,name对应到Hibernate中的区域名即可 --> <cache name="cn.javass.h3test.model.UserModel" eternal="false" maxElementsInMemory="100" timeToIdleSeconds="1200" timeToLiveSeconds="1200" overflowToDisk="false"> </cache> </ehcache>
src/main/resources/jdbc.properties
-----------------------------------
jdbc.driver=net.sf.log4jdbc.DriverSpy
jdbc.url=jdbc:log4jdbc:mysql://localhost:3306/jbpmtest?createDatabaseIfNotExist=true
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/jbpmtest?createDatabaseIfNotExist=true
jdbc.username=root
jdbc.password=root
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
src/main/resources/log4j.properties
-----------------------------------
#log4j.rootLogger=info, stdout, logfile
log4j.rootLogger=info, stdout, HUB
# log4jdbc
log4j.logger.jdbc.sqlonly=INFO
log4j.logger.jdbc.sqltiming=INFO
log4j.logger.jdbc.audit=OFF
log4j.logger.jdbc.resultset=OFF
log4j.logger.jdbc.connection=OFF
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yy-MM-dd HH:mm} %5p %c{1}:%L - %m%n
#log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.logfile.File=c:/deimos.log
#log4j.appender.logfile.DatePattern='.'yyyy-MM-dd
#log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
#log4j.appender.logfile.layout.ConversionPattern=%d{yy-MM-dd HH:mm} %5p %c{1}:%L - %m%n
log4j.logger.com.mosso=debug
log4j.logger.org.springframework.batch=DEBUG
log4j.logger.org.springframework.transaction=INFO
log4j.logger.org.springframework=error
log4j.category.org.springframework.beans.factory=DEBUG
log4j.appender.HUB=org.apache.log4j.net.SocketHubAppender
log4j.appender.HUB.layout=org.apache.log4j.PatternLayout
log4j.appender.HUB.layout.ConversionPattern=[cc]%d{MMM-dd HH:mm:ss} %-14.14c{1}- %m%n
log4j.appender.HUB.port=4445
src/main/resources/META-INF/JBPMorm.xml(没使用到)
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0"> <named-query name="ProcessInstancesWaitingForEvent"> <query> select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes where eventTypes = :type </query> </named-query> </entity-mappings>
src/main/resources/META-INF/Taskorm.xml
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0"> <named-query name="TasksAssignedAsBusinessAdministrator"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity businessAdministrator where t.archived = 0 and businessAdministrator.id = :userId and businessAdministrator in elements ( t.peopleAssignments.businessAdministrators ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsExcludedOwner"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity excludedOwners where t.archived = 0 and excludedOwners.id = :userId and excludedOwners in elements ( t.peopleAssignments.excludedOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsPotentialOwner"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and potentialOwners.id = :userId and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsPotentialOwnerByStatus"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and potentialOwners.id = :userId and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsPotentialOwnerWithGroups"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsPotentialOwnerByStatusWithGroups"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsPotentialOwnerByGroup"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and potentialOwners.id = :groupId and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="SubTasksAssignedAsPotentialOwner"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity potentialOwners where t.archived = 0 and t.taskData.parentId = :parentId and (potentialOwners.id = :userId or potentialOwners.id in (:groupIds)) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="GetSubTasksByParentTaskId"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.parentId = :parentId and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsRecipient"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity recipients where t.archived = 0 and recipients.id = :userId and recipients in elements ( t.peopleAssignments.recipients ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsTaskInitiator"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity taskInitiator where t.archived = 0 and taskInitiator.id = :userId and taskInitiator = t.peopleAssignments.taskInitiator and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksAssignedAsTaskStakeholder"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name, OrganizationalEntity taskStakeholder where t.archived = 0 and taskStakeholder.id = :userId and taskStakeholder in elements ( t.peopleAssignments.taskStakeholders ) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksOwned"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.actualOwner.id = :userId and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksByStatus"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.status = :status and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksByStatusByProcessId"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.actualOwner as actualOwner left join t.taskData.createdBy as createdBy left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.processInstanceId = :processInstanceId and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksByStatusByProcessIdByTaskName"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.actualOwner as actualOwner left join t.taskData.createdBy as createdBy left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.processInstanceId = :processInstanceId and name.shortText = :taskName and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.status in (:status) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksByStatusSince"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 0 and t.taskData.status = :status and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null and t.taskData.activationTime < :since </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="ArchivedTasks"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.archived = 1 and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TasksOwnedWithParticularStatus"> <query> select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, name.text, subject.text, description.text, t.taskData.status, t.priority, t.taskData.skipable, actualOwner, createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime, t.taskData.processId, t.taskData.processSessionId) from Task t left join t.taskData.createdBy as createdBy left join t.taskData.actualOwner as actualOwner left join t.subjects as subject left join t.descriptions as description left join t.names as name where t.taskData.actualOwner.id = :userId and t.taskData.status in (:status) and ( name.language = :language or t.names.size = 0 ) and ( subject.language = :language or t.subjects.size = 0 ) and ( description.language = :language or t.descriptions.size = 0 ) and t.taskData.expirationTime is null </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="UnescalatedDeadlines"> <query> select new org.jbpm.task.query.DeadlineSummary( t.id, d.id, d.date) from Task t, Deadline d where t.archived = 0 and (d in elements( t.deadlines.startDeadlines ) or d in elements( t.deadlines.endDeadlines ) ) and d.escalated = 0 order by d.date </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> <named-query name="TaskByWorkItemId"> <query> select t from Task t where t.archived = 0 and t.taskData.workItemId = :workItemId </query> <!-- hint name="org.hibernate.timeout" value="200"/ --> </named-query> </entity-mappings>
src/main/resources/META-INF/persistence.xml
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="org.jbpm.persistence.local" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <!-- <non-jta-data-source>jdbc/jbpm-ds</non-jta-data-source> --> <!-- Use this if you are using JPA1 / Hibernate3 --> <!-- <mapping-file>META-INF/JBPMorm.xml</mapping-file> --> <!-- <mapping-file>META-INF/Taskorm.xml</mapping-file> --> <!-- Use this if you are using JPA2 / Hibernate4 --> <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file> <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file> <mapping-file>META-INF/Taskorm.xml</mapping-file> <class>org.jbpm.task.Attachment</class> <class>org.jbpm.task.Content</class> <class>org.jbpm.task.BooleanExpression</class> <class>org.jbpm.task.Comment</class> <class>org.jbpm.task.Deadline</class> <class>org.jbpm.task.Comment</class> <class>org.jbpm.task.Deadline</class> <class>org.jbpm.task.Delegation</class> <class>org.jbpm.task.Escalation</class> <class>org.jbpm.task.Group</class> <class>org.jbpm.task.I18NText</class> <class>org.jbpm.task.Notification</class> <class>org.jbpm.task.EmailNotification</class> <class>org.jbpm.task.EmailNotificationHeader</class> <class>org.jbpm.task.PeopleAssignments</class> <class>org.jbpm.task.Reassignment</class> <class>org.jbpm.task.Status</class> <class>org.jbpm.task.Task</class> <class>org.jbpm.task.TaskData</class> <class>org.jbpm.task.SubTasksStrategy</class> <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class> <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class> <class>org.jbpm.task.User</class> <class>org.drools.persistence.info.SessionInfo</class> <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class> <class>org.drools.persistence.info.WorkItemInfo</class> <class>org.jbpm.process.audit.ProcessInstanceLog</class> <class>org.jbpm.process.audit.NodeInstanceLog</class> <class>org.jbpm.process.audit.VariableInstanceLog</class> <properties> <property name="hibernate.max_fetch_depth" value="3" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/> <property name="hibernate.cache.use_query_cache" value="true"/> <property name="hibernate.cache.use_second_level_cache" value="true"/> <property name="hibernate.generate_statistics" value="true"/> <property name="hibernate.use_sql_comments" value="true"/> <property name="hibernate.generate_statistics" value="true"/> </properties> </persistence-unit> </persistence>
src/main/java/com/gds/jbpm/JBPMUserGroupCallback.java
-----------------------------------
package com.gds.jbpm; import java.util.ArrayList; import java.util.List; import org.jbpm.task.identity.UserGroupCallback; public class JBPMUserGroupCallback implements UserGroupCallback { @Override public boolean existsGroup(String groupId) { return true; } @Override public boolean existsUser(String userId) { return true; } @Override public List<String> getGroupsForUser(String userId, List<String> groupIds, List<String> allExistingGroupIds) { if (groupIds != null) { List<String> retList = new ArrayList<String>(groupIds); // merge all groups if (allExistingGroupIds != null) { for (String grp : allExistingGroupIds) { if (!retList.contains(grp)) { retList.add(grp); } } } return retList; } else { // // return empty list by default // please note: there are different return value for different // version of jPBM // List<String> retList = new ArrayList<String>(); // retList.add("user"); // return retList; // return new ArrayList<String>(); //for jBPM5.3.0.Final return null; // for jBPM5.4.0.CR1 } } }
src/main/java/com/gds/jbpm/MyLocalTaskService.java
-----------------------------------
package com.gds.jbpm; import javax.annotation.PostConstruct; import org.drools.runtime.StatefulKnowledgeSession; import org.jbpm.task.service.local.LocalTaskService; /** * 提供这个类,是为了设定jbpm.usergroup.callback, * 但是如何注解呢? * @author pandy * */ public class MyLocalTaskService { private StatefulKnowledgeSession ksession; private LocalTaskService localTaskService; @PostConstruct public void init() { // set user group callback System.setProperty("jbpm.usergroup.callback", "com.gds.jbpm.JBPMUserGroupCallback"); } public StatefulKnowledgeSession getKsession() { return ksession; } public void setKsession(StatefulKnowledgeSession ksession) { this.ksession = ksession; } public org.jbpm.task.service.local.LocalTaskService getLocalTaskService() { return localTaskService; } public void setLocalTaskService( org.jbpm.task.service.local.LocalTaskService localTaskService) { this.localTaskService = localTaskService; } }
src/main/java/com/gds/web/OrderController.java
-----------------------------------
package com.gds.web; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.apache.log4j.Logger; import org.drools.command.Context; import org.drools.command.impl.GenericCommand; import org.drools.command.impl.KnowledgeCommandContext; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.process.WorkflowProcessInstance; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.process.instance.context.variable.VariableScopeInstance; import org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler; import org.jbpm.task.Task; import org.jbpm.task.TaskData; import org.jbpm.task.TaskService; import org.jbpm.task.query.TaskSummary; import org.jbpm.task.service.ContentData; import org.jbpm.task.utils.ContentMarshallerHelper; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import com.gds.jbpm.MyLocalTaskService; import com.gds.jbpm.Order; @Controller public class OrderController { private Logger log = Logger.getLogger(this.getClass()); @Resource @Qualifier("myLocalTaskService") private MyLocalTaskService myLocalTaskService; @Resource @Qualifier("ksession") private StatefulKnowledgeSession ksession; @RequestMapping("/") public String test() { log.info("this is the index"); return "index"; } @RequestMapping(value = "{user}/create", method = GET) public String create(@PathVariable("user") String user) { // log.info(user + " prepare to create"); System.out.println("用户[" + user + "]进入创建界面,准备创建流程。"); return "create"; } @RequestMapping(value = "{user}/create", method = { POST, PUT }) public String doCreate(@PathVariable("user") String user, Model model) { // log.info(user + " create an order"); System.out.println("用户[" + user + "]提交了流程单据"); ksession = myLocalTaskService.getKsession(); LocalHTWorkItemHandler humanTaskHandler = new LocalHTWorkItemHandler( myLocalTaskService.getLocalTaskService(), ksession); humanTaskHandler.setLocal(true); humanTaskHandler.connect(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler); Map<String, Object> params = new HashMap<String, Object>(); params.put("priority", "High"); params.put("modelNumber", "179"); params.put("quantity", "100"); System.out.println("用户[" + user + "]赋初始值,并准备启动流程......."); ksession.startProcess("com.gds.jbpm.sample", params); ksession.fireAllRules(); System.out.println("用户[" + user + "]创建流程,等待处理......"); model.addAttribute("message", "process created!"); System.out .println("---------------------------------------------------单据提交完成:" + user); return "create"; } @RequestMapping("{user}/list") public String list(@PathVariable("user") String user, Model model) { // log.info(user + " list his tasks"); System.out.println("用户[" + user + "]读取任务列表."); TaskService taskService = myLocalTaskService.getLocalTaskService(); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner( user, "en-UK"); log.info("\n***Task size::" + tasks.size() + "***\n"); for (TaskSummary taskSummary : tasks) { log.info(taskSummary.getId() + " :: " + taskSummary.getActualOwner()); } model.addAttribute("tasks", tasks); model.addAttribute("tasksCount", tasks.size()); model.addAttribute("user", user); System.out .println("---------------------------------------------------列表读取完成:" + user); return "list"; } @RequestMapping(value = "{user}/work/{task}", method = GET) public String work(@PathVariable("user") String user, @PathVariable("task") long taskId, Model model) { // log.info(user + " prepare to work on task " + taskId); System.out.println("用户[" + user + "]读取任务以便处理,任务ID=" + taskId); StatefulKnowledgeSession ksession = myLocalTaskService.getKsession(); TaskService taskService = myLocalTaskService.getLocalTaskService(); Task task = taskService.getTask(taskId); TaskData taskData = task.getTaskData(); WorkflowProcessInstance process = (WorkflowProcessInstance) ksession .getProcessInstance(taskData.getProcessInstanceId()); model.addAttribute("taskData", taskData); model.addAttribute("order", new Order(user, taskId, process)); System.out .println("---------------------------------------------------任务读取完成:" + user); return "work"; } @RequestMapping(value = "{user}/work/{task}", method = { POST, PUT }) public String doWork(@ModelAttribute Order order) { System.out.println("处理任务信息:" + order.toString()); String user = order.getUser(); long taskId = order.getTaskId(); log.info(user + " complete work on task " + taskId); TaskService taskService = myLocalTaskService.getLocalTaskService(); System.out.println("用户[" + user + "]启动人工任务, taskId=" + taskId); taskService.start(taskId, user); Map<String, Object> data = new HashMap<String, Object>(); data.put("priority", order.getPriority()); data.put("modelNumber", order.getModelNumber()); data.put("quantity", order.getQuantity()); // setProcessVariables(taskId, data); ContentData contentData = null; if (data != null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream outs; try { outs = new ObjectOutputStream(bos); outs.writeObject(data); outs.close(); contentData = new ContentData(); //contentData.setContent(bos.toByteArray()); //contentData.setAccessType(AccessType.Inline); contentData = ContentMarshallerHelper.marshal(data, null); //contentData.setAccessType(AccessType.Inline); } catch (IOException e) { e.printStackTrace(); } } System.out.println("参数:"+data.toString()); //taskService.complete(taskId, user, contentData); taskService.completeWithResults(taskId, user, data); // ksession.fireAllRules(); // ksession.getWorkItemManager().completeWorkItem(taskService.getTask(taskId).getTaskData().getWorkItemId(), // data); System.out.println("用户[" + user + "]完成人工任务"); System.out .println("---------------------------------------------------处理任务完成:" + user); return "redirect:/" + user + "/list"; } public void setProcessVariables(final long intProcessInstId, final Map<String, Object> hshVariableMap) { try { ksession.execute(new GenericCommand<Map<String, Object>>() { public Map<String, Object> execute(Context objContext) { StatefulKnowledgeSession objKSession = ((KnowledgeCommandContext) objContext) .getStatefulKnowledgesession(); org.jbpm.process.instance.ProcessInstance objProcessInstance = (org.jbpm.process.instance.ProcessInstance) objKSession .getProcessInstance(intProcessInstId); VariableScopeInstance objVariableScope = (VariableScopeInstance) objProcessInstance .getContextInstance(VariableScope.VARIABLE_SCOPE); Iterator<Map.Entry<String, Object>> objIterator = hshVariableMap .entrySet().iterator(); while (objIterator.hasNext()) { Map.Entry<String, Object> objPairs = (Map.Entry<String, Object>) objIterator .next(); objVariableScope.setVariable(objPairs.getKey(), objPairs.getValue()); } return null; } }); } catch (Exception e) { e.printStackTrace(); } } }
src/main/resources/applicationContext.xml
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:drools="http://drools.org/schema/drools-spring" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring-1.3.0.xsd"> <context:component-scan base-package="com"> <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation" /> </context:component-scan> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> <!-- Spring + Hibernate --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" p:packagesToScan="com.pandy.ssh4.domian"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> ${hibernate.dialect} </prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory </prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <prop key="hibernate.generate_statistics">true</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> <!-- JBPM 5.4 --> <bean id="xDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1:3306/jbpmtest?characterEncoding=UTF-8" /> <property name="username" value="root" /> <property name="password" value="root" /> </bean> <bean id="jbpmEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="xDataSource" /> <property name="persistenceUnitName" value="org.jbpm.persistence.local" /> </bean> <bean id="jbpmTxManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="jbpmEntityManagerFactory" /> <!-- 这里要是为false的话,提交事物的时候,容易报错 --> <property name="nestedTransactionAllowed" value="true" /> </bean> <drools:grid-node id="node1" /> <drools:kstore id="kstore1" /> <drools:kbase id="kbase" node="node1"> <drools:resources> <drools:resource type="BPMN2" source="classpath:Sample.bpmn" /> </drools:resources> </drools:kbase> <drools:ksession id="ksession" type="stateful" kbase="kbase" node="node1"> <drools:configuration> <drools:jpa-persistence> <drools:transaction-manager ref="jbpmTxManager" /> <drools:entity-manager-factory ref="jbpmEntityManagerFactory" /> </drools:jpa-persistence> </drools:configuration> </drools:ksession> <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory" factory-method="getSystemEventListener" /> <bean id="internalTaskService" class="org.jbpm.task.service.TaskService"> <property name="systemEventListener" ref="systemEventListener" /> </bean> <bean id="htTxManager" class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager"> <constructor-arg ref="jbpmTxManager" /> </bean> <bean id="springTaskSessionFactory" class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl" init-method="initialize" depends-on="internalTaskService"> <property name="entityManagerFactory" ref="jbpmEntityManagerFactory" /> <property name="transactionManager" ref="htTxManager" /> <property name="useJTA" value="true" /> <property name="taskService" ref="internalTaskService" /> </bean> <bean id="taskService" class="org.jbpm.task.service.local.LocalTaskService" depends-on="internalTaskService"> <constructor-arg ref="internalTaskService" /> </bean> <bean id="myLocalTaskService" class="com.gds.jbpm.MyLocalTaskService"> <property name="ksession" ref="ksession" /> <property name="localTaskService" ref="taskService" /> </bean> </beans
相关推荐
Struts 2.3.24.1、Spring 4.2.1 和 Hibernate 5.0 是三个在 Java 开发领域中广泛使用的开源框架,它们分别负责 Web 应用的 MVC(Model-View-Controller)架构、依赖注入与服务管理以及对象关系映射(ORM)。...
12.6 整合Struts、Spring和Hibernate实现用户管理 12.6.1 Struts、Spring和Hibernate的整合方式 12.6.2 编写用户注册画面regedit.jsp 12.6.3 编写用户登录画面login.jsp 12.6.4 编写注册控制器RegeditAction.java ...
12.6 整合Struts、Spring和Hibernate实现用户管理 12.6.1 Struts、Spring和Hibernate的整合方式 12.6.2 编写用户注册画面regedit.jsp 12.6.3 编写用户登录画面login.jsp 12.6.4 编写注册控制器RegeditAction.java ...
GIF+动画制作软件-GIF+Movie+Gear+V4.2.1汉化绿色特别版
7. **事务管理**:Hibernate支持编程式和声明式事务管理,可以结合Spring等框架进行更高级的事务控制。 8. **延迟加载**:Hibernate的懒加载(Lazy Loading)机制可以按需加载关联对象,提高性能。 9. **事件监听*...
资源名字:基于JSP+Spring+Hibernate+Struts+mysql的家庭理财收支系统设计与实现(源码+文档).zip 资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 包含模块: 4.1 ...
资源名字:基于JSP+Spring+Hibernate+Struts+mysql的机票订购系统设计与实现(源码+文档).zip 资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 包含模块: 4.1前台...
资源名字:基于JSP+Spring+Hibernate+Struts+mysql的网上在线客车售票系统设计与实现(源码+文档).zip 资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 包含模块: ...
资源名字:基于JSP+Spring+Hibernate+Struts2+mysql的校园二手交易系统设计与实现(源码+文档).zip 资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 包含模块: 4.1 ...
标题中的"Router+Tools+V4.2.1_ddwrt_router_"暗示了这是一个与路由器相关的软件工具包,特别地,是DD-WRT固件的一个版本。DD-WRT是一款流行的开源路由器固件,它提供了比许多出厂固件更丰富的功能和自定义选项,...
spring-framework-4.2.1jar包完整版,spring-framework-4.2.1jar包完整版,spring-framework-4.2.1jar包完整版,spring-framework-4.2.1jar包完整版,spring-framework-4.2.1jar包完整版,spring-framework-4.2.1jar...
本文将围绕"Hibernate4.2.1完整jar包",深入探讨其核心组件、C3P0连接池的整合以及MySQL数据库的连接配置。 1. Hibernate4.2.1核心组件: Hibernate4.2.1的核心组件包括SessionFactory、Session、Query等。...
12.6 整合Struts、Spring和Hibernate实现用户管理 12.6.1 Struts、Spring和Hibernate的整合方式 12.6.2 编写用户注册画面regedit.jsp 12.6.3 编写用户登录画面login.jsp 12.6.4 编写注册控制器RegeditAction.java ...
苹果狮子(BT)+xcode4.2.1(官方)下载地址主要涉及到的是苹果公司的操作系统OS X Lion(10.7版本)以及Xcode 4.2.1开发工具的相关内容。这两个软件对于Mac用户,尤其是苹果开发者来说,是至关重要的。 首先,OS X ...
"【WordPress主题】2022年最新版完整功能demo+插件4.2.1 ClassiPress - The bestselling classifieds theme for WordPress Classipress - WordPress的Bestselling分类主题" ---------- 泰森云每天更新发布最新...
《Hibernate 4.2.1:企业级持久化框架的深度解析》 Hibernate,作为Java领域最著名的对象关系映射(ORM)框架之一,一直以来都是开发者们的重要工具。本文将聚焦于Hibernate 4.2.1版本,深入探讨其特性、安装与配置...
hibernate4.2.1final英文版技术文档
FFmpeg 4.2.1 Windows 开发环境搭建与 QT 集成 FFmpeg 是一个免费、开源的多媒体处理工具,可以进行视频和音频的编解码、转换、流媒体处理等操作。为了在 Windows 平台上搭建 FFmpeg 4.2.1 开发环境,并集成到 QT ...