[New] Added ConfirmationPolicy.doConfirmation(Action)

This is then called in the ExecuteActivityCommand class after calling the ExecutionPolicy, so that the correct confirmation method is called depending on the new state of the action
This commit is contained in:
Robert von Burg 2020-10-16 11:51:21 +02:00
parent 482330bdc8
commit bea39845e0
2 changed files with 47 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}
}
}