public class HibernateMenuDAO extends HibernatePersistentObjectDAO<Menu> implements MenuDAO
MenuDAO
entityClass, log, sessionFactory
Modifier | Constructor and Description |
---|---|
protected |
HibernateMenuDAO() |
Modifier and Type | Method and Description |
---|---|
boolean |
applyRithtToTree(long id)
Propagates the security policies of a node to the whole subree
|
String |
computePathExtended(long menuId)
Dynamically computes the path extended for the specified menu.
|
boolean |
delete(long menuId)
This method deletes an entity.
|
void |
deleteAll(List<Menu> menus)
For each menu, save the folder delete history entry for each folder and
delete the folder
|
List<Menu> |
findByGroupId(long groupId)
Finds all menus accessible by the passed group
|
List<Menu> |
findByParentId(long parentId)
Finds all children(direct and indirect) by parentId
|
List<Menu> |
findByText(Menu parent,
String text,
boolean caseSensitive)
Finds all menus by menu text, contained in the parent menu
|
List<Menu> |
findByText(String text)
Finds all menus by menu text.
|
List<Menu> |
findByTextAndParentId(String text,
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> |
findByUserId(long userId)
Finds authorized menus for a user.
|
List<Menu> |
findByUserId(long userId,
long parentId)
Finds direct children of a menu.
|
List<Menu> |
findByUserId(long userId,
long parentId,
Integer type) |
List<Menu> |
findChildren(long parentId,
Integer max)
Finds direct children of a menu.
|
List<Menu> |
findChildren(long parentId,
long userId)
Finds direct children of a menu accessible by the given user.
|
List<Long> |
findIdByUserId(long userId,
long parentId)
This method selects only the menuId from the menus for which a user is
authorized.
|
List<Long> |
findIdByUserId(long userId,
long parentId,
Integer type) |
List<Long> |
findMenuIdByUserId(long userId)
This method selects only the menuId from the menus for which a user is
authorized.
|
List<Long> |
findMenuIdByUserIdAndPermission(long userId,
Permission permission)
Finds all menus ids with a specific permission enabled on the specifies
user
|
List<Menu> |
findParents(long menuId)
Returns a List of menus being a parent of the given menu.
|
String |
findTextById(long menuId)
This method selects only the menu text from a menu.
|
UserDAO |
getUserDAO() |
boolean |
hasWriteAccess(Menu menu,
long userId)
Checks that the user has access to the menu and all its sub-items
|
int |
isMenuWriteable(long menuId,
long userId)
Returns if a menu is writeable for a user
|
boolean |
isReadEnable(long menuId,
long userId) |
boolean |
isWriteEnable(long menuId,
long userId)
This method is looking up for writing rights for a menu and an user.
|
void |
restore(long menuId,
boolean parents)
Restores a previously deleted menu
|
void |
setUserDAO(UserDAO userDAO) |
boolean |
store(Menu menu)
This method persists the entity object.
|
bulkUpdate, deleteAll, evict, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, flush, getConnection, getCurrentSession, getDbms, getSessionFactory, initialize, isHsql, isMySQL, isOracle, isSqlServer, jdbcUpdate, jdbcUpdate, merge, prepareQuery, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet, refresh, saveOrUpdate, setSessionFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bulkUpdate, deleteAll, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet
public UserDAO getUserDAO()
public void setUserDAO(UserDAO userDAO)
public boolean store(Menu menu)
PersistentObjectDAO
store
in interface PersistentObjectDAO<Menu>
store
in interface MenuDAO
store
in class HibernatePersistentObjectDAO<Menu>
menu
- entity to be stored.public List<Menu> findByUserId(long userId)
MenuDAO
findByUserId
in interface MenuDAO
userId
- ID of the user.public List<Menu> findByUserId(long userId, long parentId)
MenuDAO
findByUserId
in interface MenuDAO
parentId
- MenuId of the menu which children are wanted.public List<Menu> findChildren(long parentId, Integer max)
MenuDAO
findChildren
in interface MenuDAO
parentId
- MenuId of the menu which children are wantedmax
- Optional, maximum number of childrenpublic List<Menu> findChildren(long parentId, long userId)
MenuDAO
findChildren
in interface MenuDAO
parentId
- MenuId of the menu which children are wanteduserId
- Identifier of the user that mush have read accesspublic List<Menu> findByParentId(long parentId)
MenuDAO
findByParentId
in interface MenuDAO
MenuDAO.findByParentId(long)
public boolean isWriteEnable(long menuId, long userId)
MenuDAO
isWriteEnable
in interface MenuDAO
menuId
- ID of the menu.userId
- ID of the user.public boolean isReadEnable(long menuId, long userId)
isReadEnable
in interface MenuDAO
public String findTextById(long menuId)
MenuDAO
findTextById
in interface MenuDAO
menuId
- Id of the menu.public List<Long> findMenuIdByUserId(long userId)
MenuDAO
findMenuIdByUserId
in interface MenuDAO
userId
- ID of the user.public int isMenuWriteable(long menuId, long userId)
MenuDAO
isMenuWriteable
in interface MenuDAO
menuId
- check this menuuserId
- privileges for this should be checkedMenuDAO.isMenuWriteable(long, long)
public boolean hasWriteAccess(Menu menu, long userId)
MenuDAO
hasWriteAccess
in interface MenuDAO
public List<Menu> findByGroupId(long groupId)
MenuDAO
findByGroupId
in interface MenuDAO
groupId
- The group idpublic List<Menu> findByText(String text)
MenuDAO
findByText
in interface MenuDAO
public List<Menu> findByText(Menu parent, String text, boolean caseSensitive)
MenuDAO
findByText
in interface MenuDAO
parent
- The parent menu(optional)text
- The menutext to search forpublic String computePathExtended(long menuId)
MenuDAO
computePathExtended
in interface MenuDAO
public List<Menu> findByTextAndParentId(String text, long parentId)
MenuDAO
findByTextAndParentId
in interface MenuDAO
public List<Menu> findParents(long menuId)
MenuDAO
findParents
in interface MenuDAO
public void restore(long menuId, boolean parents)
MenuDAO
public List<Long> findMenuIdByUserIdAndPermission(long userId, Permission permission)
MenuDAO
findMenuIdByUserIdAndPermission
in interface MenuDAO
userId
- The user identifierpermission
- The permission to checkpublic void deleteAll(List<Menu> menus)
MenuDAO
public boolean delete(long menuId)
PersistentObjectDAO
delete
in interface PersistentObjectDAO<Menu>
delete
in class HibernatePersistentObjectDAO<Menu>
menuId
- ID of the entity which should be deleted.public boolean applyRithtToTree(long id)
MenuDAO
applyRithtToTree
in interface MenuDAO
public List<Long> findIdByUserId(long userId, long parentId)
MenuDAO
findIdByUserId
in interface MenuDAO
userId
- ID of the user.parentId
- Parent menuCopyright © 2008-2014 Logical Objects. All Rights Reserved.