Yannick Pignot (European Commission) multilingual services

- EditionService for versioning of groups of translations
 - Quite a bit of trimming of whitespace that I have no intention of undoing.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5927 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-13 01:13:25 +00:00
parent f4c758dfe5
commit 9e836f04f8
23 changed files with 1835 additions and 1067 deletions

View File

@@ -2,9 +2,9 @@
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans> <beans>
<!-- File/folder specific service --> <!-- File/folder specific service -->
<bean name="fileFolderService" class="org.alfresco.repo.model.filefolder.FileFolderServiceImpl" init-method="init"> <bean name="fileFolderService" class="org.alfresco.repo.model.filefolder.FileFolderServiceImpl" init-method="init">
<property name="namespaceService"><ref bean="namespaceService" /></property> <property name="namespaceService"><ref bean="namespaceService" /></property>
<property name="dictionaryService"><ref bean="dictionaryService" /></property> <property name="dictionaryService"><ref bean="dictionaryService" /></property>
@@ -39,7 +39,7 @@
</property> </property>
</bean> </bean>
<bean id="mlContentInterceptor" class="org.alfresco.repo.model.ml.MLContentInterceptor" > <bean id="mlContentInterceptor" class="org.alfresco.repo.model.ml.MLContentInterceptor" >
<property name="nodeService"> <property name="nodeService">
<ref bean="nodeService"/> <ref bean="nodeService"/>
</property> </property>
@@ -50,8 +50,8 @@
<ref bean="multilingualContentService"/> <ref bean="multilingualContentService"/>
</property> </property>
</bean> </bean>
<bean name="tempFileMarkerInterceptor" class="org.alfresco.repo.model.filefolder.TempFileMarkerInterceptor"> <bean name="tempFileMarkerInterceptor" class="org.alfresco.repo.model.filefolder.TempFileMarkerInterceptor">
<property name="nodeService"> <property name="nodeService">
<ref bean="nodeService" /> <ref bean="nodeService" />
@@ -64,7 +64,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Multilingual specific service --> <!-- Multilingual specific service -->
<bean name="multilingualContentService" class="org.alfresco.repo.model.ml.MultilingualContentServiceImpl" > <bean name="multilingualContentService" class="org.alfresco.repo.model.ml.MultilingualContentServiceImpl" >
<property name="nodeService"> <property name="nodeService">
@@ -73,9 +73,6 @@
<property name="searchService"> <property name="searchService">
<ref bean="admSearchService" /> <ref bean="admSearchService" />
</property> </property>
<property name="versionService">
<ref bean="versionService" />
</property>
<property name="permissionService"> <property name="permissionService">
<ref bean="permissionService" /> <ref bean="permissionService" />
</property> </property>
@@ -87,4 +84,29 @@
</property> </property>
</bean> </bean>
<!-- Edition service -->
<bean name="editionService" class="org.alfresco.repo.model.ml.EditionServiceImpl" >
<property name="nodeService">
<ref bean="NodeService" />
</property>
<property name="versionService">
<ref bean="VersionService" />
</property>
<property name="multilingualContentService">
<ref bean="MultilingualContentService" />
</property>
<property name="versionNodeService">
<ref bean="versionNodeService" />
</property>
<property name="policyBehaviourFilter">
<ref bean="policyBehaviourFilter" />
</property>
<property name="nodeArchiveService">
<ref bean="nodeArchiveService" />
</property>
<property name="fileFolderService">
<ref bean="FileFolderService" />
</property>
</bean>
</beans> </beans>

View File

@@ -1,19 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans> <beans>
<import resource="classpath:alfresco/public-services-security-context.xml"/> <import resource="classpath:alfresco/public-services-security-context.xml"/>
<!-- Service Registry --> <!-- Service Registry -->
<bean id="ServiceRegistry" class="org.alfresco.repo.service.ServiceDescriptorRegistry" /> <bean id="ServiceRegistry" class="org.alfresco.repo.service.ServiceDescriptorRegistry" />
<!-- Exception Translation --> <!-- Exception Translation -->
<bean id="exceptionTranslator" class="org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor"/> <bean id="exceptionTranslator" class="org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor"/>
<!-- Descriptor Service --> <!-- Descriptor Service -->
<bean id="DescriptorService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="DescriptorService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.descriptor.DescriptorService</value> <value>org.alfresco.service.descriptor.DescriptorService</value>
@@ -27,9 +27,9 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- AuditMethodInterceptor --> <!-- AuditMethodInterceptor -->
<bean id="AuditMethodInterceptor" class="org.alfresco.repo.audit.AuditMethodInterceptor"> <bean id="AuditMethodInterceptor" class="org.alfresco.repo.audit.AuditMethodInterceptor">
<property name="auditComponent"> <property name="auditComponent">
<ref bean="auditComponent"/> <ref bean="auditComponent"/>
@@ -38,22 +38,22 @@
<value>false</value> <value>false</value>
</property> </property>
</bean> </bean>
<!-- Namespace Service --> <!-- Namespace Service -->
<alias name="namespaceService" alias="NamespaceService"/> <alias name="namespaceService" alias="NamespaceService"/>
<!-- Transaction Service --> <!-- Transaction Service -->
<alias alias="TransactionService" name="transactionComponent"/> <alias alias="TransactionService" name="transactionComponent"/>
<!-- Dictionary Service --> <!-- Dictionary Service -->
<alias name="dictionaryService" alias="DictionaryService"/> <alias name="dictionaryService" alias="DictionaryService"/>
<!-- Node Service --> <!-- Node Service -->
<bean id="NodeService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="NodeService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<list> <list>
@@ -76,7 +76,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="NodeService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="NodeService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -90,9 +90,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Content Service --> <!-- Content Service -->
<bean id="ContentService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ContentService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.repository.ContentService</value> <value>org.alfresco.service.cmr.repository.ContentService</value>
@@ -110,7 +110,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ContentService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ContentService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -121,17 +121,17 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Mime Type Service --> <!-- Mime Type Service -->
<alias name="mimetypeService" alias="MimetypeService"/> <alias name="mimetypeService" alias="MimetypeService"/>
<!-- Content Filter Languages Service --> <!-- Content Filter Languages Service -->
<alias name="contentFilterLanguagesService" alias="ContentFilterLanguagesService"/> <alias name="contentFilterLanguagesService" alias="ContentFilterLanguagesService"/>
<!-- Search Service --> <!-- Search Service -->
<bean id="SearchService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="SearchService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.search.SearchService</value> <value>org.alfresco.service.cmr.search.SearchService</value>
@@ -148,8 +148,8 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ADMSearchService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ADMSearchService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.search.SearchService</value> <value>org.alfresco.service.cmr.search.SearchService</value>
</property> </property>
@@ -165,7 +165,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="SearchService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="SearchService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -176,9 +176,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Category Service --> <!-- Category Service -->
<bean id="CategoryService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="CategoryService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.search.CategoryService</value> <value>org.alfresco.service.cmr.search.CategoryService</value>
@@ -195,7 +195,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="CategoryService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="CategoryService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -206,9 +206,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Copy Service --> <!-- Copy Service -->
<bean id="CopyService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="CopyService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.repository.CopyService</value> <value>org.alfresco.service.cmr.repository.CopyService</value>
@@ -225,7 +225,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="CopyService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="CopyService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -236,9 +236,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Lock Service --> <!-- Lock Service -->
<bean id="LockService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="LockService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.lock.LockService</value> <value>org.alfresco.service.cmr.lock.LockService</value>
@@ -255,7 +255,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="LockService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="LockService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -266,9 +266,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Version Service --> <!-- Version Service -->
<bean id="VersionService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="VersionService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.version.VersionService</value> <value>org.alfresco.service.cmr.version.VersionService</value>
@@ -285,7 +285,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="VersionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="VersionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -296,9 +296,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- COCI Service --> <!-- COCI Service -->
<bean id="CheckoutCheckinService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="CheckoutCheckinService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.coci.CheckOutCheckInService</value> <value>org.alfresco.service.cmr.coci.CheckOutCheckInService</value>
@@ -315,7 +315,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="CheckoutCheckinService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="CheckoutCheckinService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -326,9 +326,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Rule Service --> <!-- Rule Service -->
<bean id="RuleService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="RuleService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.rule.RuleService</value> <value>org.alfresco.service.cmr.rule.RuleService</value>
@@ -345,7 +345,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="RuleService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="RuleService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -356,9 +356,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Importer Service --> <!-- Importer Service -->
<bean id="ImporterService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ImporterService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.view.ImporterService</value> <value>org.alfresco.service.cmr.view.ImporterService</value>
@@ -375,7 +375,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ImporterService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ImporterService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -386,9 +386,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Exporter Service --> <!-- Exporter Service -->
<bean id="ExporterService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ExporterService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.view.ExporterService</value> <value>org.alfresco.service.cmr.view.ExporterService</value>
@@ -403,7 +403,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ExporterService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ExporterService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -414,9 +414,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Action Service --> <!-- Action Service -->
<bean id="ActionService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ActionService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.action.ActionService</value> <value>org.alfresco.service.cmr.action.ActionService</value>
@@ -433,7 +433,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ActionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ActionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -444,9 +444,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Permission Service --> <!-- Permission Service -->
<bean id="PermissionService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="PermissionService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.security.PermissionService</value> <value>org.alfresco.service.cmr.security.PermissionService</value>
@@ -463,7 +463,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="PermissionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="PermissionService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -474,9 +474,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Authority Service --> <!-- Authority Service -->
<bean id="AuthorityService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="AuthorityService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.security.AuthorityService</value> <value>org.alfresco.service.cmr.security.AuthorityService</value>
@@ -493,7 +493,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="AuthorityService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="AuthorityService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -504,9 +504,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Ownable Service --> <!-- Ownable Service -->
<bean id="OwnableService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="OwnableService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.security.OwnableService</value> <value>org.alfresco.service.cmr.security.OwnableService</value>
@@ -523,7 +523,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="OwnableService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="OwnableService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -534,9 +534,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Person Service --> <!-- Person Service -->
<bean id="PersonService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="PersonService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.security.PersonService</value> <value>org.alfresco.service.cmr.security.PersonService</value>
@@ -553,7 +553,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="PersonService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="PersonService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -564,9 +564,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Authentication Service --> <!-- Authentication Service -->
<bean id="AuthenticationService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="AuthenticationService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.security.AuthenticationService</value> <value>org.alfresco.service.cmr.security.AuthenticationService</value>
@@ -583,7 +583,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="AuthenticationService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="AuthenticationService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -600,9 +600,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Template Service --> <!-- Template Service -->
<bean id="TemplateService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="TemplateService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.repository.TemplateService</value> <value>org.alfresco.service.cmr.repository.TemplateService</value>
@@ -619,7 +619,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="TemplateService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="TemplateService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -630,9 +630,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Script Service --> <!-- Script Service -->
<bean id="ScriptService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ScriptService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.repository.ScriptService</value> <value>org.alfresco.service.cmr.repository.ScriptService</value>
@@ -649,7 +649,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ScriptService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ScriptService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -660,9 +660,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- File/Folder Service --> <!-- File/Folder Service -->
<bean id="FileFolderService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="FileFolderService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.model.FileFolderService</value> <value>org.alfresco.service.cmr.model.FileFolderService</value>
@@ -682,7 +682,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="FileFolderService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="FileFolderService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -697,9 +697,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- The CrossRepositoryCopyService --> <!-- The CrossRepositoryCopyService -->
<bean id="crossRepositoryCopyService" class="org.alfresco.repo.copy.CrossRepositoryCopyServiceImpl"> <bean id="crossRepositoryCopyService" class="org.alfresco.repo.copy.CrossRepositoryCopyServiceImpl">
<property name="avmService"> <property name="avmService">
<ref bean="indexingAVMService"/> <ref bean="indexingAVMService"/>
@@ -718,9 +718,9 @@
</property> </property>
<property name="dictionaryService"> <property name="dictionaryService">
<ref bean="dictionaryService"/> <ref bean="dictionaryService"/>
</property> </property>
</bean> </bean>
<bean id="crossRepositoryCopyServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="crossRepositoryCopyServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
<ref bean="retryingWriteTxnAdvice"/> <ref bean="retryingWriteTxnAdvice"/>
@@ -731,7 +731,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="CrossRepositoryCopyService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="CrossRepositoryCopyService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<list> <list>
@@ -747,9 +747,9 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- The AVMService --> <!-- The AVMService -->
<bean id="avmService" class="org.alfresco.repo.avm.AVMServiceImpl"> <bean id="avmService" class="org.alfresco.repo.avm.AVMServiceImpl">
<property name="avmRepository"> <property name="avmRepository">
<ref bean="avmRepository"/> <ref bean="avmRepository"/>
@@ -758,7 +758,7 @@
<ref bean="lookupCacheListener"/> <ref bean="lookupCacheListener"/>
</property> </property>
</bean> </bean>
<bean id="avmServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="avmServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
<ref bean="retryingReadTxnAdvice"/> <ref bean="retryingReadTxnAdvice"/>
@@ -848,7 +848,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="AVMService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="AVMService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<list> <list>
@@ -881,7 +881,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="avmSnapShotTriggeredIndexingMethodInterceptor" class="org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor"> <bean id="avmSnapShotTriggeredIndexingMethodInterceptor" class="org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor">
<property name="avmService"> <property name="avmService">
<ref bean="avmService" /> <ref bean="avmService" />
@@ -892,27 +892,27 @@
<property name="enableIndexing"> <property name="enableIndexing">
<value>true</value> <value>true</value>
</property> </property>
<property name="defaultMode"> <property name="defaultMode">
<value>SYNCHRONOUS</value> <value>SYNCHRONOUS</value>
</property> </property>
<property name="indexingDefinitions"> <property name="indexingDefinitions">
<list> <list>
<value>SYNCHRONOUS:TYPE:STAGING</value> <value>SYNCHRONOUS:TYPE:STAGING</value>
<value>UNINDEXED:TYPE:STAGING_PREVIEW</value> <value>UNINDEXED:TYPE:STAGING_PREVIEW</value>
<value>UNINDEXED:TYPE:AUTHOR</value> <value>UNINDEXED:TYPE:AUTHOR</value>
<value>UNINDEXED:TYPE:AUTHOR_PREVIEW</value> <value>UNINDEXED:TYPE:AUTHOR_PREVIEW</value>
<value>UNINDEXED:TYPE:WORKFLOW</value> <value>UNINDEXED:TYPE:WORKFLOW</value>
<value>UNINDEXED:TYPE:WORKFLOW_PREVIEW</value> <value>UNINDEXED:TYPE:WORKFLOW_PREVIEW</value>
<value>UNINDEXED:TYPE:AUTHOR_WORKFLOW</value> <value>UNINDEXED:TYPE:AUTHOR_WORKFLOW</value>
<value>UNINDEXED:TYPE:AUTHOR_WORKFLOW_PREVIEW</value> <value>UNINDEXED:TYPE:AUTHOR_WORKFLOW_PREVIEW</value>
<value>ASYNCHRONOUS:NAME:avmAsynchronousTest</value> <value>ASYNCHRONOUS:NAME:avmAsynchronousTest</value>
<value>SYNCHRONOUS:NAME:.*</value> <value>SYNCHRONOUS:NAME:.*</value>
</list> </list>
</property> </property>
</bean> </bean>
<!-- The AVMSyncService --> <!-- The AVMSyncService -->
<bean id="avmSyncService" class="org.alfresco.repo.avm.AVMSyncServiceImpl"> <bean id="avmSyncService" class="org.alfresco.repo.avm.AVMSyncServiceImpl">
<property name="avmService"> <property name="avmService">
<ref bean="indexingAVMService"/> <ref bean="indexingAVMService"/>
@@ -921,7 +921,7 @@
<ref bean="avmRepository"/> <ref bean="avmRepository"/>
</property> </property>
</bean> </bean>
<!-- Read transaction advisor for sync service. --> <!-- Read transaction advisor for sync service. -->
<bean id="avmSyncServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="avmSyncServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
@@ -933,7 +933,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Write transaction advisor for sync service. --> <!-- Write transaction advisor for sync service. -->
<bean id="avmSyncServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="avmSyncServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
@@ -966,7 +966,7 @@
</bean> </bean>
<!-- Attribute Service --> <!-- Attribute Service -->
<!-- Read transaction advisor for attribute service. --> <!-- Read transaction advisor for attribute service. -->
<bean id="attributeServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="attributeServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
@@ -982,7 +982,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Write transaction advisor for attribute service. --> <!-- Write transaction advisor for attribute service. -->
<bean id="attributeServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="attributeServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
@@ -1018,7 +1018,7 @@
</bean> </bean>
<!-- Deployment Service. --> <!-- Deployment Service. -->
<bean id="deploymentService" class="org.alfresco.repo.deploy.DeploymentServiceImpl"> <bean id="deploymentService" class="org.alfresco.repo.deploy.DeploymentServiceImpl">
<property name="avmService"> <property name="avmService">
<ref bean="indexingAVMService"/> <ref bean="indexingAVMService"/>
@@ -1037,7 +1037,7 @@
</property> </property>
</bean> </bean>
--> -->
<bean id="deploymentServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="deploymentServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
<ref bean="retryingWriteTxnAdvice"/> <ref bean="retryingWriteTxnAdvice"/>
@@ -1068,7 +1068,7 @@
<!-- AVM Locking Service. --> <!-- AVM Locking Service. -->
<bean id="avmLockingServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <bean id="avmLockingServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">
<ref bean="retryingReadTxnAdvice"/> <ref bean="retryingReadTxnAdvice"/>
@@ -1077,9 +1077,9 @@
<list> <list>
<value>getLock</value> <value>getLock</value>
<value>getUserLocks</value> <value>getUserLocks</value>
<value>getWebProjectLocks</value> <value>getWebProjectLocks</value>
<value>getWebProjects</value> <value>getWebProjects</value>
<value>getStoreLocks</value> <value>getStoreLocks</value>
<value>hasAccess</value> <value>hasAccess</value>
</list> </list>
</property> </property>
@@ -1094,9 +1094,9 @@
<value>addWebProject</value> <value>addWebProject</value>
<value>lockPath</value> <value>lockPath</value>
<value>removeLock</value> <value>removeLock</value>
<value>removeWebProject</value> <value>removeWebProject</value>
<value>modifyLock</value> <value>modifyLock</value>
<value>removeStoreLocks</value> <value>removeStoreLocks</value>
</list> </list>
</property> </property>
</bean> </bean>
@@ -1117,9 +1117,9 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Workflow Service --> <!-- Workflow Service -->
<bean id="WorkflowService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="WorkflowService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.workflow.WorkflowService</value> <value>org.alfresco.service.cmr.workflow.WorkflowService</value>
@@ -1136,7 +1136,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="WorkflowService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="WorkflowService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1147,9 +1147,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- Audit Service --> <!-- Audit Service -->
<bean id="AuditService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="AuditService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.audit.AuditService</value> <value>org.alfresco.service.cmr.audit.AuditService</value>
@@ -1166,7 +1166,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="AuditService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="AuditService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1177,10 +1177,10 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- MultilingualContentService --> <!-- MultilingualContentService -->
<bean id="MultilingualContentService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="MultilingualContentService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.ml.MultilingualContentService</value> <value>org.alfresco.service.cmr.ml.MultilingualContentService</value>
@@ -1192,11 +1192,11 @@
<list> <list>
<idref local="MultilingualContentService_transaction"/> <idref local="MultilingualContentService_transaction"/>
<idref local="exceptionTranslator"/> <idref local="exceptionTranslator"/>
<idref bean="MultilingualContentService_security"/> <idref bean="MultilingualContentService_security"/>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="MultilingualContentService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="MultilingualContentService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1209,9 +1209,38 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- EditionService -->
<bean id="EditionService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.service.cmr.ml.EditionService</value>
</property>
<property name="target">
<ref bean="editionService"/>
</property>
<property name="interceptorNames">
<list>
<idref local="EditionService_transaction"/>
<idref bean="EditionService_security"/>
</list>
</property>
</bean>
<bean id="EditionService_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>
<!-- ConfigurableService --> <!-- ConfigurableService -->
<bean id="ConfigurableService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ConfigurableService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.repo.configuration.ConfigurableService</value> <value>org.alfresco.repo.configuration.ConfigurableService</value>
@@ -1225,7 +1254,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ConfigurableService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ConfigurableService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1238,9 +1267,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- RegistryService --> <!-- RegistryService -->
<bean id="RegistryService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="RegistryService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.repo.admin.registry.RegistryService</value> <value>org.alfresco.repo.admin.registry.RegistryService</value>
@@ -1254,7 +1283,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="RegistryService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="RegistryService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1266,9 +1295,9 @@
</props> </props>
</property> </property>
</bean> </bean>
<!-- ModuleService --> <!-- ModuleService -->
<bean id="ModuleService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="ModuleService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"> <property name="proxyInterfaces">
<value>org.alfresco.service.cmr.module.ModuleService</value> <value>org.alfresco.service.cmr.module.ModuleService</value>
@@ -1282,7 +1311,7 @@
</list> </list>
</property> </property>
</bean> </bean>
<bean id="ModuleService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <bean id="ModuleService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"> <property name="transactionManager">
<ref bean="transactionManager"/> <ref bean="transactionManager"/>
@@ -1294,7 +1323,7 @@
</props> </props>
</property> </property>
</bean> </bean>
@@ -1318,8 +1347,8 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Write transaction advisor for link validation service. --> <!-- Write transaction advisor for link validation service. -->
<bean id="linkValidationServiceWriteTxnAdvisor" <bean id="linkValidationServiceWriteTxnAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice"> <property name="advice">

View File

@@ -4,13 +4,13 @@
<!-- ========================== --> <!-- ========================== -->
<!-- Enforcement of permissions --> <!-- Enforcement of permissions -->
<!-- ========================== --> <!-- ========================== -->
<!-- --> <!-- -->
<!-- This file defines the beans that intercept method calls to the repository services --> <!-- This file defines the beans that intercept method calls to the repository services -->
<!-- and enforce security based on the currently authenticated user. --> <!-- and enforce security based on the currently authenticated user. -->
<!-- --> <!-- -->
<beans> <beans>
@@ -38,7 +38,7 @@
</props> </props>
</property> </property>
</bean> </bean>
<bean id="permissionServiceImpl" class="org.alfresco.repo.security.permissions.impl.PermissionServiceImpl"> <bean id="permissionServiceImpl" class="org.alfresco.repo.security.permissions.impl.PermissionServiceImpl">
<property name="nodeService"> <property name="nodeService">
<ref bean="nodeService" /> <ref bean="nodeService" />
@@ -75,19 +75,19 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- =================== --> <!-- =================== -->
<!-- Dynamic Authorities --> <!-- Dynamic Authorities -->
<!-- =================== --> <!-- =================== -->
<!-- The provider to evaluate if the current authentication is the owner of a node. --> <!-- The provider to evaluate if the current authentication is the owner of a node. -->
<bean id="ownerDynamicAuthority" class="org.alfresco.repo.security.permissions.dynamic.OwnerDynamicAuthority"> <bean id="ownerDynamicAuthority" class="org.alfresco.repo.security.permissions.dynamic.OwnerDynamicAuthority">
<property name="ownableService"> <property name="ownableService">
<ref bean="ownableService" /> <ref bean="ownableService" />
</property> </property>
</bean> </bean>
<!-- The provider to evaluate if the currfent authentication is the local owner on a --> <!-- The provider to evaluate if the currfent authentication is the local owner on a -->
<!-- node. --> <!-- node. -->
<bean id="lockOwnerDynamicAuthority" class="org.alfresco.repo.security.permissions.dynamic.LockOwnerDynamicAuthority"> <bean id="lockOwnerDynamicAuthority" class="org.alfresco.repo.security.permissions.dynamic.LockOwnerDynamicAuthority">
@@ -114,43 +114,43 @@
<ref bean="dictionaryService" /> <ref bean="dictionaryService" />
</property> </property>
</bean> </bean>
<!-- ====== --> <!-- ====== -->
<!-- Voters --> <!-- Voters -->
<!-- ====== --> <!-- ====== -->
<!-- A voter to allow access base on the current authentication having authorities --> <!-- A voter to allow access base on the current authentication having authorities -->
<!-- starting with the prefix "ROLE_" --> <!-- starting with the prefix "ROLE_" -->
<!-- Any match grants --> <!-- Any match grants -->
<bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter" abstract="false" singleton="true" <bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default" > lazy-init="default" autowire="default" dependency-check="default" >
<property name="rolePrefix"> <property name="rolePrefix">
<value>ROLE_</value> <value>ROLE_</value>
</property> </property>
</bean> </bean>
<!-- A voter to allow access base on the current authentication having authorities --> <!-- A voter to allow access base on the current authentication having authorities -->
<!-- starting with the prefix "GROUP_" --> <!-- starting with the prefix "GROUP_" -->
<!-- Any match grants --> <!-- Any match grants -->
<bean id="groupVoter" class="net.sf.acegisecurity.vote.RoleVoter" abstract="false" singleton="true" <bean id="groupVoter" class="net.sf.acegisecurity.vote.RoleVoter" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default" > lazy-init="default" autowire="default" dependency-check="default" >
<property name="rolePrefix"> <property name="rolePrefix">
<value>GROUP_</value> <value>GROUP_</value>
</property> </property>
</bean> </bean>
<!-- A voter to allow access based on node access control. --> <!-- A voter to allow access based on node access control. -->
<!-- These start ACL_NODE or ACL_PARENT and are followed by .methodArgumentPosition --> <!-- These start ACL_NODE or ACL_PARENT and are followed by .methodArgumentPosition -->
<!-- then object type (prefix:localname) . permission --> <!-- then object type (prefix:localname) . permission -->
<!-- --> <!-- -->
<!-- All permissions starting ACL_NODE and ACL_PARENT must be present for access to --> <!-- All permissions starting ACL_NODE and ACL_PARENT must be present for access to -->
<!-- be granted. --> <!-- be granted. -->
<!-- --> <!-- -->
<!-- Note: ff the context evaluates to null (e.g. doing an exists test on a node --> <!-- Note: ff the context evaluates to null (e.g. doing an exists test on a node -->
<!-- that does not exist) then access will be allowed. --> <!-- that does not exist) then access will be allowed. -->
<bean id="aclEntryVoter" class="org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoter" abstract="false" singleton="true" <bean id="aclEntryVoter" class="org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoter" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default" > lazy-init="default" autowire="default" dependency-check="default" >
<property name="permissionService"> <property name="permissionService">
@@ -161,7 +161,7 @@
</property> </property>
<property name="nodeService"> <property name="nodeService">
<ref bean="nodeService"></ref> <ref bean="nodeService"></ref>
</property> </property>
<property name="authenticationService"> <property name="authenticationService">
<ref bean="authenticationService" /> <ref bean="authenticationService" />
</property> </property>
@@ -169,15 +169,15 @@
<ref bean="authorityService" /> <ref bean="authorityService" />
</property> </property>
</bean> </bean>
<!-- ======================= --> <!-- ======================= -->
<!-- Access decision manager --> <!-- Access decision manager -->
<!-- ======================= --> <!-- ======================= -->
<!-- The access decision manager asks voters in order if they should allow access --> <!-- The access decision manager asks voters in order if they should allow access -->
<!-- Role and group access do not require ACL based access --> <!-- Role and group access do not require ACL based access -->
<bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased"> <bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions"><value>false</value></property> <property name="allowIfAllAbstainDecisions"><value>false</value></property>
<property name="decisionVoters"> <property name="decisionVoters">
@@ -188,11 +188,11 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- ======================================== --> <!-- ======================================== -->
<!-- Post method call application of security --> <!-- Post method call application of security -->
<!-- ======================================== --> <!-- ======================================== -->
<bean id="afterAcl" class="org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider" abstract="false" singleton="true" <bean id="afterAcl" class="org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default" > lazy-init="default" autowire="default" dependency-check="default" >
<property name="permissionService"> <property name="permissionService">
@@ -203,7 +203,7 @@
</property> </property>
<property name="nodeService"> <property name="nodeService">
<ref bean="nodeService"></ref> <ref bean="nodeService"></ref>
</property> </property>
<property name="authenticationService"> <property name="authenticationService">
<ref bean="authenticationServiceImpl" /> <ref bean="authenticationServiceImpl" />
</property> </property>
@@ -214,9 +214,9 @@
<value>${system.acl.maxPermissionChecks}</value> <value>${system.acl.maxPermissionChecks}</value>
</property> </property>
</bean> </bean>
<!-- Link up after method call security --> <!-- Link up after method call security -->
<bean id="afterInvocationManager" class="net.sf.acegisecurity.afterinvocation.AfterInvocationProviderManager"> <bean id="afterInvocationManager" class="net.sf.acegisecurity.afterinvocation.AfterInvocationProviderManager">
<property name="providers"> <property name="providers">
<list> <list>
@@ -224,41 +224,41 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- ================================ --> <!-- ================================ -->
<!-- Beans that enforce secure access --> <!-- Beans that enforce secure access -->
<!-- ================================ --> <!-- ================================ -->
<!-- Each bean defines a new methos security interceptor wired up with the --> <!-- Each bean defines a new methos security interceptor wired up with the -->
<!-- authenticationManager, accessDecisionManager and afterInvocationManager, which --> <!-- authenticationManager, accessDecisionManager and afterInvocationManager, which -->
<!-- can all be reused. --> <!-- can all be reused. -->
<!-- If one method cal requires security enforcement - all methods must gave a --> <!-- If one method cal requires security enforcement - all methods must gave a -->
<!-- security entry of some sort. ACL_ALLOW can be used to give access to all --> <!-- security entry of some sort. ACL_ALLOW can be used to give access to all -->
<!-- ROLE_ADMINISTRATOR can be used to grant access to administrator related methods --> <!-- ROLE_ADMINISTRATOR can be used to grant access to administrator related methods -->
<!-- The namespace service does not enforce any security requirements --> <!-- The namespace service does not enforce any security requirements -->
<bean id="NamespaceService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="NamespaceService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- The dictionary service does not enforce any security requirements --> <!-- The dictionary service does not enforce any security requirements -->
<bean id="DictionaryService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="DictionaryService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ======================== --> <!-- ======================== -->
<!-- Node service permissions --> <!-- Node service permissions -->
<!-- ======================== --> <!-- ======================== -->
<!-- See the NodeService for the parameters required for each method call. --> <!-- See the NodeService for the parameters required for each method call. -->
<!-- --> <!-- -->
<!-- getStores --> <!-- getStores -->
<!-- returns a list fo the stores to which the curent authentication has Read --> <!-- returns a list fo the stores to which the curent authentication has Read -->
<!-- permission. (See the permission model defintion for what this means) --> <!-- permission. (See the permission model defintion for what this means) -->
<!-- createStore --> <!-- createStore -->
<!-- only a user with the administrator role can create new stores --> <!-- only a user with the administrator role can create new stores -->
<!-- exists --> <!-- exists -->
<!-- check if a node exists. If the current user does not have read access then --> <!-- check if a node exists. If the current user does not have read access then -->
<!-- the node will not exist. --> <!-- the node will not exist. -->
<!-- getRootNode --> <!-- getRootNode -->
<!-- get the root node for a store - access will be denied for users who do not --> <!-- get the root node for a store - access will be denied for users who do not -->
<!-- have Read permission for the root node of the store. --> <!-- have Read permission for the root node of the store. -->
@@ -272,20 +272,20 @@
<!-- required write properties permission on the parent --> <!-- required write properties permission on the parent -->
<!-- getType --> <!-- getType -->
<!-- obtaining the type of a node requires read access --> <!-- obtaining the type of a node requires read access -->
<!-- addAspect --> <!-- addAspect -->
<!-- adding an aspect updates a multi-valued property so this requires write --> <!-- adding an aspect updates a multi-valued property so this requires write -->
<!-- access to properties. --> <!-- access to properties. -->
<!-- removeAspect --> <!-- removeAspect -->
<!-- removing an aspect updates a multi-valued property so this requires write --> <!-- removing an aspect updates a multi-valued property so this requires write -->
<!-- access to properties. --> <!-- access to properties. -->
<!-- hasAspect --> <!-- hasAspect -->
<!-- querying for an aspect requires read access to a property --> <!-- querying for an aspect requires read access to a property -->
<!-- getAspects --> <!-- getAspects -->
<!-- querying for all aspect requires read access to a property --> <!-- querying for all aspect requires read access to a property -->
<!-- deleteNode --> <!-- deleteNode -->
<!-- requires the delete permission --> <!-- requires the delete permission -->
<!-- addChild --> <!-- addChild -->
<!-- requires create children on the parent --> <!-- requires create children on the parent -->
<!-- removeChild --> <!-- removeChild -->
<!-- Requires delete children from the parent and delete for the child --> <!-- Requires delete children from the parent and delete for the child -->
<!-- removeChildAssociation --> <!-- removeChildAssociation -->
@@ -306,7 +306,7 @@
<!-- It is possible that no children are accessible --> <!-- It is possible that no children are accessible -->
<!-- getPrimaryParent --> <!-- getPrimaryParent -->
<!-- Requires read on the node an aceess error will be thrown if the primary --> <!-- Requires read on the node an aceess error will be thrown if the primary -->
<!-- parent can not be read --> <!-- parent can not be read -->
<!-- createAssociation --> <!-- createAssociation -->
<!-- NOT SET YET --> <!-- NOT SET YET -->
<!-- removeAssociation --> <!-- removeAssociation -->
@@ -319,8 +319,8 @@
<!-- Requires read for the node --> <!-- Requires read for the node -->
<!-- getPaths --> <!-- getPaths -->
<!-- Requires read for the node --> <!-- Requires read for the node -->
<bean id="NodeService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="NodeService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -365,11 +365,11 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ============================== --> <!-- ============================== -->
<!-- FileFolder Service Permissions --> <!-- FileFolder Service Permissions -->
<!-- ============================== --> <!-- ============================== -->
<bean id="FileFolderService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="FileFolderService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -395,14 +395,14 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- =========================== --> <!-- =========================== -->
<!-- Content Service Permissions --> <!-- Content Service Permissions -->
<!-- =========================== --> <!-- =========================== -->
<!-- Reading requires the permission to read content --> <!-- Reading requires the permission to read content -->
<!-- Writing required the permission to write conent --> <!-- Writing required the permission to write conent -->
<bean id="ContentService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="ContentService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -420,22 +420,22 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ================ --> <!-- ================ -->
<!-- MimeType Service --> <!-- MimeType Service -->
<!-- ================ --> <!-- ================ -->
<!-- There are no permissions around mime types --> <!-- There are no permissions around mime types -->
<bean id="MimetypeService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="MimetypeService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ============== --> <!-- ============== -->
<!-- Search Service --> <!-- Search Service -->
<!-- ============== --> <!-- ============== -->
<!-- All search results are filtered to exclude nodes that the current user can not --> <!-- All search results are filtered to exclude nodes that the current user can not -->
<!-- read. Other methods restrict queries to those nodes the user can read --> <!-- read. Other methods restrict queries to those nodes the user can read -->
<bean id="SearchService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="SearchService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -450,14 +450,14 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ================ --> <!-- ================ -->
<!-- Category Service --> <!-- Category Service -->
<!-- ================ --> <!-- ================ -->
<!-- Category queries are filtered for nodes that are visible to the current user --> <!-- Category queries are filtered for nodes that are visible to the current user -->
<!-- Other methods are unrestricted at the moment --> <!-- Other methods are unrestricted at the moment -->
<bean id="CategoryService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="CategoryService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -477,24 +477,24 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ============ --> <!-- ============ -->
<!-- Copy Service --> <!-- Copy Service -->
<!-- ============ --> <!-- ============ -->
<!-- The copy service does not require any security restrictions, they are imposed --> <!-- The copy service does not require any security restrictions, they are imposed -->
<!-- by the node service it uses to do its work. --> <!-- by the node service it uses to do its work. -->
<bean id="CopyService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="CopyService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ================ --> <!-- ================ -->
<!-- The Lock Service --> <!-- The Lock Service -->
<!-- ================ --> <!-- ================ -->
<!-- Lock and Unlock require the related aspect specific permissions. Querying the --> <!-- Lock and Unlock require the related aspect specific permissions. Querying the -->
<!-- lock status just requires read access to the node. --> <!-- lock status just requires read access to the node. -->
<bean id="LockService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="LockService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -510,23 +510,23 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- =============== --> <!-- =============== -->
<!-- Version Service --> <!-- Version Service -->
<!-- =============== --> <!-- =============== -->
<!-- The version service does not have any restrictions applied at the moment. It --> <!-- The version service does not have any restrictions applied at the moment. It -->
<!-- does not use a node service that would apply any permissions. --> <!-- does not use a node service that would apply any permissions. -->
<bean id="VersionService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="VersionService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- =============================== --> <!-- =============================== -->
<!-- Multilingual Content Service --> <!-- Multilingual Content Service -->
<!-- =============================== --> <!-- =============================== -->
<!-- The version service does not have any restrictions applied at the moment. It --> <!-- The version service does not have any restrictions applied at the moment. It -->
<!-- does not use a node service that would apply any permissions. --> <!-- does not use a node service that would apply any permissions. -->
<bean id="MultilingualContentService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="MultilingualContentService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -543,19 +543,39 @@
org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=ACL_NODE.0.sys:base.Write org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=ACL_NODE.0.sys:base.Write
org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.1.sys:base.Write org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.1.sys:base.Write
org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.0.sys:base.CreateChildren org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.0.sys:base.CreateChildren
org.alfresco.service.cmr.ml.MultilingualContentService.createEdition=ACL_NODE.0.sys:base.Write org.alfresco.service.cmr.ml.MultilingualContentService.copyTranslationContainer=ACL_NODE.0.sys:base.Read,ACL_NODE.1.sys:base.CreateChildren
org.alfresco.service.cmr.ml.MultilingualContentService.moveTranslationContainer=ACL_NODE.0.sys:base.DeleteNode,ACL_NODE.1.sys:base.CreateChildren
</value> </value>
</property> </property>
</bean> </bean>
<!-- =================== -->
<!-- Edition Service -->
<!-- =================== -->
<bean id="EditionService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
<property name="objectDefinitionSource">
<value>
org.alfresco.service.cmr.ml.EditionService.createEdition=ACL_NODE.0.sys:base.Read
org.alfresco.service.cmr.ml.EditionService.getEditions=ACL_NODE.0.sys:base.Read
org.alfresco.service.cmr.ml.EditionService.getVersionedTranslations=ACL_ALLOW
org.alfresco.service.cmr.ml.EditionService.getVersionedMetadatas=ACL_ALLOW
</value>
</property>
</bean>
<!-- ============================== --> <!-- ============================== -->
<!-- The Check-out/Check-in service --> <!-- The Check-out/Check-in service -->
<!-- ============================== --> <!-- ============================== -->
<!-- To check out a node requires that you have permission to check out the node and --> <!-- To check out a node requires that you have permission to check out the node and -->
<!-- create the working copy in the specified location. Check in requires the --> <!-- create the working copy in the specified location. Check in requires the -->
<!-- the associated permission, as does cancel check out. See the permission model --> <!-- the associated permission, as does cancel check out. See the permission model -->
<!-- for how these permissions are granted. --> <!-- for how these permissions are granted. -->
<bean id="CheckoutCheckinService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="CheckoutCheckinService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -568,42 +588,42 @@
org.alfresco.service.cmr.coci.CheckOutCheckInService.getWorkingCopy=ACL_NODE.0.sys:base.Read org.alfresco.service.cmr.coci.CheckOutCheckInService.getWorkingCopy=ACL_NODE.0.sys:base.Read
</value> </value>
</property> </property>
</bean> </bean>
<!-- ================ --> <!-- ================ -->
<!-- The Rule Service --> <!-- The Rule Service -->
<!-- ================ --> <!-- ================ -->
<!-- The rule service does not require any security restrictions, they are imposed --> <!-- The rule service does not require any security restrictions, they are imposed -->
<!-- by the node service it uses to do its work. --> <!-- by the node service it uses to do its work. -->
<bean id="RuleService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="RuleService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ==================== --> <!-- ==================== -->
<!-- The Importer Service --> <!-- The Importer Service -->
<!-- ==================== --> <!-- ==================== -->
<!-- The importer service does not require any security restrictions, they are --> <!-- The importer service does not require any security restrictions, they are -->
<!-- imposed by the node service it uses to do its work. --> <!-- imposed by the node service it uses to do its work. -->
<bean id="ImporterService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="ImporterService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ================== --> <!-- ================== -->
<!-- The Action Service --> <!-- The Action Service -->
<!-- ================== --> <!-- ================== -->
<!-- The action service does not require any security restrictions, they are imposed --> <!-- The action service does not require any security restrictions, they are imposed -->
<!-- by the node service it uses to do its work. --> <!-- by the node service it uses to do its work. -->
<bean id="ActionService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="ActionService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ====================== --> <!-- ====================== -->
<!-- The Permission Service --> <!-- The Permission Service -->
<!-- ====================== --> <!-- ====================== -->
<!-- Requests to this service are controlled by the ReadPermissions and --> <!-- Requests to this service are controlled by the ReadPermissions and -->
<!-- and ChangePermissions permissions. Access to some methods are not restricted at --> <!-- and ChangePermissions permissions. Access to some methods are not restricted at -->
<!-- the moment. --> <!-- the moment. -->
<bean id="PermissionService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="PermissionService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -626,13 +646,13 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ===================== --> <!-- ===================== -->
<!-- The Authority Service --> <!-- The Authority Service -->
<!-- ===================== --> <!-- ===================== -->
<!-- This service currently has no restrictions. --> <!-- This service currently has no restrictions. -->
<bean id="AuthorityService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="AuthorityService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -655,11 +675,11 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- =============================================== --> <!-- =============================================== -->
<!-- The Authentication Service security interceptor --> <!-- The Authentication Service security interceptor -->
<!-- =============================================== --> <!-- =============================================== -->
<!-- NOTE: Authentication is excluded as it sets or clears authentication --> <!-- NOTE: Authentication is excluded as it sets or clears authentication -->
<!-- The same for validate ticaket --> <!-- The same for validate ticaket -->
<!-- Update authentication checks internally --> <!-- Update authentication checks internally -->
@@ -690,14 +710,14 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- =================== --> <!-- =================== -->
<!-- The Ownable Service --> <!-- The Ownable Service -->
<!-- =================== --> <!-- =================== -->
<!-- This service currently has no restrictions. --> <!-- This service currently has no restrictions. -->
<!-- TODO: respect the permissions on the ownable service --> <!-- TODO: respect the permissions on the ownable service -->
<bean id="OwnableService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="OwnableService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -711,10 +731,10 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- Person Service --> <!-- Person Service -->
<bean id="PersonService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="PersonService_security" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
@@ -737,37 +757,37 @@
</value> </value>
</property> </property>
</bean> </bean>
<!-- ==================== --> <!-- ==================== -->
<!-- The Template Service --> <!-- The Template Service -->
<!-- ==================== --> <!-- ==================== -->
<!-- This service currently has no restrictions. --> <!-- This service currently has no restrictions. -->
<bean id="TemplateService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="TemplateService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ==================== --> <!-- ==================== -->
<!-- The Script Service --> <!-- The Script Service -->
<!-- ==================== --> <!-- ==================== -->
<!-- This service currently has no restrictions. --> <!-- This service currently has no restrictions. -->
<bean id="ScriptService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="ScriptService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ================ --> <!-- ================ -->
<!-- Workflow Service --> <!-- Workflow Service -->
<!-- ================ --> <!-- ================ -->
<!-- TODO: Add workflow security --> <!-- TODO: Add workflow security -->
<bean id="WorkflowService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="WorkflowService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
<!-- ============= --> <!-- ============= -->
<!-- Audit Service --> <!-- Audit Service -->
<!-- ============= --> <!-- ============= -->
<!-- TODO: Add audit security --> <!-- TODO: Add audit security -->
<bean id="AuditService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" /> <bean id="AuditService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
</beans> </beans>

View File

@@ -45,7 +45,7 @@ import org.apache.commons.logging.LogFactory;
* *
* {@link org.alfresco.service.cmr.ml.ContentFilterLanguagesService Content Filter Languages Service} * {@link org.alfresco.service.cmr.ml.ContentFilterLanguagesService Content Filter Languages Service}
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class ContentFilterLanguagesMap implements ContentFilterLanguagesService public class ContentFilterLanguagesMap implements ContentFilterLanguagesService
{ {

View File

@@ -0,0 +1,420 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.model.ml;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.repo.version.common.VersionUtil;
import org.alfresco.service.cmr.ml.EditionService;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileNotFoundException;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Edition support implementation
*
* @author Yannick Pignot
*/
public class EditionServiceImpl implements EditionService
{
private static Log logger = LogFactory.getLog(EditionServiceImpl.class);
private VersionService versionService;
private NodeService nodeService;
private BehaviourFilter policyBehaviourFilter;
private MultilingualContentService multilingualContentService;
private NodeArchiveService nodeArchiveService;
private NodeService versionNodeService;
private FileFolderService fileFolderService;
/**
* List of properties to set persistent when an edition of the mlContainer is created
*/
public static final QName[] ML_CONTAINER_PROPERTIES_TO_VERSION = {
ContentModel.PROP_AUTHOR,
ContentModel.PROP_LOCALE
};
/** @inheritDoc */
public NodeRef createEdition(NodeRef startingTranslationNodeRef, Map<String, Serializable> versionProperties)
{
if (nodeService.hasAspect(startingTranslationNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
return createEditionImpl(
startingTranslationNodeRef,
versionProperties
);
}
else
{
throw new IllegalArgumentException("The node " + startingTranslationNodeRef + " is not multilingual.");
}
}
private NodeRef createEditionImpl(NodeRef startingTranslationNodeRef, Map<String, Serializable> versionProperties)
{
// 1. First step: prepare and version the mlContainer
// Get the ml container to version
NodeRef mlContainerToVersion = multilingualContentService.getTranslationContainer(startingTranslationNodeRef);
// Get all the container's children
List<ChildAssociationRef> childAssocRefs = nodeService.getChildAssocs(
mlContainerToVersion, ContentModel.ASSOC_MULTILINGUAL_CHILD,
RegexQNamePattern.MATCH_ALL);
// get the last edition and add it the Version Histories property to the version
Version currentEdition = versionService.getCurrentVersion(mlContainerToVersion);
addVersionHitoryProperty(currentEdition, childAssocRefs);
if(versionProperties == null)
{
versionProperties = new HashMap<String, Serializable>();
}
// get the properties to add to the edition history
addPropertiesToVersion(versionProperties, mlContainerToVersion);
// Version the container and its translations
versionService.createVersion(mlContainerToVersion, versionProperties, true);
// 2. Third step: prepare the current edition of the mlContainer
// Get the new starting point node, it will be returned
NodeRef startNode;
// copy the translation before its deletion and get usefull properties
NodeRef space = nodeService.getPrimaryParent(startingTranslationNodeRef).getParentRef();
String name = (String) nodeService.getProperty(startingTranslationNodeRef, ContentModel.PROP_NAME);
Locale locale = (Locale) nodeService.getProperty(startingTranslationNodeRef, ContentModel.PROP_LOCALE);
String author = (String) nodeService.getProperty(startingTranslationNodeRef, ContentModel.PROP_AUTHOR);
for (int count = 0;; count++)
{
try
{
// genererate a temporary name.
String tempName = "TEMP_NAME" + System.currentTimeMillis() + "_" + count;
// try to copy the node
startNode = fileFolderService.copy(startingTranslationNodeRef, space, tempName).getNodeRef();
// copy completed without exception
break;
}
catch (FileExistsException e)
{
// try again with a new name
}
catch (FileNotFoundException e)
{
throw new IllegalStateException(e);
}
}
// remove the current translations of the mlContainer
removeTranslations(childAssocRefs);
// restore the original name of the node
nodeService.setProperty(startNode, ContentModel.PROP_NAME, name);
// add the starting node to the mlContainer, and set the author
multilingualContentService.addTranslation(startNode, mlContainerToVersion, locale);
nodeService.setProperty(startNode, ContentModel.PROP_AUTHOR, author);
// set the starting translation become the pivot.
nodeService.setProperty(mlContainerToVersion, ContentModel.PROP_LOCALE, locale);
nodeService.setProperty(mlContainerToVersion, ContentModel.PROP_AUTHOR, author);
// Done
if (logger.isDebugEnabled())
{
// Get the version information
Version mlContainerVersion = versionService.getCurrentVersion(mlContainerToVersion);
String mlContainerVersionLabel = mlContainerVersion.getVersionLabel();
logger.debug("Versioned multilingual container: \n"
+ " Container: " + mlContainerToVersion + "\n"
+ " Current Version: " + mlContainerVersionLabel);
}
return startNode;
}
/** @inheritDoc */
public VersionHistory getEditions(NodeRef mlContainer)
{
VersionHistory editionHistory = null;
// Only the mlContainer can have editions
if (nodeService.getType(mlContainer).equals(
ContentModel.TYPE_MULTILINGUAL_CONTAINER))
{
// get the editions of the mlContainer
editionHistory = versionService.getVersionHistory(mlContainer);
}
else
{
throw new IllegalArgumentException("The type of the node must be "
+ ContentModel.TYPE_CONTAINER);
}
if (logger.isDebugEnabled())
{
logger.debug("Found all editions: \n" + " Node: "
+ mlContainer + " (type "
+ ContentModel.TYPE_MULTILINGUAL_CONTAINER + ")\n"
+ " Editions: " + editionHistory);
}
return editionHistory;
}
/** @inheritDoc */
public Map<QName, Serializable> getVersionedMetadatas(Version version)
{
NodeRef frozenNodeRef = version.getFrozenStateNodeRef();
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(frozenNodeRef)))
{
// for the mlContainer, the properties are set as a version properties
Map<String, Serializable> properties = version.getVersionProperties();
// The returned map of this method need a QName type key, not a String.
Map<QName, Serializable> convertedProperties = new HashMap<QName, Serializable>(properties.size());
// perform the convertion
for(Map.Entry<String, Serializable> entry : properties.entrySet())
{
convertedProperties.put(
QName.createQName(entry.getKey()),
entry.getValue());
}
return convertedProperties;
}
else
{
// for any other type of node, the properties are set as versioned metadata
return versionNodeService.getProperties(frozenNodeRef);
}
}
/** @inheritDoc */
public List<VersionHistory> getVersionedTranslations(Version mlContainerEdition)
{
// Ensure that the given version is an Edition of an mlContainer
if(!ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(mlContainerEdition.getVersionedNodeRef())))
{
throw new IllegalArgumentException("The type of the node must be " + ContentModel.TYPE_CONTAINER);
}
Map<QName, Serializable> properties = versionNodeService.getProperties(mlContainerEdition.getFrozenStateNodeRef());
// get the serialisation of the version histories in the version properties
List<VersionHistory> versionHistories = (List<VersionHistory>)
properties.get(VersionModel.PROP_QNAME_TRANSLATION_VERIONS);
if (versionHistories == null)
{
// the initial edition doesn't content translations (at the creation time of the mlContainer).
versionHistories = new ArrayList<VersionHistory>();
}
if (logger.isDebugEnabled())
{
logger.debug("Found all translations : \n"
+ " Versioned mlContainer: " + mlContainerEdition.getVersionedNodeRef() + "\n"
+ " Edition: " + mlContainerEdition
+ " Translations: " + versionHistories);
}
return versionHistories;
}
/**
* Util method to add the version histories of translations as a property of the frozen mlContainer
*/
private void addVersionHitoryProperty(Version edition, List<ChildAssociationRef> childAssocRefs)
{
List<VersionHistory> translationVersionHistories = new ArrayList<VersionHistory>(childAssocRefs.size());
for (ChildAssociationRef ref : childAssocRefs)
{
NodeRef translation = ref.getChildRef();
translationVersionHistories.add(versionService.getVersionHistory(translation));
}
// properties in which the version histories will be stored
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
// add the version history of the translation as property of the Edition
properties.put(VersionModel.PROP_QNAME_QNAME, VersionModel.PROP_QNAME_TRANSLATION_VERIONS);
properties.put(VersionModel.PROP_QNAME_IS_MULTI_VALUE, true);
properties.put(VersionModel.PROP_QNAME_MULTI_VALUE, (Serializable) translationVersionHistories);
// create the versioned property node
this.nodeService.createNode(
VersionUtil.convertNodeRef(edition.getFrozenStateNodeRef()),
VersionModel.CHILD_QNAME_VERSIONED_ATTRIBUTES,
VersionModel.CHILD_QNAME_VERSIONED_ATTRIBUTES,
VersionModel.TYPE_QNAME_VERSIONED_PROPERTY,
properties);
}
/**
* Util method to add the usefull properties to the existing properties of the given, mlContainer
*
* @link {@link EditionServiceImpl#ML_CONTAINER_PROPERTIES_TO_VERSION}
*/
private void addPropertiesToVersion(Map<String, Serializable> versionProperties, NodeRef mlContainerToVersion)
{
// add useful properties
for(QName prop : ML_CONTAINER_PROPERTIES_TO_VERSION)
{
versionProperties.put(prop.toString(), nodeService.getProperty(mlContainerToVersion, prop));
}
}
/**
* Util method to remove the given translations after making a new edition
*/
private void removeTranslations(List<ChildAssociationRef> childAssocRefs)
{
// Turn off any auto-version policy behaviours. Without that,
// the version history of the translations will be deleted.
this.policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
// Turn off any multilingual document policy behaviours. Without that,
// the mlcontainer of the translations will be deleted.
this.policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
try
{
for (ChildAssociationRef childAssoc : childAssocRefs)
{
NodeRef documentNodeRef = childAssoc.getChildRef();
// Permanently delete it
nodeService.deleteNode(documentNodeRef);
if(nodeService.exists(nodeArchiveService.getArchivedNode(documentNodeRef)))
{
nodeService.deleteNode(nodeArchiveService.getArchivedNode(documentNodeRef));
}
}
}
finally
{
// Turn auto-version and multinlingual document policies back on
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE);
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
}
}
/**
* @param nodeService
* the Node Service to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param versionService
* the Version Service to set
*/
public void setVersionService(VersionService versionService)
{
this.versionService = versionService;
}
/**
* @param multilingualContentService
* the Multilingual Content Service to set
*/
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
/**
* @param versionNodeService
* the Version Store Node Service to set
*/
public void setVersionNodeService(NodeService versionNodeService)
{
this.versionNodeService = versionNodeService;
}
/**
* @param policyBehaviourFilter the Behaviour Filter to set
*/
public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
{
this.policyBehaviourFilter = policyBehaviourFilter;
}
/**
* @param nodeArchiveService the node Archive Service to set
*/
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
{
this.nodeArchiveService = nodeArchiveService;
}
/**
* @param fileFolderService the fileFolder Service to set
*/
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
}

View File

@@ -44,7 +44,7 @@ import org.alfresco.service.namespace.QName;
* *
* {@link ContentModel#ASPECT_MULTILINGUAL_EMPTY_TRANSLATION ml empty document aspect} * {@link ContentModel#ASPECT_MULTILINGUAL_EMPTY_TRANSLATION ml empty document aspect}
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class EmptyTranslationAspect implements public class EmptyTranslationAspect implements
CopyServicePolicies.OnCopyNodePolicy, CopyServicePolicies.OnCopyNodePolicy,

View File

@@ -45,7 +45,7 @@ import org.alfresco.service.namespace.QName;
* *
* {@link ContentModel#TYPE_MULTILINGUAL_CONTAINER multilingual container type} * {@link ContentModel#TYPE_MULTILINGUAL_CONTAINER multilingual container type}
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class MLContainerType implements public class MLContainerType implements
NodeServicePolicies.OnUpdatePropertiesPolicy NodeServicePolicies.OnUpdatePropertiesPolicy

View File

@@ -24,7 +24,6 @@
*/ */
package org.alfresco.repo.model.ml; package org.alfresco.repo.model.ml;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -35,7 +34,6 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil; import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService; import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.MultilingualContentService; import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileFolderService;
@@ -49,8 +47,6 @@ import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
@@ -77,7 +73,7 @@ import org.apache.commons.logging.LogFactory;
* *
* @author Derek Hulley * @author Derek Hulley
* @author Philippe Dubois * @author Philippe Dubois
* @author yanipig * @author Yannick Pignot
*/ */
public class MultilingualContentServiceImpl implements MultilingualContentService public class MultilingualContentServiceImpl implements MultilingualContentService
{ {
@@ -85,7 +81,6 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
private NodeService nodeService; private NodeService nodeService;
private SearchService searchService; private SearchService searchService;
private VersionService versionService;
private PermissionService permissionService; private PermissionService permissionService;
private SearchParameters searchParametersMLRoot; private SearchParameters searchParametersMLRoot;
private ContentFilterLanguagesService contentFilterLanguagesService; private ContentFilterLanguagesService contentFilterLanguagesService;
@@ -136,8 +131,8 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
NodeRef mlContainerRootNodeRef = getMLContainerRoot(); NodeRef mlContainerRootNodeRef = getMLContainerRoot();
// Create the container // Create the container
PropertyMap versionProperties = new PropertyMap(); PropertyMap versionProperties = new PropertyMap();
versionProperties.put(ContentModel.PROP_AUTO_VERSION, Boolean.FALSE); //versionProperties.put(ContentModel.PROP_AUTO_VERSION, Boolean.FALSE);
versionProperties.put(ContentModel.PROP_INITIAL_VERSION, Boolean.FALSE); //versionProperties.put(ContentModel.PROP_INITIAL_VERSION, Boolean.FALSE);
ChildAssociationRef assocRef = nodeService.createNode( ChildAssociationRef assocRef = nodeService.createNode(
mlContainerRootNodeRef, mlContainerRootNodeRef,
ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN,
@@ -146,8 +141,8 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
versionProperties); versionProperties);
NodeRef mlContainerNodeRef = assocRef.getChildRef(); NodeRef mlContainerNodeRef = assocRef.getChildRef();
// TODO: Examine the usage of versioning - why is autoversioning on and used in the UI? // TODO: Examine the usage of versioning - why is autoversioning on and used in the UI?
// // The model makes the container versionable by default, but why? // The model makes the container versionable by default, but why?
// nodeService.addAspect(mlContainerNodeRef, ContentModel.ASPECT_VERSIONABLE, versionProperties); nodeService.addAspect(mlContainerNodeRef, ContentModel.ASPECT_VERSIONABLE, versionProperties);
// Set the permissions to allow anything by anyone // Set the permissions to allow anything by anyone
permissionService.setPermission( permissionService.setPermission(
mlContainerNodeRef, mlContainerNodeRef,
@@ -193,7 +188,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
// Done // Done
return mlContainerNodeRef; return mlContainerNodeRef;
} }
/** /**
* Retrieve or create a <b>cm:mlDocument</b> container for the given node, which must have the * Retrieve or create a <b>cm:mlDocument</b> container for the given node, which must have the
* <b>cm:mlDocument</b> already applied. * <b>cm:mlDocument</b> already applied.
@@ -312,7 +307,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
// done // done
return mlContainerNodeRef; return mlContainerNodeRef;
} }
private boolean isPivotTranslation(NodeRef contentNodeRef) private boolean isPivotTranslation(NodeRef contentNodeRef)
{ {
Locale locale = (Locale) nodeService.getProperty(contentNodeRef, ContentModel.PROP_LOCALE); Locale locale = (Locale) nodeService.getProperty(contentNodeRef, ContentModel.PROP_LOCALE);
@@ -359,7 +354,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
return false; return false;
} }
} }
/** @inheritDoc */ /** @inheritDoc */
public void makeTranslation(NodeRef contentNodeRef, Locale locale) public void makeTranslation(NodeRef contentNodeRef, Locale locale)
{ {
@@ -432,7 +427,17 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
public void addTranslation(NodeRef newTranslationNodeRef, NodeRef translationOfNodeRef, Locale locale) public void addTranslation(NodeRef newTranslationNodeRef, NodeRef translationOfNodeRef, Locale locale)
{ {
// Get the container // Get the container
NodeRef mlContainerNodeRef = getOrCreateMLContainer(translationOfNodeRef, false); NodeRef mlContainerNodeRef = null;
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(translationOfNodeRef)))
{
mlContainerNodeRef = translationOfNodeRef;
}
else
{
mlContainerNodeRef = getOrCreateMLContainer(translationOfNodeRef, false);
}
// Use the existing container to make the new content into a translation // Use the existing container to make the new content into a translation
makeTranslationImpl(mlContainerNodeRef, newTranslationNodeRef, locale); makeTranslationImpl(mlContainerNodeRef, newTranslationNodeRef, locale);
// done // done
@@ -453,72 +458,6 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
return mlContainerNodeRef; return mlContainerNodeRef;
} }
/** @inheritDoc */
public void createEdition( NodeRef translationNodeRef)
{
NodeRef mlContainerNodeRef = getOrCreateMLContainer(translationNodeRef, false);
// Ensure that the translation given is one of the children
getOrCreateMLContainer(translationNodeRef, false);
// Get all the container's children
List<ChildAssociationRef> childAssocRefs = nodeService.getChildAssocs(
mlContainerNodeRef,
ContentModel.ASSOC_MULTILINGUAL_CHILD,
RegexQNamePattern.MATCH_ALL);
// Get and store the translation verions associated to the mlContainer
List<Version> versions = new ArrayList<Version>(childAssocRefs.size());
for (ChildAssociationRef childAssoc : childAssocRefs)
{
versions.add(versionService.getCurrentVersion(childAssoc.getChildRef()));
}
Map<String, Serializable> editionProperties = new HashMap<String, Serializable>();
editionProperties.put(
VersionModel.PROP_QNAME_TRANSLATION_VERIONS.toString(),
(Serializable) versions
);
// Version the container and all its children
versionService.createVersion(mlContainerNodeRef, editionProperties, true);
// Remove all the child documents apart from the given node
boolean found = false;
for (ChildAssociationRef childAssoc : childAssocRefs)
{
NodeRef documentNodeRef = childAssoc.getChildRef();
// Is this the node to keep?
if (documentNodeRef.equals(translationNodeRef))
{
// It is, so keep it
found = true;
continue;
}
// Delete it
nodeService.deleteNode(documentNodeRef);
}
// Check that we left a document
if (!found)
{
throw new AlfrescoRuntimeException(
"The translation provided is not a child of the multilingual container: \n" +
" Container: " + mlContainerNodeRef + "\n" +
" Translation: " + translationNodeRef);
}
// Done
if (logger.isDebugEnabled())
{
// Get the version information
Version mlContainerVersion = versionService.getCurrentVersion(mlContainerNodeRef);
String mlContainerVersionLabel = mlContainerVersion.getVersionLabel();
logger.debug(
"Versioned multilingual container: \n" +
" Container: " + mlContainerNodeRef + "\n" +
" Current Version: " + mlContainerVersionLabel);
}
}
/** @inheritDoc */ /** @inheritDoc */
public Map<Locale, NodeRef> getTranslations(NodeRef translationOfNodeRef) public Map<Locale, NodeRef> getTranslations(NodeRef translationOfNodeRef)
{ {
@@ -676,7 +615,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
return nodeRefsByLocale.get(nearestLocale); return nodeRefsByLocale.get(nearestLocale);
} }
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -704,7 +643,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
" Translation: " + translationOfNodeRef + "\n" + " Translation: " + translationOfNodeRef + "\n" +
" Locale: " + locale); " Locale: " + locale);
} }
FileInfo translationOfFileInfo = fileFolderService.getFileInfo(translationOfNodeRef); FileInfo translationOfFileInfo = fileFolderService.getFileInfo(translationOfNodeRef);
String translationOfName = translationOfFileInfo.getName(); String translationOfName = translationOfFileInfo.getName();
// If name is null, supply one // If name is null, supply one
@@ -713,7 +652,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
name = translationOfName; name = translationOfName;
} }
// If there is a name clash, add the locale to the main portion of the filename // If there is a name clash, add the locale to the main portion of the filename
if (name.equals(translationOfName)) if (name.equalsIgnoreCase(translationOfName))
{ {
String localeStr = locale.toString(); String localeStr = locale.toString();
if (localeStr.endsWith("_")) if (localeStr.endsWith("_"))
@@ -744,7 +683,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
parentNodeRef, parentNodeRef,
name, name,
ContentModel.TYPE_CONTENT).getNodeRef(); ContentModel.TYPE_CONTENT).getNodeRef();
// add the translation to the container // add the translation to the container
addTranslation(newTranslationNodeRef, translationOfNodeRef, locale); addTranslation(newTranslationNodeRef, translationOfNodeRef, locale);
@@ -788,15 +727,10 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
this.searchService = searchService; this.searchService = searchService;
} }
public void setVersionService(VersionService versionService)
{
this.versionService = versionService;
}
public void setPermissionService(PermissionService permissionService) public void setPermissionService(PermissionService permissionService)
{ {
this.permissionService = permissionService; this.permissionService = permissionService;
} }
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService) public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
{ {
@@ -807,4 +741,14 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
{ {
this.fileFolderService = fileFolderService; this.fileFolderService = fileFolderService;
} }
public NodeRef copyTranslationContainer(NodeRef translationNodeRef, NodeRef newParentRef)
{
throw new UnsupportedOperationException("This operation is not yet supported");
}
public void moveTranslationContainer(NodeRef translationNodeRef, NodeRef newParentRef)
{
throw new UnsupportedOperationException("This operation is not yet supported");
}
} }

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.repo.model.ml; package org.alfresco.repo.model.ml;
@@ -35,6 +35,7 @@ import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.PolicyScope; import org.alfresco.repo.policy.PolicyScope;
import org.alfresco.repo.version.VersionServicePolicies;
import org.alfresco.service.cmr.ml.MultilingualContentService; import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
@@ -46,54 +47,69 @@ import org.alfresco.service.namespace.RegexQNamePattern;
/** /**
* Class containing behaviour for the multilingual document aspect. * Class containing behaviour for the multilingual document aspect.
* *
* {@link ContentModel#ASPECT_MULTILINGUAL_DOCUMENT ml document aspect} * {@link ContentModel#ASPECT_MULTILINGUAL_DOCUMENT ml document aspect}
* *
* @author yanipig * @author yanipig
*/ */
public class MultilingualDocumentAspect implements public class MultilingualDocumentAspect implements
CopyServicePolicies.OnCopyNodePolicy, CopyServicePolicies.OnCopyNodePolicy,
CopyServicePolicies.OnCopyCompletePolicy, CopyServicePolicies.OnCopyCompletePolicy,
NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy NodeServicePolicies.OnUpdatePropertiesPolicy,
VersionServicePolicies.OnCreateVersionPolicy
{ {
/**
* List of properties to set persistent when a version of the mlDocument is created
*/
public static final QName[] PROPERTIES_TO_VERSION = {
ContentModel.PROP_AUTHOR,
ContentModel.PROP_LOCALE,
ContentModel.PROP_TITLE,
ContentModel.PROP_DESCRIPTION,
};
// Dependencies // Dependencies
private PolicyComponent policyComponent; private PolicyComponent policyComponent;
private MultilingualContentService multilingualContentService; private MultilingualContentService multilingualContentService;
private NodeService nodeService; private NodeService nodeService;
/** /**
* Initialise the Multilingual Aspect * Initialise the Multilingual Aspect
* *
* Ensures that the {@link ContentModel#ASPECT_MULTILINGUAL_DOCUMENT ml document aspect} * Ensures that the {@link ContentModel#ASPECT_MULTILINGUAL_DOCUMENT ml document aspect}
*/ */
public void init() public void init()
{ {
this.policyComponent.bindClassBehaviour( this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyNode"), QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyNode"),
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
new JavaBehaviour(this, "onCopyNode")); new JavaBehaviour(this, "onCopyNode"));
this.policyComponent.bindClassBehaviour( this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"), QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
new JavaBehaviour(this, "onCopyComplete")); new JavaBehaviour(this, "onCopyComplete"));
this.policyComponent.bindClassBehaviour( this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"), QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
new JavaBehaviour(this, "beforeDeleteNode")); new JavaBehaviour(this, "beforeDeleteNode"));
this.policyComponent.bindClassBehaviour( this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
new JavaBehaviour(this, "onUpdateProperties")); new JavaBehaviour(this, "onUpdateProperties"));
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateVersion"),
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
new JavaBehaviour(this, "onCreateVersion"));
} }
/** /**
* @param policyComponent the policy component to register behaviour with * @param policyComponent the policy component to register behaviour with
*/ */
@@ -101,12 +117,12 @@ public class MultilingualDocumentAspect implements
{ {
this.policyComponent = policyComponent; this.policyComponent = policyComponent;
} }
/** /**
* @param multilingualContentService the Multilingual Content Service to set * @param multilingualContentService the Multilingual Content Service to set
*/ */
public void setMultilingualContentService( public void setMultilingualContentService(
MultilingualContentService multilingualContentService) MultilingualContentService multilingualContentService)
{ {
this.multilingualContentService = multilingualContentService; this.multilingualContentService = multilingualContentService;
} }
@@ -114,36 +130,36 @@ public class MultilingualDocumentAspect implements
/** /**
* @param nodeService the Node Service to set * @param nodeService the Node Service to set
*/ */
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
/** /**
* The copy of a <b>cm:mlDocument</b> can't keep the Multilingual aspect. * The copy of a <b>cm:mlDocument</b> can't keep the Multilingual aspect.
* *
* @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy#onCopyNode(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.StoreRef, boolean, org.alfresco.repo.policy.PolicyScope) * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy#onCopyNode(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.StoreRef, boolean, org.alfresco.repo.policy.PolicyScope)
*/ */
public void onCopyNode(QName classRef, NodeRef sourceNodeRef, StoreRef destinationStoreRef, boolean copyToNewNode, PolicyScope copyDetails) public void onCopyNode(QName classRef, NodeRef sourceNodeRef, StoreRef destinationStoreRef, boolean copyToNewNode, PolicyScope copyDetails)
{ {
copyDetails.removeAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); copyDetails.removeAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
} }
/** /**
* The copy of <b>mlDocument</b> don't keep the 'locale' property. * The copy of <b>mlDocument</b> don't keep the 'locale' property.
* *
* @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map) * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map)
*/ */
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef destinationRef, boolean copyToNewNode, Map<NodeRef, NodeRef> copyMap) public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef destinationRef, boolean copyToNewNode, Map<NodeRef, NodeRef> copyMap)
{ {
nodeService.removeProperty(destinationRef, ContentModel.PROP_LOCALE); nodeService.removeProperty(destinationRef, ContentModel.PROP_LOCALE);
} }
/** /**
* If this is not an empty translation, then ensure that the node is properly * If this is not an empty translation, then ensure that the node is properly
* unhooked from the translation mechanism first. * unhooked from the translation mechanism first.
*/ */
public void beforeDeleteNode(NodeRef nodeRef) public void beforeDeleteNode(NodeRef nodeRef)
{ {
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{ {
@@ -155,63 +171,63 @@ public class MultilingualDocumentAspect implements
multilingualContentService.unmakeTranslation(nodeRef); multilingualContentService.unmakeTranslation(nodeRef);
} }
} }
/** /**
* Ensure that the locale is unique inside the <b>mlContainer</b>. * Ensure that the locale is unique inside the <b>mlContainer</b>.
* *
* If the locale of a pivot translation is modified, the pivot locale reference of the mlContainer * If the locale of a pivot translation is modified, the pivot locale reference of the mlContainer
* must be modified too. * must be modified too.
* *
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/ */
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{ {
/* /*
* TODO: Move this into MultilingualContentService#setTranslationLocale * TODO: Move this into MultilingualContentService#setTranslationLocale
*/ */
Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE); Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE);
Locale localeAfter; Locale localeAfter;
// the after local property type can be either Locale or String // the after local property type can be either Locale or String
Serializable objLocaleAfter = after.get(ContentModel.PROP_LOCALE); Serializable objLocaleAfter = after.get(ContentModel.PROP_LOCALE);
if (objLocaleAfter instanceof Locale ) if (objLocaleAfter instanceof Locale )
{ {
localeAfter = (Locale) objLocaleAfter; localeAfter = (Locale) objLocaleAfter;
} }
else else
{ {
localeAfter = I18NUtil.parseLocale(objLocaleAfter.toString()); localeAfter = I18NUtil.parseLocale(objLocaleAfter.toString());
} }
// if the local has been modified // if the local has been modified
if(!localeBefore.equals(localeAfter)) if(!localeBefore.equals(localeAfter))
{ {
NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef); NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef);
// Since the map returned by the getTranslations doesn't duplicate keys, the size of this map will be // Since the map returned by the getTranslations doesn't duplicate keys, the size of this map will be
// different of the size of the number of children of the mlContainer if a duplicate locale is found. // different of the size of the number of children of the mlContainer if a duplicate locale is found.
int transSize = multilingualContentService.getTranslations(mlContainer).size(); int transSize = multilingualContentService.getTranslations(mlContainer).size();
int childSize = nodeService.getChildAssocs(mlContainer, ContentModel.ASSOC_MULTILINGUAL_CHILD, RegexQNamePattern.MATCH_ALL).size(); int childSize = nodeService.getChildAssocs(mlContainer, ContentModel.ASSOC_MULTILINGUAL_CHILD, RegexQNamePattern.MATCH_ALL).size();
// if duplicate locale found // if duplicate locale found
if(transSize != childSize) if(transSize != childSize)
{ {
// throw an exception and the current transaction will be rolled back. The properties will not be // throw an exception and the current transaction will be rolled back. The properties will not be
// longer in an illegal state. // longer in an illegal state.
throw new IllegalArgumentException("The locale " + localeAfter + throw new IllegalArgumentException("The locale " + localeAfter +
" can't be changed for the node " + nodeRef + " can't be changed for the node " + nodeRef +
" because this locale is already in use in an other translation of the same " + " because this locale is already in use in an other translation of the same " +
ContentModel.TYPE_MULTILINGUAL_CONTAINER + "."); ContentModel.TYPE_MULTILINGUAL_CONTAINER + ".");
} }
// get the locale of ML Container // get the locale of ML Container
Locale localMlContainer = (Locale) nodeService.getProperty( Locale localMlContainer = (Locale) nodeService.getProperty(
mlContainer, mlContainer,
ContentModel.PROP_LOCALE); ContentModel.PROP_LOCALE);
// if locale of the container is equals to the locale of // if locale of the container is equals to the locale of
// the node (before update). The nodeRef is the pivot language // the node (before update). The nodeRef is the pivot language
// and the locale of the mlContainer must be modified // and the locale of the mlContainer must be modified
if(localeBefore.equals(localMlContainer)) if(localeBefore.equals(localMlContainer))
@@ -219,12 +235,26 @@ public class MultilingualDocumentAspect implements
nodeService.setProperty( nodeService.setProperty(
mlContainer, mlContainer,
ContentModel.PROP_LOCALE, ContentModel.PROP_LOCALE,
localeAfter); localeAfter);
} }
}
// else no action to perform
}
/**
* Persist some specific properties in the version store
*
* @see org.alfresco.repo.model.ml.MultilingualDocumentAspect.PROPERTIES_TO_VERSION
* @see org.alfresco.repo.version.VersionServicePolicies.OnCreateVersionPolicy#onCreateVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, org.alfresco.repo.policy.PolicyScope)
*/
public void onCreateVersion(QName classRef, NodeRef versionableNode, Map<String, Serializable> versionProperties, PolicyScope nodeDetails)
{
for(QName prop : PROPERTIES_TO_VERSION)
{
nodeDetails.addProperty(prop, nodeService.getProperty(versionableNode, prop));
} }
// else no action to perform
} }
} }

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.repo.model.ml; package org.alfresco.repo.model.ml;
@@ -28,6 +28,7 @@ import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest; import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest;
import org.alfresco.repo.model.ml.tools.EditionServiceImplTest;
import org.alfresco.repo.model.ml.tools.EmptyTranslationAspectTest; import org.alfresco.repo.model.ml.tools.EmptyTranslationAspectTest;
import org.alfresco.repo.model.ml.tools.MLContainerTypeTest; import org.alfresco.repo.model.ml.tools.MLContainerTypeTest;
import org.alfresco.repo.model.ml.tools.MultilingualContentServiceImplTest; import org.alfresco.repo.model.ml.tools.MultilingualContentServiceImplTest;
@@ -35,26 +36,27 @@ import org.alfresco.repo.model.ml.tools.MultilingualDocumentAspectTest;
/** /**
* Multilingual test suite * Multilingual test suite
* *
* @author yanipig * @author yanipig
*/ */
public class MultilingualTestSuite extends TestSuite public class MultilingualTestSuite extends TestSuite
{ {
/** /**
* Creates the test suite * Creates the test suite
* *
* @return the test suite * @return the test suite
*/ */
public static Test suite() public static Test suite()
{ {
TestSuite suite = new TestSuite(); TestSuite suite = new TestSuite();
suite.addTestSuite(EmptyTranslationAspectTest.class); suite.addTestSuite(EmptyTranslationAspectTest.class);
suite.addTestSuite(ContentFilterLanguagesMapTest.class); suite.addTestSuite(ContentFilterLanguagesMapTest.class);
suite.addTestSuite(MultilingualContentServiceImplTest.class); suite.addTestSuite(MultilingualContentServiceImplTest.class);
suite.addTestSuite(MultilingualDocumentAspectTest.class); suite.addTestSuite(MultilingualDocumentAspectTest.class);
suite.addTestSuite(MLContainerTypeTest.class); suite.addTestSuite(MLContainerTypeTest.class);
suite.addTestSuite(EditionServiceImplTest.class);
return suite; return suite;
} }
} }

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.repo.model.ml.tools; package org.alfresco.repo.model.ml.tools;
@@ -33,6 +33,7 @@ import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork; import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService; import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.EditionService;
import org.alfresco.service.cmr.ml.MultilingualContentService; import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
@@ -48,12 +49,12 @@ import org.springframework.context.ApplicationContext;
/** /**
* Base multilingual test cases * Base multilingual test cases
* *
* @author yanipig * @author yanipig
*/ */
public abstract class AbstractMultilingualTestCases extends TestCase public abstract class AbstractMultilingualTestCases extends TestCase
{ {
protected static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); protected static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
protected ServiceRegistry serviceRegistry; protected ServiceRegistry serviceRegistry;
@@ -66,6 +67,8 @@ public abstract class AbstractMultilingualTestCases extends TestCase
protected NodeRef folderNodeRef; protected NodeRef folderNodeRef;
protected ContentFilterLanguagesService contentFilterLanguagesService; protected ContentFilterLanguagesService contentFilterLanguagesService;
protected NodeArchiveService nodeArchiveService; protected NodeArchiveService nodeArchiveService;
protected EditionService editionService;
@Override @Override
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
@@ -78,10 +81,11 @@ public abstract class AbstractMultilingualTestCases extends TestCase
versionService = serviceRegistry.getVersionService(); versionService = serviceRegistry.getVersionService();
multilingualContentService = (MultilingualContentService) ctx.getBean("MultilingualContentService"); multilingualContentService = (MultilingualContentService) ctx.getBean("MultilingualContentService");
contentFilterLanguagesService = (ContentFilterLanguagesService) ctx.getBean("ContentFilterLanguagesService"); contentFilterLanguagesService = (ContentFilterLanguagesService) ctx.getBean("ContentFilterLanguagesService");
editionService = (EditionService) ctx.getBean("EditionService");
// Run as admin // Run as admin
authenticationComponent.setCurrentUser("admin"); authenticationComponent.setCurrentUser("admin");
// Create a folder to work in // Create a folder to work in
TransactionWork<NodeRef> createFolderWork = new TransactionWork<NodeRef>() TransactionWork<NodeRef> createFolderWork = new TransactionWork<NodeRef>()
{ {
@@ -101,7 +105,7 @@ public abstract class AbstractMultilingualTestCases extends TestCase
}; };
folderNodeRef = TransactionUtil.executeInUserTransaction(transactionService, createFolderWork); folderNodeRef = TransactionUtil.executeInUserTransaction(transactionService, createFolderWork);
} }
@Override @Override
protected void tearDown() throws Exception protected void tearDown() throws Exception
{ {
@@ -115,13 +119,13 @@ public abstract class AbstractMultilingualTestCases extends TestCase
e.printStackTrace(); e.printStackTrace();
} }
} }
protected NodeRef createContent() protected NodeRef createContent()
{ {
String name = "" + System.currentTimeMillis(); String name = "" + System.currentTimeMillis();
return createContent(name); return createContent(name);
} }
protected NodeRef createContent(String name) protected NodeRef createContent(String name)
{ {
NodeRef contentNodeRef = fileFolderService.create( NodeRef contentNodeRef = fileFolderService.create(
@@ -134,7 +138,7 @@ public abstract class AbstractMultilingualTestCases extends TestCase
// done // done
return contentNodeRef; return contentNodeRef;
} }
public void testSetup() throws Exception public void testSetup() throws Exception
{ {
// Ensure that content can be created // Ensure that content can be created

View File

@@ -35,7 +35,7 @@ import java.util.Locale;
* @see org.alfresco.service.cmr.ml.ContentFilterLanguagesService * @see org.alfresco.service.cmr.ml.ContentFilterLanguagesService
* @see org.alfresco.repo.model.ml.ContentFilterLanguagesMap * @see org.alfresco.repo.model.ml.ContentFilterLanguagesMap
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
{ {

View File

@@ -0,0 +1,233 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.model.ml.tools;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.cmr.version.VersionType;
/**
* Edition Service test cases
*
* @since 2.1
* @author Yannick Pignot
*/
public class EditionServiceImplTest extends AbstractMultilingualTestCases
{
private static String FRENCH_CONTENT = "FRENCH_CONTENT";
private static String CHINESE_CONTENT = "CHINESE_CONTENT";
private static String JAPANESE_CONTENT = "JAPANESE_CONTENT";
public void testAutoEdition() throws Exception
{
// create a mlContainer with some content
checkFirstVersion(this.createMLContainerWithContent());
}
public void testEditionLabels()
{
// create a mlContainer with some content
NodeRef mlContainerNodeRef = createMLContainerWithContent();
Map<String, Serializable> versionProperties = null;
List<Version> editions = null;
NodeRef pivot = multilingualContentService.getPivotTranslation(mlContainerNodeRef);
checkFirstVersion(mlContainerNodeRef);
/*
* at the creation (1.0)
*/
Version rootEdition = editionService.getEditions(mlContainerNodeRef).getAllVersions().iterator().next();
// Ensure that the version label is 1.0
assertTrue("The edition label would be 1.0 and not " + rootEdition.getVersionLabel(), rootEdition.getVersionLabel().equals("1.0"));
/*
* default (1.1)
*/
pivot = editionService.createEdition(pivot, versionProperties);
editions = orderVersions(editionService.getEditions(mlContainerNodeRef).getAllVersions());
Version firstEdition = editions.get(0);
// Ensure that the version label is 1.1
assertTrue("The edition label would be 1.1 and not " + firstEdition.getVersionLabel(), firstEdition.getVersionLabel().equals("1.1"));
/*
* major (2.0)
*/
versionProperties = new HashMap<String, Serializable>();
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
pivot = editionService.createEdition(pivot, versionProperties);
editions = orderVersions(editionService.getEditions(mlContainerNodeRef).getAllVersions());
Version secondEdition = editions.get(0);
// Ensure that the version label is 2.0
assertTrue("The edition label would be 2.0 and not " + secondEdition.getVersionLabel(), secondEdition.getVersionLabel().equals("2.0"));
/*
* minor (2.1)
*/
versionProperties = new HashMap<String, Serializable>();
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
pivot = editionService.createEdition(pivot, versionProperties);
editions = orderVersions(editionService.getEditions(mlContainerNodeRef).getAllVersions());
Version thirdEdition = editions.get(0);
// Ensure that the version label is 2.1
assertTrue("The edition label would be 2.1 and not " + thirdEdition.getVersionLabel(), thirdEdition.getVersionLabel().equals("2.1"));
}
public void testCreateEdition() throws Exception
{
// create a mlContainer with some content
NodeRef mlContainerNodeRef = createMLContainerWithContent();
// get the french translation
NodeRef frenchContentNodeRef = multilingualContentService.getTranslationForLocale(mlContainerNodeRef, Locale.FRENCH);
checkFirstVersion(mlContainerNodeRef);
// create a new edition form the french translation
NodeRef newStartingPoint = editionService.createEdition(frenchContentNodeRef, null);
// get the edition history
VersionHistory editionHistory = editionService.getEditions(mlContainerNodeRef);
// Ensure that the edition history contains two versions
assertTrue("The edition history must contain two versions", editionHistory.getAllVersions().size() == 2);
// Ensure that the locale of the container is changer
assertTrue("The locale of the conatiner should be changed", nodeService.getProperty(mlContainerNodeRef, ContentModel.PROP_LOCALE).equals(Locale.FRENCH));
// get the two editions
Version rootEdition = editionHistory.getVersion("1.0");
Version actualEdition = editionHistory.getVersion("1.1");
// get the translations of the root versions
List<VersionHistory> rootVersionTranslations = editionService.getVersionedTranslations(rootEdition);
// Ensure that the editions are not null
assertNotNull("The root edition can't be null", rootEdition);
assertNotNull("The actual edition can't be null", actualEdition);
assertNotNull("The translations list of the root edition can't be null", rootVersionTranslations);
// Ensure that the new starting document noderef is different that the initial one
assertFalse("The created starting document must be different that the starting document of the edition", frenchContentNodeRef.equals(newStartingPoint));
// Ensure that the new starting document is the pivot of the current translation
assertTrue("The new pivot must be equal to the created starting document", newStartingPoint.equals(multilingualContentService.getPivotTranslation(mlContainerNodeRef)));
int numberOfTranslations;
// Ensure that the current translations size is 1
numberOfTranslations = multilingualContentService.getTranslations(mlContainerNodeRef).size();
assertEquals("The number of translations must be 1 and not " + numberOfTranslations, 1, numberOfTranslations);
// Ensure that the number of translations of the current edition is 0
numberOfTranslations = editionService.getVersionedTranslations(actualEdition).size();
assertEquals("The number of translations must be 0 and not " + numberOfTranslations, 0, numberOfTranslations);
// Ensure that the number of translations of the root verions is 3
numberOfTranslations = rootVersionTranslations.size();
assertEquals("The number of translations must be 3 and not " + numberOfTranslations, 3, numberOfTranslations);
}
public void testReadVersionedContent() throws Exception
{
}
public void testReadVersionedProperties() throws Exception
{
}
private void checkFirstVersion(NodeRef mlContainerNodeRef)
{
// get the edition list of edition
VersionHistory editionHistory = editionService.getEditions(mlContainerNodeRef);
// Ensure that the first edition of the mlContainer is created
assertNotNull("The edition history can't be null", editionHistory);
// Ensure that it contains only one version
assertTrue("The edition history must contain only one edition", editionHistory.getAllVersions().size() == 1);
// get the edition
Version currentEdition = editionHistory.getAllVersions().iterator().next();
// Ensure that this version is the edition of the mlContainer
assertTrue("The versioned mlContainer noderef of the editon must be the noderef of the created mlContainer", currentEdition.getVersionedNodeRef().equals(mlContainerNodeRef));
// get the list of translations
List<VersionHistory> translations = editionService.getVersionedTranslations(currentEdition);
// Ensure that the get versioned translations is empty
assertNotNull("The translations list of the current edition can't be null", translations);
// Ensure that the list is empty
assertTrue("The translations list of the current edition would be empty", translations.size() == 0);
}
private NodeRef createMLContainerWithContent()
{
NodeRef chineseContentNodeRef = createContent(CHINESE_CONTENT + "_1.0");
NodeRef frenchContentNodeRef = createContent(FRENCH_CONTENT + "_1.0");
NodeRef japaneseContentNodeRef = createContent(JAPANESE_CONTENT + "_1.0");
multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);
multilingualContentService.addTranslation(frenchContentNodeRef, chineseContentNodeRef, Locale.FRENCH);
multilingualContentService.addTranslation(japaneseContentNodeRef, chineseContentNodeRef, Locale.JAPANESE);
return multilingualContentService.getTranslationContainer(chineseContentNodeRef);
}
private Comparator versionComparator = new Comparator()
{
public int compare(Object o1, Object o2)
{
String label01 = ((Version) o1).getVersionLabel();
String label02 = ((Version) o2).getVersionLabel();
// sort the list ascending
return label02.compareTo(label01);
}
};
@SuppressWarnings("unchecked")
private List<Version> orderVersions(Collection<Version> allVersions)
{
List<Version> versionsAsList = new ArrayList<Version>(allVersions.size());
versionsAsList.addAll(allVersions);
Collections.sort(versionsAsList, versionComparator);
return versionsAsList;
}
}

View File

@@ -40,7 +40,7 @@ import org.alfresco.service.namespace.QName;
* *
* @see org.alfresco.service.cmr.ml.EmptyTranslationAspect * @see org.alfresco.service.cmr.ml.EmptyTranslationAspect
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class EmptyTranslationAspectTest extends AbstractMultilingualTestCases { public class EmptyTranslationAspectTest extends AbstractMultilingualTestCases {

View File

@@ -37,7 +37,7 @@ import org.alfresco.service.namespace.QName;
* *
* @see org.alfresco.service.cmr.ml.MLContainerType * @see org.alfresco.service.cmr.ml.MLContainerType
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class MLContainerTypeTest extends AbstractMultilingualTestCases public class MLContainerTypeTest extends AbstractMultilingualTestCases
{ {

View File

@@ -24,11 +24,8 @@
*/ */
package org.alfresco.repo.model.ml.tools; package org.alfresco.repo.model.ml.tools;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import net.sf.acegisecurity.Authentication; import net.sf.acegisecurity.Authentication;
@@ -39,8 +36,6 @@ import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
/** /**
* @see org.alfresco.repo.ml.MultilingualContentServiceImpl * @see org.alfresco.repo.ml.MultilingualContentServiceImpl
@@ -231,58 +226,6 @@ public class MultilingualContentServiceImplTest extends AbstractMultilingualTest
assertEquals("Empty translation name not generated correctly.", "Document2.txt", differentName); assertEquals("Empty translation name not generated correctly.", "Document2.txt", differentName);
} }
@SuppressWarnings("unused")
public void testCreateEdition() throws Exception
{
// Make some content
NodeRef chineseContentNodeRef = createContent();
NodeRef frenchContentNodeRef = createContent();
NodeRef japaneseContentNodeRef = createContent();
// Add to container
multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);
multilingualContentService.addTranslation(frenchContentNodeRef, chineseContentNodeRef, Locale.FRENCH);
multilingualContentService.addTranslation(japaneseContentNodeRef, chineseContentNodeRef, Locale.JAPANESE);
NodeRef mlContainerNodeRef = multilingualContentService.getTranslationContainer(chineseContentNodeRef);
// Check the container child count
assertEquals("Incorrect number of child nodes", 3, nodeService.getChildAssocs(mlContainerNodeRef).size());
// Version each of the documents
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(3);
nodeRefs.add(chineseContentNodeRef);
nodeRefs.add(frenchContentNodeRef);
nodeRefs.add(japaneseContentNodeRef);
versionService.createVersion(nodeRefs, null);
// Get the current versions of each of the documents
Version chineseVersionPreEdition = versionService.getCurrentVersion(chineseContentNodeRef);
Version frenchVersionPreEdition = versionService.getCurrentVersion(frenchContentNodeRef);
Version japaneseVersionPreEdition = versionService.getCurrentVersion(japaneseContentNodeRef);
// Create the edition, keeping the Chinese translation as the basis
multilingualContentService.createEdition(chineseContentNodeRef);
// Check the container child count
assertEquals("Incorrect number of child nodes", 1, nodeService.getChildAssocs(mlContainerNodeRef).size());
// Get the document versions now
Version chineseVersionPostEdition = versionService.getCurrentVersion(chineseContentNodeRef);
assertFalse("Expected document to be gone", nodeService.exists(frenchContentNodeRef));
assertFalse("Expected document to be gone", nodeService.exists(japaneseContentNodeRef));
// Now be sure that we can get the required information using the version service
VersionHistory mlContainerVersionHistory = versionService.getVersionHistory(mlContainerNodeRef);
Collection<Version> mlContainerVersions = mlContainerVersionHistory.getAllVersions();
// Loop through and get all the children of each version
for (Version mlContainerVersion : mlContainerVersions)
{
NodeRef versionedMLContainerNodeRef = mlContainerVersion.getFrozenStateNodeRef();
// Get all the children
Map<Locale, NodeRef> translationsByLocale = multilingualContentService.getTranslations(
versionedMLContainerNodeRef);
// Count the children
int count = translationsByLocale.size();
}
}
public void testGetTranslationContainerPermissions() throws Exception public void testGetTranslationContainerPermissions() throws Exception
{ {
// Grant the guest user rights to our working folder // Grant the guest user rights to our working folder
@@ -335,7 +278,6 @@ public class MultilingualContentServiceImplTest extends AbstractMultilingualTest
multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE); multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);
multilingualContentService.addTranslation(frenchContentNodeRef, chineseContentNodeRef, Locale.FRENCH); multilingualContentService.addTranslation(frenchContentNodeRef, chineseContentNodeRef, Locale.FRENCH);
multilingualContentService.addEmptyTranslation(chineseContentNodeRef, null, Locale.JAPANESE); multilingualContentService.addEmptyTranslation(chineseContentNodeRef, null, Locale.JAPANESE);
multilingualContentService.createEdition(chineseContentNodeRef);
} }
finally finally
{ {

View File

@@ -37,7 +37,7 @@ import org.alfresco.service.namespace.QName;
* *
* @see org.alfresco.service.cmr.ml.MultilingualDocumentAspect * @see org.alfresco.service.cmr.ml.MultilingualDocumentAspect
* *
* @author yanipig * @author Yannick Pignot
*/ */
public class MultilingualDocumentAspectTest extends AbstractMultilingualTestCases public class MultilingualDocumentAspectTest extends AbstractMultilingualTestCases
{ {

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.repo.version; package org.alfresco.repo.version;
@@ -35,6 +35,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.version.common.VersionUtil;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.InvalidAspectException; import org.alfresco.service.cmr.dictionary.InvalidAspectException;
import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition;
@@ -57,22 +58,22 @@ import org.alfresco.service.namespace.RegexQNamePattern;
/** /**
* The light weight version store node service implementation. * The light weight version store node service implementation.
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class NodeServiceImpl implements NodeService, VersionModel public class NodeServiceImpl implements NodeService, VersionModel
{ {
/** /**
* Error messages * Error messages
*/ */
private final static String MSG_UNSUPPORTED = private final static String MSG_UNSUPPORTED =
"This operation is not supported by a version store implementation of the node service."; "This operation is not supported by a version store implementation of the node service.";
/** /**
* The name of the spoofed root association * The name of the spoofed root association
*/ */
private static final QName rootAssocName = QName.createQName(VersionModel.NAMESPACE_URI, "versionedState"); private static final QName rootAssocName = QName.createQName(VersionModel.NAMESPACE_URI, "versionedState");
/** /**
* The db node service, used as the version store implementation * The db node service, used as the version store implementation
*/ */
@@ -83,16 +84,16 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private SearchService searcher; private SearchService searcher;
/** /**
* The dictionary service * The dictionary service
*/ */
protected DictionaryService dicitionaryService; protected DictionaryService dicitionaryService;
/** /**
* Sets the db node service, used as the version store implementation * Sets the db node service, used as the version store implementation
* *
* @param nodeService the node service * @param nodeService the node service
*/ */
public void setDbNodeService(NodeService nodeService) public void setDbNodeService(NodeService nodeService)
@@ -102,24 +103,24 @@ public class NodeServiceImpl implements NodeService, VersionModel
/** /**
* Sets the searcher * Sets the searcher
* *
* @param searcher the searcher * @param searcher the searcher
*/ */
public void setSearcher(SearchService searcher) public void setSearcher(SearchService searcher)
{ {
this.searcher = searcher; this.searcher = searcher;
} }
/** /**
* Sets the dictionary service * Sets the dictionary service
* *
* @param dictionaryService the dictionary service * @param dictionaryService the dictionary service
*/ */
public void setDictionaryService(DictionaryService dictionaryService) public void setDictionaryService(DictionaryService dictionaryService)
{ {
this.dicitionaryService = dictionaryService; this.dicitionaryService = dictionaryService;
} }
/** /**
* Delegates to the <code>NodeService</code> used as the version store implementation * Delegates to the <code>NodeService</code> used as the version store implementation
*/ */
@@ -127,7 +128,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
{ {
return dbNodeService.getStores(); return dbNodeService.getStores();
} }
/** /**
* Delegates to the <code>NodeService</code> used as the version store implementation * Delegates to the <code>NodeService</code> used as the version store implementation
*/ */
@@ -149,9 +150,9 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
public boolean exists(NodeRef nodeRef) public boolean exists(NodeRef nodeRef)
{ {
return dbNodeService.exists(convertNodeRef(nodeRef)); return dbNodeService.exists(VersionUtil.convertNodeRef(nodeRef));
} }
/** /**
* Delegates to the <code>NodeService</code> used as the version store implementation * Delegates to the <code>NodeService</code> used as the version store implementation
*/ */
@@ -160,18 +161,6 @@ public class NodeServiceImpl implements NodeService, VersionModel
return dbNodeService.getNodeStatus(nodeRef); return dbNodeService.getNodeStatus(nodeRef);
} }
/**
* Convert the incomming node ref (with the version store protocol specified)
* to the internal representation with the workspace protocol.
*
* @param nodeRef the incomming verison protocol node reference
* @return the internal version node reference
*/
private NodeRef convertNodeRef(NodeRef nodeRef)
{
return new NodeRef(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, STORE_ID), nodeRef.getId());
}
/** /**
* Delegates to the <code>NodeService</code> used as the version store implementation * Delegates to the <code>NodeService</code> used as the version store implementation
*/ */
@@ -184,7 +173,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
public ChildAssociationRef createNode( public ChildAssociationRef createNode(
NodeRef parentRef, NodeRef parentRef,
QName assocTypeQName, QName assocTypeQName,
QName assocQName, QName assocQName,
QName nodeTypeQName) throws InvalidNodeRefException QName nodeTypeQName) throws InvalidNodeRefException
@@ -192,12 +181,12 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
public ChildAssociationRef createNode( public ChildAssociationRef createNode(
NodeRef parentRef, NodeRef parentRef,
QName assocTypeQName, QName assocTypeQName,
QName assocQName, QName assocQName,
QName nodeTypeQName, QName nodeTypeQName,
@@ -206,7 +195,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -215,7 +204,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -227,7 +216,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -274,9 +263,9 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException public QName getType(NodeRef nodeRef) throws InvalidNodeRefException
{ {
return (QName)this.dbNodeService.getProperty(convertNodeRef(nodeRef), PROP_QNAME_FROZEN_NODE_TYPE); return (QName)this.dbNodeService.getProperty(VersionUtil.convertNodeRef(nodeRef), PROP_QNAME_FROZEN_NODE_TYPE);
} }
/** /**
* @see org.alfresco.service.cmr.repository.NodeService#setType(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) * @see org.alfresco.service.cmr.repository.NodeService#setType(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/ */
@@ -285,7 +274,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -318,7 +307,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException
{ {
return new HashSet<QName>( return new HashSet<QName>(
(ArrayList<QName>)this.dbNodeService.getProperty(convertNodeRef(nodeRef), PROP_QNAME_FROZEN_ASPECTS)); (ArrayList<QName>)this.dbNodeService.getProperty(VersionUtil.convertNodeRef(nodeRef), PROP_QNAME_FROZEN_ASPECTS));
} }
/** /**
@@ -326,9 +315,9 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
{ {
Map<QName, Serializable> result = new HashMap<QName, Serializable>(); Map<QName, Serializable> result = new HashMap<QName, Serializable>();
Collection<ChildAssociationRef> children = this.dbNodeService.getChildAssocs(convertNodeRef(nodeRef), CHILD_QNAME_VERSIONED_ATTRIBUTES, RegexQNamePattern.MATCH_ALL); Collection<ChildAssociationRef> children = this.dbNodeService.getChildAssocs(VersionUtil.convertNodeRef(nodeRef), CHILD_QNAME_VERSIONED_ATTRIBUTES, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef child : children) for (ChildAssociationRef child : children)
{ {
NodeRef versionedAttribute = child.getChildRef(); NodeRef versionedAttribute = child.getChildRef();
@@ -337,35 +326,35 @@ public class NodeServiceImpl implements NodeService, VersionModel
Serializable value = null; Serializable value = null;
QName qName = (QName)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_QNAME); QName qName = (QName)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_QNAME);
PropertyDefinition propDef = this.dicitionaryService.getProperty(qName); PropertyDefinition propDef = this.dicitionaryService.getProperty(qName);
Boolean isMultiValue = (Boolean)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_IS_MULTI_VALUE); Boolean isMultiValue = (Boolean)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_IS_MULTI_VALUE);
if (isMultiValue.booleanValue() == false) if (isMultiValue.booleanValue() == false)
{ {
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_VALUE); value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_VALUE);
value = (Serializable)DefaultTypeConverter.INSTANCE.convert(propDef.getDataType(), value); value = (Serializable)DefaultTypeConverter.INSTANCE.convert(propDef.getDataType(), value);
} }
else else
{ {
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_MULTI_VALUE); value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_MULTI_VALUE);
} }
result.put(qName, value); result.put(qName, value);
} }
return result; return result;
} }
/** /**
* Property translation for version store * Property translation for version store
*/ */
public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
{ {
// TODO should be doing this with a search ... // TODO should be doing this with a search ...
Map<QName, Serializable> properties = getProperties(convertNodeRef(nodeRef)); Map<QName, Serializable> properties = getProperties(VersionUtil.convertNodeRef(nodeRef));
return properties.get(qname); return properties.get(qname);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -374,7 +363,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -383,7 +372,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -395,17 +384,17 @@ public class NodeServiceImpl implements NodeService, VersionModel
/** /**
* The node will appear to be attached to the root of the version store * The node will appear to be attached to the root of the version store
* *
* @see NodeService#getParentAssocs(NodeRef) * @see NodeService#getParentAssocs(NodeRef)
*/ */
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef) public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef)
{ {
return getParentAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL); return getParentAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL);
} }
/** /**
* The node will apprear to be attached to the root of the version store * The node will apprear to be attached to the root of the version store
* *
* @see NodeService#getParentAssocs(NodeRef, QNamePattern, QNamePattern) * @see NodeService#getParentAssocs(NodeRef, QNamePattern, QNamePattern)
*/ */
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
@@ -428,7 +417,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException
{ {
return getChildAssocs(convertNodeRef(nodeRef), RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL); return getChildAssocs(VersionUtil.convertNodeRef(nodeRef), RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL);
} }
/** /**
@@ -438,46 +427,46 @@ public class NodeServiceImpl implements NodeService, VersionModel
{ {
// Get the child assocs from the version store // Get the child assocs from the version store
List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs( List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(
convertNodeRef(nodeRef), VersionUtil.convertNodeRef(nodeRef),
RegexQNamePattern.MATCH_ALL, CHILD_QNAME_VERSIONED_CHILD_ASSOCS); RegexQNamePattern.MATCH_ALL, CHILD_QNAME_VERSIONED_CHILD_ASSOCS);
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(childAssocRefs.size()); List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(childAssocRefs.size());
for (ChildAssociationRef childAssocRef : childAssocRefs) for (ChildAssociationRef childAssocRef : childAssocRefs)
{ {
// Get the child reference // Get the child reference
NodeRef childRef = childAssocRef.getChildRef(); NodeRef childRef = childAssocRef.getChildRef();
NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE); NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
if (this.dbNodeService.exists(referencedNode) == true) if (this.dbNodeService.exists(referencedNode) == true)
{ {
// get the qualified name of the frozen child association and filter out unwanted names // get the qualified name of the frozen child association and filter out unwanted names
QName qName = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_QNAME); QName qName = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_QNAME);
if (qnamePattern.isMatch(qName) == true) if (qnamePattern.isMatch(qName) == true)
{ {
// Retrieve the isPrimary and nthSibling values of the forzen child association // Retrieve the isPrimary and nthSibling values of the forzen child association
QName assocType = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_TYPE_QNAME); QName assocType = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_TYPE_QNAME);
boolean isPrimary = ((Boolean)this.dbNodeService.getProperty(childRef, PROP_QNAME_IS_PRIMARY)).booleanValue(); boolean isPrimary = ((Boolean)this.dbNodeService.getProperty(childRef, PROP_QNAME_IS_PRIMARY)).booleanValue();
int nthSibling = ((Integer)this.dbNodeService.getProperty(childRef, PROP_QNAME_NTH_SIBLING)).intValue(); int nthSibling = ((Integer)this.dbNodeService.getProperty(childRef, PROP_QNAME_NTH_SIBLING)).intValue();
// Build a child assoc ref to add to the returned list // Build a child assoc ref to add to the returned list
ChildAssociationRef newChildAssocRef = new ChildAssociationRef( ChildAssociationRef newChildAssocRef = new ChildAssociationRef(
assocType, assocType,
nodeRef, nodeRef,
qName, qName,
referencedNode, referencedNode,
isPrimary, isPrimary,
nthSibling); nthSibling);
result.add(newChildAssocRef); result.add(newChildAssocRef);
} }
} }
} }
// sort the results so that the order appears to be exactly as it was originally // sort the results so that the order appears to be exactly as it was originally
Collections.sort(result); Collections.sort(result);
return result; return result;
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -488,7 +477,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
} }
/** /**
* Simulates the node begin attached ot the root node of the version store. * Simulates the node begin attached ot the root node of the version store.
*/ */
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
{ {
@@ -498,7 +487,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
rootAssocName, rootAssocName,
nodeRef); nodeRef);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -508,7 +497,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -517,7 +506,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -525,31 +514,31 @@ public class NodeServiceImpl implements NodeService, VersionModel
{ {
// Get the child assocs from the version store // Get the child assocs from the version store
List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs( List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(
convertNodeRef(sourceRef), VersionUtil.convertNodeRef(sourceRef),
RegexQNamePattern.MATCH_ALL, CHILD_QNAME_VERSIONED_ASSOCS); RegexQNamePattern.MATCH_ALL, CHILD_QNAME_VERSIONED_ASSOCS);
List<AssociationRef> result = new ArrayList<AssociationRef>(childAssocRefs.size()); List<AssociationRef> result = new ArrayList<AssociationRef>(childAssocRefs.size());
for (ChildAssociationRef childAssocRef : childAssocRefs) for (ChildAssociationRef childAssocRef : childAssocRefs)
{ {
// Get the assoc reference // Get the assoc reference
NodeRef childRef = childAssocRef.getChildRef(); NodeRef childRef = childAssocRef.getChildRef();
NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE); NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
if (this.dbNodeService.exists(referencedNode) == true) if (this.dbNodeService.exists(referencedNode) == true)
{ {
// get the qualified type name of the frozen child association and filter out unwanted names // get the qualified type name of the frozen child association and filter out unwanted names
QName qName = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_TYPE_QNAME); QName qName = (QName)this.dbNodeService.getProperty(childRef, PROP_QNAME_ASSOC_TYPE_QNAME);
if (qnamePattern.isMatch(qName) == true) if (qnamePattern.isMatch(qName) == true)
{ {
AssociationRef newAssocRef = new AssociationRef(sourceRef, qName, referencedNode); AssociationRef newAssocRef = new AssociationRef(sourceRef, qName, referencedNode);
result.add(newAssocRef); result.add(newAssocRef);
} }
} }
} }
return result; return result;
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -558,7 +547,7 @@ public class NodeServiceImpl implements NodeService, VersionModel
// This operation is not supported for a version store // This operation is not supported for a version store
throw new UnsupportedOperationException(MSG_UNSUPPORTED); throw new UnsupportedOperationException(MSG_UNSUPPORTED);
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */
@@ -567,9 +556,9 @@ public class NodeServiceImpl implements NodeService, VersionModel
ChildAssociationRef childAssocRef = getPrimaryParent(nodeRef); ChildAssociationRef childAssocRef = getPrimaryParent(nodeRef);
Path path = new Path(); Path path = new Path();
path.append(new Path.ChildAssocElement(childAssocRef)); path.append(new Path.ChildAssocElement(childAssocRef));
return path; return path;
} }
/** /**
* @throws UnsupportedOperationException always * @throws UnsupportedOperationException always
*/ */

File diff suppressed because it is too large Load Diff

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.repo.version.common; package org.alfresco.repo.version.common;
@@ -27,11 +27,13 @@ package org.alfresco.repo.version.common;
import java.util.Collection; import java.util.Collection;
import org.alfresco.repo.version.VersionModel; import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.version.ReservedVersionNameException; import org.alfresco.service.cmr.version.ReservedVersionNameException;
/** /**
* Helper class containing helper methods for the versioning services. * Helper class containing helper methods for the versioning services.
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class VersionUtil public class VersionUtil
@@ -40,20 +42,20 @@ public class VersionUtil
* Reserved property names * Reserved property names
*/ */
public static final String[] RESERVED_PROPERTY_NAMES = new String[]{ public static final String[] RESERVED_PROPERTY_NAMES = new String[]{
VersionModel.PROP_CREATED_DATE, VersionModel.PROP_CREATED_DATE,
VersionModel.PROP_FROZEN_NODE_ID, VersionModel.PROP_FROZEN_NODE_ID,
VersionModel.PROP_FROZEN_NODE_STORE_ID, VersionModel.PROP_FROZEN_NODE_STORE_ID,
VersionModel.PROP_FROZEN_NODE_STORE_PROTOCOL, VersionModel.PROP_FROZEN_NODE_STORE_PROTOCOL,
VersionModel.PROP_FROZEN_NODE_TYPE, VersionModel.PROP_FROZEN_NODE_TYPE,
VersionModel.PROP_FROZEN_ASPECTS, VersionModel.PROP_FROZEN_ASPECTS,
VersionModel.PROP_VERSION_LABEL, VersionModel.PROP_VERSION_LABEL,
VersionModel.PROP_VERSION_NUMBER}; VersionModel.PROP_VERSION_NUMBER};
/** /**
* Checks that the names of the additional version properties are valid and that they do not clash * Checks that the names of the additional version properties are valid and that they do not clash
* with the reserved properties. * with the reserved properties.
* *
* @param versionProperties the property names * @param versionProperties the property names
* @return true is the names are considered valid, false otherwise * @return true is the names are considered valid, false otherwise
* @throws ReservedVersionNameException * @throws ReservedVersionNameException
*/ */
@@ -68,4 +70,16 @@ public class VersionUtil
} }
} }
} }
/**
* Convert the incomming node ref (with the version store protocol specified)
* to the internal representation with the workspace protocol.
*
* @param nodeRef the incomming verison protocol node reference
* @return the internal version node reference
*/
public static NodeRef convertNodeRef(NodeRef nodeRef)
{
return new NodeRef(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, VersionModel.STORE_ID), nodeRef.getId());
}
} }

View File

@@ -35,7 +35,7 @@ import org.alfresco.service.PublicService;
/** /**
* This service interface provides support for content filter languages . * This service interface provides support for content filter languages .
* *
* @author yanipig * @author Yannick Pignot
* *
*/ */
@PublicService @PublicService

View File

@@ -0,0 +1,95 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.service.cmr.ml;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.alfresco.service.Auditable;
import org.alfresco.service.PublicService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.namespace.QName;
/**
* The API to manage editions of a mlContainer. An edition is a version of a <b>mlContainer</b>
*
* @since 2.1
* @author Yannick Pignot
*/
@PublicService
public interface EditionService
{
/**
* Create a new edition of an existing <b>cm:mlContainer</b> using any one of the
* associated <b>cm:mlDocument</b> transalations.
*
* If startingTranslationNodeRef is multilingual, it will be copied. The copy will become the pivot translation
* of the new Edition of the <b>cm:mlContainer</b>. The reference of the copy will be returned.
*
* @param translationNodeRef The specific <b>cm:mlDocument</b> to use as the starting point
* of the new edition. All other translations will be removed.
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef", "versionProperties"})
NodeRef createEdition(NodeRef translationNodeRef, Map<String, Serializable> versionProperties);
/**
* Get editions of an existing <b>cm:mlContainer</b>.
*
* @param mlContainer An existing <b>cm:mlContainer</b>
* @return The Version History of the mlContainer
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"mlContainer"})
VersionHistory getEditions(NodeRef mlContainer);
/**
* Get the different <b>cm:mlDocument</b> transalation version histories of a specific edition of a <b>cm:mlContainer</b>
*
* @param mlContainerEdition An existing version of a mlContainer
* @return The list of <b>cm:mlDocument</b> transalation versions of the edition
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"mlContainerEdition"})
List<VersionHistory> getVersionedTranslations(Version mlContainerEdition);
/**
* Get the the versioned metadata of a specific <b>cm:mlDocument</b> transalation version or a specific
* <b>cm:mlContainer</b> version
*
* @see org.alfresco.repo.model.ml.MultilingualDocumentAspect.PROPERTIES_TO_VERSION the versioned metadata
* of a <b>cm:mlDocument</b> transalation added to the usual metadata versioned for a normal node.
*
* @see org.alfresco.repo.model.ml.MLContainerType.PROPERTIES_TO_VERSION the versioned metadata
* of a <b>cm:mlContainer</b> added to the usual metadata versioned for a normal node.
*
* @param version An existing version of a <b>cm:mlDocument</b> translation version or
* an existing version of a <b>cm:mlContainer</b> version.
* @return The versioned metadata
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"version"})
Map<QName, Serializable> getVersionedMetadatas(Version version);
}

View File

@@ -15,11 +15,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of * As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre * the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing"
*/ */
package org.alfresco.service.cmr.ml; package org.alfresco.service.cmr.ml;
@@ -35,7 +35,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/** /**
* The API to manage multilingual content and related structures. * The API to manage multilingual content and related structures.
* *
* @author Derek Hulley * @author Derek Hulley
* @author Philippe Dubois * @author Philippe Dubois
*/ */
@@ -44,19 +44,19 @@ public interface MultilingualContentService
{ {
/** /**
* Checks whether an existing document is part of a translation group. * Checks whether an existing document is part of a translation group.
* *
* @param contentNodeRef An existing <b>cm:content</b> * @param contentNodeRef An existing <b>cm:content</b>
* @return Returns <tt>true</tt> if the document has a <b>cm:mlContainer</b> parent * @return Returns <tt>true</tt> if the document has a <b>cm:mlContainer</b> parent
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef"})
boolean isTranslation(NodeRef contentNodeRef); boolean isTranslation(NodeRef contentNodeRef);
/** /**
* Make an existing document into a translation by adding the <b>cm:mlDocument</b> aspect and * Make an existing document into a translation by adding the <b>cm:mlDocument</b> aspect and
* creating a <b>cm:mlContainer</b> parent. If it is already a translation, then nothing is done. * creating a <b>cm:mlContainer</b> parent. If it is already a translation, then nothing is done.
* *
* @param contentNodeRef An existing <b>cm:content</b> * @param contentNodeRef An existing <b>cm:content</b>
* *
* @see org.alfresco.model.ContentModel#ASPECT_MULTILINGUAL_DOCUMENT * @see org.alfresco.model.ContentModel#ASPECT_MULTILINGUAL_DOCUMENT
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef", "locale"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef", "locale"})
@@ -65,12 +65,12 @@ public interface MultilingualContentService
/** /**
* Removes the node from any associated translations. If the translation is the * Removes the node from any associated translations. If the translation is the
* pivot translation, then the entire set of translations will be unhooked. * pivot translation, then the entire set of translations will be unhooked.
* *
* @param translationNodeRef an existing <b>cm:mlDocument</b> * @param translationNodeRef an existing <b>cm:mlDocument</b>
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"})
void unmakeTranslation(NodeRef translationNodeRef); void unmakeTranslation(NodeRef translationNodeRef);
/** /**
* Make a translation out of an existing document. The necessary translation structures will be created * Make a translation out of an existing document. The necessary translation structures will be created
* as necessary. * as necessary.
@@ -90,61 +90,51 @@ public interface MultilingualContentService
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"})
NodeRef getTranslationContainer(NodeRef translationNodeRef); NodeRef getTranslationContainer(NodeRef translationNodeRef);
/**
* Create a new edition of an existing <b>cm:mlContainer</b> using any one of the
* associated <b>cm:mlDocument</b> transalations.
*
* @param translationNodeRef The specific <b>cm:mlDocument</b> to use as the starting point
* of the new edition. All other translations will be removed.
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"})
void createEdition(NodeRef translationNodeRef);
/** /**
* Gets the set of sibling translations associated with the given <b>cm:mlDocument</b> or * Gets the set of sibling translations associated with the given <b>cm:mlDocument</b> or
* <b>cm:mlContainer</b>. * <b>cm:mlContainer</b>.
* *
* @param translationOfNodeRef An existing <b>cm:mlDocument</b> or <b>cm:mlContainer</b> * @param translationOfNodeRef An existing <b>cm:mlDocument</b> or <b>cm:mlContainer</b>
* @return Returns a map of translation nodes keyed by locale * @return Returns a map of translation nodes keyed by locale
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationOfNodeRef"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"translationOfNodeRef"})
Map<Locale, NodeRef> getTranslations(NodeRef translationOfNodeRef); Map<Locale, NodeRef> getTranslations(NodeRef translationOfNodeRef);
/** /**
* Given a <b>cm:mlDocument</b>, this method attempts to find the best translation for the given * Given a <b>cm:mlDocument</b>, this method attempts to find the best translation for the given
* locale. If there is not even a * locale. If there is not even a
* {@link org.alfresco.i18n.I18NUtil#getNearestLocale(Locale, Set) partial match}, then the * {@link org.alfresco.i18n.I18NUtil#getNearestLocale(Locale, Set) partial match}, then the
* {@link #getPivotTranslation(NodeRef) pivot translation} is used. If that also gives no results * {@link #getPivotTranslation(NodeRef) pivot translation} is used. If that also gives no results
* then the translation itself is returned. * then the translation itself is returned.
* *
* @param translationNodeRef the <b>cm:mlDocument</b> * @param translationNodeRef the <b>cm:mlDocument</b>
* @param locale the target locale * @param locale the target locale
* @return Returns the best match for the locale (never <tt>null</tt>) * @return Returns the best match for the locale (never <tt>null</tt>)
* *
* @see #getTranslations(NodeRef) * @see #getTranslations(NodeRef)
* @see org.alfresco.i18n.I18NUtil#getNearestLocale(Locale, Set) * @see org.alfresco.i18n.I18NUtil#getNearestLocale(Locale, Set)
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef", "locale"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef", "locale"})
NodeRef getTranslationForLocale(NodeRef translationNodeRef, Locale locale); NodeRef getTranslationForLocale(NodeRef translationNodeRef, Locale locale);
/** /**
* Given a <b>cm:mlDocument</b> or <b>cm:mlContainer</b> this node returns each locale for * Given a <b>cm:mlDocument</b> or <b>cm:mlContainer</b> this node returns each locale for
* which there isn't a translation. * which there isn't a translation.
* *
* @param localizedNodeRef the <b>cm:mlDocument</b> or <b>cm:mlContainer</b> * @param localizedNodeRef the <b>cm:mlDocument</b> or <b>cm:mlContainer</b>
* @param addThisNodeLocale if true, add the locale of the given <b>cm:mlDocument</b> in the list. * @param addThisNodeLocale if true, add the locale of the given <b>cm:mlDocument</b> in the list.
* @return Returns a list of missng locales * @return Returns a list of missng locales
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"localizedNodeRef", "addThisNodeLocale"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"localizedNodeRef", "addThisNodeLocale"})
List<Locale> getMissingTranslations(NodeRef localizedNodeRef, boolean addThisNodeLocale); List<Locale> getMissingTranslations(NodeRef localizedNodeRef, boolean addThisNodeLocale);
/** /**
* Given any node, this returns the pivot translation. All multilingual documents belong to * Given any node, this returns the pivot translation. All multilingual documents belong to
* a group linked by a hidden parent node of type <b>cm:mlContainer</b>. The pivot language * a group linked by a hidden parent node of type <b>cm:mlContainer</b>. The pivot language
* for the translations is stored on the parent, and the child that has the same locale is the * for the translations is stored on the parent, and the child that has the same locale is the
* pivot translation. * pivot translation.
* *
* @param nodeRef a <b>cm:mlDocument</b> translation or <b>cm:mlContainer</b> translation * @param nodeRef a <b>cm:mlDocument</b> translation or <b>cm:mlContainer</b> translation
* container * container
* @return Returns a corresponding <b>cm:mlDocument</b> that matches the locale of * @return Returns a corresponding <b>cm:mlDocument</b> that matches the locale of
@@ -153,7 +143,7 @@ public interface MultilingualContentService
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
NodeRef getPivotTranslation(NodeRef nodeRef); NodeRef getPivotTranslation(NodeRef nodeRef);
/** /**
* Make a empty translation out of an existing pivot translation. The given translation or * Make a empty translation out of an existing pivot translation. The given translation or
* container will be used to find the pivot translation. Failing this, the given translation * container will be used to find the pivot translation. Failing this, the given translation
@@ -164,12 +154,40 @@ public interface MultilingualContentService
* </pre> * </pre>
* <p/> * <p/>
* The necessary translation structures will be created as necessary. * The necessary translation structures will be created as necessary.
* *
* @param translationOfNodeRef An existing <b>cm:mlDocument</b> * @param translationOfNodeRef An existing <b>cm:mlDocument</b>
* @param name The name of the file to create, or <tt>null</tt> to use * @param name The name of the file to create, or <tt>null</tt> to use
* the default naming convention. * the default naming convention.
* @return Returns the new created <b>cm:mlEmptyTranslation</b> * @return Returns the new created <b>cm:mlEmptyTranslation</b>
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationOfNodeRef", "name", "locale"}) @Auditable(key = Auditable.Key.ARG_0, parameters = {"translationOfNodeRef", "name", "locale"})
NodeRef addEmptyTranslation(NodeRef translationOfNodeRef, String name, Locale locale); NodeRef addEmptyTranslation(NodeRef translationOfNodeRef, String name, Locale locale);
/**
* Copies the given <b>cm:mlContainer</b>.
* <p>
* This involves the copy of the <b>cm:mlContainer</b> node and the copy of its <b>cm:mlDocument</b>.
* <p>
*
* @param translationNodeRef The <b>cm:mlContainer</b> to copy
* @param newParentRef The new parent of the copied <b>cm:mlDocument</b>
* @return The copied <b>cm:mlContainer</b>
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef", "newParentRef"})
NodeRef copyTranslationContainer(NodeRef translationNodeRef, NodeRef newParentRef);
/**
* Moves the location of the given <b>cm:mlContainer</b>.
* <p>
* This not involves changing the <b>cm:mlContainer</b> node but moves its <b>cm:mlDocument</b>.
* <p>
*
* @param translationNodeRef The <b>cm:mlContainer</b> to move
* @param newParentRef The new parent of the moved <b>cm:mlDocument</b>
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef", "newParentRef"})
void moveTranslationContainer(NodeRef translationNodeRef, NodeRef newParentRef);
} }