Search in sources :

Example 1 with TransitionDefinition

use of org.springframework.webflow.definition.TransitionDefinition in project cas by apereo.

the class AbstractCasWebflowEventResolver method validateEventIdForMatchingTransitionInContext.

/**
     * Validate event for transition.
     *
     * @param eventId    the event id
     * @param context    the context
     * @param attributes the attributes
     * @return the event
     */
protected Event validateEventIdForMatchingTransitionInContext(final String eventId, final RequestContext context, final Map<String, Object> attributes) {
    try {
        final AttributeMap<Object> attributesMap = new LocalAttributeMap<>(attributes);
        final Event event = new Event(this, eventId, attributesMap);
        LOGGER.debug("Resulting event id is [{}]. Locating transitions in the context for that event id...", event.getId());
        final TransitionDefinition def = context.getMatchingTransition(event.getId());
        if (def == null) {
            LOGGER.warn("Transition definition cannot be found for event [{}]", event.getId());
            throw new AuthenticationException();
        }
        LOGGER.debug("Found matching transition [{}] with target [{}] for event [{}] with attributes [{}].", def.getId(), def.getTargetStateId(), event.getId(), event.getAttributes());
        return event;
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : LocalAttributeMap(org.springframework.webflow.core.collection.LocalAttributeMap) AuthenticationException(org.apereo.cas.authentication.AuthenticationException) Event(org.springframework.webflow.execution.Event) TransitionDefinition(org.springframework.webflow.definition.TransitionDefinition) AuthenticationException(org.apereo.cas.authentication.AuthenticationException)

Aggregations

AuthenticationException (org.apereo.cas.authentication.AuthenticationException)1 LocalAttributeMap (org.springframework.webflow.core.collection.LocalAttributeMap)1 TransitionDefinition (org.springframework.webflow.definition.TransitionDefinition)1 Event (org.springframework.webflow.execution.Event)1