Files
alfresco-community-repo/config/alfresco/rating-services-context.xml

126 lines
5.4 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Rating Service -->
<bean id="RatingService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.service.cmr.rating.RatingService</value>
</property>
<property name="target">
<ref bean="ratingService" />
</property>
<property name="interceptorNames">
<list>
<idref local="RatingService_transaction" />
<idref bean="AuditMethodInterceptor" />
<idref bean="exceptionTranslator" />
<idref local="RatingService_security" />
</list>
</property>
</bean>
<!-- Rating service transaction bean -->
<bean id="RatingService_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>
<!-- Rating service security bean -->
<bean id="RatingService_security"
class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- Rating Service base bean -->
<bean id="ratingService" class="org.alfresco.repo.rating.RatingServiceImpl">
<property name="ratingSchemeRegistry">
<ref local="ratingSchemeRegistry"/>
</property>
<property name="behaviourFilter" ref="policyBehaviourFilter" />
<property name="dictionaryService" ref="dictionaryService"/>
<property name="nodeService" ref="nodeService"/>
<property name="rollupNamingConventions" ref="rollupNamingConventions"/>
</bean>
<!-- The rating scheme registry maintains the collection of registered rating schemes. -->
<bean id="ratingSchemeRegistry" class="org.alfresco.repo.rating.RatingSchemeRegistry" />
<!-- The base rating scheme bean provides for automatic registration of rating schemes. -->
<bean name="baseRatingScheme" abstract="true" init-method="init">
<constructor-arg ref="ratingSchemeRegistry"/>
<!-- By default users can rate their own content. -->
<property name="selfRatingAllowed" value="true"/>
</bean>
<!-- Out of the box rating schemes -->
<bean name="likesRatingScheme" parent="baseRatingScheme" class="org.alfresco.repo.rating.RatingSchemeImpl">
<property name="minRating" value="1"/>
<property name="maxRating" value="1"/>
<!-- Property roll-ups. Alfresco supports 'rolling up' totals, counts for the "likes" rating scheme. -->
<property name="propertyRollups">
<list>
<bean class="org.alfresco.repo.rating.RatingCountRollupAlgorithm" parent="baseRollupAlgorithm">
<property name="ratingSchemeName" value="likesRatingScheme" />
</bean>
<bean class="org.alfresco.repo.rating.RatingTotalRollupAlgorithm" parent="baseRollupAlgorithm">
<property name="ratingSchemeName" value="likesRatingScheme" />
</bean>
</list>
</property>
</bean>
<bean name="baseRollupAlgorithm" abstract="true" class="org.alfresco.repo.rating.AbstractRatingRollupAlgorithm">
<property name="namespaceService" ref="namespaceService"/>
<property name="nodeService" ref="nodeService"/>
<property name="ratingService" ref="ratingService"/>
</bean>
<bean name="rollupNamingConventions" class="org.alfresco.repo.rating.RatingNamingConventionsUtil">
<property name="namespaceService" ref="namespaceService"/>
</bean>
<bean name="fiveStarRatingScheme" parent="baseRatingScheme"
class="org.alfresco.repo.rating.RatingSchemeImpl">
<property name="minRating" value="1"/>
<property name="maxRating" value="5"/>
<!-- For this rating scheme, users cannot rate their own content. -->
<property name="selfRatingAllowed" value="false"/>
<!-- Property roll-ups. -->
<property name="propertyRollups">
<list>
<bean class="org.alfresco.repo.rating.RatingCountRollupAlgorithm" parent="baseRollupAlgorithm">
<property name="ratingSchemeName" value="fiveStarRatingScheme" />
</bean>
<bean class="org.alfresco.repo.rating.RatingTotalRollupAlgorithm" parent="baseRollupAlgorithm">
<property name="ratingSchemeName" value="fiveStarRatingScheme" />
</bean>
</list>
</property>
</bean>
<!-- Behaviours and policies for Ratings -->
<bean id="ratingAspect" class="org.alfresco.repo.rating.RateableAspect" init-method="init">
<property name="policyComponent" ref="policyComponent"/>
<property name="ratingNamingConventions" ref="rollupNamingConventions"/>
<property name="ratingSchemeRegistry" ref="ratingSchemeRegistry"/>
</bean>
<!-- JavaScript API support -->
<bean id="ratingServiceScript" parent="baseJavaScriptExtension"
class="org.alfresco.repo.rating.script.ScriptRatingService">
<property name="extensionName">
<value>ratingService</value>
</property>
<property name="serviceRegistry" ref="ServiceRegistry"/>
</bean>
</beans>