mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-639: A developer can define a custom RM specific condition implementation.
RM-642: A records manager can create a rule with a "Is Declared" condition RM-641: A records manager can create a rule with a "Is Filled" condition RM-638: A records admin can choose from a specialised list of RM relevant conditions when defining a records rule git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48587 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -236,4 +236,5 @@
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -37,8 +37,20 @@ rm.action.records_only_undeclared=Only records can be undeclared.
|
||||
rm.action.event-not-undone=The event {0} can not be undone, because it is not defined on the disposition lifecycle.
|
||||
rm.action.reject-no-reason=Can not reject a record without a reason.
|
||||
rm.action.reject-only-unfiled-records=Can only reject unfiled records.
|
||||
|
||||
#
|
||||
# i18n for Rule Actions
|
||||
# i18n for Records Management Action Conditions
|
||||
#
|
||||
# Is declared
|
||||
isDeclared.title=Is Record Declared
|
||||
isDeclared.description=Is the record declared.
|
||||
|
||||
# Is filed
|
||||
isRecordFiled.title=Is Record Filed
|
||||
isRecordFiled.description=Is the record filed.
|
||||
|
||||
#
|
||||
# i18n for Records Management Actions
|
||||
#
|
||||
# Create record
|
||||
create-record.title=Create record
|
||||
|
@@ -12,6 +12,21 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Conditions -->
|
||||
|
||||
<bean id="rmCapabilityConditionEvaluator"
|
||||
parent="action-condition-evaluator"
|
||||
abstract="true"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.action.evaluator.CapabilityConditionEvaluator"/>
|
||||
|
||||
<bean id="isDeclared" parent="rmCapabilityConditionEvaluator">
|
||||
<property name="capabilityCondition" ref="capabilityCondition.declared"/>
|
||||
</bean>
|
||||
|
||||
<bean id="isRecordFiled" parent="rmCapabilityConditionEvaluator">
|
||||
<property name="capabilityCondition" ref="capabilityCondition.recordFiled"/>
|
||||
</bean>
|
||||
|
||||
<!-- Actions -->
|
||||
|
||||
<bean id="rmAction" parent="action-executer" abstract="true">
|
||||
|
@@ -2,6 +2,7 @@
|
||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||
|
||||
<beans>
|
||||
|
||||
<!-- REST impl for RM Action Service -->
|
||||
<bean id="webscript.org.alfresco.rma.rmaction.post"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.script.RmActionPost"
|
||||
@@ -509,20 +510,32 @@
|
||||
<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" />
|
||||
parent="webscript">
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
</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" />
|
||||
parent="webscript">
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
</bean>
|
||||
|
||||
<!-- REST impl for GET Action Condition Defitions for RM -->
|
||||
<bean id="webscript.org.alfresco.repository.rule.rm-actionconditiondefinitions.get"
|
||||
class="org.alfresco.repo.web.scripts.rule.RmActionConditionDefinitionsGet"
|
||||
parent="webscript">
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="webscript.org.alfresco.repository.rule.dm-actionconditiondefinitions.get"
|
||||
class="org.alfresco.repo.web.scripts.rule.DmActionConditionDefinitionsGet"
|
||||
parent="webscript">
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
</bean>
|
||||
|
||||
<!-- REST impl for GET Class Definitions for RM/DM -->
|
||||
<bean id="webscript.org.alfresco.repository.dictionary.rm-classes.get"
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>Get action condition definition collection for DM</shortname>
|
||||
<description>Gets a collection of the available action condition definitions in DM.</description>
|
||||
<url>/api/rm/dm-actionconditiondefinitions</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly">required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1 @@
|
||||
<#include "actionconditiondefinitions.get.json.ftl">
|
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>Get action condition definition collection for RM</shortname>
|
||||
<description>Gets a collection of the available action condition definitions in RM.</description>
|
||||
<url>/api/rm/rm-actionconditiondefinitions</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly">required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1 @@
|
||||
<#include "actionconditiondefinitions.get.json.ftl">
|
@@ -42,7 +42,6 @@ import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
|
||||
import org.alfresco.repo.action.ExtendedActionDefinitionImpl;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
@@ -284,7 +283,7 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe
|
||||
@Override
|
||||
protected ActionDefinition createActionDefinition(String name)
|
||||
{
|
||||
return new ExtendedActionDefinitionImpl(name);
|
||||
return new RecordsManagementActionDefinitionImpl(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +293,7 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe
|
||||
public ActionDefinition getActionDefinition()
|
||||
{
|
||||
ActionDefinition actionDefinition = super.getActionDefinition();
|
||||
((ExtendedActionDefinitionImpl)this.actionDefinition).setApplicableKinds(applicableKinds);
|
||||
((RecordsManagementActionDefinitionImpl)this.actionDefinition).setApplicableKinds(applicableKinds);
|
||||
return actionDefinition;
|
||||
}
|
||||
|
||||
|
@@ -67,17 +67,6 @@ public interface RecordsManagementAction
|
||||
*/
|
||||
public RecordsManagementActionResult execute(NodeRef filePlanComponent, Map<String, Serializable> parameters);
|
||||
|
||||
|
||||
/**
|
||||
* Can this action be executed?
|
||||
* Does it meet all of its entry requirements - EXCEPT permission checks.
|
||||
*
|
||||
* @param filePlanComponent file plan component the action is executed upon
|
||||
* @param parameters action parameters
|
||||
* @return
|
||||
*/
|
||||
// public boolean isExecutable(NodeRef filePlanComponent, Map<String, Serializable> parameters);
|
||||
|
||||
/**
|
||||
* Some admin-related rmActions execute against a target nodeRef which is not provided
|
||||
* by the calling code, but is instead an implementation detail of the action.
|
||||
|
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.module.org_alfresco_module_rm.action;
|
||||
|
||||
/**
|
||||
* Records management condition definition.
|
||||
*
|
||||
* Primarily used as a marker interface.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface RecordsManagementActionConditionDefinition
|
||||
{
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.module.org_alfresco_module_rm.action;
|
||||
|
||||
import org.alfresco.repo.action.ActionConditionDefinitionImpl;
|
||||
|
||||
/**
|
||||
* Records management condition definition implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RecordsManagementActionConditionDefinitionImpl extends ActionConditionDefinitionImpl
|
||||
implements RecordsManagementActionConditionDefinition
|
||||
{
|
||||
/** Serial Version UID */
|
||||
private static final long serialVersionUID = -7599279732731533610L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
* @param name name of the condition
|
||||
*/
|
||||
public RecordsManagementActionConditionDefinitionImpl(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.module.org_alfresco_module_rm.action;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
|
||||
/**
|
||||
* Records management action condition evaluator abstract base implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#getActionConditionDefintion()
|
||||
*
|
||||
* TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter
|
||||
* base class to prevent duplication of code and a cleaner extension.
|
||||
*/
|
||||
@Override
|
||||
public ActionConditionDefinition getActionConditionDefintion()
|
||||
{
|
||||
if (this.actionConditionDefinition == null)
|
||||
{
|
||||
this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(name);
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setTitleKey(getTitleKey());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(name);
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setParameterDefinitions(getParameterDefintions());
|
||||
}
|
||||
return this.actionConditionDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> arg0)
|
||||
{
|
||||
// No param implementation by default
|
||||
}
|
||||
|
||||
}
|
@@ -16,7 +16,7 @@
|
||||
* 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.action;
|
||||
package org.alfresco.module.org_alfresco_module_rm.action;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface ExtendedActionDefinition
|
||||
public interface RecordsManagementActionDefinition
|
||||
{
|
||||
/**
|
||||
* @return list of applicable file plan component kinds
|
@@ -16,11 +16,12 @@
|
||||
* 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.action;
|
||||
package org.alfresco.module.org_alfresco_module_rm.action;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
import org.alfresco.repo.action.ActionDefinitionImpl;
|
||||
|
||||
/**
|
||||
* Extended action definition implementation.
|
||||
@@ -28,7 +29,7 @@ import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ExtendedActionDefinitionImpl extends ActionDefinitionImpl implements ExtendedActionDefinition
|
||||
public class RecordsManagementActionDefinitionImpl extends ActionDefinitionImpl implements RecordsManagementActionDefinition
|
||||
{
|
||||
/** generated serial version id */
|
||||
private static final long serialVersionUID = -5226538434707253206L;
|
||||
@@ -41,7 +42,7 @@ public class ExtendedActionDefinitionImpl extends ActionDefinitionImpl implement
|
||||
*
|
||||
* @param name action definition name
|
||||
*/
|
||||
public ExtendedActionDefinitionImpl(String name)
|
||||
public RecordsManagementActionDefinitionImpl(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
@@ -55,7 +56,7 @@ public class ExtendedActionDefinitionImpl extends ActionDefinitionImpl implement
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.ExtendedActionDefinition#getApplicableKinds()
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition#getApplicableKinds()
|
||||
*/
|
||||
@Override
|
||||
public Set<FilePlanComponentKind> getApplicableKinds()
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.module.org_alfresco_module_rm.action.evaluator;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
|
||||
/**
|
||||
* Records management evaluator base implementation that delegates to a configured capability condition
|
||||
* implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class CapabilityConditionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase
|
||||
{
|
||||
/** Capability Condition */
|
||||
private CapabilityCondition capabilityCondition;
|
||||
|
||||
/**
|
||||
* @param capabilityCondition capability condition
|
||||
*/
|
||||
public void setCapabilityCondition(CapabilityCondition capabilityCondition)
|
||||
{
|
||||
this.capabilityCondition = capabilityCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// check a capability condition has been set and delegate
|
||||
ParameterCheck.mandatory("capabilityCondition", capabilityCondition);
|
||||
return capabilityCondition.evaluate(actionedUponNodeRef);
|
||||
}
|
||||
}
|
@@ -16,10 +16,11 @@
|
||||
* 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.module.org_alfresco_module_rm.action;
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.action.executer.ActionExecuter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
@@ -33,7 +34,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RMDelegateAction extends RMActionExecuterAbstractBase
|
||||
public class DelegateAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** Delegate action executer*/
|
||||
private ActionExecuter delegateActionExecuter;
|
@@ -24,6 +24,7 @@ import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
@@ -71,11 +72,11 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl
|
||||
// check each action definition
|
||||
for (ActionDefinition actionDefinition : actionDefinitions)
|
||||
{
|
||||
if (actionDefinition instanceof ExtendedActionDefinition)
|
||||
if (actionDefinition instanceof RecordsManagementActionDefinition)
|
||||
{
|
||||
if (kind != null)
|
||||
{
|
||||
Set<FilePlanComponentKind> applicableKinds = ((ExtendedActionDefinition)actionDefinition).getApplicableKinds();
|
||||
Set<FilePlanComponentKind> applicableKinds = ((RecordsManagementActionDefinition)actionDefinition).getApplicableKinds();
|
||||
if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind))
|
||||
{
|
||||
// an RM action can only act on a RM artifact
|
||||
@@ -96,13 +97,4 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.ActionServiceImpl#postCommit()
|
||||
*/
|
||||
@Override
|
||||
public void postCommit()
|
||||
{
|
||||
super.postCommit();
|
||||
}
|
||||
}
|
||||
|
@@ -23,8 +23,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.action.ExtendedActionDefinition;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionDefinition;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
|
||||
/**
|
||||
* An abstract class for the java backed webscripts to get the filtered action definition list.
|
||||
@@ -32,8 +36,15 @@ import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
* @author Tuna Aksoy
|
||||
* @since 2.1
|
||||
*/
|
||||
public class AbstractActionDefinitionsGet extends AbstractRuleWebScript
|
||||
public class AbstractActionDefinitionsGet extends DeclarativeWebScript
|
||||
{
|
||||
private ActionService actionService;
|
||||
|
||||
public void setActionService(ActionService actionService)
|
||||
{
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a model with the filtered action definitions
|
||||
*
|
||||
@@ -51,6 +62,21 @@ public class AbstractActionDefinitionsGet extends AbstractRuleWebScript
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param removeRmDefs
|
||||
* @return
|
||||
*/
|
||||
protected Map<String, Object> getModelWithFilteredActionConditionDefinitions(boolean removeRmDefs)
|
||||
{
|
||||
List<ActionConditionDefinition> defs = filterActionConditionDefinitons(actionService.getActionConditionDefinitions(), removeRmDefs);
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("actionconditiondefinitions", defs);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the action definition list
|
||||
*
|
||||
@@ -62,11 +88,29 @@ public class AbstractActionDefinitionsGet extends AbstractRuleWebScript
|
||||
{
|
||||
for (Iterator<ActionDefinition> iterator = actionDefinitions.iterator(); iterator.hasNext();)
|
||||
{
|
||||
if ((iterator.next() instanceof ExtendedActionDefinition) == removeRmRelatedActionDefs)
|
||||
if ((iterator.next() instanceof RecordsManagementActionDefinition) == removeRmRelatedActionDefs)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return actionDefinitions;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param defs
|
||||
* @param removeRmRelated
|
||||
* @return
|
||||
*/
|
||||
private List<ActionConditionDefinition> filterActionConditionDefinitons(List<ActionConditionDefinition> defs, boolean removeRmRelated)
|
||||
{
|
||||
for (Iterator<ActionConditionDefinition> iterator = defs.iterator(); iterator.hasNext();)
|
||||
{
|
||||
if ((iterator.next() instanceof RecordsManagementActionConditionDefinition) == removeRmRelated)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return defs;
|
||||
}
|
||||
}
|
||||
|
@@ -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 condition definition list.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class DmActionConditionDefinitionsGet 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 getModelWithFilteredActionConditionDefinitions(true);
|
||||
}
|
||||
}
|
@@ -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 condition definition list.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RmActionConditionDefinitionsGet 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 getModelWithFilteredActionConditionDefinitions(false);
|
||||
}
|
||||
}
|
@@ -25,6 +25,8 @@ import org.alfresco.module.org_alfresco_module_rm.test.action.CreateRecordAction
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.action.FileToActionTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.action.HideRecordActionTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.action.RejectActionTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.service.ExtendedActionServiceTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.service.RecordsManagementActionServiceImplTest;
|
||||
|
||||
|
||||
/**
|
||||
@@ -43,6 +45,8 @@ public class ActionTestSuite extends TestSuite
|
||||
public static Test suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite();
|
||||
suite.addTestSuite(RecordsManagementActionServiceImplTest.class);
|
||||
suite.addTestSuite(ExtendedActionServiceTest.class);
|
||||
suite.addTestSuite(CreateRecordActionTest.class);
|
||||
suite.addTestSuite(HideRecordActionTest.class);
|
||||
suite.addTestSuite(RejectActionTest.class);
|
||||
|
@@ -95,7 +95,7 @@
|
||||
<ref bean="rmDelegateAction"/>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="rmDelegateAction" class="org.alfresco.module.org_alfresco_module_rm.action.RMDelegateAction" parent="rmAction">
|
||||
<bean id="rmDelegateAction" class="org.alfresco.module.org_alfresco_module_rm.action.impl.DelegateAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="delegateAction" ref="testDMAction" />
|
||||
<property name="applicableKinds">
|
||||
|
Reference in New Issue
Block a user