Activiti 5.14 Activitimodeler and Business system integration (business system for Spring,struts2,mybatis structure)

Source: Internet
Author: User

all kinds of information on the Internet, all kinds of no, most of the article is a masterpiece of coffee rabbit, based on spring MVC and Marven, and I integrated business system is very different, And Activiti is 5.12 version, the other articles are basically copied to copy, after finally their own whole out, the integration of the contents of redundancy, the directory structure is unreasonable, this article is not considered, I have not clear up, record the finishing steps:

(1) Download Activiti 5.14, Download complete, find this file, Activiti-5.14\wars\activiti-explorer.war, after decompression directory structure below, (War package extract java CVF command)

(2) The file other than "Web_info" will not be processed before the project's Webroot folder

(3) After modifying the spring configuration file

Add the following configuration:

<!--process Engine base configuration started-->
<bean id= "processengineconfiguration" class= "Org.activiti.spring.SpringProcessEngineConfiguration" >
<property name= "DataSource" ref= "DataSource"/>
<!--Database configurations-->
<property name= "Databaseschemaupdate" value= "true"/>
<!--job Executor configurations-->
<property name= "Jobexecutoractivate" value= "false"/>
<property name= "TransactionManager" ref= "TransactionManager"/>
<property name= "deploymentresources" value= "CLASSPATH*:/DIAGRAMS/*/*.BPMN"/>
<property name= "Activityfontname" value= "Song Body"/>
<property name= "Labelfontname" value= "Song Body"/>
<bean id= "Processengine" class= "Org.activiti.spring.ProcessEngineFactoryBean" >
<property name= "processengineconfiguration" ref= "Processengineconfiguration"/>
<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= "Formservice" factory-bean= "Processengine" factory-method= "Getformservice"/>
<!--process engine base configuration end-->

(4) Again open the extracted war package file, find "Web-inf\classes" under all the configuration files, unmodified still to the project system corresponding to the directory, to ensure that the project compiled after the web-inf\classes can find the file.

(5) Modify Web.xml file

Activiti Modeler in the way of the servlet, you can use their own handwriting filter to intercept the way, can also directly modify the struts in the Web.xml configuration implementation, the individual directly modify the configuration file

as shown above, add filter interception, here according to different original system configuration needs to do different implementation, at present my business system action between the jump is through. The way of action.

(6) Add the following content under Web.xml

<!--application class name-->

<!--Catch All service Requests-->

(7) Add jar files and import all jar files from the downloaded Activiti package activiti-5.14\libs into the business system.

(8) decompile web-inf\classes under the related classes, a total of not a few very good decompile. Restore all the class files here under the war package, and eventually copy the related files to the business system in the original directory structure as follows

(9) Write an action class to create a process

Package com.boyun.activiti.base.action;

Import Org.activiti.engine.FormService;
Import Org.activiti.engine.HistoryService;
Import Org.activiti.engine.IdentityService;
Import Org.activiti.engine.ProcessEngine;
Import Org.activiti.engine.RepositoryService;
Import Org.activiti.engine.RuntimeService;
Import Org.activiti.engine.TaskService;
Import org.springframework.beans.factory.annotation.Autowired;
Import Org.springframework.context.annotation.Scope;
Import Org.springframework.stereotype.Controller;
Import Org.activiti.explorer.demo.DemoDataGenerator;
Import java.util.List;

Import org.activiti.editor.constants.ModelDataJsonConstants;
Import Org.activiti.engine.repository.Model;
Import Org.apache.commons.lang3.StringUtils;
Import Org.codehaus.jackson.node.ObjectNode;

Import com.boyun.action.BaseAction;
@Scope ("prototype")
@Controller ("Baseactivitiaction")
public class Baseactivitiaction extends baseaction{
Private static final long serialversionuid = 1L;
Processengine Processengine;
Repositoryservice Repositoryservice;
Taskservice Taskservice;
Runtimeservice Runtimeservice;
protected Identityservice Identityservice;
Private Formservice Formservice;
Private Historyservice Historyservice;
Public String Createactiviti () {
try {
Objectmapper objectmapper = new Objectmapper ();
Objectnode Editornode = Objectmapper.createobjectnode ();
Editornode.put ("id", "canvas");
Editornode.put ("ResourceID", "canvas");
Objectnode Stencilsetnode = Objectmapper.createobjectnode ();
Stencilsetnode.put ("namespace", "");
Editornode.put ("Stencilset", Stencilsetnode);
Model modeldata = Repositoryservice.newmodel ();

Objectnode Modelobjectnode = Objectmapper.createobjectnode ();
Modelobjectnode.put (Modeldatajsonconstants.model_name, "NAME");
Modelobjectnode.put (modeldatajsonconstants.model_revision, 1);
String 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"));

This.getresponse (). Sendredirect (This.getrequest (). Getcontextpath () + "/service/editor?id=" + modelData.getId ());
}catch (Exception e) {
E.printstacktrace ();
return null;
Private String ModelID;


(10) This class will be configured in accordance with normal struts, access to this class after completion, create complete, and then jump directly to the edit page "This.getresponse (). Sendredirect (This.getrequest (). Getcontextpath () + "/service/editor?id=" + Modeldata.getid ()); ",

after the jump completed as shown in the following figure, the following figure has been finished, the default display is the English version.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.