[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());
|
DBC.PRE.assertEquals("Can not plan illegal state", State.CREATED, action.getState());
|
||||||
logger.info("Planning action " + action.getLocator());
|
logger.info("Planning action " + action.getLocator());
|
||||||
action.setState(State.PLANNED);
|
action.setState(State.PLANNED);
|
||||||
|
tx().update(action.getRootElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unplan(Action action) {
|
public void unplan(Action action) {
|
||||||
DBC.PRE.assertEquals("Can not unplan illegal state", State.PLANNED, action.getState());
|
DBC.PRE.assertEquals("Can not unplan illegal state", State.PLANNED, action.getState());
|
||||||
action.setState(State.CREATED);
|
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());
|
throw new IllegalStateException("Can not plan illegal state " + action.getState());
|
||||||
|
|
||||||
logger.info("Planning action " + action.getLocator());
|
logger.info("Planning action " + action.getLocator());
|
||||||
|
action.setState(State.PLANNING);
|
||||||
|
|
||||||
Resource resource = evaluateAndSetResource(action);
|
Resource resource = evaluateAndSetResource(action);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
logger.error("No resource evaluated, so can not plan " + action.getLocator());
|
logger.error("No resource evaluated, so can not plan " + action.getLocator());
|
||||||
|
tx().update(action.getRootElement());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +53,7 @@ public class SimplePlanning extends PlanningPolicy {
|
||||||
}
|
}
|
||||||
|
|
||||||
action.setState(State.PLANNED);
|
action.setState(State.PLANNED);
|
||||||
|
tx().update(action.getRootElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue