Search in sources :

Example 1 with ActionFilter

use of jodd.madvoc.filter.ActionFilter in project jodd by oblac.

the class ActionMethodParser method parse.

/**
	 * Parses java action method annotation and returns its action configuration.
	 *
	 * @param actionClass action class
	 * @param actionMethod action method
	 * @param actionDef optional action def, usually <code>null</code> so to be parsed
	 */
public ActionConfig parse(final Class<?> actionClass, final Method actionMethod, ActionDef actionDef) {
    // interceptors
    ActionInterceptor[] actionInterceptors = parseActionInterceptors(actionClass, actionMethod);
    // filters
    ActionFilter[] actionFilters = parseActionFilters(actionClass, actionMethod);
    // build action definition when not provided
    if (actionDef == null) {
        actionDef = parseActionDef(actionClass, actionMethod);
    }
    ActionAnnotationData annotationData = detectActionAnnotationData(actionMethod);
    detectAndRegisterAlias(annotationData, actionDef);
    final boolean async = parseMethodAsyncFlag(annotationData);
    final Class<? extends ActionResult> actionResult = parseActionResult(annotationData);
    return createActionConfig(actionClass, actionMethod, actionResult, actionFilters, actionInterceptors, actionDef, async);
}
Also used : ActionInterceptor(jodd.madvoc.interceptor.ActionInterceptor) ActionAnnotationData(jodd.madvoc.meta.ActionAnnotationData) ActionFilter(jodd.madvoc.filter.ActionFilter)

Example 2 with ActionFilter

use of jodd.madvoc.filter.ActionFilter in project jodd by oblac.

the class ActionMethodParser method parse.

/**
 * Parses java action method annotation and returns its action runtime.
 *
 * @param actionClass action class
 * @param actionMethod action method
 * @param actionDefinition optional action def, usually <code>null</code> so to be parsed
 */
public ActionRuntime parse(final Class<?> actionClass, final Method actionMethod, ActionDefinition actionDefinition) {
    final ActionAnnotationValues annotationValues = detectActionAnnotationValues(actionMethod);
    final ActionConfig actionConfig = resolveActionConfig(annotationValues);
    // interceptors
    final ActionInterceptor[] actionInterceptors = parseActionInterceptors(actionClass, actionMethod, actionConfig);
    // filters
    final ActionFilter[] actionFilters = parseActionFilters(actionClass, actionMethod, actionConfig);
    // build action definition when not provided
    if (actionDefinition == null) {
        actionDefinition = parseActionDefinition(actionClass, actionMethod);
    }
    detectAndRegisterAlias(annotationValues, actionDefinition);
    final boolean async = parseMethodAsyncFlag(actionMethod);
    final boolean auth = parseMethodAuthFlag(actionMethod);
    final Class<? extends ActionResult> actionResult = parseActionResult(actionMethod);
    final Class<? extends ActionResult> defaultActionResult = actionConfig.getActionResult();
    return createActionRuntime(null, actionClass, actionMethod, actionResult, defaultActionResult, actionFilters, actionInterceptors, actionDefinition, async, auth);
}
Also used : ActionConfig(jodd.madvoc.ActionConfig) ActionInterceptor(jodd.madvoc.interceptor.ActionInterceptor) ActionFilter(jodd.madvoc.filter.ActionFilter) ActionAnnotationValues(jodd.madvoc.meta.ActionAnnotationValues)

Example 3 with ActionFilter

use of jodd.madvoc.filter.ActionFilter in project jodd by oblac.

the class ActionMethodParser method readActionFilters.

// ---------------------------------------------------------------- filters
/**
 * Reads class or method annotation for action filters.
 */
protected Class<? extends ActionFilter>[] readActionFilters(final AnnotatedElement actionClassOrMethod) {
    Class<? extends ActionFilter>[] result = null;
    final FilteredBy filteredBy = actionClassOrMethod.getAnnotation(FilteredBy.class);
    if (filteredBy != null) {
        result = filteredBy.value();
        if (result.length == 0) {
            result = null;
        }
    }
    return result;
}
Also used : FilteredBy(jodd.madvoc.meta.FilteredBy) ActionFilter(jodd.madvoc.filter.ActionFilter)

Aggregations

ActionFilter (jodd.madvoc.filter.ActionFilter)3 ActionInterceptor (jodd.madvoc.interceptor.ActionInterceptor)2 ActionConfig (jodd.madvoc.ActionConfig)1 ActionAnnotationData (jodd.madvoc.meta.ActionAnnotationData)1 ActionAnnotationValues (jodd.madvoc.meta.ActionAnnotationValues)1 FilteredBy (jodd.madvoc.meta.FilteredBy)1