diff --git a/config/alfresco/messages/action-config.properties b/config/alfresco/messages/action-config.properties index 735f578a1d..26268c39c0 100644 --- a/config/alfresco/messages/action-config.properties +++ b/config/alfresco/messages/action-config.properties @@ -13,84 +13,84 @@ ac-compare-operations.less_than_equal=Less Than Or Equal To 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. -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. -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. -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 -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. -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. composite-condition.title=Composite 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-integer-property.title=Items with specific integer value in property -compare-integer-property.description=Compare an integer property of the metadata, aspect or type +compare-integer-property.title=Property with number value +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 -has-tag.title=Has a tag +has-tag.title=Has tag has-tag.description=Has a tag been applied to a node. has-tag.tag.display-label=Tag # 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. -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. -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. -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. -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-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 -copy.title=Copy item to a specific space +copy.title=Copy 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. -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. -check-in.title=Check in content +check-in.title=Check in 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. -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. -import.title=Import an Alfresco content package +import.title=Import 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. -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. -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.package.description=Alfresco content package for Space ''{0}''. 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.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. 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.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 + diff --git a/source/java/org/alfresco/repo/action/evaluator/CompareMimeTypeEvaluator.java b/source/java/org/alfresco/repo/action/evaluator/CompareMimeTypeEvaluator.java index 4b2bd6fc5c..c37809d97b 100644 --- a/source/java/org/alfresco/repo/action/evaluator/CompareMimeTypeEvaluator.java +++ b/source/java/org/alfresco/repo/action/evaluator/CompareMimeTypeEvaluator.java @@ -28,6 +28,7 @@ import java.util.List; import org.alfresco.model.ContentModel; 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.service.cmr.action.ActionCondition; 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 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_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_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")); } } diff --git a/source/java/org/alfresco/repo/action/executer/CreateVersionActionExecuter.java b/source/java/org/alfresco/repo/action/executer/CreateVersionActionExecuter.java index 749863aff9..828542f0c9 100644 --- a/source/java/org/alfresco/repo/action/executer/CreateVersionActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/CreateVersionActionExecuter.java @@ -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 versionProperties = new HashMap(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 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))); } } diff --git a/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuterTest.java b/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuterTest.java index e521f0931e..a6c7a77490 100644 --- a/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuterTest.java +++ b/source/java/org/alfresco/repo/action/executer/ExecuteAllRulesActionExecuterTest.java @@ -68,7 +68,7 @@ public class ExecuteAllRulesActionExecuterTest extends BaseSpringTest private final static String ID = GUID.generate(); /** - * Called at the begining of all tests + * Called at the beginning of all tests */ @Override protected void onSetUpInTransaction() throws Exception diff --git a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java index 44ca8e441e..b34d1c4c5f 100644 --- a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java @@ -303,7 +303,7 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_DESTINATION_FOLDER))); paramList.add(new ParameterDefinitionImpl(PARAM_ENCODING, DataTypeDefinition.TEXT, - true, getParamDisplayLabel(PARAM_ENCODING))); + false, getParamDisplayLabel(PARAM_ENCODING))); } /** diff --git a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java index bf064b8bf5..8ff2ed50bd 100644 --- a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java @@ -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_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_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_TEMPLATE, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_TEMPLATE), false, "ac-email-templates")); } diff --git a/source/java/org/alfresco/repo/action/executer/SimpleWorkflowActionExecuter.java b/source/java/org/alfresco/repo/action/executer/SimpleWorkflowActionExecuter.java index 531156da89..4c272500a1 100644 --- a/source/java/org/alfresco/repo/action/executer/SimpleWorkflowActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/SimpleWorkflowActionExecuter.java @@ -63,9 +63,9 @@ public class SimpleWorkflowActionExecuter extends ActionExecuterAbstractBase @Override protected void addParameterDefinitions(List paramList) { - paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_STEP, DataTypeDefinition.TEXT, false, 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_MOVE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_APPROVE_MOVE))); + paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_STEP, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_APPROVE_STEP))); + paramList.add(new ParameterDefinitionImpl(PARAM_APPROVE_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_APPROVE_FOLDER))); + 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_FOLDER, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_REJECT_FOLDER))); paramList.add(new ParameterDefinitionImpl(PARAM_REJECT_MOVE, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_REJECT_MOVE)));