Search in sources :

Example 1 with EventHandler

use of org.axonframework.eventhandling.annotation.EventHandler 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);
}
Also used : Task(org.estatio.module.capex.dom.task.Task) StateTransition(org.estatio.module.capex.dom.state.StateTransition) EventHandler(org.axonframework.eventhandling.annotation.EventHandler) Subscribe(com.google.common.eventbus.Subscribe)

Example 2 with EventHandler

use of org.axonframework.eventhandling.annotation.EventHandler in project estatio by estatio.

the class AliasUiSubscriber method on.

@EventHandler
@Subscribe
public void on(Alias.CssClassUiEvent ev) {
    Alias alias = ev.getSource();
    ev.setCssClass("Alias" + alias.getAtPath().replace("/", "-"));
}
Also used : Alias(org.incode.module.alias.dom.impl.Alias) EventHandler(org.axonframework.eventhandling.annotation.EventHandler) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)2 EventHandler (org.axonframework.eventhandling.annotation.EventHandler)2 StateTransition (org.estatio.module.capex.dom.state.StateTransition)1 Task (org.estatio.module.capex.dom.task.Task)1 Alias (org.incode.module.alias.dom.impl.Alias)1