public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> implements CommunityService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamService |
bitstreamService |
protected CollectionService |
collectionService |
protected CommunityDAO |
communityDAO |
protected GroupService |
groupService |
protected ItemService |
itemService |
protected SiteService |
siteService |
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService| Modifier | Constructor and Description |
|---|---|
protected |
CommunityServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCollection(Context context,
Community community,
Collection collection)
Add an exisiting collection to the community
|
protected void |
addCollectionList(Community community,
List<Collection> collectionList)
Internal method to process subcommunities recursively
|
void |
addSubcommunity(Context context,
Community parentCommunity,
Community childCommunity)
Add an existing community as a subcommunity to the community
|
void |
canEdit(Context context,
Community community) |
boolean |
canEditBoolean(Context context,
Community community)
return TRUE if context's user can edit community, false otherwise
|
int |
countTotal(Context context) |
Community |
create(Community parent,
Context context)
Create a new top-level community, with a new ID.
|
Community |
create(Community parent,
Context context,
String handle)
Create a new top-level community, with a new ID.
|
Group |
createAdministrators(Context context,
Community community)
Create a default administrators group if one does not already exist.
|
Community |
createSubcommunity(Context context,
Community parentCommunity)
Create a new sub-community within this community.
|
Community |
createSubcommunity(Context context,
Community parentCommunity,
String handle)
Create a new sub-community within this community.
|
void |
delete(Context context,
Community community) |
Community |
find(Context context,
UUID id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
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) |
Community |
findByAdminGroup(Context context,
Group group) |
Community |
findByIdOrLegacyId(Context context,
String id) |
Community |
findByLegacyId(Context context,
int id)
Generic find for when the precise type of a DSO is not known, just the
a pair of type number and database ID.
|
DSpaceObject |
getAdminObject(Context context,
Community community,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
List<Collection> |
getAllCollections(Context context,
Community community)
Return an array of collections of this community and its subcommunities
|
List<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.
|
String |
getMetadata(Community community,
String field)
Get the value of a metadata field
|
DSpaceObject |
getParentObject(Context context,
Community community)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
protected void |
rawDelete(Context context,
Community community)
Internal method to remove the community and all its children from the
database, and perform any pre/post-cleanup
|
void |
removeAdministrators(Context context,
Community community)
Remove the administrators group, if no group has already been created
then return without error.
|
void |
removeCollection(Context context,
Community community,
Collection collection)
Remove a collection.
|
void |
removeSubcommunity(Context context,
Community parentCommunity,
Community childCommunity)
Remove a subcommunity.
|
Bitstream |
setLogo(Context context,
Community community,
InputStream is)
Give the community a logo.
|
void |
setMetadata(Context context,
Community community,
String field,
String value)
Set a metadata value
|
void |
update(Context context,
Community community) |
void |
updateLastModified(Context context,
Community community) |
addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getAuthoritiesAndConfidences, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, removeMetadataValues, setMetadataSingleValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getName, getTypeText, removeMetadataValues, setMetadataSingleValue@Autowired(required=true) protected CommunityDAO communityDAO
@Autowired(required=true) protected CollectionService collectionService
@Autowired(required=true) protected GroupService groupService
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected ItemService itemService
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected SiteService siteService
public Community create(Community parent, Context context) throws SQLException, AuthorizeException
CommunityServicecreate in interface CommunityServiceparent - parent communitycontext - DSpace context objectSQLException - if database errorAuthorizeException - if authorization errorpublic Community create(Community parent, Context context, String handle) throws SQLException, AuthorizeException
CommunityServicecreate in interface CommunityServiceparent - parent communitycontext - DSpace context objecthandle - the pre-determined Handle to assign to the new communitySQLException - if database errorAuthorizeException - if authorization errorpublic Community find(Context context, UUID id) throws SQLException
DSpaceObjectServicefind in interface DSpaceObjectService<Community>context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.public List<Community> findAll(Context context) throws SQLException
CommunityServicefindAll in interface CommunityServicecontext - DSpace context objectSQLException - if database errorpublic List<Community> findAll(Context context, Integer limit, Integer offset) throws SQLException
CommunityServicefindAll in interface CommunityServicecontext - contextlimit - limitoffset - offsetSQLException - if database errorpublic List<Community> findAllTop(Context context) throws SQLException
CommunityServicefindAllTop in interface CommunityServicecontext - DSpace context objectSQLException - if database errorpublic String getMetadata(Community community, String field)
DSpaceObjectServicegetMetadata in interface CommunityServicegetMetadata in interface DSpaceObjectService<Community>getMetadata in class DSpaceObjectServiceImpl<Community>community - DSpaceObjectfield - the name of the metadata field to getpublic void setMetadata(Context context, Community community, String field, String value) throws MissingResourceException, SQLException
CommunityServicesetMetadata in interface CommunityServicecontext - contextcommunity - communityfield - the name of the metadata field to getvalue - value to set the field toMissingResourceExceptionSQLException - if database errorpublic Bitstream setLogo(Context context, Community community, InputStream is) throws AuthorizeException, IOException, SQLException
CommunityServicenull removes any
existing logo. You will need to set the format of the new logo bitstream
before it will work, for example to "JPEG". Note that
update will need to be called for the change to take
effect. Setting a logo and not calling update later may
result in a previous logo lying around as an "orphaned" bitstream.setLogo in interface CommunityServicecontext - contextcommunity - communityis - the stream to use as the new logonull if there is no
logo (null was passed in)AuthorizeException - if authorization errorIOException - if IO errorSQLException - if database errorpublic void update(Context context, Community community) throws SQLException, AuthorizeException
update in interface DSpaceObjectService<Community>update in class DSpaceObjectServiceImpl<Community>SQLExceptionAuthorizeExceptionpublic Group createAdministrators(Context context, Community community) throws SQLException, AuthorizeException
CommunityServicecreateAdministrators in interface CommunityServicecontext - contextcommunity - communitySQLException - if database errorAuthorizeException - if authorization errorpublic void removeAdministrators(Context context, Community community) throws SQLException, AuthorizeException
CommunityServiceremoveAdministrators in interface CommunityServicecontext - contextcommunity - communitySQLException - if database errorAuthorizeException - if authorization errorpublic List<Community> getAllParents(Context context, Community community) throws SQLException
CommunityServicegetAllParents in interface CommunityServicecontext - contextcommunity - communitySQLException - if database errorpublic List<Community> getAllParents(Context context, Collection collection) throws SQLException
CommunityServicegetAllParents in interface CommunityServiceSQLExceptionpublic List<Collection> getAllCollections(Context context, Community community) throws SQLException
CommunityServicegetAllCollections in interface CommunityServicecontext - contextcommunity - communitySQLException - if database errorprotected void addCollectionList(Community community, List<Collection> collectionList) throws SQLException
community - communitycollectionList - list of collectionsSQLException - if database errorpublic void addCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException
CommunityServiceaddCollection in interface CommunityServicecontext - contextcommunity - communitycollection - collection to addSQLException - if database errorAuthorizeException - if authorization errorpublic Community createSubcommunity(Context context, Community parentCommunity) throws SQLException, AuthorizeException
CommunityServicecreateSubcommunity in interface CommunityServicecontext - contextparentCommunity - parent communitySQLException - if database errorAuthorizeException - if authorization errorpublic Community createSubcommunity(Context context, Community parentCommunity, String handle) throws SQLException, AuthorizeException
CommunityServicecreateSubcommunity in interface CommunityServicecontext - contextparentCommunity - parent communityhandle - the pre-determined Handle to assign to the new communitySQLException - if database errorAuthorizeException - if authorization errorpublic void addSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException
CommunityServiceaddSubcommunity in interface CommunityServicecontext - contextparentCommunity - parent community to add our subcommunity tochildCommunity - subcommunity to addSQLException - if database errorAuthorizeException - if authorization errorpublic void removeCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException, IOException
CommunityServiceremoveCollection in interface CommunityServicecontext - contextcommunity - communitycollection - collection to removeSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void removeSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException, IOException
CommunityServiceremoveSubcommunity in interface CommunityServicecontext - contextparentCommunity - parent communitychildCommunity - subcommunity to removeSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void delete(Context context, Community community) throws SQLException, AuthorizeException, IOException
delete in interface DSpaceObjectService<Community>SQLExceptionAuthorizeExceptionIOExceptionpublic int getSupportsTypeConstant()
DSpaceObjectServicegetSupportsTypeConstant in interface DSpaceObjectLegacySupportService<Community>getSupportsTypeConstant in interface DSpaceObjectService<Community>protected void rawDelete(Context context, Community community) throws SQLException, AuthorizeException, IOException
context - contextcommunity - communitySQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic boolean canEditBoolean(Context context, Community community) throws SQLException
CommunityServicecanEditBoolean in interface CommunityServicecontext - contextcommunity - communitySQLException - if database errorpublic void canEdit(Context context, Community community) throws AuthorizeException, SQLException
canEdit in interface CommunityServiceAuthorizeExceptionSQLExceptionpublic Community findByAdminGroup(Context context, Group group) throws SQLException
findByAdminGroup in interface CommunityServiceSQLExceptionpublic List<Community> findAuthorized(Context context, List<Integer> actions) throws SQLException
findAuthorized in interface CommunityServiceSQLExceptionpublic List<Community> findAuthorizedGroupMapped(Context context, List<Integer> actions) throws SQLException
findAuthorizedGroupMapped in interface CommunityServiceSQLExceptionpublic DSpaceObject getAdminObject(Context context, Community community, int action) throws SQLException
DSpaceObjectServiceDefault behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
getAdminObject in interface DSpaceObjectService<Community>getAdminObject in class DSpaceObjectServiceImpl<Community>context - DSpace contextcommunity - DSpaceObjectaction - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrownSQLException - if database errorpublic DSpaceObject getParentObject(Context context, Community community) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Community>getParentObject in class DSpaceObjectServiceImpl<Community>context - DSpace contextcommunity - DSpaceObjectSQLException - if database errorpublic void updateLastModified(Context context, Community community)
updateLastModified in interface DSpaceObjectService<Community>public Community findByIdOrLegacyId(Context context, String id) throws SQLException
findByIdOrLegacyId in interface DSpaceObjectLegacySupportService<Community>SQLExceptionpublic Community findByLegacyId(Context context, int id) throws SQLException
DSpaceObjectLegacySupportServicefindByLegacyId in interface DSpaceObjectLegacySupportService<Community>context - - the contextid - - the legacy id within table of type'd objectsSQLException - only upon failure accessing the database.public int countTotal(Context context) throws SQLException
countTotal in interface CommunityServiceSQLExceptionCopyright © 2016 DuraSpace. All rights reserved.