Merge commit 'c03c6da96' into merge-2.3/Merge231ReleaseIn23

# Conflicts:
#	pom.xml
#	rm-automation/pom.xml
#	rm-server/pom.xml
#	rm-share/pom.xml
This commit is contained in:
Oana Nechiforescu
2016-11-11 14:40:57 +02:00
5 changed files with 72 additions and 50 deletions

View File

@@ -31,7 +31,7 @@ import org.alfresco.service.namespace.QName;
*/
public final class RecordsManagementAuditQueryParameters
{
private int maxEntries = -1;
private int maxEntries = Integer.MAX_VALUE;
private String user;
private NodeRef nodeRef;
private Date dateFrom;

View File

@@ -510,48 +510,45 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
*/
private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction)
{
if (!methodCached("updateDispositionActionProperties", record))
Map<QName, Serializable> props = nodeService.getProperties(record);
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
if (daDefinition != null)
{
Map<QName, Serializable> props = nodeService.getProperties(record);
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
if (daDefinition != null)
Period period = daDefinition.getPeriod();
if (period != null)
{
Period period = daDefinition.getPeriod();
if (period != null)
{
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
}
else
{
props.put(PROP_RS_DISPOSITION_PERIOD, null);
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
}
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
}
nodeService.setProperties(record, props);
if (logger.isDebugEnabled())
else
{
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_ACTION_NAME));
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_PERIOD));
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
props.put(PROP_RS_DISPOSITION_PERIOD, null);
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
}
}
nodeService.setProperties(record, props);
if (logger.isDebugEnabled())
{
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_ACTION_NAME));
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_PERIOD));
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " +
props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
}
}
/**

View File

@@ -34,6 +34,10 @@ public class MultipleSchedulesTest extends BaseRMTestCase
protected static final String CATEGORY_B_NAME = TEST_PREFIX + "CategoryB";
/** The name to use for the folder within the second category. */
protected static final String FOLDER_B_NAME = TEST_PREFIX + "FolderB";
/** The name to use for the third category. */
protected static final String CATEGORY_C_NAME = TEST_PREFIX + "CategoryC";
/** The name to use for the folder within the third category. */
protected static final String FOLDER_C_NAME = TEST_PREFIX + "FolderC";
/** The name to use for the record. */
protected static final String RECORD_NAME = TEST_PREFIX + "Record";
@@ -48,6 +52,10 @@ public class MultipleSchedulesTest extends BaseRMTestCase
private NodeRef categoryB;
/** The folder node within the second category. */
private NodeRef folderB;
/** The third category node. */
private NodeRef categoryC;
/** The folder node within the third category. */
private NodeRef folderC;
/** The record node. */
private NodeRef record;
@@ -82,6 +90,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
// Create two categories.
categoryA = filePlanService.createRecordCategory(filePlan, CATEGORY_A_NAME);
categoryB = filePlanService.createRecordCategory(filePlan, CATEGORY_B_NAME);
categoryC = filePlanService.createRecordCategory(filePlan, CATEGORY_C_NAME);
// Create a disposition schedule for category A (Cut off immediately, then Destroy immediately).
DispositionSchedule dispSchedA = utils.createBasicDispositionSchedule(categoryA, "instructions", "authority", true, false);
Map<QName, Serializable> cutOffParamsA = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME,
@@ -103,9 +112,21 @@ public class MultipleSchedulesTest extends BaseRMTestCase
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_WEEK,
PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE);
dispositionService.addDispositionActionDefinition(dispSchedB, destroyParamsB);
// Create a disposition schedule for category C (Cut off immediately, then Destroy one year after cutoff).
DispositionSchedule dispSchedC = utils.createBasicDispositionSchedule(categoryC, "instructions", "authority", true, false);
Map<QName, Serializable> cutOffParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME,
PROP_DISPOSITION_DESCRIPTION, "description",
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(dispSchedC, cutOffParamsC);
Map<QName, Serializable> destroyParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME,
PROP_DISPOSITION_DESCRIPTION, "description",
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_YEAR,
PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE);
dispositionService.addDispositionActionDefinition(dispSchedC, destroyParamsC);
// Create a folder within each category.
folderA = recordFolderService.createRecordFolder(categoryA, FOLDER_A_NAME);
folderB = recordFolderService.createRecordFolder(categoryB, FOLDER_B_NAME);
folderC = recordFolderService.createRecordFolder(categoryC, FOLDER_C_NAME);
}
/**
@@ -123,6 +144,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
test()
.given(() -> {
setUpFilePlan();
// Create a record filed under category A and linked to category B.
record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.link(record, folderB);
@@ -187,19 +209,22 @@ public class MultipleSchedulesTest extends BaseRMTestCase
test()
.given(() -> {
setUpFilePlan();
// Create a record filed under category A and linked to category B.
// Create a record filed under category A and linked to category B and C.
record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.link(record, folderB);
})
.when(() -> {
recordService.link(record, folderC);
// Cut off the record.
dispositionService.cutoffDisposableItem(record);
// Ensure the update has been applied to the record.
internalDispositionService.updateNextDispositionAction(record);
})
.when(() -> {
// Unlink the record from folder B.
recordService.unlink(record, folderB);
})
.then()
.expect(true)
.expect(false)
.from(() -> dispositionService.isNextDispositionActionEligible(record))
.because("Destroy action should be available, as the record should follow its origin disposition schedule.");
.because("Destroy action shouldn't be available, as the record should follow disposition schedule from category C.");
}
}

View File

@@ -162,9 +162,9 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
// "audit.start", "audit.view" and "Update RM Object";
entries = getAuditTrail(3, ADMIN_USER);
assertEquals(entries.get(0).getEvent(), "audit.start");
assertEquals(entries.get(2).getEvent(), "audit.start");
assertEquals(entries.get(1).getEvent(), "audit.view");
assertEquals(entries.get(2).getEvent(), "Update RM Object");
assertEquals(entries.get(0).getEvent(), "Update RM Object");
// New "audit.view" event was generated - will be visible on next getAuditTrail().
@@ -176,14 +176,14 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
nodeService.deleteNode(record);
List<RecordsManagementAuditEntry> entries = getAuditTrail(5, ADMIN_USER);
assertEquals(entries.get(0).getEvent(), "audit.start");
assertEquals(entries.get(1).getEvent(), "audit.view");
assertEquals(entries.get(2).getEvent(), "Update RM Object");
assertEquals(entries.get(4).getEvent(), "audit.start");
assertEquals(entries.get(3).getEvent(), "audit.view");
assertEquals(entries.get(2).getEvent(), "Update RM Object");
assertEquals(entries.get(1).getEvent(), "audit.view");
// Show the audit contains a reference to the deleted item:
assertEquals(entries.get(4).getEvent(), "Delete RM Object");
assertEquals(entries.get(4).getNodeRef(), record);
assertEquals(entries.get(0).getEvent(), "Delete RM Object");
assertEquals(entries.get(0).getNodeRef(), record);
return null;
}
@@ -203,7 +203,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
// show the audit has been updated
List<RecordsManagementAuditEntry> entries = getAuditTrail(3, ADMIN_USER);
final RecordsManagementAuditEntry entry = entries.get(2);
final RecordsManagementAuditEntry entry = entries.get(0);
assertNotNull(entry);
// investigate the contents of the audit entry

0
temp Normal file
View File