From 1dab98b65402a4c2baf94fb6e479de9ce3e27c38 Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Tue, 9 Feb 2016 20:13:28 +0000 Subject: [PATCH 1/8] RM-2709 (The Add Relationship dialog is not displayed properly and is unusable on Alfresco 5.1) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index abdc460f49..b5ba64839c 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ - 5.0 + 5.0.2 org.postgresql.Driver From 1dbc47aa8c852c32e3cd0da681d12c0feb641b40 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Mon, 15 Feb 2016 14:24:46 +0000 Subject: [PATCH 2/8] RM-2776 Move SortDirection to rm-community. This is a general-use enum, and so it should be somewhere fairly accessible. --- .../java/org/alfresco/util/SortDirection.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java 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 new file mode 100644 index 0000000000..02c73d580e --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.util; + +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * Enumeration for sort direction. + * + * @author Tuna Aksoy + * @since 2.5 + */ +public enum SortDirection +{ + ASC ("asc"), + DESC ("desc"); + + /** A string representation of the sort direction. */ + private final String sortDirection; + + private SortDirection(String sortDirection) + { + this.sortDirection = sortDirection; + } + + /** + * Get the appropriate {@code SortDirection} from a string representation. + * + * @param sortDirectionString A string representation (case will be ignored). + * @return The {@code SortDirection} value. + */ + public static SortDirection getSortDirection(String sortDirectionString) + { + SortDirection sortDirection = null; + + for (SortDirection value : values()) + { + if (value.sortDirection.equalsIgnoreCase(sortDirectionString)) + { + sortDirection = value; + break; + } + } + + if (sortDirection == null) + { + throw new AlfrescoRuntimeException("Sort direction '" + sortDirection +"' unknown."); + } + + return sortDirection; + } +} From 8e6bc4b9041a578de6fd3fffcd32718efb19eb27 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Wed, 17 Feb 2016 10:29:35 +0000 Subject: [PATCH 3/8] Update version to 2.3.0.2-SNAPSHOT. --- pom.xml | 2 +- rm-automation/pom.xml | 2 +- .../alfresco/module/org_alfresco_module_rm/module.properties | 2 +- rm-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index f7de549206..828e33a1b4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.alfresco alfresco-rm-parent pom - 2.3.0.1-SNAPSHOT + 2.3.0.2-SNAPSHOT Alfresco Records Management http://www.alfresco.org/ diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index 5d0b28da47..cca0bb4a72 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.1-SNAPSHOT + 2.3.0.2-SNAPSHOT 4.0.0 alfresco-rm-automation diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties index 8b53f83020..8468aa0c5c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties @@ -6,6 +6,6 @@ module.aliases=org_alfresco_module_dod5015 module.title=Records Management module.description=Alfresco Record Management Extension -module.version=2.3.0.1 +module.version=2.3.0.2 module.repo.version.min=4.2.2 \ No newline at end of file diff --git a/rm-server/pom.xml b/rm-server/pom.xml index 1f928dd9eb..3e4d20fbef 100644 --- a/rm-server/pom.xml +++ b/rm-server/pom.xml @@ -5,7 +5,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.1-SNAPSHOT + 2.3.0.2-SNAPSHOT 4.0.0 alfresco-rm-server From a4d58e5fce2eb0b90480018af805cbebb959a1e9 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Wed, 17 Feb 2016 10:50:05 +0000 Subject: [PATCH 4/8] RM-2968 Update disposition query used to find nodes to cutoff or retain. --- .../job/DispositionLifecycleJobExecuter.java | 6 +++--- .../DispositionLifecycleJobExecuterUnitTest.java | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java index 94ada57f76..665c95910b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java @@ -108,7 +108,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute * * @return job query string */ - private String getQuery() + protected String getQuery() { if (query == null) { @@ -133,8 +133,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute } sb.append("))"); - sb.append(" AND ISNULL:\"rma:dispositionActionCompletedAt\" "); - sb.append(" + ( "); + sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" "); + sb.append(" AND ( "); sb.append("@rma\\:dispositionEventsEligible:true "); sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); sb.append(") "); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java index 813cb9611b..ced4613d26 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java @@ -18,6 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.job; +import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; @@ -228,4 +229,17 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest // ensure no more interactions verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService); } + + /** + * Brittle unit test that simply checks the generated query is an exact string when the supplied disposition actions + * are "CUTOFF" and "RETAIN" (see {@link #before}). + */ + @Test + public void testGetQuery() + { + String actual = executer.getQuery(); + + String expected = "TYPE:\"rma:dispositionAction\" + (@rma\\:dispositionAction:(\"cutoff\" OR \"retain\")) AND ISUNSET:\"rma:dispositionActionCompletedAt\" AND ( @rma\\:dispositionEventsEligible:true OR @rma\\:dispositionAsOf:[MIN TO NOW] ) "; + assertEquals(expected, actual); + } } From 68e322248df00ab0926392e8bf6479ae66089909 Mon Sep 17 00:00:00 2001 From: Ana Bozianu Date: Wed, 17 Feb 2016 15:37:19 +0200 Subject: [PATCH 5/8] RM-2996 - Files can not be uploaded in Unfiled Records if the File Plan has rules defined applying to sub-folders. - recordService.isFiled(nodeRef) fires capability check which conflicts with RM behavior so I run shouldRuleBeAppliedToNode code as system to skip capability check - this approach is a workaround --- .../repo/rule/ExtendedRuleServiceImpl.java | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java index db0fd4d67e..b53b82e9dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java @@ -228,24 +228,33 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl * @param typeQName * @return */ - private boolean shouldRuleBeAppliedToNode(Rule rule, NodeRef nodeRef, QName typeQName) + private boolean shouldRuleBeAppliedToNode(final Rule rule, final NodeRef nodeRef, final QName typeQName) { - boolean result = true; - NodeRef ruleNodeRef = getOwningNodeRef(rule); - if(filePlanService.isFilePlan(ruleNodeRef)) + return AuthenticationUtil.runAsSystem(new RunAsWork() { - // if this rule is defined at the root of the file plan then we do not want to apply - // it to holds/transfers/unfiled content... - result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) || - RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) || - RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) || - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRING) || - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) || - !recordService.isFiled(nodeRef)); - } - return result; + public Boolean doWork() throws Exception + { + boolean result = true; + NodeRef ruleNodeRef = getOwningNodeRef(rule); + if (filePlanService.isFilePlan(ruleNodeRef)) + { + // if this rule is defined at the root of the file plan then + // we do not want to apply + // it to holds/transfers/unfiled content... + result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) + || RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) + || RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) + || RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) + || RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER + .equals(typeQName) + || RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) + || nodeService.hasAspect(nodeRef, + RecordsManagementModel.ASPECT_TRANSFERRING) + || nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) + || !recordService.isFiled(nodeRef)); + } + return result; + } + }); } } From d929120a82b7e03584347c1c2cfdfdef49a78b78 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 18 Feb 2016 07:35:28 +0000 Subject: [PATCH 6/8] Update version to 2.3.0.2. --- pom.xml | 2 +- rm-automation/pom.xml | 2 +- rm-server/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 828e33a1b4..621246dcf2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.alfresco alfresco-rm-parent pom - 2.3.0.2-SNAPSHOT + 2.3.0.2 Alfresco Records Management http://www.alfresco.org/ diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index cca0bb4a72..bd09458ecf 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.2-SNAPSHOT + 2.3.0.2 4.0.0 alfresco-rm-automation diff --git a/rm-server/pom.xml b/rm-server/pom.xml index 3e4d20fbef..326d7a47fb 100644 --- a/rm-server/pom.xml +++ b/rm-server/pom.xml @@ -5,7 +5,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.2-SNAPSHOT + 2.3.0.2 4.0.0 alfresco-rm-server From 2ae091e95fe832a2cf6760e74f8c6d8b418025fa Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 18 Feb 2016 08:16:49 +0000 Subject: [PATCH 7/8] Update version to 2.3.0.3-SNAPSHOT. --- pom.xml | 2 +- rm-automation/pom.xml | 2 +- .../alfresco/module/org_alfresco_module_rm/module.properties | 2 +- rm-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 621246dcf2..0ed618218a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.alfresco alfresco-rm-parent pom - 2.3.0.2 + 2.3.0.3-SNAPSHOT Alfresco Records Management http://www.alfresco.org/ diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index bd09458ecf..65ef201907 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -3,7 +3,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.2 + 2.3.0.3-SNAPSHOT 4.0.0 alfresco-rm-automation diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties index 8468aa0c5c..93687cac16 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties @@ -6,6 +6,6 @@ module.aliases=org_alfresco_module_dod5015 module.title=Records Management module.description=Alfresco Record Management Extension -module.version=2.3.0.2 +module.version=2.3.0.3 module.repo.version.min=4.2.2 \ No newline at end of file diff --git a/rm-server/pom.xml b/rm-server/pom.xml index 326d7a47fb..80067a3f68 100644 --- a/rm-server/pom.xml +++ b/rm-server/pom.xml @@ -5,7 +5,7 @@ org.alfresco alfresco-rm-parent - 2.3.0.2 + 2.3.0.3-SNAPSHOT 4.0.0 alfresco-rm-server From 58ae9344c132527d5a09f10a975dfe2f39180c0e Mon Sep 17 00:00:00 2001 From: Ana Bozianu Date: Mon, 22 Feb 2016 16:16:38 +0200 Subject: [PATCH 8/8] Merge release/2.4 into master --- .../repo/rule/ExtendedRuleServiceImpl.java | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java index db0fd4d67e..b53b82e9dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java @@ -228,24 +228,33 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl * @param typeQName * @return */ - private boolean shouldRuleBeAppliedToNode(Rule rule, NodeRef nodeRef, QName typeQName) + private boolean shouldRuleBeAppliedToNode(final Rule rule, final NodeRef nodeRef, final QName typeQName) { - boolean result = true; - NodeRef ruleNodeRef = getOwningNodeRef(rule); - if(filePlanService.isFilePlan(ruleNodeRef)) + return AuthenticationUtil.runAsSystem(new RunAsWork() { - // if this rule is defined at the root of the file plan then we do not want to apply - // it to holds/transfers/unfiled content... - result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) || - RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) || - RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER.equals(typeQName) || - RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) || - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRING) || - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) || - !recordService.isFiled(nodeRef)); - } - return result; + public Boolean doWork() throws Exception + { + boolean result = true; + NodeRef ruleNodeRef = getOwningNodeRef(rule); + if (filePlanService.isFilePlan(ruleNodeRef)) + { + // if this rule is defined at the root of the file plan then + // we do not want to apply + // it to holds/transfers/unfiled content... + result = !(RecordsManagementModel.TYPE_HOLD.equals(typeQName) + || RecordsManagementModel.TYPE_HOLD_CONTAINER.equals(typeQName) + || RecordsManagementModel.TYPE_TRANSFER.equals(typeQName) + || RecordsManagementModel.TYPE_TRANSFER_CONTAINER.equals(typeQName) + || RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER + .equals(typeQName) + || RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) + || nodeService.hasAspect(nodeRef, + RecordsManagementModel.ASPECT_TRANSFERRING) + || nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) + || !recordService.isFiled(nodeRef)); + } + return result; + } + }); } }