[Major] Removing State.isExecutable() and associated command and policy actions

This commit is contained in:
Robert von Burg 2022-01-19 19:33:49 +01:00
parent 6b4c6b1433
commit 55fd0d181e
3 changed files with 0 additions and 60 deletions

View File

@ -191,13 +191,6 @@ public enum State {
return this == PLANNED || this == EXECUTABLE || this == State.STOPPED;
}
/**
* @return true if {@link #PLANNED} or {@link #EXECUTABLE} or {@link #EXECUTION}
*/
public boolean isExecutable() {
return this == PLANNED || this == EXECUTABLE || this == EXECUTION;
}
/**
* @return true if state >= {@link #EXECUTED}
*/

View File

@ -1,43 +0,0 @@
package li.strolch.execution.command;
import java.text.MessageFormat;
import li.strolch.exception.StrolchException;
import li.strolch.model.State;
import li.strolch.model.activity.Activity;
import li.strolch.persistence.api.StrolchTransaction;
public class SetActionToExecutableCommand extends ActionExecutionCommand {
public SetActionToExecutableCommand(StrolchTransaction tx) {
super(tx);
}
@Override
public void validate() {
super.validate();
if (!this.action.getState().canSetToExecutable()) {
String msg = "Current state is {0} and can not be changed to {1} for action {2}";
msg = MessageFormat.format(msg, this.action.getState(), State.EXECUTABLE, this.action.getLocator());
throw new StrolchException(msg);
}
}
@Override
public void doCommand() {
if (this.action.getState() == State.EXECUTABLE) {
logger.warn("Action " + this.action.getLocator() + " is already in state EXECUTABLE! Not changing.");
return;
}
Activity rootElement = this.action.getRootElement();
State currentState = rootElement.getState();
this.action.setState(State.EXECUTABLE);
getConfirmationPolicy(this.action).toExecutable(this.action);
updateOrderState(tx(), rootElement, currentState, rootElement.getState());
}
}

View File

@ -32,10 +32,6 @@ public class ConfirmationPolicy extends StrolchPolicy {
// do nothing
}
public void toExecutable(Action action) {
// do nothing
}
public void toExecution(Action action) {
// do nothing
}
@ -60,11 +56,6 @@ public class ConfirmationPolicy extends StrolchPolicy {
// do nothing
}
@Override
public void undo() {
// nothing to undo
}
/**
* Calls the appropriate confirmation method depending on the state of the {@link Action}
*
@ -76,7 +67,6 @@ public class ConfirmationPolicy extends StrolchPolicy {
case CREATED -> toCreated(action);
case PLANNING -> toPlanning(action);
case PLANNED -> toPlanned(action);
case EXECUTABLE -> toExecutable(action);
case EXECUTION -> toExecution(action);
case WARNING -> toWarning(action);
case ERROR -> toError(action);