public class GroupDAOHibernate extends InternalDirectoryEntityHibernateDao<InternalGroup,InternalGroupAttribute> implements InternalGroupDao, GroupDao
Modifier and Type | Field and Description |
---|---|
static String |
DIRECTORY_ID |
static String |
EXTERNAL_ID |
static String |
IS_LOCAL |
static String |
NAME |
batchFinder, batchProcessor, logger, statelessSessionBatchProcessor, timeSource
sessionFactory
Constructor and Description |
---|
GroupDAOHibernate() |
Modifier and Type | Method and Description |
---|---|
InternalGroup |
add(Group group)
Adds a new group.
|
BatchResultWithIdReferences<Group> |
addAll(Collection<InternalGroupWithAttributes> groups)
Bulk add of groups and their attributes.
|
BatchResult<Group> |
addAll(Set<? extends Group> groups)
Bulk add of groups.
|
void |
addAttribute(InternalGroup group,
String attributeName,
String attributeValue) |
InternalGroup |
addLocal(Group group)
Add a new local group.
|
Map<String,String> |
findByExternalIds(long directoryId,
Set<String> externalIds)
Searches the specified directory for group names of groups with the specified external ids
|
Collection<InternalGroup> |
findByIds(Collection<Long> groupIds)
Bulk find of groups with the specified database identifiers.
|
InternalGroup |
findByName(long directoryId,
String groupName)
Finds internal group by directory id and group name.
|
Collection<InternalGroup> |
findByNames(long directoryID,
Collection<String> groupnames)
Bulk find of groups using SQL disjunction.
|
InternalGroupWithAttributes |
findByNameWithAttributes(long directoryId,
String groupName)
Finds group by name.
|
Map<String,String> |
findExternalIdsByNames(long directoryId,
Set<String> groupNames)
Searches the specified directory for externalIds of groups with the specified names
|
Set<InternalGroupAttribute> |
findGroupAttributes(long groupId)
Finds group attributes of the given group identified by group id.
|
Set<String> |
getAllExternalIds(long directoryId)
Return all group externalId in the given directory.
|
long |
getExternalGroupCount(long directoryId)
Gets the count of external groups for a directory
|
long |
getGroupCount(long directoryId)
Return number of groups in given directory.
|
Set<String> |
getLocalGroupNames(long directoryId)
Return names of all local groups in given directory.
|
Class<InternalGroup> |
getPersistentClass()
All subclasses of HibernateDao must implement this method for
HibernateDao.load(Serializable) to work
correctly. |
void |
remove(Group group)
Removes group.
|
void |
removeAll(long directoryId)
Removes all groups from a directory, but does not audit group removal operation
|
BatchResult<String> |
removeAllGroups(long directoryId,
Set<String> groupNames)
Bulk remove all the given groups.
|
void |
removeAttribute(Group group,
String attributeName)
Remove the attribute from the group.
|
InternalGroup |
rename(Group group,
String newName)
Renames group.
|
<T> List<T> |
search(long directoryId,
EntityQuery<T> query)
Searches for group based on the given criteria.
|
void |
setAttributesHelper(InternalAttributesHelper attributesHelper) |
void |
setAuditProcessor(GroupAuditProcessor auditProcessor) |
void |
setDirectoryDao(DirectoryDao directoryDao) |
void |
setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater) |
void |
setMembershipDao(InternalMembershipDao membershipDao) |
void |
storeAttributes(Group group,
Map<String,Set<String>> attributes)
Stores attributes into group.
|
InternalGroup |
update(Group group)
Updates group.
|
executeBatchedQueriesIfNecessary, removeAttribute, removeAttribute, storeAttributes, updateTimestamps
createDeleteQuery, createDeleteQuery, createHibernateQuery, createQuery, createQuery, executeHQLQuery, findAllInternal, findByProperties, findByPropertiesOptional, findByProperty, findByProperty, findByPropertyOptional, findByPropertyOrThrow, load, load, loadOptional, loadReference, loadReference, remove, removeByIdIfPresent, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setClock, setStatelessSessionBatchProcessor, toPredicates, update
setSessionFactory, withStatelessSession
public static final String EXTERNAL_ID
public static final String DIRECTORY_ID
public static final String IS_LOCAL
public static final String NAME
public InternalGroup add(Group group) throws DirectoryNotFoundException, InvalidGroupException
GroupDao
add
in interface GroupDao
group
- groupDirectoryNotFoundException
- if the directory specified in group object does not existInvalidGroupException
- if a group with the same directory and name (case-insensitive) already existspublic BatchResult<Group> addAll(Set<? extends Group> groups) throws DirectoryNotFoundException
GroupDao
addAll
in interface GroupDao
groups
- to be addedDirectoryNotFoundException
- if the directory cannot be foundpublic BatchResultWithIdReferences<Group> addAll(Collection<InternalGroupWithAttributes> groups)
InternalGroupDao
addAll
in interface InternalGroupDao
groups
- Groups with attributes.public InternalGroup addLocal(Group group) throws DirectoryNotFoundException, InvalidGroupException
GroupDao
addLocal
in interface GroupDao
group
- groupDirectoryNotFoundException
- if the directory specified in group object does not existInvalidGroupException
- if a group with the same directory and name (case-insensitive) already existspublic InternalGroup findByName(long directoryId, String groupName) throws GroupNotFoundException
InternalGroupDao
findByName
in interface InternalGroupDao
findByName
in interface GroupDao
findByName
in class InternalDirectoryEntityHibernateDao<InternalGroup,InternalGroupAttribute>
directoryId
- Directory id.groupName
- Group name.GroupNotFoundException
- If the group cannot be found.public InternalGroupWithAttributes findByNameWithAttributes(long directoryId, String groupName) throws GroupNotFoundException
GroupDao
GroupDao.findByName(long, String)
in that it also returns
the group attributes associated with the retrieved group.findByNameWithAttributes
in interface GroupDao
directoryId
- the ID of the directory to look for groupgroupName
- group nameGroupNotFoundException
- if the group does not existpublic Collection<InternalGroup> findByNames(long directoryID, Collection<String> groupnames)
InternalGroupDao
findByNames
in interface InternalGroupDao
directoryID
- the directory to search for the groups.groupnames
- names of groups to findpublic Collection<InternalGroup> findByIds(Collection<Long> groupIds)
InternalGroupDao
findByIds
in interface InternalGroupDao
groupIds
- identifiers of groups that will be foundpublic Set<InternalGroupAttribute> findGroupAttributes(long groupId)
InternalGroupDao
findGroupAttributes
in interface InternalGroupDao
groupId
- Group id.public Class<InternalGroup> getPersistentClass()
HibernateDao
HibernateDao.load(Serializable)
to work
correctly.getPersistentClass
in class HibernateDao<InternalGroup>
public void remove(Group group) throws GroupNotFoundException
GroupDao
remove
in interface GroupDao
group
- groupGroupNotFoundException
- if the group does not existpublic void removeAll(long directoryId)
InternalGroupDao
removeAll
in interface InternalGroupDao
directoryId
- Directory Id.public BatchResult<String> removeAllGroups(long directoryId, Set<String> groupNames)
GroupDao
removeAllGroups
in interface GroupDao
directoryId
- directory to perform the operationgroupNames
- groups to be removedpublic Set<String> getAllExternalIds(long directoryId) throws DirectoryNotFoundException
GroupDao
null
or an empty String it won't be included.getAllExternalIds
in interface GroupDao
directoryId
- the ID of the directoryDirectoryNotFoundException
- when directory with given id does not existpublic Set<String> getLocalGroupNames(long directoryId) throws DirectoryNotFoundException
GroupDao
getLocalGroupNames
in interface GroupDao
directoryId
- the ID of the directoryDirectoryNotFoundException
- when directory with given id does not existpublic long getGroupCount(long directoryId) throws DirectoryNotFoundException
GroupDao
getGroupCount
in interface GroupDao
directoryId
- the ID of the directoryDirectoryNotFoundException
- when directory with given id does not existpublic long getExternalGroupCount(long directoryId) throws DirectoryNotFoundException
InternalGroupDao
getExternalGroupCount
in interface InternalGroupDao
directoryId
- the directory to count groups forDirectoryNotFoundException
public void removeAttribute(Group group, String attributeName) throws GroupNotFoundException
GroupDao
removeAttribute
in interface GroupDao
group
- groupattributeName
- attribute to be removedGroupNotFoundException
- if the group does not existpublic InternalGroup rename(Group group, String newName) throws GroupNotFoundException, InvalidGroupException
GroupDao
rename
in interface GroupDao
group
- groupnewName
- the new nameGroupNotFoundException
- if the group does not existInvalidGroupException
- if a group with the same directory and name (case-insensitive) already existspublic <T> List<T> search(long directoryId, EntityQuery<T> query)
GroupDao
public Map<String,String> findByExternalIds(long directoryId, Set<String> externalIds)
InternalGroupDao
findByExternalIds
in interface InternalGroupDao
directoryId
- the id of the directory to searchexternalIds
- external ids of the groups to findpublic Map<String,String> findExternalIdsByNames(long directoryId, Set<String> groupNames)
InternalGroupDao
findExternalIdsByNames
in interface InternalGroupDao
directoryId
- the id of the directory to searchgroupNames
- names of the groups to findpublic void storeAttributes(Group group, Map<String,Set<String>> attributes) throws GroupNotFoundException
GroupDao
storeAttributes
in interface GroupDao
group
- groupattributes
- attributesGroupNotFoundException
- if the group does not existpublic InternalGroup update(Group group) throws GroupNotFoundException
GroupDao
update
in interface GroupDao
group
- groupGroupNotFoundException
- if the group does not existpublic void addAttribute(InternalGroup group, String attributeName, String attributeValue)
addAttribute
in class InternalDirectoryEntityHibernateDao<InternalGroup,InternalGroupAttribute>
@Autowired public void setAttributesHelper(InternalAttributesHelper attributesHelper)
@Autowired public void setDirectoryDao(DirectoryDao directoryDao)
@Autowired public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
@Autowired public void setMembershipDao(InternalMembershipDao membershipDao)
@Autowired public void setAuditProcessor(@Qualifier(value="groupAuditProcessor") GroupAuditProcessor auditProcessor)
Copyright © 2019 Atlassian. All rights reserved.