com.scooterframework.admin
Class FilterManager

java.lang.Object
  extended by com.scooterframework.admin.FilterManager

public class FilterManager
extends java.lang.Object

FilterManager manages all filters of a specific controller class.

Filters are registered through this class. The order of filters depends on the order they appear in the filter declaration methods: declareBeforeFilter, declareAfterFilter, declareSkipBeforeFilter and declareSkipAfterFilter.


Field Summary
static java.lang.String FILTER_OPTION_EXCEPT
           
static java.lang.String FILTER_OPTION_ONLY
           
static java.lang.String FILTER_TYPE_AFTER
           
static java.lang.String FILTER_TYPE_BEFORE
           
static java.lang.String FILTER_TYPE_SKIP_AFTER
           
static java.lang.String FILTER_TYPE_SKIP_BEFORE
           
 
Method Summary
 void declareAfterFilter(java.lang.Class<?> filterClz, java.lang.String filters)
          Specifies 'after' filters that apply to all actions of the controller class.
 void declareAfterFilter(java.lang.Class<?> filterClz, java.lang.String filters, java.lang.String option, java.lang.String actions)
          Specifies 'after' filters that apply to specific actions of the controller class under special conditions.
 void declareAfterFilter(java.lang.String filters)
          Specifies 'after' filters that apply to all actions of this class.
 void declareAfterFilter(java.lang.String filters, java.lang.String option, java.lang.String actions)
          Specifies 'after' filters that apply to specific actions of this class under special conditions.
 void declareBeforeFilter(java.lang.Class<?> filterClz, java.lang.String filters)
          Specifies 'before' filters that apply to all actions of the controller class.
 void declareBeforeFilter(java.lang.Class<?> filterClz, java.lang.String filters, java.lang.String option, java.lang.String actions)
          Specifies 'before' filters that apply to specific actions of the controller class under special conditions.
 void declareBeforeFilter(java.lang.String filters)
          Specifies 'before' filters that apply to all actions of this class.
 void declareBeforeFilter(java.lang.String filters, java.lang.String option, java.lang.String actions)
          Specifies 'before' filters that apply to specific actions of this class under special conditions.
 void declareSkipAfterFilter(java.lang.Class<?> filterClz, java.lang.String filters)
          Skips 'after' filters that apply to all actions of the controller class.
 void declareSkipAfterFilter(java.lang.Class<?> filterClz, java.lang.String filters, java.lang.String option, java.lang.String actions)
          Skips 'after' filters that apply to specific actions of the controller class under special conditions.
 void declareSkipAfterFilter(java.lang.String filters)
          Skips 'after' filters that apply to all actions of this class.
 void declareSkipAfterFilter(java.lang.String filters, java.lang.String option, java.lang.String actions)
          Skips 'after' filters that apply to specific actions of this class under special conditions.
 void declareSkipBeforeFilter(java.lang.Class<?> filterClz, java.lang.String filters)
          Skips 'before' filters that apply to all actions of the controller class.
 void declareSkipBeforeFilter(java.lang.Class<?> filterClz, java.lang.String filters, java.lang.String option, java.lang.String actions)
          Skips 'before' filters that apply to specific actions of the controller class under special conditions.
 void declareSkipBeforeFilter(java.lang.String filters)
          Skips 'before' filters that apply to all actions of this class.
 void declareSkipBeforeFilter(java.lang.String filters, java.lang.String option, java.lang.String actions)
          Skips 'before' filters that apply to specific actions of this class under special conditions.
 java.lang.String executeAfterFiltersOn(java.lang.String action)
          Executes filters after an action is run.
 java.lang.String executeBeforeFiltersOn(java.lang.String action)
          Executes filters before an action is run.
 java.util.Map<java.lang.String,java.util.List<ActionControlFilter>> getActionAfterFiltersMap()
          Returns a map of an action and its related after filters.
 java.util.Map<java.lang.String,java.util.List<ActionControlFilter>> getActionBeforeFiltersMap()
          Returns a map of an action and its related before filters.
 java.util.List<ActionControlFilter> getAfterFiltersForAction(java.lang.String action)
          Returns a list of after ActionFilter objects for an action.
 java.util.List<ActionControlFilter> getBeforeFiltersForAction(java.lang.String action)
          Returns a list of before ActionFilter objects for an action.
 java.lang.Class<?> getOwnerClass()
          Returns the owner class.
 java.lang.String getOwnerClassName()
          Returns the name of the owner class.
 boolean noFilterDeclared()
          True if no filter declared.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER_TYPE_BEFORE

public static final java.lang.String FILTER_TYPE_BEFORE
See Also:
Constant Field Values

FILTER_TYPE_AFTER

public static final java.lang.String FILTER_TYPE_AFTER
See Also:
Constant Field Values

FILTER_TYPE_SKIP_BEFORE

public static final java.lang.String FILTER_TYPE_SKIP_BEFORE
See Also:
Constant Field Values

FILTER_TYPE_SKIP_AFTER

public static final java.lang.String FILTER_TYPE_SKIP_AFTER
See Also:
Constant Field Values

FILTER_OPTION_EXCEPT

public static final java.lang.String FILTER_OPTION_EXCEPT
See Also:
Constant Field Values

FILTER_OPTION_ONLY

public static final java.lang.String FILTER_OPTION_ONLY
See Also:
Constant Field Values
Method Detail

getOwnerClass

public java.lang.Class<?> getOwnerClass()
Returns the owner class.


getOwnerClassName

public java.lang.String getOwnerClassName()
Returns the name of the owner class.


noFilterDeclared

public boolean noFilterDeclared()
True if no filter declared.


getBeforeFiltersForAction

public java.util.List<ActionControlFilter> getBeforeFiltersForAction(java.lang.String action)
Returns a list of before ActionFilter objects for an action.

Parameters:
action - action name
Returns:
list of ActionFilter objects

getAfterFiltersForAction

public java.util.List<ActionControlFilter> getAfterFiltersForAction(java.lang.String action)
Returns a list of after ActionFilter objects for an action.

Parameters:
action - action name
Returns:
list of ActionFilter objects

getActionBeforeFiltersMap

public java.util.Map<java.lang.String,java.util.List<ActionControlFilter>> getActionBeforeFiltersMap()
Returns a map of an action and its related before filters.

Returns:
map of an action and its related before filters.

getActionAfterFiltersMap

public java.util.Map<java.lang.String,java.util.List<ActionControlFilter>> getActionAfterFiltersMap()
Returns a map of an action and its related after filters.

Returns:
map of an action and its related after filters.

executeBeforeFiltersOn

public java.lang.String executeBeforeFiltersOn(java.lang.String action)
Executes filters before an action is run. A not-null return value indicates that the action fails in a filter.

Parameters:
action - the action
Returns:
result of filtering

executeAfterFiltersOn

public java.lang.String executeAfterFiltersOn(java.lang.String action)
Executes filters after an action is run. A not-null return value indicates that the action fails in a filter.

Parameters:
action - the action
Returns:
result of filtering

declareBeforeFilter

public void declareBeforeFilter(java.lang.String filters)
Specifies 'before' filters that apply to all actions of this class. 'before' filters are executed before real action is executed.

Parameters:
filters - method names that act as filters separated by comma.

declareBeforeFilter

public void declareBeforeFilter(java.lang.Class<?> filterClz,
                                java.lang.String filters)
Specifies 'before' filters that apply to all actions of the controller class. 'before' filters are executed before real action is executed.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma

declareBeforeFilter

public void declareBeforeFilter(java.lang.String filters,
                                java.lang.String option,
                                java.lang.String actions)
Specifies 'before' filters that apply to specific actions of this class under special conditions. 'before' filters are executed before real action is executed. Only two options are supported: only and except.

Parameters:
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareBeforeFilter

public void declareBeforeFilter(java.lang.Class<?> filterClz,
                                java.lang.String filters,
                                java.lang.String option,
                                java.lang.String actions)
Specifies 'before' filters that apply to specific actions of the controller class under special conditions. 'before' filters are executed before real action is executed. Only two options are supported: only and except.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareAfterFilter

public void declareAfterFilter(java.lang.String filters)
Specifies 'after' filters that apply to all actions of this class. 'after' filters are executed after real action is executed.

Parameters:
filters - method names that act as filters separated by comma

declareAfterFilter

public void declareAfterFilter(java.lang.Class<?> filterClz,
                               java.lang.String filters)
Specifies 'after' filters that apply to all actions of the controller class. 'after' filters are executed after real action is executed.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma

declareAfterFilter

public void declareAfterFilter(java.lang.String filters,
                               java.lang.String option,
                               java.lang.String actions)
Specifies 'after' filters that apply to specific actions of this class under special conditions. 'after' filters are executed after real action is executed. Only two options are supported: only and except.

Parameters:
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareAfterFilter

public void declareAfterFilter(java.lang.Class<?> filterClz,
                               java.lang.String filters,
                               java.lang.String option,
                               java.lang.String actions)
Specifies 'after' filters that apply to specific actions of the controller class under special conditions. 'after' filters are executed after real action is executed. Only two options are supported: only and except.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareSkipBeforeFilter

public void declareSkipBeforeFilter(java.lang.String filters)
Skips 'before' filters that apply to all actions of this class. 'before' filters are executed before real action is executed.

Parameters:
filters - method names that act as filters separated by comma

declareSkipBeforeFilter

public void declareSkipBeforeFilter(java.lang.Class<?> filterClz,
                                    java.lang.String filters)
Skips 'before' filters that apply to all actions of the controller class. 'before' filters are executed before real action is executed.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma

declareSkipBeforeFilter

public void declareSkipBeforeFilter(java.lang.String filters,
                                    java.lang.String option,
                                    java.lang.String actions)
Skips 'before' filters that apply to specific actions of this class under special conditions. 'before' filters are executed before real action is executed. Only two options are supported: only and except.

Parameters:
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareSkipBeforeFilter

public void declareSkipBeforeFilter(java.lang.Class<?> filterClz,
                                    java.lang.String filters,
                                    java.lang.String option,
                                    java.lang.String actions)
Skips 'before' filters that apply to specific actions of the controller class under special conditions. 'before' filters are executed before real action is executed. Only two options are supported: only and except.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareSkipAfterFilter

public void declareSkipAfterFilter(java.lang.String filters)
Skips 'after' filters that apply to all actions of this class. 'after' filters are executed after real action is executed.

Parameters:
filters - method names that act as filters separated by comma

declareSkipAfterFilter

public void declareSkipAfterFilter(java.lang.Class<?> filterClz,
                                   java.lang.String filters)
Skips 'after' filters that apply to all actions of the controller class. 'after' filters are executed after real action is executed.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma

declareSkipAfterFilter

public void declareSkipAfterFilter(java.lang.String filters,
                                   java.lang.String option,
                                   java.lang.String actions)
Skips 'after' filters that apply to specific actions of this class under special conditions. 'after' filters are executed after real action is executed. Only two options are supported: only and except.

Parameters:
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma

declareSkipAfterFilter

public void declareSkipAfterFilter(java.lang.Class<?> filterClz,
                                   java.lang.String filters,
                                   java.lang.String option,
                                   java.lang.String actions)
Skips 'after' filters that apply to specific actions of the controller class under special conditions. 'after' filters are executed after real action is executed. Only two options are supported: only and except.

Parameters:
filterClz - the declaring class of filter methods
filters - method names that act as filters separated by comma
option - condition for the filter
actions - method names that act as actions separated by comma