[Fix] Fixed action state not set to planning if planning failed

This commit is contained in:
Robert von Burg 2022-01-26 12:56:35 +01:00
parent 9f8e69e729
commit ec95b2dae8
2 changed files with 5 additions and 0 deletions

View File

@ -17,11 +17,13 @@ public class NoPlanning extends PlanningPolicy {
DBC.PRE.assertEquals("Can not plan illegal state", State.CREATED, action.getState());
logger.info("Planning action " + action.getLocator());
action.setState(State.PLANNED);
tx().update(action.getRootElement());
}
@Override
public void unplan(Action action) {
DBC.PRE.assertEquals("Can not unplan illegal state", State.PLANNED, action.getState());
action.setState(State.CREATED);
tx().update(action.getRootElement());
}
}

View File

@ -35,10 +35,12 @@ public class SimplePlanning extends PlanningPolicy {
throw new IllegalStateException("Can not plan illegal state " + action.getState());
logger.info("Planning action " + action.getLocator());
action.setState(State.PLANNING);
Resource resource = evaluateAndSetResource(action);
if (resource == null) {
logger.error("No resource evaluated, so can not plan " + action.getLocator());
tx().update(action.getRootElement());
return;
}
@ -51,6 +53,7 @@ public class SimplePlanning extends PlanningPolicy {
}
action.setState(State.PLANNED);
tx().update(action.getRootElement());
}
/**