From 69e1db0845791fb95781e6cdce19a62c13601d70 Mon Sep 17 00:00:00 2001 From: estan Date: Mon, 7 Dec 2020 09:44:33 +0200 Subject: [PATCH 01/13] APPS-659 - [Upgrade] Search Result points to incorrect link to Folder on Hold --first commit --- .../patch/rm-patch-v34-context.xml | 19 +++ .../org_alfresco_module_rm/version.properties | 2 +- .../v34/RMv34HoldNewChildAssocPatch.java | 112 ++++++++++++++++++ 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml new file mode 100644 index 0000000000..10ad11d44e --- /dev/null +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties index 6830ad62fe..a36517e08d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties @@ -1,3 +1,3 @@ # RM Schema number -version.rm.schema=3300 +version.rm.schema=3410 diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java new file mode 100644 index 0000000000..7901f568c7 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java @@ -0,0 +1,112 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2020 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.module.org_alfresco_module_rm.patch.v34; + +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_RECORDS; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * Patch to create new hold child association to link the record to the hold + * + * See: https://alfresco.atlassian.net/browse/APPS-659 + * + * + * @since 3.4.1 + */ +public class RMv34HoldNewChildAssocPatch extends AbstractModulePatch +{ + /** + * Data abstraction layer for QName and Namespace entities. + */ + private QNameDAO qnameDAO; + + /** + * File plan service interface + */ + private FilePlanService filePlanService; + + /** + * Hold service interface. + */ + private HoldService holdService; + + /** + * Interface for public and internal node and store operations. + */ + private NodeService nodeService; + + /** + * Setter for fileplanservice + * @param filePlanService File plan service interface + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Setter for hold service + * @param holdService Hold service interface. + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * Setter for node service + * @param nodeService Interface for public and internal node and store operations. + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + @Override + public void applyInternal() + { + for (NodeRef filePlan : filePlanService.getFilePlans()) + { + for (NodeRef hold : holdService.getHolds(filePlan)) + { + for (ChildAssociationRef ref : nodeService.getChildAssocs(hold)) + { + holdService.removeFromHold(hold, ref.getChildRef()); + holdService.addToHold(hold, ref.getChildRef()); + } + } + } + } +} From 72c1390c659381beacc1801bc59c6e6231ceaee3 Mon Sep 17 00:00:00 2001 From: estan Date: Wed, 9 Dec 2020 10:14:46 +0200 Subject: [PATCH 02/13] APPS-659 - [Upgrade] Search Result points to incorrect link to Folder --- .../patch/rm-patch-v34-context.xml | 3 ++- .../patch/v34/RMv34HoldNewChildAssocPatch.java | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml index 10ad11d44e..bf2197a8a8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml @@ -11,7 +11,8 @@ class="org.alfresco.module.org_alfresco_module_rm.patch.v34.RMv34HoldNewChildAssocPatch"> - + + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java index 7901f568c7..c3fc3a798d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java @@ -26,13 +26,9 @@ */ package org.alfresco.module.org_alfresco_module_rm.patch.v34; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_RECORDS; - import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.domain.qname.QNameDAO; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; @@ -47,11 +43,6 @@ import org.alfresco.service.cmr.repository.NodeService; */ public class RMv34HoldNewChildAssocPatch extends AbstractModulePatch { - /** - * Data abstraction layer for QName and Namespace entities. - */ - private QNameDAO qnameDAO; - /** * File plan service interface */ From c5db115320a612d26759cf86a27ffd53fae23f37 Mon Sep 17 00:00:00 2001 From: estan Date: Tue, 15 Dec 2020 22:40:27 +0200 Subject: [PATCH 03/13] APPS-659 : [Upgrade] Search Result points to incorrect link to Folder on Hold --disable behaviours --- .../patch/rm-patch-v34-context.xml | 6 ++-- .../v34/RMv34HoldNewChildAssocPatch.java | 34 ++++++++++++++++--- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml index bf2197a8a8..513194a8e0 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml @@ -10,9 +10,9 @@ parent="rm.parentModulePatch" class="org.alfresco.module.org_alfresco_module_rm.patch.v34.RMv34HoldNewChildAssocPatch"> - - - + + + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java index c3fc3a798d..493a77180d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java @@ -26,9 +26,11 @@ */ package org.alfresco.module.org_alfresco_module_rm.patch.v34; +import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; @@ -58,6 +60,8 @@ public class RMv34HoldNewChildAssocPatch extends AbstractModulePatch */ private NodeService nodeService; + private BehaviourFilter behaviourFilter; + /** * Setter for fileplanservice * @param filePlanService File plan service interface @@ -85,19 +89,39 @@ public class RMv34HoldNewChildAssocPatch extends AbstractModulePatch this.nodeService = nodeService; } + public BehaviourFilter getBehaviourFilter() + { + return behaviourFilter; + } + + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + @Override public void applyInternal() { - for (NodeRef filePlan : filePlanService.getFilePlans()) + behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); + behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); + try { - for (NodeRef hold : holdService.getHolds(filePlan)) + for (NodeRef filePlan : filePlanService.getFilePlans()) { - for (ChildAssociationRef ref : nodeService.getChildAssocs(hold)) + for (NodeRef hold : holdService.getHolds(filePlan)) { - holdService.removeFromHold(hold, ref.getChildRef()); - holdService.addToHold(hold, ref.getChildRef()); + for (ChildAssociationRef ref : nodeService.getChildAssocs(hold)) + { + holdService.removeFromHold(hold, ref.getChildRef()); + holdService.addToHold(hold, ref.getChildRef()); + } } } } + finally + { + behaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); + behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); + } } } From 688f74e400e38665bb4708202e43eeb8fc431f96 Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Thu, 7 Jan 2021 19:54:00 +0200 Subject: [PATCH 04/13] add the possibility to login when using Identity Service --- .../rm-automation-community-rest-api/pom.xml | 12 +++++++++++- .../org/alfresco/rest/v0/RMRolesAndActionsAPI.java | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index f178cc8d3b..e41c879044 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -15,7 +15,8 @@ false alfresco-governance-services-community-share alfresco-governance-services-community-repo - 1.38 + 1.50 + 3.0.41 2.0.0 2.7.9.1 @@ -61,8 +62,17 @@ com.fasterxml.jackson.core jackson-databind + + org.alfresco.tas + utility + + + org.alfresco.tas + utility + ${tas.utility.version} + org.projectlombok lombok 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 6ce10de83d..4284d7e6f4 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 @@ -47,6 +47,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.data.DataUserAIS; import org.apache.chemistry.opencmis.client.api.CmisObject; import org.apache.commons.httpclient.HttpStatus; import org.apache.http.HttpResponse; @@ -90,6 +91,8 @@ public class RMRolesAndActionsAPI extends BaseAPI @Autowired private UserService userService; + @Autowired + private DataUserAIS dataUser; /** * Get all the configured RM roles. * @@ -199,7 +202,9 @@ public class RMRolesAndActionsAPI extends BaseAPI { if (!userService.userExists(adminUser, adminPassword, userName)) { - userService.create(adminUser, adminPassword, userName, password, email, firstName, lastName); + //userService.create(adminUser, adminPassword, userName, password, email, firstName, lastName); + dataUser.createUser(userName, password); + } assignRoleToUser(adminUser, adminPassword, userName, role); } From 8e98326de8fb6d2c053fb1bdaaf62867ee69401e Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Mon, 11 Jan 2021 16:58:46 +0200 Subject: [PATCH 05/13] additional changes to use the utility that can create users when using Identity Service --- .../main/java/org/alfresco/rest/core/RestAPIFactory.java | 9 ++++----- .../rest/v0/service/DispositionScheduleService.java | 4 ++-- .../org/alfresco/rest/v0/service/RMAuditService.java | 4 ++-- .../java/org/alfresco/rest/v0/service/RoleService.java | 3 ++- .../alfresco/rest/rm/community/base/BaseRMRestTest.java | 5 ++--- 5 files changed, 12 insertions(+), 13 deletions(-) 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 13bd6e21d2..d26fd26d37 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 @@ -30,6 +30,8 @@ import static lombok.AccessLevel.PROTECTED; import javax.annotation.Resource; +import lombok.Getter; +import lombok.Setter; import org.alfresco.rest.requests.Node; import org.alfresco.rest.requests.coreAPI.RestCoreAPI; import org.alfresco.rest.requests.search.SearchAPI; @@ -46,16 +48,13 @@ import org.alfresco.rest.rm.community.requests.gscore.api.TransferAPI; import org.alfresco.rest.rm.community.requests.gscore.api.TransferContainerAPI; import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.data.DataUserAIS; import org.alfresco.utility.model.RepoTestModel; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import lombok.Getter; -import lombok.Setter; - /** * REST API Factory which provides access to the APIs * @@ -68,7 +67,7 @@ public class RestAPIFactory { @Autowired @Getter (value = PROTECTED) - private DataUser dataUser; + private DataUserAIS dataUser; @Resource(name = "RMRestWrapper") @Getter diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java index 930e8811e8..9fa6db0860 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java @@ -31,7 +31,7 @@ import java.util.HashMap; import org.alfresco.rest.core.v0.BaseAPI; import org.alfresco.rest.v0.RecordCategoriesAPI; -import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.data.DataUserAIS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,7 +48,7 @@ public class DispositionScheduleService extends BaseAPI private RecordCategoriesAPI recordCategoriesAPI; @Autowired - private DataUser dataUser; + private DataUserAIS dataUser; /** * Helper method for adding a retain after period step diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java index 3a8d4f4fc2..8a4e1fefe4 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java @@ -35,7 +35,7 @@ import java.util.List; import org.alfresco.rest.rm.community.model.audit.AuditEntry; import org.alfresco.rest.rm.community.model.audit.AuditEvents; import org.alfresco.rest.v0.RMAuditAPI; -import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.data.DataUserAIS; import org.alfresco.utility.model.UserModel; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +54,7 @@ public class RMAuditService private RMAuditAPI rmAuditAPI; @Autowired - private DataUser dataUser; + private DataUserAIS dataUser; /** * Clear the list of audit entries as admin user. 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 a62b24ccf8..afecd9c92b 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 @@ -40,6 +40,7 @@ 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.data.DataUserAIS; import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; @@ -60,7 +61,7 @@ public class RoleService @Autowired @Getter (value = PROTECTED) - private DataUser dataUser; + private DataUserAIS dataUser; @Autowired @Getter (value = PROTECTED) 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 720a6fc662..1b57359633 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 @@ -75,7 +75,6 @@ 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.unfiledcontainer.UnfiledContainerChildEntry; -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; @@ -85,7 +84,7 @@ import org.alfresco.rest.search.SearchNodeModel; import org.alfresco.rest.search.SearchRequest; import org.alfresco.rest.v0.SearchAPI; import org.alfresco.utility.Utility; -import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.data.DataUserAIS; import org.alfresco.utility.model.ContentModel; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FolderModel; @@ -111,7 +110,7 @@ public class BaseRMRestTest extends RestTest @Autowired @Getter (value = PROTECTED) - private DataUser dataUser; + protected DataUserAIS dataUser; @Autowired @Getter(value = PROTECTED) From fed5acf63c231116a8c7213dd8e56c52405849d4 Mon Sep 17 00:00:00 2001 From: estan Date: Mon, 11 Jan 2021 21:47:33 +0200 Subject: [PATCH 06/13] APPS-659 [Upgrade] Search Result points to incorrect link to Folder on Hold --- .../patch/v34/RMv34HoldNewChildAssocPatch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java index 493a77180d..39a77b22f8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java @@ -2,7 +2,7 @@ * #%L * Alfresco Records Management Module * %% - * Copyright (C) 2005 - 2020 Alfresco Software Limited + * Copyright (C) 2005 - 2021 Alfresco Software Limited * %% * This file is part of the Alfresco software. * - From 018aee74e8fb10c5de2308e51c1c16b7ac9ee5dc Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Tue, 19 Jan 2021 09:36:15 +0200 Subject: [PATCH 07/13] remove the parameters not used in the method createUserAndAssignToRole --- .../main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java | 5 +---- 1 file changed, 1 insertion(+), 4 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 4284d7e6f4..672cc3f489 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 @@ -195,10 +195,7 @@ public class RMRolesAndActionsAPI extends BaseAPI String adminPassword, String userName, String password, - String email, - String role, - String firstName, - String lastName) + String role) { if (!userService.userExists(adminUser, adminPassword, userName)) { From b5be6c602719e5b69827a916947c888d4ab1498d Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Tue, 19 Jan 2021 09:43:37 +0200 Subject: [PATCH 08/13] remove the commented method --- .../src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java | 1 - 1 file changed, 1 deletion(-) 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 672cc3f489..7f524b0121 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 @@ -199,7 +199,6 @@ public class RMRolesAndActionsAPI extends BaseAPI { if (!userService.userExists(adminUser, adminPassword, userName)) { - //userService.create(adminUser, adminPassword, userName, password, email, firstName, lastName); dataUser.createUser(userName, password); } From 0d54336a22154af9906ae6918680d2614e0b05a6 Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Thu, 21 Jan 2021 09:01:46 +0200 Subject: [PATCH 09/13] review changes & changes to replace userService method that create uses --- rm-automation/rm-automation-community-rest-api/pom.xml | 10 +++++----- .../rest/rm/community/util/CommonTestUtils.java | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index e41c879044..202a565fe6 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -58,15 +58,15 @@ restapi ${tas.restapi.version} - - com.fasterxml.jackson.core - jackson-databind - + + com.fasterxml.jackson.core + jackson-databind + org.alfresco.tas utility - + org.alfresco.tas diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java index 7c8b528af0..dbe6a0862d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java @@ -37,6 +37,11 @@ import java.util.UUID; */ public class CommonTestUtils { + /** + * The default pattern used for the user full name when users are created with tas utility + */ + public static final String USER_FULLNAME_PATTERN = "FN-%1$s LN-%1$s"; + /** Private constructor to prevent instantiation. */ private CommonTestUtils() { From 1c03a3028bbd3ae974a11e8351825001344f9264 Mon Sep 17 00:00:00 2001 From: estan Date: Thu, 21 Jan 2021 10:38:33 +0200 Subject: [PATCH 10/13] APPS-659 [Upgrade] Search Result points to incorrect link to Folder on Hold --added test and renamed from 3.4 to 3.5 --- ...4-context.xml => rm-patch-v35-context.xml} | 2 +- .../RMv35HoldNewChildAssocPatch.java} | 6 +- .../RMv35HoldNewChildAssocPatchUnitTest.java | 133 ++++++++++++++++++ 3 files changed, 137 insertions(+), 4 deletions(-) rename rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/{rm-patch-v34-context.xml => rm-patch-v35-context.xml} (96%) rename rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/{v34/RMv34HoldNewChildAssocPatch.java => v35/RMv35HoldNewChildAssocPatch.java} (96%) create mode 100644 rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml similarity index 96% rename from rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml rename to rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml index 513194a8e0..9f52cdc488 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v34-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml @@ -8,7 +8,7 @@ + class="org.alfresco.module.org_alfresco_module_rm.patch.v35.RMv35HoldNewChildAssocPatch"> diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java similarity index 96% rename from rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java rename to rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java index 39a77b22f8..0b620d07df 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v34/RMv34HoldNewChildAssocPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java @@ -24,7 +24,7 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.module.org_alfresco_module_rm.patch.v34; +package org.alfresco.module.org_alfresco_module_rm.patch.v35; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; @@ -41,9 +41,9 @@ import org.alfresco.service.cmr.repository.NodeService; * See: https://alfresco.atlassian.net/browse/APPS-659 * * - * @since 3.4.1 + * @since 3.5 */ -public class RMv34HoldNewChildAssocPatch extends AbstractModulePatch +public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch { /** * File plan service interface diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java new file mode 100644 index 0000000000..e8b5a3c4b5 --- /dev/null +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java @@ -0,0 +1,133 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2021 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.module.org_alfresco_module_rm.patch.v35; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * RM V3.5 Create new hold child association to link the record to the hold + * + * @since 3.5 + */ +public class RMv35HoldNewChildAssocPatchUnitTest +{ + @Mock + private FilePlanService filePlanService; + + @Mock + private HoldService holdService; + + @Mock + private NodeService nodeService; + + @Mock + private BehaviourFilter behaviourFilter; + + @InjectMocks + private RMv35HoldNewChildAssocPatch patch; + + private NodeRef filePlanRef, holdRef, heldItemRef; + private Set fileplans; + private List holds; + + @Mock + private ChildAssociationRef childAssociationRef; + + private List childAssocs; + + @Before + public void setUp() + { + MockitoAnnotations.initMocks(this); + filePlanRef = new NodeRef("workspace://SpacesStore/filePlan"); + holdRef = new NodeRef("workspace://SpacesStore/hold"); + heldItemRef = new NodeRef("workspace://SpacesStore/heldItem"); + fileplans = new HashSet<>(); + fileplans.add(filePlanRef); + holds = new ArrayList<>(); + holds.add(holdRef); + childAssocs = new ArrayList<>(); + childAssocs.add(childAssociationRef); + } + + /** + * Test held items are removed from a hold and re-add to make sure the association is correct + */ + @Test + public void testAHoldIsRemovedAndReplacedDuringUpgrade() + { + when(filePlanService.getFilePlans()).thenReturn(fileplans); + when(holdService.getHolds(filePlanRef)).thenReturn(holds); + when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); + when(nodeService.getChildAssocs(holdRef)).thenReturn(childAssocs); + patch.applyInternal(); + verify(holdService, times(1)).removeFromHold(holdRef, heldItemRef); + verify(holdService, times(1)).addToHold(holdRef, heldItemRef); + } + + @Test + public void patchRunWithSuccessWhenNoHoldEntries() + { + //no holds + List holdList = new ArrayList<>(); + when(filePlanService.getFilePlans()).thenReturn(fileplans); + when(holdService.getHolds(filePlanRef)).thenReturn(holdList); + + verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(holdService, times(0)).addToHold(holdRef, heldItemRef); + + //child assocs + holdList.add(holdRef); + when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); + when(nodeService.getChildAssocs(holdRef)).thenReturn(new ArrayList<>()); + patch.applyInternal(); + verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(holdService, times(0)).addToHold(holdRef, heldItemRef); + + } + +} From 15c9459c02feaf37b12b0e4e5042605f006dbe0f Mon Sep 17 00:00:00 2001 From: estan Date: Thu, 21 Jan 2021 10:40:34 +0200 Subject: [PATCH 11/13] APPS-659 [Upgrade] Search Result points to incorrect link to Folder on Hold --changed version.properties --- .../alfresco/module/org_alfresco_module_rm/version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties index a36517e08d..a8d3e2c6b3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties @@ -1,3 +1,3 @@ # RM Schema number -version.rm.schema=3410 +version.rm.schema=3500 From b8b1e4735493aa22e9c91707b7b1f70364a23c69 Mon Sep 17 00:00:00 2001 From: estan Date: Thu, 21 Jan 2021 10:42:02 +0200 Subject: [PATCH 12/13] APPS-659 [Upgrade] Search Result points to incorrect link to Folder on Hold --fixed fixedToSchema --- .../org_alfresco_module_rm/patch/rm-patch-v35-context.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml index 9f52cdc488..05d77d40ef 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml @@ -11,7 +11,7 @@ class="org.alfresco.module.org_alfresco_module_rm.patch.v35.RMv35HoldNewChildAssocPatch"> - + From 2e568c1328d4926a0d0bf5c11a1e895472af955d Mon Sep 17 00:00:00 2001 From: estan Date: Mon, 25 Jan 2021 10:20:58 +0200 Subject: [PATCH 13/13] APPS-659 [Upgrade] Search Result points to incorrect link to Folder on Hold --fixed test --- .../patch/rm-patch-v35-context.xml | 2 +- .../RMv35HoldNewChildAssocPatchUnitTest.java | 67 +++++++++++++------ 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml index 05d77d40ef..63ccdb75e8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + holdList = new ArrayList<>(); - when(filePlanService.getFilePlans()).thenReturn(fileplans); - when(holdService.getHolds(filePlanRef)).thenReturn(holdList); - - verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); - verify(holdService, times(0)).addToHold(holdRef, heldItemRef); - - //child assocs holdList.add(holdRef); when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); - when(nodeService.getChildAssocs(holdRef)).thenReturn(new ArrayList<>()); + when(mockNodeService.getChildAssocs(holdRef)).thenReturn(new ArrayList<>()); patch.applyInternal(); - verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); - verify(holdService, times(0)).addToHold(holdRef, heldItemRef); + + verify(mockHoldService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(mockHoldService, times(0)).addToHold(holdRef, heldItemRef); } + @Test + public void patchRunWithSuccessWhenNoHolds() + { + //no holds + List holdList = new ArrayList<>(); + when(mockFilePlanService.getFilePlans()).thenReturn(fileplans); + when(mockHoldService.getHolds(filePlanRef)).thenReturn(holdList); + patch.applyInternal(); + + verify(mockHoldService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(mockHoldService, times(0)).addToHold(holdRef, heldItemRef); + } + + @Test + public void patchRunWithSuccessWhenNoFilePlan() + { + // given + doReturn(Collections.EMPTY_SET).when(mockFilePlanService).getFilePlans(); + + // when + patch.applyInternal(); + + // then + verifyZeroInteractions(mockHoldService); + verify(mockNodeService, times(0)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); + } }