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:
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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.action;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
|
||||
/**
|
||||
* Extended action definition interface.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface ExtendedActionDefinition
|
||||
{
|
||||
/**
|
||||
* @return list of applicable file plan component kinds
|
||||
*/
|
||||
Set<FilePlanComponentKind> getApplicableKinds();
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* 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.action;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
|
||||
/**
|
||||
* Extended action definition implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ExtendedActionDefinitionImpl extends ActionDefinitionImpl implements ExtendedActionDefinition
|
||||
{
|
||||
/** generated serial version id */
|
||||
private static final long serialVersionUID = -5226538434707253206L;
|
||||
|
||||
/** Applicable kinds */
|
||||
private Set<FilePlanComponentKind> applicableKinds;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
* @param name action definition name
|
||||
*/
|
||||
public ExtendedActionDefinitionImpl(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param applicableKinds applicable kinds
|
||||
*/
|
||||
public void setApplicableKinds(Set<FilePlanComponentKind> applicableKinds)
|
||||
{
|
||||
this.applicableKinds = applicableKinds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.ExtendedActionDefinition#getApplicableKinds()
|
||||
*/
|
||||
@Override
|
||||
public Set<FilePlanComponentKind> getApplicableKinds()
|
||||
{
|
||||
return applicableKinds;
|
||||
}
|
||||
}
|
@@ -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
|
||||
*
|
||||
@@ -50,6 +61,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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user