Class DefaultMenuItemService<P extends NavMenuItem>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.adminnavigation.service.DefaultMenuItemService<P>
- All Implemented Interfaces:
MenuItemService<P>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
public class DefaultMenuItemService<P extends NavMenuItem>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements MenuItemService<P>
- Author:
- Samarth Dhruva (samarthd)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMenuItemService(NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected booleanevaluateCustomNavigationPredicate(@NonNull NavigationPredicate predicate, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for custom navigation predicates.protected booleanevaluateNavigationPredicate(@NonNull NavigationPredicate predicate, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Evaluates whether a givenNavigationPredicateis satisfied based on the provided request and context information.protected booleanevaluatePredicates(@NonNull NavMenuItem item, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Evaluates whether all navigation predicates associated with the specifiedNavMenuItemare satisfied within the context of the providedWebRequestandContextInfo.protected NavigationItemLocatorA reference to theNavigationItemLocatorresponsible for contributing navigation menu items from various sources such as the database or a custom properties file.getMenuWithNavigationTree(int depthLimit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns the admin menu with itssubmenufully populated.protected NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected com.broadleafcommerce.common.extension.TypeFactoryorg.springframework.data.domain.Page<P>readAllByLabel(String labelQuery, boolean rootsOnly, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all menu items for the admin menu, optionally filtered by label (ignoring case).readAllByParentMenuItemId(String parentMenuItemId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all menu items that are direct children of the specifiedNavMenuItem.readAncestors(String menuItemId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Accepts a menu item ID and returns a payload object containing the requested menu item and a list of its ancestors.voidsetCompositeLocator(NavigationItemLocator compositeLocator) A reference to theNavigationItemLocatorresponsible for contributing navigation menu items from various sources such as the database or a custom properties file.voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, createAll, createAllAllowingPartialSuccess, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Field Details
-
CACHE_BY_MENU_TREE
- See Also:
-
ADMIN_NAVIGATION_MENU_TREE_KEY_GENERATOR
- See Also:
-
-
Constructor Details
-
Method Details
-
readAllByLabel
public org.springframework.data.domain.Page<P> readAllByLabel(@Nullable String labelQuery, boolean rootsOnly, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MenuItemServiceRead all menu items for the admin menu, optionally filtered by label (ignoring case).- Specified by:
readAllByLabelin interfaceMenuItemService<P extends NavMenuItem>- Parameters:
labelQuery- (optional) the menu item label to filter by (ignoring case)rootsOnly- if true, restricts results to only the top-level menu items for the menu. Otherwise, returns all menu items for the menu.filters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.page- the requested page of results from the databasecontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- all menu items, optionally filtered by name
-
readAllByParentMenuItemId
public List<P> readAllByParentMenuItemId(@NonNull String parentMenuItemId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MenuItemServiceRead all menu items that are direct children of the specifiedNavMenuItem. In other words, find all menu items who have the given parentMenuItemId set as theirNavMenuItem.getParentMenuItemId().- Specified by:
readAllByParentMenuItemIdin interfaceMenuItemService<P extends NavMenuItem>- Parameters:
parentMenuItemId- the context ID of theNavMenuItemwhose direct children should be returnedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- all the menu items which are direct children of the specified menu item
-
readAncestors
@NonNull public MenuItemAncestorList readAncestors(@NonNull String menuItemId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MenuItemServiceAccepts a menu item ID and returns a payload object containing the requested menu item and a list of its ancestors.- Specified by:
readAncestorsin interfaceMenuItemService<P extends NavMenuItem>- Parameters:
menuItemId- the context ID of the menu item whose ancestors should be foundcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a payload object containing the requested menu item and a list of its ancestors, sorted with the immediate parent at the beginning and the top-level parent at the end
-
create
@CacheEvict(cacheNames="adminNavigationMenuTreeCache", allEntries=true) public P create(P menu, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
createin interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends NavMenuItem>- Overrides:
createin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-
update
@CacheEvict(cacheNames="adminNavigationMenuTreeCache", allEntries=true) public P update(String id, P menu, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
updatein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends NavMenuItem>- Overrides:
updatein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-
replace
@CacheEvict(cacheNames="adminNavigationMenuTreeCache", allEntries=true) public P replace(String id, P menu, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
replacein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends NavMenuItem>- Overrides:
replacein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-
delete
@CacheEvict(cacheNames="adminNavigationMenuTreeCache", allEntries=true) public void delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
deletein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends NavMenuItem>- Overrides:
deletein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-
getRepository
@NonNull protected NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-
getCompositeLocator
A reference to theNavigationItemLocatorresponsible for contributing navigation menu items from various sources such as the database or a custom properties file.- Since:
- Admin Navigation 3.0.0, Release Train 3.0.0
-
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) - Since:
- Admin Navigation 3.0.0, Release Train 3.0.0
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()- Since:
- Admin Navigation 3.0.0, Release Train 3.0.0
-