<?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:context="http://www.springframework.org/schema/context"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
	<context:component-scan base-package="com.blueland.bpm.engine.identity,com.blueland.bpm.engine.core.power" />
	<!-- Activiti begin -->
	<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
		<property name="dataSource" ref="dataSource" />
		<property name="transactionManager" ref="transactionManager" />
		<property name="databaseSchemaUpdate" value="false" />
		<property name="jobExecutorActivate" value="true" />
		<property name="history" value="audit" />
		<property name="activityFontName" value="宋体"></property>
		<property name="labelFontName" value="宋体"/>
		<property name="idGenerator" ref="uuidGenerator"/>
		<property name="dbIdentityUsed" value="false"/>
		<property name="enableDatabaseEventLogging" value="true"/>
		<property name="jobExecutor">
	    	<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
	    		<property name="waitTimeInMillis" value="10000" />
	    	</bean>
    	</property>
		  <!-- 自定义用户和组工厂 -->
      	<property name="customSessionFactories">
         <list>
            <bean class="com.blueland.bpm.engine.core.identity.CustomUserManagerFactory" />
            <bean class="com.blueland.bpm.engine.core.identity.CustomGroupManagerFactory" />
         </list>
      	</property>
	      <!-- 全局监听器 -->
	    <property name="globalTaskCreateListeners">
			<list>
				<bean class="com.blueland.bpm.engine.core.listener.GlobalTaskAssigneeListener" />
				<bean class="com.blueland.bpm.engine.core.listener.GlobalTaskDutDateListener" />
				<bean class="com.blueland.bpm.unitework.TaskCreateListener" />
			</list>
		</property>
		<property name="typedEventListeners">
		      <map>
		        <entry key="PROCESS_COMPLETED">
		          <list>
		            <bean class="com.blueland.bpm.unitework.ProcessEndEvent" />
		          </list>
		        </entry>
		        <entry key="PROCESS_CANCEL">
		          <list>
		            <bean class="com.blueland.bpm.unitework.ProcessCancelEvent" />
		          </list>
		        </entry>
		        <entry key="TASK_ASSIGNED_TRANSFER">
		          <list>
		            <bean class="com.blueland.bpm.unitework.TaskAssigneTransferEvent" />
		          </list>
		        </entry>
		         <entry key="ENTITY_DELETED">
		          <list>
		            <bean class="com.blueland.bpm.unitework.TaskDeleleEvent" />
		          </list>
		        </entry>
		      </map>
    	</property>
		<!-- 流程定义缓存-->
		<property name="processDefinitionCache">
            <bean class="com.blueland.bpm.engine.util.cache.MyProcessDefinitionCache">
            	<property name="redisTemplate" ref="redisTemplate" />
            </bean>
        </property>
	</bean>

	<bean id="uuidGenerator" class="org.activiti.engine.impl.persistence.StrongUuidGenerator"/>

	<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
		<property name="processEngineConfiguration" ref="processEngineConfiguration" />
	</bean>

	<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
	<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
	<bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
	<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
	<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" />
	<!-- Activiti end -->
</beans>