Jbpm

package cn.cslg.shally.manager.impl;

import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.exe.TaskInstance;

import cn.cslg.shally.manager.JbpmFacede;
import cn.cslg.shally.model.Document;
import cn.cslg.shally.utils.AbstractPageModel;
import cn.cslg.shally.utils.SystemException;

public class JbpmFacedeImpl  extends AbstractPageModel implements JbpmFacede{
 

 private JbpmConfiguration jbpmConfiguration;
 
 

 public JbpmConfiguration getJbpmConfiguration() {
  return jbpmConfiguration;
 }

 public void setJbpmConfiguration(JbpmConfiguration jbpmConfiguration) {
  this.jbpmConfiguration = jbpmConfiguration;
 }
//添加流程实例
 //返回流程实例的ID
 @Override
 public long addProcessInstance(String processName, Document doc) throws SystemException {
  JbpmContext context=getJbpmContext();
 //获取流程的定义 
  ProcessDefinition pdf=context.getGraphSession().findLatestProcessDefinition(processName);
  //获取流程实例变量
  ProcessInstance instance=new ProcessInstance(pdf);
  //将公文ID提交到流程实例变量中
  instance.getContextInstance().setVariable("document", doc.getId());
  
  //将公文标题也提交到流程实例变量中,以便在E-Mail中能够提示这个公文的名称
  instance.getContextInstance().setVariable("docTitle", doc.getTitle());
  
  //将公文的相关属性设置进入流程实例变量
  Map props = doc.getProperties();
  if(props != null){
   Set entries = props.entrySet();
   for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
    Map.Entry entry = (Map.Entry) iterator.next();
    String propertyName = (String)entry.getKey();
    Object obj = doc.getProperty(propertyName);
    //将变量放入流程实例变量
    instance.getContextInstance().setVariable(propertyName, obj);
   }
  }
  
  context.save(instance);
  
  return instance.getId();
  
 }
//回退也就是不同意 暂时没看明白
 @Override
 public Object[] backStep(long processInstanceId, String actorId) {
JbpmContext context = getJbpmContext();
  
  //根据流程实例标识查找流程实例
  ProcessInstance instance = context.getProcessInstance(processInstanceId);
  Object[] os = new Object[2];
  //搜索用户对应的所有的任务实例
  List taskInstances = context.getTaskMgmtSession().findTaskInstances(actorId);
  for (Iterator iterator = taskInstances.iterator(); iterator
    .hasNext();) {
   TaskInstance ti = (TaskInstance) iterator.next();
   if(ti.getProcessInstance().getId() == processInstanceId){
    
    //先判断是否是要回退到起点
    Set set = ti.getToken().getNode().getArrivingTransitions();
    for (Iterator iterator2 = set.iterator(); iterator2.hasNext();) {
     Transition t = (Transition) iterator2.next();
     //如果它需要回退到起点
     if(t.getFrom().equals(ti.getProcessInstance().getProcessDefinition().getStartState())){
      int docId = (Integer)ti.getProcessInstance().getContextInstance().getVariable("document");
      //结束当前的流程实例
      ti.getProcessInstance().end();
      //结束当前任务实例
      ti.end();
      
      //重新创建流程实例对象
      ProcessInstance pi = new ProcessInstance(ti.getProcessInstance().getProcessDefinition());
      pi.getContextInstance().setVariable("document", docId);
      //将流程实例对象重新持久化到数据库
      context.save(pi);
      
      os[0] = Document.STATUS_NEW;
      os[1] = pi.getId();
      
      return os;
     }
    }
    
    //如果不需要回退到起点
    ti.end(CreateTransitionAction.BACK_TRANSITION);
    break;
   }
  }
  
  os[0] = instance.getRootToken().getNode().getName();
  os[1] = processInstanceId;
  
  return os;
 }
//删除流程定义  为了避免覆盖 导致其他没流完的流程无法继续进行下去 所以采用版本控制的方式避免覆盖 所以在删除时要循环的删除
 @Override
 public void delProcessDefinition(String processName) {
     JbpmContext context=getJbpmContext();
     List defs=context.getGraphSession().findAllProcessDefinitionVersions(processName);
     for (Iterator iterator = defs.iterator(); iterator.hasNext();) {
   ProcessDefinition def = (ProcessDefinition) iterator.next();
   context.getGraphSession().deleteProcessDefinition(def);
  }
 }
//删除流程实例
 @Override
 public void delProcessInstance(long processInstanceId) {
  JbpmContext context = getJbpmContext();
  context.getGraphSession().deleteProcessInstance(processInstanceId);
 }
//上传流程定义 返回流程定义的名字
 @Override
 public String deployProcessDefinition(byte[] processDef) {
JbpmContext context = getJbpmContext();
  
  ProcessDefinition def = ProcessDefinition.parseXmlInputStream(
   new ByteArrayInputStream(processDef)
  );
  
  context.deployProcessDefinition(def);
  
  return def.getName();
 }
//提交到下一个节点
 //返回下一个节点的名称
 @Override
 public String nextStep(long processInstanceId, String actorId,
   String transitionName) {

  JbpmContext context = getJbpmContext();
  //获取流程实例变量
  ProcessInstance instance = context.getProcessInstance(processInstanceId);
  
  //当前节点的名称
  String currentNodeName = instance.getRootToken().getNode().getName();
  
  //起点的名称
  String startNodeName = instance.getProcessDefinition().getStartState().getName();
    
  //如果是在起点
  if(startNodeName.equals(currentNodeName)){
   if(transitionName == null){
    instance.signal();
   }else{
    instance.signal(transitionName);
   }
  }else{
   //获取改用户的所有任务列表
   List taskInstances = context.getTaskMgmtSession().findTaskInstances(actorId);
   for (Iterator iterator = taskInstances.iterator(); iterator
     .hasNext();) {
    TaskInstance ti = (TaskInstance) iterator.next();
    //如果当前的流程实例==循环中的流程实例
    if(ti.getProcessInstance().getId() == processInstanceId){
     if(transitionName == null){
      ti.end();
     }else{
      ti.end(transitionName);
     }
     break;
    }
   }
   
   
   //查找所属组的任务实例
   List pooledTaskInstances = context.getTaskMgmtSession().findPooledTaskInstances(actorId);
   for (Iterator iterator = pooledTaskInstances.iterator(); iterator
     .hasNext();) {
    TaskInstance ti = (TaskInstance) iterator.next();
    if(ti.getProcessInstance().getId() == processInstanceId){
     if(transitionName == null){
      ti.end();
     }else{
      ti.end(transitionName);
     }
     break;
    }
   }
  }
  
  //返回转向之后的节点名称
  return instance.getRootToken().getNode().getName();
 }
//搜索我的待审的公文的列表
 @Override
 public List searchMyTaskList(String actorId) {
  JbpmContext context = getJbpmContext();
  List docIds = new ArrayList();
  List taskInstances = context.getTaskMgmtSession().findTaskInstances(actorId);
  for (Iterator iterator = taskInstances.iterator(); iterator.hasNext();) {
   TaskInstance ti = (TaskInstance) iterator.next();
   Integer docId = (Integer)ti.getProcessInstance().getContextInstance().getVariable("document");
   docIds.add(docId);
  }
  
  //查找所属组的任务实例
  List pooledTaskInstances = context.getTaskMgmtSession().findPooledTaskInstances(actorId);
  for (Iterator iterator = pooledTaskInstances.iterator(); iterator
    .hasNext();) {
   TaskInstance ti = (TaskInstance) iterator.next();
   Integer docId = (Integer)ti.getProcessInstance().getContextInstance().getVariable("document");
   docIds.add(docId);
  }  
  
  return docIds;
 }
//查护下往下走的可选的路径
 @Override
 public List searchNextTransitions(long processInstanceId, String actorId) {
  JbpmContext context = getJbpmContext();
  ProcessInstance instance = context.getProcessInstance(processInstanceId);
  
  //当前节点
  String currentNodeName = instance.getRootToken().getNode().getName();
  
  //起点的名称
  String startNodeName = instance.getProcessDefinition().getStartState().getName();
  
  Collection transitions = null;
  
  //如果是在起点
  if(startNodeName.equals(currentNodeName)){
   transitions = instance.getRootToken().getAvailableTransitions();
  }else{
   //如果是中间节点
   List taskInstances = context.getTaskMgmtSession().findTaskInstances(actorId);
   for (Iterator iterator = taskInstances.iterator(); iterator
     .hasNext();) {
    TaskInstance ti = (TaskInstance) iterator.next();
    if(ti.getProcessInstance().getId() == processInstanceId){
     transitions = ti.getAvailableTransitions();
     break;
    }
   }
   
   //查找所属组的任务实例
   List pooledTaskInstances = context.getTaskMgmtSession().findPooledTaskInstances(actorId);
   for (Iterator iterator = pooledTaskInstances.iterator(); iterator
     .hasNext();) {
    TaskInstance ti = (TaskInstance) iterator.next();
    if(ti.getProcessInstance().getId() == processInstanceId){
     transitions = ti.getAvailableTransitions();
    }
   }
  }
  
  List transitionNames = new ArrayList();
  
  if(transitions != null){
   //为了不把Transition对象直接暴露给OA系统,需要将其转换为名称列表
   for (Iterator iterator = transitions.iterator(); iterator.hasNext();) {
    Transition transition = (Transition) iterator.next();
    transitionNames.add(transition.getName());
   }
  }
  
  return transitionNames;
 }

 
 private JbpmContext getJbpmContext(){
  JbpmContext context = jbpmConfiguration.createJbpmContext();
  context.setSession(getSession());
  return context;
 }

}

 

 

 

 

 

 

 

 

 

 

<jbpm-configuration>

  <!--
    This configuration is used when there is no jbpm.cfg.xml file found in the
    root of the classpath.  It is a very basic configuration without persistence
    and message services.  Only the authorization service installed.
    You can parse and create processes, but when you try to use one of the
    unavailable services, you'll get an exception.
  -->
 
  <jbpm-context>
    <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
    <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
    <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
    <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
    <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
    <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
  </jbpm-context>

  <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
  <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />

  <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
  <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
  <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
  <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
  <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
  <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
  <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
  <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
  <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />

  <int    name="jbpm.byte.block.size" value="1024" singleton="true" />
  <string name="jbpm.mail.smtp.host" value="localhost" />
  <bean   name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
  <bean   name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
  <bean   name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
 
  <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
    <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
    <field name="name"><string value="JbpmJobExector" /></field>
    <field name="nbrOfThreads"><int value="1" /></field>
    <field name="idleInterval"><int value="5000" /></field>
    <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
    <field name="historyMaxSize"><int value="20" /></field>
    <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
    <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
    <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
  </bean>

</jbpm-configuration>

 

 

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1/realoa</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">root</property>
    <property name="hibernate.connection.autocommit">true</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.show_sql">true</property>
    <property name="hibernate.hbm2ddl.auto">update</property>
    <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
    <mapping resource="cn/cslg/shally/model/ACL.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/ApptoveInfo.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/Document.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/FieldInput.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/FieldType.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/FlowForm.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/FormField.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/Module.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/Organization.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/Person.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/Roles.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/User.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/UsersRoles.hbm.xml"/>
    <mapping resource="cn/cslg/shally/model/WorkFlow.hbm.xml"/>
     <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
    <mapping resource="org/jbpm/identity/User.hbm.xml"/>
    <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
    <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
    <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
    <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
    <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
    <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
    <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
    <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
    <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
    <mapping resource="org/jbpm/job/Job.hbm.xml"/>
    <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
    <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
    <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
  </session-factory>
</hibernate-configuration>

 

 

<?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:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 <!-- 配置SessionFactory -->
 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="configLocation">
   <value>classpath:hibernate.cfg.xml</value>
  </property>
 </bean>
 
 <!-- 配置事务管理器 -->
 <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref bean="sessionFactory"/>
  </property> 
 </bean>   
 
 <!-- 事务的传播特性 -->
 <tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
  
   <tx:method name="add*" propagation="REQUIRED"/>
   <tx:method name="del*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED"/>
   <tx:method name="*"/>
   <!--
   <tx:method name="*" propagation="REQUIRED"/>
    -->
  </tx:attributes>
 </tx:advice>
 
 <!-- 那些类那些方法使用事务 -->
 <aop:config>
  <aop:pointcut id="allManagerMethod" expression="execution(* cn.clsg.shally.manager.*.*(..))"/>
  <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
 </aop:config>
<bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
  <property name="configuration" value="classpath:jbpm.cfg.xml"></property>
 </bean>
</beans>

 

 

<?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:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 <bean id="orgManager" class="cn.cslg.shally.manager.impl.OrgManagerImpl">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>
 <bean id="personManager" class="cn.cslg.shally.manager.impl.PersonManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>

 <bean id="userManager" class="cn.cslg.shally.manager.impl.UserManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <bean id="roleManager" class="cn.cslg.shally.manager.impl.RoleManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <bean id="moduleManager" class="cn.cslg.shally.manager.impl.ModuleManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <bean id="initSystemDatas" class="cn.cslg.shally.utils.InitSystemDatasImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
  <property name="userManager" ref="userManager"></property>
  <property name="orgManager" ref="orgManager"></property>
 </bean>
 <bean id="aclManager" class="cn.cslg.shally.manager.impl.AclManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <bean id="securityFunctions" class="cn.cslg.shally.utils.SecurityFunctions">
  <property name="aclManager" ref="aclManager"></property>
 </bean>
 <bean id="documentManager" class="cn.cslg.shally.manager.impl.DocumentManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
  <property name="jbpmFacede" ref="jbpmFacede"></property>
 </bean>
 <bean name="jbpmFacede" class="cn.cslg.shally.manager.impl.JbpmFacedeImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
  <property name="jbpmConfiguration" ref="jbpmConfiguration"></property>
 </bean>
 <bean name="formManager" class="cn.cslg.shally.manager.impl.FormManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <bean name="workFlowManager" class="cn.cslg.shally.manager.impl.WorkFlowManagerImpl">
  <property name="sessionFactory" ref="sessionFactory"></property>
  <property name="jbpmFacede" ref="jbpmFacede"></property>
 </bean>
 <bean name="DynaFormFunction" class="cn.cslg.shally.utils.DynaFormFunction">
  <property name="formManager" ref="formManager"></property>
 </bean>
</beans>

 

 

<?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:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 <bean name="/org" class="cn.cslg.shally.web.actions.OrgAction"
  scope="prototype">
  <property name="orgManager" ref="orgManager"></property>
 </bean>
 <bean name="/person" class="cn.cslg.shally.web.actions.PersonAction">
  <property name="personManager" ref="personManager"></property>
 </bean>
 <bean name="/user" class="cn.cslg.shally.web.actions.UserAction">
  <property name="userManager" ref="userManager"></property>
  <property name="personManager" ref="personManager"></property>
  <property name="roleManager" ref="roleManager"></property>
 </bean>
 <bean name="/role" class="cn.cslg.shally.web.actions.RoleAction">
  <property name="roleManager" ref="roleManager"></property>
 </bean>
 <bean name="/module" class="cn.cslg.shally.web.actions.ModuleAction">
      <property name="moduleManager" ref="moduleManager"></property>
 </bean>
 <bean name="/acl" class="cn.cslg.shally.web.actions.AclAction">
   <property name="userManager" ref="userManager"></property>
   <property name="roleManager" ref="roleManager"></property>
   <property name="moduleManager" ref="moduleManager"></property>
 </bean>
 <bean name="/login" class="cn.cslg.shally.web.actions.LoginAction">
   <property name="userManager" ref="userManager"></property>
 </bean>
 <bean name="/index" class="cn.cslg.shally.web.actions.IndexAction">
      <property name="aclManager" ref="aclManager"></property>
 </bean>
 <bean name="/document" class="cn.cslg.shally.web.actions.DocumentAction">
  <property name="documentManager" ref="documentManager"></property>
  <property name="workFlowManager" ref="workFlowManager"></property>
 </bean>
 <bean name="/workflow" class="cn.cslg.shally.web.actions.WorkFlowAction">
  <property name="workFlowManager" ref="workFlowManager"></property>
 </bean>
 <bean name="/flowform" class="cn.cslg.shally.web.actions.FlowFormAction">
  <property name="workFlowManager" ref="workFlowManager"></property>
  <property name="formManager" ref="formManager"></property>
 </bean>
 
</beans>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值