Merge branch 'release/V2.4'

Conflicts:
	rm-automation/src/test/java/org/alfresco/test/TestData.java
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_de.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_es.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_fr.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_it.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_ja.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_nb.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_nl.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_pt_BR.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_ru.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content-model_zh_CN.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_de.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_es.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_fr.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_it.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_ja.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_nb.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_nl.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_pt_BR.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_ru.properties
	rm-enterprise/rm-enterprise-repo/src/main/amp/config/alfresco/module/alfresco-rm-enterprise-repo/messages/classified-content_zh_CN.properties
This commit is contained in:
Tuna Aksoy
2016-04-12 09:30:57 +01:00
5 changed files with 254 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Extend Imap Service -->
<bean id="rm.imapService" abstract="true" class="org.alfresco.repo.imap.ExtendedImapServiceImpl">
<property name="dictionaryService" ref="DictionaryService"/>
<property name="authenticationUtil" ref="AuthenticationUtil"/>
</bean>
<bean class="org.alfresco.util.BeanExtender">
<property name="beanName" value="imapService" />
<property name="extendingBeanName" value="rm.imapService" />
</bean>
</beans>

View File

@@ -18,7 +18,7 @@ rm.action.ghosted-prop-update=Impossibile aggiornare le propriet\u00e0 di conten
rm.action.valid-date-disp-asof=La data di inizio dell'azione di amministrazione deve corrispondere a una data valida.
rm.action.disp-asof-lifecycle-applied=Impossibile modificare la data di inizio di amministrazione per un record o cartella di record per cui \u00e8 stato impostato un ciclo di vita.
rm.action.hold-edit-reason-none=Impossibile modificare il motivo sospensione, poich\u00e9 non \u00e8 stato fornito alcun motivo.
rm.action.hold-edit-type=Impossibile modificare il motivo sospensione, poich\u00e9 il nodo su cui \u00e8 stata eseguita l'azione non \u00e8 del tipo {0}. (nodeRef={1})
rm.action.hold-edit-type=Impossibile modificare il motivo sospensione, poich\u00e9 il nodo su cui \u00e8 stata eseguita l''azione non \u00e8 del tipo {0}. (nodeRef={1})
rm.action.specify-avlid-date=La data di inizio dell'esame deve corrispondere a una data valida.
rm.action.review-details-only=\u00c8 possibile modificare solo i dettagli di esame dei record fondamentali.
rm.action.freeze-no-reason=Impossibile tenere in sospeso un record senza un motivo.
@@ -34,6 +34,6 @@ rm.action.node-not-transfer=Il nodo non \u00e8 un oggetto da trasferire.
rm.action.undo-not-last=Impossibile annullare il cut off, poich\u00e9 l'ultima azione di amministrazione non \u00e8 stata interrotta.
rm.action.records_only_undeclared=Solo i record possono essere completati.
rm.action.event-not-undone=Impossibile annullare l''evento {0}, poich\u00e9 non \u00e8 definito nel ciclo di vita di amministrazione.
rm.action.node-not-record-category=Non \u00e8 stato possibile creare il programma di amministrazione, poich\u00e9 il nodo ({0}) su cui \u00e8 stata eseguita l'azione non costituiva una categoria record.
rm.action.node-not-record-category=Non \u00e8 stato possibile creare il programma di amministrazione, poich\u00e9 il nodo ({0}) su cui \u00e8 stata eseguita l''azione non costituiva una categoria record.
rm.action.parameter-not-supplied=Il parametro ''{0}'' non \u00e8 stato fornito.
rm.action.delete-not-hold-type=Non \u00e8 stato possibile cancellare la sospensione, poich\u00e9 il nodo non \u00e8 del tipo {0}. (actionedUponNodeRef={1})

View File

@@ -224,7 +224,8 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
@Override
public Void doWork()
{
if (nodeService.exists(nodeRef))
// Check if the node exists and the aspect hasn't been removed in the same transaction (see RM-3266)
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName))
{
// Look up the root and set on the aspect if found
NodeRef root = filePlanService.getFilePlan(nodeRef);

View File

@@ -0,0 +1,109 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco 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 Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.imap;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
/**
* Extends the core service ImapServiceImpl functionality
*
* @author Ana Bozianu
* @since 2.4
*
*/
public class ExtendedImapServiceImpl extends ImapServiceImpl
{
private NodeService nodeService;
private BehaviourFilter policyBehaviourFilter;
private DictionaryService dictionaryService;
private AuthenticationUtil authenticationUtil;
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
public void setPolicyFilter(BehaviourFilter policyBehaviourFilter)
{
this.policyBehaviourFilter = policyBehaviourFilter;
super.setPolicyFilter(policyBehaviourFilter);
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
super.setNodeService(nodeService);
}
/**
* Overwrites the core functionality so we can list RM files in IMAP
* @see https://issues.alfresco.com/jira/browse/RM-3216
*/
@Override
public String getPathFromSites(final NodeRef ref)
{
return doAsSystem(new RunAsWork<String>()
{
@Override
public String doWork() throws Exception
{
String name = ((String) nodeService.getProperty(ref, ContentModel.PROP_NAME)).toLowerCase();
if (dictionaryService.isSubClass(nodeService.getType(ref), SiteModel.TYPE_SITE))
{
return name;
}
else
{
NodeRef parent = nodeService.getPrimaryParent(ref).getParentRef();
return getPathFromSites(parent) + "/" + name;
}
}
});
}
private <R> R doAsSystem(RunAsWork<R> work)
{
policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE);
policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE);
try
{
return authenticationUtil.runAsSystem(work);
}
finally
{
policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE);
policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE);
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco 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 Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.imap;
import static org.mockito.Mockito.when;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
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.repository.StoreRef;
import org.alfresco.service.namespace.QName;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.extensions.webscripts.GUID;
/**
* Unit test for ExtendedImapServiceImpl
* @author Ana Bozianu
*/
public class ExtendedImapServiceImplUnitTest
{
/* service mocks */
private @Mock NodeService mockedNodeService;
private @Mock BehaviourFilter mockedPolicyBehaviourFilter;
private @Mock DictionaryService mockedDictionaryService;
private @Mock AuthenticationUtil mockedAuthenticationUtil;
/* test instance of extended IMAP service implementation */
private @InjectMocks ExtendedImapServiceImpl extendedImapServiceImpl;
/* test data */
private NodeRef rmSite = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
private final String RM_SITE_NAME = "RM";
private NodeRef rmFilePlan = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
private final String RM_FILEPLAN_NAME = "fileplan";
private NodeRef rmCategory = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
private final String RM_CATEGORY_NAME = "C1";
@Before
public void setup()
{
MockitoAnnotations.initMocks(this);
// setup mocked authentication util
MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil);
// node names
when(mockedNodeService.getProperty(rmSite, ContentModel.PROP_NAME)).thenReturn(RM_SITE_NAME);
when(mockedNodeService.getProperty(rmCategory, ContentModel.PROP_NAME)).thenReturn(RM_CATEGORY_NAME);
when(mockedNodeService.getProperty(rmFilePlan, ContentModel.PROP_NAME)).thenReturn(RM_FILEPLAN_NAME);
// node types
when(mockedNodeService.getType(rmSite)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
when(mockedNodeService.getType(rmFilePlan)).thenReturn(RecordsManagementModel.TYPE_FILE_PLAN);
when(mockedNodeService.getType(rmCategory)).thenReturn(RecordsManagementModel.TYPE_RECORD_CATEGORY);
// type hierarchy
when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RM_SITE, SiteModel.TYPE_SITE)).thenReturn(true);
when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_FILE_PLAN, SiteModel.TYPE_SITE)).thenReturn(false);
when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RECORD_CATEGORY, SiteModel.TYPE_SITE)).thenReturn(false);
// node associations
ChildAssociationRef filePlanParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmSite, QName.createQName(GUID.generate()), rmFilePlan);
when(mockedNodeService.getPrimaryParent(rmFilePlan)).thenReturn(filePlanParentAssoc);
ChildAssociationRef categoryParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmFilePlan, QName.createQName(GUID.generate()), rmCategory);
when(mockedNodeService.getPrimaryParent(rmCategory)).thenReturn(categoryParentAssoc);
}
/**
* given the method is called on the rm site node
* check if the result is the site name
*/
@Test
public void testGetPathFromRMSite()
{
String rmSitePath = extendedImapServiceImpl.getPathFromSites(rmSite);
Assert.assertEquals("Incorrect return value", RM_SITE_NAME.toLowerCase(), rmSitePath);
}
/**
* given the method is called on a rm category
* check if the result is the full path relative to the rm site
*/
@Test
public void testGetPathFromRMCategory()
{
String rmCategoryPath = extendedImapServiceImpl.getPathFromSites(rmCategory);
Assert.assertEquals("Incorrect return value", (RM_SITE_NAME + "/" + RM_FILEPLAN_NAME + "/" + RM_CATEGORY_NAME).toLowerCase(), rmCategoryPath);
}
}