From 1ea167364b348a50780dbff1a80aa0ba4d9317b1 Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Wed, 20 Feb 2013 16:28:02 +0000 Subject: [PATCH] RM-592 (A records management admin can see the appropriate list of RM related actions and conditions when creating (and managing) rules within the file plan) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46868 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../messages/actions.properties | 8 +- .../rm-action-context.xml | 1242 ++++++++--------- .../rm-webscript-context.xml | 16 + .../rule/dm-actiondefinitions.get.desc.xml | 8 + .../rule/dm-actiondefinitions.get.json.ftl | 1 + .../rule/rm-actiondefinitions.get.desc.xml | 8 + .../rule/rm-actiondefinitions.get.json.ftl | 1 + .../rule/AbstractActionDefinitionsGet.java | 72 + .../scripts/rule/DmActionDefinitionsGet.java | 43 + .../scripts/rule/RmActionDefinitionsGet.java | 43 + 10 files changed, 819 insertions(+), 623 deletions(-) create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.desc.xml create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.json.ftl create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl create mode 100644 rm-server/source/java/org/alfresco/repo/web/scripts/rule/AbstractActionDefinitionsGet.java create mode 100644 rm-server/source/java/org/alfresco/repo/web/scripts/rule/DmActionDefinitionsGet.java create mode 100644 rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties index bbed6263de..cfd0ff80e5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties @@ -42,6 +42,12 @@ rm.action.reject-only-unfiled-records=Can only reject unfiled records. # # Create record create-record.title=Create record -create-record.description=Creates a Record from an existing document. +create-record.description=Creates a record from an existing document. create-record.file-plan.display-label=File plan create-record.hide-record.display-label=Hide Record +# Declare record +declareRecord.title=Declare record +declateRecord.description=Declares a record. +# File to +fileTo.title=File to +fileTo.description=Files a record to the specified record folder. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml index 842eac2465..07e1a009aa 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml @@ -3,701 +3,699 @@ - - - - - alfresco.module.org_alfresco_module_rm.rm-actions - - - + + + + + alfresco.module.org_alfresco_module_rm.rm-actions + + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction - org.alfresco.repo.action.executer.ActionExecuter - - - + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction + org.alfresco.repo.action.executer.ActionExecuter + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DestroyRecordsScheduledForDestruction + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DestroyRecordsScheduledForDestruction - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + + + + + + + ${rm.ghosting.enabled} + + - - - - - - - ${rm.ghosting.enabled} - - + + - - + + + + + + + + + + - - - - - - - - - - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ReOpenFolders + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ReOpenFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CloseFolders + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CloseFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CycleVitalRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CycleVitalRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM.Declare.0 + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM.Declare.0 - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + + + - - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.UndeclareRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.UndeclareRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + + - - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ExtendRetentionPeriodOrFreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ExtendRetentionPeriodOrFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Unfreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Unfreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ViewUpdateReasonsForFreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ViewUpdateReasonsForFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.PlanningReviewCycles + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.PlanningReviewCycles - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ManuallyChangeDispositionDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ManuallyChangeDispositionDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + - + + - - + + + + + + + + + + - - - - - - - - - - + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - + + - - - - + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeAllTransfers + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeNominatedTransfers + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CreateModifyDestroyFileplanMetadata + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - + + + + - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeAllTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeNominatedTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CreateModifyDestroyFileplanMetadata - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml index d591b88429..9f4a5eca6a 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml @@ -502,4 +502,20 @@ parent="webscript"> + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.desc.xml new file mode 100644 index 0000000000..e2a48701e8 --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.desc.xml @@ -0,0 +1,8 @@ + + Get action definition collection for DM + Gets a collection of the available action definitions in DM. + /api/rm/dm-actiondefinitions + argument + user + required + \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.json.ftl new file mode 100644 index 0000000000..2b7650e50d --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/dm-actiondefinitions.get.json.ftl @@ -0,0 +1 @@ +<#include "actiondefinitions.get.json.ftl"> \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml new file mode 100644 index 0000000000..f55b3246e8 --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml @@ -0,0 +1,8 @@ + + Get action definition collection for RM + Gets a collection of the available action definitions in RM. + /api/rm/rm-actiondefinitions + argument + user + required + \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl new file mode 100644 index 0000000000..2b7650e50d --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl @@ -0,0 +1 @@ +<#include "actiondefinitions.get.json.ftl"> \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/AbstractActionDefinitionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/AbstractActionDefinitionsGet.java new file mode 100644 index 0000000000..e9214366f9 --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/AbstractActionDefinitionsGet.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2005-2012 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.repo.web.scripts.rule; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.repo.action.ExtendedActionDefinition; +import org.alfresco.service.cmr.action.ActionDefinition; + +/** + * An abstract class for the java backed webscripts to get the filtered action definition list. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class AbstractActionDefinitionsGet extends AbstractRuleWebScript +{ + /** + * Returns a model with the filtered action definitions + * + * @param removeRmRelatedActionDefs if true the rm related action definitions will be removed, otherwise dm related actions + * @return Map the model with the filtered action definitions + */ + protected Map getModelWithFilteredActionDefinitions(boolean removeRmRelatedActionDefs) + { + // get all action definitions and filter them + List actiondefinitions = filterActionDefinitons(actionService.getActionDefinitions(), removeRmRelatedActionDefs); + + Map model = new HashMap(); + model.put("actiondefinitions", actiondefinitions); + + return model; + } + + /** + * Filters the action definition list + * + * @param actionDefinitions the list of action definitions to filter + * @param removeRmRelatedActionDefs if true the rm related action definitions will be removed, otherwise dm related actions + * @return List the filtered list of action definitions + */ + private List filterActionDefinitons(List actionDefinitions, boolean removeRmRelatedActionDefs) + { + for (Iterator iterator = actionDefinitions.iterator(); iterator.hasNext();) + { + if ((iterator.next() instanceof ExtendedActionDefinition) == removeRmRelatedActionDefs) + { + iterator.remove(); + } + } + return actionDefinitions; + } +} diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/DmActionDefinitionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/DmActionDefinitionsGet.java new file mode 100644 index 0000000000..54ae738d98 --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/DmActionDefinitionsGet.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2013 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.repo.web.scripts.rule; + +import java.util.Map; + +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for java backed webscript to get the DM related action definition list. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class DmActionDefinitionsGet extends AbstractActionDefinitionsGet +{ + /** + * @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) + { + return getModelWithFilteredActionDefinitions(true); + } +} diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java new file mode 100644 index 0000000000..64af80e5c7 --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2013 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.repo.web.scripts.rule; + +import java.util.Map; + +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get the RM related action definition list. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmActionDefinitionsGet extends AbstractActionDefinitionsGet +{ + /** + * @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) + { + return getModelWithFilteredActionDefinitions(false); + } +}