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)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMenuItemService
(NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptiongetMenuWithNavigationTree
(int depthLimit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns the admin menu with itssubmenu
fully populated.protected NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable>
org.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.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
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:MenuItemService
Read all menu items for the admin menu, optionally filtered by label (ignoring case).- Specified by:
readAllByLabel
in 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 beEmptyNode
if 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:MenuItemService
Read 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:
readAllByParentMenuItemId
in interfaceMenuItemService<P extends NavMenuItem>
- Parameters:
parentMenuItemId
- the context ID of theNavMenuItem
whose 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:MenuItemService
Accepts a menu item ID and returns a payload object containing the requested menu item and a list of its ancestors.- Specified by:
readAncestors
in 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
-
getRepository
@NonNull protected NavMenuItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends NavMenuItem>
-