>(
- "MigrateVersionStore",
+ "CleanOldVersionStore",
transactionService.getRetryingTransactionHelper(),
batchProcessorWork, threadCount, 1,
applicationEventPublisher, logger, loggingInterval);
@@ -705,6 +779,12 @@ public class VersionMigrator implements ApplicationEventPublisherAware
else
{
logger.info(I18NUtil.getMessage(MSG_DELETE_COMPLETE, (toDo - notMigratedCount), toDo, ((System.currentTimeMillis()-startTime)/1000)));
+
+ if (notMigratedCount == 0)
+ {
+ migrationComplete = null;
+ isMigrationComplete();
+ }
}
}
}
diff --git a/source/java/org/alfresco/repo/version/VersionMigratorTest.java b/source/java/org/alfresco/repo/version/VersionMigratorTest.java
index 0332d0bcc2..9cd332872b 100644
--- a/source/java/org/alfresco/repo/version/VersionMigratorTest.java
+++ b/source/java/org/alfresco/repo/version/VersionMigratorTest.java
@@ -358,7 +358,7 @@ public class VersionMigratorTest extends BaseVersionStoreTest
public NodeRef execute() throws Throwable
{
// Migrate (and don't delete old version history) !
- versionMigrator.migrateVersions(1, 1, false);
+ versionMigrator.migrateVersions(1, 1, -1, false, null, false);
return null;
}
diff --git a/source/java/org/alfresco/repo/version/common/VersionHistoryImpl.java b/source/java/org/alfresco/repo/version/common/VersionHistoryImpl.java
index 65feeabc32..b78e708c42 100644
--- a/source/java/org/alfresco/repo/version/common/VersionHistoryImpl.java
+++ b/source/java/org/alfresco/repo/version/common/VersionHistoryImpl.java
@@ -125,7 +125,7 @@ public class VersionHistoryImpl implements VersionHistory
* Gets a collection containing all the versions within the
* version history.
*
- * Versions are returned in descending create date order.
+ * Versions are returned in descending create date order (most recent first).
*
* @return collection containing all the versions
*/
diff --git a/source/java/org/alfresco/repo/version/common/VersionLabelComparator.java b/source/java/org/alfresco/repo/version/common/VersionLabelComparator.java
index 84a4be54a2..03368956b1 100644
--- a/source/java/org/alfresco/repo/version/common/VersionLabelComparator.java
+++ b/source/java/org/alfresco/repo/version/common/VersionLabelComparator.java
@@ -21,21 +21,24 @@ package org.alfresco.repo.version.common;
import java.util.Comparator;
import org.alfresco.service.cmr.version.Version;
+import org.alfresco.util.VersionNumber;
/**
- * A comparator to sort a version list according theires version labels ascending
+ * A comparator to sort a version list according to their version labels in descending order (eg. 2.1, 2.0, 1.1, 1.0)
*
* @author Yanick Pignot
+ *
+ * @deprecated see VersionHistory (getAllVersions, VersionComparatorAsc, VersionComparatorDesc)
*/
-public class VersionLabelComparator implements Comparator
+public class VersionLabelComparator implements Comparator
{
- public int compare(Object version1, Object version2)
+ public int compare(Version version1, Version version2)
{
- String labelV1 = ((Version) version1).getVersionLabel();
- String labelV2 = ((Version) version2).getVersionLabel();
+ String labelV1 = version1.getVersionLabel();
+ String labelV2 = version2.getVersionLabel();
- // sort the list ascending
- return labelV2.compareTo(labelV1);
+ // sort the list descending (ie. most recent first)
+ return new VersionNumber(labelV2).compareTo(new VersionNumber(labelV1));
}
}
diff --git a/source/java/org/alfresco/repo/workflow/jbpm/AlfrescoJavaScript.java b/source/java/org/alfresco/repo/workflow/jbpm/AlfrescoJavaScript.java
index 1f302163da..b4a717bc6d 100644
--- a/source/java/org/alfresco/repo/workflow/jbpm/AlfrescoJavaScript.java
+++ b/source/java/org/alfresco/repo/workflow/jbpm/AlfrescoJavaScript.java
@@ -27,6 +27,7 @@ import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.ScriptService;
@@ -34,9 +35,12 @@ import org.alfresco.service.cmr.workflow.WorkflowException;
import org.dom4j.Element;
import org.jbpm.context.def.VariableAccess;
import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.Node;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.jbpm.taskmgmt.def.Task;
+import org.jbpm.taskmgmt.exe.TaskInstance;
import org.springframework.beans.factory.BeanFactory;
import org.xml.sax.InputSource;
@@ -64,7 +68,6 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
private Element script;
private String runas;
-
/* (non-Javadoc)
* @see org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler#initialiseHandler(org.springframework.beans.factory.BeanFactory)
*/
@@ -74,11 +77,9 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
services = (ServiceRegistry)factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
}
-
/* (non-Javadoc)
* @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
*/
- @SuppressWarnings("unchecked")
public void execute(final ExecutionContext executionContext) throws Exception
{
// validate script
@@ -86,64 +87,13 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
{
throw new WorkflowException("Script has not been provided");
}
+ boolean isTextOnly = isScriptOnlyText();
- // extract action configuration
- String expression = null;
- List variableAccesses = null;
-
- // is the script specified as text only, or as explicit expression, variable elements
- boolean isTextOnly = true;
- Iterator iter = script.elementIterator();
- while (iter.hasNext())
- {
- Element element = iter.next();
- if (element.getNodeType() == org.dom4j.Node.ELEMENT_NODE)
- {
- isTextOnly = false;
- }
- }
-
- // extract script and variables
- if (isTextOnly)
- {
- expression = script.getTextTrim();
- }
- else
- {
- variableAccesses = jpdlReader.readVariableAccesses(script);
- Element expressionElement = script.element("expression");
- if (expressionElement == null)
- {
- throw new WorkflowException("Script expression has not been provided");
- }
- expression = expressionElement.getTextTrim();
- }
+ List variableAccesses = getVariableAccessors(isTextOnly);
+ String expression = getExpression(isTextOnly);
// execute
- Object result = null;
- if (runas == null)
- {
- result = executeScript(executionContext, services, expression, variableAccesses);
- }
- else
- {
- boolean runasExists = services.getPersonService().personExists(runas);
- if (!runasExists)
- {
- throw new WorkflowException("runas user '" + runas + "' does not exist.");
- }
-
- // execute as specified runas user
- final String expr = expression;
- final List varAcc = variableAccesses;
- result = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork