From a54a80f6a628e787691cb31d9eace994accaaeab Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 23 Apr 2019 08:23:43 +0300 Subject: [PATCH 01/25] transform UserPermissions in enum; add helper methods to create users with rm role, permissions or clearance --- .../community/model/user/UserPermissions.java | 15 +++++-- .../requests/gscore/api/FilesAPI.java | 6 +-- .../requests/gscore/api/RMUserAPI.java | 9 ++--- .../rm/community/base/BaseRMRestTest.java | 39 +++++++++++++------ .../community/records/DeleteRecordTests.java | 7 +--- .../community/records/UpdateRecordsTests.java | 9 ++--- .../rest/rm/community/utils/RMSiteUtil.java | 2 +- 7 files changed, 50 insertions(+), 37 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java index 1b9dfe5aba..7c237bd47c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java @@ -32,9 +32,16 @@ package org.alfresco.rest.rm.community.model.user; * @author Kristijan Conkas * @since 2.6 */ -public class UserPermissions +public enum UserPermissions { - public static final String PERMISSION_FILING = "Filing"; - public static final String PERMISSION_READ_RECORDS = "ReadRecords"; - public static final String PERMISSION_FILE_RECORDS = "FileRecords"; + PERMISSION_FILING("Filing"), + PERMISSION_READ_RECORDS("ReadRecords"), + PERMISSION_FILE_RECORDS("FileRecords"); + + public final String permissionId; + + UserPermissions(String permissionId) + { + this.permissionId = permissionId; + } } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java index 10da1e0570..18b91bd2cc 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java @@ -57,9 +57,8 @@ public class FilesAPI extends RMModelRequest * @param fileId The Id of a file to declare as record * @param parameters Request parameters, refer to API documentation for more details * @return The {@link Record} for created record - * @throws Exception for malformed JSON responses */ - public Record declareAsRecord(String fileId, String parameters) throws Exception + public Record declareAsRecord(String fileId, String parameters) { mandatoryString("fileId", fileId); @@ -76,9 +75,8 @@ public class FilesAPI extends RMModelRequest * * @param fileId The Id of a file to declare as record * @return The {@link Record} for created record - * @throws Exception for malformed JSON responses */ - public Record declareAsRecord(String fileId) throws Exception + public Record declareAsRecord(String fileId) { mandatoryString("fileId", fileId); diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java index d24c53c614..213751117f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java @@ -86,9 +86,8 @@ public class RMUserAPI extends RMModelRequest * Assign RM role to user * @param userName User's username * @param userRole User's RM role, one of {@link UserRoles} roles - * @throws Exception for failed requests */ - public void assignRoleToUser(String userName, String userRole) throws Exception + public void assignRoleToUser(String userName, String userRole) { UserModel adminUser = getRmRestWrapper().getTestUser(); @@ -117,11 +116,11 @@ public class RMUserAPI extends RMModelRequest /** * Helper method to add permission on a component to user - * @param component The id of the file plan component on which permission should be given + * @param filePlanComponentId The id of the file plan component on which permission should be given * @param user {@link UserModel} for a user to be granted permission * @param permission {@link UserPermissions} to be granted */ - public void addUserPermission(String filePlanComponentId, UserModel user, String permission) + public void addUserPermission(String filePlanComponentId, UserModel user, UserPermissions permission) { UserModel adminUser = getRmRestWrapper().getTestUser(); @@ -132,7 +131,7 @@ public class RMUserAPI extends RMModelRequest .addArray("permissions") .addObject() .add("authority", user.getUsername()) - .add("role", permission) + .add("role", permission.permissionId) .end() .getJson(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 15e831dc9a..0f9e0352bc 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -54,6 +54,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import lombok.Getter; import org.alfresco.dataprep.ContentService; import org.alfresco.rest.RestTest; import org.alfresco.rest.core.RestAPIFactory; @@ -69,6 +70,7 @@ import org.alfresco.rest.rm.community.model.site.RMSite; import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer; import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; +import org.alfresco.rest.rm.community.model.user.UserPermissions; import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; @@ -88,8 +90,6 @@ import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; -import lombok.Getter; - /** * Base class for all GS REST API Tests * @@ -615,18 +615,34 @@ public class BaseRMRestTest extends RestTest } /** - * Assign filling permission on a record category and give the user RM_USER role + * Helper method to create a test user with rm role * - * @param user the user to assign the permission to - * @param categoryId the id of the category to assign permissions for - * @throws Exception + * @param userRole the rm role + * @return the created user model */ - public void assignFillingPermissionsOnCategory(UserModel user, String categoryId, - String userPermission, String userRole) throws Exception + protected UserModel createUserWithRMRole(String userRole) { - getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission); - rmRolesAndActionsAPI.assignRoleToUser(getAdminUser().getUsername(), - getAdminUser().getPassword(), user.getUsername(), userRole); + UserModel rmUser = getDataUser().createRandomTestUser(); + getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole); + assertStatusCode(OK); + return rmUser; + } + + /** + * Helper method to create a test user with rm role and permissions over the record category + * + * @param userRole the rm role + * @param userPermission the permissions over the record category + * @param recordCategory the category on which user has permissions + * @return the created user model + */ + protected UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory, + UserPermissions userPermission) + { + UserModel rmUser = createUserWithRMRole(userRole); + getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), rmUser, userPermission); + assertStatusCode(OK); + return rmUser; } /** @@ -793,5 +809,4 @@ public class BaseRMRestTest extends RestTest documentLibrary.setNodeRef(nodes.get(0).onModel().getId()); return documentLibrary; } - } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java index ef63360a39..387e263460 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java @@ -236,15 +236,12 @@ public class DeleteRecordTests extends BaseRMRestTest public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception { // Create test user and add it with collaboration privileges - UserModel deleteUser = getDataUser().createRandomTestUser("delnoperm"); + // Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities + UserModel deleteUser = createUserWithRMRole(ROLE_RM_POWER_USER.roleId); getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), SiteCollaborator); String username = deleteUser.getUsername(); logger.info("Test user: " + username); - // Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities - getRestAPIFactory().getRMUserAPI().assignRoleToUser(username, ROLE_RM_POWER_USER.roleId); - assertStatusCode(OK); - // Create random folder RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); logger.info("Random folder:" + recordFolder.getName()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java index 2f8f3af510..c433c99dc6 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java @@ -234,15 +234,12 @@ public class UpdateRecordsTests extends BaseRMRestTest public void userWithEditMetadataCapsCanUpdateMetadata() throws Exception { RMUserAPI rmUserAPI = getRestAPIFactory().getRMUserAPI(); - // Create test user and add it with collab. privileges - UserModel updateUser = getDataUser().createRandomTestUser("updateuser"); + // Create test user and add it with collab. privileges. + // RM Security Officer is the lowest role with Edit Record Metadata capabilities + UserModel updateUser = createUserWithRMRole(ROLE_RM_SECURITY_OFFICER.roleId); updateUser.setUserRole(UserRole.SiteCollaborator); getDataUser().addUserToSite(updateUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator); - // RM Security Officer is the lowest role with Edit Record Metadata capabilities - rmUserAPI.assignRoleToUser(updateUser.getUsername(), ROLE_RM_SECURITY_OFFICER.roleId); - assertStatusCode(OK); - // Create random folder RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); logger.info("random folder:" + recordFolder.getName()); 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 b3574a0fcb..80062165ca 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 @@ -66,7 +66,7 @@ public class RMSiteUtil /** * Creates an RM Site for the given compliance and default title and description * - * @param The RM site compliance + * @param compliance The RM site compliance * @return The {@link RMSite} with the given details */ private static RMSite createRMSiteModel(RMSiteCompliance compliance) From e8725860ebcecb1f24433e1bff9afa499024d418 Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 23 Apr 2019 12:15:38 +0300 Subject: [PATCH 02/25] transform UserPermissions in enum; add helper methods to create users with rm role, permissions or clearance --- .../community/requests/gscore/api/FilesAPI.java | 6 ++++-- .../rest/rm/community/base/BaseRMRestTest.java | 16 ++++++++++++++++ .../rm/community/base/DataProviderClass.java | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java index 18b91bd2cc..10da1e0570 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java @@ -57,8 +57,9 @@ public class FilesAPI extends RMModelRequest * @param fileId The Id of a file to declare as record * @param parameters Request parameters, refer to API documentation for more details * @return The {@link Record} for created record + * @throws Exception for malformed JSON responses */ - public Record declareAsRecord(String fileId, String parameters) + public Record declareAsRecord(String fileId, String parameters) throws Exception { mandatoryString("fileId", fileId); @@ -75,8 +76,9 @@ public class FilesAPI extends RMModelRequest * * @param fileId The Id of a file to declare as record * @return The {@link Record} for created record + * @throws Exception for malformed JSON responses */ - public Record declareAsRecord(String fileId) + public Record declareAsRecord(String fileId) throws Exception { mandatoryString("fileId", fileId); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 0f9e0352bc..ff69f85d1a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -614,6 +614,22 @@ public class BaseRMRestTest extends RestTest recordCategoryAPI.deleteRecordCategory(recordCategoryId); } + /** + * Assign permission on a record category and give the user RM role + * + * @param user the user to assign rm role and permissions + * @param categoryId the id of the category to assign permissions for + * @param userPermission the permissions to be assigned to the user + * @param userRole the rm role to be assigned to the user + */ + public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission, + String userRole) + { + getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission); + rmRolesAndActionsAPI.assignRoleToUser(getAdminUser().getUsername(), getAdminUser().getPassword(), + user.getUsername(), userRole); + } + /** * Helper method to create a test user with rm role * diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java index b4b39f70b8..d437da677a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java @@ -105,7 +105,7 @@ public class DataProviderClass * @return file plan component alias */ @DataProvider - public static String[][] categoryTypes() + public static Object[][] categoryTypes() { return new String[][] { { FOLDER_TYPE }, From 86128a66b3b3c9d151f63886b7cd8ecb87a55754 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 25 Apr 2019 15:05:18 +0300 Subject: [PATCH 03/25] RM-6796 Added automated tests for Declare and file to a record folder functionality --- .../rm-automation-community-rest-api/pom.xml | 5 + .../alfresco/rest/core/RMRestProperties.java | 3 + .../rest/core/service/ActionsService.java | 85 +++++++++++ .../rm/community/requests/RMModelRequest.java | 2 +- .../community/requests/gscore/GSCoreAPI.java | 2 +- .../rest/rm/community/util/DockerHelper.java | 136 ++++++++++++++++++ .../src/main/resources/config.properties | 5 +- .../files/DeclareDocumentAsRecordTests.java | 8 +- .../community/records/FileRecordsTests.java | 6 +- 9 files changed, 245 insertions(+), 7 deletions(-) create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index 583d5b15e7..4662386d6c 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -85,5 +85,10 @@ commons-collections4 4.1 + + com.github.docker-java + docker-java + 3.0.14 + diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java index 1d6e11f909..99991254a6 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java @@ -56,4 +56,7 @@ public class RMRestProperties extends RestProperties @Value ("${rest.rmPath}") private String restRmPath; + + @Value ("${docker.host}") + private String dockerHost; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java new file mode 100644 index 0000000000..03a54d5c24 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java @@ -0,0 +1,85 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2019 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 . + * #L% + */ +package org.alfresco.rest.core.service; + +import com.google.common.collect.ImmutableMap; + +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.core.RestAPIFactory; +import org.alfresco.rest.rm.community.model.rules.ActionsOnRule; +import org.alfresco.utility.model.RepoTestModel; +import org.alfresco.utility.model.UserModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; + +/** + * Produces processed results from Core Actions API calls + * + * @author Claudia Agache + * @since 3.1 + */ +@Service +public class ActionsService +{ + @Autowired + private RestAPIFactory restAPIFactory; + + /** + * Declares and files a document as record to a record folder using v1 actions api + * + * @param userModel user who executes the action + * @param targetNode the node on which the action is executed + * @param destinationPath the path to the record folder + * @throws Exception + */ + public void declareAndFile(UserModel userModel, RepoTestModel targetNode, String destinationPath) throws Exception + { + RMRestWrapper rmRestWrapper = restAPIFactory.getRmRestWrapper(); + rmRestWrapper.getRestWrapper() + .authenticateUser(userModel).withCoreAPI().usingActions() + .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode, + ImmutableMap.of("path", destinationPath)); + rmRestWrapper.assertStatusCodeIs(HttpStatus.ACCEPTED); + } + + /** + * Declares a document as record using v1 actions api + * + * @param userModel user who executes the action + * @param targetNode the node on which the action is executed + * @throws Exception + */ + public void declareAsRecord(UserModel userModel, RepoTestModel targetNode) throws Exception + { + RMRestWrapper rmRestWrapper = restAPIFactory.getRmRestWrapper(); + rmRestWrapper.getRestWrapper() + .authenticateUser(userModel).withCoreAPI().usingActions() + .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode); + rmRestWrapper.assertStatusCodeIs(HttpStatus.ACCEPTED); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java index c9eefdfa0d..b2510f80f7 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java @@ -48,7 +48,7 @@ public abstract class RMModelRequest extends ModelRequest private RMRestWrapper rmRestWrapper; /** - * @param restWrapper + * @param rmRestWrapper */ public RMModelRequest(RMRestWrapper rmRestWrapper) { diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java index 23f6655166..febd2b5427 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java @@ -113,7 +113,7 @@ public class GSCoreAPI extends RMModelRequest /** * Provides DSL on all REST calls under records/... API path * - * @return {@link FilePlanComponentAPI} + * @return {@link RecordsAPI} */ public RecordsAPI usingRecords() { diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java new file mode 100644 index 0000000000..c5f3be62a2 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java @@ -0,0 +1,136 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2019 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 . + * #L% + */ + +package org.alfresco.rest.rm.community.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +import com.github.dockerjava.api.DockerClient; +import com.github.dockerjava.api.command.LogContainerCmd; +import com.github.dockerjava.api.model.Container; +import com.github.dockerjava.api.model.Frame; +import com.github.dockerjava.core.DockerClientBuilder; +import com.github.dockerjava.core.command.LogContainerResultCallback; + +import org.apache.commons.lang.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +/** + * Helper class for interaction with docker containers + * + * @author Claudia Agache + * @since 3.1 + */ +@Service +public class DockerHelper +{ + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private static final String REPO_IMAGE_NAME = "repository"; + private DockerClient dockerClient; + + public DockerHelper(@Value ("${docker.host}") String dockerHost) + { + if (SystemUtils.IS_OS_WINDOWS) + { + this.dockerClient = DockerClientBuilder.getInstance(dockerHost).build(); + } + else + { + this.dockerClient = DockerClientBuilder.getInstance().build(); + } + } + + /** + * Method for returning logs of docker container + * + * @param containerId - ID of the container + * @return list of strings, where every string is log line + */ + private List getDockerLogs(String containerId) + { + final List logs = new ArrayList<>(); + // get the logs since current time - 10 seconds + int timeStamp = (int) (System.currentTimeMillis() / 1000) - 10; + + LogContainerCmd logContainerCmd = dockerClient.logContainerCmd(containerId); + logContainerCmd.withStdOut(true) + .withStdErr(true) + .withSince(timeStamp) // UNIX timestamp to filter logs. Output log-entries since that timestamp. + .withTimestamps(true); //print timestamps for every log line + + try + { + logContainerCmd.exec(new LogContainerResultCallback() + { + @Override + public void onNext(Frame item) + { + logs.add(item.toString()); + } + }).awaitCompletion(); + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); // set interrupt flag + logger.error("Failed to retrieve logs of container " + containerId, e); + } + + return logs; + } + + /** + * Get the alfresco container logs + * + * @return list of strings, where every string is log line + */ + public List getAlfrescoLogs() + { + Optional alfrescoContainer = findContainerByImageName(REPO_IMAGE_NAME); + return (alfrescoContainer.isPresent()) ? getDockerLogs(alfrescoContainer.get().getId()) : Collections.emptyList(); + } + + /** + * Method for finding a docker container after the image name + * + * @param imageName - the name of the image used by container + * @return the container + */ + private Optional findContainerByImageName(String imageName) + { + List containers = dockerClient.listContainersCmd().withShowAll(true).exec(); + + return containers.stream() + .filter(container -> container.getImage().contains(imageName)) + .findFirst(); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties b/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties index f66389d1f5..5d54d6c02d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties +++ b/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties @@ -1,3 +1,6 @@ alfresco.server=localhost alfresco.port=8080 -rest.rmPath=alfresco/api/-default-/public/gs/versions/1 \ No newline at end of file +rest.rmPath=alfresco/api/-default-/public/gs/versions/1 + +# Docker properties values +docker.host=tcp://127.0.0.1:2375 \ No newline at end of file diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java index 077703bca5..5e08e5fd7f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java @@ -100,10 +100,16 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest * And it is now a record * And it remains a secondary child of the starting location where I can still view it *
+     *
+     * RM-6779
+     * Given I declare a record using the v1 API
+     * When I do not provide a location parameter
+     * Then the record is declared in the unfiled folder
+     *
      * @throws Exception for malformed JSON API response
      */
     @Test(description = "User with correct permissions can declare document as a record")
-    @AlfrescoTest(jira = "RM-4429")
+    @AlfrescoTest(jira = "RM-4429, RM-6779")
     public void userWithPrivilegesCanDeclareDocumentAsRecord() throws Exception
     {
         // create document in a folder in a collaboration site
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java
index 2a90dcb5bd..98a7963406 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java
@@ -68,7 +68,7 @@ public class FileRecordsTests extends BaseRMRestTest
 {
     private UnfiledContainerChild electronicRecord = UnfiledContainerChild.builder()
                                                                   .name(ELECTRONIC_RECORD_NAME)
-                                                                  .nodeType(CONTENT_TYPE.toString())
+                                                                  .nodeType(CONTENT_TYPE)
                                                                   .content(RecordContent.builder().mimeType("text/plain").build())
                                                                   .build();
 
@@ -78,14 +78,14 @@ public class FileRecordsTests extends BaseRMRestTest
                                                                                                             .title("Title")
                                                                                                             .build())
                                                                      .name(NONELECTRONIC_RECORD_NAME)
-                                                                     .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
+                                                                     .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                                      .build();
 
     /**
      * Invalid  containers where electronic and non-electronic records can be filed
      */
     @DataProvider (name = "invalidContainersToFile")
-    public String[][] getFolderContainers() throws Exception
+    public Object[][] getFolderContainers() throws Exception
     {
         return new String[][] {
             { FILE_PLAN_ALIAS},

From d396c87e29e64ef66b32102aa0e2e2c12808282d Mon Sep 17 00:00:00 2001
From: cagache 
Date: Thu, 25 Apr 2019 16:21:01 +0300
Subject: [PATCH 04/25] split test class in 2

---
 .../DeclareAndFileDocumentAsRecordTests.java  | 431 ++++++++++++++++++
 1 file changed, 431 insertions(+)
 create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java

diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
new file mode 100644
index 0000000000..c4d0634eeb
--- /dev/null
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
@@ -0,0 +1,431 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2019 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 .
+ * #L%
+ */
+package org.alfresco.rest.rm.community.files;
+
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
+import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
+import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
+import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
+import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER;
+import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
+import static org.alfresco.utility.data.RandomData.getRandomName;
+import static org.alfresco.utility.report.log.Step.STEP;
+import static org.springframework.http.HttpStatus.CREATED;
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.alfresco.dataprep.CMISUtil;
+import org.alfresco.rest.core.service.ActionsService;
+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.rm.community.model.recordfolder.RecordFolderEntry;
+import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
+import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry;
+import org.alfresco.rest.rm.community.model.user.UserPermissions;
+import org.alfresco.rest.rm.community.model.user.UserRoles;
+import org.alfresco.rest.rm.community.util.DockerHelper;
+import org.alfresco.test.AlfrescoTest;
+import org.alfresco.utility.Utility;
+import org.alfresco.utility.constants.UserRole;
+import org.alfresco.utility.model.FileModel;
+import org.alfresco.utility.model.SiteModel;
+import org.alfresco.utility.model.UserModel;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * API tests for declaring document as record and filing it immediately to a record folder location within the file plan
+ *
+ * @author Claudia Agache
+ * @since 3.1
+ */
+@AlfrescoTest (jira = "RM-6779")
+public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
+{
+    private final static String DESTINATION_PATH_NOT_RESOLVED_EXC = "Unable to execute create-record action, because the destination path could not be resolved.";
+    private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid.";
+    private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder.";
+    private final static String CLOSED_RECORD_FOLDER_EXC = "You can't add new items to a closed record folder";
+
+    private UserModel userFillingPermission, userReadOnlyPermission;
+    private SiteModel publicSite;
+    private RecordCategory recordCategory;
+    private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory;
+    private UnfiledContainerChild unfiledContainerFolder;
+
+    @Autowired
+    private ActionsService actionsService;
+    @Autowired
+    private DockerHelper dockerHelper;
+
+    /**
+     * Invalid  containers where in-place records can't be filed
+     */
+    @DataProvider (name = "invalidFileLocations")
+    public Object[][] getInvalidFileLocations() throws Exception
+    {
+        RecordCategoryChild closedFolder = createFolder(recordCategory.getId(), getRandomName("closedFolder"));
+        closeFolder(closedFolder.getId());
+
+        unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
+                "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE);
+        return new String[][]
+            {
+                { "/", DESTINATION_PATH_NOT_RESOLVED_EXC},
+                { "Unfiled Records", INVALID_DESTINATION_PATH_EXC },
+                { "Transfers", INVALID_DESTINATION_PATH_EXC },
+                { "Holds", INVALID_DESTINATION_PATH_EXC },
+                { "rm/documentlibrary", DESTINATION_PATH_NOT_RESOLVED_EXC },
+                { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC },
+                // a closed record folder
+                { Utility.buildPath(recordCategory.getName(), closedFolder.getName()), CLOSED_RECORD_FOLDER_EXC},
+                // an arbitrary unfiled records folder
+                { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC },
+                // a collaboration site folder
+                { dataContent.usingAdmin().usingSite(publicSite).createFolder().getCmisLocation(), DESTINATION_PATH_NOT_RESOLVED_EXC }
+            };
+    }
+
+    @BeforeClass (alwaysRun = true)
+    public void declareAndFileDocumentAsRecordSetup() throws Exception
+    {
+        STEP("Create test collaboration site to store documents in.");
+        publicSite = dataSite.usingAdmin().createPublicRandomSite();
+
+        STEP("Create a record category with 2 record folders");
+        recordCategory = createRootCategory(getRandomName("recordCategory"));
+        subCategory = createRecordCategory(recordCategory.getId(), getRandomName("subCategory"));
+        recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder"));
+        subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder"));
+
+        STEP("Create rm users with different permissions on the record category");
+        userFillingPermission = createCollaboratorWithRMRoleAndPermission(ROLE_RM_POWER_USER, PERMISSION_FILING);
+        userReadOnlyPermission = createCollaboratorWithRMRoleAndPermission(ROLE_RM_USER, PERMISSION_READ_RECORDS);
+    }
+
+    /**
+     * Given I am calling the "declare as record" action
+     * And I am not providing a location parameter value
+     * When I execute the action
+     * Then the document is declared as a record
+     * And is placed in the Unfiled Records location
+     */
+    @Test
+    public void declareAndFileNoLocationUsingActionsAPI() throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite)
+                                        .usingUser(userReadOnlyPermission)
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record without providing a location parameter value using v1 actions api");
+        actionsService.declareAsRecord(userReadOnlyPermission, testFile);
+
+        STEP("Verify the declared record is placed in the Unfiled Records folder");
+        assertTrue(isMatchingRecordInUnfiledRecords(testFile), "Record should be filed to Unfiled Records folder");
+
+        STEP("Verify the document in collaboration site is now a record");
+        assertTrue(hasRecordAspect(testFile), "File should have record aspect");
+    }
+
+    /**
+     * Given I am calling the "declare as record" action
+     * And I provide a valid record folder in the location parameter
+     * When I execute the action
+     * Then the document is declared as a record
+     * And is filed to the record folder specified
+     */
+    @Test
+    public void declareAndFileToValidLocationUsingActionsAPI() throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite)
+                                        .usingAdmin()
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with a location parameter value");
+        actionsService.declareAndFile(userFillingPermission, testFile,
+                Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
+
+        STEP("Verify the declared record is placed in the record folder");
+        assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record should be filed to record folder");
+
+        STEP("Verify the document in collaboration site is now a record");
+        assertTrue(hasRecordAspect(testFile), "File should have record aspect");
+    }
+
+    /**
+     * Given I am calling the "declare as record" action
+     * And I provide an invalid record folder in the location parameter
+     * When I execute the action
+     * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
+     * And the document is not declared as a record
+     */
+    @Test (dataProvider = "invalidFileLocations")
+    public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite)
+                                        .usingAdmin()
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with an invalid location parameter value");
+        actionsService.declareAndFile(getAdminUser(), testFile, containerPath);
+
+        STEP("Check the exception thrown in alfresco logs");
+        //Retry the operation because sometimes it takes few seconds to throw the exception
+        Utility.sleep(6000, 30000, () ->
+        {
+            List alfrescoLogs = dockerHelper.getAlfrescoLogs();
+            assertTrue(alfrescoLogs.stream().anyMatch(logLine -> logLine.contains(expectedException)));
+        });
+
+        STEP("Check that the file is not a record");
+        assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
+    }
+
+    /**
+     * Given I declare a record using the v1 API
+     * When I provide a location parameter
+     * Then the record is declared in the correct location
+     */
+    @Test
+    public void declareAndFileToValidLocationUsingFilesAPI() throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite)
+                                        .usingAdmin()
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with a location parameter value");
+        //TODO add recordFolder location parameter value
+        Record record = getRestAPIFactory().getFilesAPI(userFillingPermission)
+                                           .declareAsRecord(testFile.getNodeRefWithoutVersion());
+        assertStatusCode(CREATED);
+
+        STEP("Verify the declared record is placed in the record folder");
+        assertEquals(record.getParentId(), recordFolder.getId(), "Record should be filed to record folder");
+
+        STEP("Verify the document in collaboration site is now a record");
+        assertTrue(hasRecordAspect(testFile), "File should have record aspect");
+    }
+
+    /**
+     * Given I am an user with read only permissions on a record folder
+     * When I declare and file a record to the record folder
+     * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
+     * And the document is not declared as a record
+     */
+    @Test
+    public void declareAndFileByUserWithReadOnlyPermission() throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite).usingAdmin()
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with a record folder as location parameter");
+        //TODO add recordFolder location parameter value
+        getRestAPIFactory().getFilesAPI(userReadOnlyPermission).declareAsRecord(testFile.getNodeRefWithoutVersion());
+        //TODO check what status code should be returned
+        assertStatusCode(FORBIDDEN);
+
+        STEP("Check that the file is not a record");
+        assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
+    }
+
+    /**
+     * Given I am a non RM user
+     * When I declare and file a record to the record folder
+     * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
+     * And the document is not declared as a record
+     */
+    @Test
+    public void declareAndFileByNonRMUser() throws Exception
+    {
+        STEP("Create an user with no rm rights");
+        UserModel nonRMUser = getDataUser().createRandomTestUser();
+        getDataUser().addUserToSite(nonRMUser, publicSite, UserRole.SiteContributor);
+
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite).usingUser(nonRMUser)
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with a record folder as location parameter");
+        //TODO add recordFolder location parameter value
+        getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(testFile.getNodeRefWithoutVersion());
+        assertStatusCode(FORBIDDEN);
+
+        STEP("Check that the file is not a record");
+        assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
+    }
+
+    /**
+     * Given I declare a record using the v1 API
+     * When I provide a location parameter
+     * Then the record is declared in the correct location
+     * And when I declare it again using a different location
+     * Then I get an invalid operation exception
+     */
+    @Test
+    public void declareAndFileTwiceDifferentLocations() throws Exception
+    {
+        STEP("Create a document in the collaboration site");
+        FileModel testFile = dataContent.usingSite(publicSite).usingAdmin()
+                                        .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
+
+        STEP("Declare document as record with a record folder as location parameter");
+        //TODO add subcategoryRecordFolder as location parameter value
+        getRestAPIFactory().getFilesAPI(userFillingPermission).declareAsRecord(testFile.getNodeRefWithoutVersion());
+        assertStatusCode(CREATED);
+
+        STEP("Declare it again using a different record folder as location parameter");
+        //TODO add recordFolder as location parameter value
+        getRestAPIFactory().getFilesAPI(userFillingPermission).declareAsRecord(testFile.getNodeRefWithoutVersion());
+        assertStatusCode(UNPROCESSABLE_ENTITY);
+
+        STEP("Verify the declared record is placed in the first record folder");
+        assertTrue(isMatchingRecordInRecordFolder(testFile, subcategoryRecordFolder),
+                "Record should be filed to recordFolder");
+        assertFalse(isMatchingRecordInRecordFolder(testFile, recordFolder),
+                "Record should not be filed to subcategoryRecordFolder");
+    }
+
+    /**
+     * Helper method to verify if the declared record is in Unfiled Records location
+     *
+     * @param testFile the file declared as record
+     * @return true if the matching record is found in Unfiled Records, false otherwise
+     */
+    private boolean isMatchingRecordInUnfiledRecords(FileModel testFile)
+    {
+        try
+        {
+            Utility.sleep(5000, 15000,
+                () -> {
+                    Optional matchingRecord = getRestAPIFactory().getUnfiledContainersAPI()
+                                                                                             .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
+                                                                                             .getEntries()
+                                                                                             .stream()
+                                                                                             .filter(e -> e.getEntry().getId()
+                                                                                                           .equals(testFile.getNodeRefWithoutVersion()))
+                                                                                             .findAny();
+                    assertTrue(matchingRecord.isPresent());
+                });
+            return true;
+        }
+        catch (AssertionError | Exception e)
+        {
+            return false;
+        }
+    }
+
+    /**
+     * Helper method to verify if the declared record is filed to the record folder location
+     *
+     * @param testFile the file declared as record
+     * @param recFolder the record folder where the declared record has been filed
+     * @return true if matching record is found in record folder, null otherwise
+     */
+    private boolean isMatchingRecordInRecordFolder(FileModel testFile, RecordCategoryChild recFolder)
+    {
+        try
+        {
+            Utility.sleep(5000, 15000,
+                () -> {
+                    Optional matchingRecord = getRestAPIFactory().getRecordFolderAPI()
+                                                                                    .getRecordFolderChildren(recFolder.getId())
+                                                                                    .getEntries()
+                                                                                    .stream()
+                                                                                    .filter(e -> e.getEntry().getId()
+                                                                                                  .equals(testFile.getNodeRefWithoutVersion()))
+                                                                                    .findAny();
+                    assertTrue(matchingRecord.isPresent());
+                });
+            return true;
+        }
+        catch (AssertionError | Exception e)
+        {
+            return false;
+        }
+    }
+
+    /**
+     * Helper method to create a test user with rm role and permissions over the recordCategory and collaborator role
+     * in collaboration site
+     *
+     * @param userRole the rm role
+     * @param userPermission the permissions over the recordCategory
+     * @return the created user model
+     * @throws Exception
+     */
+    private UserModel createCollaboratorWithRMRoleAndPermission(UserRoles userRole, UserPermissions userPermission)
+    {
+        UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory, userPermission);
+        getDataUser().addUserToSite(rmUser, publicSite, UserRole.SiteCollaborator);
+        return rmUser;
+    }
+
+    /**
+     * Checks if the given file has record aspect
+     *
+     * @param testFile the file to be checked
+     * @return true if the file has the aspect, false otherwise
+     */
+    private boolean hasRecordAspect(FileModel testFile) throws Exception
+    {
+        return getRestAPIFactory().getNodeAPI(testFile).getNode()
+                                  .getAspectNames().contains(RECORD_TYPE);
+    }
+
+    @AfterClass(alwaysRun = true)
+    public void declareAndFileDocumentAsRecordCleanup()
+    {
+        //delete rm items
+        deleteRecordCategory(recordCategory.getId());
+        getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledContainerFolder.getId());
+
+        //delete created collaboration site
+        dataSite.deleteSite(publicSite);
+
+        //delete users
+        getDataUser().deleteUser(userFillingPermission);
+        getDataUser().deleteUser(userReadOnlyPermission);
+    }
+}

From 9f095aea8c4472df9ada9c066ad9d38d6c776102 Mon Sep 17 00:00:00 2001
From: Rodica Sutu 
Date: Fri, 3 May 2019 15:54:08 +0300
Subject: [PATCH 05/25] remove some of the method duplicated and change the
 action service class into a component

---
 .../alfresco/rest/core/RestAPIFactory.java    |  11 ++
 .../community/requests/gscore/GSCoreAPI.java  |  11 ++
 .../gscore/api/ActionsExecutionAPI.java}      |  46 +++---
 .../alfresco/rest/v0/service/RoleService.java |  82 +++++++++++
 .../rm/community/base/BaseRMRestTest.java     | 136 +++++++++++-------
 .../DeclareAndFileDocumentAsRecordTests.java  | 110 ++------------
 .../community/records/DeleteRecordTests.java  |   6 +-
 .../community/records/UpdateRecordsTests.java |   7 +-
 8 files changed, 235 insertions(+), 174 deletions(-)
 rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/{core/service/ActionsService.java => rm/community/requests/gscore/api/ActionsExecutionAPI.java} (58%)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
index 05e5c3db21..ac0a6025cc 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
@@ -34,6 +34,7 @@ import org.alfresco.rest.requests.Node;
 import org.alfresco.rest.requests.coreAPI.RestCoreAPI;
 import org.alfresco.rest.requests.search.SearchAPI;
 import org.alfresco.rest.rm.community.requests.gscore.GSCoreAPI;
+import org.alfresco.rest.rm.community.requests.gscore.api.ActionsExecutionAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
@@ -225,4 +226,14 @@ public class RestAPIFactory
     {
         return getGSCoreAPI(userModel).usingUnfiledRecordFolder();
     }
+
+    public ActionsExecutionAPI getActionsAPI(UserModel userModel)
+    {
+        return getGSCoreAPI(userModel).usingActionsExecutionsAPI();
+    }
+
+    public ActionsExecutionAPI getActionsAPI()
+    {
+        return getGSCoreAPI(null).usingActionsExecutionsAPI();
+    }
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
index febd2b5427..f0e2e241ed 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
@@ -33,6 +33,7 @@ import com.jayway.restassured.RestAssured;
 
 import org.alfresco.rest.core.RMRestProperties;
 import org.alfresco.rest.core.RMRestWrapper;
+import org.alfresco.rest.rm.community.requests.gscore.api.ActionsExecutionAPI;
 import org.alfresco.rest.rm.community.requests.RMModelRequest;
 import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI;
@@ -179,4 +180,14 @@ public class GSCoreAPI extends RMModelRequest
     {
         return new RMUserAPI(getRmRestWrapper());
     }
+
+    /**
+     * Provides DSL for ActionExecution API
+     *
+     * @return {@link ActionsExecutionAPI}
+     */
+    public ActionsExecutionAPI usingActionsExecutionsAPI()
+    {
+        return new ActionsExecutionAPI(restWrapper);
+    }
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
similarity index 58%
rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java
rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
index 03a54d5c24..d6e2475624 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/service/ActionsService.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
@@ -24,18 +24,16 @@
  * along with Alfresco. If not, see .
  * #L%
  */
-package org.alfresco.rest.core.service;
+package org.alfresco.rest.rm.community.requests.gscore.api;
 
 import com.google.common.collect.ImmutableMap;
 
-import org.alfresco.rest.core.RMRestWrapper;
-import org.alfresco.rest.core.RestAPIFactory;
+import org.alfresco.rest.core.RestWrapper;
+import org.alfresco.rest.requests.ModelRequest;
 import org.alfresco.rest.rm.community.model.rules.ActionsOnRule;
 import org.alfresco.utility.model.RepoTestModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Service;
+import org.json.JSONObject;
+import org.springframework.stereotype.Component;
 
 /**
  * Produces processed results from Core Actions API calls
@@ -43,43 +41,43 @@ import org.springframework.stereotype.Service;
  * @author Claudia Agache
  * @since 3.1
  */
-@Service
-public class ActionsService
+@Component
+public class ActionsExecutionAPI extends ModelRequest
 {
-    @Autowired
-    private RestAPIFactory restAPIFactory;
+
+    /**
+     * @param rmRestWrapper
+     */
+    public ActionsExecutionAPI(RestWrapper rmRestWrapper)
+    {
+        super(rmRestWrapper);
+    }
+
 
     /**
      * Declares and files a document as record to a record folder using v1 actions api
      *
-     * @param userModel       user who executes the action
      * @param targetNode      the node on which the action is executed
      * @param destinationPath the path to the record folder
      * @throws Exception
      */
-    public void declareAndFile(UserModel userModel, RepoTestModel targetNode, String destinationPath) throws Exception
+    public JSONObject declareAndFile(RepoTestModel targetNode, String destinationPath) throws Exception
     {
-        RMRestWrapper rmRestWrapper = restAPIFactory.getRmRestWrapper();
-        rmRestWrapper.getRestWrapper()
-                     .authenticateUser(userModel).withCoreAPI().usingActions()
+       return restWrapper.withCoreAPI().usingActions()
                      .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode,
                              ImmutableMap.of("path", destinationPath));
-        rmRestWrapper.assertStatusCodeIs(HttpStatus.ACCEPTED);
+
     }
 
     /**
      * Declares a document as record using v1 actions api
      *
-     * @param userModel  user who executes the action
      * @param targetNode the node on which the action is executed
      * @throws Exception
      */
-    public void declareAsRecord(UserModel userModel, RepoTestModel targetNode) throws Exception
+    public JSONObject declareAsRecord(RepoTestModel targetNode) throws Exception
     {
-        RMRestWrapper rmRestWrapper = restAPIFactory.getRmRestWrapper();
-        rmRestWrapper.getRestWrapper()
-                                     .authenticateUser(userModel).withCoreAPI().usingActions()
-                       .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode);
-        rmRestWrapper.assertStatusCodeIs(HttpStatus.ACCEPTED);
+        return restWrapper.withCoreAPI().usingActions()
+                                 .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode);
     }
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
index ccf2785cd8..d126fb92a0 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
@@ -26,12 +26,22 @@
  */
 package org.alfresco.rest.v0.service;
 
+import static lombok.AccessLevel.PROTECTED;
+import static org.springframework.http.HttpStatus.OK;
+
 import java.util.HashSet;
 import java.util.Set;
 
+import lombok.Getter;
+import org.alfresco.rest.core.RestAPIFactory;
+import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
+import org.alfresco.rest.rm.community.model.user.UserPermissions;
 import org.alfresco.rest.rm.community.model.user.UserRoles;
 import org.alfresco.rest.v0.RMRolesAndActionsAPI;
+import org.alfresco.utility.constants.UserRole;
 import org.alfresco.utility.data.DataUser;
+import org.alfresco.utility.model.SiteModel;
+import org.alfresco.utility.model.UserModel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -50,6 +60,10 @@ public class RoleService
     @Autowired
     private DataUser dataUser;
 
+    @Autowired
+    @Getter (value = PROTECTED)
+    private RestAPIFactory restAPIFactory;
+
     /**
      * Add capabilities to a role
      *
@@ -81,4 +95,72 @@ public class RoleService
         rmRolesAndActionsAPI.updateRole(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
                 role.roleId, role.displayName, roleCapabilities);
     }
+
+    /**
+     * Assign permission on a record category and give the user RM role
+     *
+     * @param user           the user to assign rm role and permissions
+     * @param categoryId     the id of the category to assign permissions for
+     * @param userPermission the permissions to be assigned to the user
+     * @param userRole       the rm role to be assigned to the user
+     */
+    public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission,
+                                                         String userRole)
+    {
+        getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
+        rmRolesAndActionsAPI.assignRoleToUser(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
+                user.getUsername(), userRole);
+    }
+
+    /**
+     * Helper method to create a test user with rm role
+     *
+     * @param userRole the rm role
+     * @return the created user model
+     */
+    public UserModel createUserWithRMRole(String userRole)
+    {
+        UserModel rmUser = dataUser.createRandomTestUser();
+        getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole);
+        getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
+        return rmUser;
+    }
+
+    /**
+     * Helper method to create a test user with rm role and permissions over the record category
+     *
+     * @param userRole       the rm role
+     * @param userPermission the permissions over the record category
+     * @param recordCategory the category on which user has permissions
+     * @return the created user model
+     */
+    public UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory,
+                                                                  UserPermissions userPermission)
+    {
+        UserModel rmUser = createUserWithRMRole(userRole);
+        getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), rmUser, userPermission);
+        getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
+        return rmUser;
+    }
+
+    /**
+     * Helper method to create a test user with rm role and permissions over the recordCategory and collaborator role
+     * in collaboration site
+     *
+     * @param siteModel collaboration site
+     * @param recordCategory  the category  on which permission should be given
+     * @param userRole       the rm role
+     * @param userPermission the permissions over the recordCategory
+     * @return the created user model
+     * @throws Exception
+     */
+    public UserModel createCollaboratorWithRMRoleAndPermission(SiteModel siteModel, RecordCategory recordCategory,
+                                                                UserRoles userRole, UserPermissions userPermission)
+    {
+        UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory,
+                userPermission);
+        dataUser.addUserToSite(rmUser, siteModel, UserRole.SiteCollaborator);
+        return rmUser;
+    }
+
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
index ff69f85d1a..64f244019c 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
@@ -52,6 +52,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import lombok.Getter;
@@ -65,12 +66,13 @@ 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.rm.community.model.recordfolder.RecordFolder;
+import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderEntry;
 import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
 import org.alfresco.rest.rm.community.model.site.RMSite;
 import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer;
 import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer;
 import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
+import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry;
 import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
@@ -80,8 +82,10 @@ import org.alfresco.rest.search.SearchNodeModel;
 import org.alfresco.rest.search.SearchRequest;
 import org.alfresco.rest.v0.RMRolesAndActionsAPI;
 import org.alfresco.rest.v0.SearchAPI;
+import org.alfresco.utility.Utility;
 import org.alfresco.utility.data.DataUser;
 import org.alfresco.utility.model.ContentModel;
+import org.alfresco.utility.model.FileModel;
 import org.alfresco.utility.model.FolderModel;
 import org.alfresco.utility.model.SiteModel;
 import org.alfresco.utility.model.UserModel;
@@ -614,53 +618,6 @@ public class BaseRMRestTest extends RestTest
         recordCategoryAPI.deleteRecordCategory(recordCategoryId);
     }
 
-    /**
-     * Assign permission on a record category and give the user RM role
-     *
-     * @param user the user to assign rm role and permissions
-     * @param categoryId the id of the category to assign permissions for
-     * @param userPermission the permissions to be assigned to the user
-     * @param userRole the rm role to be assigned to the user
-     */
-    public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission,
-                                                         String userRole)
-    {
-        getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
-        rmRolesAndActionsAPI.assignRoleToUser(getAdminUser().getUsername(), getAdminUser().getPassword(),
-                user.getUsername(), userRole);
-    }
-
-    /**
-     * Helper method to create a test user with rm role
-     *
-     * @param userRole the rm role
-     * @return the created user model
-     */
-    protected UserModel createUserWithRMRole(String userRole)
-    {
-        UserModel rmUser = getDataUser().createRandomTestUser();
-        getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole);
-        assertStatusCode(OK);
-        return rmUser;
-    }
-
-    /**
-     * Helper method to create a test user with rm role and permissions over the record category
-     *
-     * @param userRole the rm role
-     * @param userPermission the permissions over the record category
-     * @param recordCategory the category on which user has permissions
-     * @return the created user model
-     */
-    protected UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory,
-                                                                  UserPermissions userPermission)
-    {
-        UserModel rmUser = createUserWithRMRole(userRole);
-        getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), rmUser, userPermission);
-        assertStatusCode(OK);
-        return rmUser;
-    }
-
     /**
      * Returns search results for the given search term
      *
@@ -825,4 +782,87 @@ public class BaseRMRestTest extends RestTest
         documentLibrary.setNodeRef(nodes.get(0).onModel().getId());
         return documentLibrary;
     }
+
+    /**
+     * Checks if the given file has record aspect
+     *
+     * @param testFile the file to be checked
+     * @return true if the file has the aspect, false otherwise
+     */
+    protected boolean hasRecordAspect(FileModel testFile) throws Exception
+    {
+        return hasAspect(testFile,RECORD_TYPE);
+    }
+
+    /**
+     * Checks if the given file has the given aspect
+     *
+     * @param testFile the file to be checked
+     * @param aspectName the matching aspect
+     * @return true if the file has the aspect, false otherwise
+     */
+    private boolean hasAspect(FileModel testFile, String aspectName) throws Exception
+    {
+        return getRestAPIFactory().getNodeAPI(testFile).getNode()
+                                  .getAspectNames().contains(aspectName);
+    }
+
+    /**
+     * Helper method to verify if the declared record is in Unfiled Records location
+     *
+     * @param testFile the file declared as record
+     * @return true if the matching record is found in Unfiled Records, false otherwise
+     */
+    protected boolean isMatchingRecordInUnfiledRecords(FileModel testFile)
+    {
+        try
+        {
+            Utility.sleep(5000, 15000,
+                    () -> {
+                        Optional matchingRecord = getRestAPIFactory().getUnfiledContainersAPI()
+                                                                                                 .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
+                                                                                                 .getEntries()
+                                                                                                 .stream()
+                                                                                                 .filter(e -> e.getEntry().getId()
+                                                                                                               .equals(testFile.getNodeRefWithoutVersion()))
+                                                                                                 .findAny();
+                        assertTrue(matchingRecord.isPresent());
+                    });
+            return true;
+        }
+        catch (AssertionError | Exception e)
+        {
+            return false;
+        }
+    }
+
+    /**
+     * Helper method to verify if the declared record is filed to the record folder location
+     *
+     * @param testFile  the file declared as record
+     * @param recFolder the record folder where the declared record has been filed
+     * @return true if matching record is found in record folder, null otherwise
+     */
+    protected boolean isMatchingRecordInRecordFolder(FileModel testFile, RecordCategoryChild recFolder)
+    {
+        try
+        {
+            Utility.sleep(5000, 15000,
+                    () -> {
+                        Optional matchingRecord = getRestAPIFactory().getRecordFolderAPI()
+                                                                                        .getRecordFolderChildren(recFolder.getId())
+                                                                                        .getEntries()
+                                                                                        .stream()
+                                                                                        .filter(e -> e.getEntry().getId()
+                                                                                                      .equals(testFile.getNodeRefWithoutVersion()))
+                                                                                        .findAny();
+                        assertTrue(matchingRecord.isPresent());
+                    });
+            return true;
+        }
+        catch (AssertionError | Exception e)
+        {
+            return false;
+        }
+    }
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
index c4d0634eeb..da36124ada 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
@@ -27,7 +27,6 @@
 package org.alfresco.rest.rm.community.files;
 
 import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_TYPE;
 import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
 import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
 import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
@@ -36,6 +35,7 @@ import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER;
 import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
 import static org.alfresco.utility.data.RandomData.getRandomName;
 import static org.alfresco.utility.report.log.Step.STEP;
+import static org.springframework.http.HttpStatus.ACCEPTED;
 import static org.springframework.http.HttpStatus.CREATED;
 import static org.springframework.http.HttpStatus.FORBIDDEN;
 import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
@@ -44,20 +44,15 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
 import java.util.List;
-import java.util.Optional;
 
 import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.core.service.ActionsService;
 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.rm.community.model.recordfolder.RecordFolderEntry;
 import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
 import org.alfresco.rest.rm.community.util.DockerHelper;
+import org.alfresco.rest.v0.service.RoleService;
 import org.alfresco.test.AlfrescoTest;
 import org.alfresco.utility.Utility;
 import org.alfresco.utility.constants.UserRole;
@@ -90,11 +85,12 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
     private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory;
     private UnfiledContainerChild unfiledContainerFolder;
 
-    @Autowired
-    private ActionsService actionsService;
     @Autowired
     private DockerHelper dockerHelper;
 
+    @Autowired
+    private RoleService roleService;
+
     /**
      * Invalid  containers where in-place records can't be filed
      */
@@ -136,8 +132,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
         subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder"));
 
         STEP("Create rm users with different permissions on the record category");
-        userFillingPermission = createCollaboratorWithRMRoleAndPermission(ROLE_RM_POWER_USER, PERMISSION_FILING);
-        userReadOnlyPermission = createCollaboratorWithRMRoleAndPermission(ROLE_RM_USER, PERMISSION_READ_RECORDS);
+        userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING);
+        userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory,ROLE_RM_USER, PERMISSION_READ_RECORDS);
     }
 
     /**
@@ -156,7 +152,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
                                         .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
 
         STEP("Declare document as record without providing a location parameter value using v1 actions api");
-        actionsService.declareAsRecord(userReadOnlyPermission, testFile);
+        getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAsRecord(testFile);
 
         STEP("Verify the declared record is placed in the Unfiled Records folder");
         assertTrue(isMatchingRecordInUnfiledRecords(testFile), "Record should be filed to Unfiled Records folder");
@@ -181,7 +177,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
                                         .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
 
         STEP("Declare document as record with a location parameter value");
-        actionsService.declareAndFile(userFillingPermission, testFile,
+        getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile,
                 Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
 
         STEP("Verify the declared record is placed in the record folder");
@@ -207,7 +203,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
                                         .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
 
         STEP("Declare document as record with an invalid location parameter value");
-        actionsService.declareAndFile(getAdminUser(), testFile, containerPath);
+        getRestAPIFactory().getActionsAPI().declareAndFile(testFile, containerPath);
+        assertStatusCode(ACCEPTED);
 
         STEP("Check the exception thrown in alfresco logs");
         //Retry the operation because sometimes it takes few seconds to throw the exception
@@ -327,92 +324,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
                 "Record should not be filed to subcategoryRecordFolder");
     }
 
-    /**
-     * Helper method to verify if the declared record is in Unfiled Records location
-     *
-     * @param testFile the file declared as record
-     * @return true if the matching record is found in Unfiled Records, false otherwise
-     */
-    private boolean isMatchingRecordInUnfiledRecords(FileModel testFile)
-    {
-        try
-        {
-            Utility.sleep(5000, 15000,
-                () -> {
-                    Optional matchingRecord = getRestAPIFactory().getUnfiledContainersAPI()
-                                                                                             .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
-                                                                                             .getEntries()
-                                                                                             .stream()
-                                                                                             .filter(e -> e.getEntry().getId()
-                                                                                                           .equals(testFile.getNodeRefWithoutVersion()))
-                                                                                             .findAny();
-                    assertTrue(matchingRecord.isPresent());
-                });
-            return true;
-        }
-        catch (AssertionError | Exception e)
-        {
-            return false;
-        }
-    }
 
-    /**
-     * Helper method to verify if the declared record is filed to the record folder location
-     *
-     * @param testFile the file declared as record
-     * @param recFolder the record folder where the declared record has been filed
-     * @return true if matching record is found in record folder, null otherwise
-     */
-    private boolean isMatchingRecordInRecordFolder(FileModel testFile, RecordCategoryChild recFolder)
-    {
-        try
-        {
-            Utility.sleep(5000, 15000,
-                () -> {
-                    Optional matchingRecord = getRestAPIFactory().getRecordFolderAPI()
-                                                                                    .getRecordFolderChildren(recFolder.getId())
-                                                                                    .getEntries()
-                                                                                    .stream()
-                                                                                    .filter(e -> e.getEntry().getId()
-                                                                                                  .equals(testFile.getNodeRefWithoutVersion()))
-                                                                                    .findAny();
-                    assertTrue(matchingRecord.isPresent());
-                });
-            return true;
-        }
-        catch (AssertionError | Exception e)
-        {
-            return false;
-        }
-    }
-
-    /**
-     * Helper method to create a test user with rm role and permissions over the recordCategory and collaborator role
-     * in collaboration site
-     *
-     * @param userRole the rm role
-     * @param userPermission the permissions over the recordCategory
-     * @return the created user model
-     * @throws Exception
-     */
-    private UserModel createCollaboratorWithRMRoleAndPermission(UserRoles userRole, UserPermissions userPermission)
-    {
-        UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory, userPermission);
-        getDataUser().addUserToSite(rmUser, publicSite, UserRole.SiteCollaborator);
-        return rmUser;
-    }
-
-    /**
-     * Checks if the given file has record aspect
-     *
-     * @param testFile the file to be checked
-     * @return true if the file has the aspect, false otherwise
-     */
-    private boolean hasRecordAspect(FileModel testFile) throws Exception
-    {
-        return getRestAPIFactory().getNodeAPI(testFile).getNode()
-                                  .getAspectNames().contains(RECORD_TYPE);
-    }
 
     @AfterClass(alwaysRun = true)
     public void declareAndFileDocumentAsRecordCleanup()
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
index 387e263460..bc88c6a6d6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
@@ -49,7 +49,6 @@ import static org.springframework.http.HttpStatus.NO_CONTENT;
 import static org.springframework.http.HttpStatus.OK;
 
 import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.core.JsonBodyGenerator;
 import org.alfresco.rest.core.RestResponse;
 import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS;
 import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
@@ -66,6 +65,7 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
 import org.alfresco.rest.v0.RMRolesAndActionsAPI;
 import org.alfresco.rest.v0.service.DispositionScheduleService;
+import org.alfresco.rest.v0.service.RoleService;
 import org.alfresco.test.AlfrescoTest;
 import org.alfresco.utility.data.RandomData;
 import org.alfresco.utility.model.FileModel;
@@ -90,6 +90,8 @@ public class DeleteRecordTests extends BaseRMRestTest
     private RMRolesAndActionsAPI rmRolesAndActionsAPI;
     @Autowired
     private org.alfresco.rest.v0.RecordsAPI recordsAPI;
+    @Autowired
+    private RoleService roleService;
 
     /**
      * 
@@ -237,7 +239,7 @@ public class DeleteRecordTests extends BaseRMRestTest
     {
         // Create test user and add it with collaboration privileges
         // Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities
-        UserModel deleteUser = createUserWithRMRole(ROLE_RM_POWER_USER.roleId);
+        UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_POWER_USER.roleId);
         getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), SiteCollaborator);
         String username = deleteUser.getUsername();
         logger.info("Test user: " + username);
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
index c433c99dc6..35c2eee056 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
@@ -66,10 +66,12 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
 import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
+import org.alfresco.rest.v0.service.RoleService;
 import org.alfresco.test.AlfrescoTest;
 import org.alfresco.utility.constants.UserRole;
 import org.alfresco.utility.model.SiteModel;
 import org.alfresco.utility.model.UserModel;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -87,6 +89,9 @@ public class UpdateRecordsTests extends BaseRMRestTest
     /* to be used to append to modifications */
     private final String MODIFIED_PREFIX = "modified_";
 
+    @Autowired
+    private RoleService roleService;
+
     /** Incomplete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */
     @DataProvider(name = "incompleteRecords")
     public Object[][] getIncompleteRecords() throws Exception
@@ -236,7 +241,7 @@ public class UpdateRecordsTests extends BaseRMRestTest
         RMUserAPI rmUserAPI = getRestAPIFactory().getRMUserAPI();
         // Create test user and add it with collab. privileges.
         // RM Security Officer is the lowest role with Edit Record Metadata capabilities
-        UserModel updateUser = createUserWithRMRole(ROLE_RM_SECURITY_OFFICER.roleId);
+        UserModel updateUser = roleService.createUserWithRMRole(ROLE_RM_SECURITY_OFFICER.roleId);
         updateUser.setUserRole(UserRole.SiteCollaborator);
         getDataUser().addUserToSite(updateUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
 

From cff25869f8a563514d83cb6b1ecbec4e5fbd8909 Mon Sep 17 00:00:00 2001
From: cagache 
Date: Mon, 6 May 2019 10:25:19 +0300
Subject: [PATCH 06/25] updated javadoc

---
 .../rest/rm/community/requests/gscore/api/FilePlanAPI.java      | 2 +-
 .../rest/rm/community/requests/gscore/api/FilesAPI.java         | 2 +-
 .../rest/rm/community/requests/gscore/api/RMUserAPI.java        | 2 +-
 .../rm/community/requests/gscore/api/RecordCategoryAPI.java     | 2 +-
 .../rest/rm/community/requests/gscore/api/RecordFolderAPI.java  | 2 +-
 .../rest/rm/community/requests/gscore/api/RecordsAPI.java       | 2 +-
 .../rest/rm/community/requests/gscore/api/TransferAPI.java      | 2 +-
 .../rm/community/requests/gscore/api/TransferContainerAPI.java  | 2 +-
 .../rm/community/requests/gscore/api/UnfiledContainerAPI.java   | 2 +-
 .../community/requests/gscore/api/UnfiledRecordFolderAPI.java   | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java
index 2dc3978e1b..895ccd6d5e 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java
@@ -54,7 +54,7 @@ public class FilePlanAPI extends RMModelRequest
     /**
      * Constructor.
      *
-     * @param restWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public FilePlanAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java
index 10da1e0570..5440b3866c 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java
@@ -44,7 +44,7 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest;
 public class FilesAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public FilesAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java
index 213751117f..7b53f855ea 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java
@@ -59,7 +59,7 @@ import org.alfresco.utility.model.UserModel;
 public class RMUserAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public RMUserAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java
index 9158ce00e5..2d8121f36a 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java
@@ -54,7 +54,7 @@ public class RecordCategoryAPI extends RMModelRequest
     /**
      * Constructor.
      *
-     * @param restWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public RecordCategoryAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java
index bc79c916e5..230517d571 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java
@@ -66,7 +66,7 @@ public class RecordFolderAPI extends RMModelRequest
     /**
      * Constructor.
      *
-     * @param restWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public RecordFolderAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java
index 6057234ecb..f9958fc5bf 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java
@@ -53,7 +53,7 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest;
 public class RecordsAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public RecordsAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java
index 9ec19094e0..4bcf18813e 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java
@@ -46,7 +46,7 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest;
 public class TransferAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public TransferAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java
index 22ae02b913..4613a65624 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java
@@ -50,7 +50,7 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest;
 public class TransferContainerAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public TransferContainerAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java
index 05a1e6b846..b919f9ea93 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java
@@ -63,7 +63,7 @@ import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin;
 public class UnfiledContainerAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public UnfiledContainerAPI(RMRestWrapper rmRestWrapper)
     {
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java
index aa4328ccfd..d04576ed21 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java
@@ -63,7 +63,7 @@ import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin;
 public class UnfiledRecordFolderAPI extends RMModelRequest
 {
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
     public UnfiledRecordFolderAPI(RMRestWrapper rmRestWrapper)
     {

From 41f9acbede8ca2b58d04a8f19290e53b913b3f5a Mon Sep 17 00:00:00 2001
From: cagache 
Date: Mon, 6 May 2019 10:28:11 +0300
Subject: [PATCH 07/25] used rmRestWrapper

---
 .../rm/community/requests/gscore/GSCoreAPI.java    |  2 +-
 .../requests/gscore/api/ActionsExecutionAPI.java   | 14 +++++---------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
index f0e2e241ed..063eb03b43 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java
@@ -188,6 +188,6 @@ public class GSCoreAPI extends RMModelRequest
      */
     public ActionsExecutionAPI usingActionsExecutionsAPI()
     {
-        return new ActionsExecutionAPI(restWrapper);
+        return new ActionsExecutionAPI(getRmRestWrapper());
     }
 }
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
index d6e2475624..d663609833 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
@@ -28,12 +28,11 @@ package org.alfresco.rest.rm.community.requests.gscore.api;
 
 import com.google.common.collect.ImmutableMap;
 
-import org.alfresco.rest.core.RestWrapper;
-import org.alfresco.rest.requests.ModelRequest;
+import org.alfresco.rest.core.RMRestWrapper;
 import org.alfresco.rest.rm.community.model.rules.ActionsOnRule;
+import org.alfresco.rest.rm.community.requests.RMModelRequest;
 import org.alfresco.utility.model.RepoTestModel;
 import org.json.JSONObject;
-import org.springframework.stereotype.Component;
 
 /**
  * Produces processed results from Core Actions API calls
@@ -41,19 +40,16 @@ import org.springframework.stereotype.Component;
  * @author Claudia Agache
  * @since 3.1
  */
-@Component
-public class ActionsExecutionAPI extends ModelRequest
+public class ActionsExecutionAPI extends RMModelRequest
 {
-
     /**
-     * @param rmRestWrapper
+     * @param rmRestWrapper RM REST Wrapper
      */
-    public ActionsExecutionAPI(RestWrapper rmRestWrapper)
+    public ActionsExecutionAPI(RMRestWrapper rmRestWrapper)
     {
         super(rmRestWrapper);
     }
 
-
     /**
      * Declares and files a document as record to a record folder using v1 actions api
      *

From a37e56f1fc088836a12c53d83b6c90c9d57dbd04 Mon Sep 17 00:00:00 2001
From: cagache 
Date: Mon, 6 May 2019 10:33:42 +0300
Subject: [PATCH 08/25] code review comments

---
 .../rm/community/files/DeclareAndFileDocumentAsRecordTests.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
index da36124ada..899466aeaf 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
@@ -125,7 +125,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
         STEP("Create test collaboration site to store documents in.");
         publicSite = dataSite.usingAdmin().createPublicRandomSite();
 
-        STEP("Create a record category with 2 record folders");
+        STEP("Create record categories and record folders");
         recordCategory = createRootCategory(getRandomName("recordCategory"));
         subCategory = createRecordCategory(recordCategory.getId(), getRandomName("subCategory"));
         recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder"));

From f7e8eb9def731a498681d2485a6c2589442bc35c Mon Sep 17 00:00:00 2001
From: cagache 
Date: Mon, 6 May 2019 15:20:29 +0300
Subject: [PATCH 09/25] autowire the constructor

---
 .../java/org/alfresco/rest/rm/community/util/DockerHelper.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java
index c5f3be62a2..adbb4ab30c 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java
@@ -42,6 +42,7 @@ import com.github.dockerjava.core.command.LogContainerResultCallback;
 import org.apache.commons.lang.SystemUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -58,6 +59,7 @@ public class DockerHelper
     private static final String REPO_IMAGE_NAME = "repository";
     private DockerClient dockerClient;
 
+    @Autowired
     public DockerHelper(@Value ("${docker.host}") String dockerHost)
     {
         if (SystemUtils.IS_OS_WINDOWS)

From 7ed0e9f15cb1b97f23feb297cd2fd1f67b763b4a Mon Sep 17 00:00:00 2001
From: cagache 
Date: Mon, 6 May 2019 16:57:39 +0300
Subject: [PATCH 10/25] used rmRestWrapper

---
 .../requests/gscore/api/ActionsExecutionAPI.java         | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
index d663609833..a977db9ad6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java
@@ -59,10 +59,9 @@ public class ActionsExecutionAPI extends RMModelRequest
      */
     public JSONObject declareAndFile(RepoTestModel targetNode, String destinationPath) throws Exception
     {
-       return restWrapper.withCoreAPI().usingActions()
-                     .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode,
-                             ImmutableMap.of("path", destinationPath));
-
+        return getRmRestWrapper().withCoreAPI().usingActions()
+                                 .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode,
+                                         ImmutableMap.of("path", destinationPath));
     }
 
     /**
@@ -73,7 +72,7 @@ public class ActionsExecutionAPI extends RMModelRequest
      */
     public JSONObject declareAsRecord(RepoTestModel targetNode) throws Exception
     {
-        return restWrapper.withCoreAPI().usingActions()
+        return getRmRestWrapper().withCoreAPI().usingActions()
                                  .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode);
     }
 }

From 2955a87244c39f1152d3f1d5a085a662170028a1 Mon Sep 17 00:00:00 2001
From: cagache 
Date: Thu, 9 May 2019 10:38:19 +0300
Subject: [PATCH 11/25] fix some sonar issues from RoleService class

---
 .../alfresco/rest/v0/service/RoleService.java | 39 ++++++++++++-------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
index d126fb92a0..a5bdff72c0 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
@@ -55,15 +55,29 @@ import org.springframework.stereotype.Service;
 public class RoleService
 {
     @Autowired
+    @Getter (value = PROTECTED)
     private RMRolesAndActionsAPI rmRolesAndActionsAPI;
 
     @Autowired
+    @Getter (value = PROTECTED)
     private DataUser dataUser;
 
     @Autowired
     @Getter (value = PROTECTED)
     private RestAPIFactory restAPIFactory;
 
+    /**
+     * Get the capabilities for a role
+     *
+     * @param roleName the role name
+     * @return the list of capabilities
+     */
+    public Set getRoleCapabilities(String roleName)
+    {
+        return getRmRolesAndActionsAPI().getCapabilitiesForRole(getDataUser().getAdminUser().getUsername(),
+                getDataUser().getAdminUser().getPassword(), roleName);
+    }
+
     /**
      * Add capabilities to a role
      *
@@ -72,12 +86,10 @@ public class RoleService
      */
     public void addCapabilitiesToRole(UserRoles role, Set capabilities)
     {
-        Set roleCapabilities = new HashSet<>();
-        roleCapabilities.addAll(rmRolesAndActionsAPI.getCapabilitiesForRole(dataUser.getAdminUser().getUsername(),
-                dataUser.getAdminUser().getPassword(), role.roleId));
-        capabilities.stream().forEach(cap -> roleCapabilities.add(cap));
+        Set roleCapabilities = new HashSet<>(getRoleCapabilities(role.roleId));
+        roleCapabilities.addAll(capabilities);
 
-        rmRolesAndActionsAPI.updateRole(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
+        getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
                 role.roleId, role.displayName, roleCapabilities);
     }
 
@@ -89,10 +101,9 @@ public class RoleService
      */
     public void removeCapabilitiesFromRole(UserRoles role, Set capabilities)
     {
-        Set roleCapabilities = rmRolesAndActionsAPI.getCapabilitiesForRole(dataUser.getAdminUser().getUsername(),
-                dataUser.getAdminUser().getPassword(), role.roleId);
+        Set roleCapabilities = getRoleCapabilities(role.roleId);
         roleCapabilities.removeAll(capabilities);
-        rmRolesAndActionsAPI.updateRole(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
+        getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
                 role.roleId, role.displayName, roleCapabilities);
     }
 
@@ -108,7 +119,7 @@ public class RoleService
                                                          String userRole)
     {
         getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
-        rmRolesAndActionsAPI.assignRoleToUser(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(),
+        getRmRolesAndActionsAPI().assignRoleToUser(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
                 user.getUsername(), userRole);
     }
 
@@ -120,7 +131,7 @@ public class RoleService
      */
     public UserModel createUserWithRMRole(String userRole)
     {
-        UserModel rmUser = dataUser.createRandomTestUser();
+        final UserModel rmUser = getDataUser().createRandomTestUser();
         getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole);
         getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
         return rmUser;
@@ -137,7 +148,7 @@ public class RoleService
     public UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory,
                                                                   UserPermissions userPermission)
     {
-        UserModel rmUser = createUserWithRMRole(userRole);
+        final UserModel rmUser = createUserWithRMRole(userRole);
         getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), rmUser, userPermission);
         getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
         return rmUser;
@@ -152,15 +163,13 @@ public class RoleService
      * @param userRole       the rm role
      * @param userPermission the permissions over the recordCategory
      * @return the created user model
-     * @throws Exception
      */
     public UserModel createCollaboratorWithRMRoleAndPermission(SiteModel siteModel, RecordCategory recordCategory,
                                                                 UserRoles userRole, UserPermissions userPermission)
     {
-        UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory,
+        final UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory,
                 userPermission);
-        dataUser.addUserToSite(rmUser, siteModel, UserRole.SiteCollaborator);
+        getDataUser().addUserToSite(rmUser, siteModel, UserRole.SiteCollaborator);
         return rmUser;
     }
-
 }

From a11feb9bfed12c46a17a4d7129bfe62b8600dd2b Mon Sep 17 00:00:00 2001
From: cagache 
Date: Thu, 9 May 2019 11:32:32 +0300
Subject: [PATCH 12/25] removed contentService from child classes and made it
 protected in parent class

---
 .../src/main/java/org/alfresco/rest/core/v0/BaseAPI.java     | 2 +-
 .../main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java | 4 ----
 .../src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java | 5 -----
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java
index 20acd4cf57..7438ee5ed6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java
@@ -89,7 +89,7 @@ public abstract class BaseAPI
     private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
 
     @Autowired
-    private ContentService contentService;
+    protected ContentService contentService;
 
     public static final String NODE_REF_WORKSPACE_SPACES_STORE = "workspace://SpacesStore/";
     private static final String FILE_PLAN_PATH = "/Sites/rm/documentLibrary";
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java
index 96025d88b3..2cc343a50a 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java
@@ -44,7 +44,6 @@ import java.util.Set;
 
 import org.alfresco.dataprep.AlfrescoHttpClient;
 import org.alfresco.dataprep.AlfrescoHttpClientFactory;
-import org.alfresco.dataprep.ContentService;
 import org.alfresco.dataprep.UserService;
 import org.alfresco.rest.core.v0.BaseAPI;
 import org.alfresco.rest.core.v0.RMEvents;
@@ -92,9 +91,6 @@ public class RMRolesAndActionsAPI extends BaseAPI
     @Autowired
     private UserService userService;
 
-    @Autowired
-    private ContentService contentService;
-
     /**
      * Get all the configured RM roles.
      *
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java
index 82a50deb94..cae9768e39 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java
@@ -28,14 +28,12 @@ package org.alfresco.rest.v0;
 
 import static org.apache.http.HttpStatus.SC_OK;
 
-import org.alfresco.dataprep.ContentService;
 import org.alfresco.rest.core.v0.BaseAPI;
 import org.apache.http.HttpResponse;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
@@ -49,9 +47,6 @@ public class RecordFoldersAPI extends BaseAPI
 {
     private static final Logger LOGGER = LoggerFactory.getLogger(RecordFoldersAPI.class);
 
-    @Autowired
-    private ContentService contentService;
-
     /**
      * Close the record folder
      *

From ba729a0f2ee4be52cc76ffbe511a134d671fe4a4 Mon Sep 17 00:00:00 2001
From: cagache 
Date: Thu, 9 May 2019 11:34:42 +0300
Subject: [PATCH 13/25] removed unused variable

---
 .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java  | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
index 64f244019c..4ecf318e2a 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
@@ -80,7 +80,6 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
 import org.alfresco.rest.search.RestRequestQueryModel;
 import org.alfresco.rest.search.SearchNodeModel;
 import org.alfresco.rest.search.SearchRequest;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
 import org.alfresco.rest.v0.SearchAPI;
 import org.alfresco.utility.Utility;
 import org.alfresco.utility.data.DataUser;
@@ -115,10 +114,6 @@ public class BaseRMRestTest extends RestTest
     @Getter(value = PROTECTED)
     private ContentService contentService;
 
-    @Autowired
-    @Getter(value = PROTECTED)
-    private RMRolesAndActionsAPI rmRolesAndActionsAPI;
-
     @Autowired
     @Getter(value = PROTECTED)
     private SearchAPI searchApi;

From a15998b23f5c42169e5519ebc95d4b81cc512d37 Mon Sep 17 00:00:00 2001
From: cagache 
Date: Fri, 10 May 2019 10:59:56 +0300
Subject: [PATCH 14/25] added missing curly braces

---
 ...cordsManagementAuditServiceDeprecated.java |  10 +-
 .../caveat/RMCaveatConfigComponentImpl.java   |   2 -
 .../caveat/RMCaveatConfigService.java         |   8 +-
 .../caveat/RMCaveatConfigServiceImpl.java     |   3 +-
 .../caveat/RMListOfValuesConstraint.java      |   2 +-
 .../caveat/ScriptConstraint.java              |   9 +-
 .../DeprecatedExtendedSecurityService.java    |   4 +-
 .../FilePlanAuthenticationService.java        |   5 +-
 .../FilePlanAuthenticationServiceImpl.java    |   4 +-
 .../RecordsManagementSecurityService.java     |   6 +-
 .../action/RMActionExecuterAbstractBase.java  |   2 +-
 .../RecordsManagementActionCondition.java     |   2 +-
 ...tActionConditionEvaluatorAbstractBase.java |  14 +-
 .../RecordsManagementActionServiceImpl.java   |   4 +-
 .../admin/RecordsManagementAdminService.java  |  28 ++--
 .../RecordsManagementAdminServiceImpl.java    |   5 +-
 ...RecordsManagementAuditQueryParameters.java |   1 +
 .../RecordsManagementAuditServiceImpl.java    |   5 +-
 .../AuthenticatedUserRolesDataExtractor.java  |  27 ++++
 .../FilePlanIdentifierDataExtractor.java      |  26 ++++
 .../FilePlanNamePathDataExtractor.java        |  27 ++++
 .../FilePlanNodeRefPathDataExtractor.java     |  27 ++++
 .../capability/CapabilityService.java         |  10 +-
 .../capability/CompositeCapability.java       |   2 +-
 .../capability/RMActionProxyFactoryBean.java  |   2 +-
 .../capability/RMAfterInvocationProvider.java |   1 +
 .../capability/RMEntryVoter.java              | 125 ++++++++++--------
 .../capability/RMPermissionModel.java         |  10 +-
 .../declarative/DeclarativeCapability.java    |   4 +-
 .../DeclarativeCompositeCapability.java       |   2 +-
 ...HasDispositionDateCapabilityCondition.java |  12 --
 .../HasEventsCapabilityCondition.java         |  12 --
 .../IsClassifiedCapabilityCondition.java      |  12 --
 .../IsScheduledCapabilityCondition.java       |  12 --
 .../LastDispositionActionCondition.java       |   7 -
 .../MayBeScheduledCapabilityCondition.java    |  12 --
 .../content/EagerContentStoreCleaner.java     |   2 +-
 .../dataset/DataSetService.java               |   6 +-
 .../dataset/DataSetServiceImpl.java           |   4 +-
 .../DispositionActionDefinitionImpl.java      |   4 +-
 .../disposition/DispositionActionImpl.java    |   4 +-
 .../disposition/DispositionSchedule.java      |   2 +-
 .../disposition/DispositionScheduleImpl.java  |   2 +-
 .../disposition/DispositionService.java       |   2 +-
 .../email/CustomEmailMappingService.java      |   2 +-
 .../email/CustomEmailMappingServiceImpl.java  |   2 +-
 .../CustomisableEmailMappingKeyBootstrap.java |   2 +-
 .../event/RecordsManagementEventService.java  |   2 +-
 .../RecordsManagementEventServiceImpl.java    |   5 +-
 .../fileplan/FilePlanService.java             |  14 +-
 .../RecordsManagementTypeFormFilter.java      |   2 +-
 .../freeze/FreezeService.java                 |   8 +-
 .../freeze/FreezeServiceImpl.java             |   3 +-
 .../identifier/IdentifierGeneratorBase.java   |   2 +-
 .../job/DispositionLifecycleJobExecuter.java  |   2 +-
 .../model/CustomisableTypesBootstrap.java     |   2 +-
 .../rma/aspect/FilePlanComponentAspect.java   |  11 +-
 .../model/rma/aspect/QShareAspect.java        |   8 --
 .../type/RecordsManagementContainerType.java  |  10 +-
 .../model/rma/type/RmSiteType.java            |   6 +-
 .../model/security/ModelSecurityService.java  |   6 +-
 ...ordsManagementPermissionPostProcessor.java |   2 +-
 .../record/RecordService.java                 |   8 +-
 .../record/RecordServiceImpl.java             |   4 +-
 .../relationship/RelationshipServiceImpl.java |   2 +-
 .../org_alfresco_module_rm/report/Report.java |   2 +-
 .../report/ReportService.java                 |   2 +-
 .../report/ReportServiceImpl.java             |   2 +-
 .../report/generator/BaseReportGenerator.java |   2 +-
 .../generator/DeclarativeReportGenerator.java |   2 +-
 .../transfer/TransferReportGenerator.java     |   2 +-
 .../role/FilePlanRoleService.java             |   6 +-
 .../role/FilePlanRoleServiceImpl.java         |  15 +--
 .../script/AbstractRmWebScript.java           |   5 +-
 .../script/AuditLogStatusGet.java             |   2 +-
 .../script/BaseAuditAdminWebScript.java       |   2 +-
 .../script/BaseAuditRetrievalWebScript.java   |   2 +-
 .../script/BaseTransferWebScript.java         |   7 +-
 .../script/EmailMapDelete.java                |   4 +-
 .../script/EmailMapGet.java                   |   4 +-
 .../script/EmailMapPost.java                  |   4 +-
 .../script/ExportPost.java                    |   4 +-
 .../script/admin/RmEventDelete.java           |   4 +-
 .../script/slingshot/RMSavedSearchesPost.java |   4 +-
 .../slingshot/RMSearchPropertiesGet.java      |   4 +-
 .../slingshot/RecordedVersionConfigGet.java   |   4 +-
 .../slingshot/RecordedVersionConfigPost.java  |   6 +-
 .../RecordsManagementSearchService.java       |   4 +-
 .../RecordsManagementSearchServiceImpl.java   |   2 +-
 .../search/ReportDetails.java                 |   2 +-
 .../search/SavedSearchDetails.java            |   2 +-
 .../security/ExtendedSecurityService.java     |   4 +-
 .../security/ExtendedSecurityServiceImpl.java |   2 +-
 .../security/FilePlanPermissionService.java   |   2 +-
 .../FilePlanPermissionServiceImpl.java        |   5 +-
 .../util/AuthenticationUtil.java              |   2 +-
 .../RecordableVersionNodeServiceImpl.java     |   4 +-
 .../version/RecordableVersionService.java     |   4 +-
 .../version/RecordableVersionServiceImpl.java |   6 +-
 .../NodeParameterSuggesterBootstrap.java      |   2 +-
 .../ParameterProcessorComponent.java          |   2 +-
 .../impl/ExtendedPermissionService.java       |   4 +-
 .../processor/PermissionPreProcessor.java     |   3 +-
 .../PermissionProcessorRegistry.java          |   4 +-
 .../impl/PermissionProcessorBaseImpl.java     |   2 +-
 .../scripts/dictionary/RmPropertiesGet.java   |   2 +-
 .../RmSubstitutionSuggestionsGet.java         |  10 +-
 .../rest/api/impl/ApiNodesModelFactory.java   |  21 +--
 .../api/impl/FilePlanComponentsApiUtils.java  |  14 +-
 .../rest/api/model/RecordCategoryChild.java   |   1 +
 .../rm/rest/api/model/TargetContainer.java    |   1 +
 .../alfresco/rm/rest/api/model/Transfer.java  |   1 +
 .../rm/rest/api/model/TransferChild.java      |   1 +
 .../rm/rest/api/model/TransferContainer.java  |   1 +
 .../java/org/alfresco/util/SortDirection.java |   2 +-
 115 files changed, 407 insertions(+), 365 deletions(-)

diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java
index dfbc255329..bf77147568 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java
@@ -46,31 +46,31 @@ import org.alfresco.service.cmr.repository.NodeRef;
 public interface RecordsManagementAuditServiceDeprecated
 {
     /**
-     * @deprecated as of 2.1, see {@link #stop(NodeRef)}
+     * @deprecated as of 2.1, see {@link RecordsManagementAuditService#stopAuditLog(NodeRef)}
      */
     @Deprecated
     void stop();
 
     /**
-     * @deprecated as of 2.1, see {@link #clear(NodeRef)}
+     * @deprecated as of 2.1, see {@link RecordsManagementAuditService#clearAuditLog(NodeRef)}
      */
     @Deprecated
     void clear();
 
     /**
-     * @deprecated as of 2.1, see {@link #isEnabled(NodeRef)}
+     * @deprecated as of 2.1, see {@link RecordsManagementAuditService#isAuditLogEnabled(NodeRef)}
      */
     @Deprecated
     boolean isEnabled();
 
     /**
-     * @deprecated as of 2.1, see {@link #getDateLastStarted(NodeRef)}
+     * @deprecated as of 2.1, see {@link RecordsManagementAuditService#getDateAuditLogLastStarted(NodeRef)}
      */
     @Deprecated
     Date getDateLastStarted();
 
     /**
-     * @deprecated as of 2.1, see {@link #getDateLastStopped(NodeRef)}
+     * @deprecated as of 2.1, see {@link RecordsManagementAuditService#getDateLastStopped()}
      */
     Date getDateLastStopped();
 
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java
index ea6a566863..536a619db8 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java
@@ -281,7 +281,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
      * Validate the caveat config and optionally update the cache.
      *
      * @param nodeRef The nodeRef of the config
-     * @param updateCache Set to true to update the cache
     */
     @SuppressWarnings("unchecked")
     protected void validateAndReset(NodeRef nodeRef)
@@ -988,7 +987,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
      *
      * @param listName the name of the RMConstraintList
      * @param authorityName
-     * @param values
      */
     public void removeRMConstraintListAuthority(String listName, String authorityName)
     {
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java
index aa04bd6b5c..aa9533fda7 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java
@@ -95,7 +95,7 @@ public interface RMCaveatConfigService
     /**
      * update RM constraint Title
      * @param listName the name of the RMConstraintList - can not be changed
-     * @param allowedValues
+     * @param newTitle the new value for the title constraint
      */
     RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle);
 
@@ -112,7 +112,7 @@ public interface RMCaveatConfigService
      *
      * @param listName the name of the RMConstraintList
      * @param authorityName
-     * @param values
+     * @param value
      * @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
      */
     void addRMConstraintListValue(String listName, String authorityName, String value);
@@ -134,7 +134,6 @@ public interface RMCaveatConfigService
      *
      * @param listName the name of the RMConstraintList
      * @param authorityName
-     * @param values
      */
     void removeRMConstraintListAuthority(String listName, String authorityName);
 
@@ -154,8 +153,7 @@ public interface RMCaveatConfigService
      * Remove an authority from a list
      *
      * @param listName the name of the RMConstraintList
-     * @param authorityName
-     * @param value
+     * @param valueName
      */
     void removeRMConstraintListValue(String listName, String valueName);
 }
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java
index b2b8ced94b..a42e3cf013 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java
@@ -201,7 +201,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
      *
      * @param listName the name of the RMConstraintList
      * @param authorityName
-     * @param values
+     * @param value
      * @throws AlfrescoRuntimeException if either the list or the authority do not already exist.
      */
     public void addRMConstraintListValue(String listName, String authorityName, String value)
@@ -251,7 +251,6 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
      *
      * @param listName the name of the RMConstraintList
      * @param authorityName
-     * @param values
      */
     public void removeRMConstraintListAuthority(String listName, String authorityName)
     {
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
index f86bd43418..e0de5e8dff 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
@@ -172,7 +172,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
     /**
      * Set the values that are allowed by the constraint.
      *
-     * @param values a list of allowed values
+     * @param allowedValues a list of allowed values
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     @Override
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java
index fa9a09b475..b44e49fa47 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java
@@ -134,8 +134,7 @@ public class ScriptConstraint implements Serializable
 
     /**
      * Update a value
-     * @param values
-     * @param authorities
+     * @param bodge
      */
     public void updateValues(JSONArray bodge) throws Exception
     {
@@ -156,7 +155,7 @@ public class ScriptConstraint implements Serializable
 
     /**
      * Update a value
-     * @param values
+     * @param value
      * @param authorities
      */
     public void updateValues(String value, String[] authorities)
@@ -171,7 +170,7 @@ public class ScriptConstraint implements Serializable
      */
     public void deleteAuthority(String authority)
     {
-
+        //Do nothing
     }
 
     /**
@@ -180,7 +179,7 @@ public class ScriptConstraint implements Serializable
      */
     public void deleteValue(String value)
     {
-
+        //Do nothing
     }
 
 
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java
index b7405dd079..ca4cae065f 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java
@@ -42,7 +42,7 @@ public interface DeprecatedExtendedSecurityService
      * Gets the set of authorities that are extended readers for the given node.
      *
      * @param nodeRef   node reference
-     * @return {@link Set}<{@link String}>  set of extended readers
+     * @return {@link Set}<{@link String}> set of extended readers
      * 
      * @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)}
      */
@@ -52,7 +52,7 @@ public interface DeprecatedExtendedSecurityService
      * Get the set of authorities that are extended writers for the given node.
      *
      * @param nodeRef   node reference
-     * @return {@link Set}<{@link String}>  set of extended writers
+     * @return {@link Set}<{@link String}>  set of extended writers
      * 
      * @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)}
      */
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java
index 54ceba5c71..a7432cbfbe 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java
@@ -53,7 +53,10 @@ public interface FilePlanAuthenticationService
      * @param runAsWork work to execute as the rm admin user
      * @return R        result of work execution
      *
-     * @deprecated as of 2.2, use {@link AuthenticationUtil#runAs(RunAsWork, AuthenticationUtil#getAdminUserName())}
+     * @deprecated as of 2.2, use
+     *
+     *
+     * {@link AuthenticationUtil#runAs(RunAsWork, String)}
      */
      R runAsRmAdmin(RunAsWork runAsWork);
 }
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java
index 298f1132f1..62e56fdd60 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java
@@ -42,7 +42,7 @@ public class FilePlanAuthenticationServiceImpl implements FilePlanAuthentication
     public static final String DEFAULT_RM_ADMIN_USER = "rmadmin";
 
     /**
-     * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#getRMAdminUserName()
+     * @see FilePlanAuthenticationService#getRmAdminUserName() ()
      */
     @Override
     @Deprecated
@@ -52,7 +52,7 @@ public class FilePlanAuthenticationServiceImpl implements FilePlanAuthentication
     }
 
     /**
-     * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#runAsRMAdmin(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork)
+     * @see FilePlanAuthenticationService#runAsRmAdmin(RunAsWork)
      */
     @Override
     @Deprecated
diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java
index 65ff0fb011..ac76a889bc 100644
--- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java
+++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java
@@ -70,7 +70,7 @@ public interface RecordsManagementSecurityService
      * Get all the available roles for the given records management root node
      * 
      * @param rmRootNode    root node
-     * @return {@link Set}<{@link Role}>    all roles for a given root node
+     * @return {@link Set}<{@link Role}>    all roles for a given root node
      * 
      * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)}
      */
@@ -201,14 +201,14 @@ public interface RecordsManagementSecurityService
     void deletePermission(NodeRef nodeRef, String authority, String permission);
     
     /**
-     * @return  {@link Set}<{@link QName}>  protected aspect names
+     * @return  {@link Set}<{@link QName}>  protected aspect names
      * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects}
      */
     @Deprecated
     Set getProtectedAspects();
    
     /**
-     * @return {@link Set}<{@link QName}>   protected properties
+     * @return {@link Set}<{@link QName}>   protected properties
      * @deprecated  As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties}
      */
     Set getProtectedProperties();
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
index e6d3ae0657..135501c1d0 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
@@ -683,7 +683,7 @@ public abstract class RMActionExecuterAbstractBase  extends PropertySubActionExe
      *
      * @return padded string or the original if already at >= len characters
      *
-     * @deprecated As of 2.1, replaced by {@link org.apache.commons.lang.StringUtils.leftPad}
+     * @deprecated As of 2.1, replaced by {@link org.apache.commons.lang.StringUtils#leftPad(String, int)}
      */
     @Deprecated
     protected String padString(String s, int len)
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java
index e671096fc9..81755f456e 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java
@@ -43,7 +43,7 @@ public interface RecordsManagementActionCondition
      *
      * @return  String  action condition name
      */
-    String getName();
+    String getBeanName();
 
     /**
      * Get the label of the action condition
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
index ab3c4ada31..30e4f4c0b3 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
@@ -56,7 +56,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
     private FilePlanService filePlanService;
 
     /** bean name */
-    private String name;
+    private String beanName;
 
     /** public condition */
     private boolean publicCondition = true;
@@ -145,16 +145,16 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
     @Override
     public void setBeanName(String name)
     {
-        this.name = name;
+        this.beanName = name;
         super.setBeanName(name);
     }
 
     /**
-     * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getName()
+     * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getBeanName()
      */
-    public String getName()
+    public String getBeanName()
     {
-        return this.name;
+        return this.beanName;
     }
 
     /**
@@ -184,11 +184,11 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
     {
         if (this.actionConditionDefinition == null)
         {
-            this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(name);
+            this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(beanName);
             ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setTitleKey(getTitleKey());
             ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey());
             ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed());
-            ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(name);
+            ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(beanName);
             ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setLocalizedParameterDefinitions(getLocalizedParameterDefinitions());
         }
         return this.actionConditionDefinition;
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
index b86ea5e3b9..016bafafec 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
@@ -142,9 +142,9 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
 
     public void register(RecordsManagementActionCondition rmCondition)
     {
-        if (!rmConditions.containsKey(rmCondition.getName()))
+        if (!rmConditions.containsKey(rmCondition.getBeanName()))
         {
-            rmConditions.put(rmCondition.getName(), rmCondition);
+            rmConditions.put(rmCondition.getBeanName(), rmCondition);
         }
     }
 
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java
index 6a1ae91c01..aacb554459 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java
@@ -42,7 +42,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
 import org.alfresco.service.cmr.repository.NodeRef;
 import org.alfresco.service.cmr.repository.NodeService;
 import org.alfresco.service.namespace.QName;
-import org.alfresco.service.namespace.RegexQNamePattern;
+import org.alfresco.service.namespace.QNamePattern;
 
 /**
  * Records management custom model service interface. Implementations of this class are responsible
@@ -58,7 +58,7 @@ public interface RecordsManagementAdminService
     /**
      * Get a list of all registered customisable types and aspects.
      *
-     * @return Set of <{@link QName}>s of customisable types and aspects
+     * @return Set of <{@link QName}>s of customisable types and aspects
      */
     Set getCustomisable();
 
@@ -67,7 +67,7 @@ public interface RecordsManagementAdminService
      * node reference.
      *
      * @param nodeRef  node reference
-     * @return Set of <{@link QName}>s of customisable types and aspects, empty if none
+     * @return Set of <{@link QName}>s of customisable types and aspects, empty if none
      */
     Set getCustomisable(NodeRef nodeRef);
 
@@ -110,22 +110,23 @@ public interface RecordsManagementAdminService
      * Therefore custom properties created in the current transaction will not appear
      * in the result of this method.
      *
+     * 

* @param customisableType - * @return - * @see CustomisableRmElement + * @return Map of <{@link QName}, {@link PropertyDefinition}>s of custom properties definitions */ Map getCustomPropertyDefinitions(QName customisableType); /** * This method returns the custom properties that have been defined for all of * the specified customisable RM elements. + *

* Note: the custom property definitions are retrieved from the dictionaryService * which is notified of any newly created definitions on transaction commit. * Therefore custom properties created in the current transaction will not appear * in the result of this method. + *

* - * @return - * @see CustomisableRmElement + * @return Map of <{@link QName}, {@link PropertyDefinition}>s of custom properties definitions */ Map getCustomPropertyDefinitions(); @@ -138,7 +139,7 @@ public interface RecordsManagementAdminService * within URLs and in QNames. Therefore it must contain URL/QName-valid characters * only. It must also be unique. * If a null value is passed, an id will be generated. - * @param aspectName - mandatory. The aspect within which the property is to be defined. + * @param typeName - mandatory. The aspect within which the property is to be defined. * This must be one of the CustomisableRmElements. * @param label - mandatory * @param dataType - mandatory @@ -146,7 +147,6 @@ public interface RecordsManagementAdminService * @param description - optional * * @return the propId, whether supplied as a parameter or generated. - * @see CustomisableRmElement#getCorrespondingAspect() */ QName addCustomPropertyDefinition(QName propId, QName typeName, String label, QName dataType, String title, String description) throws CustomMetadataException; @@ -157,7 +157,7 @@ public interface RecordsManagementAdminService * within URLs and in QNames. Therefore it must contain URL/QName-valid characters * only. It must also be unique. * If a null value is passed, an id will be generated. - * @param aspectName - mandatory. The aspect within which the property is to be defined. + * @param typeName - mandatory. The aspect within which the property is to be defined. * This must be one of the CustomisableRmElements. * @param label - mandatory * @param dataType - mandatory @@ -170,7 +170,6 @@ public interface RecordsManagementAdminService * @param lovConstraintQName - optional custom constraint * * @return the propId, whether supplied as a parameter or generated. - * @see CustomisableRmElement#getCorrespondingAspect() */ // TODO propId string (not QName) ? @@ -248,7 +247,9 @@ public interface RecordsManagementAdminService * * @param node the node from which the associations start. * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getTargetAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. + * @deprecated as of RM 2.3, please + * use{@link NodeService#getTargetAssocs(NodeRef, QNamePattern)} with QNamePattern RegexQNamePattern.MATCH_ALL + * instead */ List getCustomReferencesFrom(NodeRef node); @@ -267,7 +268,8 @@ public interface RecordsManagementAdminService * * @param node the node to which the associations point. * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getSourceAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. + * @deprecated as of RM 2.3, please use + * {@link NodeService#getSourceAssocs(NodeRef, QNamePattern)} with QNamePattern RegexQNamePattern.MATCH_ALL instead. */ List getCustomReferencesTo(NodeRef node); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java index bf18587423..a696f7d85b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java @@ -32,7 +32,6 @@ import static org.springframework.extensions.surf.util.ParameterCheck.mandatoryS import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -61,7 +60,6 @@ import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.authority.RMAuthority; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AssociationDefinition; @@ -73,7 +71,6 @@ import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityType; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.transaction.TransactionService; @@ -652,7 +649,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(org.alfresco.module.org_alfresco_module_rm.CustomisableRmElement) + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(QName) */ public Map getCustomPropertyDefinitions(QName customisableType) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java index 20712b9af7..b9a671967d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java @@ -55,6 +55,7 @@ public final class RecordsManagementAuditQueryParameters */ public RecordsManagementAuditQueryParameters() { + //Default constructor } /** 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 8af59833ee..8e816549d8 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 @@ -1696,8 +1696,6 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean * Returns the display label for a property QName * * @param property The property to get label for - * @param ddService DictionaryService instance - * @param namespaceService NamespaceService instance * @return The label */ private String getPropertyLabel(QName property) @@ -1830,7 +1828,8 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean } /** - * {@inheritDoc} + * use {@link #startAuditLog(NodeRef)} instead + * */ @Deprecated public void start() diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java index f2f29675dd..fcbe2deeac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java @@ -28,6 +28,7 @@ package org.alfresco.module.org_alfresco_module_rm.audit.extractor; import java.io.Serializable; +import java.util.Objects; import java.util.Set; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; @@ -124,4 +125,30 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra // Done return sb.toString(); } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + AuthenticatedUserRolesDataExtractor that = (AuthenticatedUserRolesDataExtractor) o; + return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) + && Objects.equals(filePlanRoleService, that.filePlanRoleService); + } + + @Override + public int hashCode() + { + return Objects.hash(nodeService, filePlanService, filePlanRoleService); + } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java index 2847504a6e..2ef6fbce78 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java @@ -28,6 +28,7 @@ package org.alfresco.module.org_alfresco_module_rm.audit.extractor; import java.io.Serializable; +import java.util.Objects; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.audit.extractor.AbstractDataExtractor; @@ -76,4 +77,29 @@ public final class FilePlanIdentifierDataExtractor extends AbstractDataExtractor // Done return identifier; } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + FilePlanIdentifierDataExtractor that = (FilePlanIdentifierDataExtractor) o; + return Objects.equals(nodeService, that.nodeService); + } + + @Override + public int hashCode() + { + return Objects.hash(nodeService); + } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java index a0adcd0a68..67e6bd68fc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java @@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.audit.extractor; import java.io.Serializable; import java.util.List; +import java.util.Objects; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; @@ -126,4 +127,30 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor return extractedData; } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + FilePlanNamePathDataExtractor that = (FilePlanNamePathDataExtractor) o; + return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) + && Objects.equals(ruleService, that.ruleService); + } + + @Override + public int hashCode() + { + return Objects.hash(nodeService, filePlanService, ruleService); + } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java index 6e536d1811..0f9d85c0d9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java @@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.audit.extractor; import java.io.Serializable; import java.util.List; +import java.util.Objects; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -112,4 +113,30 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto return extractedData; } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + FilePlanNodeRefPathDataExtractor that = (FilePlanNodeRefPathDataExtractor) o; + return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) + && Objects.equals(ruleService, that.ruleService); + } + + @Override + public int hashCode() + { + return Objects.hash(nodeService, filePlanService, ruleService); + } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java index aa25dac7f3..b8dd1b16fb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java @@ -62,7 +62,7 @@ public interface CapabilityService /** * Get a list of all the assignable capabilities. * - * @return {@link Set}<{@link Capability}> set of all the assignable capabilities + * @return {@link Set}<{@link Capability}> set of all the assignable capabilities */ Set getCapabilities(); @@ -70,7 +70,7 @@ public interface CapabilityService * Get a list of all the capabilities, optionally including those that are non-assignable. * * @param includePrivate indicates that the private, or non-assignable capabilities are included in the result - * @return {@link Set}<{@link Capability}> set of capabilities + * @return {@link Set}<{@link Capability}> set of capabilities */ Set getCapabilities(boolean includePrivate); @@ -110,7 +110,7 @@ public interface CapabilityService /** * Gets the list of all the capability groups (in index order) * - * @return {@link List}<{@link Group}> List of all the capability groups (in index order) + * @return {@link List}<{@link Group}> List of all the capability groups (in index order) */ List getGroups(); @@ -118,7 +118,7 @@ public interface CapabilityService * Gets a list of capabilities for the given group id * * @param groupId The id of a group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group + * @return {@link List}<{@link Capability}> List of capabilities for the given group */ List getCapabilitiesByGroupId(String groupId); @@ -126,7 +126,7 @@ public interface CapabilityService * Get a list of capabilities for the given group * * @param group The group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group + * @return {@link List}<{@link Capability}> List of capabilities for the given group */ List getCapabilitiesByGroup(Group group); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java index f74944660f..dbc9991368 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java @@ -40,7 +40,7 @@ public interface CompositeCapability extends Capability /** * Get set of child capabilities. * - * @return {@link Set}<{@link Capability}> set of child capabilities. + * @return {@link Set}<{@link Capability} > set of child capabilities. */ Set getCapabilities(); } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java index adbd7b929d..6c2dbeb946 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java @@ -60,7 +60,7 @@ public class RMActionProxyFactoryBean extends ProxyFactoryBean /** * Set action service * - * @param actionService + * @param runtimeActionService */ public void setRuntimeActionService(RuntimeActionService runtimeActionService) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java index 264915f9c6..8a959bd593 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java @@ -98,6 +98,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon public void afterPropertiesSet() { + //Do nothing } /** diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java index bfe7ae2f58..6618796a71 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java @@ -258,67 +258,75 @@ public class RMEntryVoter extends RMSecurityCommon } else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP)) { - switch(checkCapability(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if(logger.isDebugEnabled()) - { - if(logger.isTraceEnabled()) - { - logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - } + switch (checkCapability(invocation, params, cad)) + { + case AccessDecisionVoter.ACCESS_DENIED: + { + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_ABSTAIN: + { + if (logger.isDebugEnabled()) + { + if (logger.isTraceEnabled()) + { + logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException()); + } + else + { + logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod()); + } + } + // abstain denies + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_GRANTED: + { + break; + } + default: + { + //do nothing + } + } } else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM)) - { - switch(checkPolicy(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - // log message - RMMethodSecurityInterceptor.addMessage("Policy " + cad.getPolicyName() + " denied."); + { + switch (checkPolicy(invocation, params, cad)) + { + case AccessDecisionVoter.ACCESS_DENIED: + { + // log message + RMMethodSecurityInterceptor.addMessage("Policy " + cad.getPolicyName() + " denied."); - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if(logger.isDebugEnabled()) - { - if(logger.isTraceEnabled()) - { - logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - } - } + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_ABSTAIN: + { + if (logger.isDebugEnabled()) + { + if (logger.isTraceEnabled()) + { + logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException()); + } + else + { + logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod()); + } + } + // abstain denies + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_GRANTED: + { + break; + } + default: + { + //do nothing + } + } + } } } finally @@ -385,6 +393,7 @@ public class RMEntryVoter extends RMSecurityCommon */ public void afterPropertiesSet() { + //Do nothing } /** diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java index f4b3aac725..fd51d82fbf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java @@ -45,27 +45,27 @@ public interface RMPermissionModel // Roles /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_USER} instead + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_USER} instead */ @Deprecated String ROLE_NAME_USER = FilePlanRoleService.ROLE_USER; /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_POWER_USER} instead + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_POWER_USER} instead */ @Deprecated String ROLE_NAME_POWER_USER = FilePlanRoleService.ROLE_POWER_USER; /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_SECURITY_OFFICER} instead + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_SECURITY_OFFICER} instead */ @Deprecated String ROLE_NAME_SECURITY_OFFICER = FilePlanRoleService.ROLE_SECURITY_OFFICER; /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_RECORDS_MANAGER} instead + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_RECORDS_MANAGER} instead */ @Deprecated String ROLE_NAME_RECORDS_MANAGER = FilePlanRoleService.ROLE_RECORDS_MANAGER; /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_ADMIN} instead + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_ADMIN} instead */ @Deprecated String ROLE_NAME_ADMINISTRATOR = FilePlanRoleService.ROLE_ADMIN; diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java index cb792debf6..86c8d5c83b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java @@ -92,7 +92,7 @@ public class DeclarativeCapability extends AbstractCapability } /** - * @return {@link Map} conditions and expected values + * @return {@link Map} <String, Boolean > conditions and expected values */ public Map getConditions() { @@ -108,7 +108,7 @@ public class DeclarativeCapability extends AbstractCapability } /** - * @return {@link List}<@link String> list of expected file plan component kinds + * @return {@link List} <@link String > list of expected file plan component kinds */ public List getKinds() { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java index 06429342cd..9859f5f685 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java @@ -47,7 +47,7 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability private Set capabilities; /** - * @param capabilites set of capabilities + * @param capabilities set of capabilities */ public void setCapabilities(Set capabilities) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java index 9fcf4f04be..a2cf48c900 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java @@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -39,17 +38,6 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCondition { - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java index 5702c03beb..e75db13930 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java @@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -39,17 +38,6 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class HasEventsCapabilityCondition extends AbstractCapabilityCondition { - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java index 40bca0db1d..e4bfd3cbd6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java @@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -40,17 +39,6 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class IsClassifiedCapabilityCondition extends AbstractCapabilityCondition { - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java index 1499f80f61..f94913536d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java @@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -42,9 +41,6 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition /** Disposition action */ private String dispositionAction; - /** Disposition service */ - private DispositionService dispositionService; - /** * @param dispositionAction disposition action */ @@ -53,14 +49,6 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition this.dispositionAction = dispositionAction; } - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java index dfda81bcde..975ca5a4da 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java @@ -29,7 +29,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -39,15 +38,9 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class LastDispositionActionCondition extends AbstractCapabilityCondition { - private DispositionService dispositionService; private String dispositionActionName; - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - public void setDispositionActionName(String dispositionActionName) { this.dispositionActionName = dispositionActionName; diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java index 894b618119..f3ce7cf02d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java @@ -30,7 +30,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condit import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -43,9 +42,6 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi /** Disposition action */ private String dispositionAction; - /** Disposition service */ - private DispositionService dispositionService; - /** * @param dispositionAction disposition action */ @@ -54,14 +50,6 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi this.dispositionAction = dispositionAction; } - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java index cc370c601b..530acc40a4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java @@ -60,7 +60,7 @@ public class EagerContentStoreCleaner extends org.alfresco.repo.content.cleanup. private ContentCleanser contentCleanser; /** - * @param transactionResourceHelper transactional resource helper + * @param transactionalResourceHelper transactional resource helper */ public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java index 9aa965565a..377ce52ff7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java @@ -44,7 +44,7 @@ public interface DataSetService /** * Gets the details of all available data sets. * - * @return Map details of all available data sets + * @return the Map<String, DataSet> with details of all available data sets */ Map getDataSets(); @@ -55,7 +55,7 @@ public interface DataSetService * @param filePlan the file plan for which the details should be retrieved * @param excludeLoaded if true only data sets will be retrieved which has * not been loaded - * @return Map details of the available data sets for a + * @return Map<String, DataSet> with details of the available data sets for a * specified file plan depending on the parameter "excludeLoaded". * The result could also be an empty map */ @@ -66,7 +66,7 @@ public interface DataSetService * * @param filePlan the file plan for which the loaded data sets should be * retrieved - * @return Map details of all loaded data sets or an empty + * @return Map<String, DataSet> details of all loaded data sets or an empty * map if there has not been any data sets loaded for the specified * file plan */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java index d12e072d5e..c51581cbd6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java @@ -257,8 +257,8 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode } /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#loadDataSet(java.lang.String, - * org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#loadDataSet( + *org.alfresco.service.cmr.repository.NodeRef, java.lang.String) */ @Override public void loadDataSet(NodeRef filePlan, String dataSetId) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java index 02000d0d44..4963de8248 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java @@ -78,7 +78,9 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit /** * Constructor * - * @param services service registry + * @param recordsManagementEventService records management event service + * @param recordsManagementActionService records management action service + * @param nodeService node service * @param nodeRef disposition action node reference * @param index index of disposition action */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java index 31f0f88d4d..8329406e2b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java @@ -187,7 +187,7 @@ public class DispositionActionImpl implements DispositionAction, } /** - * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedAt() + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getStartedAt() */ public Date getStartedAt() { @@ -195,7 +195,7 @@ public class DispositionActionImpl implements DispositionAction, } /** - * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedBy() + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getStartedBy() */ public String getStartedBy() { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java index 510be0625e..e9ddf24785 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java @@ -70,7 +70,7 @@ public interface DispositionSchedule /** * Gets all the disposition action definitions for the schedule * - * @return List<{@link DispositionActionDefinition}> disposition action definitions + * @return List<{@link DispositionActionDefinition}> disposition action definitions */ List getDispositionActionDefinitions(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java index eec7f3db4e..adff94ce9b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java @@ -118,7 +118,7 @@ public class DispositionScheduleImpl implements DispositionSchedule, { return value.booleanValue(); } - return null; + return false; } }); } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java index cec70cc8e0..ef7a27b86a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java @@ -108,7 +108,7 @@ public interface DispositionService * the disposition schedule. * * @param dispositionSchedule disposition schedule - * @return {@link List}<{@link NodeRef}> list of disposable items + * @return {@link List} <{@link NodeRef}> list of disposable items */ List getDisposableItems(DispositionSchedule dispositionSchedule); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java index 4dd2fbc14f..68f20376a9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java @@ -38,7 +38,7 @@ public interface CustomEmailMappingService /** * Get the list of custom mappings * - * @return {@link Set}<{@link CustomMapping}> + * @return {@link Set}<{@link CustomMapping}> */ Set getCustomMappings(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java index 3b9be9366a..214229395a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java @@ -277,7 +277,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme } /** - * @see org.alfresco.module.org_alfresco_module_rm.email.EmailMappingKeyService#registerEMailMappingKey(java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#registerEMailMappingKey(java.lang.String) */ @Override public void registerEMailMappingKey(String emailMappingKey) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java index 1272017ff2..1e1d26cafb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java @@ -44,7 +44,7 @@ public class CustomisableEmailMappingKeyBootstrap private CustomEmailMappingService customEmailMappingService; /** - * @param customizable list of mappings to register as customisable + * @param customisable list of mappings to register as customisable */ public void setCustomisable(List customisable) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java index 55f320abd7..7e99b10162 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java @@ -56,7 +56,7 @@ public interface RecordsManagementEventService /** * Get the records management event type * - * @param eventType name + * @param eventTypeName name * @return RecordsManagementEventType event type */ RecordsManagementEventType getEventType(String eventTypeName); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java index e6fc8ace75..c161c04036 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java @@ -134,7 +134,10 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent } /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String) + * Indicates whether a particular event display label exists. Returns true if it does, false otherwise. + * + * @param eventDisplayLabel event display label + * @return boolean true if event exists, false otherwise */ public boolean existsEventDisplayLabel(String eventDisplayLabel) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java index bffa52dddd..cf12e30450 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java @@ -143,7 +143,7 @@ public interface FilePlanService * Creates, and returns, a unfiled container for a given file plan. * * @param filePlan file plan - * @return {@link Node} unfiled container + * @return {@link NodeRef} unfiled container */ NodeRef createUnfiledContainer(NodeRef filePlan); @@ -260,7 +260,7 @@ public interface FilePlanService * @param recordCategory record category node reference * @param deep if true then return all children including sub-categories and their children in turn, if false then just * return the immediate children - * @return {@link List}<{@link NodeRef>} list of contained node references + * @return {@link List}<{@link NodeRef}> list of contained node references */ List getAllContained(NodeRef recordCategory, boolean deep); @@ -268,7 +268,7 @@ public interface FilePlanService * Only return the immediate children. * * @param recordCategory record category node reference - * @return {@link List}<{@link NodeRef>} list of contained node references + * @return {@link List}<{@link NodeRef}> list of contained node references */ List getAllContained(NodeRef recordCategory); @@ -278,7 +278,7 @@ public interface FilePlanService * @param recordCategory record category node reference * @param deep if true then return all children including sub-categories and their children in turn, if false then just * return the immediate children - * @return {@link List}<{@link NodeRef>} list of container node references + * @return {@link List}<{@link NodeRef}> list of container node references */ List getContainedRecordCategories(NodeRef recordCategory, boolean deep); @@ -286,7 +286,7 @@ public interface FilePlanService * Only return immediate children. * * @param recordCategory container node reference - * @return {@link List}<{@link NodeRef>} list of container node references + * @return {@link List}<{@link NodeRef}> list of container node references */ List getContainedRecordCategories(NodeRef recordCategory); @@ -296,7 +296,7 @@ public interface FilePlanService * @param container container node reference * @param deep if true then return all children including sub-containers and their children in turn, if false then just * return the immediate children - * @return {@link List}<{@link NodeRef>} list of record folder node references + * @return {@link List}<{@link NodeRef}> list of record folder node references */ List getContainedRecordFolders(NodeRef container, boolean deep); @@ -304,7 +304,7 @@ public interface FilePlanService * Only return immediate children. * * @param container container node reference - * @return {@link List}<{@link NodeRef>} list of record folder node references + * @return {@link List}<{@link NodeRef}> list of record folder node references */ List getContainedRecordFolders(NodeRef container); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java index 46389d3f4d..0dc515728e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java @@ -143,7 +143,7 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter * Adds a property definition for each of the custom properties for the * given RM type to the given form. * - * @param rmTypeCustomAspect Enum representing the RM type to add custom + * @param customisableType Enum representing the RM type to add custom * properties for * @param form The form to add the properties to */ diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java index 9ae6b85775..fc15aa1ab5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java @@ -28,6 +28,7 @@ package org.alfresco.module.org_alfresco_module_rm.freeze; import java.util.Date; +import java.util.List; import java.util.Set; import org.alfresco.api.AlfrescoPublicApi; @@ -102,13 +103,14 @@ public interface FreezeService void freeze(NodeRef hold, NodeRef nodeRef); /** - * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, List)} instead. + * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and + * {@link HoldService#addToHold(NodeRef, List)} instead. */ @Deprecated NodeRef freeze(String reason, Set nodeRefs); /** - * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, List)} instead. + * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, List)} instead. */ @Deprecated void freeze(NodeRef hold, Set nodeRefs); @@ -148,4 +150,4 @@ public interface FreezeService */ @Deprecated Set getHolds(NodeRef filePlan); -} +} \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java index 08e61bd993..65724d81bb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java @@ -22,6 +22,7 @@ * - * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . + * #L% */ @@ -252,7 +253,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getHold(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHolds(NodeRef) */ @Override public Set getHolds(NodeRef filePlan) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java index b40e77d47e..d99d3bdf0c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java @@ -96,7 +96,7 @@ public abstract class IdentifierGeneratorBase implements IdentifierGenerator * * @param s String to pad with leading zero '0' characters * @param len Length to pad to - * @return padded string or the original if already at >=len characters + * @return padded string or the original if already at >=len characters */ protected String padString(String s, int len) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java index cfe7237333..5416c936a9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java @@ -50,7 +50,7 @@ import org.apache.commons.logging.LogFactory; /** * The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where - * asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records. + * asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records. * * @author mrogers * @author Roy Wetherall diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java index 17fdc83935..1cd6fe39f9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java @@ -68,7 +68,7 @@ public class CustomisableTypesBootstrap } /** - * @param customizable list of types and aspects to register as customisable + * @param customisable list of types and aspects to register as customisable */ public void setCustomisable(List customisable) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java index 7accbb46f9..ffe88fd04a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java @@ -83,9 +83,6 @@ public class FilePlanComponentAspect extends BaseBehaviourBean /** file plan service */ private FilePlanService filePlanService; - /** rendition service */ - private RenditionService renditionService; - /** * @param scriptService set script service */ @@ -111,7 +108,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean } /** - * @param renditionService rendition service + * @param service rendition service */ public void setRenditionService(RenditionService service) { @@ -153,7 +150,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean * @param oldProps the old properties and their values. * @param newProps the new properties and their values. * - * @see #lookupScripts(Map, Map) + * @see #lookupScripts(Map, Map) */ private void lookupAndExecuteScripts(NodeRef nodeWithChangedProperties, Map oldProps, @@ -179,7 +176,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean * @param newProps the new properties and their values. * @return A list of nodeRefs corresponding to the Script resources. * - * @see #determineChangedProps(Map, Map) + * @see org.alfresco.util.PropertyMap#getChangedProperties(Map, Map) */ private List lookupScripts(Map oldProps, Map newProps) { @@ -287,7 +284,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean * Copy behaviour call back * * @param classRef class reference - * @param copyDetail details of the information being copied + * @param copyDetails details of the information being copied * @return CopyBehaviourCallback */ @Behaviour diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java index d39e02a2f8..a5e2fe56eb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java @@ -36,7 +36,6 @@ import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; /** @@ -49,13 +48,6 @@ import org.alfresco.service.namespace.QName; @BehaviourBean(defaultType = "qshare:shared") public class QShareAspect extends BaseBehaviourBean implements NodeServicePolicies.BeforeAddAspectPolicy { - private NodeService nodeService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - /** * Behaviour to prevent sharing a record * diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java index 37be591979..36635049c1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java @@ -27,11 +27,7 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type; -import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.appendIdentifierToName; -import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.generateRecordIdentifier; - import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -121,7 +117,8 @@ public class RecordsManagementContainerType extends BaseBehaviourBean } /** - * @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation + * (ChildAssociationRef, boolean) */ @Behaviour ( @@ -159,7 +156,8 @@ public class RecordsManagementContainerType extends BaseBehaviourBean } /** - * @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(ChildAssociationRef, boolean) + * */ @Behaviour ( diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java index d559b6e8d5..fe2063d735 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java @@ -59,12 +59,10 @@ import org.alfresco.service.namespace.QName; import org.alfresco.util.ParameterCheck; import org.alfresco.util.PropertyMap; -import com.google.common.collect.Sets; - /** * Behaviour associated with the RM Site type * - * @author Roy Wetherall + * @author Roy Wetherall, Silviu Dinuta * @since 2.2 */ @BehaviourBean @@ -318,8 +316,6 @@ public class RmSiteType extends BaseBehaviourBean * * * Other than this nothing can be created under rm site nodeRef - * - * @author Silviu Dinuta * @since 2.6 */ @Override diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java index a8495bca10..3ad804b421 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java @@ -76,7 +76,7 @@ public interface ModelSecurityService /** * Indicates whether a property is protected or not. * - * @param name name of property + * @param property name of property * @return boolean true if property is protected, false otherwise */ boolean isProtectedProperty(QName property); @@ -84,7 +84,7 @@ public interface ModelSecurityService /** * Get the protected properties * - * @return {@link Set}<{@link QName}> all the protected properties + * @return {@link Set}<{@link QName} > all the protected properties */ Set getProtectedProperties(); @@ -121,7 +121,7 @@ public interface ModelSecurityService /** * Get the protected aspects. * - * @return {@link Set}<{@link QName}> all the protected aspects + * @return {@link Set}<{@link QName}> all the protected aspects */ Set getProtectedAspects(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java index 06a0182cd1..c03c7a3b42 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java @@ -60,7 +60,7 @@ public class RecordsManagementPermissionPostProcessor extends PermissionPostProc public void setPermissionModel(PermissionModel permissionModel) {this.permissionModel=permissionModel;} /** - * @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(org.alfresco.service.cmr.security.AccessStatus, org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + * @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(AccessStatus, NodeRef, String, List, List) */ @Override public AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm, diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java index d5a249f107..a8c06ac228 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java @@ -86,7 +86,7 @@ public interface RecordService /** * Gets a list of all the record meta-data aspects * - * @return {@link Set}<{@link QName}> list of record meta-data aspects + * @return {@link Set}<{@link QName}> list of record meta-data aspects * * @deprecated since 2.2, file plan component required to provide context */ @@ -124,7 +124,7 @@ public interface RecordService * recommended. * * @param nodeRef node reference to file plan component providing context - * @return {@link Set}<{@link QName}> list of record meta-data aspects + * @return {@link Set}<{@link QName} > list of record meta-data aspects * * @since 2.2 */ @@ -137,7 +137,7 @@ public interface RecordService * file plan type (rma:filePlan) are returned. * * @param filePlanType file plan type - * @return{@link Set}<{@link QName}> list of record meta-data aspects + * @return {@link Set} <{@link QName} > list of record meta-data aspects * * @since 2.2 */ @@ -267,7 +267,7 @@ public interface RecordService * Gets a list of all the records within a record folder * * @param recordFolder record folder - * @return List list of records in the record folder + * @return List<NodeRef> list of records in the record folder */ List getRecords(NodeRef recordFolder); 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 91255cd918..c9e55fe20b 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 @@ -701,7 +701,7 @@ public class RecordServiceImpl extends BaseBehaviourBean /** * Get map containing record metadata aspects. * - * @return {@link Map}<{@link QName}, {@link Set}<{@link QName}>> map containing record metadata aspects + * @return {@link Map}<{@link QName}, {@link Set}<{@link QName} >> map containing record metadata aspects * * @since 2.2 */ @@ -812,7 +812,7 @@ public class RecordServiceImpl extends BaseBehaviourBean } /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(NodeRef) */ @Override public Set getRecordMetadataAspects(NodeRef nodeRef) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java index 3c863b3202..315d8a01d9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java @@ -263,7 +263,7 @@ public class RelationshipServiceImpl extends RecordsManagementAdminBase implemen } /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#updateReleationshipDefinition(java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#updateRelationshipDefinition(java.lang.String, RelationshipDisplayName) */ @Override public RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java index ca13e874cd..b748d8af74 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java @@ -54,7 +54,7 @@ public interface Report String getReportName(); /** - * @return {@link Map}<{@link QName},{@link Serializable}> report properties + * @return {@link Map}<{@link QName},{@link Serializable}> report properties */ Map getReportProperties(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java index 750b0a1235..66bdaff2f0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java @@ -52,7 +52,7 @@ public interface ReportService /** * Get a list of the available report types. * - * @return {@link Set}<{@link QName}> list of the available report types + * @return {@link Set}<{@link QName}> list of the available report types */ Set getReportTypes(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java index ac96ed6743..cf8fec6c8f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java @@ -117,7 +117,7 @@ public class ReportServiceImpl extends ServiceBaseImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#fileReport(org.alfresco.module.org_alfresco_module_rm.report.Report) + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#fileReport(NodeRef, org.alfresco.module.org_alfresco_module_rm.report.Report) */ @Override public NodeRef fileReport(NodeRef nodeRef, Report report) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java index 7264d32f91..5dd9ec9fde 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java @@ -102,7 +102,7 @@ public abstract class BaseReportGenerator implements ReportGenerator } /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#generateReport(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#generateReport(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) */ @Override public Report generateReport(NodeRef reportedUponNodeRef, String mimetype) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java index da106c0529..ed8799b00d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java @@ -175,7 +175,7 @@ public class DeclarativeReportGenerator extends BaseReportGenerator } /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef, String) */ @Override protected String generateReportName(NodeRef reportedUponNodeRef, String mimetype) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java index 228219b390..26eaf123e8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java @@ -66,7 +66,7 @@ public class TransferReportGenerator extends DeclarativeReportGenerator } /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGeneratorUnitTest#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) */ @Override protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java index f13c73c3c5..905f3e8b00 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java @@ -183,7 +183,7 @@ public interface FilePlanRoleService * * @param filePlan file plan * @param role role - * @return {@link Set}<{@link String}> set of users + * @return {@link Set}<{@link String}> set of users */ Set getUsersAssignedToRole(NodeRef filePlan, String role); @@ -192,7 +192,7 @@ public interface FilePlanRoleService * * @param filePlan file plan * @param role role - * @return {@link Set}<{@link String}> set of groups + * @return {@link Set}<{@link String}> set of groups */ Set getGroupsAssignedToRole(NodeRef filePlan, String role); @@ -201,7 +201,7 @@ public interface FilePlanRoleService * * @param filePlan file plan * @param role role - * @return {@link Set}<{@link String}> set of groups and users + * @return {@link Set}<{@link String}> set of groups and users */ Set getAllAssignedToRole(NodeRef filePlan, String role); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java index 0d9b536a89..09a55aca95 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java @@ -27,11 +27,8 @@ package org.alfresco.module.org_alfresco_module_rm.role; -import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -161,7 +158,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#initialiseFilePlan(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#setupFilePlanRoles(NodeRef) */ @Override public void setupFilePlanRoles(final NodeRef filePlan) @@ -394,7 +391,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles() + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRoles(NodeRef) */ public Set getRoles(final NodeRef rmRootNode) { @@ -519,7 +516,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) */ public Role getRole(final NodeRef rmRootNode, final String role) { @@ -571,7 +568,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#existsRole(NodeRef, java.lang.String) */ public boolean existsRole(final NodeRef rmRootNode, final String role) { @@ -589,7 +586,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) * * TODO .. change this to check a property of the role its self */ @@ -708,7 +705,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(java.lang.String) + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(NodeRef,String) */ public void deleteRole(final NodeRef rmRootNode, final String role) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java index 91201fcc53..7dd0ea4dd0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java @@ -29,9 +29,8 @@ package org.alfresco.module.org_alfresco_module_rm.script; import static org.alfresco.util.WebScriptUtils.getTemplateVars; -import java.util.Map; - import javax.servlet.http.HttpServletResponse; +import java.util.Map; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; @@ -47,6 +46,7 @@ import org.springframework.extensions.webscripts.WebScriptRequest; * * @author Neil McErlean * @author Tuna Aksoy + * @author Gavin Cornwell */ public abstract class AbstractRmWebScript extends DeclarativeWebScript { @@ -133,7 +133,6 @@ public abstract class AbstractRmWebScript extends DeclarativeWebScript * @param req The webscript request * @return The NodeRef passed in the request * - * @author Gavin Cornwell */ protected NodeRef parseRequestForNodeRef(WebScriptRequest req) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java index 6608169d23..78b0da1824 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java @@ -55,7 +55,7 @@ public class AuditLogStatusGet extends DeclarativeWebScript /** * Sets the RecordsManagementAuditService instance * - * @param auditService The RecordsManagementAuditService instance + * @param rmAuditService The RecordsManagementAuditService instance */ public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java index 4e544a7ee5..261ca51d9b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java @@ -53,7 +53,7 @@ public class BaseAuditAdminWebScript extends DeclarativeWebScript /** * Sets the RecordsManagementAuditService instance * - * @param auditService The RecordsManagementAuditService instance + * @param rmAuditService The RecordsManagementAuditService instance */ public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java index 19b53db6d5..a2beab806e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java @@ -73,7 +73,7 @@ public class BaseAuditRetrievalWebScript extends StreamContent /** * Sets the RecordsManagementAuditService instance * - * @param auditService The RecordsManagementAuditService instance + * @param rmAuditService The RecordsManagementAuditService instance */ public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java index 79c6d1fcff..f7f2f60bd5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java @@ -27,14 +27,13 @@ package org.alfresco.module.org_alfresco_module_rm.script; +import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletResponse; - import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -69,7 +68,9 @@ public abstract class BaseTransferWebScript extends StreamACP } /** - * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java index a76076a55d..c70166c3ff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java @@ -59,7 +59,9 @@ public class EmailMapDelete extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java index 33f47996f0..6b9765d0bb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java @@ -56,7 +56,9 @@ public class EmailMapGet extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java index f6f30454da..7b49399f8b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java @@ -62,7 +62,9 @@ public class EmailMapPost extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java index 404fe1e55e..7778627c0d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java @@ -78,7 +78,9 @@ public class ExportPost extends StreamACP } /** - * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @SuppressWarnings("deprecation") @Override diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java index c3f42c488b..13132629bf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java @@ -58,7 +58,9 @@ public class RmEventDelete extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override public Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java index 836eb39f4e..1a0f9e0429 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java @@ -86,7 +86,9 @@ public class RMSavedSearchesPost extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java index 8e7e9e05ca..0765e8852b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java @@ -102,7 +102,9 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java index d32c382ed5..212c2d29da 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java @@ -70,7 +70,9 @@ public class RecordedVersionConfigGet extends AbstractRmWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java index 8d1fbc5f8b..0bfab96fef 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java @@ -76,7 +76,9 @@ public class RecordedVersionConfigPost extends AbstractRmWebScript } /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) @@ -90,7 +92,7 @@ public class RecordedVersionConfigPost extends AbstractRmWebScript /** * Gets the recordable version policy from the request * - * @param The webscript request + * @param req The webscript request * @return The recordable version policy */ private String getRecordableVersionPolicy(WebScriptRequest req) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java index ee8419ded2..acb1a5e1c0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java @@ -45,14 +45,14 @@ public interface RecordsManagementSearchService * @param siteId the id of the rm site to query * @param query search query string * @param searchParameters search parameters - * @return {@link List}<{@link Pair}<{@link NodeRef}, {@link NodeRef}> search results as pairs for parent and child nodes + * @return {@link List}<{@link Pair} <{@link NodeRef}, {@link NodeRef}>> search results as pairs for parent and child nodes */ List> search(String siteId, String query, RecordsManagementSearchParameters searchParameters); /** * Get all the searches saved on the given records management site. * @param siteId site id - * @return {@link List<{@link SavedSearchDetails}>} list of saved search details + * @return {@link List}<{@link SavedSearchDetails}> list of saved search details */ List getSavedSearches(String siteId); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java index 02666fbd38..90aa48eb3b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java @@ -466,7 +466,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear } /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean) + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(String, String, String, String, RecordsManagementSearchParameters, boolean) */ @Override public SavedSearchDetails saveSearch(String siteId, String name, String description, String query, RecordsManagementSearchParameters searchParameters, boolean isPublic) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java index f07bb3f6aa..f75b93a4c0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java @@ -97,7 +97,7 @@ public class ReportDetails } /** - * @param query query string + * @param search query string */ public void setSearch(String search) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java index 41d7a9561b..04f1c2a3a9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java @@ -74,7 +74,7 @@ import org.springframework.extensions.surf.util.I18NUtil; * searchparams contains the filters, sort, etc information about the query * query is there for backward compatibility * note: - * "params": "terms=keywords:xyz&undeclared=true", + * "params": "terms=keywords:xyz&undeclared=true", * "sort": "cm:name/asc" * "query": "the complete search query string", * ... are sometimes found in the place of searchparams and are migrated to the new format when re-saved diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java index 5fe283da60..572303c1da 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java @@ -57,7 +57,7 @@ public interface ExtendedSecurityService extends DeprecatedExtendedSecurityServi * Gets the set of authorities that are extended readers for the given node. * * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended readers + * @return {@link Set}<{@link String}> set of extended readers */ Set getReaders(NodeRef nodeRef); @@ -65,7 +65,7 @@ public interface ExtendedSecurityService extends DeprecatedExtendedSecurityServi * Get the set of authorities that are extended writers for the given node. * * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended writers + * @return {@link Set}<{@link String}> set of extended writers */ Set getWriters(NodeRef nodeRef); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java index 5920b071e7..7af2408b09 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java @@ -184,7 +184,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getReaders(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#getReaders(org.alfresco.service.cmr.repository.NodeRef) */ @SuppressWarnings("unchecked") @Override diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java index 010c76db62..8e798f30d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java @@ -42,7 +42,7 @@ public interface FilePlanPermissionService /** * Setup permissions for a record category * - * @param nodeRef record category node reference + * @param recordCategory record category node reference */ void setupRecordCategoryPermissions(NodeRef recordCategory); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java index 5a51c73585..fd28505b70 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java @@ -28,8 +28,7 @@ package org.alfresco.module.org_alfresco_module_rm.security; import static java.util.Collections.singletonMap; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority.EXTENDED_READER; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority.EXTENDED_WRITER; + import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; import static org.alfresco.repo.policy.annotation.BehaviourKind.CLASS; import static org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName; @@ -589,7 +588,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, boolean) + * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setPermission(NodeRef, String, String) */ @Override public void setPermission(final NodeRef nodeRef, final String authority, final String permission) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java index 4723c1b52d..4d1ba62780 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java @@ -45,7 +45,7 @@ public class AuthenticationUtil *

* Useful when testing using mocks. * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork, String) + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork) */ public R runAsSystem(RunAsWork runAsWork) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java index f1f53750b4..79695c3428 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java @@ -101,7 +101,7 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl * Process properties map before returning as frozen state. * * @param properties properties map - * @return {@link Map}<{@link QName}, {@link Serializable}> processed property map + * @return {@link Map}<{@link QName}, {@link Serializable}> processed property map */ protected Map processProperties(NodeRef version, Map properties) { @@ -229,7 +229,7 @@ public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl * Process frozen aspects. * * @param aspects aspect set - * @return {@link Set}<{@link QName}> processed aspect set + * @return {@link Set}<{@link QName}> processed aspect set */ protected Set processAspects(Set aspects) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java index 643d009458..c7d80b5abe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java @@ -69,7 +69,7 @@ public interface RecordableVersionService /** * Gets the version that relates to the version record * - * @param versionRecord version record node reference + * @param record version record node reference * @return Version version or null if not found */ Version getRecordedVersion(NodeRef record); @@ -89,7 +89,7 @@ public interface RecordableVersionService *

* Does not create a record if the node is not versionable or the latest version is already recorded. * - * @param nodeRef parent node reference + * @param filePlan parent node reference * @param nodeRef node reference * @param autoVersion true, create new record version from latest version, false creates a record from the latest frozen version * @return NodeRef node reference to the created record. diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java index 2380e3309a..1fceed588f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java @@ -620,7 +620,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isLatestVersionRecorded(org.alfresco.service.cmr.repository.NodeRef) + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isCurrentVersionRecorded(NodeRef) */ @Override public boolean isCurrentVersionRecorded(NodeRef nodeRef) @@ -672,7 +672,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl /** * Create Version Store Ref * - * @param store ref + * @param storeRef store ref * @return store ref for version store */ public StoreRef convertStoreRef(StoreRef storeRef) @@ -693,7 +693,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl } /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, autoVersion) + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(NodeRef, NodeRef, boolean autoVersion) */ @Override public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef, final boolean isEnableAutoVersionOnRecordCreation) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java index b1deb19f16..762f12bce9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java @@ -52,7 +52,7 @@ public class NodeParameterSuggesterBootstrap private NodeParameterProcessor nodeParameterProcessor; /** - * @param recordMetadataAspects map of record metadata aspects against file plan types + * @param nodeParameterProcessorAspectsNames map of record metadata aspects against file plan types */ public void setNodeParameterProcessorAspects(String nodeParameterProcessorAspectsNames) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java index dd5d89d3fd..6f8c6d6619 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java @@ -137,7 +137,7 @@ public class ParameterProcessorComponent implements ParameterSubstitutionSuggest /** * Return a list of substitution suggestions for the passed string fragment. * - * @param subtitutionFragment Text fragment to search on. + * @param substitutionFragment Text fragment to search on. * @return A list of substitutions that match the substitution fragment. */ public List getSubstitutionSuggestions(final String substitutionFragment) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java index 6fab4e94a2..83fb1501a9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java @@ -45,7 +45,7 @@ public interface ExtendedPermissionService extends PermissionService * Get a set of all the authorities that have write access. * * @param aclId acl id - * @return {@link Set}<{@link String}> set of authorities with write access + * @return {@link Set}<{@link String}> set of authorities with write access */ Set getWriters(Long aclId); @@ -55,7 +55,7 @@ public interface ExtendedPermissionService extends PermissionService * The writers list includes the owner for the node. * * @param nodeRef node reference - * @return Pair, Set> first is a set containing all the authorities that have read permission on the + * @return Pair<Set<String>, Set<String>> first is a set containing all the authorities that have read permission on the * document and second is a set containing all the authorities that have write * permission on the document, including the owner. * diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java index 689c00748b..ff42e9f192 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java @@ -41,8 +41,7 @@ public interface PermissionPreProcessor { /** * Process permission. - * - * @param accessStatus current access status + * * @param nodeRef node reference * @param perm permission * @return {@link AccessStatus} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java index 766ac302ce..96794d1daf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java @@ -67,7 +67,7 @@ public class PermissionProcessorRegistry /** * Get a list of the registered permission pre-processors. * - * @return {@link List}<{@link PermissionPreProcessor}> list of permission pre-processors + * @return {@link List}<{@link PermissionPreProcessor}> list of permission pre-processors */ public List getPermissionPreProcessors() { @@ -77,7 +77,7 @@ public class PermissionProcessorRegistry /** * Get a list of the registered permission post-processors. * - * @return <{@link List}>{@link PermissionPreProcessor} list of permission post-processors + * @return <{@link List}>{@link PermissionPreProcessor} list of permission post-processors */ public List getPermissionPostProcessors() { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java index 6e1d6e6330..5eede3afe2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java @@ -41,7 +41,7 @@ import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegis private PermissionProcessorRegistry permissionProcessorRegistry; /** - * @param PermissionProcessorRegistry permission processor registry + * @param permissionProcessorRegistry permission processor registry */ public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java index d95cd506e6..ccec29a168 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java @@ -44,7 +44,7 @@ import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** - * Webscript to get the Propertydefinitions for a given classname eg. =>cm_person + * Webscript to get the Propertydefinitions for a given classname eg. =>cm_person * * This class makes it possible to get only RM related property definitions * @see PropertiesGet for the original implementation diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java index a4e9f1798e..c435076953 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java @@ -91,9 +91,9 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript } /** - * Set the parameter processor component bean + * Set the node service * - * @param parameterProcessorComponent + * @param nodeService */ public void setNodeService(NodeService nodeService) { @@ -109,7 +109,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript } /** - * @param filePlanService file plan service + * @param capabilityService file plan service */ public void setCapabilityService(CapabilityService capabilityService) { @@ -119,7 +119,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript /** * Set the minimum fragment size to process for suggestion processing * - * @param maximumNumberSuggestions + * @param substitutionMinimumFragmentSize */ public void setSubstitutionMinimumFragmentSize(int substitutionMinimumFragmentSize) { @@ -129,7 +129,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript /** * Set the maxmimum number of suggestions returned from the global property * - * @param maximumNumberSuggestions + * @param pathSubstitutionMaximumNumberSuggestions */ public void setPathSubstitutionMaximumNumberSuggestions(int pathSubstitutionMaximumNumberSuggestions) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java index fbd2b911a3..60bab513dd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java @@ -641,8 +641,7 @@ public class ApiNodesModelFactory * Creates an object of type FilePlan * * @param info info of the file plan - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return FilePlan object @@ -659,8 +658,7 @@ public class ApiNodesModelFactory * Creates an object of type RecordCategory * * @param info info of the record category - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return RecordCategory object @@ -685,8 +683,7 @@ public class ApiNodesModelFactory * Creates an object of type RecordCategory * * @param info - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return RecordCategory object @@ -710,8 +707,7 @@ public class ApiNodesModelFactory * Creates an object of type UnfiledContainer * * @param info - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return UnfiledContainer object @@ -729,8 +725,7 @@ public class ApiNodesModelFactory * Creates an object of type TransferContainer * * @param info - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return UnfiledContainer object @@ -747,8 +742,7 @@ public class ApiNodesModelFactory * Creates an object of type Transfer * * @param info - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return UnfiledContainer object @@ -765,8 +759,7 @@ public class ApiNodesModelFactory * Creates an object of type TransferChild * * @param info - * @param propertyFilter - * @param includeParam + * @param parameters * @param mapUserInfo * @param isMinimalInfo * @return UnfiledContainer object diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java index 78b0e5a5b2..472d079ef8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java @@ -39,7 +39,6 @@ import java.io.Serializable; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -65,8 +64,6 @@ import org.alfresco.repo.tenant.TenantUtil; import org.alfresco.rest.antlr.WhereClauseParser; import org.alfresco.rest.api.Activities; import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.model.PathInfo; -import org.alfresco.rest.api.model.PathInfo.ElementInfo; import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; import org.alfresco.rest.framework.core.exceptions.InsufficientStorageException; @@ -90,7 +87,6 @@ import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.lock.NodeLockedException; import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentIOException; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; @@ -98,10 +94,7 @@ import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Path; -import org.alfresco.service.cmr.repository.Path.Element; import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.usage.ContentQuotaException; import org.alfresco.service.namespace.QName; @@ -781,7 +774,7 @@ public class FilePlanComponentsApiUtils * Returns a List of filter properties specified by request parameters. * @param parameters The {@link Parameters} object to get the parameters passed into the request * including: - * - filter, sort & paging params (where, orderBy, skipCount, maxItems) + * - filter, sort & paging params (where, orderBy, skipCount, maxItems) * @return The list of {@link FilterProp}. Can be null. */ public List getListChildrenFilterProps(Parameters parameters, Set listFolderChildrenEqualsQueryProperties) @@ -912,8 +905,9 @@ public class FilePlanComponentsApiUtils /** * Helper method that generates allowable operation for the provided node * @param nodeRef the node to get the allowable operations for - * @param type the type of the provided nodeRef - * @return a sublist of [{@link Nodes.OP_DELETE}, {@link Nodes.OP_CREATE}, {@link Nodes.OP_UPDATE}] representing the allowable operations for the provided node + * @param typeQName the type of the provided nodeRef + * @return a sublist of [{@link Nodes#OP_DELETE}, {@link Nodes#OP_CREATE}, {@link Nodes#OP_UPDATE}] representing + * the allowable operations for the provided node */ protected List getAllowableOperations(NodeRef nodeRef, QName typeQName) { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java index 8619a42c99..cd35c889ff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java @@ -48,6 +48,7 @@ public class RecordCategoryChild extends RMNode public RecordCategoryChild() { + //Default constructor } public Boolean getIsRecordCategory() diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java index 124896d6a5..bc810cbb45 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java @@ -39,6 +39,7 @@ public class TargetContainer public TargetContainer() { + //Default constructor } public String getTargetParentId() diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java index 57a5eb34f7..2bd605ee06 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java @@ -67,6 +67,7 @@ public class Transfer public Transfer() { + //Default constructor } @JsonProperty ("id") diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java index 812107c990..8f2ef1d3e7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java @@ -45,6 +45,7 @@ public class TransferChild extends RMNode public TransferChild() { + //Default constructor } public Boolean getIsClosed() diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java index 77677120d4..e51e7948c7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java @@ -60,6 +60,7 @@ public class TransferContainer public TransferContainer() { + //Default constructor } @JsonProperty ("id") diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java b/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java index 6be0c21d74..72282d6279 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java @@ -72,7 +72,7 @@ public enum SortDirection if (sortDirection == null) { - throw new AlfrescoRuntimeException("Sort direction '" + sortDirection +"' unknown."); + throw new AlfrescoRuntimeException("Sort direction unknown."); } return sortDirection; From 4fa230a3223e164c50456b5944c9a586f7c84666 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 10 May 2019 15:24:03 +0300 Subject: [PATCH 15/25] removed contentService from child classes and made it protected in parent class --- .../src/main/java/org/alfresco/rest/v0/RecordsAPI.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java index ac2fe6933f..0598a95d06 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java @@ -33,7 +33,6 @@ import java.text.MessageFormat; import java.util.Map; import org.alfresco.dataprep.CMISUtil.DocumentType; -import org.alfresco.dataprep.ContentService; import org.alfresco.rest.core.v0.BaseAPI; import org.apache.chemistry.opencmis.client.api.CmisObject; import org.apache.commons.lang3.tuple.Pair; @@ -42,7 +41,6 @@ import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -59,9 +57,6 @@ public class RecordsAPI extends BaseAPI private static final String CREATE_NON_ELECTRONIC_RECORD_API = "{0}type/rma:nonElectronicDocument/formprocessor"; - @Autowired - private ContentService contentService; - /** * Declare documents as records * From 3c341d85c5d955a6801e45082ebe1fc0a0193473 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 10 May 2019 17:05:15 +0300 Subject: [PATCH 16/25] delete unnecessary imports --- .../org/alfresco/rest/rm/community/base/DataProviderClass.java | 1 - .../alfresco/rest/rm/community/records/CompleteRecordTests.java | 2 -- 2 files changed, 3 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java index d437da677a..5f90e68072 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java @@ -38,7 +38,6 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import org.testng.annotations.DataProvider; diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java index d5ca79d7e3..cdd9fe2644 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java @@ -42,8 +42,6 @@ import java.util.List; import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.site.RMSite; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; import org.alfresco.test.AlfrescoTest; From 5dcae9c6086175f20ff0a00a08cba84978a03f85 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 10 May 2019 17:08:33 +0300 Subject: [PATCH 17/25] delete unnecessary semicolon --- .../rest/rm/community/files/DeclareDocumentAsRecordTests.java | 4 ++-- .../rm/community/recordcategories/RecordCategoryTests.java | 1 - .../alfresco/rest/rm/community/records/ReadRecordTests.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java index 5e08e5fd7f..af871ccabe 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java @@ -162,8 +162,8 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest try ( InputStream recordInputStream = getRestAPIFactory().getRecordsAPI().getRecordContent(record.getId()).asInputStream(); - InputStream documentInputStream = documentPostFiling.getContentStream().getStream(); - ) + InputStream documentInputStream = documentPostFiling.getContentStream().getStream() + ) { assertEquals(DigestUtils.sha1(recordInputStream), DigestUtils.sha1(documentInputStream)); } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java index 9cd8b476b6..8580839556 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java @@ -775,7 +775,6 @@ public class RecordCategoryTests extends BaseRMRestTest { //is unfiled container containerId = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(containerAlias).getId(); - ; } // Create a record folder diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java index 06b513ccac..e2c48d8695 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java @@ -269,7 +269,7 @@ public class ReadRecordTests extends BaseRMRestTest try ( InputStream recordContentStream = recordsAPI.getRecordContent(binaryRecordId).asInputStream(); - FileInputStream localFileStream = new FileInputStream(getFile(IMAGE_FILE)); + FileInputStream localFileStream = new FileInputStream(getFile(IMAGE_FILE)) ) { assertEquals(DigestUtils.sha1(recordContentStream), DigestUtils.sha1(localFileStream)); From 929980e7c2327adbee38cf206c512d54f7f7130b Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 13 May 2019 10:00:29 +0300 Subject: [PATCH 18/25] Fix "Either re-interrupt this method or rethrow the "InterruptedException"." sonar bug --- .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 4ecf318e2a..fccd1bf693 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -642,6 +642,8 @@ public class BaseRMRestTest extends RestTest } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } } @@ -690,6 +692,8 @@ public class BaseRMRestTest extends RestTest } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } } @@ -739,6 +743,8 @@ public class BaseRMRestTest extends RestTest } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } } result = searchApi.searchForNodePropertyAsUser(user.getUsername(), user.getPassword(), nodeRef, From 7e9147ceef01473ec219887ff66c064d43eee8ba Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 13 May 2019 15:00:42 +0300 Subject: [PATCH 19/25] Added parentId parameter for tests that use declareRecord v1 api --- .../rm/community/requests/RMModelRequest.java | 2 +- .../requests/gscore/api/FilesAPI.java | 31 ++---- .../DeclareAndFileDocumentAsRecordTests.java | 96 ++++++++++++++----- 3 files changed, 84 insertions(+), 45 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java index b2510f80f7..7f1435142a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java @@ -41,7 +41,7 @@ import lombok.Setter; * @author Tuna Aksoy * @since 2.6 */ -public abstract class RMModelRequest extends ModelRequest +public abstract class RMModelRequest extends ModelRequest { @Getter (value = PROTECTED) @Setter (value = PRIVATE) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java index 5440b3866c..8559459294 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java @@ -41,8 +41,10 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest; * @author Kristijan Conkas * @since 2.6 */ -public class FilesAPI extends RMModelRequest +public class FilesAPI extends RMModelRequest { + public static final String PARENT_ID_PARAM = "parentId"; + /** * @param rmRestWrapper RM REST Wrapper */ @@ -55,26 +57,6 @@ public class FilesAPI extends RMModelRequest * Declare file as record * * @param fileId The Id of a file to declare as record - * @param parameters Request parameters, refer to API documentation for more details - * @return The {@link Record} for created record - * @throws Exception for malformed JSON responses - */ - public Record declareAsRecord(String fileId, String parameters) throws Exception - { - mandatoryString("fileId", fileId); - - return getRmRestWrapper().processModel(Record.class, simpleRequest( - POST, - "/files/{fileId}/declare?{parameters}", - fileId, - parameters - )); - } - - /** - * A no-parameter version of {@link FilesAPI#declareAsRecord} - * - * @param fileId The Id of a file to declare as record * @return The {@link Record} for created record * @throws Exception for malformed JSON responses */ @@ -82,7 +64,12 @@ public class FilesAPI extends RMModelRequest { mandatoryString("fileId", fileId); - return declareAsRecord(fileId, EMPTY); + return getRmRestWrapper().processModel(Record.class, simpleRequest( + POST, + "/files/{fileId}/declare?{parameters}", + fileId, + getRmRestWrapper().getParameters() + )); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 899466aeaf..379ceb45ed 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -26,16 +26,19 @@ */ package org.alfresco.rest.rm.community.files; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER; +import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.alfresco.utility.data.RandomData.getRandomName; import static org.alfresco.utility.report.log.Step.STEP; import static org.springframework.http.HttpStatus.ACCEPTED; +import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; @@ -57,6 +60,7 @@ import org.alfresco.test.AlfrescoTest; import org.alfresco.utility.Utility; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.FileModel; +import org.alfresco.utility.model.FolderModel; import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; @@ -77,10 +81,11 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private final static String DESTINATION_PATH_NOT_RESOLVED_EXC = "Unable to execute create-record action, because the destination path could not be resolved."; private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid."; private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder."; - private final static String CLOSED_RECORD_FOLDER_EXC = "You can't add new items to a closed record folder"; + private final static String CLOSED_RECORD_FOLDER_EXC = "Unable to create record, because container is closed"; private UserModel userFillingPermission, userReadOnlyPermission; private SiteModel publicSite; + private FolderModel testFolder; private RecordCategory recordCategory; private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory; private UnfiledContainerChild unfiledContainerFolder; @@ -92,16 +97,14 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private RoleService roleService; /** - * Invalid containers where in-place records can't be filed + * Invalid destination paths where in-place records can't be filed */ - @DataProvider (name = "invalidFileLocations") - public Object[][] getInvalidFileLocations() throws Exception + @DataProvider (name = "invalidDestinationPaths") + public Object[][] getInvalidDestinationPaths() throws Exception { RecordCategoryChild closedFolder = createFolder(recordCategory.getId(), getRandomName("closedFolder")); closeFolder(closedFolder.getId()); - unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); return new String[][] { { "/", DESTINATION_PATH_NOT_RESOLVED_EXC}, @@ -115,25 +118,49 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest // an arbitrary unfiled records folder { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC }, // a collaboration site folder - { dataContent.usingAdmin().usingSite(publicSite).createFolder().getCmisLocation(), DESTINATION_PATH_NOT_RESOLVED_EXC } + { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_RESOLVED_EXC } }; } + /** + * Invalid destination ids where in-place records can't be filed + */ + @DataProvider (name = "invalidDestinationIds") + public Object[][] getInvalidDestinationIds() + { + return new String[][] + { + { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId() }, + { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, + { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() }, + { getContentService().getNodeRefByPath(getAdminUser().getUsername(), getAdminUser().getPassword(), "/Sites/rm/documentLibrary/Holds") }, + { recordCategory.getId() }, + { unfiledContainerFolder.getId() }, + { testFolder.getNodeRef() } + }; + } + @BeforeClass (alwaysRun = true) public void declareAndFileDocumentAsRecordSetup() throws Exception { STEP("Create test collaboration site to store documents in."); publicSite = dataSite.usingAdmin().createPublicRandomSite(); + STEP("Create a test foloder within the collaboration site"); + testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder(); + STEP("Create record categories and record folders"); recordCategory = createRootCategory(getRandomName("recordCategory")); subCategory = createRecordCategory(recordCategory.getId(), getRandomName("subCategory")); recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder")); subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder")); + unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, + "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); STEP("Create rm users with different permissions on the record category"); userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING); - userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory,ROLE_RM_USER, PERMISSION_READ_RECORDS); + userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, + ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS); } /** @@ -194,7 +221,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder * And the document is not declared as a record */ - @Test (dataProvider = "invalidFileLocations") + @Test (dataProvider = "invalidDestinationPaths") public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception { STEP("Create a document in the collaboration site"); @@ -232,8 +259,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest .createContent(CMISUtil.DocumentType.TEXT_PLAIN); STEP("Declare document as record with a location parameter value"); - //TODO add recordFolder location parameter value Record record = getRestAPIFactory().getFilesAPI(userFillingPermission) + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(CREATED); @@ -244,6 +271,30 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest assertTrue(hasRecordAspect(testFile), "File should have record aspect"); } + /** + * Given I declare a record using the v1 API + * When I provide an invalid record folder in the location parameter + * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder + * And the document is not declared as a record + */ + @Test (dataProvider = "invalidDestinationIds") + public void declareAndFileToInvalidLocationUsingFilesAPI(String containerID) throws Exception + { + STEP("Create a document in the collaboration site"); + FileModel testFile = dataContent.usingSite(publicSite) + .usingAdmin() + .createContent(CMISUtil.DocumentType.TEXT_PLAIN); + + STEP("Declare document as record with an invalid location parameter value"); + getRestAPIFactory().getFilesAPI() + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, containerID)) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); + assertStatusCode(BAD_REQUEST); + + STEP("Check that the file is not a record"); + assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); + } + /** * Given I am an user with read only permissions on a record folder * When I declare and file a record to the record folder @@ -258,9 +309,9 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest .createContent(CMISUtil.DocumentType.TEXT_PLAIN); STEP("Declare document as record with a record folder as location parameter"); - //TODO add recordFolder location parameter value - getRestAPIFactory().getFilesAPI(userReadOnlyPermission).declareAsRecord(testFile.getNodeRefWithoutVersion()); - //TODO check what status code should be returned + getRestAPIFactory().getFilesAPI(userReadOnlyPermission) + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(FORBIDDEN); STEP("Check that the file is not a record"); @@ -285,8 +336,9 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest .createContent(CMISUtil.DocumentType.TEXT_PLAIN); STEP("Declare document as record with a record folder as location parameter"); - //TODO add recordFolder location parameter value - getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(testFile.getNodeRefWithoutVersion()); + getRestAPIFactory().getFilesAPI(nonRMUser) + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(FORBIDDEN); STEP("Check that the file is not a record"); @@ -308,13 +360,15 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest .createContent(CMISUtil.DocumentType.TEXT_PLAIN); STEP("Declare document as record with a record folder as location parameter"); - //TODO add subcategoryRecordFolder as location parameter value - getRestAPIFactory().getFilesAPI(userFillingPermission).declareAsRecord(testFile.getNodeRefWithoutVersion()); + getRestAPIFactory().getFilesAPI(userFillingPermission) + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, subcategoryRecordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(CREATED); STEP("Declare it again using a different record folder as location parameter"); - //TODO add recordFolder as location parameter value - getRestAPIFactory().getFilesAPI(userFillingPermission).declareAsRecord(testFile.getNodeRefWithoutVersion()); + getRestAPIFactory().getFilesAPI(userFillingPermission) + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(UNPROCESSABLE_ENTITY); STEP("Verify the declared record is placed in the first record folder"); @@ -324,8 +378,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest "Record should not be filed to subcategoryRecordFolder"); } - - @AfterClass(alwaysRun = true) public void declareAndFileDocumentAsRecordCleanup() { From bb1e01a6ccfedee90fb67aa5a4ffb6efa97db0b9 Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 13 May 2019 16:46:32 +0300 Subject: [PATCH 20/25] Fix sonar bugs for DockerHelper class --- .../rest/rm/community/util/DockerHelper.java | 16 ++++++++++------ .../DeclareAndFileDocumentAsRecordTests.java | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java index adbb4ab30c..ce17d71717 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java @@ -39,6 +39,8 @@ import com.github.dockerjava.api.model.Frame; import com.github.dockerjava.core.DockerClientBuilder; import com.github.dockerjava.core.command.LogContainerResultCallback; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,8 +57,10 @@ import org.springframework.stereotype.Service; @Service public class DockerHelper { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private static final Logger LOGGER = LoggerFactory.getLogger(DockerHelper.class); private static final String REPO_IMAGE_NAME = "repository"; + @Getter + @Setter private DockerClient dockerClient; @Autowired @@ -82,9 +86,9 @@ public class DockerHelper { final List logs = new ArrayList<>(); // get the logs since current time - 10 seconds - int timeStamp = (int) (System.currentTimeMillis() / 1000) - 10; + final int timeStamp = (int) (System.currentTimeMillis() / 1000) - 10; - LogContainerCmd logContainerCmd = dockerClient.logContainerCmd(containerId); + final LogContainerCmd logContainerCmd = getDockerClient().logContainerCmd(containerId); logContainerCmd.withStdOut(true) .withStdErr(true) .withSince(timeStamp) // UNIX timestamp to filter logs. Output log-entries since that timestamp. @@ -104,7 +108,7 @@ public class DockerHelper catch (InterruptedException e) { Thread.currentThread().interrupt(); // set interrupt flag - logger.error("Failed to retrieve logs of container " + containerId, e); + LOGGER.error("Failed to retrieve logs of container " + containerId, e); } return logs; @@ -117,7 +121,7 @@ public class DockerHelper */ public List getAlfrescoLogs() { - Optional alfrescoContainer = findContainerByImageName(REPO_IMAGE_NAME); + final Optional alfrescoContainer = findContainerByImageName(REPO_IMAGE_NAME); return (alfrescoContainer.isPresent()) ? getDockerLogs(alfrescoContainer.get().getId()) : Collections.emptyList(); } @@ -129,7 +133,7 @@ public class DockerHelper */ private Optional findContainerByImageName(String imageName) { - List containers = dockerClient.listContainersCmd().withShowAll(true).exec(); + final List containers = getDockerClient().listContainersCmd().withShowAll(true).exec(); return containers.stream() .filter(container -> container.getImage().contains(imageName)) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 379ceb45ed..327b70d7b4 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -146,7 +146,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest STEP("Create test collaboration site to store documents in."); publicSite = dataSite.usingAdmin().createPublicRandomSite(); - STEP("Create a test foloder within the collaboration site"); + STEP("Create a test folder within the collaboration site"); testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder(); STEP("Create record categories and record folders"); From 60f8a61599b04eb784ef6af316d7f94acfad2536 Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 14 May 2019 09:54:16 +0300 Subject: [PATCH 21/25] Added closed folder to invalidDestinationIds data provider --- .../files/DeclareAndFileDocumentAsRecordTests.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 327b70d7b4..90db7d8d16 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -87,7 +87,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private SiteModel publicSite; private FolderModel testFolder; private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory; + private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory, closedFolder; private UnfiledContainerChild unfiledContainerFolder; @Autowired @@ -100,11 +100,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest * Invalid destination paths where in-place records can't be filed */ @DataProvider (name = "invalidDestinationPaths") - public Object[][] getInvalidDestinationPaths() throws Exception + public Object[][] getInvalidDestinationPaths() { - RecordCategoryChild closedFolder = createFolder(recordCategory.getId(), getRandomName("closedFolder")); - closeFolder(closedFolder.getId()); - return new String[][] { { "/", DESTINATION_PATH_NOT_RESOLVED_EXC}, @@ -135,6 +132,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() }, { getContentService().getNodeRefByPath(getAdminUser().getUsername(), getAdminUser().getPassword(), "/Sites/rm/documentLibrary/Holds") }, { recordCategory.getId() }, + { closedFolder.getId() }, { unfiledContainerFolder.getId() }, { testFolder.getNodeRef() } }; @@ -156,6 +154,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder")); unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); + closedFolder = createFolder(recordCategory.getId(), getRandomName("closedFolder")); + closeFolder(closedFolder.getId()); STEP("Create rm users with different permissions on the record category"); userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING); From e5ac7ad9b77d7893e3fd98579b7fdaebfe2d24d5 Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 14 May 2019 15:18:24 +0300 Subject: [PATCH 22/25] code review comments --- .../rm/community/base/BaseRMRestTest.java | 12 +- .../DeclareAndFileDocumentAsRecordTests.java | 111 +++++++++++------- 2 files changed, 73 insertions(+), 50 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index fccd1bf693..baa37afc28 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -480,32 +480,32 @@ public class BaseRMRestTest extends RestTest return createCategoryFolderInFilePlan(getAdminUser()); } - public UnfiledContainer getUnfiledContainerAsUser(UserModel user, String componentId) throws Exception + public UnfiledContainer getUnfiledContainerAsUser(UserModel user, String componentId) { return getRestAPIFactory().getUnfiledContainersAPI(user).getUnfiledContainer(componentId); } - public UnfiledContainer getUnfiledContainer(String componentId) throws Exception + public UnfiledContainer getUnfiledContainer(String componentId) { return getUnfiledContainerAsUser(getAdminUser(), componentId); } - public TransferContainer getTransferContainerAsUser(UserModel user, String componentId) throws Exception + public TransferContainer getTransferContainerAsUser(UserModel user, String componentId) { return getRestAPIFactory().getTransferContainerAPI(user).getTransferContainer(componentId); } - public TransferContainer getTransferContainer(String componentId) throws Exception + public TransferContainer getTransferContainer(String componentId) { return getTransferContainerAsUser(getAdminUser(), componentId); } - public FilePlan getFilePlanAsUser(UserModel user, String componentId) throws Exception + public FilePlan getFilePlanAsUser(UserModel user, String componentId) { return getRestAPIFactory().getFilePlansAPI(user).getFilePlan(componentId); } - public FilePlan getFilePlan(String componentId) throws Exception + public FilePlan getFilePlan(String componentId) { return getFilePlanAsUser(getAdminUser(), componentId); } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 90db7d8d16..0044f48ddb 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -41,6 +41,7 @@ import static org.springframework.http.HttpStatus.ACCEPTED; import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.FORBIDDEN; +import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; @@ -66,6 +67,7 @@ import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -86,8 +88,9 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private UserModel userFillingPermission, userReadOnlyPermission; private SiteModel publicSite; private FolderModel testFolder; + private FileModel testFile; private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory, closedFolder; + private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory, closedRecordFolder; private UnfiledContainerChild unfiledContainerFolder; @Autowired @@ -111,7 +114,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { "rm/documentlibrary", DESTINATION_PATH_NOT_RESOLVED_EXC }, { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC }, // a closed record folder - { Utility.buildPath(recordCategory.getName(), closedFolder.getName()), CLOSED_RECORD_FOLDER_EXC}, + { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()), CLOSED_RECORD_FOLDER_EXC}, // an arbitrary unfiled records folder { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC }, // a collaboration site folder @@ -127,12 +130,11 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { return new String[][] { - { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId() }, - { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, - { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() }, + { getFilePlan(FILE_PLAN_ALIAS).getId() }, + { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, + { getTransferContainer(TRANSFERS_ALIAS).getId() }, { getContentService().getNodeRefByPath(getAdminUser().getUsername(), getAdminUser().getPassword(), "/Sites/rm/documentLibrary/Holds") }, { recordCategory.getId() }, - { closedFolder.getId() }, { unfiledContainerFolder.getId() }, { testFolder.getNodeRef() } }; @@ -154,8 +156,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder")); unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); - closedFolder = createFolder(recordCategory.getId(), getRandomName("closedFolder")); - closeFolder(closedFolder.getId()); + closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder")); + closeFolder(closedRecordFolder.getId()); STEP("Create rm users with different permissions on the record category"); userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING); @@ -163,6 +165,15 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS); } + @BeforeMethod(alwaysRun = true) + public void createDocument() throws Exception + { + STEP("Create a document in the collaboration site"); + testFile = dataContent.usingSite(publicSite) + .usingAdmin() + .createContent(CMISUtil.DocumentType.TEXT_PLAIN); + } + /** * Given I am calling the "declare as record" action * And I am not providing a location parameter value @@ -173,11 +184,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Test public void declareAndFileNoLocationUsingActionsAPI() throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingUser(userReadOnlyPermission) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record without providing a location parameter value using v1 actions api"); getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAsRecord(testFile); @@ -198,11 +204,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Test public void declareAndFileToValidLocationUsingActionsAPI() throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record with a location parameter value"); getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile, Utility.buildPath(recordCategory.getName(), recordFolder.getName())); @@ -224,11 +225,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Test (dataProvider = "invalidDestinationPaths") public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record with an invalid location parameter value"); getRestAPIFactory().getActionsAPI().declareAndFile(testFile, containerPath); assertStatusCode(ACCEPTED); @@ -253,11 +249,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Test public void declareAndFileToValidLocationUsingFilesAPI() throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record with a location parameter value"); Record record = getRestAPIFactory().getFilesAPI(userFillingPermission) .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) @@ -280,16 +271,14 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Test (dataProvider = "invalidDestinationIds") public void declareAndFileToInvalidLocationUsingFilesAPI(String containerID) throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record with an invalid location parameter value"); getRestAPIFactory().getFilesAPI() .usingParams(String.format("%s=%s", PARENT_ID_PARAM, containerID)) .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(BAD_REQUEST); + getRestAPIFactory().getRmRestWrapper() + .assertLastError() + .containsSummary("is not valid for this endpoint. Expected nodeType is:{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder"); STEP("Check that the file is not a record"); assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); @@ -298,16 +287,12 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest /** * Given I am an user with read only permissions on a record folder * When I declare and file a record to the record folder - * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder + * Then I receive an error indicating that the access is denied * And the document is not declared as a record */ @Test public void declareAndFileByUserWithReadOnlyPermission() throws Exception { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite).usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - STEP("Declare document as record with a record folder as location parameter"); getRestAPIFactory().getFilesAPI(userReadOnlyPermission) .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) @@ -321,7 +306,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest /** * Given I am a non RM user * When I declare and file a record to the record folder - * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder + * Then I receive an error indicating that the access is denied * And the document is not declared as a record */ @Test @@ -329,11 +314,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { STEP("Create an user with no rm rights"); UserModel nonRMUser = getDataUser().createRandomTestUser(); - getDataUser().addUserToSite(nonRMUser, publicSite, UserRole.SiteContributor); - - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite).usingUser(nonRMUser) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); + getDataUser().addUserToSite(nonRMUser, publicSite, UserRole.SiteCollaborator); STEP("Declare document as record with a record folder as location parameter"); getRestAPIFactory().getFilesAPI(nonRMUser) @@ -345,6 +326,48 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); } + /** + * Given I declare a record using the v1 API + * When I provide a nonexistent record folder in the location parameter + * Then I receive an error indicating that the record folder does not exist + * And the document is not declared as a record + */ + @Test + public void declareAndFileToNonexistentRecordFolderUsingFilesAPI() throws Exception + { + STEP("Declare document as record with a nonexistent location parameter value"); + getRestAPIFactory().getFilesAPI() + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, "nonexistent")) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); + assertStatusCode(NOT_FOUND); + + STEP("Check that the file is not a record"); + assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); + } + + + /** + * Given I declare a record using the v1 API + * When I provide a closed record folder in the location parameter + * Then I receive an error indicating that the record folder is closed + * And the document is not declared as a record + */ + @Test + public void declareAndFileToClosedRecordFolderUsingFilesAPI() throws Exception + { + STEP("Declare document as record with a closed location parameter value"); + getRestAPIFactory().getFilesAPI() + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, closedRecordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); + assertStatusCode(UNPROCESSABLE_ENTITY); + getRestAPIFactory().getRmRestWrapper() + .assertLastError() + .containsSummary(CLOSED_RECORD_FOLDER_EXC); + + STEP("Check that the file is not a record"); + assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); + } + /** * Given I declare a record using the v1 API * When I provide a location parameter From ba3acb3eed7747c37267fc7e8211938f43098850 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 16 May 2019 10:54:58 +0300 Subject: [PATCH 23/25] Added test for declaring and file a record into a held record folder --- .../rest/v0/RMRolesAndActionsAPI.java | 167 +++++++++++------- .../DeclareAndFileDocumentAsRecordTests.java | 35 +++- 2 files changed, 138 insertions(+), 64 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java index 2cc343a50a..94e0b25269 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java @@ -30,6 +30,7 @@ import static org.alfresco.dataprep.AlfrescoHttpClient.MIME_TYPE_JSON; import static org.alfresco.rest.core.v0.APIUtils.ISO_INSTANT_FORMATTER; import static org.apache.http.HttpStatus.SC_OK; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; import static org.testng.AssertJUnit.fail; @@ -47,6 +48,7 @@ import org.alfresco.dataprep.AlfrescoHttpClientFactory; import org.alfresco.dataprep.UserService; import org.alfresco.rest.core.v0.BaseAPI; import org.alfresco.rest.core.v0.RMEvents; +import org.alfresco.utility.Utility; import org.apache.chemistry.opencmis.client.api.CmisObject; import org.apache.commons.httpclient.HttpStatus; import org.apache.http.HttpResponse; @@ -72,6 +74,8 @@ import org.springframework.stereotype.Component; @Component public class RMRolesAndActionsAPI extends BaseAPI { + public static final String HOLDS_CONTAINER = "Holds"; + /** The URI to view the configured roles and capabilities. */ private static final String RM_ROLES = "{0}rma/admin/rmroles"; /** The URI for REST requests about a particular configured role. */ @@ -82,6 +86,8 @@ public class RMRolesAndActionsAPI extends BaseAPI private static final Logger LOGGER = LoggerFactory.getLogger(RMRolesAndActionsAPI.class); private static final String MOVE_ACTIONS_API = "action/rm-move-to/site/rm/documentLibrary/{0}"; private static final String CREATE_HOLDS_API = "{0}type/rma:hold/formprocessor"; + /** The URI to view the configured roles and capabilities. */ + private static final String RM_HOLDS_API = "{0}rma/holds"; /** http client factory */ @Autowired @@ -101,7 +107,8 @@ public class RMRolesAndActionsAPI extends BaseAPI public Set getConfiguredRoles(String adminUser, String adminPassword) { // Using "is=true" includes the in-place readers and writers. - JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject("data"); + final JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject( + "data"); return jsonObject.toMap().keySet(); } @@ -115,11 +122,31 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public Set getCapabilitiesForRole(String adminUser, String adminPassword, String role) { - JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject("data"); + final JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject( + "data"); assertTrue("Could not find role '" + role + "' in " + jsonObject.keySet(), jsonObject.has(role)); return jsonObject.getJSONObject(role).getJSONObject("capabilities").keySet(); } + /** + * Creates the body for PUT/POST Roles API requests + * + * @param roleName the role name + * @param roleDisplayLabel a human-readable label for the role + * @param capabilities a list of capabilities for the role + * @return + */ + private JSONObject roleRequestBody(String roleName, String roleDisplayLabel, Set capabilities) + { + final JSONObject requestBody = new JSONObject(); + requestBody.put("name", roleName); + requestBody.put("displayLabel", roleDisplayLabel); + final JSONArray capabilitiesArray = new JSONArray(); + capabilities.forEach(capabilitiesArray::put); + requestBody.put("capabilities", capabilitiesArray); + return requestBody; + } + /** * Create a new RM role. * @@ -131,13 +158,8 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public void createRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set capabilities) { - JSONObject requestBody = new JSONObject(); - requestBody.put("name", roleName); - requestBody.put("displayLabel", roleDisplayLabel); - JSONArray capabilitiesArray = new JSONArray(); - capabilities.forEach(capabilitiesArray::put); - requestBody.put("capabilities", capabilitiesArray); - doPostJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, requestBody, RM_ROLES); + doPostJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, roleRequestBody(roleName, roleDisplayLabel, capabilities), + RM_ROLES); } /** @@ -151,13 +173,8 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public void updateRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set capabilities) { - JSONObject requestBody = new JSONObject(); - requestBody.put("name", roleName); - requestBody.put("displayLabel", roleDisplayLabel); - JSONArray capabilitiesArray = new JSONArray(); - capabilities.forEach(capabilitiesArray::put); - requestBody.put("capabilities", capabilitiesArray); - doPutJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, requestBody, RM_ROLES_ROLE, roleName); + doPutJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, roleRequestBody(roleName, roleDisplayLabel, capabilities), + RM_ROLES_ROLE, roleName); } /** @@ -170,8 +187,8 @@ public class RMRolesAndActionsAPI extends BaseAPI public void deleteRole(String adminUser, String adminPassword, String roleName) { doDeleteRequest(adminUser, adminPassword, MessageFormat.format(RM_ROLES_ROLE, "{0}", roleName)); - boolean success = !getConfiguredRoles(adminUser, adminPassword).contains(roleName); - assertTrue("Failed to delete role " + roleName + " with " + adminUser, success); + assertFalse("Failed to delete role " + roleName + " with " + adminUser, + getConfiguredRoles(adminUser, adminPassword).contains(roleName)); } /** @@ -270,7 +287,7 @@ public class RMRolesAndActionsAPI extends BaseAPI } catch (JSONException | IOException e) { - e.printStackTrace(); + LOGGER.error(e.toString()); } finally { @@ -308,16 +325,40 @@ public class RMRolesAndActionsAPI extends BaseAPI } /** - * Perform an action on the record folder + * Perform an action on the given content * * @param user the user executing the action * @param password the user's password * @param contentName the content name * @return The HTTP response. */ - public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS rm_action) + public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS action) { - return executeAction(user, password, contentName, rm_action, null); + return executeAction(user, password, contentName, action, null); + } + + /** + * Creates the body for Actions API requests + * + * @param user the user executing the action + * @param password the user's password + * @param contentName the content on which the action is executed + * @param action the action executed + * @param actionsParams the request parameters + * @return the JSONObject created + */ + private JSONObject actionsRequestBody(String user, String password, String contentName, RM_ACTIONS action, + JSONObject actionsParams) + { + final String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName); + final JSONObject requestParams = new JSONObject(); + requestParams.put("name", action.getAction()); + requestParams.put("nodeRef", recNodeRef); + if (actionsParams != null) + { + requestParams.put("params", actionsParams); + } + return requestParams; } /** @@ -331,19 +372,12 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS action, ZonedDateTime date) { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName); - JSONObject requestParams = new JSONObject(); - requestParams.put("name", action.getAction()); - requestParams.put("nodeRef", recNodeRef); + final JSONObject actionParams = new JSONObject(); if (date != null) { - String thisMoment = date.format(ISO_INSTANT_FORMATTER); - requestParams.put("params", new JSONObject() - .put("asOfDate", new JSONObject() - .put("iso8601", thisMoment) - ) - ); + actionParams.put("asOfDate", new JSONObject().put("iso8601", ISO_INSTANT_FORMATTER.format(date))); } + final JSONObject requestParams = actionsRequestBody(user, password, contentName, action, actionParams); return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); } @@ -359,20 +393,14 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public HttpResponse completeEvent(String user, String password, String nodeName, RMEvents event, Instant date) { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, nodeName); - JSONObject requestParams = new JSONObject(); - requestParams.put("name", RM_ACTIONS.COMPLETE_EVENT.getAction()); - requestParams.put("nodeRef", recNodeRef); date = (date != null) ? date : Instant.now(); - String formattedDate = ISO_INSTANT_FORMATTER.format(date); - requestParams.put("params", new JSONObject() - .put("eventName", event.getEventName()) - .put("eventCompletedBy", user) - .put("eventCompletedAt", new JSONObject() - .put("iso8601", formattedDate) - ) - ); - + final JSONObject actionParams = new JSONObject().put("eventName", event.getEventName()) + .put("eventCompletedBy", user) + .put("eventCompletedAt", new JSONObject() + .put("iso8601", ISO_INSTANT_FORMATTER.format(date)) + ); + final JSONObject requestParams = actionsRequestBody(user, password, nodeName, RM_ACTIONS.COMPLETE_EVENT, + actionParams); return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); } @@ -387,13 +415,8 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public HttpResponse undoEvent(String user, String password, String contentName, RMEvents event) { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName); - JSONObject requestParams = new JSONObject(); - requestParams.put("name", RM_ACTIONS.UNDO_EVENT.getAction()); - requestParams.put("nodeRef", recNodeRef); - requestParams.put("params", new JSONObject() - .put("eventName", event.getEventName())); - + final JSONObject requestParams = actionsRequestBody(user, password, contentName, RM_ACTIONS.UNDO_EVENT, + new JSONObject().put("eventName", event.getEventName())); return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); } @@ -412,8 +435,8 @@ public class RMRolesAndActionsAPI extends BaseAPI { item.delete(); } - boolean success = !(contentService.getFolderObject(contentService.getCMISSession(username, password), siteId, containerName).getChildren().getHasMoreItems()); - assertTrue("Not all items were deleted from " + containerName, success); + assertFalse("Not all items were deleted from " + containerName, + contentService.getFolderObject(contentService.getCMISSession(username, password), siteId, containerName).getChildren().getHasMoreItems()); } /** @@ -426,10 +449,9 @@ public class RMRolesAndActionsAPI extends BaseAPI */ public void deleteHold(String username, String password, String holdName) { - deleteItem(username, password, "/Holds/" + holdName); + deleteItem(username, password, String.format("/%s/%s", HOLDS_CONTAINER, holdName)); } - /** * Util method to create a hold * @@ -443,29 +465,50 @@ public class RMRolesAndActionsAPI extends BaseAPI public HttpResponse createHold(String user, String password, String holdName, String reason, String description) { // if the hold already exists don't try to create it again - String holdsContainerPath = getFilePlanPath() + "/Holds"; - String fullHoldPath = holdsContainerPath + "/" + holdName; - CmisObject hold = getObjectByPath(user, password, fullHoldPath); + final String holdsContainerPath = Utility.buildPath(getFilePlanPath(), HOLDS_CONTAINER); + final String fullHoldPath = holdsContainerPath + holdName; + final CmisObject hold = getObjectByPath(user, password, fullHoldPath); if (hold != null) { return null; } // retrieve the Holds container nodeRef - String parentNodeRef = getItemNodeRef(user, password, "/Holds"); + final String parentNodeRef = getItemNodeRef(user, password, "/" + HOLDS_CONTAINER); - JSONObject requestParams = new JSONObject(); + final JSONObject requestParams = new JSONObject(); requestParams.put("alf_destination", getNodeRefSpacesStore() + parentNodeRef); requestParams.put("prop_cm_name", holdName); requestParams.put("prop_cm_description", description); requestParams.put("prop_rma_holdReason", reason); // Make the POST request and throw an assertion error if it fails. - HttpResponse httpResponse = doPostJsonRequest(user, password, SC_OK, requestParams, CREATE_HOLDS_API); + final HttpResponse httpResponse = doPostJsonRequest(user, password, SC_OK, requestParams, CREATE_HOLDS_API); assertNotNull("Expected object to have been created at " + fullHoldPath, getObjectByPath(user, password, fullHoldPath)); return httpResponse; } + /** + * Adds item (record/ record folder) to the hold + * + * @param user the user who adds the item to the hold + * @param password the user's password + * @param itemNodeRef the nodeRef of the item to be added to hold + * @param holdName the hold name + * @return The HTTP response + */ + public HttpResponse addItemToHold(String user, String password, String itemNodeRef, String holdName) + { + final JSONArray nodeRefs = new JSONArray().put(getNodeRefSpacesStore() + itemNodeRef); + final String holdNodeRef = getItemNodeRef(user, password, String.format("/%s/%s", HOLDS_CONTAINER, holdName)); + final JSONArray holds = new JSONArray().put(getNodeRefSpacesStore() + holdNodeRef); + final JSONObject requestParams = new JSONObject(); + requestParams.put("nodeRefs", nodeRefs); + requestParams.put("holds", holds); + + return doPostJsonRequest(user, password, SC_OK, requestParams, RM_HOLDS_API); + } + /** * Updates metadata, can be used on records, folders and categories * diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 0044f48ddb..ca6aaab85a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -34,6 +34,7 @@ import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSI import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM; +import static org.alfresco.rest.v0.RMRolesAndActionsAPI.HOLDS_CONTAINER; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.alfresco.utility.data.RandomData.getRandomName; import static org.alfresco.utility.report.log.Step.STEP; @@ -56,6 +57,7 @@ import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; import org.alfresco.rest.rm.community.util.DockerHelper; +import org.alfresco.rest.v0.RMRolesAndActionsAPI; import org.alfresco.rest.v0.service.RoleService; import org.alfresco.test.AlfrescoTest; import org.alfresco.utility.Utility; @@ -84,6 +86,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid."; private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder."; private final static String CLOSED_RECORD_FOLDER_EXC = "Unable to create record, because container is closed"; + private final static String HOLD_NAME = "holdName"; private UserModel userFillingPermission, userReadOnlyPermission; private SiteModel publicSite; @@ -99,6 +102,9 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest @Autowired private RoleService roleService; + @Autowired + private RMRolesAndActionsAPI rmRolesAndActionsAPI; + /** * Invalid destination paths where in-place records can't be filed */ @@ -133,7 +139,8 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { getFilePlan(FILE_PLAN_ALIAS).getId() }, { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, { getTransferContainer(TRANSFERS_ALIAS).getId() }, - { getContentService().getNodeRefByPath(getAdminUser().getUsername(), getAdminUser().getPassword(), "/Sites/rm/documentLibrary/Holds") }, + { rmRolesAndActionsAPI.getItemNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), + "/" + HOLDS_CONTAINER) }, { recordCategory.getId() }, { unfiledContainerFolder.getId() }, { testFolder.getNodeRef() } @@ -345,7 +352,6 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); } - /** * Given I declare a record using the v1 API * When I provide a closed record folder in the location parameter @@ -368,6 +374,31 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); } + /** + * Given I declare a record using the v1 API + * When I provide a held record folder in the location parameter + * Then I receive an error indicating that the record folder is held + * And the document is not declared as a record + */ + @Test + public void declareAndFileToHeldRecordFolderUsingFilesAPI() throws Exception + { + RecordCategoryChild heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder")); + rmRolesAndActionsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, + "hold reason", "hold description"); + rmRolesAndActionsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), + heldRecordFolder.getId(), HOLD_NAME); + + STEP("Declare document as record with a frozen location parameter value"); + getRestAPIFactory().getFilesAPI() + .usingParams(String.format("%s=%s", PARENT_ID_PARAM, heldRecordFolder.getId())) + .declareAsRecord(testFile.getNodeRefWithoutVersion()); + assertStatusCode(UNPROCESSABLE_ENTITY); + + STEP("Check that the file is not a record"); + assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); + } + /** * Given I declare a record using the v1 API * When I provide a location parameter From 8f49086a060d37d94023819b8298f212036ebae8 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 16 May 2019 14:27:13 +0300 Subject: [PATCH 24/25] Updated exception message --- .../files/DeclareAndFileDocumentAsRecordTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index ca6aaab85a..ab89fe6869 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -82,7 +82,7 @@ import org.testng.annotations.Test; @AlfrescoTest (jira = "RM-6779") public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { - private final static String DESTINATION_PATH_NOT_RESOLVED_EXC = "Unable to execute create-record action, because the destination path could not be resolved."; + private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute create-record action, because the destination path could not be found."; private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid."; private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder."; private final static String CLOSED_RECORD_FOLDER_EXC = "Unable to create record, because container is closed"; @@ -113,18 +113,18 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { return new String[][] { - { "/", DESTINATION_PATH_NOT_RESOLVED_EXC}, + { "/", DESTINATION_PATH_NOT_FOUND_EXC }, { "Unfiled Records", INVALID_DESTINATION_PATH_EXC }, { "Transfers", INVALID_DESTINATION_PATH_EXC }, { "Holds", INVALID_DESTINATION_PATH_EXC }, - { "rm/documentlibrary", DESTINATION_PATH_NOT_RESOLVED_EXC }, + { "rm/documentlibrary", DESTINATION_PATH_NOT_FOUND_EXC }, { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC }, // a closed record folder { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()), CLOSED_RECORD_FOLDER_EXC}, // an arbitrary unfiled records folder { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC }, // a collaboration site folder - { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_RESOLVED_EXC } + { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_FOUND_EXC } }; } From 284ea22322d4b042122575718614efe0e0b08354 Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 20 May 2019 16:58:35 +0300 Subject: [PATCH 25/25] addressed code review comments --- .../main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java index 94e0b25269..2a98261c7e 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java @@ -465,8 +465,7 @@ public class RMRolesAndActionsAPI extends BaseAPI public HttpResponse createHold(String user, String password, String holdName, String reason, String description) { // if the hold already exists don't try to create it again - final String holdsContainerPath = Utility.buildPath(getFilePlanPath(), HOLDS_CONTAINER); - final String fullHoldPath = holdsContainerPath + holdName; + final String fullHoldPath = Utility.buildPath(getFilePlanPath(), HOLDS_CONTAINER) + holdName; final CmisObject hold = getObjectByPath(user, password, fullHoldPath); if (hold != null) {