public class StaticMenuLogic extends AuthMenuLogic
Modifier and Type | Field and Description |
---|---|
protected MenuHelper |
menuHelper |
Constructor and Description |
---|
StaticMenuLogic() |
Modifier and Type | Method and Description |
---|---|
protected MenuItemState |
changeMenuStateByAuth(MenuItemState state,
User user)
Change the current State for authorizations.
|
protected Boolean |
checkIfChildrenHaveAutorization(MenuItemState state,
User user)
Menus that don't have authorization can be shown if they have a Child that does -- but any links then should be de-activated
|
MenuItemState |
getCurrentState(MenuItem rootItem,
MenuItem focussedItem,
User user)
|
IAuthorizationService.AuthState |
getItemAuthState(MenuItemState currentState,
User user)
Determine the Authorization State of a Menu Item after reading its Auth Configuration
(If its
MenuItem is of type AuthorizableMenuItem ). |
MenuHelper |
getMenuHelper() |
protected boolean |
isMenuItemsEqual(MenuItem rootItem,
MenuItem focussedItem)
For logic that needs to identify if a menu Item should be focussed on or not.
|
void |
setMenuHelper(MenuHelper menuHelper) |
getCurrentState
protected MenuHelper menuHelper
protected boolean isMenuItemsEqual(MenuItem rootItem, MenuItem focussedItem)
MenuItem.equals(Object)
but one can override this logic
for comparison.public MenuItemState getCurrentState(MenuItem rootItem, MenuItem focussedItem, User user)
AuthMenuLogic
User
is auth to see/use a MenuItem
,
the rest is same as super#getCurrentState(MenuItem, MenuItem)
. If User
is null
then it is upto the implementation on how it impace the resultant state.getCurrentState
in class AuthMenuLogic
rootItem
- as MenuItem
as the Menu (navigation tree)focussedItem
- as MenuItem
; the item that is in Focususer
- as @nullable trueMenuItemState
protected Boolean checkIfChildrenHaveAutorization(MenuItemState state, User user)
protected MenuItemState changeMenuStateByAuth(MenuItemState state, User user)
state
- as MenuItemState
user
- as User
@nullable trueMenuItemState
; same object as param to support chainingpublic IAuthorizationService.AuthState getItemAuthState(MenuItemState currentState, User user)
IMenuAuthLogic
MenuItem
is of type AuthorizableMenuItem
). If it not of that sub-type
then it is upto the implementation to decide the final state.
currentState
- as MenuItemState
@nullable falseuser
- as User
@nullable trueIAuthorizationService.AuthState
public MenuHelper getMenuHelper()
public void setMenuHelper(MenuHelper menuHelper)
Copyright © 2018. All rights reserved.