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:
Roy Wetherall
2010-02-22 01:12:55 +00:00
parent 904d6dd314
commit 371b920e8f
7 changed files with 89 additions and 36 deletions

View File

@@ -13,84 +13,84 @@ ac-compare-operations.less_than_equal=Less Than Or Equal To
no-condition.title=All Items no-condition.title=All Items
no-condition.description=This condition will match any item added to the space. Use this when you wish to apply an action to everything when it is added to the space. no-condition.description=This condition will match any item added to the space. Use this when you wish to apply an action to everything when it is added to the space.
compare-property-value.title=Items which contain a specific value in its name compare-property-value.title=Name contains value
compare-property-value.description=The rule is applied to all items that has a specific value in its name. compare-property-value.description=The rule is applied to all items that has a specific value in its name.
in-category.title=Items with the specified category value in-category.title=Has category
in-category.description=The rule is applied to all items that has the specified category value. in-category.description=The rule is applied to all items that has the specified category value.
is-subtype.title=Items of a specified type or its sub-types is-subtype.title=Content of type or sub-type
is-subtype.description=The rule is applied to all items that are of a specified type or its sub-types is-subtype.description=The rule is applied to all items that are of a specified type or its sub-types
has-aspect.title=Items that have a specific aspect applied has-aspect.title=Has aspect
has-aspect.description=The rule is applied to all items that have the specified aspect applied. has-aspect.description=The rule is applied to all items that have the specified aspect applied.
compare-mime-type.title=Items with the specified mime type compare-mime-type.title=Content of mimetype
compare-mime-type.description=The rule is applied to all items that have content of the specified mime type. compare-mime-type.description=The rule is applied to all items that have content of the specified mime type.
composite-condition.title=Composite Condition composite-condition.title=Composite Condition
composite-condition.description=Combine several conditions to create a more complicate condition. composite-condition.description=Combine several conditions to create a more complicate condition.
compare-date-property.title=Items with specific date value in property compare-date-property.title=Property with date value
compare-date-property.description=Compare a date property of the metadata, aspect or type compare-date-property.description=Compare a date property of the metadata, aspect or type
compare-integer-property.title=Items with specific integer value in property compare-integer-property.title=Property with number value
compare-integer-property.description=Compare an integer property of the metadata, aspect or type compare-integer-property.description=Compare a number property of the metadata, aspect or type
compare-text-property.title=Items with specific text value in property compare-text-property.title=Property with text value
compare-text-property.description=Compare a text property of the metadata, aspect or type compare-text-property.description=Compare a text property of the metadata, aspect or type
has-tag.title=Has a tag has-tag.title=Has tag
has-tag.description=Has a tag been applied to a node. has-tag.description=Has a tag been applied to a node.
has-tag.tag.display-label=Tag has-tag.tag.display-label=Tag
# Actions # Actions
add-features.title=Add aspect to item add-features.title=Add an aspect
add-features.description=This will add an aspect to the matched item. add-features.description=This will add an aspect to the matched item.
remove-features.title=Remove an aspect from an item remove-features.title=Remove an aspect
remove-features.description=This will remove an aspect from the matched item. remove-features.description=This will remove an aspect from the matched item.
simple-workflow.title=Add simple workflow to item simple-workflow.title=Add simple workflow
simple-workflow.description=This will add a simple workflow to the matched item. This will allow the item to be moved to a different space for its next step in a workflow. You can also give a space for it to be moved to if you want a reject step. simple-workflow.description=This will add a simple workflow to the matched item. This will allow the item to be moved to a different space for its next step in a workflow. You can also give a space for it to be moved to if you want a reject step.
link-category.title=Link item to category link-category.title=Link to category
link-category.description=This will apply a category to the matched item. link-category.description=This will apply a category to the matched item.
transform.title=Transform and copy content to a specific space transform.title=Transform and copy content
transform.description=This will transform the the matched content and copy the result to a specific space transform.description=This will transform the the matched content and copy the result to a specific space
transform-image.title=Transform and copy image to a specific space transform-image.title=Transform and copy image
transform-image.description=This will transform the matched image and copy the result to a specific space transform-image.description=This will transform the matched image and copy the result to a specific space
copy.title=Copy item to a specific space copy.title=Copy
copy.description=This will copy the matched item to another space. copy.description=This will copy the matched item to another space.
move.title=Move item to a specific space move.title=Move
move.description=This will move the matched item to another space. move.description=This will move the matched item to another space.
mail.title=Send an email to specified users mail.title=Send email
mail.description=This will send an email to a list of users when the content matches. mail.description=This will send an email to a list of users when the content matches.
check-in.title=Check in content check-in.title=Check in
check-in.description=This will check in the matched content. check-in.description=This will check in the matched content.
check-out.title=Check out content check-out.title=Check out
check-out.description=This will check out the matched content. check-out.description=This will check out the matched content.
set-property-value.title=Set the value of a property set-property-value.title=Set property value
set-property-value.description=This will set the value of a property to a given value. set-property-value.description=This will set the value of a property to a given value.
import.title=Import an Alfresco content package import.title=Import
import.description=Imports an Alfresco content package into the repository. import.description=Imports an Alfresco content package into the repository.
extract-metadata.title=Extract common metadata fields from content extract-metadata.title=Extract common metadata fields
extract-metadata.description=Imports title, author and description metadata fields from common content types. extract-metadata.description=Imports title, author and description metadata fields from common content types.
specialise-type.title=Specialise the type of an item specialise-type.title=Specialise type
specialise-type.description=This will specialise the matched item to a given type. specialise-type.description=This will specialise the matched item to a given type.
export.title=Export a Space export.title=Export Space
export.description=Exports a Space and optionally it's children to an Alfresco export package. export.description=Exports a Space and optionally it's children to an Alfresco export package.
export.package.description=Alfresco content package for Space ''{0}''. export.package.description=Alfresco content package for Space ''{0}''.
export.root.package.description=Alfresco content package for complete Repository. export.root.package.description=Alfresco content package for complete Repository.
@@ -98,7 +98,7 @@ export.store.package.description=Alfresco Repository export of store ''{0}''.
export.generic.package.description=Alfresco Repository export. export.generic.package.description=Alfresco Repository export.
export.package.error=Failed to find temporary file for export export.package.error=Failed to find temporary file for export
script.title=Execute a script script.title=Execute script
script.description=Execute a JavaScript file to perform tasks such as creating new files or folders. script.description=Execute a JavaScript file to perform tasks such as creating new files or folders.
counter.title=Increment Counter counter.title=Increment Counter
@@ -161,3 +161,8 @@ avm-link-validation.description=Performs a link validation check.
avm-link-validation.monitor.display-label=The status object used to determine progress avm-link-validation.monitor.display-label=The status object used to determine progress
avm-link-validation.compare-to-staging.display-label=Determines whether the link check should use the corresponding staging area for comparison avm-link-validation.compare-to-staging.display-label=Determines whether the link check should use the corresponding staging area for comparison
create-version.title=Creates new version
create-version.description=Creates a new version
create-version.description.display-label=Version description
create-version.minor-change.display-label=Indicates whether the change is major

View File

@@ -28,6 +28,7 @@ import java.util.List;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.evaluator.compare.ComparePropertyValueOperation;
import org.alfresco.repo.action.evaluator.compare.ContentPropertyName; import org.alfresco.repo.action.evaluator.compare.ContentPropertyName;
import org.alfresco.service.cmr.action.ActionCondition; import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.action.ActionServiceException; import org.alfresco.service.cmr.action.ActionServiceException;
@@ -85,6 +86,9 @@ public class CompareMimeTypeEvaluator extends ComparePropertyValueEvaluator
} }
} }
// Set the operation to equals
actionCondition.setParameterValue(ComparePropertyValueEvaluator.PARAM_OPERATION, ComparePropertyValueOperation.EQUALS.toString());
// Set the content property to be MIMETYPE // Set the content property to be MIMETYPE
actionCondition.setParameterValue(ComparePropertyValueEvaluator.PARAM_CONTENT_PROPERTY, ContentPropertyName.MIME_TYPE.toString()); actionCondition.setParameterValue(ComparePropertyValueEvaluator.PARAM_CONTENT_PROPERTY, ContentPropertyName.MIME_TYPE.toString());
@@ -100,6 +104,6 @@ public class CompareMimeTypeEvaluator extends ComparePropertyValueEvaluator
paramList.add(new ParameterDefinitionImpl(PARAM_PROPERTY, DataTypeDefinition.QNAME, false, getParamDisplayLabel(PARAM_PROPERTY))); paramList.add(new ParameterDefinitionImpl(PARAM_PROPERTY, DataTypeDefinition.QNAME, false, getParamDisplayLabel(PARAM_PROPERTY)));
paramList.add(new ParameterDefinitionImpl(PARAM_CONTENT_PROPERTY, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_CONTENT_PROPERTY))); paramList.add(new ParameterDefinitionImpl(PARAM_CONTENT_PROPERTY, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_CONTENT_PROPERTY)));
paramList.add(new ParameterDefinitionImpl(PARAM_VALUE, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_VALUE), false, "ac-mimetypes")); paramList.add(new ParameterDefinitionImpl(PARAM_VALUE, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_VALUE), false, "ac-mimetypes"));
paramList.add(new ParameterDefinitionImpl(PARAM_OPERATION, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_OPERATION), false, "ac-compare-operations")); //paramList.add(new ParameterDefinitionImpl(PARAM_OPERATION, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_OPERATION), false, "ac-compare-operations"));
} }
} }

View File

@@ -24,14 +24,22 @@
*/ */
package org.alfresco.repo.action.executer; package org.alfresco.repo.action.executer;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel; 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.Action;
import org.alfresco.service.cmr.action.ParameterDefinition; 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.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; 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.VersionService;
import org.alfresco.service.cmr.version.VersionType;
/** /**
* Add features action executor implementation. * Add features action executor implementation.
@@ -44,16 +52,30 @@ public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
* Action constants * Action constants
*/ */
public static final String NAME = "create-version"; 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; public NodeService nodeService;
/** Version service */
public VersionService versionService; public VersionService versionService;
/**
* Set node service
*
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
/**
* Set version service
*
* @param versionService version service
*/
public void setVersionService(VersionService versionService) public void setVersionService(VersionService versionService)
{ {
this.versionService = versionService; this.versionService = versionService;
@@ -67,8 +89,28 @@ public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
if (this.nodeService.exists(actionedUponNodeRef) == true && if (this.nodeService.exists(actionedUponNodeRef) == true &&
this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE) == true) this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
{ {
// TODO would be nice to be able to set the version details Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(2);
this.versionService.createVersion(actionedUponNodeRef, null);
// 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 @Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) 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)));
} }
} }

View File

@@ -68,7 +68,7 @@ public class ExecuteAllRulesActionExecuterTest extends BaseSpringTest
private final static String ID = GUID.generate(); private final static String ID = GUID.generate();
/** /**
* Called at the begining of all tests * Called at the beginning of all tests
*/ */
@Override @Override
protected void onSetUpInTransaction() throws Exception protected void onSetUpInTransaction() throws Exception

View File

@@ -303,7 +303,7 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase
paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF,
true, getParamDisplayLabel(PARAM_DESTINATION_FOLDER))); true, getParamDisplayLabel(PARAM_DESTINATION_FOLDER)));
paramList.add(new ParameterDefinitionImpl(PARAM_ENCODING, DataTypeDefinition.TEXT, paramList.add(new ParameterDefinitionImpl(PARAM_ENCODING, DataTypeDefinition.TEXT,
true, getParamDisplayLabel(PARAM_ENCODING))); false, getParamDisplayLabel(PARAM_ENCODING)));
} }
/** /**

View File

@@ -473,7 +473,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
paramList.add(new ParameterDefinitionImpl(PARAM_TO, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_TO))); paramList.add(new ParameterDefinitionImpl(PARAM_TO, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_TO)));
paramList.add(new ParameterDefinitionImpl(PARAM_TO_MANY, DataTypeDefinition.ANY, false, getParamDisplayLabel(PARAM_TO_MANY), true)); paramList.add(new ParameterDefinitionImpl(PARAM_TO_MANY, DataTypeDefinition.ANY, false, getParamDisplayLabel(PARAM_TO_MANY), true));
paramList.add(new ParameterDefinitionImpl(PARAM_SUBJECT, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_SUBJECT))); paramList.add(new ParameterDefinitionImpl(PARAM_SUBJECT, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_SUBJECT)));
paramList.add(new ParameterDefinitionImpl(PARAM_TEXT, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_TEXT))); paramList.add(new ParameterDefinitionImpl(PARAM_TEXT, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_TEXT)));
paramList.add(new ParameterDefinitionImpl(PARAM_FROM, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_FROM))); paramList.add(new ParameterDefinitionImpl(PARAM_FROM, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_FROM)));
paramList.add(new ParameterDefinitionImpl(PARAM_TEMPLATE, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_TEMPLATE), false, "ac-email-templates")); paramList.add(new ParameterDefinitionImpl(PARAM_TEMPLATE, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_TEMPLATE), false, "ac-email-templates"));
} }

View File

@@ -63,9 +63,9 @@ public class SimpleWorkflowActionExecuter extends ActionExecuterAbstractBase
@Override @Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{ {
paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_STEP, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_APPROVE_STEP))); paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_STEP, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_APPROVE_STEP)));
paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_APPROVE_FOLDER))); paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_APPROVE_FOLDER)));
paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_MOVE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_APPROVE_MOVE))); paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_MOVE, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PARAM_APPROVE_MOVE)));
paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_STEP, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_REJECT_STEP))); paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_STEP, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_REJECT_STEP)));
paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_REJECT_FOLDER))); paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_REJECT_FOLDER)));
paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_MOVE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_REJECT_MOVE))); paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_MOVE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_REJECT_MOVE)));