mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Workflow:
- Addition of Workflow Task URL Command Processor git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3597 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
public class BPMEngineRegistry
|
public class BPMEngineRegistry
|
||||||
{
|
{
|
||||||
/** ID seperator used in global Ids */
|
/** ID seperator used in global Ids */
|
||||||
private static final String ID_SEPERATOR = "://";
|
private static final String ID_SEPERATOR = "-";
|
||||||
|
|
||||||
/** Logging support */
|
/** Logging support */
|
||||||
private static Log logger = LogFactory.getLog("org.alfresco.repo.workflow");
|
private static Log logger = LogFactory.getLog("org.alfresco.repo.workflow");
|
||||||
|
@@ -113,6 +113,10 @@ public class JBPMEngine extends BPMEngine
|
|||||||
"and ti.isOpen = false " +
|
"and ti.isOpen = false " +
|
||||||
"and ti.end is not null";
|
"and ti.end is not null";
|
||||||
|
|
||||||
|
// Workflow Path Seperators
|
||||||
|
private final static String WORKFLOW_PATH_SEPERATOR = "--";
|
||||||
|
private final static String WORKFLOW_TOKEN_SEPERATOR = "@";
|
||||||
|
|
||||||
// I18N labels
|
// I18N labels
|
||||||
private final static String TITLE_LABEL = "title";
|
private final static String TITLE_LABEL = "title";
|
||||||
private final static String DESC_LABEL = "description";
|
private final static String DESC_LABEL = "description";
|
||||||
@@ -1050,7 +1054,7 @@ public class JBPMEngine extends BPMEngine
|
|||||||
protected Token getWorkflowToken(GraphSession session, String pathId)
|
protected Token getWorkflowToken(GraphSession session, String pathId)
|
||||||
{
|
{
|
||||||
// extract process id and token path within process
|
// extract process id and token path within process
|
||||||
String[] path = pathId.split("::");
|
String[] path = pathId.split(WORKFLOW_PATH_SEPERATOR);
|
||||||
if (path.length != 2)
|
if (path.length != 2)
|
||||||
{
|
{
|
||||||
throw new WorkflowException("Invalid workflow path '" + pathId + "'");
|
throw new WorkflowException("Invalid workflow path '" + pathId + "'");
|
||||||
@@ -1058,7 +1062,8 @@ public class JBPMEngine extends BPMEngine
|
|||||||
|
|
||||||
// retrieve jBPM token for workflow position
|
// retrieve jBPM token for workflow position
|
||||||
ProcessInstance processInstance = session.loadProcessInstance(getJbpmId(path[0]));
|
ProcessInstance processInstance = session.loadProcessInstance(getJbpmId(path[0]));
|
||||||
Token token = processInstance.findToken(path[1]);
|
String tokenId = path[1].replace(WORKFLOW_TOKEN_SEPERATOR, "/");
|
||||||
|
Token token = processInstance.findToken(tokenId);
|
||||||
if (token == null)
|
if (token == null)
|
||||||
{
|
{
|
||||||
throw new WorkflowException("Workflow path '" + pathId + "' does not exist");
|
throw new WorkflowException("Workflow path '" + pathId + "' does not exist");
|
||||||
@@ -1417,7 +1422,8 @@ public class JBPMEngine extends BPMEngine
|
|||||||
protected WorkflowPath createWorkflowPath(Token token)
|
protected WorkflowPath createWorkflowPath(Token token)
|
||||||
{
|
{
|
||||||
WorkflowPath path = new WorkflowPath();
|
WorkflowPath path = new WorkflowPath();
|
||||||
path.id = createGlobalId(token.getProcessInstance().getId() + "::" + token.getFullName());
|
String tokenId = token.getFullName().replace("/", WORKFLOW_TOKEN_SEPERATOR);
|
||||||
|
path.id = createGlobalId(token.getProcessInstance().getId() + WORKFLOW_PATH_SEPERATOR + tokenId);
|
||||||
path.instance = createWorkflowInstance(token.getProcessInstance());
|
path.instance = createWorkflowInstance(token.getProcessInstance());
|
||||||
path.node = createWorkflowNode(token.getNode());
|
path.node = createWorkflowNode(token.getNode());
|
||||||
path.active = !token.hasEnded();
|
path.active = !token.hasEnded();
|
||||||
|
@@ -131,7 +131,7 @@ public class JBPMEngineTest extends BaseSpringTest
|
|||||||
WorkflowDefinition workflowDef = getTestDefinition();
|
WorkflowDefinition workflowDef = getTestDefinition();
|
||||||
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, null);
|
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, null);
|
||||||
assertNotNull(path);
|
assertNotNull(path);
|
||||||
assertTrue(path.id.endsWith("::/"));
|
assertTrue(path.id.endsWith("--@"));
|
||||||
assertNotNull(path.node);
|
assertNotNull(path.node);
|
||||||
assertNotNull(path.instance);
|
assertNotNull(path.instance);
|
||||||
assertEquals(workflowDef.id, path.instance.definition.id);
|
assertEquals(workflowDef.id, path.instance.definition.id);
|
||||||
@@ -154,7 +154,7 @@ public class JBPMEngineTest extends BaseSpringTest
|
|||||||
|
|
||||||
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, params);
|
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, params);
|
||||||
assertNotNull(path);
|
assertNotNull(path);
|
||||||
assertTrue(path.id.endsWith("::/"));
|
assertTrue(path.id.endsWith("--@"));
|
||||||
assertNotNull(path.node);
|
assertNotNull(path.node);
|
||||||
assertNotNull(path.instance);
|
assertNotNull(path.instance);
|
||||||
assertEquals(workflowDef.id, path.instance.definition.id);
|
assertEquals(workflowDef.id, path.instance.definition.id);
|
||||||
@@ -187,7 +187,7 @@ public class JBPMEngineTest extends BaseSpringTest
|
|||||||
|
|
||||||
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, params);
|
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.id, params);
|
||||||
assertNotNull(path);
|
assertNotNull(path);
|
||||||
assertTrue(path.id.endsWith("::/"));
|
assertTrue(path.id.endsWith("--@"));
|
||||||
assertNotNull(path.node);
|
assertNotNull(path.node);
|
||||||
assertNotNull(path.instance);
|
assertNotNull(path.instance);
|
||||||
assertEquals(workflowDef.id, path.instance.definition.id);
|
assertEquals(workflowDef.id, path.instance.definition.id);
|
||||||
@@ -279,7 +279,7 @@ public class JBPMEngineTest extends BaseSpringTest
|
|||||||
assertNotNull(paths);
|
assertNotNull(paths);
|
||||||
assertEquals(1, paths.size());
|
assertEquals(1, paths.size());
|
||||||
assertEquals(instances.get(0).id, paths.get(0).instance.id);
|
assertEquals(instances.get(0).id, paths.get(0).instance.id);
|
||||||
assertTrue(paths.get(0).id.endsWith("::/"));
|
assertTrue(paths.get(0).id.endsWith("--@"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user