Package org.dspace.eperson.service
Interface GroupService
-
- All Superinterfaces:
DSpaceObjectLegacySupportService<Group>,DSpaceObjectService<Group>
- All Known Implementing Classes:
GroupServiceImpl
public interface GroupService extends DSpaceObjectService<Group>, DSpaceObjectLegacySupportService<Group>
Service interface class for the Group object. The implementation of this class is responsible for all business logic calls for the Group object and is autowired by Spring.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description static intNAME-
Fields inherited from interface org.dspace.content.service.DSpaceObjectService
MD_COPYRIGHT_TEXT, MD_INTRODUCTORY_TEXT, MD_LICENSE, MD_NAME, MD_PROVENANCE_DESCRIPTION, MD_SHORT_DESCRIPTION, MD_SIDEBAR_TEXT, MD_SOURCE, MD_USER_FORMAT_DESCRIPTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddMember(Context context, Group group, EPerson e)add an eperson membervoidaddMember(Context context, Group groupParent, Group groupChild)add group to this group.List<Group>allMemberGroups(Context context, EPerson ePerson)Get all of the groups that an eperson is a member of.Set<Group>allMemberGroupsSet(Context context, EPerson ePerson)List<EPerson>allMembers(Context context, Group group)Get all of the EPerson objects who are a member of the specified group, or a member of a subgroup of the specified group, etc.intcountAllMembers(Context context, Group group)Count all of the EPerson objects who are a member of the specified group, or a member of a subgroup of the specified group, etc.intcountByParent(Context context, Group parent)Return number of groups which are a member of the given Parent group.intcountTotal(Context context)Count the total number of groups in DSpaceGroupcreate(Context context)Create a new groupList<Group>findAll(Context context, int sortField)Deprecated.List<Group>findAll(Context context, List<MetadataField> metadataSortFields)Deprecated.Please usefindAll(Context context, List<MetadataField> metadataFieldsSort, int pageSize, int offset)insteadList<Group>findAll(Context context, List<MetadataField> metadataSortFields, int pageSize, int offset)Finds all groups in the siteList<Group>findByMetadataField(Context context, String searchValue, MetadataField metadataField)Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)GroupfindByName(Context context, String name)Find the group by its name - assumes name is uniqueList<Group>findByParent(Context context, Group parent, int pageSize, int offset)Find all groups which are a member of the given Parent groupList<Group>getEmptyGroups(Context context)Find all empty groups in DSpacevoidinitDefaultGroupNames(Context context)Initializes the group names for anonymous and administrator, and marks them "permanent".booleanisDirectMember(Group group, EPerson ePerson)check to see if an eperson is a direct member.booleanisEmpty(Group group)Return true if group has no direct or indirect membersbooleanisMember(Context context, String groupName)fast check to see if an eperson is a member called with eperson id.booleanisMember(Context context, EPerson epersonToCheck, String groupName)fast check to see if an eperson is a member called with eperson id.booleanisMember(Context context, EPerson eperson, Group group)fast check to see if an eperson is a member called with eperson id.booleanisMember(Context context, Group group)fast check to see if an eperson is a member called with eperson id.booleanisMember(Group owningGroup, Group childGroup)Check to see if childGroup is a direct group member of owningGroup.booleanisParentOf(Context context, Group parentGroup, Group childGroup)Check to see if parentGroup is a direct or in-direct parent of a childGroup.voidremoveMember(Context context, Group group, EPerson ePerson)remove an eperson from a groupvoidremoveMember(Context context, Group groupParent, Group childGroup)remove group from this group.List<Group>search(Context context, String query)Find the Groups that match the query across both Group name and Group ID.List<Group>search(Context context, String query, int offset, int limit)Find the Groups that match the query across both Group name and Group ID.List<Group>searchNonMembers(Context context, String query, Group excludeParentGroup, int offset, int limit)Find the groups that match the search query which are NOT currently members (subgroups) of the given parentGroupintsearchNonMembersCount(Context context, String query, Group excludeParentGroup)Returns the total number of groups that match the search query which are NOT currently members (subgroups) of the given parentGroup.intsearchResultCount(Context context, String query)Returns the total number of Groups returned by a specific query.voidsetName(Group group, String name)set name of group-
Methods inherited from interface org.dspace.content.service.DSpaceObjectLegacySupportService
findByIdOrLegacyId, findByLegacyId, getSupportsTypeConstant
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, delete, find, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getParentObject, getSupportsTypeConstant, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValue, update, updateLastModified
-
-
-
-
Field Detail
-
NAME
static final int NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
Group create(Context context) throws SQLException, AuthorizeException
Create a new group- Parameters:
context- DSpace context object- Returns:
- group
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
setName
void setName(Group group, String name) throws SQLException
set name of group- Parameters:
group- DSpace groupname- new group name- Throws:
SQLException- if database error
-
addMember
void addMember(Context context, Group group, EPerson e)
add an eperson member- Parameters:
context- DSpace context objectgroup- DSpace groupe- eperson
-
addMember
void addMember(Context context, Group groupParent, Group groupChild) throws SQLException
add group to this group. Be sure to call the#update(Context, Group)method once that all the membership are set to trigger the rebuild of the group2group cache table- Parameters:
context- DSpace context objectgroupParent- parent groupgroupChild- child group- Throws:
SQLException- if database error
-
removeMember
void removeMember(Context context, Group group, EPerson ePerson) throws SQLException
remove an eperson from a group- Parameters:
context- DSpace context objectgroup- DSpace groupePerson- eperson- Throws:
SQLException
-
removeMember
void removeMember(Context context, Group groupParent, Group childGroup) throws SQLException
remove group from this group. Be sure to call the#update(Context, Group)method once that all the membership are set to trigger the rebuild of the group2group cache table- Parameters:
context- DSpace context objectgroupParent- parent groupchildGroup- child group- Throws:
SQLException- if database error
-
isDirectMember
boolean isDirectMember(Group group, EPerson ePerson)
check to see if an eperson is a direct member. If the eperson is a member via a subgroup will be returnedfalse- Parameters:
group- DSpace groupePerson- eperson to check membership- Returns:
- true or false
-
isMember
boolean isMember(Group owningGroup, Group childGroup)
Check to see if childGroup is a direct group member of owningGroup. If childGroup is a subgroup via another group will be returnedfalse- Parameters:
owningGroup- parent groupchildGroup- child group- Returns:
- true or false
-
isParentOf
boolean isParentOf(Context context, Group parentGroup, Group childGroup) throws SQLException
Check to see if parentGroup is a direct or in-direct parent of a childGroup.- Parameters:
context- current DSpace session.parentGroup- parent groupchildGroup- child group- Returns:
- true or false
- Throws:
SQLException
-
isMember
boolean isMember(Context context, Group group) throws SQLException
fast check to see if an eperson is a member called with eperson id. Does database lookup without instantiating all of the eperson objects and is thus a static method- Parameters:
context- contextgroup- group to check- Returns:
- true or false
- Throws:
SQLException- if database error
-
isMember
boolean isMember(Context context, String groupName) throws SQLException
fast check to see if an eperson is a member called with eperson id. Does database lookup without instantiating all of the eperson objects and is thus a static method. This method uses context.getCurrentUser() as eperson whose membership should be checked.- Parameters:
context- contextgroupName- the name of the group to check- Returns:
- true or false
- Throws:
SQLException- if database error
-
isMember
boolean isMember(Context context, EPerson epersonToCheck, String groupName) throws SQLException
fast check to see if an eperson is a member called with eperson id. Does database lookup without instantiating all of the eperson objects and is thus a static method. The eperson whose membership should be checked must be defined as method attribute.- Parameters:
context- contextepersonToCheck- is this EPerson a member of the group?groupName- the name of the group to check- Returns:
- true or false
- Throws:
SQLException- if database error
-
isMember
boolean isMember(Context context, EPerson eperson, Group group) throws SQLException
fast check to see if an eperson is a member called with eperson id. Does database lookup without instantiating all of the eperson objects and is thus a static method.- Parameters:
context- DSpace context object.eperson- EPerson whose membership should be checked.group- The group to check against.- Returns:
- true or false
- Throws:
SQLException- if database error
-
allMemberGroups
List<Group> allMemberGroups(Context context, EPerson ePerson) throws SQLException
Get all of the groups that an eperson is a member of.- Parameters:
context- DSpace contextePerson- ePerson object- Returns:
- list of Group objects
- Throws:
SQLException- if database error
-
allMemberGroupsSet
Set<Group> allMemberGroupsSet(Context context, EPerson ePerson) throws SQLException
- Throws:
SQLException
-
allMembers
List<EPerson> allMembers(Context context, Group group) throws SQLException
Get all of the EPerson objects who are a member of the specified group, or a member of a subgroup of the specified group, etc.WARNING: This method may have bad performance for Groups with a very large number of members, as it will load all member EPerson objects into memory. Only use if you need access to *every* EPerson object at once.
- Parameters:
context- The relevant DSpace Context.group- Group object- Returns:
- List of EPerson objects
- Throws:
SQLException- if error
-
countAllMembers
int countAllMembers(Context context, Group group) throws SQLException
Count all of the EPerson objects who are a member of the specified group, or a member of a subgroup of the specified group, etc. In other words, this will return the size of "allMembers()" without having to load all EPerson objects into memory.- Parameters:
context- current DSpace contextgroup- Group object- Returns:
- count of EPerson object members
- Throws:
SQLException- if error
-
findByName
Group findByName(Context context, String name) throws SQLException
Find the group by its name - assumes name is unique- Parameters:
context- The relevant DSpace Context.name- Group name to search for- Returns:
- the named Group, or null if not found
- Throws:
SQLException- if error
-
findAll
List<Group> findAll(Context context, List<MetadataField> metadataSortFields, int pageSize, int offset) throws SQLException
Finds all groups in the site- Parameters:
context- The relevant DSpace Context.metadataSortFields- metadata fields to sort by, leave empty to sort by NamepageSize- how many results returnoffset- the position of the first result to return- Returns:
- List of all groups in the site
- Throws:
SQLException- if error
-
findAll
@Deprecated List<Group> findAll(Context context, List<MetadataField> metadataSortFields) throws SQLException
Deprecated.Please usefindAll(Context context, List<MetadataField> metadataFieldsSort, int pageSize, int offset)instead- Parameters:
context- The relevant DSpace Context.metadataSortFields- metadata fields to sort by, leave empty to sort by Name- Returns:
- List of all groups in the site
- Throws:
SQLException- if error
-
findAll
@Deprecated List<Group> findAll(Context context, int sortField) throws SQLException
Deprecated.DEPRECATED: Please usefindAll(Context context, List<MetadataField> metadataFieldsSort)instead- Parameters:
context- DSpace contextsortField- sort field index- Returns:
- List of all groups in the site
- Throws:
SQLException- if error
-
search
List<Group> search(Context context, String query) throws SQLException
Find the Groups that match the query across both Group name and Group ID. This is an unpaginated search, which means it will load all matching groups into memory at once. This may provide POOR PERFORMANCE when a large number of groups are matched.- Parameters:
context- DSpace contextquery- The search string used to search across group name or group ID- Returns:
- List of matching Group objects
- Throws:
SQLException- if error
-
search
List<Group> search(Context context, String query, int offset, int limit) throws SQLException
Find the Groups that match the query across both Group name and Group ID. This method supports pagination, which provides better performance than the above non-paginated search() method.- Parameters:
context- DSpace contextquery- The search string used to search across group name or group IDoffset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching Group objects
- Throws:
SQLException- if error
-
searchResultCount
int searchResultCount(Context context, String query) throws SQLException
Returns the total number of Groups returned by a specific query. Search is performed based on Group name and Group ID. May be used with search() above to support pagination of matching Groups.- Parameters:
context- DSpace contextquery- The search string used to search across group name or group ID- Returns:
- the number of groups matching the query
- Throws:
SQLException- if error
-
searchNonMembers
List<Group> searchNonMembers(Context context, String query, Group excludeParentGroup, int offset, int limit) throws SQLException
Find the groups that match the search query which are NOT currently members (subgroups) of the given parentGroup- Parameters:
context- DSpace contextquery- The search string used to search across group name or group IDexcludeParentGroup- Parent group to exclude results fromoffset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching Group objects
- Throws:
SQLException- if error
-
searchNonMembersCount
int searchNonMembersCount(Context context, String query, Group excludeParentGroup) throws SQLException
Returns the total number of groups that match the search query which are NOT currently members (subgroups) of the given parentGroup. Can be used with searchNonMembers() to support pagination.- Parameters:
context- DSpace contextquery- The search string used to search across group name or group IDexcludeParentGroup- Parent group to exclude results from- Returns:
- the number of Groups matching the query
- Throws:
SQLException- if error
-
isEmpty
boolean isEmpty(Group group)
Return true if group has no direct or indirect members- Parameters:
group- DSpace group- Returns:
- true or false
-
initDefaultGroupNames
void initDefaultGroupNames(Context context) throws SQLException, AuthorizeException
Initializes the group names for anonymous and administrator, and marks them "permanent".- Parameters:
context- the DSpace context- Throws:
SQLException- database exceptionAuthorizeException- authorization error
-
getEmptyGroups
List<Group> getEmptyGroups(Context context) throws SQLException
Find all empty groups in DSpace- Parameters:
context- The DSpace context- Returns:
- All empty groups
- Throws:
SQLException- database exception
-
countTotal
int countTotal(Context context) throws SQLException
Count the total number of groups in DSpace- Parameters:
context- The DSpace context- Returns:
- The total number of groups
- Throws:
SQLException- database exception
-
findByMetadataField
List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException
Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)- Parameters:
context- The DSpace contextsearchValue- The value to matchmetadataField- The metadata field to search in- Returns:
- The groups that have a matching value for specified metadata field
- Throws:
SQLException- database exception
-
findByParent
List<Group> findByParent(Context context, Group parent, int pageSize, int offset) throws SQLException
Find all groups which are a member of the given Parent group- Parameters:
context- The relevant DSpace Context.parent- The parent Group to search onpageSize- how many results returnoffset- the position of the first result to return- Returns:
- List of all groups which are members of the parent group
- Throws:
SQLException- database exception if error
-
countByParent
int countByParent(Context context, Group parent) throws SQLException
Return number of groups which are a member of the given Parent group. Can be used with findByParent() for pagination of all groups within a given Parent group.- Parameters:
context- The relevant DSpace Context.parent- The parent Group to search on- Returns:
- number of groups which are members of the parent group
- Throws:
SQLException- database exception if error
-
-