public class CustomAutoNav<T extends IHierarchialReference> extends HierarchyTypeAutoNav<T>
HierarchyTypeAutoNav
for ContentDescriptor
IHierarchialReference
objects and further put it as a Navigatable Tree.
MenuItem.name
s are case insensitive while comparing.Modifier and Type | Class and Description |
---|---|
static class |
CustomAutoNav.CustomHierarchicalReference
Note: Menu
MenuItem.name s are case insensitive while comparing. |
static class |
CustomAutoNav.CustomMenuItem |
Modifier and Type | Field and Description |
---|---|
Comparator<T> |
DFAULT_AVAILABLE_SORT |
filterNodesWithNames, filterPredicate
Constructor and Description |
---|
CustomAutoNav() |
Modifier and Type | Method and Description |
---|---|
protected MenuItem |
addNode(MenuItem parent,
T node,
List<MenuItem> children)
Add Leaf nodes
|
protected List |
convert(List<T> flatList)
|
MenuItem |
getGeneratedMenuItem(Object... params)
Generate a Menu based on context, logic and some optional/additional params
|
org.apache.commons.collections.Transformer |
getIsNavigableTransformer()
A simple transformer that should return a boolean true/false if the item should be
MenuItem.isNavigable() or not. |
org.apache.commons.collections.Transformer |
getPagePathLookup()
Allows for an algorithm to determine the path of the product page
The Transformer is expected to take in CustomAutoNav.CustomHierarchicalReference type as input and give the path as String |
org.apache.commons.collections.Transformer |
getQueryService()
A service that can be passed context params and will return a Result Set in the format, where NAME uniquely identifies the Tuplet:
TUPLE1 as Object[3]: <Name1>,<Display Name 1>,<Parent Category Name 1> |
Map<String,String[]> |
getReferenceToPathMapping(Object... params)
A
MenuItem.getRefId() points to the raw resource that the menu points to (like classpath name). |
protected String |
getRefId(T itemReference)
Custom algorithm to figure the destination from the Item reference of Type
IHierarchialReference |
Comparator<T> |
getSort()
Allow Sorting of children (nodes of type
CustomAutoNav.CustomHierarchicalReference ) |
protected boolean |
isNodeNavigable(T itemReference) |
void |
setIsNavigableTransformer(org.apache.commons.collections.Transformer isNavigableTransformer)
A simple transformer that should return a boolean true/false if the item should be
MenuItem.isNavigable() or not. |
void |
setPagePathLookup(org.apache.commons.collections.Transformer productPagePathLookup)
Allows for an algorithm to determine the path of the product page
The Transformer is expected to take in CustomAutoNav.CustomHierarchicalReference type as input and give the path as String |
void |
setQueryService(org.apache.commons.collections.Transformer queryService)
A service that can be passed context params and will return a Result Set in the format, where NAME uniquely identifies the Tuplet:
TUPLE1 as Object[3]: <Name1>,<Display Name 1>,<Parent Category Name 1> |
void |
setSort(Comparator<T> sort)
Allow Sorting of children (nodes of type
CustomAutoNav.CustomHierarchicalReference ) |
add, assignRootLevel, getFilterNodesWithNames, getGeneratedPageMenuMap, getId, setFilterNodesWithNames, setId, toString, transform
public final Comparator<T extends IHierarchialReference> DFAULT_AVAILABLE_SORT
protected MenuItem addNode(MenuItem parent, T node, List<MenuItem> children)
HierarchyTypeAutoNav
addNode
in class HierarchyTypeAutoNav<T extends IHierarchialReference>
parent
- as MenuItem
as the node to add children undernode
- as type IHierarchialReference
children
- as List of MenuItem
protected String getRefId(T itemReference)
IHierarchialReference
getRefId
in class HierarchyTypeAutoNav<T extends IHierarchialReference>
String
protected boolean isNodeNavigable(T itemReference)
isNodeNavigable
in class HierarchyTypeAutoNav<T extends IHierarchialReference>
MenuItem.isNavigable()
protected List convert(List<T> flatList)
flatList
- as List
of IHierarchialReference
of type List
. Category nodes are lists again with parent as first and other nodes are IHierarchialReference
of type public MenuItem getGeneratedMenuItem(Object... params)
IMenuGenerator
getGeneratedMenuItem
in interface IMenuGenerator
getGeneratedMenuItem
in class HierarchyTypeAutoNav<T extends IHierarchialReference>
params
- here is just additional context params, the main data is expected from the queryService
MenuItem
public Map<String,String[]> getReferenceToPathMapping(Object... params)
IMenuPathMapper
MenuItem.getRefId()
points to the raw resource that the menu points to (like classpath name).
To generate the Page Menu Map when the refId is not same as app path we require the additional mapping(s).
Note, a reference can have multiple path aliases.Map
of String to String arraypublic org.apache.commons.collections.Transformer getPagePathLookup()
Transformer
is expected to take in CustomAutoNav.CustomHierarchicalReference
type as input and give the path as Stringpublic void setPagePathLookup(org.apache.commons.collections.Transformer productPagePathLookup)
Transformer
is expected to take in CustomAutoNav.CustomHierarchicalReference
type as input and give the path as Stringpublic org.apache.commons.collections.Transformer getIsNavigableTransformer()
MenuItem.isNavigable()
or not.public void setIsNavigableTransformer(org.apache.commons.collections.Transformer isNavigableTransformer)
MenuItem.isNavigable()
or not.public org.apache.commons.collections.Transformer getQueryService()
public void setQueryService(org.apache.commons.collections.Transformer queryService)
public Comparator<T> getSort()
CustomAutoNav.CustomHierarchicalReference
)public void setSort(Comparator<T> sort)
CustomAutoNav.CustomHierarchicalReference
)Copyright © 2018. All rights reserved.