Package org.craftercms.core.service.impl
Class CompositeItemFilter
- java.lang.Object
-
- org.craftercms.core.service.impl.CompositeItemFilter
-
- All Implemented Interfaces:
ItemFilter
public class CompositeItemFilter extends Object implements ItemFilter
CompositeItemFilter
implementation. CallsItemFilter
s before processing and after processing, depending on what theirItemFilter.runBeforeProcessing()
andItemFilter.runAfterProcessing()
methods return.- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Constructor Summary
Constructors Constructor Description CompositeItemFilter()
Creates a composite filter with anull
list ofItemFilter
s.CompositeItemFilter(List<ItemFilter> filters)
Creates a composite filter with the specified list ofItemFilter
s.CompositeItemFilter(ItemFilter... filters)
Creates a composite filter with the specified array ofItemFilter
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing)
IfrunningBeforeProcessing
is true, calls all filters that need to be run before processing.void
addFilter(ItemFilter filter)
Adds the specifiedItemFilter
to the filter list, creating the list if necessary.boolean
equals(Object o)
int
hashCode()
boolean
removeFilter(ItemFilter filter)
Removes the specifiedItemFilter
from the filter list, only if the list is notnull
.boolean
runAfterProcessing()
Always returns true so that filters that need to run after processing are called.boolean
runBeforeProcessing()
Always returns true so that filters that need to run before processing are called.void
setFilters(List<ItemFilter> filters)
Sets the list of filters.String
toString()
-
-
-
Constructor Detail
-
CompositeItemFilter
public CompositeItemFilter()
Creates a composite filter with anull
list ofItemFilter
s.
-
CompositeItemFilter
public CompositeItemFilter(List<ItemFilter> filters)
Creates a composite filter with the specified list ofItemFilter
s.
-
CompositeItemFilter
public CompositeItemFilter(ItemFilter... filters)
Creates a composite filter with the specified array ofItemFilter
s.
-
-
Method Detail
-
setFilters
public void setFilters(List<ItemFilter> filters)
Sets the list of filters.
-
addFilter
public void addFilter(ItemFilter filter)
Adds the specifiedItemFilter
to the filter list, creating the list if necessary.
-
removeFilter
public boolean removeFilter(ItemFilter filter)
Removes the specifiedItemFilter
from the filter list, only if the list is notnull
.
-
runBeforeProcessing
public boolean runBeforeProcessing()
Always returns true so that filters that need to run before processing are called.- Specified by:
runBeforeProcessing
in interfaceItemFilter
-
runAfterProcessing
public boolean runAfterProcessing()
Always returns true so that filters that need to run after processing are called.- Specified by:
runAfterProcessing
in interfaceItemFilter
-
accepts
public boolean accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing)
IfrunningBeforeProcessing
is true, calls all filters that need to be run before processing. If it is false, calls all filters that need to be run after processing. Filters in the chain are called until one of them rejects the item.- Specified by:
accepts
in interfaceItemFilter
- Parameters:
item
- the item to accept or rejectacceptedItems
- the list of the currently accepted itemsrejectedItems
- the list of the currently rejected itemsrunningBeforeProcessing
- if the filter is running before processing (true) or after processing (false)
-
-