<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

	<bean id="siteService_dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/model/siteModel.xml</value>
            </list>
        </property>
    </bean>
       
    <!-- Bootstrap the permission model -->
    <bean id="siteService_permissionBootstrap" parent="permissionModelBootstrap">
    	<property name="model" value="alfresco/model/sitePermissionDefinitions.xml"/>
    </bean>
    
    <!-- Site service bean -->
    <bean id="SiteService" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>org.alfresco.service.cmr.site.SiteService</value>
        </property>
        <property name="target">
            <ref bean="siteService"/>
        </property>
        <property name="interceptorNames">
            <list>
                <idref local="SiteService_transaction"/>
                <idref bean="AuditMethodInterceptor"/>
                <idref bean="exceptionTranslator"/>
                <idref local="SiteService_security"/>
            </list>
        </property>
    </bean>

    <!-- Site service transaction bean -->
    <bean id="SiteService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="*">${server.transaction.mode.default}</prop>
            </props>
        </property>
    </bean>
    
    <!-- Site service security bean -->
    <bean id="SiteService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
    
    
     <!-- I18N -->   
    <bean id="siteServiceResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
       <property name="resourceBundles">
          <list>
             <value>alfresco.messages.site-service</value>
          </list>
       </property>
    </bean>
    
    <!--  Site role precedence - higher number - more important role -->    
    <bean id="siteRoleComparator" class="org.alfresco.repo.site.RoleComparatorImpl" init-method="init">
       <property name="rolePrecedence">
       		<map>
       			<entry key="SiteManager" value="4" />
       			<entry key="SiteCollaborator" value="3" />
       			<entry key="SiteContributor" value="2" />
       			<entry key="SiteConsumer" value="1" />
       		</map>
       </property>
    </bean>
    
    <bean id="siteService" class="org.alfresco.repo.site.SiteServiceImpl" init-method="init">
       <property name="nodeService" ref="NodeService"/>
       <property name="fileFolderService" ref="FileFolderService"/>
       <property name="searchService" ref="SearchService"/>
       <property name="namespaceService" ref="NamespaceService"/>
       <property name="permissionService" ref="PermissionService"/>
       <property name="authenticationContext" ref="authenticationContext"/>      
       <property name="personService" ref="PersonService"/>
       <property name="activityService" ref="activityService"/>
       <property name="taggingService" ref="TaggingService"/>
       <property name="authorityService" ref="authorityService"/>
       <property name="dictionaryService" ref="DictionaryService"/>
       <property name="tenantAdminService" ref="tenantAdminService"/>
       <property name="transactionHelper" ref="retryingTransactionHelper"/>
       <property name="sitesXPath">
           <value>./${spaces.company_home.childname}/st:sites</value>
       </property>
       <property name="tenantService" ref="tenantService"/>
       <property name="roleComparator" ref="siteRoleComparator" />

       
    </bean>
    
    <bean id="siteServiceScript" parent="baseJavaScriptExtension" class="org.alfresco.repo.site.script.ScriptSiteService">
        <property name="extensionName">
            <value>siteService</value>
        </property>
        <!-- Creates Sites which require the ServiceRegistry -->
        <property name="serviceRegistry" ref="ServiceRegistry"/>
        <property name="siteService" ref="siteService"/>
    </bean>
    
    
</beans>
