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