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, setSessionFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bulkUpdate, delete, deleteAll, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet
protected LockManager lockManager
public UserDAO getUserDAO()
public void setUserDAO(UserDAO userDAO)
public boolean store(Folder folder)
PersistentObjectDAO
store
in interface PersistentObjectDAO<Folder>
store
in class HibernatePersistentObjectDAO<Folder>
folder
- entity to be stored.public boolean store(Folder folder, FolderHistory transaction)
FolderDAO
public List<Folder> findByUserId(long userId)
FolderDAO
findByUserId
in interface FolderDAO
userId
- ID of the userpublic List<Folder> findByUserId(long userId, long parentId)
FolderDAO
findByUserId
in interface FolderDAO
parentId
- ID of the folder which children are wantedpublic List<Folder> findChildren(long parentId, Integer max)
FolderDAO
findChildren
in interface FolderDAO
parentId
- Folder ID of the folder which children are wantedmax
- Optional, maximum number of childrenpublic List<Folder> findChildren(long parentId, long userId)
FolderDAO
findChildren
in interface FolderDAO
parentId
- Folder ID of the folder which children are wanteduserId
- Identifier of the user that must have read accesspublic List<Folder> findByParentId(long parentId)
FolderDAO
findByParentId
in interface FolderDAO
public boolean isWriteEnable(long folderId, long userId)
FolderDAO
isWriteEnable
in interface FolderDAO
folderId
- ID of the folderuserId
- ID of the userpublic boolean isReadEnable(long folderId, long userId)
isReadEnable
in interface FolderDAO
public Collection<Long> findFolderIdByUserId(long userId, Long parentId, boolean tree)
FolderDAO
findFolderIdByUserId
in interface FolderDAO
userId
- 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)
FolderDAO
hasWriteAccess
in interface FolderDAO
public List<Folder> findByGroupId(long groupId)
FolderDAO
findByGroupId
in interface FolderDAO
groupId
- The group idpublic List<Long> findIdByUserId(long userId, long parentId)
FolderDAO
findIdByUserId
in interface FolderDAO
userId
- ID of the userparentId
- Parent folderpublic List<Folder> findByName(String name)
FolderDAO
findByName
in interface FolderDAO
public List<Folder> findByName(Folder parent, String name, boolean caseSensitive)
FolderDAO
findByName
in interface FolderDAO
parent
- The parent folder(optional)name
- The folder name to search forpublic String computePathExtended(long folderId)
FolderDAO
computePathExtended
in interface FolderDAO
public List<Folder> findByNameAndParentId(String name, long parentId)
FolderDAO
findByNameAndParentId
in interface FolderDAO
public List<Folder> findParents(long folderId)
FolderDAO
findParents
in interface FolderDAO
public boolean isPermissionEnabled(Permission permission, long folderId, long userId)
FolderDAO
isPermissionEnabled
in interface FolderDAO
permission
- the permission to checkfolderId
- ID of the folderuserId
- ID of the userpublic void restore(long folderId, long parentId, FolderHistory transaction)
FolderDAO
public Set<Permission> getEnabledPermissions(long folderId, long userId)
FolderDAO
getEnabledPermissions
in interface FolderDAO
folderId
- ID of the folderuserId
- ID of the userpublic Collection<Long> findFolderIdByUserIdAndPermission(long userId, Permission permission, Long parentId, boolean tree)
FolderDAO
findFolderIdByUserIdAndPermission
in interface FolderDAO
userId
- 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)
FolderDAO
public boolean delete(long folderId, FolderHistory transaction)
FolderDAO
public boolean applyRithtToTree(long rootId, FolderHistory transaction)
FolderDAO
applyRithtToTree
in interface FolderDAO
public boolean applyMetadataToTree(long id, FolderHistory transaction)
FolderDAO
applyMetadataToTree
in interface FolderDAO
public Folder create(Folder parent, Folder folderVO, boolean inheritSecurity, FolderHistory transaction)
FolderDAO
public Folder createPath(Folder parent, String path, boolean inheritSecurity, FolderHistory transaction)
FolderDAO
createPath
in interface FolderDAO
parent
- 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)
FolderDAO
findByPath
in interface FolderDAO
public void setUniqueName(Folder folder)
setUniqueName
in interface FolderDAO
public void move(Folder source, Folder target, FolderHistory transaction) throws Exception
FolderDAO
public List<Folder> deleteTree(long folderId, FolderHistory transaction) throws Exception
FolderDAO
Important: All the contained documents will be deleted
deleteTree
in interface FolderDAO
folderId
- Folder to deletetransaction
- entry to log the event (set the user)Exception
public List<Folder> deleteTree(Folder folder, FolderHistory transaction) throws Exception
FolderDAO
Important: Remember to delete orphaned documents.
deleteTree
in interface FolderDAO
folder
- Folder to deletetransaction
- entry to log the event (set the user)Exception
public Set<Long> findFolderIdInTree(long rootId, boolean includeDeleted)
FolderDAO
findFolderIdInTree
in interface FolderDAO
rootId
- Root of the folderincludeDeleted
- True if the deleted records need to be loadedpublic List<Folder> find(String name)
FolderDAO
public boolean isInPath(long folderId, long targetId)
FolderDAO
public int count(boolean computeDeleted)
FolderDAO
public List<Folder> findWorkspaces()
FolderDAO
findWorkspaces
in interface FolderDAO
public void initialize(Folder folder)
HibernatePersistentObjectDAO
initialize
in interface PersistentObjectDAO<Folder>
initialize
in interface FolderDAO
initialize
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)
FolderDAO
findDeleted
in interface FolderDAO
userId
- The user that performed the deletionmaxHits
- Optional defines the max number of returned hitsCopyright © 2008-2014 Logical Objects. All Rights Reserved.