Merge branch 'release/V2.4' of gitlab.alfresco.com:records-management/records-management into feature/RM-2700_CommunityOnEnterprise

This commit is contained in:
Roy Wetherall
2016-02-25 10:42:21 +11:00
5 changed files with 54 additions and 22 deletions

View File

@@ -132,6 +132,11 @@
<artifactId>wiremock</artifactId>
<version>1.56</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>

View File

@@ -168,8 +168,9 @@ public class ContentDestructionComponent
// We want to remove the rn:renditioned aspect, but due to the possibility
// that there is Alfresco 3.2-era data with the cm:thumbnailed aspect
// applied, we must consider removing it too.
if (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) ||
getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED))
if (includeRenditions
&& (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED)
|| getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)))
{
// get the rendition assoc types
Set<QName> childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet();
@@ -179,6 +180,9 @@ public class ContentDestructionComponent
{
// destroy renditions content
destroyContent(child.getChildRef(), false);
//delete the rendition node
getNodeService().deleteNode(child.getChildRef());
}
}
}

View File

@@ -108,7 +108,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
*
* @return job query string
*/
private String getQuery()
protected String getQuery()
{
if (query == null)
{
@@ -133,8 +133,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
}
sb.append("))");
sb.append(" AND ISNULL:\"rma:dispositionActionCompletedAt\" ");
sb.append(" + ( ");
sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" ");
sb.append(" AND ( ");
sb.append("@rma\\:dispositionEventsEligible:true ");
sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] ");
sb.append(") ");

View File

@@ -228,24 +228,33 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
* @param typeQName
* @return
*/
private boolean shouldRuleBeAppliedToNode(Rule rule, NodeRef nodeRef, QName typeQName)
private boolean shouldRuleBeAppliedToNode(final Rule rule, final NodeRef nodeRef, final QName typeQName)
{
boolean result = true;
NodeRef ruleNodeRef = getOwningNodeRef(rule);
if(filePlanService.isFilePlan(ruleNodeRef))
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{
// if this rule is defined at the root of the file plan then we do not want to apply
// it to holds/transfers/unfiled content...
result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) ||
RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) ||
RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) ||
RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) ||
RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER.equals(typeQName) ||
RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) ||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRING) ||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) ||
!recordService.isFiled(nodeRef));
}
return result;
public Boolean doWork() throws Exception
{
boolean result = true;
NodeRef ruleNodeRef = getOwningNodeRef(rule);
if (filePlanService.isFilePlan(ruleNodeRef))
{
// if this rule is defined at the root of the file plan then
// we do not want to apply
// it to holds/transfers/unfiled content...
result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName)
|| RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName)
|| RecordsManagementModel.TYPE_TRANSFER.equals(typeQName)
|| RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName)
|| RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER
.equals(typeQName)
|| RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName)
|| nodeService.hasAspect(nodeRef,
RecordsManagementModel.ASPECT_TRANSFERRING)
|| nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN)
|| !recordService.isFiled(nodeRef));
}
return result;
}
});
}
}

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.job;
import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyMap;
import static org.mockito.Matchers.anyString;
@@ -229,4 +230,17 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
// ensure no more interactions
verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService);
}
/**
* Brittle unit test that simply checks the generated query is an exact string when the supplied disposition actions
* are "CUTOFF" and "RETAIN" (see {@link #before}).
*/
@Test
public void testGetQuery()
{
String actual = executer.getQuery();
String expected = "TYPE:\"rma:dispositionAction\" + (@rma\\:dispositionAction:(\"cutoff\" OR \"retain\")) AND ISUNSET:\"rma:dispositionActionCompletedAt\" AND ( @rma\\:dispositionEventsEligible:true OR @rma\\:dispositionAsOf:[MIN TO NOW] ) ";
assertEquals(expected, actual);
}
}