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
CompositeItemFilterimplementation. CallsItemFilters 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 anulllist ofItemFilters.CompositeItemFilter(List<ItemFilter> filters)Creates a composite filter with the specified list ofItemFilters.CompositeItemFilter(ItemFilter... filters)Creates a composite filter with the specified array ofItemFilters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing)IfrunningBeforeProcessingis true, calls all filters that need to be run before processing.voidaddFilter(ItemFilter filter)Adds the specifiedItemFilterto the filter list, creating the list if necessary.booleanequals(Object o)inthashCode()booleanremoveFilter(ItemFilter filter)Removes the specifiedItemFilterfrom the filter list, only if the list is notnull.booleanrunAfterProcessing()Always returns true so that filters that need to run after processing are called.booleanrunBeforeProcessing()Always returns true so that filters that need to run before processing are called.voidsetFilters(List<ItemFilter> filters)Sets the list of filters.StringtoString()
-
-
-
Constructor Detail
-
CompositeItemFilter
public CompositeItemFilter()
Creates a composite filter with anulllist ofItemFilters.
-
CompositeItemFilter
public CompositeItemFilter(List<ItemFilter> filters)
Creates a composite filter with the specified list ofItemFilters.
-
CompositeItemFilter
public CompositeItemFilter(ItemFilter... filters)
Creates a composite filter with the specified array ofItemFilters.
-
-
Method Detail
-
setFilters
public void setFilters(List<ItemFilter> filters)
Sets the list of filters.
-
addFilter
public void addFilter(ItemFilter filter)
Adds the specifiedItemFilterto the filter list, creating the list if necessary.
-
removeFilter
public boolean removeFilter(ItemFilter filter)
Removes the specifiedItemFilterfrom 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:
runBeforeProcessingin interfaceItemFilter
-
runAfterProcessing
public boolean runAfterProcessing()
Always returns true so that filters that need to run after processing are called.- Specified by:
runAfterProcessingin interfaceItemFilter
-
accepts
public boolean accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing)
IfrunningBeforeProcessingis 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:
acceptsin 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)
-
-