@Service public class AdministrationMenuManager extends Object
The categories are distributed over two menus and an additional extension section. The two menus are the system and the account menu. The system menu is intended to hold entries to configure and administer the Communote installation (server settings, logging, ...). The account menu holds entries which are relevant to configure an account (aka a client in a non-standalone environment) like user or group management. When running a non-standalone version the system menu will only be available to the global client.
System and account menu can be extended with new categories and entries for the existing or new categories. Additionally filters can be added to include or exclude certain categories or entries in specific situations. Administration menu entries of extensions that should not be added to a category can just be added to the additional extension section.
Modifier and Type | Field and Description |
---|---|
static String |
ACCOUNT_CATEGORY_INTEGRATION |
static String |
ACCOUNT_CATEGORY_OVERVIEW |
static String |
ACCOUNT_CATEGORY_PROFILE |
static String |
ACCOUNT_CATEGORY_SECURITY |
static String |
ACCOUNT_CATEGORY_USER_MANAGEMENT |
static String |
SYSTEM_CATEGORY_APPLICATION |
static String |
SYSTEM_CATEGORY_COMMUNICATION |
static String |
SYSTEM_CATEGORY_CONTENT |
static String |
SYSTEM_CATEGORY_LOGGING |
Constructor and Description |
---|
AdministrationMenuManager() |
Modifier and Type | Method and Description |
---|---|
void |
addAccountMenuCategory(BasicMenuEntry category,
PositionDescriptor positionDescriptor)
Add a new category to the account menu.
|
void |
addAccountMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
Add a filter that will be called when the system menu is built to decide whether a menu entry
should be added to its category.
|
void |
addAccountMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
Add a filter that will be called when the account menu is built to decide whether a category
should be included in the menu.
|
void |
addSystemMenuCategory(BasicMenuEntry category,
PositionDescriptor positionDescriptor)
Same as
addAccountMenuCategory(BasicMenuEntry, PositionDescriptor) except that the
category is added to the system menu. |
void |
addSystemMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
Add a filter that will be called when the system menu is built to decide whether a menu entry
should be added to its category.
|
void |
addSystemMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
Add a filter that will be called when the system menu is built to decide whether a category
should be included in the menu.
|
void |
addToAccountMenuCategory(String categoryId,
AdministrationPageMenuEntry entry,
PositionDescriptor positionDescriptor)
Add a menu entry to a category of the account menu.
|
void |
addToExtensionSection(AdministrationPageMenuEntry entry,
PositionDescriptor positionDescriptor,
boolean systemPage)
Add an entry to the extension section.
|
void |
addToSystemMenuCategory(String categoryId,
AdministrationPageMenuEntry entry,
PositionDescriptor positionDescriptor)
Same as
addToAccountMenuCategory(String, AdministrationPageMenuEntry, PositionDescriptor)
except that the entry is added to a category of the system menu. |
void |
excludeAccountMenuEntryOnGlobalClient(String menuEntryId)
Exclude a account menu entry if the menu is rendered on the global client.
|
SimpleMenu<BasicMenuEntry,AdministrationPageMenuEntry> |
getAccountMenu() |
AdministrationMenuEntryDetails |
getCurrentEntry(javax.servlet.http.HttpServletRequest request)
Return the entry that belongs to the current request.
|
AdministrationMenuEntryDetails |
getEntry(String categoryId,
String entryId)
Get an entry of a given category.
|
CategoryEntry<BasicMenuEntry,AdministrationPageMenuEntry> |
getExtensions() |
SimpleMenu<BasicMenuEntry,AdministrationPageMenuEntry> |
getSystemMenu() |
protected void |
init() |
void |
removeAccountMenuCategory(String categoryId)
Remove a previously added category from the account menu.
|
void |
removeAccountMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
Remove a previously added filter
|
void |
removeAccountMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
Remove a previously added filter
|
void |
removeFromAccountMenuCategory(String categoryId,
String entryId)
Remove a previously added entry from a category of the account menu.
|
void |
removeFromExtensionSection(String entryId) |
void |
removeFromSystemMenuCategory(String categoryId,
String entryId)
Remove a previously added entry from a category of the system menu.
|
void |
removeSystemMenuCategory(String categoryId)
Same as
removeAccountMenuCategory(String) except that the category is removed from
the system menu. |
void |
removeSystemMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
Remove a previously added filter
|
void |
removeSystemMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
Remove a previously added filter
|
public static final String SYSTEM_CATEGORY_CONTENT
public static final String SYSTEM_CATEGORY_LOGGING
public static final String SYSTEM_CATEGORY_COMMUNICATION
public static final String SYSTEM_CATEGORY_APPLICATION
public static final String ACCOUNT_CATEGORY_SECURITY
public static final String ACCOUNT_CATEGORY_INTEGRATION
public static final String ACCOUNT_CATEGORY_USER_MANAGEMENT
public static final String ACCOUNT_CATEGORY_PROFILE
public static final String ACCOUNT_CATEGORY_OVERVIEW
public void addAccountMenuCategory(BasicMenuEntry category, PositionDescriptor positionDescriptor)
If called several times with position type TOP
the categories which were added
later will be positioned before those added earlier. If called several times with position
type BOTTOM
or AFTER
(and the same menu entry ID to position
after), the categories which were added later will be positioned after those added earlier.
Entries with position type TOP
are always before the BOTTOM
positioned categories. Categories with position type AFTER
will not appear in
the resulting menu if the referenced category does not exist. However, if that referenced
category is added later on, the categories to position after that category will than be
contained in the menu.
To position after one of the core account menu categories the menu entry ID of the position
descriptor can be set to one of the ACCOUNT_CATEGORY_*
constants.
category
- the category to add. The ID of the category must not be blank or contain
whitespaces.positionDescriptor
- descriptor defining where the item should be added. If null the category will be
added to the bottom.IllegalArgumentException
- in case the ID of the category is not validpublic void addAccountMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
Note: there is already a filter for excluding certain entries if the current client is not
the global client. See excludeAccountMenuEntryOnGlobalClient(String)
filter
- the filter to addpublic void addAccountMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
filter
- the filter to addpublic void addSystemMenuCategory(BasicMenuEntry category, PositionDescriptor positionDescriptor)
addAccountMenuCategory(BasicMenuEntry, PositionDescriptor)
except that the
category is added to the system menu.
To position after one of the core system menu categories the menu entry ID of the position
descriptor can be set to one of the SYSTEM_CATEGORY_*
constants.
category
- the category to add. The ID of the category must not be blank or contain
whitespaces.positionDescriptor
- descriptor defining where the item should be added. If null the category will be
added to the bottom.IllegalArgumentException
- in case the ID of the category is not validaddAccountMenuCategory(BasicMenuEntry, PositionDescriptor)
public void addSystemMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
filter
- the filter to addpublic void addSystemMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
filter
- the filter to addpublic void addToAccountMenuCategory(String categoryId, AdministrationPageMenuEntry entry, PositionDescriptor positionDescriptor)
If called several times with position type TOP
the entries which were added
later will be positioned before those added earlier. If called several times with position
type BOTTOM
or AFTER
(and the same menu entry ID to position
after), the entries which were added later will be positioned after those added earlier.
Entries with position type TOP
are always before the BOTTOM
positioned entries. Entries with position type AFTER
will not appear in the
resulting menu if the referenced menu entry does not exist. However, if that referenced entry
is added later on, the entries to position after that entry will than be contained in the
category.
categoryId
- the ID of the category. The ACCOUNT_CATEGORY_*
constants can be used
to add the entry to one of the core account menu categories.entry
- the entry to add. The URL of the entry has to start with /admin/
and
the ID must not be blank or contain whitespaces otherwise an exception is thrown.positionDescriptor
- descriptor defining where the item should be added. If null the item will be added
to the bottomIllegalArgumentException
- in case the entry is not validpublic void addToExtensionSection(AdministrationPageMenuEntry entry, PositionDescriptor positionDescriptor, boolean systemPage)
If called several times with position type TOP
the entries which were added
later will be positioned before those added earlier. If called several times with position
type BOTTOM
or AFTER
(and the same menu entry ID to position
after), the entries which were added later will be positioned after those added earlier.
Entries with position type TOP
are always before the BOTTOM
positioned entries. Entries with position type AFTER
will not appear in the
resulting menu if the referenced menu entry does not exist. However, if that referenced entry
is added later on, the entries to position after that entry will than be contained in the
category.
entry
- the entry to add. The URL of the entry has to start with /admin/
and
the ID must not be blank or contain whitespaces otherwise an exception is thrown.positionDescriptor
- descriptor defining where the item should be added. If null the item will be added
to the bottomsystemPage
- true if the page is intended to configure or administer the installation, false if
it is intended for the account. This is similar to the differentiation between
system and account menu. With a non-standalone installation, a systemPage will
only be included if it is rendered on the global clientIllegalArgumentException
- in case the entry is not validpublic void addToSystemMenuCategory(String categoryId, AdministrationPageMenuEntry entry, PositionDescriptor positionDescriptor)
addToAccountMenuCategory(String, AdministrationPageMenuEntry, PositionDescriptor)
except that the entry is added to a category of the system menu.categoryId
- the ID of the category. The SYSTEM_CATEGORY_*
constants can be used
to add the entry to one of the core system menu categories.entry
- the entry to add. The URL of the entry has to start with /admin/
and
the ID must not be blank or contain whitespaces otherwise an exception is thrown.positionDescriptor
- descriptor defining where the item should be added. If null the item will be added
to the bottomIllegalArgumentException
- in case the entry is not validaddToAccountMenuCategory(String, AdministrationPageMenuEntry, PositionDescriptor)
public void excludeAccountMenuEntryOnGlobalClient(String menuEntryId)
menuEntryId
- the ID of the menu entry to excludepublic SimpleMenu<BasicMenuEntry,AdministrationPageMenuEntry> getAccountMenu()
public AdministrationMenuEntryDetails getCurrentEntry(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic AdministrationMenuEntryDetails getEntry(String categoryId, String entryId)
categoryId
- the ID of the categoryentryId
- the ID of the entry in the categorypublic CategoryEntry<BasicMenuEntry,AdministrationPageMenuEntry> getExtensions()
public SimpleMenu<BasicMenuEntry,AdministrationPageMenuEntry> getSystemMenu()
@PostConstruct protected void init()
public void removeAccountMenuCategory(String categoryId)
categoryId
- the ID of the category to remove.public void removeAccountMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
filter
- the filter to removepublic void removeAccountMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
filter
- the filter to removepublic void removeFromAccountMenuCategory(String categoryId, String entryId)
categoryId
- the ID of the category from which the entry should be removedentryId
- the ID of the entry to removepublic void removeFromExtensionSection(String entryId)
public void removeFromSystemMenuCategory(String categoryId, String entryId)
categoryId
- the ID of the category from which the entry should be removedentryId
- the ID of the entry to removepublic void removeSystemMenuCategory(String categoryId)
removeAccountMenuCategory(String)
except that the category is removed from
the system menu.categoryId
- the ID of the category to removepublic void removeSystemMenuCategoryEntryFilter(MenuEntryFilter<AdministrationPageMenuEntry> filter)
filter
- the filter to removepublic void removeSystemMenuCategoryFilter(MenuEntryFilter<BasicMenuEntry> filter)
filter
- the filter to removeCopyright © 2019 Communote team. All rights reserved.