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:
@@ -55,16 +55,15 @@ public class DispositionScheduleService extends BaseAPI
|
|||||||
*
|
*
|
||||||
* @param categoryName the category in whose schedule the step will be added
|
* @param categoryName the category in whose schedule the step will be added
|
||||||
* @param period
|
* @param period
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public void addRetainAfterPeriodStep(String categoryName, String period)
|
public void addRetainAfterPeriodStep(String categoryName, String period)
|
||||||
{
|
{
|
||||||
HashMap<RETENTION_SCHEDULE, String> cutOffStep = new HashMap<>();
|
HashMap<RETENTION_SCHEDULE, String> retainStep = new HashMap<>();
|
||||||
cutOffStep.put(RETENTION_SCHEDULE.NAME, "retain");
|
retainStep.put(RETENTION_SCHEDULE.NAME, "retain");
|
||||||
cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
|
retainStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
|
||||||
cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Retain after a period step");
|
retainStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Retain after a period step");
|
||||||
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
|
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
|
||||||
dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
|
dataUser.getAdminUser().getPassword(), categoryName, retainStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +71,6 @@ public class DispositionScheduleService extends BaseAPI
|
|||||||
*
|
*
|
||||||
* @param categoryName the category in whose schedule the step will be added
|
* @param categoryName the category in whose schedule the step will be added
|
||||||
* @param period
|
* @param period
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public void addCutOffAfterPeriodStep(String categoryName, String period)
|
public void addCutOffAfterPeriodStep(String categoryName, String period)
|
||||||
{
|
{
|
||||||
@@ -89,14 +87,13 @@ public class DispositionScheduleService extends BaseAPI
|
|||||||
*
|
*
|
||||||
* @param categoryName the category in whose schedule the step will be added
|
* @param categoryName the category in whose schedule the step will be added
|
||||||
* @param period
|
* @param period
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public void addDestroyWithGhostingAfterPeriodStep(String categoryName, String period)
|
public void addDestroyWithGhostingAfterPeriodStep(String categoryName, String period)
|
||||||
{
|
{
|
||||||
HashMap<RETENTION_SCHEDULE, String> destroyStep = new HashMap<>();
|
HashMap<RETENTION_SCHEDULE, String> destroyStep = new HashMap<>();
|
||||||
destroyStep.put(RETENTION_SCHEDULE.NAME, "destroy");
|
destroyStep.put(RETENTION_SCHEDULE.NAME, "destroy");
|
||||||
destroyStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, "immediately|");
|
destroyStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
|
||||||
destroyStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Destroy immediately");
|
destroyStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Destroy after a period step");
|
||||||
destroyStep.put(RETENTION_SCHEDULE.RETENTION_GHOST, "on");
|
destroyStep.put(RETENTION_SCHEDULE.RETENTION_GHOST, "on");
|
||||||
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
|
recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
|
||||||
dataUser.getAdminUser().getPassword(), categoryName, destroyStep);
|
dataUser.getAdminUser().getPassword(), categoryName, destroyStep);
|
||||||
|
@@ -288,7 +288,7 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
STEP("Create a record in folder A and copy it into folder B.");
|
STEP("Create a record in folder A and copy it into folder B.");
|
||||||
String recordId = getRestAPIFactory().getRecordFolderAPI()
|
String recordId = getRestAPIFactory().getRecordFolderAPI()
|
||||||
.createRecord(createElectronicRecordModel(), recordFolderA.getId(), getFile(IMAGE_FILE)).getId();
|
.createRecord(createElectronicRecordModel(), recordFolderA.getId(), getFile(IMAGE_FILE)).getId();
|
||||||
String copyId = copyRecord(recordId, recordFolderB.getId()).getId();
|
String copyId = copyNode(recordId, recordFolderB.getId()).getId();
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
STEP("Check that it's possible to load the original content.");
|
STEP("Check that it's possible to load the original content.");
|
||||||
@@ -306,7 +306,7 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given a file that has copy
|
* Given a file that has a copy
|
||||||
* And the original file is declared as record
|
* And the original file is declared as record
|
||||||
* When I delete the original
|
* When I delete the original
|
||||||
* Then it is still possible to view the content of the copy
|
* Then it is still possible to view the content of the copy
|
||||||
@@ -320,9 +320,8 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
testSite = dataSite.usingAdmin().createPublicRandomSite();
|
testSite = dataSite.usingAdmin().createPublicRandomSite();
|
||||||
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
|
|
||||||
STEP("Create a copy for the file created.");
|
STEP("Create a copy of the file.");
|
||||||
String postBody = JsonBodyGenerator.keyValueJson("targetParentId", testSite.getGuid());
|
RestNodeModel copyOfTestFile = copyNode(testFile.getNodeRefWithoutVersion(), testSite.getGuid());
|
||||||
RestNodeModel copyOfTestFile = getRestAPIFactory().getNodeAPI(testFile).copyNode(postBody);
|
|
||||||
|
|
||||||
STEP("Declare original file as record");
|
STEP("Declare original file as record");
|
||||||
getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
|
getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
|
||||||
@@ -341,9 +340,9 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given a file that has copy
|
* Given a file that has a copy
|
||||||
* And the original file is declared as record
|
* And the original file is declared as record
|
||||||
* And the file becomes part of a disposition schedule with a destroy step
|
* And the record becomes part of a disposition schedule with a destroy step
|
||||||
* When the record is destroyed
|
* When the record is destroyed
|
||||||
* Then it is still possible to view the content of the copy
|
* Then it is still possible to view the content of the copy
|
||||||
* </pre>
|
* </pre>
|
||||||
@@ -357,8 +356,8 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
FolderModel folderModel = dataContent.usingSite(testSite).createFolder();
|
FolderModel folderModel = dataContent.usingSite(testSite).createFolder();
|
||||||
|
|
||||||
STEP("Create a copy for the file created.");
|
STEP("Create a copy of the file.");
|
||||||
RestNodeModel copy = copyRecord(testFile.getNodeRefWithoutVersion(), folderModel.getNodeRefWithoutVersion());
|
RestNodeModel copy = copyNode(testFile.getNodeRefWithoutVersion(), folderModel.getNodeRefWithoutVersion());
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
STEP("Declare the file as record.");
|
STEP("Declare the file as record.");
|
||||||
@@ -397,22 +396,20 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given a file that is declared version as record
|
* Given a file that has version declared as record
|
||||||
* When the record is deleted
|
* When the record is deleted
|
||||||
* Then it is still possible to view the content of the file
|
* Then it is still possible to view the content of the file
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Test (description = "Destroying record doesn't delete the content for the associated copy")
|
@Test (description = "Deleting record made from version doesn't delete the content for the file")
|
||||||
@AlfrescoTest (jira = "MNT-20145")
|
@AlfrescoTest (jira = "MNT-20145")
|
||||||
public void deleteVersionDeclaredAsRecord() throws Exception
|
public void deleteVersionDeclaredAsRecord() throws Exception
|
||||||
{
|
{
|
||||||
STEP("Create a file.");
|
STEP("Create a file.");
|
||||||
testSite = dataSite.usingAdmin().createPublicRandomSite();
|
testSite = dataSite.usingAdmin().createPublicRandomSite();
|
||||||
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel testFile = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
FolderModel folderModel = dataContent.usingSite(testSite).createFolder();
|
|
||||||
|
|
||||||
STEP("Declare the file as record.");
|
STEP("Declare file version as record.");
|
||||||
// declare documents as records
|
|
||||||
recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(),
|
recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(),
|
||||||
testFile.getName());
|
testFile.getName());
|
||||||
UnfiledContainerChild unfiledContainerChild = getRestAPIFactory().getUnfiledContainersAPI()
|
UnfiledContainerChild unfiledContainerChild = getRestAPIFactory().getUnfiledContainersAPI()
|
||||||
@@ -455,15 +452,15 @@ public class DeleteRecordTests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a record to a record folder.
|
* Copy a node to a folder.
|
||||||
*
|
*
|
||||||
* @param recordId The id of the record to copy.
|
* @param nodeId The id of the node to copy.
|
||||||
* @param destinationFolder The id of the record folder to copy it to.
|
* @param destinationFolder The id of the folder to copy it to.
|
||||||
* @return The model returned by the copy API.
|
* @return The model returned by the copy API.
|
||||||
*/
|
*/
|
||||||
private RestNodeModel copyRecord(String recordId, String destinationFolder)
|
private RestNodeModel copyNode(String nodeId, String destinationFolder)
|
||||||
{
|
{
|
||||||
Node node = getNode(recordId);
|
Node node = getNode(nodeId);
|
||||||
RestNodeBodyMoveCopyModel copyBody = new RestNodeBodyMoveCopyModel();
|
RestNodeBodyMoveCopyModel copyBody = new RestNodeBodyMoveCopyModel();
|
||||||
copyBody.setTargetParentId(destinationFolder);
|
copyBody.setTargetParentId(destinationFolder);
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user