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
This commit is contained in:
Tuna Aksoy
2013-02-20 16:28:02 +00:00
parent 53e37bab75
commit 1ea167364b
10 changed files with 819 additions and 623 deletions

View File

@@ -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.

View File

@@ -73,10 +73,8 @@
</property>
</bean>
<!-- Cutoff action -->
<bean id="cutoff_proxy" parent="rmProxyAction" >
<property name="target">
<ref bean="cutoff"/>
@@ -272,6 +270,7 @@
</bean>
<bean id="declareRecord" class="org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction" parent="rmAction">
<property name="publicAction" value="true"/>
</bean>
<!-- undeclare record -->
@@ -683,7 +682,6 @@
<bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction" />
<!-- File To -->
<bean id="fileTo_proxy" parent="rmProxyAction">
@@ -697,7 +695,7 @@
<bean id="fileTo" class="org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction" parent="rmAction">
<property name="fileFolderService" ref="FileFolderService"/>
<property name="publicAction" value="true"/>
</bean>
</beans>

View File

@@ -502,4 +502,20 @@
parent="webscript">
<property name="customEmailMappingService" ref="CustomEmailMappingService" />
</bean>
<!-- Abstract parent bean for the RM and DM action definition beans -->
<bean id="abstractActionDefinitionsGet" parent="abstractRuleWebScript" abstract="true" />
<!-- REST impl for GET Action Defitions for RM -->
<bean id="webscript.org.alfresco.repository.rule.rm-actiondefinitions.get"
class="org.alfresco.repo.web.scripts.rule.RmActionDefinitionsGet"
parent="abstractActionDefinitionsGet">
</bean>
<!-- REST impl for GET Action Defitions for DM -->
<bean id="webscript.org.alfresco.repository.rule.dm-actiondefinitions.get"
class="org.alfresco.repo.web.scripts.rule.DmActionDefinitionsGet"
parent="abstractActionDefinitionsGet">
</bean>
</beans>

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>Get action definition collection for DM</shortname>
<description>Gets a collection of the available action definitions in DM.</description>
<url>/api/rm/dm-actiondefinitions</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction allow="readonly">required</transaction>
</webscript>

View File

@@ -0,0 +1 @@
<#include "actiondefinitions.get.json.ftl">

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>Get action definition collection for RM</shortname>
<description>Gets a collection of the available action definitions in RM.</description>
<url>/api/rm/rm-actiondefinitions</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction allow="readonly">required</transaction>
</webscript>

View File

@@ -0,0 +1 @@
<#include "actiondefinitions.get.json.ftl">

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, Object> the model with the filtered action definitions
*/
protected Map<String, Object> getModelWithFilteredActionDefinitions(boolean removeRmRelatedActionDefs)
{
// get all action definitions and filter them
List<ActionDefinition> actiondefinitions = filterActionDefinitons(actionService.getActionDefinitions(), removeRmRelatedActionDefs);
Map<String, Object> model = new HashMap<String, Object>();
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<ActionDefinition> the filtered list of action definitions
*/
private List<ActionDefinition> filterActionDefinitons(List<ActionDefinition> actionDefinitions, boolean removeRmRelatedActionDefs)
{
for (Iterator<ActionDefinition> iterator = actionDefinitions.iterator(); iterator.hasNext();)
{
if ((iterator.next() instanceof ExtendedActionDefinition) == removeRmRelatedActionDefs)
{
iterator.remove();
}
}
return actionDefinitions;
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
return getModelWithFilteredActionDefinitions(true);
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
return getModelWithFilteredActionDefinitions(false);
}
}