Class DefaultRelatedItemsCollector
- java.lang.Object
-
- de.hybris.platform.servicelayer.model.collector.DefaultRelatedItemsCollector
-
- All Implemented Interfaces:
RelatedItemsCollector
public class DefaultRelatedItemsCollector extends java.lang.Object implements RelatedItemsCollector
Reference implementation ofRelatedItemsCollector. It assume existence ofItemVisitorRegistrywhich uses for matching best or givenItemVisitor.Note: Travers given
theSourceitem againstItemVisitorand 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_DEPTHtoctxas 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 Constructor Description DefaultRelatedItemsCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ItemModel>
java.util.List<ItemModel>collect(T theSource, ItemVisitor<T> theStrategy, java.util.Map<java.lang.String,java.lang.Object> ctx)Travers giventheSourceitem against givenItemVisitorand returns all collected relatives.<T extends ItemModel>
java.util.List<ItemModel>collect(T theSource, java.util.Map<java.lang.String,java.lang.Object> ctx)Travers giventheSourceitem against best matchingItemVisitorand returns all collected relatives.protected voidcollectInternal(ItemModel theSource, java.util.List<ItemModel> collected, java.util.Map<java.lang.String,java.lang.Object> ctx, int currentDepth)protected intextractMaxRecursionDepth(java.util.Map<java.lang.String,java.lang.Object> ctx)voidsetItemVisitorRegistry(ItemVisitorRegistry itemVisitorRegistry)
-
-
-
Method Detail
-
collect
public <T extends ItemModel> java.util.List<ItemModel> collect(T theSource, java.util.Map<java.lang.String,java.lang.Object> ctx)
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> java.util.List<ItemModel> collect(T theSource, ItemVisitor<T> theStrategy, java.util.Map<java.lang.String,java.lang.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
protected void collectInternal(ItemModel theSource, java.util.List<ItemModel> collected, java.util.Map<java.lang.String,java.lang.Object> ctx, int currentDepth)
-
extractMaxRecursionDepth
protected int extractMaxRecursionDepth(java.util.Map<java.lang.String,java.lang.Object> ctx)
-
setItemVisitorRegistry
public void setItemVisitorRegistry(ItemVisitorRegistry itemVisitorRegistry)
-
-