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 exisiting 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,
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, clearMetadata, deleteMetadata, 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, 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 CommunityServicecontext - DSpace context objectSQLExceptionAuthorizeExceptionpublic Community create(Community parent, Context context, String handle) throws SQLException, AuthorizeException
CommunityServicecreate in interface CommunityServicecontext - DSpace context objecthandle - the pre-determined Handle to assign to the new communitySQLExceptionAuthorizeExceptionpublic 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 objectSQLExceptionpublic List<Community> findAll(Context context, Integer limit, Integer offset) throws SQLException
CommunityServicefindAll in interface CommunityServiceSQLExceptionpublic List<Community> findAllTop(Context context) throws SQLException
CommunityServicefindAllTop in interface CommunityServicecontext - DSpace context objectSQLExceptionpublic String getMetadata(Community community, String field)
DSpaceObjectServicegetMetadata in interface CommunityServicegetMetadata in interface DSpaceObjectService<Community>getMetadata in class DSpaceObjectServiceImpl<Community>field - the name of the metadata field to getpublic void setMetadata(Context context, Community community, String field, String value) throws MissingResourceException, SQLException
CommunityServicesetMetadata in interface CommunityServicefield - the name of the metadata field to getvalue - value to set the field toMissingResourceExceptionSQLExceptionpublic 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(/code> 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 CommunityServiceis - the stream to use as the new logonull if there is no
logo (null was passed in)AuthorizeExceptionIOExceptionSQLExceptionpublic 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 CommunityServiceSQLExceptionAuthorizeExceptionpublic void removeAdministrators(Context context, Community community) throws SQLException, AuthorizeException
CommunityServiceremoveAdministrators in interface CommunityServiceSQLExceptionAuthorizeExceptionpublic List<Community> getAllParents(Context context, Community community) throws SQLException
CommunityServicegetAllParents in interface CommunityServiceSQLExceptionpublic List<Collection> getAllCollections(Context context, Community community) throws SQLException
CommunityServicegetAllCollections in interface CommunityServiceSQLExceptionprotected void addCollectionList(Community community, List<Collection> collectionList) throws SQLException
SQLExceptionpublic void addCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException
CommunityServiceaddCollection in interface CommunityServicecollection - collection to addSQLExceptionAuthorizeExceptionpublic Community createSubcommunity(Context context, Community parentCommunity) throws SQLException, AuthorizeException
CommunityServicecreateSubcommunity in interface CommunityServiceSQLExceptionAuthorizeExceptionpublic Community createSubcommunity(Context context, Community parentCommunity, String handle) throws SQLException, AuthorizeException
CommunityServicecreateSubcommunity in interface CommunityServicehandle - the pre-determined Handle to assign to the new communitySQLExceptionAuthorizeExceptionpublic void addSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException
CommunityServiceaddSubcommunity in interface CommunityServiceparentCommunity - parent community to add our subcommunity tochildCommunity - subcommunity to addSQLExceptionAuthorizeExceptionpublic void removeCollection(Context context, Community community, Collection collection) throws SQLException, AuthorizeException, IOException
CommunityServiceremoveCollection in interface CommunityServicecollection - collection to removeSQLExceptionAuthorizeExceptionIOExceptionpublic void removeSubcommunity(Context context, Community parentCommunity, Community childCommunity) throws SQLException, AuthorizeException, IOException
CommunityServiceremoveSubcommunity in interface CommunityServicechildCommunity - subcommunity to removeSQLExceptionAuthorizeExceptionIOExceptionpublic 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
public boolean canEditBoolean(Context context, Community community) throws SQLException
CommunityServicecanEditBoolean in interface CommunityServiceSQLExceptionpublic 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>action - 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 thrownSQLExceptionpublic DSpaceObject getParentObject(Context context, Community community) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Community>getParentObject in class DSpaceObjectServiceImpl<Community>SQLExceptionpublic 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.