mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
code review changes
This commit is contained in:
@@ -39,8 +39,8 @@ import org.springframework.stereotype.Service;
|
|||||||
/**
|
/**
|
||||||
* Service for different disposition schedule actions
|
* Service for different disposition schedule actions
|
||||||
*
|
*
|
||||||
* @author jcule
|
* @author jcule, cagache
|
||||||
* @since 2.7.0.1
|
* @since 2.6.2
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DispositionScheduleService extends BaseAPI
|
public class DispositionScheduleService extends BaseAPI
|
||||||
|
@@ -110,7 +110,7 @@ public class DispositionScheduleInheritanceTests extends BaseRMRestTest
|
|||||||
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
||||||
|
|
||||||
STEP("Check that recFolder inherit root category retention schedule");
|
STEP("Check that recFolder inherits root category retention schedule");
|
||||||
Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
|
Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
"rma:recordSearchHasDispositionSchedule property should be true");
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
}
|
}
|
||||||
@@ -202,4 +202,90 @@ public class DispositionScheduleInheritanceTests extends BaseRMRestTest
|
|||||||
CUTOFF_STEP,
|
CUTOFF_STEP,
|
||||||
"Disposition action should be retain and not cutoff for complete record");
|
"Disposition action should be retain and not cutoff for complete record");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given following structure is created:
|
||||||
|
* rootCategory with RS applied on folder records level
|
||||||
|
* - subCategory with another RS applied on records level
|
||||||
|
* - recFolder
|
||||||
|
* - incomplete electronic record
|
||||||
|
* - complete non-electronic record
|
||||||
|
* Then both records should inherit the RS from subCategory
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMixedRSInheritanceWhenFirstParentHasRSOnRecords() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Create record category with retention schedule and apply it to folder records.");
|
||||||
|
RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false);
|
||||||
|
|
||||||
|
STEP("Add retention schedule cut off step with immediate period.");
|
||||||
|
dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
|
||||||
|
|
||||||
|
STEP("Create a subcategory with retention schedule and apply it to records.");
|
||||||
|
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName();
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, true);
|
||||||
|
|
||||||
|
STEP("Add retention schedule retain step with 1 day after created date.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1");
|
||||||
|
|
||||||
|
STEP("Create a record folder with 2 records. Complete one of them.");
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
||||||
|
Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
|
||||||
|
Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
|
||||||
|
getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
|
||||||
|
|
||||||
|
STEP("Check that both records inherit subCategory retention schedule");
|
||||||
|
Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true for incomplete record");
|
||||||
|
Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true for complete record");
|
||||||
|
Assert.assertEquals(elRecord.getProperties().getRecordSearchDispositionActionName(),
|
||||||
|
RETAIN_STEP,
|
||||||
|
"Disposition action should be retain and not cutoff for incomplete record");
|
||||||
|
Assert.assertEquals(nonElRecord.getProperties().getRecordSearchDispositionActionName(),
|
||||||
|
RETAIN_STEP,
|
||||||
|
"Disposition action should be retain and not cutoff for complete record");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given following structure is created:
|
||||||
|
* rootCategory with RS applied on records level
|
||||||
|
* - subCategory with another RS applied on folder records level
|
||||||
|
* - recFolder
|
||||||
|
* - incomplete electronic record
|
||||||
|
* - complete non-electronic record
|
||||||
|
* Then both records should not have RS (rma:recordSearchHasDispositionSchedule property is set to false)
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMixedRSInheritanceWhenFirstParentHasRSOnFolders() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Create record category with retention schedule and apply it to records.");
|
||||||
|
RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true);
|
||||||
|
|
||||||
|
STEP("Add retention schedule cut off step with immediate period.");
|
||||||
|
dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
|
||||||
|
|
||||||
|
STEP("Create a subcategory with retention schedule and apply it to record folders.");
|
||||||
|
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName();
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, false);
|
||||||
|
|
||||||
|
STEP("Add retention schedule retain step with 1 day after created date.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1");
|
||||||
|
|
||||||
|
STEP("Create a record folder with 2 records. Complete one of them.");
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
||||||
|
Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
|
||||||
|
Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
|
||||||
|
getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
|
||||||
|
|
||||||
|
STEP("Check that the records don't have retention schedule");
|
||||||
|
Assert.assertFalse(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be false for incomplete record");
|
||||||
|
Assert.assertFalse(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be false for complete record");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user