Class DefaultRelatedItemsCollector
java.lang.Object
de.hybris.platform.servicelayer.model.collector.DefaultRelatedItemsCollector
- All Implemented Interfaces:
RelatedItemsCollector
Reference implementation of
RelatedItemsCollector. It assume existence of
ItemVisitorRegistry which uses for matching best or given ItemVisitor.
Note:
Travers given theSource item against ItemVisitor and collects all catalog aware
relatives for a given item. Relatives items are traversed using the same approach i.e. the method calls are
recursive.
Note:
Just to optimize you can pass RelatedItemsCollector.MAX_RECURSION_DEPTH to ctx as a parameter
that express max recursion depth.
-
Field Summary
Fields inherited from interface de.hybris.platform.servicelayer.model.collector.RelatedItemsCollector
MAX_RECURSION_DEPTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncollect(T theSource, ItemVisitor<T> theStrategy, Map<String, Object> ctx) Travers giventheSourceitem against givenItemVisitorand returns all collected relatives.Travers giventheSourceitem against best matchingItemVisitorand returns all collected relatives.protected voidcollectInternal(ItemModel theSource, List<ItemModel> collected, Map<String, Object> ctx, int currentDepth) protected intvoidsetItemVisitorRegistry(ItemVisitorRegistry itemVisitorRegistry)
-
Constructor Details
-
DefaultRelatedItemsCollector
public DefaultRelatedItemsCollector()
-
-
Method Details
-
collect
Description copied from interface:RelatedItemsCollectorTravers giventheSourceitem against best matchingItemVisitorand returns all collected relatives. Note:- Specified by:
collectin interfaceRelatedItemsCollector- Type Parameters:
T- specific model class derived from ItemModel- Parameters:
theSource- given itemctx- ctx given context- Returns:
- all relatives for a given
theSourceitem
-
collect
public <T extends ItemModel> List<ItemModel> collect(T theSource, ItemVisitor<T> theStrategy, Map<String, Object> ctx) Description copied from interface:RelatedItemsCollectorTravers giventheSourceitem against givenItemVisitorand returns all collected relatives.- Specified by:
collectin interfaceRelatedItemsCollector- Type Parameters:
T-specific model class derived from ItemModel - Parameters:
theSource- given itemtheStrategy- givenItemVisitorctx- given context- Returns:
- all relatives for a given
theSourceitem and giventheStrategy
-
collectInternal
-
extractMaxRecursionDepth
-
setItemVisitorRegistry
-