From 41e41902c0ba42feb5b9773f5c5005a7a9a10f14 Mon Sep 17 00:00:00 2001 From: cagache Date: Wed, 11 Dec 2019 16:16:49 +0200 Subject: [PATCH] RM-7093 Update item location to include the provenience site --- .../rest/rm/community/audit/AuditAddToHoldTests.java | 6 +++--- .../rm/community/audit/AuditRemoveFromHoldTests.java | 6 +++--- .../org/alfresco/rest/rm/community/utils/RMSiteUtil.java | 1 + .../audit/RecordsManagementAuditServiceImpl.java | 9 ++++----- .../audit/extractor/NamePathDataExtractor.java | 3 ++- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java index 0d63ac5002..6a291f1e87 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java @@ -32,6 +32,7 @@ import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_HOLD; import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH; import static org.alfresco.utility.Utility.buildPath; import static org.alfresco.utility.Utility.removeLastSlash; import static org.alfresco.utility.data.RandomData.getRandomName; @@ -129,14 +130,13 @@ public class AuditAddToHoldTests extends BaseRMRestTest @DataProvider (name = "validNodesForAddToHold") public Object[][] getValidNodesForAddToHold() throws Exception { - String documentLibrary = "/documentLibrary"; FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite) .createContent(CMISUtil.DocumentType.TEXT_PLAIN); RecordCategoryChild recordFolderToBeAdded = createRecordFolder(recordCategory.getId(), PREFIX + "recFolderToBeAdded"); Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record"); - String recordFolderPath = removeLastSlash(buildPath(documentLibrary, recordCategory.getName(), + String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), recordFolderToBeAdded.getName())); - String recordPath = removeLastSlash(buildPath(documentLibrary, recordCategory.getName(), + String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), recordFolder.getName(), recordToBeAdded.getName())); String contentPath = "/Company Home" + contentToBeAdded.getCmisLocation(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java index 7fa655f79b..2aa77a25ff 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java @@ -32,6 +32,7 @@ import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_HOLD; import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH; import static org.alfresco.utility.Utility.buildPath; import static org.alfresco.utility.Utility.removeLastSlash; import static org.alfresco.utility.data.RandomData.getRandomName; @@ -144,10 +145,9 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest @DataProvider (name = "validNodesForRemoveFromHold") public Object[][] getValidNodesForRemoveFromHold() { - String documentLibrary = "/documentLibrary"; - String recordFolderPath = removeLastSlash(buildPath(documentLibrary, recordCategory.getName(), + String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), heldRecordFolder.getName())); - String recordPath = removeLastSlash(buildPath(documentLibrary, recordCategory.getName(), + String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), recordFolder.getName(), heldRecord.getName())); String contentPath = "/Company Home" + heldContent.getCmisLocation(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java index 80062165ca..52e9eeadd7 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java @@ -49,6 +49,7 @@ public class RMSiteUtil public static final String RM_ID = "rm"; public static final String RM_TITLE = "Records Management"; public static final String RM_DESCRIPTION = "Records Management Site"; + public static final String FILE_PLAN_PATH = "/rm/documentLibrary"; /** * Creates an RM Site model for the given compliance, title and description diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java index 9868b4261d..72cb924a53 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java @@ -93,7 +93,6 @@ import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyMap; import org.alfresco.util.TempFileProvider; import org.alfresco.util.transaction.TransactionListenerAdapter; -import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -138,7 +137,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean protected static final String RM_AUDIT_SNIPPET_CHANGES = "/changes"; protected static final String RM_AUDIT_SNIPPET_BEFORE = "/before"; protected static final String RM_AUDIT_SNIPPET_AFTER = "/after"; - protected static final String RM_AUDIT_DOCUMENT_LIBRARY_PATH = "/documentLibrary"; + protected static final String RM_AUDIT_SITES_PATH = "/Sites"; protected static final String RM_AUDIT_DATA_PERSON_FULLNAME = "/RM/event/person/fullName"; protected static final String RM_AUDIT_DATA_PERSON_ROLES = "/RM/event/person/roles"; @@ -1464,10 +1463,10 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean // we need to strip off the first part of the path String path = entry.getPath(); String displayPath; - int idx = path.indexOf(RM_AUDIT_DOCUMENT_LIBRARY_PATH); + int idx = path.indexOf(RM_AUDIT_SITES_PATH); if (idx != -1) { - displayPath = path.substring(idx + RM_AUDIT_DOCUMENT_LIBRARY_PATH.length()); + displayPath = path.substring(idx + RM_AUDIT_SITES_PATH.length()); } else { @@ -1481,7 +1480,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean } writer.write("\n"); - if (entry.getChangedProperties() != null) + if (entry.getChangedProperties() != null && !entry.getChangedProperties().isEmpty()) { writer.write(""); writer.write(""); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java index 2aba0a894f..b68bc01837 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java @@ -135,7 +135,8 @@ public final class NamePathDataExtractor extends AbstractDataExtractor { // Get path from the RM root List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + nodeRefPath.add(0, nodeService.getPrimaryParent(filePlan).getParentRef()); for (NodeRef pathNodeRef : nodeRefPath) { String name = (String) nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME);
PropertyPrevious ValueNew Value