Package org.dspace.content.service
Interface CommunityService
-
- All Superinterfaces:
DSpaceObjectLegacySupportService<Community>,DSpaceObjectService<Community>
- All Known Implementing Classes:
CommunityServiceImpl
public interface CommunityService extends DSpaceObjectService<Community>, DSpaceObjectLegacySupportService<Community>
Service interface class for the Community object. The implementation of this class is responsible for all business logic calls for the Community object and is autowired by spring- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
-
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 Modifier and Type Method Description voidaddCollection(Context context, Community community, Collection collection)Add an exisiting collection to the communityvoidaddSubcommunity(Context context, Community parentCommunity, Community childCommunity)Add an existing community as a subcommunity to the communityvoidcanEdit(Context context, Community community)booleancanEditBoolean(Context context, Community community)return TRUE if context's user can edit community, false otherwiseintcountTotal(Context context)Communitycreate(Community parent, Context context)Create a new top-level community, with a new ID.Communitycreate(Community parent, Context context, String handle)Create a new top-level community, with a new ID.Communitycreate(Community parent, Context context, String handle, UUID uuid)Create a new top-level community, with a new ID.GroupcreateAdministrators(Context context, Community community)Create a default administrators group if one does not already exist.CommunitycreateSubcommunity(Context context, Community parentCommunity)Create a new sub-community within this community.CommunitycreateSubcommunity(Context context, Community parentCommunity, String handle)Create a new sub-community within this community.CommunitycreateSubcommunity(Context context, Community parentCommunity, String handle, UUID uuid)Create a new sub-community within this community.List<Community>findAll(Context context)Get a list of all communities in the system.List<Community>findAll(Context context, Integer limit, Integer offset)Get all communities in the system.List<Community>findAllTop(Context context)Get a list of all top-level communities in the system.List<Community>findAuthorized(Context context, List<Integer> actions)List<Community>findAuthorizedGroupMapped(Context context, List<Integer> actions)CommunityfindByAdminGroup(Context context, Group group)List<Collection>getAllCollections(Context context, Community community)Return an array of collections of this community and its subcommunitiesList<Community>getAllParents(Context context, Collection collection)Return an array of parent communities of this collection.List<Community>getAllParents(Context context, Community community)Return an array of parent communities of this community, in ascending order.voidremoveAdministrators(Context context, Community community)Remove the administrators group, if no group has already been created then return without error.voidremoveCollection(Context context, Community community, Collection c)Remove a collection.voidremoveSubcommunity(Context context, Community parentCommunity, Community childCommunity)Remove a subcommunity.BitstreamsetLogo(Context context, Community community, InputStream is)Give the community a logo.-
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
-
-
-
-
Method Detail
-
create
Community create(Community parent, Context context) throws SQLException, AuthorizeException
Create a new top-level community, with a new ID.- Parameters:
parent- parent communitycontext- DSpace context object- Returns:
- the newly created community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
Community create(Community parent, Context context, String handle) throws SQLException, AuthorizeException
Create a new top-level community, with a new ID.- Parameters:
parent- parent communitycontext- DSpace context objecthandle- the pre-determined Handle to assign to the new community- Returns:
- the newly created community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
Community create(Community parent, Context context, String handle, UUID uuid) throws SQLException, AuthorizeException
Create a new top-level community, with a new ID.- Parameters:
parent- parent communitycontext- DSpace context objecthandle- the pre-determined Handle to assign to the new communityuuid- the pre-determined uuid to assign to the new community- Returns:
- the newly created community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findAll
List<Community> findAll(Context context) throws SQLException
Get a list of all communities in the system. These are alphabetically sorted by community name.- Parameters:
context- DSpace context object- Returns:
- the communities in the system
- Throws:
SQLException- if database error
-
findAll
List<Community> findAll(Context context, Integer limit, Integer offset) throws SQLException
Get all communities in the system. Adds support for limit and offset.- Parameters:
context- contextlimit- limitoffset- offset- Returns:
- list of communities
- Throws:
SQLException- if database error
-
findAllTop
List<Community> findAllTop(Context context) throws SQLException
Get a list of all top-level communities in the system. These are alphabetically sorted by community name. A top-level community is one without a parent community.- Parameters:
context- DSpace context object- Returns:
- the top-level communities in the system
- Throws:
SQLException- if database error
-
setLogo
Bitstream setLogo(Context context, Community community, InputStream is) throws AuthorizeException, IOException, SQLException
Give the community a logo. Passing innullremoves any existing logo. You will need to set the format of the new logo bitstream before it will work, for example to "JPEG". Note thatupdatewill need to be called for the change to take effect. Setting a logo and not callingupdatelater may result in a previous logo lying around as an "orphaned" bitstream.- Parameters:
context- contextcommunity- communityis- the stream to use as the new logo- Returns:
- the new logo bitstream, or
nullif there is no logo (nullwas passed in) - Throws:
IOException- if IO errorSQLException- if database errorAuthorizeException- if authorization error
-
createAdministrators
Group createAdministrators(Context context, Community community) throws SQLException, AuthorizeException
Create a default administrators group if one does not already exist. Returns either the newly created group or the previously existing one. Note that other groups may also be administrators.- Parameters:
context- contextcommunity- community- Returns:
- the default group of editors associated with this community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeAdministrators
void removeAdministrators(Context context, Community community) throws SQLException, AuthorizeException
Remove the administrators group, if no group has already been created then return without error. This will merely dereference the current administrators group from the community so that it may be deleted without violating database constraints.- Parameters:
context- contextcommunity- community- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
getAllParents
List<Community> getAllParents(Context context, Community community) throws SQLException
Return an array of parent communities of this community, in ascending order. If community is top-level, return an empty array.- Parameters:
context- contextcommunity- community- Returns:
- an array of parent communities, empty if top-level
- Throws:
SQLException- if database error
-
getAllParents
List<Community> getAllParents(Context context, Collection collection) throws SQLException
Return an array of parent communities of this collection.- Parameters:
context- The relevant DSpace Context.collection- collection to check- Returns:
- an array of parent communities
- Throws:
SQLException- if database error
-
getAllCollections
List<Collection> getAllCollections(Context context, Community community) throws SQLException
Return an array of collections of this community and its subcommunities- Parameters:
context- contextcommunity- community- Returns:
- an array of collections
- Throws:
SQLException- if database error
-
addCollection
void addCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException
Add an exisiting collection to the community- Parameters:
context- contextcommunity- communitycollection- collection to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createSubcommunity
Community createSubcommunity(Context context, Community parentCommunity) throws SQLException, AuthorizeException
Create a new sub-community within this community.- Parameters:
context- contextparentCommunity- parent community- Returns:
- the new community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createSubcommunity
Community createSubcommunity(Context context, Community parentCommunity, String handle) throws SQLException, AuthorizeException
Create a new sub-community within this community.- Parameters:
context- contexthandle- the pre-determined Handle to assign to the new communityparentCommunity- parent community- Returns:
- the new community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createSubcommunity
Community createSubcommunity(Context context, Community parentCommunity, String handle, UUID uuid) throws SQLException, AuthorizeException
Create a new sub-community within this community.- Parameters:
context- contexthandle- the pre-determined Handle to assign to the new communityparentCommunity- parent communityuuid- the pre-determined UUID to assign to the new community- Returns:
- the new community
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
addSubcommunity
void addSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException
Add an existing community as a subcommunity to the community- Parameters:
context- contextparentCommunity- parent community to add our subcommunity tochildCommunity- subcommunity to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeCollection
void removeCollection(Context context, Community community, Collection c) throws SQLException, AuthorizeException, IOException
Remove a collection. If it only belongs to one parent community, then it is permanently deleted. If it has more than one parent community, it is simply unmapped from the current community.- Parameters:
context- contextc- collection to removecommunity- community- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
removeSubcommunity
void removeSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException, IOException
Remove a subcommunity. If it only belongs to one parent community, then it is permanently deleted. If it has more than one parent community, it is simply unmapped from the current community.- Parameters:
context- contextchildCommunity- subcommunity to removeparentCommunity- parent community- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
canEditBoolean
boolean canEditBoolean(Context context, Community community) throws SQLException
return TRUE if context's user can edit community, false otherwise- Parameters:
context- contextcommunity- community- Returns:
- boolean true = current user can edit community
- Throws:
SQLException- if database error
-
canEdit
void canEdit(Context context, Community community) throws AuthorizeException, SQLException
- Throws:
AuthorizeExceptionSQLException
-
findByAdminGroup
Community findByAdminGroup(Context context, Group group) throws SQLException
- Throws:
SQLException
-
findAuthorized
List<Community> findAuthorized(Context context, List<Integer> actions) throws SQLException
- Throws:
SQLException
-
findAuthorizedGroupMapped
List<Community> findAuthorizedGroupMapped(Context context, List<Integer> actions) throws SQLException
- Throws:
SQLException
-
countTotal
int countTotal(Context context) throws SQLException
- Throws:
SQLException
-
-