jeecg + activiti 流程设计器

原创 2018年04月17日 10:10:22

jeecg 3.4.3 + activiti 5.18.0


activiti 流程设计器 示例 源码

https://download.csdn.net/download/anysun7/10354206


项目pom文件添加activiti依赖:

<dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-engine</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-spring</artifactId>

            <version>${activiti.version}</version>

            <exclusions>

                <exclusion>

                    <artifactId>commons-dbcp</artifactId>

                    <groupId>commons-dbcp</groupId>

                </exclusion>

            </exclusions>

        </dependency>

 

        <dependency>

            <groupId>commons-dbcp</groupId>

            <artifactId>commons-dbcp</artifactId>

            <version>1.4</version>

        </dependency>

 

        <dependency>

            <groupId>org.mybatis</groupId>

            <artifactId>mybatis</artifactId>

            <version>3.2.5</version>

        </dependency>

 

        <!--<dependency>

            <groupId>javax.activation</groupId>

            <artifactId>activation</artifactId>

            <version>1.1</version>

        </dependency>-->

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-bpmn-model</artifactId>

            <version>${activiti.version}</version>

        </dependency>

        <dependency>

           <groupId>org.activiti</groupId>

           <artifactId>activiti-bpmn-converter</artifactId>

           <version>${activiti.version}</version>

       </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-bpmn-layout</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-common-rest</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-crystalball</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-diagram-rest</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-explorer</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-image-generator</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-json-converter</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-modeler</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-simple-workflow</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.vaadin.addons</groupId>

            <artifactId>dcharts-widget</artifactId>

            <version>0.10.0</version>

        </dependency>

 

        <dependency>

            <groupId>org.activiti</groupId>

            <artifactId>activiti-process-validation</artifactId>

            <version>${activiti.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>xmlgraphics-commons</artifactId>

            <version>1.2</version>

        </dependency>

 

        <dependency>

            <groupId>com.vaadin</groupId>

            <artifactId>vaadin</artifactId>

            <version>6.8.8</version>

        </dependency>

 

        <dependency>

            <groupId>org.imgscalr</groupId>

            <artifactId>imgscalr-lib</artifactId>

            <version>4.2</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.geronimo.specs</groupId>

            <artifactId>geronimo-servlet_3.0_spec</artifactId>

            <version>1.0</version>

            <scope>provided</scope>

        </dependency>

 

        <!--<dependency>

            <groupId>javax</groupId>

            <artifactId>javaee-api</artifactId>

            <version>7.0</version>

        </dependency>-->

 

        <dependency>

            <groupId>joda-time</groupId>

            <artifactId>joda-time</artifactId>

            <version>2.1</version>

        </dependency>

 

        <!--Batik的包主要是用来解析html中的svg的内容-->

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-transcoder</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-dom</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-bridge</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-css</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-anim</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-codec</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-ext</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-gvt</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-script</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-js</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-parser</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-svg-dom</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-svggen</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-util</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-xml</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-js</artifactId>

            <version>1.7</version>

        </dependency>

 

        <dependency>

            <groupId>xml-apis</groupId>

            <artifactId>xml-apis-ext</artifactId>

            <version>1.3.04</version>

        </dependency>

 

        <dependency>

            <groupId>xml-apis</groupId>

            <artifactId>xml-apis</artifactId>

            <version>1.3.04</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>xmlgraphics-commons</artifactId>

            <version>1.2</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.xmlgraphics</groupId>

            <artifactId>batik-awt-util</artifactId>

            <version>1.7</version>

        </dependency>

 

配置spring-activiti.xml文件

src/main/resources目录下新建spring-activiti.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"

       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

        <property name="dataSource" ref="dataSource" />

        <property name="transactionManager" ref="transactionManager" />

        <property name="databaseSchemaUpdate" value="true" />

        <property name="jobExecutorActivate" value="false" />

    </bean>

    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">

        <property name="processEngineConfiguration" ref="processEngineConfiguration" />

    </bean>

    <bean id="repositoryService" factory-bean="processEngine"

          factory-method="getRepositoryService" />

    <bean id="runtimeService" factory-bean="processEngine"

          factory-method="getRuntimeService" />

    <bean id="taskService" factory-bean="processEngine"

          factory-method="getTaskService" />

    <bean id="historyService" factory-bean="processEngine"

          factory-method="getHistoryService" />

    <bean id="managementService" factory-bean="processEngine"

          factory-method="getManagementService" />

    <bean id="identityService" factory-bean="processEngine"

          factory-method="getIdentityService" />

    <bean id="transactionManager"

          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

        <property name="dataSource" ref="dataSource" />

    </bean>

</beans>

 

web.xml文件,修改context-param添加了classpath:spring-activiti.xml

 

复制设计器文件

下载activiti-webapp-explorer2的源代码,

1. activiti-explorer工程中的diagram-viewereditor-appmodeler.html复制到工程的src/main/webapp目录下

 

2. activiti-explorer工程中WEB-INF/classes文件下的stencilset.jsonui.propertiesui.properties.alfresco复制到工程的src/main/resources目录下

 

3.modules/目录中找到org\activiti\rest\diagramorg\activiti\rest\editor这两个包,将他们整个复制到工程的src/main/java目录下

 

4.修改spring-mvc.xml文件,在其中加入以下内容,使spring在扫描controller类的时候,也扫描这些包里面的类

 

5.向工程的web.xml文件中添加以下内容,让spring也管理起来带/service/的链接

<!-- activiti -->

    <servlet-mapping>

        <servlet-name>springMvc</servlet-name>

        <url-pattern>/service/*</url-pattern>

    </servlet-mapping>

 

6.打开editor-app/app-cfg.js, 将其中的activiti-explorer”修改为“jeecg”。当然,具体项目中这里可能会经常变化,我们可以写一个js函数来自动获取工程的名字,这样以后将设计器集成到其他工程的时候,就不需要修改这里的内容了

 

7.工程的src\main\java\org\activiti\rest\editor目录下新建一个java文件,命名为ModuleController

package org.activiti.rest.editor;

 

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import org.activiti.editor.constants.ModelDataJsonConstants;

import org.activiti.engine.RepositoryService;

import org.activiti.engine.repository.Model;

import org.apache.commons.lang3.StringUtils;

import org.jeecgframework.core.common.controller.BaseController;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;

 

import com.fasterxml.jackson.databind.ObjectMapper;

import com.fasterxml.jackson.databind.node.ObjectNode;

 

@Controller

@RequestMapping("/model")

public class ModuleController extends BaseController{

private Logger logger = LoggerFactory.getLogger(ModuleController.class);

@Autowired

private RepositoryService repositoryService;

@RequestMapping(params = "create")

  public void create(HttpServletRequest request, HttpServletResponse response) {

    try {

          String name = "test";

          String key = "test";

          String description = "testModel";

 

          ObjectMapper objectMapper = new ObjectMapper();

      ObjectNode editorNode = objectMapper.createObjectNode();

      editorNode.put("id", "canvas");

      editorNode.put("resourceId", "canvas");

      ObjectNode stencilSetNode = objectMapper.createObjectNode();

      stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");

      editorNode.put("stencilset", stencilSetNode);

      Model modelData = repositoryService.newModel();

 

      ObjectNode modelObjectNode = objectMapper.createObjectNode();

      modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);

      modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);

      description = StringUtils.defaultString(description);

      modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);

      modelData.setMetaInfo(modelObjectNode.toString());

      modelData.setName(name);

      modelData.setKey(StringUtils.defaultString(key));

 

      repositoryService.saveModel(modelData);

      repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));

 

      response.sendRedirect(request.getContextPath() + "/modeler.html?modelId=" + modelData.getId());

    } catch (Exception e) {

      logger.error("创建模型失败:", e);

    }

  }

}

 

8. 访问:http://localhost:8080/jeecg/model.do?create

 

 

注:

新版(3.7.2jeecgresponse的处理,添加了org.jeecgframework.core.aop.Wrapper,导致json数据返回解析出错。整合时,需处理。

Jeecg修改pom内容

Maven版本改为 5.18.0

添加:

<dependency> 

<groupId>com.fasterxml.jackson.core</groupId> 

<artifactId>jackson-databind</artifactId> 

<version>2.2.3</version> 

</dependency>

Springmvc添加 (rest请求数据 /jeecg/service/model/5001/json

<mvc:annotation-driven />


中途bug:

TypeError: Cannot read property 'split' of undefined

    at Object.ORYX.Core.StencilSet.stencilSet (oryx.debug.js:8647)
    at oryx.debug.js:8625
    at prototype-1.5.1.js:446
    at Array._each (prototype-1.5.1.js:672)
    at Array.each (prototype-1.5.1.js:445)
    at Object.ORYX.Core.StencilSet.stencilSets (oryx.debug.js:8624)
    at classDef.getStencilSets (oryx.debug.js:11715)
    at classDef._createCanvas (oryx.debug.js:11201)
    at classDef.construct (oryx.debug.js:10930)
    at new classDef (oryx.debug.js:1747)

解决思路:遇到该错误,主要原因是后台返回json数据时,格式存在问题,请查看response中最终返回到页面之前的数据。查看是否是框架对数据做了处理,寻找相应解决方法。






另转:

activiti-modeler 工作流设计器代码分析

https://blog.csdn.net/fgstudent/article/details/50668086

activiti 流程设计器 示例

  • 2018年04月17日 10:40
  • 1.4MB
  • 下载

JEECG V3.0 版本(jbpm5 工作流自定义+WEB UI快速开发库+代码生成器) spring mvc +hibernate

简要说明 JEECG V3.0版本推翻了原有SSH2架构,采用SpringMVC+Hibernate+Spring jdbc基础架构, 采用面向声明的开发模式,基于泛型方式编写极少代码即可实现...
  • zhangdaiscott
  • zhangdaiscott
  • 2013-03-04 15:19:37
  • 10670

activiti modeler流程设计器界面定制

我们在把activiti modeler流程设计器集成到项目中时候,尤其是将它嵌入到项目中页面的iframe中时候,当我们在点击那个关闭按钮的时候,那么在iframe中就会显示其他页面,为了避免用户在...
  • romantichjwhjwhjw
  • romantichjwhjwhjw
  • 2014-11-12 16:28:42
  • 4848

Activiti在线流程设计器

  • 2015年09月16日 11:19
  • 1.55MB
  • 下载

activiti流程设计器activiti designer在eclipse中的安装。

网上很多地方建议使用eclipse的“help->Install New software”的在线安装方式,我试了下不但慢,而且几乎不能成功。所以建议直接下载该eclipse插件到本地后安装,由于这个...
  • achilles12345
  • achilles12345
  • 2015-12-29 23:34:47
  • 2933

activiti流程设计器汉化

{ "title" : "流程编辑器", "namespace" : "http://b3mn.org/stencilset/bpmn2.0#", "description" : "BPM...
  • sundehui01
  • sundehui01
  • 2017-01-03 01:08:04
  • 1990

activiti 网页流程设计器 的使用

使用activiti 网页流程设计器可以方便的画流程图。可以导出为xml。 当然也可以直接在eclipse安装activiti-designeer也可以画流程设计图,参见我的另一篇博文,点击查看。 ...
  • jenyzhang
  • jenyzhang
  • 2017-08-03 14:21:36
  • 3978

SpringMVC与Activiti网页流程设计器整合

忙活了一个星期左右,查找各种资料,终于将Activiti的流程设计器分离出来,与SpringMVC,spring整合了起来,先把工程分享出来,等有时间了在慢慢讲解具体的整合步骤。工程下载之后直接可以运...
  • xinqing623
  • xinqing623
  • 2015-09-18 09:25:58
  • 28856

SpringMVC与Activiti网页流程设计器整合(二)

动态获取项目名称 1、modeler.jsp    获取项目名称 var appContextRoot='${pageContext.request.contextPath}'; 2、editor...
  • sundehui01
  • sundehui01
  • 2017-01-03 16:20:02
  • 1387

Activiti 6.0 流程设计器汉化

  • 2018年02月06日 13:03
  • 237KB
  • 下载
收藏助手
不良信息举报
您举报文章:jeecg + activiti 流程设计器
举报原因:
原因补充:

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