Interface MenuService<P extends Menu>
-
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultMenuService
public interface MenuService<P extends Menu> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API forMenus
. Supported byMenuRepository
.- Author:
- Samarth Dhruva (samarthd)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NavigableMenu
getMenuWithNavigationTree(String menuName, int depthLimit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Accepts a menu name and returns the menu with itssubmenu
fully populated.String
getRepositoryDomain()
org.springframework.data.domain.Page<P>
readAllByName(String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Read all menus, optionally filtered by name.Optional<P>
readByName(String menuName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Finds the menu with the given name (should only be one result, as menu names are unique).-
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
-
-
-
-
Method Detail
-
readAllByName
org.springframework.data.domain.Page<P> readAllByName(@Nullable String nameQuery, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Read all menus, optionally filtered by name.- Parameters:
nameQuery
- (optional) the menu name to filter bypage
- the requested page of results from the databasefilters
- additional filters to apply in the query, can be nullcontext
- context information surrounding sandboxing and multitenant state- Returns:
- all menus, optionally filtered by name
-
readByName
Optional<P> readByName(@NonNull String menuName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Finds the menu with the given name (should only be one result, as menu names are unique).- Parameters:
menuName
- the menu name of the menu that should be retrievedcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- an
Optional
containing the menu with the given name, empty if not found
-
getMenuWithNavigationTree
NavigableMenu getMenuWithNavigationTree(@NonNull String menuName, int depthLimit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Accepts a menu name and returns the menu with itssubmenu
fully populated.- Parameters:
menuName
- the name of the menu whose navigation tree should be returneddepthLimit
- the output will be limited to only the topdepthLimit
levels of the tree. This should generally be at least 1 to return any sub menus. Negative values return the entire hierarchy, and 0 returns no sub menus at allcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the requested menu with its navigation tree, limited to the first
depthLimit
levels. Each level will be sorted by thedisplayOrder
specified in each item in that level. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if no menu with the given name was found
-
getRepositoryDomain
@NonNull String getRepositoryDomain()
-
-