From 69e1db0845791fb95781e6cdce19a62c13601d70 Mon Sep 17 00:00:00 2001 From: estan Date: Mon, 7 Dec 2020 09:44:33 +0200 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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); + } } }