首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Maven集成Activiti Modeler

使用Maven集成Activiti Modeler
EN

Stack Overflow用户
提问于 2016-02-05 07:49:24
回答 1查看 1K关注 0票数 2

如何将Activiti Modeler集成到自己的web应用程序中,并保留Maven建议的所有优点?

程序是Maven中的Activiti Modeler是Activiti Explorer的一部分。网上有几个问题来自想要开发自己的web应用程序、使用Modeler编辑流程但不需要其他资源管理器特性的人。

例如,Activiti BPM without activiti-explorerHow To Integrate Activiti Modeller Into own Web Application

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-05 08:03:53

我使用Maven覆盖功能成功地做到了这一点:

1)包含资源管理器web应用程序的覆盖,但只包括Modeler文件:

pom.xml:

代码语言:javascript
复制
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-webapp-explorer2</artifactId>
        <version>${activiti-version}</version>
        <type>war</type>
        <scope>compile</scope>
    </dependency>
....
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <overlays>
                    <overlay>
                        <groupId>org.activiti</groupId>
                        <artifactId>activiti-webapp-explorer2</artifactId>
                        <includes>
                            <include>WEB-INF/classes/stencilset.json</include>   
                            <include>editor-app/**</include>   
                            <include>modeler.html</include>   
                        </includes>
                    </overlay>
                </overlays>
            </configuration>
        </plugin>

2)添加建模器Spring资源。它们用于检索和保存模型(注意:不是过程定义,这有点不同),还用于为模板集服务:

代码语言:javascript
复制
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-modeler</artifactId>
        <version>${activiti-version}</version>
    </dependency>

3)就是这样,但是它实际上不会在您的应用程序中工作,除非它被称为“activiti”。向项目中添加一个名为"editor-app/app-cfg.js“的文件,并在其中添加以下内容:

编辑器-app/app-cfg.js:

代码语言:javascript
复制
'use strict';
var ACTIVITI = ACTIVITI || {};
ACTIVITI.CONFIG = {
        'contextRoot' : window.location.pathname.substring(0,window.location.pathname.lastIndexOf('/')),
};

这实际上是本机app-cfg的一个副本,其中包含了上下文根奇怪的“//service”设置。我们将其更改为更通用的设置。它将用于从存储库中检索模型。我们的文件将覆盖浏览器webapp附带的文件。

备注:

( a)您必须自己管理流程定义到模型的转换。有关一个想法,请参见https://github.com/Activiti/Activiti/blob/activiti-5.19.0.1/modules/activiti-explorer/src/main/java/org/activiti/editor/ui/ConvertProcessDefinitionPopupWindow.java

b)我不得不避免在每件事上都使用一个Jackson对象Mapper,我还没有研究为什么这样做不起作用:

代码语言:javascript
复制
<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper">
</bean>    
<mvc:annotation-driven>
    <!-- using the same objectMapper leads to stencilset resource being served as string -->
    <mvc:message-converters register-defaults="true">
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper" ref="objectMapper"/>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>

不要这么做,也不要做更多的研究,因为这实际上破坏了为“activiti modeler”的一部分服务的模板。它开始将stencilset服务为格式错误的字符串,而不是普通的json。

c)我不知道如何在Modeler保存函数中插入CSRF安全头,所以我关闭了它--如果您不使用Security,就放弃它

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35218832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档