public class HibernateFolderDAO extends HibernatePersistentObjectDAO<Folder> implements FolderDAO
FolderDAO| Modifier and Type | Field and Description |
|---|---|
protected LockManager |
lockManager |
entityClass, log, sessionFactory| Modifier | Constructor and Description |
|---|---|
protected |
HibernateFolderDAO() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
applyMetadataToTree(long id,
FolderHistory transaction)
Propagates the template metadata a node to the whole subree
|
boolean |
applyRithtToTree(long rootId,
FolderHistory transaction)
Propagates the security policies of a node to the whole subree
|
String |
computePathExtended(long folderId)
Dynamically computes the path extended for the specified folder.
|
int |
count(boolean computeDeleted)
Counts the number of folders
|
Folder |
create(Folder parent,
Folder folderVO,
boolean inheritSecurity,
FolderHistory transaction)
Creates a new folder in the parent Folder
|
Folder |
createPath(Folder parent,
String path,
boolean inheritSecurity,
FolderHistory transaction)
Creates the folder for the specified path.
|
boolean |
delete(long folderId,
FolderHistory transaction)
This method deletes the folder object and insert a new folder history
entry.
|
void |
deleteAll(List<Folder> folders,
FolderHistory transaction)
For each folder, save the folder delete history entry for each folder and
delete the folder
|
List<Folder> |
deleteTree(Folder folder,
FolderHistory transaction)
Delete a folder and all its sub-folders that a user can delete.
|
List<Folder> |
deleteTree(long folderId,
FolderHistory transaction)
Delete a folder and all its sub-folders that a user can delete.
|
List<Folder> |
find(String name)
Useful method that allows to find all folders that contains the given
name into their text.
|
List<Folder> |
findByGroupId(long groupId)
Finds all folders accessible by the passed group
|
List<Folder> |
findByName(Folder parent,
String name,
boolean caseSensitive)
Finds all folders by folder text, contained in the parent folder.
|
List<Folder> |
findByName(String name)
Finds all folders by folder name
|
List<Folder> |
findByNameAndParentId(String name,
long parentId)
Finds that folder that lies under a specific parent (given by the id) an
with a given name(like operator is used)
|
List<Folder> |
findByParentId(long parentId)
Finds all children(direct and indirect) by parentId
|
Folder |
findByPath(String pathExtended)
Retrieval of a folder by the extended path
|
List<Folder> |
findByUserId(long userId)
Finds authorized folders for a user
|
List<Folder> |
findByUserId(long userId,
long parentId)
Finds direct children of a folder.
|
List<Folder> |
findChildren(long parentId,
Integer max)
Finds direct children of a folder
|
List<Folder> |
findChildren(long parentId,
long userId)
Finds direct children of a folder accessible by the given user
|
List<Folder> |
findDeleted(long userId,
Integer maxHits)
Finds all deleted folders of a specific user.
|
Collection<Long> |
findFolderIdByUserId(long userId,
Long parentId,
boolean tree)
This method selects only the folder ID from the folders for which a user
is authorized.
|
Collection<Long> |
findFolderIdByUserIdAndPermission(long userId,
Permission permission,
Long parentId,
boolean tree)
Finds all folders ids with a specific permission enabled on the specifies
user
|
Set<Long> |
findFolderIdInTree(long rootId,
boolean includeDeleted)
Retrieve all the ids of the folder in a given tree
|
List<Long> |
findIdByUserId(long userId,
long parentId)
This method selects only the folder ID from the folders for which a user
is authorized.
|
List<Folder> |
findParents(long folderId)
Returns a List of folders being a parent of the given folder.
|
List<Folder> |
findWorkspaces()
Retrieves all the workspaces in the system, that are the first-level
folders of type 1.
|
Set<Permission> |
getEnabledPermissions(long folderId,
long userId)
Finds all permissions of a user enabled on the specified folder
|
FolderHistoryDAO |
getHistoryDAO() |
UserDAO |
getUserDAO() |
boolean |
hasWriteAccess(Folder folder,
long userId)
Checks that the user has access to the folder and all its sub-items
|
void |
initialize(Folder folder)
Doesn't do anything by default
|
boolean |
isInPath(long folderId,
long targetId)
Checks if a folder with the given folderId is parent of the folder with
the given targetId
|
boolean |
isPermissionEnabled(Permission permission,
long folderId,
long userId)
This method checks if the given permission is enabled for a folder and an
user.
|
boolean |
isReadEnable(long folderId,
long userId) |
boolean |
isWriteEnable(long folderId,
long userId)
This method is looking up for writing rights for a folder and an user.
|
void |
move(Folder source,
Folder target,
FolderHistory transaction)
Move a folder into another folder
|
void |
restore(long folderId,
long parentId,
FolderHistory transaction)
Restores a previously deleted folder
|
void |
setConfig(ContextProperties config) |
void |
setHistoryDAO(FolderHistoryDAO historyDAO) |
void |
setLockManager(LockManager lockManager) |
void |
setUniqueName(Folder folder) |
void |
setUserDAO(UserDAO userDAO) |
boolean |
store(Folder folder)
This method persists the entity object.
|
boolean |
store(Folder folder,
FolderHistory transaction)
Same as store(Folder, boolean, FolderHistory)
|
bulkUpdate, delete, deleteAll, evict, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, flush, getConnection, getCurrentSession, getDbms, getSessionFactory, isHsql, isMySQL, isOracle, isSqlServer, jdbcUpdate, jdbcUpdate, merge, prepareQuery, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet, refresh, saveOrUpdate, setSessionFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbulkUpdate, delete, deleteAll, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSetprotected LockManager lockManager
public UserDAO getUserDAO()
public void setUserDAO(UserDAO userDAO)
public boolean store(Folder folder)
PersistentObjectDAOstore in interface PersistentObjectDAO<Folder>store in class HibernatePersistentObjectDAO<Folder>folder - entity to be stored.public boolean store(Folder folder, FolderHistory transaction)
FolderDAOpublic List<Folder> findByUserId(long userId)
FolderDAOfindByUserId in interface FolderDAOuserId - ID of the userpublic List<Folder> findByUserId(long userId, long parentId)
FolderDAOfindByUserId in interface FolderDAOparentId - ID of the folder which children are wantedpublic List<Folder> findChildren(long parentId, Integer max)
FolderDAOfindChildren in interface FolderDAOparentId - Folder ID of the folder which children are wantedmax - Optional, maximum number of childrenpublic List<Folder> findChildren(long parentId, long userId)
FolderDAOfindChildren in interface FolderDAOparentId - Folder ID of the folder which children are wanteduserId - Identifier of the user that must have read accesspublic List<Folder> findByParentId(long parentId)
FolderDAOfindByParentId in interface FolderDAOpublic boolean isWriteEnable(long folderId,
long userId)
FolderDAOisWriteEnable in interface FolderDAOfolderId - ID of the folderuserId - ID of the userpublic boolean isReadEnable(long folderId,
long userId)
isReadEnable in interface FolderDAOpublic Collection<Long> findFolderIdByUserId(long userId, Long parentId, boolean tree)
FolderDAOfindFolderIdByUserId in interface FolderDAOuserId - ID of the user.parentId - The id of the parent folder to inspect (optional)tree - If true, the parentId will be interpreted as the root of a
treepublic boolean hasWriteAccess(Folder folder, long userId)
FolderDAOhasWriteAccess in interface FolderDAOpublic List<Folder> findByGroupId(long groupId)
FolderDAOfindByGroupId in interface FolderDAOgroupId - The group idpublic List<Long> findIdByUserId(long userId, long parentId)
FolderDAOfindIdByUserId in interface FolderDAOuserId - ID of the userparentId - Parent folderpublic List<Folder> findByName(String name)
FolderDAOfindByName in interface FolderDAOpublic List<Folder> findByName(Folder parent, String name, boolean caseSensitive)
FolderDAOfindByName in interface FolderDAOparent - The parent folder(optional)name - The folder name to search forpublic String computePathExtended(long folderId)
FolderDAOcomputePathExtended in interface FolderDAOpublic List<Folder> findByNameAndParentId(String name, long parentId)
FolderDAOfindByNameAndParentId in interface FolderDAOpublic List<Folder> findParents(long folderId)
FolderDAOfindParents in interface FolderDAOpublic boolean isPermissionEnabled(Permission permission, long folderId, long userId)
FolderDAOisPermissionEnabled in interface FolderDAOpermission - the permission to checkfolderId - ID of the folderuserId - ID of the userpublic void restore(long folderId,
long parentId,
FolderHistory transaction)
FolderDAOpublic Set<Permission> getEnabledPermissions(long folderId, long userId)
FolderDAOgetEnabledPermissions in interface FolderDAOfolderId - ID of the folderuserId - ID of the userpublic Collection<Long> findFolderIdByUserIdAndPermission(long userId, Permission permission, Long parentId, boolean tree)
FolderDAOfindFolderIdByUserIdAndPermission in interface FolderDAOuserId - The user identifierpermission - The permission to checkparentId - The id of the parent folder to inspect (optional)tree - If true, the parentId will be interpreted as the root of a
treepublic FolderHistoryDAO getHistoryDAO()
public void setHistoryDAO(FolderHistoryDAO historyDAO)
public void deleteAll(List<Folder> folders, FolderHistory transaction)
FolderDAOpublic boolean delete(long folderId,
FolderHistory transaction)
FolderDAOpublic boolean applyRithtToTree(long rootId,
FolderHistory transaction)
FolderDAOapplyRithtToTree in interface FolderDAOpublic boolean applyMetadataToTree(long id,
FolderHistory transaction)
FolderDAOapplyMetadataToTree in interface FolderDAOpublic Folder create(Folder parent, Folder folderVO, boolean inheritSecurity, FolderHistory transaction)
FolderDAOpublic Folder createPath(Folder parent, String path, boolean inheritSecurity, FolderHistory transaction)
FolderDAOcreatePath in interface FolderDAOparent - The parent folderpath - The folder path(for example /dog/cat/mouse)inheritSecurity - If true the new folders will 'point' to the parent
for the security policies.public Folder findByPath(String pathExtended)
FolderDAOfindByPath in interface FolderDAOpublic void setUniqueName(Folder folder)
setUniqueName in interface FolderDAOpublic void move(Folder source, Folder target, FolderHistory transaction) throws Exception
FolderDAOpublic List<Folder> deleteTree(long folderId, FolderHistory transaction) throws Exception
FolderDAOImportant: All the contained documents will be deleted
deleteTree in interface FolderDAOfolderId - Folder to deletetransaction - entry to log the event (set the user)Exceptionpublic List<Folder> deleteTree(Folder folder, FolderHistory transaction) throws Exception
FolderDAOImportant: Remember to delete orphaned documents.
deleteTree in interface FolderDAOfolder - Folder to deletetransaction - entry to log the event (set the user)Exceptionpublic Set<Long> findFolderIdInTree(long rootId, boolean includeDeleted)
FolderDAOfindFolderIdInTree in interface FolderDAOrootId - Root of the folderincludeDeleted - True if the deleted records need to be loadedpublic List<Folder> find(String name)
FolderDAOpublic boolean isInPath(long folderId,
long targetId)
FolderDAOpublic int count(boolean computeDeleted)
FolderDAOpublic List<Folder> findWorkspaces()
FolderDAOfindWorkspaces in interface FolderDAOpublic void initialize(Folder folder)
HibernatePersistentObjectDAOinitialize in interface PersistentObjectDAO<Folder>initialize in interface FolderDAOinitialize in class HibernatePersistentObjectDAO<Folder>folder - The entity to be initialisedpublic void setConfig(ContextProperties config)
public void setLockManager(LockManager lockManager)
public List<Folder> findDeleted(long userId, Integer maxHits)
FolderDAOfindDeleted in interface FolderDAOuserId - The user that performed the deletionmaxHits - Optional defines the max number of returned hitsCopyright © 2008-2014 Logical Objects. All Rights Reserved.