[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:
parent
482330bdc8
commit
bea39845e0
|
@ -91,7 +91,7 @@ public class ExecuteActivityCommand extends BasePlanningAndExecutionCommand
|
||||||
logger.info("Action " + action.getLocator() + " is now being executed...");
|
logger.info("Action " + action.getLocator() + " is now being executed...");
|
||||||
|
|
||||||
executionPolicy.toExecution(action);
|
executionPolicy.toExecution(action);
|
||||||
confirmationPolicy.toExecution(action);
|
confirmationPolicy.doConfirmation(action);
|
||||||
|
|
||||||
if (action.getState() == State.EXECUTED)
|
if (action.getState() == State.EXECUTED)
|
||||||
this.needsRetriggerOfExecution = true;
|
this.needsRetriggerOfExecution = true;
|
||||||
|
|
|
@ -24,6 +24,10 @@ public class ConfirmationPolicy extends StrolchPolicy {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toPlanning(Action action) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
public void toPlanned(Action action) {
|
public void toPlanned(Action action) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -60,4 +64,46 @@ public class ConfirmationPolicy extends StrolchPolicy {
|
||||||
public void undo() {
|
public void undo() {
|
||||||
// nothing to 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue