mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge remote-tracking branch 'remotes/origin/release/V2.6' into merge-2.7/Merge_MNT-19967_From2.6
# Conflicts: # rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordCategoriesAPI.java # rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java
This commit is contained in:
@@ -52,6 +52,13 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_LOCATION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_LOCATION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
|
||||||
@@ -64,6 +71,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
@@ -208,4 +216,25 @@ public class RecordProperties extends TestModel
|
|||||||
|
|
||||||
@JsonProperty(PROPERTIES_AUTHOR)
|
@JsonProperty(PROPERTIES_AUTHOR)
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION)
|
||||||
|
private String recordSearchDispositionPeriodExpression;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY)
|
||||||
|
private String recordSearchDispositionAuthority;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF)
|
||||||
|
private Date recordSearchDispositionActionAsOf;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD)
|
||||||
|
private String recordSearchDispositionPeriod;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME)
|
||||||
|
private String recordSearchDispositionActionName;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE)
|
||||||
|
private Boolean recordSearchDispositionEventsEligible;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
||||||
|
private String recordSearchDispositionInstructions;
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
@@ -51,6 +51,23 @@ public class DispositionScheduleService extends BaseAPI
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DataUser dataUser;
|
private DataUser dataUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for adding a retain after period step
|
||||||
|
*
|
||||||
|
* @param categoryName the category in whose schedule the step will be added
|
||||||
|
* @param period
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void addRetainAfterPeriodStep(String categoryName, String period)
|
||||||
|
{
|
||||||
|
HashMap<RETENTION_SCHEDULE, String> cutOffStep = new HashMap<>();
|
||||||
|
cutOffStep.put(RETENTION_SCHEDULE.NAME, "retain");
|
||||||
|
cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
|
||||||
|
cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Retain after a period step");
|
||||||
|
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
|
||||||
|
dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for adding a cut off after period step
|
* Helper method for adding a cut off after period step
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,299 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.rm.community.recordcategories;
|
||||||
|
|
||||||
|
import static org.alfresco.utility.data.RandomData.getRandomName;
|
||||||
|
import static org.alfresco.utility.report.log.Step.STEP;
|
||||||
|
|
||||||
|
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
||||||
|
import org.alfresco.rest.rm.community.model.record.Record;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
|
||||||
|
import org.alfresco.rest.v0.service.DispositionScheduleService;
|
||||||
|
import org.alfresco.test.AlfrescoTest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
public class DispositionScheduleInheritanceTests extends BaseRMRestTest
|
||||||
|
{
|
||||||
|
private static final String RETAIN_STEP = "retain";
|
||||||
|
private static final String CUTOFF_STEP = "cutoff";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DispositionScheduleService dispositionScheduleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given following structure is created:
|
||||||
|
* rootCategory with RS applied on records level
|
||||||
|
* - subCategory without RS
|
||||||
|
* - recFolder
|
||||||
|
* - incomplete electronic record
|
||||||
|
* - complete non-electronic record
|
||||||
|
* Then both records should inherit the RS from rootCategory
|
||||||
|
*/
|
||||||
|
@AlfrescoTest (jira = "MNT-19967")
|
||||||
|
@Test
|
||||||
|
public void testRSInheritanceOnRecordsWhenOnlyACategoryHasRS() 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("Add retention schedule retain step with immediate period.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately");
|
||||||
|
|
||||||
|
STEP("Create a subcategory with a record folder");
|
||||||
|
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
||||||
|
|
||||||
|
STEP("Create 2 records in the record folder. Complete one of them.");
|
||||||
|
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 root category retention schedule");
|
||||||
|
Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
|
Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given following structure is created:
|
||||||
|
* rootCategory with RS applied on records folder level
|
||||||
|
* - subCategory without RS
|
||||||
|
* - recFolder
|
||||||
|
* Then recFolder should inherit the RS from rootCategory
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRSInheritanceOnRecordFoldersWhenOnlyACategoryHasRS() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Create record category with retention schedule and apply it to record folders.");
|
||||||
|
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("Add retention schedule retain step with immediate period.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately");
|
||||||
|
|
||||||
|
STEP("Create a subcategory with a record folder");
|
||||||
|
RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
|
||||||
|
|
||||||
|
STEP("Check that recFolder inherits root category retention schedule");
|
||||||
|
Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given following structure is created:
|
||||||
|
* rootCategory with RS applied on records level
|
||||||
|
* - subCategory1 with another RS applied on records level
|
||||||
|
* - subCategory2 without RS
|
||||||
|
* - recFolder
|
||||||
|
* - incomplete electronic record
|
||||||
|
* - complete non-electronic record
|
||||||
|
* Then both records should inherit the RS from subCategory1
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRSInheritanceOnRecordsWhen2CategoriesHaveRS() 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 records.");
|
||||||
|
RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName();
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, true);
|
||||||
|
|
||||||
|
STEP("Add retention schedule retain step with 1 day after created date.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(subcategory1Path, "day|1");
|
||||||
|
|
||||||
|
STEP("Create a subcategory2 in subcategory1");
|
||||||
|
RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory"));
|
||||||
|
|
||||||
|
STEP("Create a record folder with 2 records. Complete one of them.");
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory2.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 subCategory1 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 folder level
|
||||||
|
* - subCategory1 with another RS applied on records folder level
|
||||||
|
* - subCategory2 without RS
|
||||||
|
* - recFolder
|
||||||
|
* Then recFolder should inherit the RS from subCategory1
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRSInheritanceOnRecordFoldersWhen2CategoriesHaveRS() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Create record category with retention schedule and apply it to record folders.");
|
||||||
|
RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false);
|
||||||
|
|
||||||
|
STEP("Add retention schedule retain step with 2 days after created date.");
|
||||||
|
dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "day|2");
|
||||||
|
|
||||||
|
STEP("Create a subcategory with retention schedule and apply it to record folders.");
|
||||||
|
RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
|
||||||
|
String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName();
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, false);
|
||||||
|
|
||||||
|
STEP("Add retention schedule cut off step with immediate period.");
|
||||||
|
dispositionScheduleService.addCutOffAfterPeriodStep(subcategory1Path, "immediately");
|
||||||
|
|
||||||
|
STEP("Create a subcategory2 with a record folder in subcategory1");
|
||||||
|
RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory"));
|
||||||
|
RecordCategoryChild recFolder = createFolder(subCategory2.getId(), getRandomName("recFolder"));
|
||||||
|
|
||||||
|
STEP("Check that recFolder inherits subCategory1 retention schedule");
|
||||||
|
Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
|
Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(),
|
||||||
|
CUTOFF_STEP,
|
||||||
|
"Disposition action should be cutoff and not retain for the record folder");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
* and record folder inherits the RS from subCategory
|
||||||
|
*/
|
||||||
|
@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");
|
||||||
|
|
||||||
|
STEP("Check that recFolder inherits subCategory retention schedule");
|
||||||
|
Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
|
||||||
|
"rma:recordSearchHasDispositionSchedule property should be true");
|
||||||
|
Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(),
|
||||||
|
RETAIN_STEP,
|
||||||
|
"Disposition action should be retain and not cutoff for the record folder");
|
||||||
|
}
|
||||||
|
}
|
@@ -348,9 +348,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns a NodeRef
|
* This method returns a NodeRef
|
||||||
* Gets the disposition instructions
|
* Gets the disposition instructions
|
||||||
@@ -383,7 +380,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
NodeRef result = getAssociatedDispositionScheduleImpl(parent);
|
NodeRef result = getAssociatedDispositionScheduleImpl(parent);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
return null;
|
return getOriginDispositionSchedule(parent);
|
||||||
}
|
}
|
||||||
return new DispositionScheduleImpl(serviceRegistry, nodeService, result);
|
return new DispositionScheduleImpl(serviceRegistry, nodeService, result);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user