use of org.estatio.module.capex.dom.state.StateTransition in project estatio by estatio.
the class EnforceTaskAssignmentPolicySubscriber method on.
@EventHandler
@Subscribe
public void on(Task_mixinActAbstract.ActionDomainEvent ev) {
if (ev.getSemantics().isSafeInNature()) {
return;
}
final Class stateTransitionClass = ev.getStateTransitionClass();
final Task task = (Task) ev.getMixedIn();
final StateTransition transition = stateTransitionService.findFor(task);
if (transition == null) {
// shouldn't occur
return;
}
final Class taskTransitionClass = stateTransitionService.transitionClassFor(transition.getTransitionType());
if (stateTransitionClass != taskTransitionClass) {
// or, maybe should hide (and then we can delete code in the subtypes of the mixinAbstract
return;
}
final Object domainObject = transition.getDomainObject();
applyPolicy(stateTransitionClass, domainObject, ev);
}
Aggregations