Package org.craftercms.core.service.impl
Class CompositeItemFilter
java.lang.Object
org.craftercms.core.service.impl.CompositeItemFilter
- All Implemented Interfaces:
ItemFilter
Composite
ItemFilter implementation. Calls ItemFilters before processing and after processing,
depending on what their ItemFilter.runBeforeProcessing() and ItemFilter.runAfterProcessing() methods
return.- Author:
- Sumer Jabri, Alfonso Vásquez
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionbooleanaccepts(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.booleaninthashCode()booleanremoveFilter(ItemFilter filter) Removes the specifiedItemFilterfrom the filter list, only if the list is notnull.booleanAlways returns true so that filters that need to run after processing are called.booleanAlways returns true so that filters that need to run before processing are called.voidsetFilters(List<ItemFilter> filters) Sets the list of filters.toString()
-
Constructor Details
-
CompositeItemFilter
public CompositeItemFilter()Creates a composite filter with anulllist ofItemFilters. -
CompositeItemFilter
Creates a composite filter with the specified list ofItemFilters. -
CompositeItemFilter
Creates a composite filter with the specified array ofItemFilters.
-
-
Method Details
-
setFilters
Sets the list of filters. -
addFilter
Adds the specifiedItemFilterto the filter list, creating the list if necessary. -
removeFilter
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)
-
equals
-
hashCode
public int hashCode() -
toString
-