有没有办法将Activiti BPM与Web应用程序集成

时间:2014-07-21 13:12:23

标签: activiti workflow-activity

我是Activiti BPM的新手。我只是想用使用maven依赖的activiti BPM实现web应用程序。如何做到。

2 个答案:

答案 0 :(得分:1)

也许您应该提供更多详细信息以解决您的问题。我用配置构建了一个测试演示。希望它有所帮助。 A configuration demo

编辑:我在这里解析Spring applicationContext.xml。修复此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"
  xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">

  <context:property-placeholder location="classpath:jdbc.properties" />

  <tx:annotation-driven transaction-manager="transactionManager" />

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverClass}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
  </bean>

  <bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
  </bean>

  <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mapperLocations" value="classpath*:com/java/actdemo/domain/entity/*.xml" />
    <property name="typeAliasesPackage" value="com.java.actdemo.domain.entity" />
  </bean>

  <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
    <constructor-arg index="0" ref="sqlSessionFactory" />
  </bean>

  <!-- Configurations for the Activiti process engine. -->
  <!-- A base configuration bean. Manage third-party plugins and Activiti functions. -->
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="databaseSchemaUpdate" value="true" />

    <!-- A switch for all timer related functions -->
    <property name="jobExecutorActivate" value="true" />

    <!-- This property affects the auto-deployment function. -->
    <property name="deploymentResources"
      value="classpath*:/com/java/actdemo/domain/entity/bpmn/*.bpmn" />
    <property name="createDiagramOnDeploy" value="false" />
  </bean>

  <!-- Factory bean for building all services. This is the fundamental entry for 
    all users if Spring is not used. -->
  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>

  <!-- Activiti Beans for handling processes. -->
  <!-- The basic service for BPMN diagrams. Handle all deployment related function. 
    Mainly operate Deployment and ProcessDefinition. -->
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />

  <!-- The basic service for managing processes. Use this service to perform Start, 
    Stop, Update functions for any running process. Events and messages handling are 
    all here. Mainly operate Activity, ProcessInstance, and Execution. -->
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />

  <!-- The basic service for managing user tasks. Manage how Tasks work, including 
    claiming, completing, unclaiming, etc. Mainly operate Task. -->
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />

  <!-- The service for querying historic data(related to history level). Mainly operate 
    HistoricVariableInstance, HistoricProcessInstance, etc. -->
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />

  <!-- The service for managing timer related jobs and customized functions. Admin 
    functions and querying are here. Mainly operate Job. -->
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />

  <!-- Manage Activiti authority functions. Use this service to build user-group 
    relations. Mainly operate User, Group, Membership -->
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />

  <!-- This service operate form related functions like setting form variables, starting 
    processes with form data, completing tasks with form, etc. -->
  <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
</beans>

这是基本依赖项。我使用Junit,Jackson,Spring-test和Mysql。你可以删除它们:

  <repositories>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>Alfresco Maven Repository</id>
      <url>https://maven.alfresco.com/nexus/content/groups/public/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-engine</artifactId>
      <version>5.15.1</version>
    </dependency>
    <dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-spring</artifactId>
      <version>5.15.1</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>3.2.7.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>3.2.7.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>3.2.7.RELEASE</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>3.2.7.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.2.5</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>1.2.2</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.7</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.7</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.16</version>
    </dependency>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.4</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.30</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>3.2.7.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.3.3</version>
    </dependency>
  </dependencies>

答案 1 :(得分:0)

通过将Activiti BPM公开为webservices,您可以将Activiti BPM与任何任何Web技术集成。你必须知道activiti BPM api才能玩它。