mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
SAIL-307 : Changes in the action and condition definitions
1. parameters on simple-workflow actin made mandatory as requested 2. major version and version description parameters added to create-version action 3. shortened action and condition labels 4. did not remove encoding from import action but have made it optional. Defaults to UTF-8 if not set. 5. text parameter now optional on mail action 6. no action taken 7. no action taken .. dont want to upset current default operation behaviour 8. operator assumed to be equals for mimetype comparison so operation removed from parameter list git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18743 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,14 +24,22 @@
|
||||
*/
|
||||
package org.alfresco.repo.action.executer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
|
||||
/**
|
||||
* Add features action executor implementation.
|
||||
@@ -44,16 +52,30 @@ public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
|
||||
* Action constants
|
||||
*/
|
||||
public static final String NAME = "create-version";
|
||||
public static final String PARAM_DESCRIPTION = "description";
|
||||
public static final String PARAM_MINOR_CHANGE = "minor-change";
|
||||
|
||||
/** Node service */
|
||||
public NodeService nodeService;
|
||||
|
||||
/** Version service */
|
||||
public VersionService versionService;
|
||||
|
||||
/**
|
||||
* Set node service
|
||||
*
|
||||
* @param nodeService node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set version service
|
||||
*
|
||||
* @param versionService version service
|
||||
*/
|
||||
public void setVersionService(VersionService versionService)
|
||||
{
|
||||
this.versionService = versionService;
|
||||
@@ -67,8 +89,28 @@ public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
|
||||
if (this.nodeService.exists(actionedUponNodeRef) == true &&
|
||||
this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
|
||||
{
|
||||
// TODO would be nice to be able to set the version details
|
||||
this.versionService.createVersion(actionedUponNodeRef, null);
|
||||
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(2);
|
||||
|
||||
// Get the version description
|
||||
String description = (String)ruleAction.getParameterValue(PARAM_DESCRIPTION);
|
||||
if (description != null && description.length() != 0)
|
||||
{
|
||||
versionProperties.put(Version.PROP_DESCRIPTION, description);
|
||||
}
|
||||
|
||||
// determine whether the change is minor or major
|
||||
Boolean minorChange = (Boolean)ruleAction.getParameterValue(PARAM_MINOR_CHANGE);
|
||||
if (minorChange != null && minorChange.booleanValue() == false)
|
||||
{
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
|
||||
}
|
||||
|
||||
// Create the version
|
||||
this.versionService.createVersion(actionedUponNodeRef, versionProperties);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +120,8 @@ public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_MINOR_CHANGE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_MINOR_CHANGE)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_DESCRIPTION, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_DESCRIPTION)));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user