diff --git a/li.strolch.service/src/main/java/li/strolch/execution/command/ExecuteActivityCommand.java b/li.strolch.service/src/main/java/li/strolch/execution/command/ExecuteActivityCommand.java index 421a4b56a..e133c92ad 100644 --- a/li.strolch.service/src/main/java/li/strolch/execution/command/ExecuteActivityCommand.java +++ b/li.strolch.service/src/main/java/li/strolch/execution/command/ExecuteActivityCommand.java @@ -91,7 +91,7 @@ public class ExecuteActivityCommand extends BasePlanningAndExecutionCommand logger.info("Action " + action.getLocator() + " is now being executed..."); executionPolicy.toExecution(action); - confirmationPolicy.toExecution(action); + confirmationPolicy.doConfirmation(action); if (action.getState() == State.EXECUTED) this.needsRetriggerOfExecution = true; diff --git a/li.strolch.service/src/main/java/li/strolch/execution/policy/ConfirmationPolicy.java b/li.strolch.service/src/main/java/li/strolch/execution/policy/ConfirmationPolicy.java index e8e4173a8..0f9af8a1e 100644 --- a/li.strolch.service/src/main/java/li/strolch/execution/policy/ConfirmationPolicy.java +++ b/li.strolch.service/src/main/java/li/strolch/execution/policy/ConfirmationPolicy.java @@ -24,6 +24,10 @@ public class ConfirmationPolicy extends StrolchPolicy { // do nothing } + public void toPlanning(Action action) { + // do nothing + } + public void toPlanned(Action action) { // do nothing } @@ -60,4 +64,46 @@ public class ConfirmationPolicy extends StrolchPolicy { public void undo() { // nothing to undo } + + /** + * Calls the appropriate confirmation method depending on the state of the {@link Action} + * + * @param action + * the action for which to perform the confirmation call + */ + public void doConfirmation(Action action) { + switch (action.getState()) { + + case CREATED: + toCreated(action); + break; + case PLANNING: + toPlanning(action); + break; + case PLANNED: + toPlanned(action); + break; + case EXECUTABLE: + toExecutable(action); + break; + case EXECUTION: + toExecution(action); + break; + case WARNING: + toWarning(action); + break; + case ERROR: + toError(action); + break; + case STOPPED: + toStopped(action); + break; + case EXECUTED: + toExecuted(action); + break; + case CLOSED: + toClosed(action); + break; + } + } }