Package com.logicaldoc.core.security.dao
Interface MenuDAO
-
- All Superinterfaces:
PersistentObjectDAO<Menu>
- All Known Implementing Classes:
HibernateMenuDAO
public interface MenuDAO extends PersistentObjectDAO<Menu>
Instances of this class is a DAO-service for menu objects.- Version:
- 1.0
- Author:
- Michael Scholz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
applyRightToTree(long id)
Propagates the security policies of a node to the whole subtreeString
computePathExtended(long id)
Dynamically computes the path extended for the specified menu.List<Menu>
findByGroupId(long groupId)
Finds all menus accessible by the passed groupList<Menu>
findByName(Menu parent, String name, boolean caseSensitive)
Finds all menus by menu text, contained in the parent menuList<Menu>
findByName(String name)
Finds all menus by menu text.List<Menu>
findByNameAndParentId(String name, long parentId)
Finds that folder that lies under a specific parent (given by the id) an with a given text(like operator is used)List<Menu>
findByParentId(long parentId)
Finds all children(direct and indirect) by parentIdList<Menu>
findByUserId(long userId)
Finds authorized menus for a user.List<Menu>
findByUserId(long userId, long parentId)
Finds direct children of a menuList<Menu>
findChildren(long parentId, long userId)
Finds direct children of a menu accessible by the given user.List<Menu>
findChildren(long parentId, Integer max)
Finds direct children of a menu.List<Long>
findIdByUserId(long userId, long parentId)
This method selects only the menuId from the menus for which a user is authorized.List<Long>
findMenuIdByUserId(long userId)
This method selects only the menuId from the menus for which a user is authorizedList<Long>
findMenuIdByUserIdAndPermission(long userId, Permission permission)
Finds all menus ids with a specific permission enabled on the specifies userString
findNameById(long id)
This method selects only the menu text from a menuList<Menu>
findParents(long id)
Returns a List of menus being a parent of the given menu.boolean
hasWriteAccess(Menu menu, long userId)
Checks that the user has access to the menu and all its sub-itemsint
isMenuWriteable(long id, long userId)
Returns if a menu is writeable for a userboolean
isReadEnable(long id, long userId)
This method is looking up for read rights for a menu and an userboolean
isWriteEnable(long id, long userId)
This method is looking up for writing rights for a menu and an uservoid
restore(long id, boolean parents)
Restores a previously deleted menu-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
findByName
List<Menu> findByName(String name)
Finds all menus by menu text.- Parameters:
name
- name of the menu- Returns:
- List of menus with given menu text.
-
findByName
List<Menu> findByName(Menu parent, String name, boolean caseSensitive)
Finds all menus by menu text, contained in the parent menu- Parameters:
parent
- The parent menu(optional)name
- the name to searchcaseSensitive
- if we have to consider the search case sensitive- Returns:
- List of menus with given menu name.
-
findByUserId
List<Menu> findByUserId(long userId)
Finds authorized menus for a user.- Parameters:
userId
- ID of the user.- Returns:
- List of found menus.
-
findMenuIdByUserIdAndPermission
List<Long> findMenuIdByUserIdAndPermission(long userId, Permission permission)
Finds all menus ids with a specific permission enabled on the specifies user- Parameters:
userId
- The user identifierpermission
- The permission to check- Returns:
- list of folder IDs
-
findByUserId
List<Menu> findByUserId(long userId, long parentId)
Finds direct children of a menu- Parameters:
userId
- identifier of the userparentId
- MenuId of the menu which children are wanted- Returns:
- List of found menus sorted by name
-
findByParentId
List<Menu> findByParentId(long parentId)
Finds all children(direct and indirect) by parentId- Parameters:
parentId
- identifier of the parent menu- Returns:
- list of children menus
-
findChildren
List<Menu> findChildren(long parentId, Integer max)
Finds direct children of a menu.- Parameters:
parentId
- MenuId of the menu which children are wantedmax
- Optional, maximum number of children- Returns:
- List of found menus
-
findChildren
List<Menu> findChildren(long parentId, long userId)
Finds direct children of a menu accessible by the given user.- Parameters:
parentId
- MenuId of the menu which children are wanteduserId
- Identifier of the user that mush have read access- Returns:
- List of found menus.
-
isWriteEnable
boolean isWriteEnable(long id, long userId)
This method is looking up for writing rights for a menu and an user- Parameters:
id
- ID of the menuuserId
- ID of the user- Returns:
- id the user has write permission
-
isReadEnable
boolean isReadEnable(long id, long userId)
This method is looking up for read rights for a menu and an user- Parameters:
id
- ID of the menuuserId
- ID of the user- Returns:
- id the user can access the menu
-
findNameById
String findNameById(long id)
This method selects only the menu text from a menu- Parameters:
id
- Id of the menu- Returns:
- Selected menu text
-
findMenuIdByUserId
List<Long> findMenuIdByUserId(long userId)
This method selects only the menuId from the menus for which a user is authorized- Parameters:
userId
- ID of the user- Returns:
- List of selected menuId's
-
findIdByUserId
List<Long> findIdByUserId(long userId, long parentId)
This method selects only the menuId from the menus for which a user is authorized. Only menus direct child of the specified parent are returned.- Parameters:
userId
- ID of the user.parentId
- Parent menu- Returns:
- List of selected menuId's.
-
isMenuWriteable
int isMenuWriteable(long id, long userId)
Returns if a menu is writeable for a user- Parameters:
id
- check this menuuserId
- privileges for this should be checked- Returns:
- a 0 if false, a 1 if true
-
hasWriteAccess
boolean hasWriteAccess(Menu menu, long userId)
Checks that the user has access to the menu and all its sub-items- Parameters:
menu
- the menuuserId
- identifier of the menu- Returns:
- if the user has write permission
-
findByGroupId
List<Menu> findByGroupId(long groupId)
Finds all menus accessible by the passed group- Parameters:
groupId
- The group id- Returns:
- The List of menus
-
findParents
List<Menu> findParents(long id)
Returns a List of menus being a parent of the given menu. The list is ordered starting from the root of menus.- Parameters:
id
- identifier of the group- Returns:
- hierarchy of parents
-
restore
void restore(long id, boolean parents) throws PersistenceException
Restores a previously deleted menu- Parameters:
id
- The menu identifierparents
- true if parents must be restored also- Throws:
PersistenceException
- is happened a database error
-
findByNameAndParentId
List<Menu> findByNameAndParentId(String name, long parentId)
Finds that folder that lies under a specific parent (given by the id) an with a given text(like operator is used)- Parameters:
name
- name of the menuparentId
- identifier of the parent menu- Returns:
- list of manues
-
computePathExtended
String computePathExtended(long id)
Dynamically computes the path extended for the specified menu. The path extended is a human readable path in the form: /folder1/folder2/folder3- Parameters:
id
- identifier of the menu- Returns:
- full path of the menu
-
applyRightToTree
boolean applyRightToTree(long id)
Propagates the security policies of a node to the whole subtree- Parameters:
id
- identifier of a folder- Returns:
- true if all went correctly
-
-