Nuxeo Enterprise Platform 5.1

org.nuxeo.ecm.platform.actions
Class DefaultActionFilter

java.lang.Object
  extended by org.nuxeo.ecm.platform.actions.DefaultActionFilter
All Implemented Interfaces:
Serializable, ActionFilter

public class DefaultActionFilter
extends Object
implements ActionFilter

Author:
Bogdan Stefanescu, Ruslan Spivak, Anahide Tchertchian
See Also:
Serialized Form

Constructor Summary
DefaultActionFilter()
           
DefaultActionFilter(String id, FilterRule[] rules)
           
DefaultActionFilter(String id, FilterRule[] rules, boolean append)
           
 
Method Summary
 boolean accept(Action action, ActionContext context)
          Checks whether this action is valid in the given context.
protected  boolean checkConditions(Action action, ActionContext context, String[] conditions)
          Returns true if one of the conditions is verified, else false.
protected  boolean checkFacets(Action action, ActionContext context, String[] facets)
          Returns true if document has one of the given facets, else false.
protected  boolean checkPermissions(Action action, ActionContext context, String[] permissions)
          Returns true if given document has one of the permissions, else false.
protected  boolean checkRule(FilterRule rule, Action action, ActionContext context)
          Returns true if all conditions defined in the rule are true.
protected  boolean checkSchemas(Action action, ActionContext context, String[] schemas)
          Returns true if document has one of the given schemas, else false.
protected  boolean checkTypes(Action action, ActionContext context, String[] types)
          Returns true if document type is one of the given types, else false.
 boolean getAppend()
           
 String getId()
           
 FilterRule[] getRules()
           
 void setAppend(boolean append)
           
 void setId(String id)
           
 void setRules(FilterRule[] rules)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultActionFilter

public DefaultActionFilter()

DefaultActionFilter

public DefaultActionFilter(String id,
                           FilterRule[] rules)

DefaultActionFilter

public DefaultActionFilter(String id,
                           FilterRule[] rules,
                           boolean append)
Method Detail

getId

public String getId()
Specified by:
getId in interface ActionFilter

setId

public void setId(String id)
Specified by:
setId in interface ActionFilter

getRules

public FilterRule[] getRules()

setRules

public void setRules(FilterRule[] rules)

accept

public boolean accept(Action action,
                      ActionContext context)
Checks whether this action is valid in the given context.

The action is considered valid if no denying rule is found and at least one granting rule is found. If no rule is found at all, it is valid.

In other words: OR between granting rules, AND between denying rules, denial is favored (also if exceptions occur), AND inside of rules, OR inside or rule items (type, facet,...).

Specified by:
accept in interface ActionFilter
Parameters:
action -
Returns:

checkRule

protected final boolean checkRule(FilterRule rule,
                                  Action action,
                                  ActionContext context)
Returns true if all conditions defined in the rule are true.


checkFacets

protected final boolean checkFacets(Action action,
                                    ActionContext context,
                                    String[] facets)
Returns true if document has one of the given facets, else false.

Returns:
true if document has one of the given facets, else false.

checkPermissions

protected final boolean checkPermissions(Action action,
                                         ActionContext context,
                                         String[] permissions)
Returns true if given document has one of the permissions, else false.

If no document is found, return true only if principal is a manager.

Returns:
true if given document has one of the given permissions, else false

checkConditions

protected final boolean checkConditions(Action action,
                                        ActionContext context,
                                        String[] conditions)
Returns true if one of the conditions is verified, else false.

If one evaluation fails, return false.

Returns:
true if one of the conditions is verified, else false.

checkTypes

protected final boolean checkTypes(Action action,
                                   ActionContext context,
                                   String[] types)
Returns true if document type is one of the given types, else false.

If document is null, consider context is the server and return true if 'Server' is in the list.

Returns:
true if document type is one of the given types, else false.

checkSchemas

protected final boolean checkSchemas(Action action,
                                     ActionContext context,
                                     String[] schemas)
Returns true if document has one of the given schemas, else false.

Returns:
true if document has one of the given schemas, else false

getAppend

public boolean getAppend()

setAppend

public void setAppend(boolean append)

Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.