Merge branch 'feature/RM-7093_UpdateItemLocation' into 'master'

RM-7093 Update item location to include the provenience site

Closes RM-7093

See merge request records-management/records-management!1335
This commit is contained in:
Claudia Agache
2019-12-13 09:32:14 +00:00
5 changed files with 13 additions and 12 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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

View File

@@ -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("</div>\n");
if (entry.getChangedProperties() != null)
if (entry.getChangedProperties() != null && !entry.getChangedProperties().isEmpty())
{
writer.write("<table class=\"changed-values-table\" cellspacing=\"0\">");
writer.write("<tr><th>Property</th><th>Previous Value</th><th>New Value</th></tr>");

View File

@@ -135,7 +135,8 @@ public final class NamePathDataExtractor extends AbstractDataExtractor
{
// Get path from the RM root
List<NodeRef> 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);