Merge branch 'release/V2.4'

Conflicts:
	rm-community/rm-community-share/pom.xml
	rm-enterprise/rm-enterprise-share/pom.xml
This commit is contained in:
Tuna Aksoy
2016-03-31 15:29:35 +01:00
7 changed files with 282 additions and 17 deletions

19
pom.xml
View File

@@ -214,6 +214,25 @@
<ignore /> <ignore />
</action> </action>
</pluginExecution> </pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<versionRange>
[1.9.1,)
</versionRange>
<goals>
<goal>regex-properties</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions> </pluginExecutions>
</lifecycleMappingMetadata> </lifecycleMappingMetadata>
</configuration> </configuration>

View File

@@ -9,7 +9,7 @@
<property name="description" value="RM patch executer"/> <property name="description" value="RM patch executer"/>
<property name="sinceVersion" value="2.2"/> <property name="sinceVersion" value="2.2"/>
<property name="executeOnceOnly" value="false"/> <property name="executeOnceOnly" value="false"/>
<property name="moduleSchema" value="2001"/> <property name="moduleSchema" value="2401"/>
<property name="attributeService" ref="AttributeService" /> <property name="attributeService" ref="AttributeService" />
<property name="dependsOn"> <property name="dependsOn">
<list> <list>
@@ -28,10 +28,7 @@
<!-- import patch implementations --> <!-- import patch implementations -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml"/> <import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v*-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml"/>
<!-- compatibility beans --> <!-- compatibility beans -->

View File

@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- RM v2.4 Patches -->
<bean id="rm.filePlanContainerRuleInheritancePatch"
parent="rm.parentModulePatch"
class="org.alfresco.module.org_alfresco_module_rm.patch.v24.RMv24FilePlanContainerRuleInheritancePatch">
<property name="description" value="Break rule inheritance for existing file plan containers."/>
<property name="fixesToSchema" value="2400"/>
<property name="targetSchema" value="2401"/>
<property name="filePlanService" ref="filePlanService"/>
<property name="nodeService" ref="nodeService"/>
</bean>
</beans>

View File

@@ -277,11 +277,6 @@
</build> </build>
<dependencies> <dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency> <dependency>
<groupId>${alfresco.groupId}</groupId> <groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-remote-api</artifactId> <artifactId>alfresco-remote-api</artifactId>
@@ -332,10 +327,12 @@
<groupId>postgresql</groupId> <groupId>postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>${alfresco.postgres.version}</version> <version>${alfresco.postgres.version}</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${alfresco.groupId}</groupId> <groupId>${alfresco.groupId}</groupId>
@@ -348,6 +345,7 @@
<artifactId>*</artifactId> <artifactId>*</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -540,6 +538,30 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${alfresco.postgres.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${alfresco.mysql.version}</version>
</dependency>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${alfresco.version}</version>
<classifier>h2scripts</classifier>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@@ -0,0 +1,91 @@
/*
* #%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.module.org_alfresco_module_rm.patch.v24;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
import org.alfresco.repo.rule.RuleModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
/**
* RM v2.4 patch that ensures that file plan root containers do not inherited rules, because this is no longer enforced
* in the service code anymore.
*
* See https://issues.alfresco.com/jira/browse/RM-3154
*
* @author Roy Wetherall
* @since 2.4
*/
public class RMv24FilePlanContainerRuleInheritancePatch extends AbstractModulePatch
{
/** file plan service */
private FilePlanService filePlanService;
/** node service */
private NodeService nodeService;
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
*
* Note that we do not break rule inheritance for the root file since this wasn't previously
* the behaviour and we don't want to prevent this from happening if the current installation
* has been setup to allow it.
*/
@Override
public void applyInternal()
{
// get all the file plans
Set<NodeRef> filePlans = filePlanService.getFilePlans();
for (NodeRef filePlan : filePlans)
{
// set rule inheritance for all root file plan containers
nodeService.addAspect(filePlanService.getUnfiledContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
nodeService.addAspect(filePlanService.getHoldContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
nodeService.addAspect(filePlanService.getTransferContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
}
}
}

View File

@@ -0,0 +1,118 @@
/*
* #%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.module.org_alfresco_module_rm.patch.v24;
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateNodeRef;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import java.util.Collections;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.rule.RuleModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
/**
* RM V2.4 File Plan container rule inheritance patch unit test.
*
* @author Roy Wetherall
* @since 2.4
*/
public class RMv24FilePlanContainerRuleInheritancePatchUnitTest
{
private @Mock NodeService mockedNodeService;
private @Mock FilePlanService mockedFilePlanService;
private @InjectMocks RMv24FilePlanContainerRuleInheritancePatch patch;
@Before
public void before()
{
MockitoAnnotations.initMocks(this);
}
/**
* Given there are not file plans,
* When the patch is executed,
* Then nothing happens
*/
@SuppressWarnings("unchecked")
@Test
public void noFilePlans()
{
// given
when(mockedFilePlanService.getFilePlans())
.thenReturn(Collections.EMPTY_SET);
// when
patch.applyInternal();
// then
verifyZeroInteractions(mockedNodeService);
}
/**
* Given there is a file plan,
* When the patch is executed,
* Then the file plan containers are updated
*/
@Test
public void atLeastOneFilePlan()
{
NodeRef filePlan = generateNodeRef(mockedNodeService, RecordsManagementModel.TYPE_FILE_PLAN);
NodeRef holdsContainer = generateNodeRef(mockedNodeService);
NodeRef transferContainer = generateNodeRef(mockedNodeService);
NodeRef unfiledRecordsContainer = generateNodeRef(mockedNodeService);
// given
when(mockedFilePlanService.getFilePlans())
.thenReturn(Collections.singleton(filePlan));
when(mockedFilePlanService.getHoldContainer(filePlan))
.thenReturn(holdsContainer);
when(mockedFilePlanService.getTransferContainer(filePlan))
.thenReturn(transferContainer);
when(mockedFilePlanService.getUnfiledContainer(filePlan))
.thenReturn(unfiledRecordsContainer);
// when
patch.applyInternal();
// then
verify(mockedNodeService).addAspect(holdsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
verify(mockedNodeService).addAspect(transferContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
verify(mockedNodeService).addAspect(unfiledRecordsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null);
}
}