Author: sb
Date: Mon Jan 21 18:06:25 2008
New Revision: 7217
Log:
- Cancel execution on activation of Cancel node.
# Code Coverage is now slightly below 100%, will add missing test(s) later.
Modified:
trunk/Workflow/src/interfaces/execution.php
trunk/Workflow/src/nodes/cancel.php
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitActionActionCancelCaseSynchronization.log
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitCancelCaseActionActionSynchronization.log
Modified: trunk/Workflow/src/interfaces/execution.php
==============================================================================
--- trunk/Workflow/src/interfaces/execution.php [iso-8859-1] (original)
+++ trunk/Workflow/src/interfaces/execution.php [iso-8859-1] Mon Jan 21
18:06:25 2008
@@ -556,14 +556,15 @@
*/
public function activate( ezcWorkflowNode $node, $notifyListeners = true )
{
- // Check whether the node is ready to be activated
- // and not yet activated.
- if ( !$node->isExecutable() ||
+ // Only activate the node when
+ // - the execution of the workflow has not been cancelled,
+ // - the node is ready to be activated,
+ // - and the node is not already activated.
+ if ( $this->isCancelled() ||
+ !$node->isExecutable() ||
ezcWorkflowUtil::findObject( $this->activatedNodes, $node ) !==
false )
{
- // @codeCoverageIgnoreStart
return false;
- // @codeCoverageIgnoreEnd
}
// Add node to list of activated nodes.
@@ -649,26 +650,31 @@
*/
public function startThread( $parentId = null, $numSiblings = 1 )
{
- $this->threads[$this->nextThreadId] = array(
- 'parentId' => $parentId,
- 'numSiblings' => $numSiblings
- );
-
- $this->notifyListeners(
- sprintf(
- 'Started thread #%d (%s%d sibling(s)) for execution #%d of
workflow "%s" (version %d).',
-
- $this->nextThreadId,
- $parentId != null ? 'parent: ' . $parentId . ', ' : '',
- $numSiblings,
- $this->id,
- $this->workflow->name,
- $this->workflow->version
- ),
- ezcWorkflowExecutionListener::DEBUG
- );
-
- return $this->nextThreadId++;
+ if ( !$this->isCancelled() )
+ {
+ $this->threads[$this->nextThreadId] = array(
+ 'parentId' => $parentId,
+ 'numSiblings' => $numSiblings
+ );
+
+ $this->notifyListeners(
+ sprintf(
+ 'Started thread #%d (%s%d sibling(s)) for execution #%d of
workflow "%s" (version %d).',
+
+ $this->nextThreadId,
+ $parentId != null ? 'parent: ' . $parentId . ', ' : '',
+ $numSiblings,
+ $this->id,
+ $this->workflow->name,
+ $this->workflow->version
+ ),
+ ezcWorkflowExecutionListener::DEBUG
+ );
+
+ return $this->nextThreadId++;
+ }
+
+ return false;
}
/**
Modified: trunk/Workflow/src/nodes/cancel.php
==============================================================================
--- trunk/Workflow/src/nodes/cancel.php [iso-8859-1] (original)
+++ trunk/Workflow/src/nodes/cancel.php [iso-8859-1] Mon Jan 21 18:06:25 2008
@@ -43,9 +43,11 @@
* Cancels the execution of this workflow.
*
* @param ezcWorkflowExecution $execution
+ * @param ezcWorkflowNode $activatedFrom
+ * @param int $threadId
* @ignore
*/
- public function execute( ezcWorkflowExecution $execution )
+ public function activate( ezcWorkflowExecution $execution, ezcWorkflowNode
$activatedFrom = null, $threadId = 0 )
{
$execution->cancel( $this );
}
Modified:
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitActionActionCancelCaseSynchronization.log
==============================================================================
---
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitActionActionCancelCaseSynchronization.log
[iso-8859-1] (original)
+++
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitActionActionCancelCaseSynchronization.log
[iso-8859-1] Mon Jan 21 18:06:25 2008
@@ -8,12 +8,5 @@
MMM DD HH:MM:SS [Debug] [default] [default] Started thread #2 (3 sibling(s))
for execution #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#6(ezcWorkflowNodeAction) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Started thread #3 (3 sibling(s))
for execution #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#7(ezcWorkflowNodeCancel) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#4(ezcWorkflowNodeSynchronization) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#3(ezcWorkflowNodeAction) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#6(ezcWorkflowNodeAction) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Could not roll back service object
"ServiceObject" of node #3 for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Could not roll back service object
"ServiceObject" of node #6 for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#7(ezcWorkflowNodeCancel) for instance #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
MMM DD HH:MM:SS [Info] [default] [default] Cancelled execution #1 of workflow
"ParallelSplitActionActionCancelCaseSynchronization" (version 1).
Modified:
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitCancelCaseActionActionSynchronization.log
==============================================================================
---
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitCancelCaseActionActionSynchronization.log
[iso-8859-1] (original)
+++
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitCancelCaseActionActionSynchronization.log
[iso-8859-1] Mon Jan 21 18:06:25 2008
@@ -4,11 +4,5 @@
MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#1(ezcWorkflowNodeStart) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Started thread #1 (3 sibling(s))
for execution #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#3(ezcWorkflowNodeCancel) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Started thread #2 (3 sibling(s))
for execution #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#6(ezcWorkflowNodeAction) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Started thread #3 (3 sibling(s))
for execution #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#7(ezcWorkflowNodeAction) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
-MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#3(ezcWorkflowNodeCancel) for instance #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
MMM DD HH:MM:SS [Info] [default] [default] Cancelled execution #1 of workflow
"ParallelSplitCancelCaseActionActionSynchronization" (version 1).
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components