List of usage examples for org.springframework.statemachine StateContext getTransition
Transition<S, E> getTransition();
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
public void callOnTransitionStart(String stateMachineId, StateContext<S, E> stateContext) { List<StateMachineHandler<? extends Annotation, S, E>> handlersList = new ArrayList<StateMachineHandler<? extends Annotation, S, E>>(); String cacheKey = OnTransitionStart.class.getName() + stateMachineId; List<CacheEntry> list = getCacheEntries(cacheKey); if (list == null) { return;// w w w . j a v a 2 s . c om } for (CacheEntry entry : list) { if (annotationHandlerSourceTargetMatch( (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "source"), (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "target"), entry.annotation, stateContext.getTransition().getSource(), stateContext.getTransition().getTarget())) { handlersList.add(entry.handler); } } getStateMachineHandlerResults(handlersList, stateContext); }
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
public void callOnTransition(String stateMachineId, StateContext<S, E> stateContext) { List<StateMachineHandler<? extends Annotation, S, E>> handlersList = new ArrayList<StateMachineHandler<? extends Annotation, S, E>>(); String cacheKey = OnTransition.class.getName() + stateMachineId; List<CacheEntry> list = getCacheEntries(cacheKey); if (list == null) { return;/*from ww w. j a v a2s . co m*/ } for (CacheEntry entry : list) { if (annotationHandlerSourceTargetMatch( (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "source"), (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "target"), entry.annotation, stateContext.getTransition().getSource(), stateContext.getTransition().getTarget())) { handlersList.add(entry.handler); } } getStateMachineHandlerResults(handlersList, stateContext); }
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
public void callOnTransitionEnd(String stateMachineId, StateContext<S, E> stateContext) { List<StateMachineHandler<? extends Annotation, S, E>> handlersList = new ArrayList<StateMachineHandler<? extends Annotation, S, E>>(); String cacheKey = OnTransitionEnd.class.getName() + stateMachineId; List<CacheEntry> list = getCacheEntries(cacheKey); if (list == null) { return;//from w w w. java 2s .c om } for (CacheEntry entry : list) { if (annotationHandlerSourceTargetMatch( (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "source"), (String[]) AnnotationUtils.getValue(entry.metaAnnotation, "target"), entry.annotation, stateContext.getTransition().getSource(), stateContext.getTransition().getTarget())) { handlersList.add(entry.handler); } } getStateMachineHandlerResults(handlersList, stateContext); }
From source file:org.springframework.statemachine.support.StateMachineObjectSupport.java
protected void notifyTransitionStart(StateContext<S, E> stateContext) { try {/* ww w .j av a 2 s. co m*/ stateMachineHandlerCallHelper.callOnTransitionStart(getBeanName(), stateContext); stateListener.transitionStarted(stateContext.getTransition()); stateListener.stateContext(stateContext); if (contextEventsEnabled) { StateMachineEventPublisher eventPublisher = getStateMachineEventPublisher(); if (eventPublisher != null) { eventPublisher.publishTransitionStart(this, stateContext.getTransition()); } } } catch (Throwable e) { log.warn("Error during notifyTransitionStart", e); } }
From source file:org.springframework.statemachine.support.StateMachineObjectSupport.java
protected void notifyTransition(StateContext<S, E> stateContext) { try {//from ww w.ja v a 2s .c o m stateMachineHandlerCallHelper.callOnTransition(getBeanName(), stateContext); stateListener.transition(stateContext.getTransition()); stateListener.stateContext(stateContext); if (contextEventsEnabled) { StateMachineEventPublisher eventPublisher = getStateMachineEventPublisher(); if (eventPublisher != null) { eventPublisher.publishTransition(this, stateContext.getTransition()); } } } catch (Throwable e) { log.warn("Error during notifyTransition", e); } }
From source file:org.springframework.statemachine.support.StateMachineObjectSupport.java
protected void notifyTransitionEnd(StateContext<S, E> stateContext) { try {/* ww w . ja v a 2s .c o m*/ stateMachineHandlerCallHelper.callOnTransitionEnd(getBeanName(), stateContext); stateListener.transitionEnded(stateContext.getTransition()); stateListener.stateContext(stateContext); if (contextEventsEnabled) { StateMachineEventPublisher eventPublisher = getStateMachineEventPublisher(); if (eventPublisher != null) { eventPublisher.publishTransitionEnd(this, stateContext.getTransition()); } } } catch (Throwable e) { log.warn("Error during notifyTransitionEnd", e); } }