<?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-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"
	default-lazy-init="true">

	<description>Activiti Configuration</description>
	
    <!-- 加载配置属性文件 -->
	<context:property-placeholder ignore-unresolvable="true" location="classpath:/properties/jeeplus.properties" />
	
	<!-- 扫描REST -->
	<context:component-scan
            base-package="org.activiti.conf,org.activiti.rest.editor,org.activiti.rest.service">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
		
	<!-- 单例json对象 -->
    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
	
	<!-- Activiti begin -->
	<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
		<property name="dataSource" ref="dataSource" />
		<property name="transactionManager" ref="transactionManager" />
		<property name="deploymentResources" value="classpath*:/act/deployments/**/*.bar"/>
		<property name="databaseSchemaUpdate" value="false" />
		<property name="jobExecutorActivate" value="true" />
		<property name="history" value="full" />
		<property name="processDefinitionCacheLimit" value="10"/>

        <!-- UUID作为主键生成策略 -->
        <property name="idGenerator" ref="idGen" />
        
        <!-- 生成流程图的字体 -->
        <property name="activityFontName" value="${activiti.diagram.activityFontName}"/>
        <property name="labelFontName" value="${activiti.diagram.labelFontName}"/>
        
        <!-- 自定义用户权限 -->
        <property name="customSessionFactories"> 
            <list>
				<bean class="com.jeeplus.modules.act.service.ext.ActUserEntityServiceFactory"/>
				<bean class="com.jeeplus.modules.act.service.ext.ActGroupEntityServiceFactory"/>
            </list>
    	</property>
        
	</bean>
	
	<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 -->
	
	<!-- 集成REST服务需要的bean -->
    <bean id="restResponseFactory" class="org.activiti.rest.service.api.RestResponseFactory" />
    <bean id="contentTypeResolver" class="org.activiti.rest.common.application.DefaultContentTypeResolver" />
</beans>