Spring3.1 + Hibernate4.2.1 + JBPM5.4 + Ehache整合例子

转载 2013年12月04日 15:47:35
pom.xml 
----------------------------------- 
Xml代码  收藏代码
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  3.     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  
  4.     <modelVersion>4.0.0</modelVersion>  
  5.     <groupId>org.jbpm</groupId>  
  6.     <artifactId>jbpm-maven-example</artifactId>  
  7.     <name>jBPM Maven Project</name>  
  8.     <version>1.0-SNAPSHOT</version>  
  9.     <properties>  
  10.         <spring.version>3.1.4.RELEASE</spring.version>  
  11.         <aspectj.version>1.6.2</aspectj.version>  
  12.         <jboss.netty.version>3.2.0.Final</jboss.netty.version>  
  13.         <mysql.version>5.1.10</mysql.version>  
  14.   
  15.         <hibernate.version>4.2.1.Final</hibernate.version>  
  16.         <hibernateCommAnn.version>3.2.0.Final</hibernateCommAnn.version>  
  17.         <hibernateAnn.version>3.5.6-Final</hibernateAnn.version>  
  18.         <cglib.version>2.2.2</cglib.version>  
  19.   
  20.         <slf4j.version>1.6.1</slf4j.version>  
  21.         <log4j.version>1.2.16</log4j.version>  
  22.   
  23.         <jbpm.version>5.4.0.Final</jbpm.version>  
  24.         <drools.version>5.5.0.Final</drools.version>  
  25.     </properties>  
  26.     <repositories>  
  27.         <!-- use this repository for stable releases -->  
  28.         <repository>  
  29.             <id>jboss-public-repository-group</id>  
  30.             <name>JBoss Public Maven Repository Group</name>  
  31.             <url>https://repository.jboss.org/nexus/content/groups/public/</url>  
  32.             <layout>default</layout>  
  33.             <releases>  
  34.                 <enabled>true</enabled>  
  35.                 <updatePolicy>never</updatePolicy>  
  36.             </releases>  
  37.             <snapshots>  
  38.                 <enabled>false</enabled>  
  39.             </snapshots>  
  40.         </repository>  
  41.         <!-- use this repository for snapshot releases -->  
  42.         <repository>  
  43.             <id>jboss-snapshot-repository-group</id>  
  44.             <name>JBoss SNAPSHOT Maven Repository Group</name>  
  45.             <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>  
  46.             <layout>default</layout>  
  47.             <releases>  
  48.                 <enabled>false</enabled>  
  49.             </releases>  
  50.             <snapshots>  
  51.                 <enabled>true</enabled>  
  52.                 <updatePolicy>never</updatePolicy>  
  53.             </snapshots>  
  54.         </repository>  
  55.     </repositories>  
  56.   
  57.     <dependencies>  
  58.         <!-- Spring 3 -->  
  59.         <dependency>  
  60.             <groupId>org.springframework</groupId>  
  61.             <artifactId>spring-asm</artifactId>  
  62.             <version>${spring.version}</version>  
  63.         </dependency>  
  64.         <dependency>  
  65.             <groupId>org.springframework</groupId>  
  66.             <artifactId>spring-aspects</artifactId>  
  67.             <version>${spring.version}</version>  
  68.         </dependency>  
  69.         <dependency>  
  70.             <groupId>org.springframework</groupId>  
  71.             <artifactId>spring-core</artifactId>  
  72.             <version>${spring.version}</version>  
  73.         </dependency>  
  74.         <dependency>  
  75.             <groupId>org.springframework</groupId>  
  76.             <artifactId>spring-beans</artifactId>  
  77.             <version>${spring.version}</version>  
  78.         </dependency>  
  79.         <dependency>  
  80.             <groupId>org.springframework</groupId>  
  81.             <artifactId>spring-web</artifactId>  
  82.             <version>${spring.version}</version>  
  83.         </dependency>  
  84.         <dependency>  
  85.             <groupId>org.springframework</groupId>  
  86.             <artifactId>spring-tx</artifactId>  
  87.             <version>${spring.version}</version>  
  88.         </dependency>  
  89.         <dependency>  
  90.             <groupId>org.springframework</groupId>  
  91.             <artifactId>spring-webmvc</artifactId>  
  92.             <version>${spring.version}</version>  
  93.         </dependency>  
  94.         <dependency>  
  95.             <groupId>org.springframework</groupId>  
  96.             <artifactId>spring-context</artifactId>  
  97.             <version>${spring.version}</version>  
  98.         </dependency>  
  99.         <dependency>  
  100.             <groupId>org.springframework</groupId>  
  101.             <artifactId>spring-context-support</artifactId>  
  102.             <version>${spring.version}</version>  
  103.         </dependency>  
  104.         <dependency>  
  105.             <groupId>org.springframework</groupId>  
  106.             <artifactId>spring-aop</artifactId>  
  107.             <version>${spring.version}</version>  
  108.         </dependency>  
  109.         <dependency>  
  110.             <groupId>org.springframework</groupId>  
  111.             <artifactId>spring-expression</artifactId>  
  112.             <version>${spring.version}</version>  
  113.         </dependency>  
  114.         <dependency>  
  115.             <groupId>org.springframework</groupId>  
  116.             <artifactId>spring-orm</artifactId>  
  117.             <version>${spring.version}</version>  
  118.         </dependency>  
  119.         <dependency>  
  120.             <groupId>org.springframework</groupId>  
  121.             <artifactId>spring-jdbc</artifactId>  
  122.             <version>${spring.version}</version>  
  123.         </dependency>  
  124.         <dependency>  
  125.             <groupId>org.springframework</groupId>  
  126.             <artifactId>spring-test</artifactId>  
  127.             <version>${spring.version}</version>  
  128.             <optional>true</optional>  
  129.             <scope>test</scope>  
  130.         </dependency>  
  131.         <dependency>  
  132.             <groupId>org.springframework</groupId>  
  133.             <artifactId>spring-webmvc</artifactId>  
  134.             <version>${spring.version}</version>  
  135.         </dependency>  
  136.         <dependency>  
  137.             <groupId>org.aspectj</groupId>  
  138.             <artifactId>aspectjweaver</artifactId>  
  139.             <version>${aspectj.version}</version>  
  140.         </dependency>  
  141.         <dependency>  
  142.             <groupId>org.apache.openjpa</groupId>  
  143.             <artifactId>openjpa-persistence</artifactId>  
  144.             <version>2.2.2</version>  
  145.         </dependency>  
  146.         <!-- Hibernate -->  
  147.         <dependency>  
  148.             <groupId>org.hibernate</groupId>  
  149.             <artifactId>hibernate-core</artifactId>  
  150.             <version>${hibernate.version}</version>  
  151.         </dependency>  
  152.         <dependency>  
  153.             <groupId>org.hibernate</groupId>  
  154.             <artifactId>hibernate-entitymanager</artifactId>  
  155.             <version>${hibernate.version}</version>  
  156.         </dependency>  
  157.         <dependency>  
  158.             <groupId>org.hibernate</groupId>  
  159.             <artifactId>hibernate-commons-annotations</artifactId>  
  160.             <version>${hibernateCommAnn.version}</version>  
  161.         </dependency>  
  162.         <dependency>  
  163.             <groupId>org.hibernate</groupId>  
  164.             <artifactId>hibernate-annotations</artifactId>  
  165.             <version>${hibernateAnn.version}</version>  
  166.         </dependency>  
  167.         <dependency>  
  168.             <groupId>cglib</groupId>  
  169.             <artifactId>cglib</artifactId>  
  170.             <version>${cglib.version}</version>  
  171.         </dependency>  
  172.         <dependency>  
  173.             <groupId>org.hibernate.javax.persistence</groupId>  
  174.             <artifactId>hibernate-jpa-2.0-api</artifactId>  
  175.             <version>1.0.1.Final</version>  
  176.         </dependency>  
  177.         <!-- JBOSS Cache & Hibernate -->  
  178.         <dependency>  
  179.             <groupId>org.hibernate</groupId>  
  180.             <artifactId>hibernate-ehcache</artifactId>  
  181.             <version>4.2.1.Final</version>  
  182.         </dependency>  
  183.         <dependency>  
  184.             <groupId>hsqldb</groupId>  
  185.             <artifactId>hsqldb</artifactId>  
  186.             <version>1.8.0.4</version>  
  187.         </dependency>  
  188.         <dependency>  
  189.             <groupId>org.hibernate</groupId>  
  190.             <artifactId>hibernate-testing</artifactId>  
  191.             <version>${hibernate.version}</version>  
  192.         </dependency>  
  193.         <dependency>  
  194.             <groupId>net.sf.ehcache</groupId>  
  195.             <artifactId>ehcache-core</artifactId>  
  196.             <version>2.4.3</version>  
  197.         </dependency>  
  198.         <!-- JBPM5.4 -->  
  199.         <dependency>  
  200.             <groupId>org.drools</groupId>  
  201.             <artifactId>drools-spring</artifactId>  
  202.             <version>${drools.version}</version>  
  203.         </dependency>  
  204.         <dependency>  
  205.             <groupId>org.jbpm</groupId>  
  206.             <artifactId>jbpm-bpmn2</artifactId>  
  207.             <version>${jbpm.version}</version>  
  208.         </dependency>  
  209.         <dependency>  
  210.             <groupId>org.jbpm</groupId>  
  211.             <artifactId>jbpm-human-task-core</artifactId>  
  212.             <version>${jbpm.version}</version>  
  213.         </dependency>  
  214.         <dependency>  
  215.             <groupId>org.jbpm</groupId>  
  216.             <artifactId>jbpm-persistence-jpa</artifactId>  
  217.             <version>${jbpm.version}</version>  
  218.         </dependency>  
  219.         <dependency>  
  220.             <groupId>org.jbpm</groupId>  
  221.             <artifactId>jbpm-bam</artifactId>  
  222.             <version>${jbpm.version}</version>  
  223.         </dependency>  
  224.   
  225.         <!-- Log4j -->  
  226.         <dependency>  
  227.             <groupId>org.slf4j</groupId>  
  228.             <artifactId>slf4j-api</artifactId>  
  229.             <version>1.6.1</version>  
  230.         </dependency>  
  231.         <dependency>  
  232.             <groupId>log4j</groupId>  
  233.             <artifactId>log4j</artifactId>  
  234.             <version>${log4j.version}</version>  
  235.         </dependency>  
  236.         <dependency>  
  237.             <groupId>org.slf4j</groupId>  
  238.             <artifactId>slf4j-log4j12</artifactId>  
  239.             <version>1.6.1</version>  
  240.         </dependency>  
  241.         <dependency>  
  242.             <groupId>org.lazyluke</groupId>  
  243.             <artifactId>log4jdbc-remix</artifactId>  
  244.             <version>0.2.7</version>  
  245.         </dependency>  
  246.   
  247.   
  248.         <dependency>  
  249.             <groupId>mysql</groupId>  
  250.             <artifactId>mysql-connector-java</artifactId>  
  251.             <version>${mysql.version}</version>  
  252.         </dependency>  
  253.   
  254.     </dependencies>  
  255.     <build>  
  256.         <finalName>JBPM54sh</finalName>  
  257.         <plugins>  
  258.             <plugin>  
  259.                 <groupId>org.apache.maven.plugins</groupId>  
  260.                 <artifactId>maven-compiler-plugin</artifactId>  
  261.                 <version>2.3.2</version>  
  262.                 <configuration>  
  263.                     <source>1.6</source>  
  264.                     <target>1.6</target>  
  265.                 </configuration>  
  266.             </plugin>  
  267.             <plugin>  
  268.                 <groupId>org.apache.maven.plugins</groupId>  
  269.                 <artifactId>maven-surefire-plugin</artifactId>  
  270.                 <version>2.5</version>  
  271.             </plugin>  
  272.             <plugin>  
  273.                 <groupId>org.apache.maven.plugins</groupId>  
  274.                 <artifactId>maven-war-plugin</artifactId>  
  275.                 <version>2.1.1</version>  
  276.                 <configuration>  
  277.                     <archive>  
  278.                         <manifest>  
  279.                             <!--<addClasspath>true</addClasspath> -->  
  280.                         </manifest>  
  281.                         <manifestEntries>  
  282.                             <Built-By>org-builder</Built-By>  
  283.                             <Build-Jdk>${java.version}</Build-Jdk>  
  284.                         </manifestEntries>  
  285.                     </archive>  
  286.                 </configuration>  
  287.             </plugin>  
  288.             <plugin>  
  289.                 <groupId>org.mortbay.jetty</groupId>  
  290.                 <artifactId>maven-jetty-plugin</artifactId>  
  291.                 <version>6.1.20</version>  
  292.                 <configuration>  
  293.                     <contextPath>/JBPM54sh</contextPath>  
  294.                     <!--<webDefaultXml>webdefault.xml</webDefaultXml> -->  
  295.                     <scanIntervalSeconds>0</scanIntervalSeconds>  
  296.                     <scanTargetPatterns>  
  297.                         <scanTargetPattern>  
  298.                             <directory>src/main/webapp/WEB-INF</directory>  
  299.                             <excludes>  
  300.                                 <exclude>**/*.jsp</exclude>  
  301.                             </excludes>  
  302.                             <includes>  
  303.                                 <include>**/*.properties</include>  
  304.                                 <include>**/*.xml</include>  
  305.                             </includes>  
  306.                         </scanTargetPattern>  
  307.                     </scanTargetPatterns>  
  308.                 </configuration>  
  309.             </plugin>  
  310.             <plugin>  
  311.                 <artifactId>maven-war-plugin</artifactId>  
  312.                 <version>2.0.2</version>  
  313.                 <configuration>  
  314.                     <archive>  
  315.                         <manifest>  
  316.                             <addDefaultImplementationEntries>true</addDefaultImplementationEntries>  
  317.                         </manifest>  
  318.                         <manifestEntries>  
  319.                             <Implementation-Build>${buildNumber}</Implementation-Build>  
  320.                         </manifestEntries>  
  321.                     </archive>  
  322.                     <dependentWarExcludes>  
  323.                         **/jdbc.properties,**/web.xml,WEB-INF/classes/META-INF/**  
  324.                     </dependentWarExcludes>  
  325.                 </configuration>  
  326.             </plugin>  
  327.         </plugins>  
  328.     </build>  
  329. </project>  


src/main/resources/ehcache.xml 
----------------------------------- 
Xml代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <ehcache>  
  3.     <!--如果缓存中的对象存储超过指定的缓存数量的对象存储的磁盘地址 -->  
  4.     <diskStore path="D:/ehcache" />  
  5.   
  6.     <!-- 默认cache:如果没有对应的特定区域的缓存,就使用默认缓存 -->  
  7.     <defaultCache maxElementsInMemory="10000" eternal="false"  
  8.         timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false" />  
  9.           
  10.           
  11.     <!-- 指定区域cache:通过name指定,name对应到Hibernate中的区域名即可 -->  
  12.     <cache name="cn.javass.h3test.model.UserModel" eternal="false"  
  13.         maxElementsInMemory="100" timeToIdleSeconds="1200" timeToLiveSeconds="1200"  
  14.         overflowToDisk="false">  
  15.     </cache>  
  16.   
  17. </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代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"  
  5.     version="1.0">  
  6.     <named-query name="ProcessInstancesWaitingForEvent">  
  7.         <query>  
  8.             select  
  9.             processInstanceInfo.processInstanceId  
  10.             from  
  11.             ProcessInstanceInfo processInstanceInfo join  
  12.             processInstanceInfo.eventTypes eventTypes  
  13.             where  
  14.             eventTypes = :type  
  15.         </query>  
  16.     </named-query>  
  17. </entity-mappings>  



src/main/resources/META-INF/Taskorm.xml 
----------------------------------- 
Xml代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"  
  5.     version="1.0">  
  6.     <named-query name="TasksAssignedAsBusinessAdministrator">  
  7.         <query>  
  8.             select  
  9.             new org.jbpm.task.query.TaskSummary(  
  10.             t.id,  
  11.             t.taskData.processInstanceId,  
  12.             name.text,  
  13.             subject.text,  
  14.             description.text,  
  15.             t.taskData.status,  
  16.             t.priority,  
  17.             t.taskData.skipable,  
  18.             actualOwner,  
  19.             createdBy,  
  20.             t.taskData.createdOn,  
  21.             t.taskData.activationTime,  
  22.             t.taskData.expirationTime,  
  23.             t.taskData.processId,  
  24.             t.taskData.processSessionId)  
  25.             from  
  26.             Task t  
  27.             left join t.taskData.createdBy as createdBy  
  28.             left join t.taskData.actualOwner as actualOwner  
  29.             left join t.subjects as subject  
  30.             left join t.descriptions as description  
  31.             left join t.names as name,  
  32.             OrganizationalEntity businessAdministrator  
  33.             where  
  34.             t.archived = 0 and  
  35.             businessAdministrator.id = :userId and  
  36.             businessAdministrator in elements ( t.peopleAssignments.businessAdministrators ) and  
  37.   
  38.             (  
  39.             name.language = :language  
  40.             or t.names.size = 0  
  41.             ) and  
  42.   
  43.             (  
  44.             subject.language = :language  
  45.             or t.subjects.size = 0  
  46.             ) and  
  47.   
  48.             (  
  49.             description.language = :language  
  50.             or t.descriptions.size = 0  
  51.             ) and  
  52.   
  53.             t.taskData.expirationTime is null  
  54.         </query>  
  55.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  56.     </named-query>  
  57.     <named-query name="TasksAssignedAsExcludedOwner">  
  58.         <query>  
  59.             select  
  60.             new org.jbpm.task.query.TaskSummary(  
  61.             t.id,  
  62.             t.taskData.processInstanceId,  
  63.             name.text,  
  64.             subject.text,  
  65.             description.text,  
  66.             t.taskData.status,  
  67.             t.priority,  
  68.             t.taskData.skipable,  
  69.             actualOwner,  
  70.             createdBy,  
  71.             t.taskData.createdOn,  
  72.             t.taskData.activationTime,  
  73.             t.taskData.expirationTime,  
  74.             t.taskData.processId,  
  75.             t.taskData.processSessionId)  
  76.             from  
  77.             Task t  
  78.             left join t.taskData.createdBy as createdBy  
  79.             left join t.taskData.actualOwner as actualOwner  
  80.             left join t.subjects as subject  
  81.             left join t.descriptions as description  
  82.             left join t.names as name,  
  83.             OrganizationalEntity excludedOwners  
  84.             where  
  85.             t.archived = 0 and  
  86.             excludedOwners.id = :userId and  
  87.             excludedOwners in elements ( t.peopleAssignments.excludedOwners ) and  
  88.   
  89.             (  
  90.             name.language = :language  
  91.             or t.names.size = 0  
  92.             ) and  
  93.   
  94.             (  
  95.             subject.language = :language  
  96.             or t.subjects.size = 0  
  97.             ) and  
  98.   
  99.             (  
  100.             description.language = :language  
  101.             or t.descriptions.size = 0  
  102.             ) and  
  103.   
  104.             t.taskData.expirationTime is null  
  105.         </query>  
  106.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  107.     </named-query>  
  108.     <named-query name="TasksAssignedAsPotentialOwner">  
  109.         <query>  
  110.             select  
  111.             new org.jbpm.task.query.TaskSummary(  
  112.             t.id,  
  113.             t.taskData.processInstanceId,  
  114.             name.text,  
  115.             subject.text,  
  116.             description.text,  
  117.             t.taskData.status,  
  118.             t.priority,  
  119.             t.taskData.skipable,  
  120.             actualOwner,  
  121.             createdBy,  
  122.             t.taskData.createdOn,  
  123.             t.taskData.activationTime,  
  124.             t.taskData.expirationTime,  
  125.             t.taskData.processId,  
  126.             t.taskData.processSessionId)  
  127.             from  
  128.             Task t  
  129.             left join t.taskData.createdBy as createdBy  
  130.             left join t.taskData.actualOwner as actualOwner  
  131.             left join t.subjects as subject  
  132.             left join t.descriptions as description  
  133.             left join t.names as name,  
  134.             OrganizationalEntity potentialOwners  
  135.             where  
  136.             t.archived = 0 and  
  137.             potentialOwners.id = :userId and  
  138.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  139.   
  140.             (  
  141.             name.language = :language  
  142.             or t.names.size = 0  
  143.             ) and  
  144.   
  145.             (  
  146.             subject.language = :language  
  147.             or t.subjects.size = 0  
  148.             ) and  
  149.   
  150.             (  
  151.             description.language = :language  
  152.             or t.descriptions.size = 0  
  153.             ) and  
  154.   
  155.             t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and  
  156.   
  157.             t.taskData.expirationTime is null  
  158.         </query>  
  159.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  160.     </named-query>  
  161.     <named-query name="TasksAssignedAsPotentialOwnerByStatus">  
  162.         <query>  
  163.             select  
  164.             new org.jbpm.task.query.TaskSummary(  
  165.             t.id,  
  166.             t.taskData.processInstanceId,  
  167.             name.text,  
  168.             subject.text,  
  169.             description.text,  
  170.             t.taskData.status,  
  171.             t.priority,  
  172.             t.taskData.skipable,  
  173.             actualOwner,  
  174.             createdBy,  
  175.             t.taskData.createdOn,  
  176.             t.taskData.activationTime,  
  177.             t.taskData.expirationTime,  
  178.             t.taskData.processId,  
  179.             t.taskData.processSessionId)  
  180.             from  
  181.             Task t  
  182.             left join t.taskData.createdBy as createdBy  
  183.             left join t.taskData.actualOwner as actualOwner  
  184.             left join t.subjects as subject  
  185.             left join t.descriptions as description  
  186.             left join t.names as name,  
  187.             OrganizationalEntity potentialOwners  
  188.             where  
  189.             t.archived = 0 and  
  190.             potentialOwners.id = :userId and  
  191.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  192.   
  193.             (  
  194.             name.language = :language  
  195.             or t.names.size = 0  
  196.             ) and  
  197.   
  198.             (  
  199.             subject.language = :language  
  200.             or t.subjects.size = 0  
  201.             ) and  
  202.   
  203.             (  
  204.             description.language = :language  
  205.             or t.descriptions.size = 0  
  206.             ) and  
  207.   
  208.             t.taskData.status in (:status) and  
  209.   
  210.             t.taskData.expirationTime is null  
  211.         </query>  
  212.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  213.     </named-query>  
  214.     <named-query name="TasksAssignedAsPotentialOwnerWithGroups">  
  215.         <query>  
  216.             select  
  217.             new org.jbpm.task.query.TaskSummary(  
  218.             t.id,  
  219.             t.taskData.processInstanceId,  
  220.             name.text,  
  221.             subject.text,  
  222.             description.text,  
  223.             t.taskData.status,  
  224.             t.priority,  
  225.             t.taskData.skipable,  
  226.             actualOwner,  
  227.             createdBy,  
  228.             t.taskData.createdOn,  
  229.             t.taskData.activationTime,  
  230.             t.taskData.expirationTime,  
  231.             t.taskData.processId,  
  232.             t.taskData.processSessionId)  
  233.             from  
  234.             Task t  
  235.             left join t.taskData.createdBy as createdBy  
  236.             left join t.taskData.actualOwner as actualOwner  
  237.             left join t.subjects as subject  
  238.             left join t.descriptions as description  
  239.             left join t.names as name,  
  240.             OrganizationalEntity potentialOwners  
  241.             where  
  242.             t.archived = 0 and  
  243.             ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) )  
  244.             and  
  245.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  246.   
  247.             (  
  248.             name.language = :language  
  249.             or t.names.size = 0  
  250.             ) and  
  251.   
  252.             (  
  253.             subject.language = :language  
  254.             or t.subjects.size = 0  
  255.             ) and  
  256.   
  257.             (  
  258.             description.language = :language  
  259.             or t.descriptions.size = 0  
  260.             ) and  
  261.   
  262.             t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and  
  263.   
  264.             t.taskData.expirationTime is null  
  265.         </query>  
  266.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  267.     </named-query>  
  268.     <named-query name="TasksAssignedAsPotentialOwnerByStatusWithGroups">  
  269.         <query>  
  270.             select  
  271.             new org.jbpm.task.query.TaskSummary(  
  272.             t.id,  
  273.             t.taskData.processInstanceId,  
  274.             name.text,  
  275.             subject.text,  
  276.             description.text,  
  277.             t.taskData.status,  
  278.             t.priority,  
  279.             t.taskData.skipable,  
  280.             actualOwner,  
  281.             createdBy,  
  282.             t.taskData.createdOn,  
  283.             t.taskData.activationTime,  
  284.             t.taskData.expirationTime,  
  285.             t.taskData.processId,  
  286.             t.taskData.processSessionId)  
  287.             from  
  288.             Task t  
  289.             left join t.taskData.createdBy as createdBy  
  290.             left join t.taskData.actualOwner as actualOwner  
  291.             left join t.subjects as subject  
  292.             left join t.descriptions as description  
  293.             left join t.names as name,  
  294.             OrganizationalEntity potentialOwners  
  295.             where  
  296.             t.archived = 0 and  
  297.             ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) )  
  298.             and  
  299.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  300.   
  301.             (  
  302.             name.language = :language  
  303.             or t.names.size = 0  
  304.             ) and  
  305.   
  306.             (  
  307.             subject.language = :language  
  308.             or t.subjects.size = 0  
  309.             ) and  
  310.   
  311.             (  
  312.             description.language = :language  
  313.             or t.descriptions.size = 0  
  314.             ) and  
  315.   
  316.             t.taskData.status in (:status) and  
  317.   
  318.             t.taskData.expirationTime is null  
  319.         </query>  
  320.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  321.     </named-query>  
  322.     <named-query name="TasksAssignedAsPotentialOwnerByGroup">  
  323.         <query>  
  324.             select  
  325.             new org.jbpm.task.query.TaskSummary(  
  326.             t.id,  
  327.             t.taskData.processInstanceId,  
  328.             name.text,  
  329.             subject.text,  
  330.             description.text,  
  331.             t.taskData.status,  
  332.             t.priority,  
  333.             t.taskData.skipable,  
  334.             actualOwner,  
  335.             createdBy,  
  336.             t.taskData.createdOn,  
  337.             t.taskData.activationTime,  
  338.             t.taskData.expirationTime,  
  339.             t.taskData.processId,  
  340.             t.taskData.processSessionId)  
  341.             from  
  342.             Task t  
  343.             left join t.taskData.createdBy as createdBy  
  344.             left join t.taskData.actualOwner as actualOwner  
  345.             left join t.subjects as subject  
  346.             left join t.descriptions as description  
  347.             left join t.names as name,  
  348.             OrganizationalEntity potentialOwners  
  349.             where  
  350.             t.archived = 0 and  
  351.             potentialOwners.id = :groupId and  
  352.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  353.   
  354.             (  
  355.             name.language = :language  
  356.             or t.names.size = 0  
  357.             ) and  
  358.   
  359.             (  
  360.             subject.language = :language  
  361.             or t.subjects.size = 0  
  362.             ) and  
  363.   
  364.             (  
  365.             description.language = :language  
  366.             or t.descriptions.size = 0  
  367.             ) and  
  368.   
  369.             t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and  
  370.   
  371.             t.taskData.expirationTime is null  
  372.         </query>  
  373.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  374.     </named-query>  
  375.   
  376.     <named-query name="SubTasksAssignedAsPotentialOwner">  
  377.         <query>  
  378.             select  
  379.             new org.jbpm.task.query.TaskSummary(  
  380.             t.id,  
  381.             t.taskData.processInstanceId,  
  382.             name.text,  
  383.             subject.text,  
  384.             description.text,  
  385.             t.taskData.status,  
  386.             t.priority,  
  387.             t.taskData.skipable,  
  388.             actualOwner,  
  389.             createdBy,  
  390.             t.taskData.createdOn,  
  391.             t.taskData.activationTime,  
  392.             t.taskData.expirationTime,  
  393.             t.taskData.processId,  
  394.             t.taskData.processSessionId)  
  395.             from  
  396.             Task t  
  397.             left join t.taskData.createdBy as createdBy  
  398.             left join t.taskData.actualOwner as actualOwner  
  399.             left join t.subjects as subject  
  400.             left join t.descriptions as description  
  401.             left join t.names as name,  
  402.             OrganizationalEntity potentialOwners  
  403.             where  
  404.             t.archived = 0 and  
  405.             t.taskData.parentId = :parentId and  
  406.             (potentialOwners.id = :userId or potentialOwners.id in (:groupIds)) and  
  407.             potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and  
  408.   
  409.             (  
  410.             name.language = :language  
  411.             or t.names.size = 0  
  412.             ) and  
  413.   
  414.             (  
  415.             subject.language = :language  
  416.             or t.subjects.size = 0  
  417.             ) and  
  418.   
  419.             (  
  420.             description.language = :language  
  421.             or t.descriptions.size = 0  
  422.             ) and  
  423.   
  424.             t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and  
  425.   
  426.             t.taskData.expirationTime is null  
  427.         </query>  
  428.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  429.     </named-query>  
  430.   
  431.     <named-query name="GetSubTasksByParentTaskId">  
  432.         <query>  
  433.             select  
  434.             new org.jbpm.task.query.TaskSummary(  
  435.             t.id,  
  436.             t.taskData.processInstanceId,  
  437.             name.text,  
  438.             subject.text,  
  439.             description.text,  
  440.             t.taskData.status,  
  441.             t.priority,  
  442.             t.taskData.skipable,  
  443.             actualOwner,  
  444.             createdBy,  
  445.             t.taskData.createdOn,  
  446.             t.taskData.activationTime,  
  447.             t.taskData.expirationTime,  
  448.             t.taskData.processId,  
  449.             t.taskData.processSessionId)  
  450.             from  
  451.             Task t  
  452.             left join t.taskData.createdBy as createdBy  
  453.             left join t.taskData.actualOwner as actualOwner  
  454.             left join t.subjects as subject  
  455.             left join t.descriptions as description  
  456.             left join t.names as name  
  457.             where  
  458.             t.archived = 0 and  
  459.             t.taskData.parentId = :parentId and  
  460.   
  461.             (  
  462.             name.language = :language  
  463.             or t.names.size = 0  
  464.             ) and  
  465.   
  466.             (  
  467.             subject.language = :language  
  468.             or t.subjects.size = 0  
  469.             ) and  
  470.   
  471.             (  
  472.             description.language = :language  
  473.             or t.descriptions.size = 0  
  474.             ) and  
  475.   
  476.             t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and  
  477.   
  478.             t.taskData.expirationTime is null  
  479.         </query>  
  480.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  481.     </named-query>  
  482.   
  483.   
  484.     <named-query name="TasksAssignedAsRecipient">  
  485.         <query>  
  486.             select  
  487.             new org.jbpm.task.query.TaskSummary(  
  488.             t.id,  
  489.             t.taskData.processInstanceId,  
  490.             name.text,  
  491.             subject.text,  
  492.             description.text,  
  493.             t.taskData.status,  
  494.             t.priority,  
  495.             t.taskData.skipable,  
  496.             actualOwner,  
  497.             createdBy,  
  498.             t.taskData.createdOn,  
  499.             t.taskData.activationTime,  
  500.             t.taskData.expirationTime,  
  501.             t.taskData.processId,  
  502.             t.taskData.processSessionId)  
  503.             from  
  504.             Task t  
  505.             left join t.taskData.createdBy as createdBy  
  506.             left join t.taskData.actualOwner as actualOwner  
  507.             left join t.subjects as subject  
  508.             left join t.descriptions as description  
  509.             left join t.names as name,  
  510.             OrganizationalEntity recipients  
  511.             where  
  512.             t.archived = 0 and  
  513.             recipients.id = :userId and  
  514.             recipients in elements ( t.peopleAssignments.recipients ) and  
  515.   
  516.             (  
  517.             name.language = :language  
  518.             or t.names.size = 0  
  519.             ) and  
  520.   
  521.             (  
  522.             subject.language = :language  
  523.             or t.subjects.size = 0  
  524.             ) and  
  525.   
  526.             (  
  527.             description.language = :language  
  528.             or t.descriptions.size = 0  
  529.             ) and  
  530.   
  531.             t.taskData.expirationTime is null  
  532.         </query>  
  533.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  534.     </named-query>  
  535.     <named-query name="TasksAssignedAsTaskInitiator">  
  536.         <query>  
  537.             select  
  538.             new org.jbpm.task.query.TaskSummary(  
  539.             t.id,  
  540.             t.taskData.processInstanceId,  
  541.             name.text,  
  542.             subject.text,  
  543.             description.text,  
  544.             t.taskData.status,  
  545.             t.priority,  
  546.             t.taskData.skipable,  
  547.             actualOwner,  
  548.             createdBy,  
  549.             t.taskData.createdOn,  
  550.             t.taskData.activationTime,  
  551.             t.taskData.expirationTime,  
  552.             t.taskData.processId,  
  553.             t.taskData.processSessionId)  
  554.             from  
  555.             Task t  
  556.             left join t.taskData.createdBy as createdBy  
  557.             left join t.taskData.actualOwner as actualOwner  
  558.             left join t.subjects as subject  
  559.             left join t.descriptions as description  
  560.             left join t.names as name,  
  561.             OrganizationalEntity taskInitiator  
  562.             where  
  563.             t.archived = 0 and  
  564.             taskInitiator.id = :userId and  
  565.             ttaskInitiator = t.peopleAssignments.taskInitiator and  
  566.   
  567.             (  
  568.             name.language = :language  
  569.             or t.names.size = 0  
  570.             ) and  
  571.   
  572.             (  
  573.             subject.language = :language  
  574.             or t.subjects.size = 0  
  575.             ) and  
  576.   
  577.             (  
  578.             description.language = :language  
  579.             or t.descriptions.size = 0  
  580.             ) and  
  581.   
  582.             t.taskData.expirationTime is null  
  583.         </query>  
  584.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  585.     </named-query>  
  586.     <named-query name="TasksAssignedAsTaskStakeholder">  
  587.         <query>  
  588.             select  
  589.             new org.jbpm.task.query.TaskSummary(  
  590.             t.id,  
  591.             t.taskData.processInstanceId,  
  592.             name.text,  
  593.             subject.text,  
  594.             description.text,  
  595.             t.taskData.status,  
  596.             t.priority,  
  597.             t.taskData.skipable,  
  598.             actualOwner,  
  599.             createdBy,  
  600.             t.taskData.createdOn,  
  601.             t.taskData.activationTime,  
  602.             t.taskData.expirationTime,  
  603.             t.taskData.processId,  
  604.             t.taskData.processSessionId)  
  605.             from  
  606.             Task t  
  607.             left join t.taskData.createdBy as createdBy  
  608.             left join t.taskData.actualOwner as actualOwner  
  609.             left join t.subjects as subject  
  610.             left join t.descriptions as description  
  611.             left join t.names as name,  
  612.             OrganizationalEntity taskStakeholder  
  613.             where  
  614.             t.archived = 0 and  
  615.             taskStakeholder.id = :userId and  
  616.             taskStakeholder in elements ( t.peopleAssignments.taskStakeholders ) and  
  617.   
  618.             (  
  619.             name.language = :language  
  620.             or t.names.size = 0  
  621.             ) and  
  622.   
  623.             (  
  624.             subject.language = :language  
  625.             or t.subjects.size = 0  
  626.             ) and  
  627.   
  628.             (  
  629.             description.language = :language  
  630.             or t.descriptions.size = 0  
  631.             ) and  
  632.   
  633.             t.taskData.expirationTime is null  
  634.         </query>  
  635.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  636.     </named-query>  
  637.     <named-query name="TasksOwned">  
  638.         <query>  
  639.             select  
  640.             new org.jbpm.task.query.TaskSummary(  
  641.             t.id,  
  642.             t.taskData.processInstanceId,  
  643.             name.text,  
  644.             subject.text,  
  645.             description.text,  
  646.             t.taskData.status,  
  647.             t.priority,  
  648.             t.taskData.skipable,  
  649.             actualOwner,  
  650.             createdBy,  
  651.             t.taskData.createdOn,  
  652.             t.taskData.activationTime,  
  653.             t.taskData.expirationTime,  
  654.             t.taskData.processId,  
  655.             t.taskData.processSessionId)  
  656.             from  
  657.             Task t  
  658.             left join t.taskData.createdBy as createdBy  
  659.             left join t.taskData.actualOwner as actualOwner  
  660.             left join t.subjects as subject  
  661.             left join t.descriptions as description  
  662.             left join t.names as name  
  663.             where  
  664.             t.archived = 0 and  
  665.             t.taskData.actualOwner.id = :userId and  
  666.   
  667.             (  
  668.             name.language = :language  
  669.             or t.names.size = 0  
  670.             ) and  
  671.   
  672.             (  
  673.             subject.language = :language  
  674.             or t.subjects.size = 0  
  675.             ) and  
  676.   
  677.             (  
  678.             description.language = :language  
  679.             or t.descriptions.size = 0  
  680.             ) and  
  681.   
  682.             t.taskData.expirationTime is null  
  683.         </query>  
  684.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  685.     </named-query>  
  686.   
  687.     <named-query name="TasksByStatus">  
  688.         <query>  
  689.             select  
  690.             new org.jbpm.task.query.TaskSummary(  
  691.             t.id,  
  692.             t.taskData.processInstanceId,  
  693.             name.text,  
  694.             subject.text,  
  695.             description.text,  
  696.             t.taskData.status,  
  697.             t.priority,  
  698.             t.taskData.skipable,  
  699.             actualOwner,  
  700.             createdBy,  
  701.             t.taskData.createdOn,  
  702.             t.taskData.activationTime,  
  703.             t.taskData.expirationTime,  
  704.             t.taskData.processId,  
  705.             t.taskData.processSessionId)  
  706.             from  
  707.             Task t  
  708.             left join t.taskData.createdBy as createdBy  
  709.             left join t.taskData.actualOwner as actualOwner  
  710.             left join t.subjects as subject  
  711.             left join t.descriptions as description  
  712.             left join t.names as name  
  713.             where  
  714.             t.archived = 0 and  
  715.             t.taskData.status = :status and  
  716.   
  717.             (  
  718.             name.language = :language  
  719.             or t.names.size = 0  
  720.             ) and  
  721.   
  722.             (  
  723.             subject.language = :language  
  724.             or t.subjects.size = 0  
  725.             ) and  
  726.   
  727.             (  
  728.             description.language = :language  
  729.             or t.descriptions.size = 0  
  730.             ) and  
  731.   
  732.             t.taskData.expirationTime is null  
  733.         </query>  
  734.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  735.     </named-query>  
  736.     <named-query name="TasksByStatusByProcessId">  
  737.         <query>  
  738.             select  
  739.             new org.jbpm.task.query.TaskSummary(  
  740.             t.id,  
  741.             t.taskData.processInstanceId,  
  742.             name.text,  
  743.             subject.text,  
  744.             description.text,  
  745.             t.taskData.status,  
  746.             t.priority,  
  747.             t.taskData.skipable,  
  748.             actualOwner,  
  749.             createdBy,  
  750.             t.taskData.createdOn,  
  751.             t.taskData.activationTime,  
  752.             t.taskData.expirationTime,  
  753.             t.taskData.processId,  
  754.             t.taskData.processSessionId)  
  755.             from  
  756.             Task t  
  757.             left join t.taskData.actualOwner as actualOwner  
  758.             left join t.taskData.createdBy as createdBy  
  759.             left join t.subjects as subject  
  760.             left join t.descriptions as description  
  761.             left join t.names as name  
  762.             where  
  763.             t.archived = 0 and  
  764.             t.taskData.processInstanceId = :processInstanceId and  
  765.             (  
  766.             name.language = :language  
  767.             or t.names.size = 0  
  768.             ) and  
  769.   
  770.             (  
  771.             subject.language = :language  
  772.             or t.subjects.size = 0  
  773.             ) and  
  774.   
  775.             (  
  776.             description.language = :language  
  777.             or t.descriptions.size = 0  
  778.             ) and  
  779.   
  780.             t.taskData.status in (:status) and  
  781.   
  782.             t.taskData.expirationTime is null  
  783.         </query>  
  784.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  785.     </named-query>  
  786.     <named-query name="TasksByStatusByProcessIdByTaskName">  
  787.         <query>  
  788.             select  
  789.             new org.jbpm.task.query.TaskSummary(  
  790.             t.id,  
  791.             t.taskData.processInstanceId,  
  792.             name.text,  
  793.             subject.text,  
  794.             description.text,  
  795.             t.taskData.status,  
  796.             t.priority,  
  797.             t.taskData.skipable,  
  798.             actualOwner,  
  799.             createdBy,  
  800.             t.taskData.createdOn,  
  801.             t.taskData.activationTime,  
  802.             t.taskData.expirationTime,  
  803.             t.taskData.processId,  
  804.             t.taskData.processSessionId)  
  805.             from  
  806.             Task t  
  807.             left join t.taskData.actualOwner as actualOwner  
  808.             left join t.taskData.createdBy as createdBy  
  809.             left join t.subjects as subject  
  810.             left join t.descriptions as description  
  811.             left join t.names as name  
  812.             where  
  813.             t.archived = 0 and  
  814.             t.taskData.processInstanceId = :processInstanceId and  
  815.             name.shortText = :taskName and  
  816.             (  
  817.             name.language = :language  
  818.             or t.names.size = 0  
  819.             ) and  
  820.   
  821.             (  
  822.             subject.language = :language  
  823.             or t.subjects.size = 0  
  824.             ) and  
  825.   
  826.             (  
  827.             description.language = :language  
  828.             or t.descriptions.size = 0  
  829.             ) and  
  830.   
  831.             t.taskData.status in (:status) and  
  832.   
  833.             t.taskData.expirationTime is null  
  834.         </query>  
  835.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  836.     </named-query>  
  837.     <named-query name="TasksByStatusSince">  
  838.         <query>  
  839.             select  
  840.             new org.jbpm.task.query.TaskSummary(  
  841.             t.id,  
  842.             t.taskData.processInstanceId,  
  843.             name.text,  
  844.             subject.text,  
  845.             description.text,  
  846.             t.taskData.status,  
  847.             t.priority,  
  848.             t.taskData.skipable,  
  849.             actualOwner,  
  850.             createdBy,  
  851.             t.taskData.createdOn,  
  852.             t.taskData.activationTime,  
  853.             t.taskData.expirationTime,  
  854.             t.taskData.processId,  
  855.             t.taskData.processSessionId)  
  856.             from  
  857.             Task t  
  858.             left join t.taskData.createdBy as createdBy  
  859.             left join t.taskData.actualOwner as actualOwner  
  860.             left join t.subjects as subject  
  861.             left join t.descriptions as description  
  862.             left join t.names as name  
  863.             where  
  864.             t.archived = 0 and  
  865.             t.taskData.status = :status and  
  866.   
  867.             (  
  868.             name.language = :language  
  869.             or t.names.size = 0  
  870.             ) and  
  871.   
  872.             (  
  873.             subject.language = :language  
  874.             or t.subjects.size = 0  
  875.             ) and  
  876.   
  877.             (  
  878.             description.language = :language  
  879.             or t.descriptions.size = 0  
  880.             ) and  
  881.   
  882.             t.taskData.expirationTime is null  
  883.   
  884.             and  
  885.   
  886.             t.taskData.activationTime &lt; :since  
  887.         </query>  
  888.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  889.     </named-query>  
  890.   
  891.     <named-query name="ArchivedTasks">  
  892.         <query>  
  893.             select  
  894.             new org.jbpm.task.query.TaskSummary(  
  895.             t.id,  
  896.             t.taskData.processInstanceId,  
  897.             name.text,  
  898.             subject.text,  
  899.             description.text,  
  900.             t.taskData.status,  
  901.             t.priority,  
  902.             t.taskData.skipable,  
  903.             actualOwner,  
  904.             createdBy,  
  905.             t.taskData.createdOn,  
  906.             t.taskData.activationTime,  
  907.             t.taskData.expirationTime,  
  908.             t.taskData.processId,  
  909.             t.taskData.processSessionId)  
  910.             from  
  911.             Task t  
  912.             left join t.taskData.createdBy as createdBy  
  913.             left join t.taskData.actualOwner as actualOwner  
  914.             left join t.subjects as subject  
  915.             left join t.descriptions as description  
  916.             left join t.names as name  
  917.             where  
  918.             t.archived = 1 and  
  919.   
  920.             (  
  921.             name.language = :language  
  922.             or t.names.size = 0  
  923.             ) and  
  924.   
  925.             (  
  926.             subject.language = :language  
  927.             or t.subjects.size = 0  
  928.             ) and  
  929.   
  930.             (  
  931.             description.language = :language  
  932.             or t.descriptions.size = 0  
  933.             ) and  
  934.   
  935.             t.taskData.expirationTime is null  
  936.         </query>  
  937.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  938.     </named-query>  
  939.   
  940.   
  941.     <named-query name="TasksOwnedWithParticularStatus">  
  942.         <query>  
  943.             select  
  944.             new org.jbpm.task.query.TaskSummary(  
  945.             t.id,  
  946.             t.taskData.processInstanceId,  
  947.             name.text,  
  948.             subject.text,  
  949.             description.text,  
  950.             t.taskData.status,  
  951.             t.priority,  
  952.             t.taskData.skipable,  
  953.             actualOwner,  
  954.             createdBy,  
  955.             t.taskData.createdOn,  
  956.             t.taskData.activationTime,  
  957.             t.taskData.expirationTime,  
  958.             t.taskData.processId,  
  959.             t.taskData.processSessionId)  
  960.             from  
  961.             Task t  
  962.             left join t.taskData.createdBy as createdBy  
  963.             left join t.taskData.actualOwner as actualOwner  
  964.             left join t.subjects as subject  
  965.             left join t.descriptions as description  
  966.             left join t.names as name  
  967.             where  
  968.             t.taskData.actualOwner.id = :userId and  
  969.   
  970.             t.taskData.status in (:status) and  
  971.   
  972.             (  
  973.             name.language = :language  
  974.             or t.names.size = 0  
  975.             ) and  
  976.   
  977.             (  
  978.             subject.language = :language  
  979.             or t.subjects.size = 0  
  980.             ) and  
  981.   
  982.             (  
  983.             description.language = :language  
  984.             or t.descriptions.size = 0  
  985.             ) and  
  986.   
  987.             t.taskData.expirationTime is null  
  988.         </query>  
  989.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  990.     </named-query>  
  991.   
  992.     <named-query name="UnescalatedDeadlines">  
  993.         <query>  
  994.             select  
  995.             new org.jbpm.task.query.DeadlineSummary(  
  996.             t.id,  
  997.             d.id,  
  998.             d.date)  
  999.             from  
  1000.             Task t,  
  1001.             Deadline d  
  1002.             where  
  1003.             t.archived = 0 and  
  1004.             (d in elements( t.deadlines.startDeadlines ) or d in elements(  
  1005.             t.deadlines.endDeadlines ) ) and  
  1006.             d.escalated = 0  
  1007.             order by  
  1008.             d.date  
  1009.         </query>  
  1010.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  1011.     </named-query>  
  1012.     <named-query name="TaskByWorkItemId">  
  1013.         <query>  
  1014.             select  
  1015.             t  
  1016.             from  
  1017.             Task t  
  1018.             where  
  1019.             t.archived = 0 and  
  1020.             t.taskData.workItemId = :workItemId  
  1021.         </query>  
  1022.         <!-- hint name="org.hibernate.timeout" value="200"/ -->  
  1023.     </named-query>  
  1024. </entity-mappings>  



src/main/resources/META-INF/persistence.xml 
----------------------------------- 
Xml代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <persistence version="1.0"  
  3.     xmlns="http://java.sun.com/xml/ns/persistence"   
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5.     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence  
  6.     http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">  
  7.     <persistence-unit name="org.jbpm.persistence.local"  
  8.         transaction-type="RESOURCE_LOCAL">  
  9.         <provider>org.hibernate.ejb.HibernatePersistence</provider>  
  10.         <!-- <non-jta-data-source>jdbc/jbpm-ds</non-jta-data-source> -->  
  11.         <!-- Use this if you are using JPA1 / Hibernate3 -->  
  12.         <!-- <mapping-file>META-INF/JBPMorm.xml</mapping-file> -->  
  13.         <!-- <mapping-file>META-INF/Taskorm.xml</mapping-file> -->  
  14.         <!-- Use this if you are using JPA2 / Hibernate4 -->   
  15.         <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>  
  16.         <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>  
  17.         <mapping-file>META-INF/Taskorm.xml</mapping-file>  
  18.           
  19.         <class>org.jbpm.task.Attachment</class>  
  20.         <class>org.jbpm.task.Content</class>  
  21.         <class>org.jbpm.task.BooleanExpression</class>  
  22.         <class>org.jbpm.task.Comment</class>  
  23.         <class>org.jbpm.task.Deadline</class>  
  24.         <class>org.jbpm.task.Comment</class>  
  25.         <class>org.jbpm.task.Deadline</class>  
  26.         <class>org.jbpm.task.Delegation</class>  
  27.         <class>org.jbpm.task.Escalation</class>  
  28.         <class>org.jbpm.task.Group</class>  
  29.         <class>org.jbpm.task.I18NText</class>  
  30.         <class>org.jbpm.task.Notification</class>  
  31.         <class>org.jbpm.task.EmailNotification</class>  
  32.         <class>org.jbpm.task.EmailNotificationHeader</class>  
  33.         <class>org.jbpm.task.PeopleAssignments</class>  
  34.         <class>org.jbpm.task.Reassignment</class>  
  35.         <class>org.jbpm.task.Status</class>  
  36.         <class>org.jbpm.task.Task</class>  
  37.         <class>org.jbpm.task.TaskData</class>  
  38.         <class>org.jbpm.task.SubTasksStrategy</class>  
  39.         <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>  
  40.         <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>  
  41.         <class>org.jbpm.task.User</class>  
  42.           
  43.         <class>org.drools.persistence.info.SessionInfo</class>  
  44.         <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>  
  45.         <class>org.drools.persistence.info.WorkItemInfo</class>  
  46.         <class>org.jbpm.process.audit.ProcessInstanceLog</class>  
  47.         <class>org.jbpm.process.audit.NodeInstanceLog</class>  
  48.         <class>org.jbpm.process.audit.VariableInstanceLog</class>  
  49.         <properties>  
  50.             <property name="hibernate.max_fetch_depth" value="3" />  
  51.             <property name="hibernate.hbm2ddl.auto" value="update" />  
  52.             <property name="hibernate.show_sql" value="false" />  
  53.             <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />  
  54.             <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>  
  55.             <property name="hibernate.cache.use_query_cache" value="true"/>  
  56.             <property name="hibernate.cache.use_second_level_cache" value="true"/>  
  57.             <property name="hibernate.generate_statistics" value="true"/>  
  58.             <property name="hibernate.use_sql_comments" value="true"/>  
  59.             <property name="hibernate.generate_statistics" value="true"/>  
  60.         </properties>  
  61.     </persistence-unit>  
  62. </persistence>  


src/main/java/com/gds/jbpm/JBPMUserGroupCallback.java 
----------------------------------- 
Java代码  收藏代码
  1. package com.gds.jbpm;  
  2.   
  3. import java.util.ArrayList;  
  4. import java.util.List;  
  5.   
  6. import org.jbpm.task.identity.UserGroupCallback;  
  7.   
  8. public class JBPMUserGroupCallback implements UserGroupCallback {  
  9.   
  10.     @Override  
  11.     public boolean existsGroup(String groupId) {  
  12.         return true;  
  13.     }  
  14.   
  15.     @Override  
  16.     public boolean existsUser(String userId) {  
  17.         return true;  
  18.     }  
  19.   
  20.     @Override  
  21.     public List<String> getGroupsForUser(String userId, List<String> groupIds,  
  22.             List<String> allExistingGroupIds) {  
  23.         if (groupIds != null) {  
  24.   
  25.             List<String> retList = new ArrayList<String>(groupIds);  
  26.   
  27.             // merge all groups  
  28.   
  29.             if (allExistingGroupIds != null) {  
  30.   
  31.                 for (String grp : allExistingGroupIds) {  
  32.   
  33.                     if (!retList.contains(grp)) {  
  34.   
  35.                         retList.add(grp);  
  36.   
  37.                     }  
  38.   
  39.                 }  
  40.   
  41.             }  
  42.   
  43.             return retList;  
  44.   
  45.         } else {  
  46.             //  
  47.             // return empty list by default  
  48.             // please note: there are different return value for different  
  49.             // version of jPBM  
  50.             // List<String> retList = new ArrayList<String>();  
  51.   
  52.             // retList.add("user");  
  53.             // return retList;  
  54.             // return new ArrayList<String>(); //for jBPM5.3.0.Final  
  55.             return null// for jBPM5.4.0.CR1  
  56.   
  57.         }  
  58.   
  59.     }  
  60.   
  61. }  


src/main/java/com/gds/jbpm/MyLocalTaskService.java 
----------------------------------- 
Java代码  收藏代码
  1. package com.gds.jbpm;  
  2.   
  3. import javax.annotation.PostConstruct;  
  4.   
  5. import org.drools.runtime.StatefulKnowledgeSession;  
  6. import org.jbpm.task.service.local.LocalTaskService;  
  7.   
  8. /** 
  9.  * 提供这个类,是为了设定jbpm.usergroup.callback, 
  10.  * 但是如何注解呢? 
  11.  * @author pandy 
  12.  * 
  13.  */  
  14. public class MyLocalTaskService {  
  15.     private StatefulKnowledgeSession ksession;  
  16.     private LocalTaskService localTaskService;  
  17.   
  18.     @PostConstruct  
  19.     public void init() {  
  20.         // set user group callback  
  21.         System.setProperty("jbpm.usergroup.callback""com.gds.jbpm.JBPMUserGroupCallback");  
  22.     }  
  23.   
  24.     public StatefulKnowledgeSession getKsession() {  
  25.         return ksession;  
  26.     }  
  27.   
  28.     public void setKsession(StatefulKnowledgeSession ksession) {  
  29.         this.ksession = ksession;  
  30.     }  
  31.   
  32.     public org.jbpm.task.service.local.LocalTaskService getLocalTaskService() {  
  33.         return localTaskService;  
  34.     }  
  35.   
  36.     public void setLocalTaskService(  
  37.             org.jbpm.task.service.local.LocalTaskService localTaskService) {  
  38.         this.localTaskService = localTaskService;  
  39.     }  
  40.   
  41. }  



src/main/java/com/gds/web/OrderController.java 
----------------------------------- 
Java代码  收藏代码
  1. package com.gds.web;  
  2.   
  3. import static org.springframework.web.bind.annotation.RequestMethod.GET;  
  4. import static org.springframework.web.bind.annotation.RequestMethod.POST;  
  5. import static org.springframework.web.bind.annotation.RequestMethod.PUT;  
  6.   
  7. import java.io.ByteArrayOutputStream;  
  8. import java.io.IOException;  
  9. import java.io.ObjectOutputStream;  
  10. import java.util.HashMap;  
  11. import java.util.Iterator;  
  12. import java.util.List;  
  13. import java.util.Map;  
  14.   
  15. import javax.annotation.Resource;  
  16.   
  17. import org.apache.log4j.Logger;  
  18. import org.drools.command.Context;  
  19. import org.drools.command.impl.GenericCommand;  
  20. import org.drools.command.impl.KnowledgeCommandContext;  
  21. import org.drools.runtime.StatefulKnowledgeSession;  
  22. import org.drools.runtime.process.WorkflowProcessInstance;  
  23. import org.jbpm.process.core.context.variable.VariableScope;  
  24. import org.jbpm.process.instance.context.variable.VariableScopeInstance;  
  25. import org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler;  
  26. import org.jbpm.task.Task;  
  27. import org.jbpm.task.TaskData;  
  28. import org.jbpm.task.TaskService;  
  29. import org.jbpm.task.query.TaskSummary;  
  30. import org.jbpm.task.service.ContentData;  
  31. import org.jbpm.task.utils.ContentMarshallerHelper;  
  32. import org.springframework.beans.factory.annotation.Qualifier;  
  33. import org.springframework.stereotype.Controller;  
  34. import org.springframework.ui.Model;  
  35. import org.springframework.web.bind.annotation.ModelAttribute;  
  36. import org.springframework.web.bind.annotation.PathVariable;  
  37. import org.springframework.web.bind.annotation.RequestMapping;  
  38.   
  39. import com.gds.jbpm.MyLocalTaskService;  
  40. import com.gds.jbpm.Order;  
  41.   
  42. @Controller  
  43. public class OrderController {  
  44.   
  45.     private Logger log = Logger.getLogger(this.getClass());  
  46.   
  47.     @Resource  
  48.     @Qualifier("myLocalTaskService")  
  49.     private MyLocalTaskService myLocalTaskService;  
  50.     @Resource  
  51.     @Qualifier("ksession")  
  52.     private StatefulKnowledgeSession ksession;  
  53.   
  54.     @RequestMapping("/")  
  55.     public String test() {  
  56.         log.info("this is the index");  
  57.         return "index";  
  58.     }  
  59.   
  60.     @RequestMapping(value = "{user}/create", method = GET)  
  61.     public String create(@PathVariable("user") String user) {  
  62.         // log.info(user + " prepare to create");  
  63.         System.out.println("用户[" + user + "]进入创建界面,准备创建流程。");  
  64.         return "create";  
  65.     }  
  66.   
  67.     @RequestMapping(value = "{user}/create", method = { POST, PUT })  
  68.     public String doCreate(@PathVariable("user") String user, Model model) {  
  69.         // log.info(user + " create an order");  
  70.         System.out.println("用户[" + user + "]提交了流程单据");  
  71.   
  72.         ksession = myLocalTaskService.getKsession();  
  73.         LocalHTWorkItemHandler humanTaskHandler = new LocalHTWorkItemHandler(  
  74.                 myLocalTaskService.getLocalTaskService(), ksession);  
  75.         humanTaskHandler.setLocal(true);  
  76.         humanTaskHandler.connect();  
  77.         ksession.getWorkItemManager().registerWorkItemHandler("Human Task",  
  78.                 humanTaskHandler);  
  79.   
  80.         Map<String, Object> params = new HashMap<String, Object>();  
  81.         params.put("priority""High");  
  82.         params.put("modelNumber""179");  
  83.         params.put("quantity""100");  
  84.         System.out.println("用户[" + user + "]赋初始值,并准备启动流程.......");  
  85.         ksession.startProcess("com.gds.jbpm.sample", params);  
  86.         ksession.fireAllRules();  
  87.         System.out.println("用户[" + user + "]创建流程,等待处理......");  
  88.         model.addAttribute("message""process created!");  
  89.         System.out  
  90.                 .println("---------------------------------------------------单据提交完成:"  
  91.                         + user);  
  92.         return "create";  
  93.     }  
  94.   
  95.     @RequestMapping("{user}/list")  
  96.     public String list(@PathVariable("user") String user, Model model) {  
  97.         // log.info(user + " list his tasks");  
  98.         System.out.println("用户[" + user + "]读取任务列表.");  
  99.   
  100.         TaskService taskService = myLocalTaskService.getLocalTaskService();  
  101.         List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner(  
  102.                 user, "en-UK");  
  103.   
  104.         log.info("\n***Task size::" + tasks.size() + "***\n");  
  105.         for (TaskSummary taskSummary : tasks) {  
  106.             log.info(taskSummary.getId() + " :: "  
  107.                     + taskSummary.getActualOwner());  
  108.         }  
  109.   
  110.         model.addAttribute("tasks", tasks);  
  111.         model.addAttribute("tasksCount", tasks.size());  
  112.         model.addAttribute("user", user);  
  113.         System.out  
  114.                 .println("---------------------------------------------------列表读取完成:"  
  115.                         + user);  
  116.         return "list";  
  117.     }  
  118.   
  119.     @RequestMapping(value = "{user}/work/{task}", method = GET)  
  120.     public String work(@PathVariable("user") String user,  
  121.             @PathVariable("task"long taskId, Model model) {  
  122.         // log.info(user + " prepare to work on task " + taskId);  
  123.         System.out.println("用户[" + user + "]读取任务以便处理,任务ID=" + taskId);  
  124.   
  125.         StatefulKnowledgeSession ksession = myLocalTaskService.getKsession();  
  126.         TaskService taskService = myLocalTaskService.getLocalTaskService();  
  127.   
  128.         Task task = taskService.getTask(taskId);  
  129.         TaskData taskData = task.getTaskData();  
  130.         WorkflowProcessInstance process = (WorkflowProcessInstance) ksession  
  131.                 .getProcessInstance(taskData.getProcessInstanceId());  
  132.   
  133.         model.addAttribute("taskData", taskData);  
  134.         model.addAttribute("order"new Order(user, taskId, process));  
  135.         System.out  
  136.                 .println("---------------------------------------------------任务读取完成:"  
  137.                         + user);  
  138.         return "work";  
  139.     }  
  140.   
  141.     @RequestMapping(value = "{user}/work/{task}", method = { POST, PUT })  
  142.     public String doWork(@ModelAttribute Order order) {  
  143.         System.out.println("处理任务信息:" + order.toString());  
  144.         String user = order.getUser();  
  145.         long taskId = order.getTaskId();  
  146.         log.info(user + " complete work on task " + taskId);  
  147.   
  148.         TaskService taskService = myLocalTaskService.getLocalTaskService();  
  149.         System.out.println("用户[" + user + "]启动人工任务, taskId=" + taskId);  
  150.         taskService.start(taskId, user);  
  151.   
  152.         Map<String, Object> data = new HashMap<String, Object>();  
  153.         data.put("priority", order.getPriority());  
  154.         data.put("modelNumber", order.getModelNumber());  
  155.         data.put("quantity", order.getQuantity());  
  156.   
  157.         // setProcessVariables(taskId, data);  
  158.   
  159.         ContentData contentData = null;  
  160.         if (data != null) {  
  161.             ByteArrayOutputStream bos = new ByteArrayOutputStream();  
  162.             ObjectOutputStream outs;  
  163.             try {  
  164.                 outs = new ObjectOutputStream(bos);  
  165.                 outs.writeObject(data);  
  166.                 outs.close();  
  167.                 contentData = new ContentData();  
  168.                 //contentData.setContent(bos.toByteArray());  
  169.                 //contentData.setAccessType(AccessType.Inline);  
  170.   
  171.                 contentData = ContentMarshallerHelper.marshal(data, null);  
  172.                 //contentData.setAccessType(AccessType.Inline);  
  173.   
  174.             } catch (IOException e) {  
  175.                 e.printStackTrace();  
  176.             }  
  177.         }  
  178.   
  179.         System.out.println("参数:"+data.toString());  
  180.         //taskService.complete(taskId, user, contentData);  
  181.         taskService.completeWithResults(taskId, user, data);  
  182.         // ksession.fireAllRules();  
  183.         // ksession.getWorkItemManager().completeWorkItem(taskService.getTask(taskId).getTaskData().getWorkItemId(),  
  184.         // data);  
  185.         System.out.println("用户[" + user + "]完成人工任务");  
  186.         System.out  
  187.                 .println("---------------------------------------------------处理任务完成:"  
  188.                         + user);  
  189.   
  190.         return "redirect:/" + user + "/list";  
  191.     }  
  192.   
  193.     public void setProcessVariables(final long intProcessInstId,  
  194.             final Map<String, Object> hshVariableMap) {  
  195.         try {  
  196.             ksession.execute(new GenericCommand<Map<String, Object>>() {  
  197.                 public Map<String, Object> execute(Context objContext) {  
  198.                     StatefulKnowledgeSession objKSession = ((KnowledgeCommandContext) objContext)  
  199.                             .getStatefulKnowledgesession();  
  200.                     org.jbpm.process.instance.ProcessInstance objProcessInstance = (org.jbpm.process.instance.ProcessInstance) objKSession  
  201.                             .getProcessInstance(intProcessInstId);  
  202.                     VariableScopeInstance objVariableScope = (VariableScopeInstance) objProcessInstance  
  203.                             .getContextInstance(VariableScope.VARIABLE_SCOPE);  
  204.                     Iterator<Map.Entry<String, Object>> objIterator = hshVariableMap  
  205.                             .entrySet().iterator();  
  206.                     while (objIterator.hasNext()) {  
  207.                         Map.Entry<String, Object> objPairs = (Map.Entry<String, Object>) objIterator  
  208.                                 .next();  
  209.                         objVariableScope.setVariable(objPairs.getKey(),  
  210.                                 objPairs.getValue());  
  211.                     }  
  212.                     return null;  
  213.                 }  
  214.             });  
  215.         } catch (Exception e) {  
  216.             e.printStackTrace();  
  217.         }  
  218.     }  
  219. }  



src/main/resources/applicationContext.xml 
----------------------------------- 
Xml代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
  4.     xmlns:context="http://www.springframework.org/schema/context"  
  5.     xmlns:tx="http://www.springframework.org/schema/tx"   
  6.     xmlns:p="http://www.springframework.org/schema/p"  
  7.     xmlns:drools="http://drools.org/schema/drools-spring"  
  8.     xsi:schemaLocation="http://www.springframework.org/schema/beans   
  9.     http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  
  10.     http://www.springframework.org/schema/tx     
  11.     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd   
  12.     http://www.springframework.org/schema/context     
  13.    http://www.springframework.org/schema/context/spring-context-3.0.xsd  
  14.     http://drools.org/schema/drools-spring   
  15.     http://drools.org/schema/drools-spring-1.3.0.xsd">  
  16.   
  17.     <context:component-scan base-package="com">  
  18.         <context:exclude-filter expression="org.springframework.stereotype.Controller"  
  19.             type="annotation" />  
  20.     </context:component-scan>  
  21.     <bean  
  22.         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
  23.         <property name="locations">  
  24.             <value>classpath:jdbc.properties</value>  
  25.         </property>  
  26.     </bean>  
  27.   
  28.     <!-- Spring + Hibernate -->  
  29.     <bean id="dataSource"  
  30.         class="org.springframework.jdbc.datasource.DriverManagerDataSource">  
  31.         <property name="driverClassName" value="${jdbc.driver}" />  
  32.         <property name="url" value="${jdbc.url}" />  
  33.         <property name="username" value="${jdbc.username}" />  
  34.         <property name="password" value="${jdbc.password}" />  
  35.     </bean>  
  36.     <bean id="sessionFactory"  
  37.         class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"  
  38.         p:packagesToScan="com.pandy.ssh4.domian">  
  39.         <property name="dataSource">  
  40.             <ref bean="dataSource" />  
  41.         </property>  
  42.         <property name="hibernateProperties">  
  43.             <props>  
  44.                 <prop key="hibernate.dialect">  
  45.                     ${hibernate.dialect}  
  46.                 </prop>  
  47.                 <prop key="hibernate.show_sql">false</prop>  
  48.                 <prop key="hibernate.format_sql">false</prop>  
  49.                 <prop key="hibernate.cache.use_query_cache">true</prop>  
  50.                 <prop key="hibernate.cache.use_second_level_cache">true</prop>  
  51.                 <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory  
  52.                 </prop>  
  53.                 <prop key="hibernate.cache.use_structured_entries">true</prop>  
  54.                 <prop key="hibernate.generate_statistics">true</prop>  
  55.             </props>  
  56.         </property>  
  57.     </bean>  
  58.     <bean id="transactionManager"  
  59.         class="org.springframework.orm.hibernate4.HibernateTransactionManager">  
  60.         <property name="sessionFactory">  
  61.             <ref local="sessionFactory" />  
  62.         </property>  
  63.     </bean>  
  64.     <tx:annotation-driven transaction-manager="transactionManager"  
  65.         proxy-target-class="true" />  
  66.   
  67.   
  68.     <!-- JBPM 5.4 -->  
  69.     <bean id="xDataSource"  
  70.         class="org.springframework.jdbc.datasource.DriverManagerDataSource">  
  71.         <property name="driverClassName" value="com.mysql.jdbc.Driver" />  
  72.         <property name="url"  
  73.             value="jdbc:mysql://127.0.0.1:3306/jbpmtest?characterEncoding=UTF-8" />  
  74.         <property name="username" value="root" />  
  75.         <property name="password" value="root" />  
  76.     </bean>  
  77.     <bean id="jbpmEntityManagerFactory"  
  78.         class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">  
  79.         <property name="dataSource" ref="xDataSource" />  
  80.         <property name="persistenceUnitName" value="org.jbpm.persistence.local" />  
  81.     </bean>  
  82.     <bean id="jbpmTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">  
  83.         <property name="entityManagerFactory" ref="jbpmEntityManagerFactory" />  
  84.         <!-- 这里要是为false的话,提交事物的时候,容易报错 -->  
  85.         <property name="nestedTransactionAllowed" value="true" />  
  86.     </bean>  
  87.       
  88.     <drools:grid-node id="node1" />  
  89.     <drools:kstore id="kstore1" />  
  90.     <drools:kbase id="kbase" node="node1">  
  91.         <drools:resources>  
  92.             <drools:resource type="BPMN2" source="classpath:Sample.bpmn" />  
  93.         </drools:resources>  
  94.     </drools:kbase>  
  95.     <drools:ksession id="ksession" type="stateful" kbase="kbase" node="node1">  
  96.         <drools:configuration>  
  97.             <drools:jpa-persistence>  
  98.                 <drools:transaction-manager ref="jbpmTxManager" />  
  99.                 <drools:entity-manager-factory ref="jbpmEntityManagerFactory" />  
  100.             </drools:jpa-persistence>  
  101.         </drools:configuration>  
  102.     </drools:ksession>  
  103.       
  104.     <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory"  
  105.         factory-method="getSystemEventListener" />  
  106.     <bean id="internalTaskService" class="org.jbpm.task.service.TaskService">  
  107.         <property name="systemEventListener" ref="systemEventListener" />  
  108.     </bean>  
  109.     <bean id="htTxManager"  
  110.         class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager">  
  111.         <constructor-arg ref="jbpmTxManager" />  
  112.     </bean>  
  113.     <bean id="springTaskSessionFactory"  
  114.         class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl"  
  115.         init-method="initialize" depends-on="internalTaskService">  
  116.         <property name="entityManagerFactory" ref="jbpmEntityManagerFactory" />  
  117.         <property name="transactionManager" ref="htTxManager" />  
  118.         <property name="useJTA" value="true" />  
  119.         <property name="taskService" ref="internalTaskService" />  
  120.     </bean>  
  121.     <bean id="taskService" class="org.jbpm.task.service.local.LocalTaskService"  
  122.         depends-on="internalTaskService">  
  123.         <constructor-arg ref="internalTaskService" />  
  124.     </bean>  
  125.     <bean id="myLocalTaskService" class="com.gds.jbpm.MyLocalTaskService">  
  126.         <property name="ksession" ref="ksession" />  
  127.         <property name="localTaskService" ref="taskService" />  
  128.     </bean>  
  129.       
  130. </beans>  

相关文章推荐

spring+hibernate+jbpm整合成功

最后的配置结果是:   hibernate.cfg.xml、jbpm.cfg.xml在关联spring后保持不变,只需要更改spirng的配置文件就好了。 xml version="1.0" enco...

Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8 整合例子(附完整的请假流程例子)。

Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8 整合例子(附完整的请假流程例子)。 1.       jbpm4.4 测试环境搭建 2.   ...

Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8整合例子(附完整的请假流程例子,jbpm基础,常见问题解决)

Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8整合例子(附完整的请假流程例子)。1.       jbpm4.4测试环境搭建2.       Jbpm...
  • centre10
  • centre10
  • 2011年04月25日 11:25
  • 16731

jbpm4整合struts2+spring2.5+hibernate3.3入门实例教程

jbpm4整合struts2+spring2.5+hibernate3.3入门实例教程,代码下载地址:http://www.zuidaima.com/share/1751866898320384.ht...

JBPM5.4 工作流例子

  • 2014年07月22日 16:44
  • 278KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Spring3.1 + Hibernate4.2.1 + JBPM5.4 + Ehache整合例子
举报原因:
原因补充:

(最多只允许输入30个字)