From e4ffc81ed453b6ecd655b2415670c04ff14b2eef Mon Sep 17 00:00:00 2001 From: Sara Aspery Date: Thu, 16 May 2019 10:44:29 +0100 Subject: [PATCH] RM-6792 updates from review 1 --- .../action/dm/CreateRecordAction.java | 9 ++++++--- .../record/RecordServiceImpl.java | 4 ++-- .../record/RecordServiceImplUnitTest.java | 18 +++++++++--------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index bd60827fcc..8684092a73 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -213,7 +213,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase if (nodeRef == null) { - throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be resolved."); + throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be found."); } else { @@ -251,8 +251,11 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase // if the file plan is still null, raise an exception if (filePlan == null) { - LOGGER.debug("Unable to execute " + NAME + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created."); - throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the fileplan path could not be determined."); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Unable to execute " + NAME + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created."); + throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the fileplan path could not be determined."); + } } return filePlan; } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index dfbebbf810..2a31b852c5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -881,7 +881,7 @@ public class RecordServiceImpl extends BaseBehaviourBean public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef destinationNodeRef, final boolean isLinked) { // filePlan can be null. In this case the default RM site will be used. - // locationNodeRef can be null. In this case the unfiled record container will be used + // destinationNodeRef can be null. In this case the unfiled record container will be used ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("isLinked", isLinked); @@ -909,7 +909,7 @@ public class RecordServiceImpl extends BaseBehaviourBean newRecordContainer = filePlanService.getUnfiledContainer(checkedFilePlan); if (newRecordContainer == null) { - throw new AlfrescoRuntimeException("Unable to create record, because new record container could not be found."); + throw new AlfrescoRuntimeException("Unable to create record, because record container could not be found."); } } // if optional location supplied, check that it is a valid record folder diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java index c38b5cf2e1..5574d1a1ae 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java @@ -475,10 +475,10 @@ public class RecordServiceImplUnitTest extends BaseUnitTest /** * Given a file that is not yet a record * When I create the record without specifying a location - * Then the record is created in the unfiled record folder + * Then the record is created in the unfiled record container */ @Test - public void createRecordIntoUnfiledRecordFolder() + public void createRecordIntoUnfiledRecordContainer() { mocksForRecordCreation(); @@ -495,18 +495,18 @@ public class RecordServiceImplUnitTest extends BaseUnitTest /** * Given a file that is not yet a record - * When I create the record specifying the unfiled record folder - * Then the record is created in the unfiled record folder + * When I create the record specifying the unfiled record container + * Then the record is created in the unfiled record container */ @Test - public void createRecordIntoSpecifiedUnfiledRecordFolder() + public void createRecordIntoSpecifiedUnfiledRecordContainer() { mocksForRecordCreation(); // create the record - recordService.createRecord(nonStandardFilePlan, dmNodeRef, unfiledRecordFolder); + recordService.createRecord(filePlan, dmNodeRef, unfiledRecordFolder); - // verify record was created in specified record folder + // verify record was created in specified unfiled record container verify(mockedNodeService, times(1)).moveNode( dmNodeRef, unfiledRecordFolder, @@ -525,7 +525,7 @@ public class RecordServiceImplUnitTest extends BaseUnitTest mocksForRecordCreation(); // create the record - recordService.createRecord(nonStandardFilePlan, dmNodeRef, recordFolder); + recordService.createRecord(filePlan, dmNodeRef, recordFolder); // verify record was created in specified record folder verify(mockedNodeService, times(1)).moveNode( @@ -547,7 +547,7 @@ public class RecordServiceImplUnitTest extends BaseUnitTest NodeRef recordCategory = generateNodeRef(TYPE_RECORD_CATEGORY); // create the record - recordService.createRecord(nonStandardFilePlan, dmNodeRef, recordCategory); + recordService.createRecord(filePlan, dmNodeRef, recordCategory); } /* Helper method to set up the mocks for record creation */