Ssh+activity Workflow Integration Development

Source: Internet
Author: User
Tags aop ssh

Has not been updated recently, the previous information was collated.
SSH's integrated configuration inventory looks at an article

Struts-2.3.24+spring-framework-4.1.6.release+hibernate-release-4.3.10.final
Integrated development

Import the jar required by the activity workflow
Activiti-bpmn-converter-5.16.4.jar
Activiti-bpmn-layout-5.16.4.jar
Activiti-bpmn-model-5.16.4.jar
Activiti-camel-5.16.4.jar
Activiti-cdi.jar
Activiti-common-rest-5.16.4.jar
Activiti-crystalball-5.16.4.jar
Activiti-cxf-5.16.4.jar
Activiti-diagram-rest-5.16.4.jar
Activiti-engine-5.16.4.jar
Activiti-explorer-5.16.4.jar
Activiti-image-generator-5.16.4.jar
Activiti-json-converter-5.16.4.jar
Activiti-ldap-5.16.4.jar
Activiti-modeler-5.16.4.jar
Activiti-mule-5.16.4.jar
Activiti-osgi-5.16.4.jar
Activiti-process-validation-5.16.4.jar
Activiti-simple-workflow-5.16.4.jar
Activiti-rest-5.16.4.jar
Activiti-spring-5.16.4.jar

Add a profile: Create a new Activiti.cfg.xml file

<beans xmlns= "Http://www.springframework.org/schema/beans" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "xmlns:aop=" HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP "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/TX http://www.springframework.org/schema/tx/spring-tx.xsd/HTTP WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop.xsd HTTP://WWW.SPR Ingframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd "> <!-- Spring is responsible for creating the configuration file for the process engine--<bean id= "processengineconfiguration" class= " Org.activiti.spring.SpringProcessEngineConfiguration "> <!--data Source-<property name="DataSource "ref=" DataSource "/> <!--configuration transaction manager, unified transaction--<property name=" TransactionManager "ref= "Txmanager"/> <!--set up a table policy, and if there is no table, automatically create table--<property name= "Databaseschemaupdate" value= "true" /> </bean> <!--creating process engine objects--<bean id= "Processengine" class= "Org.activiti.spring.ProcessEngi Nefactorybean "> <property name=" processengineconfiguration "ref=" processengineconfiguration "/> </
    Bean> <!--equivalent to the following code Repositoryservicie Repositoryservice = Processengine.getrepositoryservice ();
    Runtimeservicie Repositoryservice = Processengine.getruntimeservicie ();
    Taskservicie Taskservicie = Processengine.gettaskservicie ();
     Historyservicie Historyservicie = Processengine.gethistoryservicie (); -<!--by the process engine object, provides the method to create the Activiti workflow that is used in the project--<bean id= "Repositoryservice" factory-bean= "proc Essengine "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= "Formservice" factory-bean= "

 Processengine "factory-method=" Getformservice "/> </beans>

When this configuration is complete, you can use annotations to inject activity

Gets the process engine object, which can obtain several other service objects through the Process engine object
@Resource
private processengine processengine;
Get the deployment Process Object service, Repositoryservice can deploy process information, query process information
@Resource
private  Repositoryservice Repositoryservice;
Gets the process run-time object that can be queried by querying the process information being executed
@Resource
private Runtimeservice  runtimeservice;
Task service object, through which he can query task information
@Resource
private taskservice taskservice;
Historical service object, through his query history process information
@Resource
private Historyservice  historyservice;

Pass

<import resource= "Classpath:activiti.cfg.xml"/>

Import into the Applicationcontext.xml configuration file and give it to spring management. View the Applicationcontext.xml configuration in detail.

The following is the basic use of activity.

Configure Applicationcontext.xml as follows:

<?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:aop= "Http://www.springframework.org/schema/aop" 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/s Pring-beans.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-t
        X.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context/spring-context. xsd > <!--1, auto scan and assemble bean---<context:component-scan base-package= "Cn.ssha" ></context:component -scan> <!--Import external configuration files--&LT;context:property-placeholder location= "Classpath:jdbc.properties"/> <!--configuration data source-<bean id= "Dataso Urce "class=" Com.mchange.v2.c3p0.ComboPooledDataSource "> <property name=" jdbcurl "value=" ${jdbcurl} ">< /property> <property name= "Driverclass" value= "${driverclass}" ></property> <property nam e= "User" value= "${user}" ></property> <property name= "password" value= "${password}" ></property&gt
        ; <!--other Configurations-<!--get three connections when initializing, the value should be between Minpoolsize and Maxpoolsize. Default:3---<property name= "Initialpoolsize" value= "3" ></property> <!--the minimum number of connections left in the connection pool. Default:3---<property name= "Minpoolsize" value= "3" ></property> <!--the maximum number of connections left in the connection pool. Default:15--<property name= "Maxpoolsize" value= "5" ></property> <!--when the connection in the connection pool is exhausted c3p0 The number of connections fetched at one time. Default:3--<property name= "AcquireincRement "value=" 3 "></property> <!--controls the number of preparedstatements loaded in the data source. If both maxstatements and maxstatementsperconnection are 0, the cache is closed. default:0--<property name= "maxstatements" value= "8" ></property> <!--Max Statementsperconnection defines the maximum number of cache statements that a single connection in a connection pool has. default:0--<property name= "Maxstatementsperconnection" value= "5" ></property> <!--max Empty Idle time, unused in 1800 seconds, the connection is discarded. If 0, it will never be discarded. default:0--<property name= "MaxIdleTime" value= "1800" ></property> </bean> <!-- Configuration Sessionfactory--<bean id= "sessionfactory" class= "Org.springframework.orm.hibernate4.LocalSessionFac Torybean "> <!--Specify hibernate configuration Path--<property name=" configlocation "value=" Classpath:hibernat E.cfg.xml "></property> <property name=" DataSource "ref=" DataSource "></property> <! --Configure C3P0 database connection pool <property name= "DataSource" &Gt <bean class= "Com.mchange.v2.c3p0.ComboPooledDataSource" > Database connection Information <property name= "Jdbcurl" value= "${j Dbcurl} "></property> <property name=" Driverclass "value=" ${driverclass} "></property> &lt ;p roperty name= "user" value= "${user}" ></property> <property name= "password" value= "${password}" &G T;</property> Three connections are obtained when other configurations are initialized, the values should be between Minpoolsize and Maxpoolsize. Default:3 <property name= "Initialpoolsize" value= "3" ></property> connection pool The minimum number of connections kept. Default:3 <property name= "Minpoolsize" value= "3" ></property> connection pool The maximum number of connections reserved. Default:15 <property name= "Maxpoolsize" value= "5" ></property> when the connection in the connection pool is exhausted, c3p0 the number of connections fetched at one time. Default:3 <property name= "Acquireincrement" value= "3" ></property> controls the number of preparedstatements loaded within the data source. If both maxstatements and maxstatementsperconnection are 0, the cache is closed. default:0 <property name= "maxstatements"Value=" 8 "></property> maxstatementsperconnection defines the maximum number of cache statements that a single connection in a connection pool has. default:0 <property name= "Maxstatementsperconnection" value= "5" ></property> maximum idle time, not used in 1800 seconds connection is Discarded. If 0, it will never be discarded. default:0 <property name= "maxidletime" value= "1800" ></property> </bean> </property> -<!--<property name= "mappingresources" > <list> <value>cn/s
                Sha/oa/doman/product.hbm.xml</value> <value>cn/ssha/oa/doman/Employee.hbm.xml</value> <value>cn/ssha/oa/doman/LeaveBill.hbm.xml</value> </list> </propert y> <property name= "hibernateproperties" > <value> hibernate.dialect=org. Hibernate.dialect.MySQL5InnoDBDialect hibernate.show_sql=true HIBERNATE.HBM2DDL.AUTO=UPDA Te hibernate.temp.use_jdbc_mEtadata_defaults=false </value> </property>-</bean> <!--Configuring the reputation transaction management (using annotations)--<bean id= "Txmanager" class= "Org.springframework.orm.hibernate4.HibernateTransactionManager "> <property name=" sessionfactory "ref=" sessionfactory "></property> </bean> <tx:an Notation-driven transaction-manager= "Txmanager"/> <!--configuration-based DAO, in other DAO only need to inherit and <bean id= "Baseda O "abstract=" true "> <property name=" sessionfactory "ref=" Sessionfactory "></property> </bean&
    Gt <import resource= "Classpath:activiti.cfg.xml"/> </beans>

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: info-contact@alibabacloud.com 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.