2016-02-05 125 views

回答

2

我已成功地做到这一点使用Maven的叠加功能:

1)包括浏览器的Web应用程序的叠加,但只包括建模文件:

POM .xml:

<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)添加modeler Spring资源。它们被用来获取和保存模型(注意:不是流程定义,它有点不同的东西),也服务于stencilset:

<dependency> 
     <groupId>org.activiti</groupId> 
     <artifactId>activiti-modeler</artifactId> 
     <version>${activiti-version}</version> 
    </dependency> 

3),这将是它,但它不会实际工作的除非它被称为“activiti-explorer”。将文件添加到您的项目称为“主编应用程序/应用-cfg.js”,并添加以下内容有:

主编应用程序/应用-cfg.js:

'use strict'; 
var ACTIVITI = ACTIVITI || {}; 
ACTIVITI.CONFIG = { 
     'contextRoot' : window.location.pathname.substring(0,window.location.pathname.lastIndexOf('/')), 
}; 

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

注:

一)你必须自己管理的过程定义转化为模型。对于一个想法,看到https://github.com/Activiti/Activiti/blob/activiti-5.19.0.1/modules/activiti-explorer/src/main/java/org/activiti/editor/ui/ConvertProcessDefinitionPopupWindow.java

B)我必须避免使用一切一个杰克逊对象映射器,我没有研究为什么这不工作:

<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> 

不要这样做或研究更多,因为这实际上打破了“活动建模者”的服务部分重新提供服务。它开始服务stencilset作为一个畸形的字符串,而不是普通的json。

三)我不知道如何注入CSRF安全头在Modeler的保存功能,所以我打开它关闭 - 如果你不使用Spring Security,丢弃这个

+0

目前尚不清楚其中的编​​辑器,应用程序/app-cfg.js文件去。 – javydreamercsw

+0

@javydreamercsw对不起,我错过了 - 我在这个发展中做了很大的停顿。可能你已经知道了。该目录和文件直接进入webapp文件夹 - 以及WEB-INF和META-INF文件夹。 – fedd