[Fix] Fixed issues where remaining actions on Activity aren't executed

This ocurred because of settings remaining unneeded Actions to state
CLOSED, and thus execution was not continued.
This commit is contained in:
Robert von Burg 2017-05-19 10:55:57 +02:00
parent bb1cd337c7
commit 1354a89f72
3 changed files with 9 additions and 5 deletions

View File

@ -243,7 +243,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
synchronized (this.registeredActivities) {
if (!this.registeredActivities.removeElement(realm, activityLoc))
logger.warn("Activity " + actionLoc + " already removed from registered activities!");
logger.warn("Activity " + activityLoc + " already removed from registered activities!");
}
archiveActivity(realm, activity.getLocator());

View File

@ -82,9 +82,12 @@ public abstract class ExecutionCommand extends Command implements TimeOrderingVi
Iterator<Entry<String, IActivityElement>> iter = activity.elementIterator();
while (iter.hasNext()) {
IActivityElement element = iter.next().getValue();
State state = element.getState();
if (element.getState().compareTo(State.EXECUTED) >= 0)
continue;
// in series we can never have two Actions in execution, so if we found the action in execution, we stop
if (element instanceof Action && element.getState() == State.EXECUTION)
if (element instanceof Action && state == State.EXECUTION)
break;
boolean canExecute = isExecutable(element);
@ -104,6 +107,8 @@ public abstract class ExecutionCommand extends Command implements TimeOrderingVi
Iterator<Entry<String, IActivityElement>> iter = activity.elementIterator();
while (iter.hasNext()) {
IActivityElement element = iter.next().getValue();
if (element.getState().isExecuted())
continue;
boolean canExecute = isExecutable(element);
if (canExecute) {
@ -113,7 +118,7 @@ public abstract class ExecutionCommand extends Command implements TimeOrderingVi
}
protected boolean isExecutable(IActivityElement element) {
if (element.getState() == State.EXECUTED)
if (element.getState().compareTo(State.EXECUTED) >= 0)
return false;
return element instanceof Activity || element.getState().compareTo(State.EXECUTION) < 0;
}

View File

@ -8,8 +8,7 @@ import li.strolch.persistence.api.StrolchTransaction;
/**
* <p>
* Simple Execution Policy which sets the state of the action depending on the
* method called.
* Simple Execution Policy which sets the state of the action depending on the method called.
* </p>
*
* @author Robert von Burg <eitch@eitchnet.ch>