Interface MenuItemService<P extends NavMenuItem>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
All Known Implementing Classes:
DefaultMenuItemService

public interface MenuItemService<P extends NavMenuItem> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API for MenuItems. Supported by NavMenuItemRepository.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    getMenuWithNavigationTree(int depthLimit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns the admin menu with its submenu fully populated.
    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 specified NavMenuItem.
    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 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
  • Method Details

    • readAllByLabel

      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)
      Read all menu items for the admin menu, optionally filtered by label (ignoring case).
      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 be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      all menu items, optionally filtered by name
    • readAllByParentMenuItemId

      List<P> readAllByParentMenuItemId(@NonNull String parentMenuItemId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all menu items that are direct children of the specified NavMenuItem. In other words, find all menu items who have the given parentMenuItemId set as their NavMenuItem.getParentMenuItemId().
      Parameters:
      parentMenuItemId - the context ID of the NavMenuItem whose direct children should be returned
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      all the menu items which are direct children of the specified menu item
    • readAncestors

      @NonNull MenuItemAncestorList readAncestors(@NonNull String menuItemId, @Nullable 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.
      Parameters:
      menuItemId - the context ID of the menu item whose ancestors should be found
      contextInfo - 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
    • getMenuWithNavigationTree

      NavigableMenu getMenuWithNavigationTree(int depthLimit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns the admin menu with its submenu fully populated.
      Parameters:
      depthLimit - the output will be limited to only the top depthLimit 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 all
      contextInfo - 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 the displayOrder specified in each item in that level.