[Fix] Use relation in ExecutionCommand.updateOrderState() instead of type/id
This commit is contained in:
parent
5cc6d1662c
commit
8ee29b7688
|
@ -1,5 +1,6 @@
|
|||
package li.strolch.execution.command;
|
||||
|
||||
import static li.strolch.runtime.StrolchConstants.PolicyConstants.PARAM_ORDER;
|
||||
import static li.strolch.utils.helper.StringHelper.DASH;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
@ -56,12 +57,16 @@ public abstract class ExecutionCommand extends Command implements TimeOrderingVi
|
|||
if (currentState == newState)
|
||||
return;
|
||||
|
||||
String type = rootElement.getType();
|
||||
String id = rootElement.getId();
|
||||
|
||||
Order order = tx().getOrderBy(type, id);
|
||||
if (order == null)
|
||||
return;
|
||||
Order order = tx().getOrderByRelation(rootElement, PARAM_ORDER);
|
||||
if (order == null) {
|
||||
logger.warn("Did not find activity order by relation " + PARAM_ORDER + " for activity " + rootElement
|
||||
.getLocator() + ", trying by Activity type and id");
|
||||
order = tx().getOrderBy(rootElement.getType(), rootElement.getId());
|
||||
if (order == null) {
|
||||
logger.error("Could not find order by Activity type and id either, not updating order state!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
order.setState(rootElement.getState());
|
||||
|
||||
|
|
|
@ -206,4 +206,9 @@ public abstract class ExecutionPolicy extends StrolchPolicy {
|
|||
throws PrivilegeException, Exception {
|
||||
return getContainer().getPrivilegeHandler().runWithResult(StrolchConstants.SYSTEM_USER_AGENT, runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package li.strolch.planning;
|
||||
|
||||
import li.strolch.agent.api.ComponentContainer;
|
||||
import li.strolch.model.Order;
|
||||
import li.strolch.model.activity.Activity;
|
||||
import li.strolch.persistence.api.StrolchTransaction;
|
||||
|
@ -8,8 +7,8 @@ import li.strolch.policy.StrolchPolicy;
|
|||
|
||||
public abstract class ActivityCreationPolicy extends StrolchPolicy {
|
||||
|
||||
public ActivityCreationPolicy(ComponentContainer container, StrolchTransaction tx) {
|
||||
super(container, tx);
|
||||
public ActivityCreationPolicy(StrolchTransaction tx) {
|
||||
super(tx);
|
||||
}
|
||||
|
||||
public abstract Activity create(Order order);
|
||||
|
|
Loading…
Reference in New Issue