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
-
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 groupList<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 epeople who are a member of the specified group, or a member of a sub-group of the specified group, etc.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>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, does database lookup without instantiating all of the epeople objects and is thus a static method.booleanisMember(Context context, EPerson epersonToCheck, String groupName)fast check to see if an eperson is a member called with eperson id, does database lookup without instantiating all of the epeople objects and is thus a static method.booleanisMember(Context context, EPerson eperson, Group group)fast check to see if an eperson is a member called with eperson id, does database lookup without instantiating all of the epeople objects and is thus a static methodbooleanisMember(Context context, Group group)fast check to see if an eperson is a member called with eperson id, does database lookup without instantiating all of the epeople objects and is thus a static methodbooleanisMember(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 groupList<Group>search(Context context, String groupIdentifier)Find the groups that match the search query across eperson_group_id or nameList<Group>search(Context context, String groupIdentifier, int offset, int limit)Find the groups that match the search query across eperson_group_id or nameintsearchResultCount(Context context, String query)Returns the total number of groups returned by a specific query, without the overhead of creating the Group objects to store the results.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, clearMetadata, delete, find, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getParentObject, getSupportsTypeConstant, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, 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- Parameters:
context- DSpace context objectgroupParent- parent groupgroupChild- child group- Throws:
SQLException- if database error
-
removeMember
void removeMember(Context context, Group group, EPerson ePerson)
remove an eperson from a group- Parameters:
context- DSpace context objectgroup- DSpace groupePerson- eperson
-
removeMember
void removeMember(Context context, Group groupParent, Group childGroup) throws SQLException
remove group from this group- 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:
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 epeople 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 epeople objects and is thus a static method. This method uses context.getCurrentUser() as eperson whos 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 epeople objects and is thus a static method. The eperson whos membership should be checked must be defined as method attribute.- 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 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 epeople objects and is thus a static method- Parameters:
context- DSpace context object.eperson- EPerson whos 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 contenxtePerson- 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 epeople who are a member of the specified group, or a member of a sub-group of the specified group, etc.- Parameters:
context- The relevant DSpace Context.group- Group object- Returns:
- List of EPerson objects
- 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
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 groupIdentifier) throws SQLException
Find the groups that match the search query across eperson_group_id or name- Parameters:
context- DSpace contextgroupIdentifier- The group name or group ID- Returns:
- array of Group objects
- Throws:
SQLException- if error
-
search
List<Group> search(Context context, String groupIdentifier, int offset, int limit) throws SQLException
Find the groups that match the search query across eperson_group_id or name- Parameters:
context- DSpace contextgroupIdentifier- The group name or group IDoffset- Inclusive offsetlimit- Maximum number of matches returned- Returns:
- array of 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, without the overhead of creating the Group objects to store the results.- Parameters:
context- DSpace contextquery- The search string- 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
-
-