Class MenuCallable
- java.lang.Object
-
- de.uplanet.lucy.server.auxiliaries.MenuCallable
-
@VelocityVariable("Menu") @VelocityCallable("singleton") public final class MenuCallable extends Object
-
-
Constructor Summary
Constructors Constructor Description MenuCallable(org.springframework.context.ApplicationContext p_appCtx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
alwaysCheckForNewMenu()
boolean
canAccessMenuNode(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Check if the current user can access the given menu item.List<IMenuItem>
findMenuItems(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, IRtMenuFilter p_filter)
Starting with the root menu node, find all menu items that are accepted by the given filter.List<IMenuItem>
findMenuItems(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter)
Find all menu items that are accepted by the given filter, starting with the given menu node.static IRtMenuFilter
getAbstractContainerMenuFilter()
static IRtMenuFilter
getAcceptingMenuFilter()
static IRtMenuFilter
getApplicationMenuFilter(String p_strAppGuid)
Map<String,de.uplanet.lucy.server.auxiliaries.menu.ApplicationMenu>
getApplicationMenus(String p_strKey)
Get all application menus for the current user.IMenuItem
getMenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx)
Get the menu starting with the root menu node.IMenuItem
getMenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, IRtMenuFilter p_filter)
Get the menu starting with the root menu node.String
getMenuCookie()
Comparator<IMenuItem>
getMenuTitleComparator(String p_strLang)
String
getMenuTitleWithFallback(IMenuItem p_item, String p_strPreferredLang)
Get a menu title in the given preferred language.static IRtMenuFilter
getNamePatternMenuFilter(String p_strLang, String p_strPattern, boolean p_bAcceptPattern)
Set<String>
getOpenNewWindowMenuItemAppGuids(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the application GUIDs of all applications or links of the given submenu that have the open-new-window-flag set.IMenuItem
getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the submenu with the specified unique identifier.IMenuItem
getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter)
Get the submenu with the specified unique identifier.IMenuItem
getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter, boolean p_bFilterCmsMenuItems)
Get the submenu with the specified unique identifier.IMenuItem
getSubmenuDefinition(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the submenu with the specified unique identifier.TopLevelGroupMenuItem
getTopLevelGroupMenuFromChild(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
boolean
isCmsPage(String p_strPageGuid)
boolean
isExistingMenuNode(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Check if a menu node with the given GUID exists in the portal.boolean
isMenuCookieValid(String p_strCookie)
String
toJSONString(IMenuItem p_menuItem)
Convert the given menu tree to JSON.void
writeJSON(Writer p_writer, IMenuItem p_menuItem)
Convert the given menu tree to JSON and write the output to the given character stream.
-
-
-
Method Detail
-
alwaysCheckForNewMenu
public boolean alwaysCheckForNewMenu()
-
isMenuCookieValid
public boolean isMenuCookieValid(String p_strCookie)
-
getMenuCookie
public String getMenuCookie()
-
isExistingMenuNode
public boolean isExistingMenuNode(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId) throws de.uplanet.lucy.menu.MenuException
Check if a menu node with the given GUID exists in the portal.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.- Returns:
true
if a menu node with the given id exists in the portal, orfalse
otherwise.- Throws:
de.uplanet.lucy.menu.MenuException
-
canAccessMenuNode
public boolean canAccessMenuNode(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Check if the current user can access the given menu item.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the menu item.- Returns:
true
if the current user can access the given menu item, orfalse
otherwise.
-
getMenu
public IMenuItem getMenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx)
Get the menu starting with the root menu node.- Parameters:
p_ctx
- The processing context.- Returns:
- The complete menu, or
null
if an error occurred.
-
getMenu
public IMenuItem getMenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, IRtMenuFilter p_filter)
Get the menu starting with the root menu node.- Parameters:
p_ctx
- The processing context.p_filter
- A menu filter to be applied to the menu tree.- Returns:
- The filtered menu, or
null
if an error occurred.
-
getSubmenuDefinition
public IMenuItem getSubmenuDefinition(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the submenu with the specified unique identifier. (No principal an permission will checked)
Only call when_canAccessMenuNode(ISimpleProcessingContext, String, IRtMenuFilter)
==false
- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.- Returns:
- The submenu, or
null
if an error occurred.
-
getSubmenu
public IMenuItem getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the submenu with the specified unique identifier.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.- Returns:
- The submenu, or
null
if an error occurred.
-
getSubmenu
public IMenuItem getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter)
Get the submenu with the specified unique identifier.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.p_filter
- A menu filter to be applied to the menu tree.- Returns:
- The submenu, or
null
if an error occurred.
-
getSubmenu
public IMenuItem getSubmenu(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter, boolean p_bFilterCmsMenuItems)
Get the submenu with the specified unique identifier.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.p_filter
- A menu filter to be applied to the menu tree.p_bFilterCmsMenuItems
- Enables (true
) or disables (false
) the filtering of invalid CMS menu items or CMS menu items that do no support the the language used by the user.- Returns:
- The submenu, or
null
if an error occurred.
-
findMenuItems
public List<IMenuItem> findMenuItems(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, IRtMenuFilter p_filter)
Starting with the root menu node, find all menu items that are accepted by the given filter.The result contains the menu items in tree order.
- Parameters:
p_ctx
- The processing context.p_filter
- The filter.- Returns:
- A possibly empty list of menu nodes.
-
findMenuItems
public List<IMenuItem> findMenuItems(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId, IRtMenuFilter p_filter)
Find all menu items that are accepted by the given filter, starting with the given menu node.The result contains the menu items in tree order.
- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.p_filter
- The filter.- Returns:
- A possibly empty list of menu nodes.
-
getTopLevelGroupMenuFromChild
public TopLevelGroupMenuItem getTopLevelGroupMenuFromChild(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
-
toJSONString
public String toJSONString(IMenuItem p_menuItem)
Convert the given menu tree to JSON.Note: This method is not intended to be part of the public Intrexx API. The JSON format may change at any time.
- Parameters:
p_menuItem
- The menu tree.- Returns:
- The menu tree's JSON representation.
-
writeJSON
public void writeJSON(Writer p_writer, IMenuItem p_menuItem) throws IOException
Convert the given menu tree to JSON and write the output to the given character stream.Note: This method is not intended to be part of the public Intrexx API. The JSON format may change at any time.
- Parameters:
p_menuItem
- The menu tree.- Throws:
IOException
- If an I/O error occurred.
-
getApplicationMenus
public Map<String,de.uplanet.lucy.server.auxiliaries.menu.ApplicationMenu> getApplicationMenus(String p_strKey)
Get all application menus for the current user.- Parameters:
p_strKey
- A grouping key, e.g.desktop
, ormobile
.- Returns:
- The application menus per application GUID.
-
getOpenNewWindowMenuItemAppGuids
public Set<String> getOpenNewWindowMenuItemAppGuids(de.uplanet.lucy.server.ISimpleProcessingContext p_ctx, String p_strId)
Get the application GUIDs of all applications or links of the given submenu that have the open-new-window-flag set.- Parameters:
p_ctx
- The processing context.p_strId
- The unique identifier of the submenu.- Returns:
- A possibly empty set of application GUIDs.
-
getMenuTitleWithFallback
public String getMenuTitleWithFallback(IMenuItem p_item, String p_strPreferredLang)
Get a menu title in the given preferred language. If the title does not exist in the preferred language, the default language will be used.- Parameters:
p_item
- The menu item.p_strPreferredLang
- The preferred language.- Returns:
- The menu item title, or
null
if none could be found in the requested or default language. - Throws:
IllegalArgumentException
- If the given menu item isnull
.- See Also:
IMenuItem.getName(String)
-
getMenuTitleComparator
public Comparator<IMenuItem> getMenuTitleComparator(String p_strLang)
-
getAcceptingMenuFilter
@Customization("feature request #4470") public static IRtMenuFilter getAcceptingMenuFilter()
- Returns:
- A menu filter that accepts all menu items.
-
getNamePatternMenuFilter
@Customization("feature request #4470") public static IRtMenuFilter getNamePatternMenuFilter(String p_strLang, String p_strPattern, boolean p_bAcceptPattern)
- Parameters:
p_strLang
- The language to be used.p_strPattern
- A name pattern.p_bAcceptPattern
-true
if menu items that match the given pattern should be accepted, orfalse
if they should be rejected by this filter.- Returns:
- A menu filter that accepts menu items that match the given criteria.
-
getAbstractContainerMenuFilter
public static IRtMenuFilter getAbstractContainerMenuFilter()
- Returns:
- A menu filter that accepts all menu items that are
instanceof de.uplanet.lucy.server.menu.rt.AbstractContainerMenuItem
.
-
getApplicationMenuFilter
public static IRtMenuFilter getApplicationMenuFilter(String p_strAppGuid)
- Returns:
- A menu filter that accepts all application menu items with the given GUID.
-
isCmsPage
public boolean isCmsPage(String p_strPageGuid)
-
-