[Fix] Fixed action state not set to planning if planning failed
This commit is contained in:
parent
9f8e69e729
commit
ec95b2dae8
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue