public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected BitstreamService |
bitstreamService |
protected CollectionDAO |
collectionDAO |
protected CommunityService |
communityService |
protected GroupService |
groupService |
protected HarvestedCollectionService |
harvestedCollectionService |
protected ItemService |
itemService |
protected LicenseService |
licenseService |
protected ResourcePolicyService |
resourcePolicyService |
protected SubscribeService |
subscribeService |
protected WorkspaceItemService |
workspaceItemService |
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService| Modifier | Constructor and Description |
|---|---|
protected |
CollectionServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Context context,
Collection collection,
Item item)
Add an item to the collection.
|
void |
canEdit(Context context,
Collection collection) |
void |
canEdit(Context context,
Collection collection,
boolean useInheritance) |
boolean |
canEditBoolean(Context context,
Collection collection) |
boolean |
canEditBoolean(Context context,
Collection collection,
boolean useInheritance) |
int |
countTotal(Context context) |
Collection |
create(Context context,
Community community)
Create a new collection with a new ID.
|
Collection |
create(Context context,
Community community,
String handle)
Create a new collection with the supplied handle and with a new ID.
|
Group |
createAdministrators(Context context,
Collection collection)
Create a default administrators group if one does not already exist.
|
Group |
createSubmitters(Context context,
Collection collection)
Create a default submitters group if one does not already exist.
|
void |
createTemplateItem(Context context,
Collection collection)
Create an empty template item for this collection.
|
Group |
createWorkflowGroup(Context context,
Collection collection,
int step)
Create a workflow group for the given step if one does not already exist.
|
void |
delete(Context context,
Collection collection) |
Collection |
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<Collection> |
findAll(Context context)
Get all collections in the system.
|
List<Collection> |
findAll(Context context,
Integer limit,
Integer offset)
Get all collections in the system.
|
List<Collection> |
findAuthorized(Context context,
Community community,
int actionID)
return an array of collections that user has a given permission on
(useful for trimming 'select to collection' list) or figuring out which
collections a person is an editor for.
|
List<Collection> |
findAuthorizedOptimized(Context context,
int actionID) |
Collection |
findByGroup(Context context,
Group group) |
Collection |
findByIdOrLegacyId(Context context,
String id) |
Collection |
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.
|
List<Collection> |
findCollectionsWithSubscribers(Context context) |
List<Collection> |
findDirectMapped(Context context,
int actionID) |
List<Collection> |
findGroup2CommunityMapped(Context context) |
List<Collection> |
findGroup2GroupMapped(Context context,
int actionID) |
List<Collection> |
findGroupMapped(Context context,
int actionID) |
DSpaceObject |
getAdminObject(Context context,
Collection collection,
int action)
Return the dspace object where an ADMIN action right is sufficient to
grant the initial authorize check.
|
List<Map.Entry<Collection,Long>> |
getCollectionsWithBitstreamSizesTotal(Context context)
The map entry returned contains a collection as a key and sum of bitstream sizes in bytes as a value
|
String |
getLicense(Collection collection)
Get the license that users must grant before submitting to this
collection.
|
String |
getMetadata(Collection collection,
String field)
Deprecated.
|
DSpaceObject |
getParentObject(Context context,
Collection collection)
Return the dspace object that "own" the current object in the hierarchy.
|
int |
getSupportsTypeConstant()
Returns the Constants which this service supports
|
Group |
getWorkflowGroup(Collection collection,
int step)
Get the the workflow group corresponding to a particular workflow step.
|
boolean |
hasCustomLicense(Collection collection)
Find out if the collection has a custom license
|
void |
removeAdministrators(Context context,
Collection collection)
Remove the administrators group, if no group has already been created
then return without error.
|
void |
removeItem(Context context,
Collection collection,
Item item)
Remove an item.
|
void |
removeSubmitters(Context context,
Collection collection)
Remove the submitters group, if no group has already been created
then return without error.
|
void |
removeTemplateItem(Context context,
Collection collection)
Remove the template item for this collection, if there is one.
|
Bitstream |
setLogo(Context context,
Collection collection,
InputStream is)
Give the collection a logo.
|
void |
setMetadata(Context context,
Collection collection,
String field,
String value)
Set a metadata value
|
void |
setWorkflowGroup(Context context,
Collection collection,
int step,
Group group)
Set the workflow group corresponding to a particular workflow step.
|
void |
update(Context context,
Collection collection) |
void |
updateLastModified(Context context,
Collection collection) |
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 CollectionDAO collectionDAO
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
@Autowired(required=true) protected BitstreamService bitstreamService
@Autowired(required=true) protected ItemService itemService
@Autowired(required=true) protected CommunityService communityService
@Autowired(required=true) protected GroupService groupService
@Autowired(required=true) protected LicenseService licenseService
@Autowired(required=true) protected SubscribeService subscribeService
@Autowired(required=true) protected WorkspaceItemService workspaceItemService
@Autowired(required=true) protected HarvestedCollectionService harvestedCollectionService
public Collection create(Context context, Community community) throws SQLException, AuthorizeException
CollectionServicecreate in interface CollectionServicecontext - DSpace context objectcommunity - DSpace Community (parent)SQLException - if database errorAuthorizeException - if authorization errorpublic Collection create(Context context, Community community, String handle) throws SQLException, AuthorizeException
CollectionServicecreate in interface CollectionServicecontext - DSpace context objectcommunity - DSpace Community (parent)handle - the pre-determined Handle to assign to the new communitySQLException - if database errorAuthorizeException - if authorization errorpublic List<Collection> findAll(Context context) throws SQLException
CollectionServicefindAll in interface CollectionServicecontext - DSpace context objectSQLException - if database errorpublic List<Collection> findAll(Context context, Integer limit, Integer offset) throws SQLException
CollectionServicefindAll in interface CollectionServiceSQLException - if database errorpublic List<Collection> findAuthorizedOptimized(Context context, int actionID) throws SQLException
findAuthorizedOptimized in interface CollectionServiceSQLExceptionpublic List<Collection> findDirectMapped(Context context, int actionID) throws SQLException
findDirectMapped in interface CollectionServiceSQLExceptionpublic List<Collection> findGroup2CommunityMapped(Context context) throws SQLException
findGroup2CommunityMapped in interface CollectionServiceSQLExceptionpublic List<Collection> findGroup2GroupMapped(Context context, int actionID) throws SQLException
findGroup2GroupMapped in interface CollectionServiceSQLExceptionpublic List<Collection> findGroupMapped(Context context, int actionID) throws SQLException
findGroupMapped in interface CollectionServiceSQLExceptionpublic Collection find(Context context, UUID id) throws SQLException
DSpaceObjectServicefind in interface DSpaceObjectService<Collection>context - - the contextid - - id within table of type'd objectsSQLException - only upon failure accessing the database.public void setMetadata(Context context, Collection collection, String field, String value) throws MissingResourceException, SQLException
CollectionServicesetMetadata in interface CollectionServicecontext - DSpace Contextcollection - Collectionfield - the name of the metadata field to getvalue - value to set the field toMissingResourceException - if resource missingSQLException - if database errorpublic Bitstream setLogo(Context context, Collection collection, InputStream is) throws AuthorizeException, IOException, SQLException
CollectionServicenull 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 CollectionServicecontext - DSpace Contextcollection - Collectionis - 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 Group createWorkflowGroup(Context context, Collection collection, int step) throws SQLException, AuthorizeException
CollectionServiceupdate is called.createWorkflowGroup in interface CollectionServicecontext - DSpace Contextcollection - Collectionstep - the step (1-3) of the workflow to create or get the group forSQLException - if database errorAuthorizeException - if authorization errorpublic void setWorkflowGroup(Context context, Collection collection, int step, Group group) throws SQLException, AuthorizeException
CollectionServicenull can be passed in if there should be no associated
group for that workflow step; any existing group is NOT deleted.setWorkflowGroup in interface CollectionServicecollection - Collectionstep - the workflow step (1-3)group - the new workflow group, or nullSQLExceptionAuthorizeExceptionpublic Group getWorkflowGroup(Collection collection, int step)
CollectionServicenull if there is no group associated with
this collection for the given step.getWorkflowGroup in interface CollectionServicecollection - Collectionstep - the workflow step (1-3)null@Deprecated public String getMetadata(Collection collection, String field)
getMetadata in interface DSpaceObjectService<Collection>getMetadata in class DSpaceObjectServiceImpl<Collection>collection - field - the name of the metadata field to getIllegalArgumentException - if the requested metadata field doesn't existpublic Group createSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
CollectionServicecreateSubmitters in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorpublic void removeSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
CollectionServiceremoveSubmitters in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorpublic Group createAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
CollectionServicecreateAdministrators in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorpublic void removeAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
CollectionServiceremoveAdministrators in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorpublic String getLicense(Collection collection)
CollectionServicegetLicense in interface CollectionServicecollection - Collectionpublic boolean hasCustomLicense(Collection collection)
CollectionServicehasCustomLicense in interface CollectionServicecollection - Collectiontrue if the collection has a custom licensepublic void createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException
CollectionServiceupdate on
the collection after doing this, or the item will have been created but
the collection record will not refer to it.createTemplateItem in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorpublic void removeTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
CollectionServiceupdate.removeTemplateItem in interface CollectionServicecontext - DSpace Contextcollection - CollectionSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void addItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException
CollectionServiceupdate need not be called.addItem in interface CollectionServicecontext - DSpace Contextcollection - Collectionitem - item to addSQLException - if database errorAuthorizeException - if authorization errorpublic void removeItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException, IOException
CollectionServiceremoveItem in interface CollectionServicecontext - DSpace Contextcollection - Collectionitem - item to removeSQLException - if database errorAuthorizeException - if authorization errorIOException - if IO errorpublic void update(Context context, Collection collection) throws SQLException, AuthorizeException
update in interface DSpaceObjectService<Collection>update in class DSpaceObjectServiceImpl<Collection>SQLExceptionAuthorizeExceptionpublic boolean canEditBoolean(Context context, Collection collection) throws SQLException
canEditBoolean in interface CollectionServiceSQLExceptionpublic boolean canEditBoolean(Context context, Collection collection, boolean useInheritance) throws SQLException
canEditBoolean in interface CollectionServiceSQLExceptionpublic void canEdit(Context context, Collection collection) throws SQLException, AuthorizeException
canEdit in interface CollectionServiceSQLExceptionAuthorizeExceptionpublic void canEdit(Context context, Collection collection, boolean useInheritance) throws SQLException, AuthorizeException
canEdit in interface CollectionServiceSQLExceptionAuthorizeExceptionpublic void delete(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
delete in interface DSpaceObjectService<Collection>SQLExceptionAuthorizeExceptionIOExceptionpublic int getSupportsTypeConstant()
DSpaceObjectServicegetSupportsTypeConstant in interface DSpaceObjectLegacySupportService<Collection>getSupportsTypeConstant in interface DSpaceObjectService<Collection>public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException
CollectionServicefindAuthorized in interface CollectionServicecontext - DSpace Contextcommunity - (optional) restrict search to a community, else nullactionID - of the actionSQLException - if database errorpublic Collection findByGroup(Context context, Group group) throws SQLException
findByGroup in interface CollectionServiceSQLExceptionpublic List<Collection> findCollectionsWithSubscribers(Context context) throws SQLException
findCollectionsWithSubscribers in interface CollectionServiceSQLExceptionpublic DSpaceObject getAdminObject(Context context, Collection collection, 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<Collection>getAdminObject in class DSpaceObjectServiceImpl<Collection>context - DSpace contextcollection - 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, Collection collection) throws SQLException
DSpaceObjectServicegetParentObject in interface DSpaceObjectService<Collection>getParentObject in class DSpaceObjectServiceImpl<Collection>context - DSpace contextcollection - DSpaceObjectSQLException - if database errorpublic void updateLastModified(Context context, Collection collection) throws SQLException, AuthorizeException
updateLastModified in interface DSpaceObjectService<Collection>SQLExceptionAuthorizeExceptionpublic Collection findByIdOrLegacyId(Context context, String id) throws SQLException
findByIdOrLegacyId in interface DSpaceObjectLegacySupportService<Collection>SQLExceptionpublic Collection findByLegacyId(Context context, int id) throws SQLException
DSpaceObjectLegacySupportServicefindByLegacyId in interface DSpaceObjectLegacySupportService<Collection>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 CollectionServiceSQLExceptionpublic List<Map.Entry<Collection,Long>> getCollectionsWithBitstreamSizesTotal(Context context) throws SQLException
CollectionServicegetCollectionsWithBitstreamSizesTotal in interface CollectionServicecontext - DSpace ContextSQLException - if database errorCopyright © 2017 DuraSpace. All rights reserved.