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> <artifactId>wiremock</artifactId>
<version>1.56</version> <version>1.56</version>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>

View File

@@ -168,8 +168,9 @@ public class ContentDestructionComponent
// We want to remove the rn:renditioned aspect, but due to the possibility // 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 // that there is Alfresco 3.2-era data with the cm:thumbnailed aspect
// applied, we must consider removing it too. // applied, we must consider removing it too.
if (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) || if (includeRenditions
getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)) && (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED)
|| getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)))
{ {
// get the rendition assoc types // get the rendition assoc types
Set<QName> childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); Set<QName> childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet();
@@ -179,6 +180,9 @@ public class ContentDestructionComponent
{ {
// destroy renditions content // destroy renditions content
destroyContent(child.getChildRef(), false); 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 * @return job query string
*/ */
private String getQuery() protected String getQuery()
{ {
if (query == null) if (query == null)
{ {
@@ -133,8 +133,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
} }
sb.append("))"); sb.append("))");
sb.append(" AND ISNULL:\"rma:dispositionActionCompletedAt\" "); sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" ");
sb.append(" + ( "); sb.append(" AND ( ");
sb.append("@rma\\:dispositionEventsEligible:true "); sb.append("@rma\\:dispositionEventsEligible:true ");
sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] ");
sb.append(") "); sb.append(") ");

View File

@@ -228,24 +228,33 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
* @param typeQName * @param typeQName
* @return * @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; return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
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 public Boolean doWork() throws Exception
// it to holds/transfers/unfiled content... {
result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) || boolean result = true;
RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) || NodeRef ruleNodeRef = getOwningNodeRef(rule);
RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) || if (filePlanService.isFilePlan(ruleNodeRef))
RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) || {
RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER.equals(typeQName) || // if this rule is defined at the root of the file plan then
RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) || // we do not want to apply
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRING) || // it to holds/transfers/unfiled content...
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) || result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName)
!recordService.isFiled(nodeRef)); || RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName)
} || RecordsManagementModel.TYPE_TRANSFER.equals(typeQName)
return result; || 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; 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.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.any;
import static org.mockito.Matchers.anyMap; import static org.mockito.Matchers.anyMap;
import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyString;
@@ -229,4 +230,17 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest
// ensure no more interactions // ensure no more interactions
verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService); 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);
}
} }