Merge branch 'RM-2526_LinkingMakesRecordPropertiesUnavailbale' into release/V2.3

This commit is contained in:
roxana
2016-10-25 17:38:07 +03:00
2 changed files with 36 additions and 8 deletions

View File

@@ -278,6 +278,22 @@ public class DispositionServiceImpl extends ServiceBaseImpl
NodeRef dsNodeRef = null;
if (isRecord(nodeRef))
{
// calculate disposition schedule without taking into account the user
DispositionSchedule originDispositionSchedule = AuthenticationUtil.runAsSystem(new RunAsWork<DispositionSchedule>()
{
@Override
public DispositionSchedule doWork()
{
return getOriginDispositionSchedule(nodeRef);
}
});
// if the initial disposition schedule of the record is folder based
if (originDispositionSchedule == null ||
isNotTrue(originDispositionSchedule.isRecordLevelDisposition()))
{
return null;
}
final NextActionFromDisposition dsNextAction = getDispositionActionByNameForRecord(nodeRef);
if (dsNextAction != null)
@@ -1143,6 +1159,13 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (nextDispositionAction == null)
{
DispositionAction lastCompletedDispositionAction = getLastCompletedDispostionAction(record);
if (lastCompletedDispositionAction != null)
{
// all disposition actions upon the given record were completed
return null;
}
return getFirstDispositionAction(record, recordFolders);
}
else

View File

@@ -3,11 +3,10 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition;
import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
@@ -21,6 +20,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.extensions.webscripts.GUID;
import com.google.common.collect.ImmutableMap;
public class MultipleSchedulesTest extends BaseRMTestCase
{
/** A unique prefix for the constants in this test. */
@@ -118,6 +119,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
*/
public void testLinkedToLongerSchedule()
{
Calendar calendar = Calendar.getInstance();
test()
.given(() -> {
setUpFilePlan();
@@ -130,11 +132,12 @@ public class MultipleSchedulesTest extends BaseRMTestCase
dispositionService.cutoffDisposableItem(record);
// Ensure the update has been applied to the record.
internalDispositionService.updateNextDispositionAction(record);
calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE));
calendar.add(Calendar.WEEK_OF_YEAR, 1);
})
.then()
.expect(7 * 24 * 60 * 60 * 1000L)
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate().getTime()
- ((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)).getTime())
.expect(calendar.getTime())
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
.because("Record should follow largest rentention schedule period, which is one week.");
}
@@ -149,6 +152,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
*/
public void testLinkedToShorterSchedule()
{
Calendar calendar = Calendar.getInstance();
test()
.given(() -> {
setUpFilePlan();
@@ -161,11 +165,12 @@ public class MultipleSchedulesTest extends BaseRMTestCase
dispositionService.cutoffDisposableItem(record);
// Ensure the update has been applied to the record.
internalDispositionService.updateNextDispositionAction(record);
calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE));
calendar.add(Calendar.WEEK_OF_YEAR, 1);
})
.then()
.expect(7 * 24 * 60 * 60 * 1000L)
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate().getTime()
- ((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)).getTime())
.expect(calendar.getTime())
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
.because("Record should follow largest rentention schedule period, which is one week.");
}
}