Package org.dspace.content
Class CollectionServiceImpl
- java.lang.Object
-
- org.dspace.content.DSpaceObjectServiceImpl<Collection>
-
- org.dspace.content.CollectionServiceImpl
-
- All Implemented Interfaces:
CollectionService,DSpaceObjectLegacySupportService<Collection>,DSpaceObjectService<Collection>
public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService
Service implementation for the Collection object. This class is responsible for all business logic calls for the Collection object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected BitstreamServicebitstreamServiceprotected CollectionDAOcollectionDAOprotected CollectionRoleServicecollectionRoleServiceprotected CommunityServicecommunityServiceprotected ConfigurationServiceconfigurationServiceprotected GroupServicegroupServiceprotected HarvestedCollectionServiceharvestedCollectionServiceprotected IdentifierServiceidentifierServiceprotected ItemServiceitemServiceprotected LicenseServicelicenseServiceprotected ResourcePolicyServiceresourcePolicyServiceprotected SearchServicesearchServiceprotected SubscribeServicesubscribeServiceprotected XmlWorkflowFactoryworkflowFactoryprotected WorkspaceItemServiceworkspaceItemService-
Fields inherited from class org.dspace.content.DSpaceObjectServiceImpl
choiceAuthorityService, handleService, metadataAuthorityService, metadataFieldService, metadataValueService, relationshipService
-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCollectionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItem(Context context, Collection collection, Item item)Add an item to the collection.voidcanEdit(Context context, Collection collection)voidcanEdit(Context context, Collection collection, boolean useInheritance)booleancanEditBoolean(Context context, Collection collection)booleancanEditBoolean(Context context, Collection collection, boolean useInheritance)intcountCollectionsWithSubmit(String q, Context context, Community community)Counts the number of Collection for which the current user has 'submit' privileges.intcountCollectionsWithSubmit(String q, Context context, Community community, String entityType)Counts the number of Collection for which the current user has 'submit' privileges.intcountTotal(Context context)Collectioncreate(Context context, Community community)Create a new collection with a new ID.Collectioncreate(Context context, Community community, String handle)Create a new collection with the supplied handle and with a new ID.Collectioncreate(Context context, Community community, String handle, UUID uuid)Create a new collection with the supplied handle and ID.GroupcreateAdministrators(Context context, Collection collection)Create a default administrators group if one does not already exist.GroupcreateDefaultReadGroup(Context context, Collection collection, String typeOfGroupString, int defaultRead)This method will create a default read group for the given Collection.GroupcreateSubmitters(Context context, Collection collection)Create a default submitters group if one does not already exist.voidcreateTemplateItem(Context context, Collection collection)Create an empty template item for this collection.GroupcreateWorkflowGroup(Context context, Collection collection, int step)Create a workflow group for the given step if one does not already exist.voiddelete(Context context, Collection collection)Collectionfind(Context context, UUID id)Generic find for when the precise type of an Entity is not knownList<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)CollectionfindByGroup(Context context, Group group)CollectionfindByIdOrLegacyId(Context context, String id)CollectionfindByLegacyId(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>findCollectionsWithSubmit(String q, Context context, Community community, int offset, int limit)Returns Collections for which the current user has 'submit' privileges.List<Collection>findCollectionsWithSubmit(String q, Context context, Community community, String entityType, int offset, int limit)Returns Collections for which the current user has 'submit' privileges.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)DSpaceObjectgetAdminObject(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 valueStringgetDefaultReadGroupName(Collection collection, String typeOfGroupString)This method will return the name to give to the group created by theCollectionService.createDefaultReadGroup(Context, Collection, String, int)methodStringgetLicense(Collection collection)Get the license that users must grant before submitting to this collection.DSpaceObjectgetParentObject(Context context, Collection collection)Return the dspace object that "own" the current object in the hierarchy.intgetSupportsTypeConstant()Returns the Constants which this service supportsGroupgetWorkflowGroup(Context context, Collection collection, int step)Get the the workflow group corresponding to a particular workflow step.booleanhasCustomLicense(Collection collection)Find out if the collection has a custom licensevoidremoveAdministrators(Context context, Collection collection)Remove the administrators group, if no group has already been created then return without error.voidremoveItem(Context context, Collection collection, Item item)Remove an item.voidremoveSubmitters(Context context, Collection collection)Remove the submitters group, if no group has already been created then return without error.voidremoveTemplateItem(Context context, Collection collection)Remove the template item for this collection, if there is one.BitstreamsetLogo(Context context, Collection collection, InputStream is)Give the collection a logo.voidsetMetadataSingleValue(Context context, Collection collection, MetadataFieldName field, String language, String value)Set first metadata field valuevoidsetWorkflowGroup(Context context, Collection collection, int step, Group group)Set the workflow group corresponding to a particular workflow step.voidupdate(Context context, Collection collection)voidupdateLastModified(Context context, Collection collection)-
Methods inherited from class org.dspace.content.DSpaceObjectServiceImpl
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getAuthoritiesAndConfidences, getElements, getElementsFilled, getIdentifiers, getMDValueByField, getMDValueByLegacyField, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getMetadataValuePlace, getName, getTypeText, match, moveMetadata, moveSingleMetadataValue, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue
-
-
-
-
Field Detail
-
collectionDAO
@Autowired(required=true) protected CollectionDAO collectionDAO
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
resourcePolicyService
@Autowired(required=true) protected ResourcePolicyService resourcePolicyService
-
bitstreamService
@Autowired(required=true) protected BitstreamService bitstreamService
-
itemService
@Autowired(required=true) protected ItemService itemService
-
communityService
@Autowired(required=true) protected CommunityService communityService
-
groupService
@Autowired(required=true) protected GroupService groupService
-
identifierService
@Autowired(required=true) protected IdentifierService identifierService
-
licenseService
@Autowired(required=true) protected LicenseService licenseService
-
subscribeService
@Autowired(required=true) protected SubscribeService subscribeService
-
workspaceItemService
@Autowired(required=true) protected WorkspaceItemService workspaceItemService
-
harvestedCollectionService
@Autowired(required=true) protected HarvestedCollectionService harvestedCollectionService
-
workflowFactory
@Autowired(required=true) protected XmlWorkflowFactory workflowFactory
-
collectionRoleService
@Autowired(required=true) protected CollectionRoleService collectionRoleService
-
searchService
@Autowired(required=true) protected SearchService searchService
-
configurationService
@Autowired(required=true) protected ConfigurationService configurationService
-
-
Method Detail
-
create
public Collection create(Context context, Community community) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a new collection with a new ID. Once created the collection is added to the given community- Specified by:
createin interfaceCollectionService- Parameters:
context- DSpace context objectcommunity- DSpace Community (parent)- Returns:
- the newly created collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
public Collection create(Context context, Community community, String handle) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a new collection with the supplied handle and with a new ID. Once created the collection is added to the given community- Specified by:
createin interfaceCollectionService- Parameters:
context- DSpace context objectcommunity- DSpace Community (parent)handle- the pre-determined Handle to assign to the new community- Returns:
- the newly created collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
create
public Collection create(Context context, Community community, String handle, UUID uuid) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a new collection with the supplied handle and ID. Once created the collection is added to the given community- Specified by:
createin interfaceCollectionService- Parameters:
context- DSpace context objectcommunity- DSpace Community (parent)handle- the pre-determined Handle to assign to the new collectionuuid- the pre-determined UUID to assign to the new collection- Returns:
- the newly created collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
findAll
public List<Collection> findAll(Context context) throws SQLException
Description copied from interface:CollectionServiceGet all collections in the system. These are alphabetically sorted by collection name.- Specified by:
findAllin interfaceCollectionService- Parameters:
context- DSpace context object- Returns:
- the collections in the system
- Throws:
SQLException- if database error
-
findAll
public List<Collection> findAll(Context context, Integer limit, Integer offset) throws SQLException
Description copied from interface:CollectionServiceGet all collections in the system. Adds support for limit and offset.- Specified by:
findAllin interfaceCollectionService- Parameters:
context- The relevant DSpace Context.limit- paging limitoffset- paging offset- Returns:
- List of Collections
- Throws:
SQLException- if database error
-
findAuthorizedOptimized
public List<Collection> findAuthorizedOptimized(Context context, int actionID) throws SQLException
- Specified by:
findAuthorizedOptimizedin interfaceCollectionService- Throws:
SQLException
-
findDirectMapped
public List<Collection> findDirectMapped(Context context, int actionID) throws SQLException
- Specified by:
findDirectMappedin interfaceCollectionService- Throws:
SQLException
-
findGroup2CommunityMapped
public List<Collection> findGroup2CommunityMapped(Context context) throws SQLException
- Specified by:
findGroup2CommunityMappedin interfaceCollectionService- Throws:
SQLException
-
findGroup2GroupMapped
public List<Collection> findGroup2GroupMapped(Context context, int actionID) throws SQLException
- Specified by:
findGroup2GroupMappedin interfaceCollectionService- Throws:
SQLException
-
findGroupMapped
public List<Collection> findGroupMapped(Context context, int actionID) throws SQLException
- Specified by:
findGroupMappedin interfaceCollectionService- Throws:
SQLException
-
find
public Collection find(Context context, UUID id) throws SQLException
Description copied from interface:DSpaceObjectServiceGeneric find for when the precise type of an Entity is not known- Specified by:
findin interfaceDSpaceObjectService<Collection>- Parameters:
context- - the contextid- - uuid within table of typed dspace objects- Returns:
- the dspace object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
setMetadataSingleValue
public void setMetadataSingleValue(Context context, Collection collection, MetadataFieldName field, String language, String value) throws MissingResourceException, SQLException
Description copied from interface:DSpaceObjectServiceSet first metadata field value- Specified by:
setMetadataSingleValuein interfaceDSpaceObjectService<Collection>- Overrides:
setMetadataSingleValuein classDSpaceObjectServiceImpl<Collection>- Parameters:
context- DSpace contextcollection- DSpaceObjectfield- {schema, element, qualifier} for the desired field.language- the ISO639 language code, optionally followed by an underscore and the ISO3166 country code.nullmeans only values with no language are removed, andItem.ANYmeans values with any country code or no country code are removed.value- metadata value- Throws:
SQLException- if database errorMissingResourceException
-
setLogo
public Bitstream setLogo(Context context, Collection collection, InputStream is) throws AuthorizeException, IOException, SQLException
Description copied from interface:CollectionServiceGive the collection 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.- Specified by:
setLogoin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionis- the stream to use as the new logo- Returns:
- the new logo bitstream, or
nullif there is no logo (nullwas passed in) - Throws:
AuthorizeException- if authorization errorIOException- if IO errorSQLException- if database error
-
createWorkflowGroup
public Group createWorkflowGroup(Context context, Collection collection, int step) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a workflow group for the given step if one does not already exist. Returns either the newly created group or the previously existing one. Note that while the new group is created in the database, the association between the group and the collection is not written untilupdateis called.- Specified by:
createWorkflowGroupin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionstep- the step (1-3) of the workflow to create or get the group for- Returns:
- the workflow group associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
setWorkflowGroup
public void setWorkflowGroup(Context context, Collection collection, int step, Group group) throws SQLException
Description copied from interface:CollectionServiceSet the workflow group corresponding to a particular workflow step.nullcan be passed in if there should be no associated group for that workflow step; any existing group is NOT deleted.- Specified by:
setWorkflowGroupin interfaceCollectionService- Parameters:
context- current DSpace session.collection- Collectionstep- the workflow step (1-3)group- the new workflow group, ornull- Throws:
SQLException- passed through.
-
getWorkflowGroup
public Group getWorkflowGroup(Context context, Collection collection, int step)
Description copied from interface:CollectionServiceGet the the workflow group corresponding to a particular workflow step. This returnsnullif there is no group associated with this collection for the given step.- Specified by:
getWorkflowGroupin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionstep- the workflow step (1-3)- Returns:
- the group of reviewers or
null
-
createSubmitters
public Group createSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate a default submitters 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 allowed to submit to this collection by the authorization system.- Specified by:
createSubmittersin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Returns:
- the default group of submitters associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeSubmitters
public void removeSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceRemove the submitters group, if no group has already been created then return without error. This will merely dereference the current submitters group from the collection so that it may be deleted without violating database constraints.- Specified by:
removeSubmittersin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
createAdministrators
public Group createAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate 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.- Specified by:
createAdministratorsin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Returns:
- the default group of editors associated with this collection
- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeAdministrators
public void removeAdministrators(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceRemove the administrators group, if no group has already been created then return without error. This will merely dereference the current administrators group from the collection so that it may be deleted without violating database constraints.- Specified by:
removeAdministratorsin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
getLicense
public String getLicense(Collection collection)
Description copied from interface:CollectionServiceGet the license that users must grant before submitting to this collection. If the collection does not have a specific license, the site-wide default is returned.- Specified by:
getLicensein interfaceCollectionService- Parameters:
collection- Collection- Returns:
- the license for this collection
-
hasCustomLicense
public boolean hasCustomLicense(Collection collection)
Description copied from interface:CollectionServiceFind out if the collection has a custom license- Specified by:
hasCustomLicensein interfaceCollectionService- Parameters:
collection- Collection- Returns:
trueif the collection has a custom license
-
createTemplateItem
public void createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceCreate an empty template item for this collection. If one already exists, no action is taken. Caution: Make sure you callupdateon the collection after doing this, or the item will have been created but the collection record will not refer to it.- Specified by:
createTemplateItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeTemplateItem
public void removeTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
Description copied from interface:CollectionServiceRemove the template item for this collection, if there is one. Note that since this has to remove the old template item ID from the collection record in the database, the collection record will be changed, including any other changes made; in other words, this method does anupdate.- Specified by:
removeTemplateItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collection- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
addItem
public void addItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceAdd an item to the collection. This simply adds a relationship between the item and the collection - it does nothing like set an issue date, remove a personal workspace item etc. This has instant effect;updateneed not be called.- Specified by:
addItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionitem- item to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-
removeItem
public void removeItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException, IOException
Description copied from interface:CollectionServiceRemove an item. If the item is then orphaned, it is deleted.- Specified by:
removeItemin interfaceCollectionService- Parameters:
context- DSpace Contextcollection- Collectionitem- item to remove- Throws:
SQLException- if database errorAuthorizeException- if authorization errorIOException- if IO error
-
update
public void update(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
updatein interfaceDSpaceObjectService<Collection>- Overrides:
updatein classDSpaceObjectServiceImpl<Collection>- Throws:
SQLExceptionAuthorizeException
-
canEditBoolean
public boolean canEditBoolean(Context context, Collection collection) throws SQLException
- Specified by:
canEditBooleanin interfaceCollectionService- Throws:
SQLException
-
canEditBoolean
public boolean canEditBoolean(Context context, Collection collection, boolean useInheritance) throws SQLException
- Specified by:
canEditBooleanin interfaceCollectionService- Throws:
SQLException
-
canEdit
public void canEdit(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
canEditin interfaceCollectionService- Throws:
SQLExceptionAuthorizeException
-
canEdit
public void canEdit(Context context, Collection collection, boolean useInheritance) throws SQLException, AuthorizeException
- Specified by:
canEditin interfaceCollectionService- Throws:
SQLExceptionAuthorizeException
-
delete
public void delete(Context context, Collection collection) throws SQLException, AuthorizeException, IOException
- Specified by:
deletein interfaceDSpaceObjectService<Collection>- Throws:
SQLExceptionAuthorizeExceptionIOException
-
getSupportsTypeConstant
public int getSupportsTypeConstant()
Description copied from interface:DSpaceObjectServiceReturns the Constants which this service supports- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectLegacySupportService<Collection>- Specified by:
getSupportsTypeConstantin interfaceDSpaceObjectService<Collection>- Returns:
- a org.dspace.core.Constants that represents a IndexableObject type
-
findAuthorized
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException
Description copied from interface:CollectionServicereturn 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.- Specified by:
findAuthorizedin interfaceCollectionService- Parameters:
context- DSpace Contextcommunity- (optional) restrict search to a community, else nullactionID- of the action- Returns:
- Collection [] of collections with matching permissions
- Throws:
SQLException- if database error
-
findByGroup
public Collection findByGroup(Context context, Group group) throws SQLException
- Specified by:
findByGroupin interfaceCollectionService- Parameters:
context- DSpace Contextgroup- EPerson Group- Returns:
- the collection, if any, that has the specified group as administrators or submitters
- Throws:
SQLException
-
findCollectionsWithSubscribers
public List<Collection> findCollectionsWithSubscribers(Context context) throws SQLException
- Specified by:
findCollectionsWithSubscribersin interfaceCollectionService- Throws:
SQLException
-
getAdminObject
public DSpaceObject getAdminObject(Context context, Collection collection, int action) throws SQLException
Description copied from interface:DSpaceObjectServiceReturn the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.
- Specified by:
getAdminObjectin interfaceDSpaceObjectService<Collection>- Overrides:
getAdminObjectin classDSpaceObjectServiceImpl<Collection>- Parameters:
context- DSpace contextcollection- DSpaceObjectaction- ID of action being attempted, fromorg.dspace.core.Constants. The ADMIN action is not a valid parameter for this method, an IllegalArgumentException should be thrown- Returns:
- the dspace object, if any, where an ADMIN action is sufficient to grant the original action
- Throws:
SQLException- if database error
-
getParentObject
public DSpaceObject getParentObject(Context context, Collection collection) throws SQLException
Description copied from interface:DSpaceObjectServiceReturn the dspace object that "own" the current object in the hierarchy. Note that this method has a meaning slightly different from the getAdminObject because it is independent of the action but it is in a way related to it. It defines the "first" dspace object OTHER then the current one, where allowed ADMIN actions imply allowed ADMIN actions on the object self.- Specified by:
getParentObjectin interfaceDSpaceObjectService<Collection>- Overrides:
getParentObjectin classDSpaceObjectServiceImpl<Collection>- Parameters:
context- DSpace contextcollection- DSpaceObject- Returns:
- the dspace object that "own" the current object in the hierarchy
- Throws:
SQLException- if database error
-
updateLastModified
public void updateLastModified(Context context, Collection collection) throws SQLException, AuthorizeException
- Specified by:
updateLastModifiedin interfaceDSpaceObjectService<Collection>- Throws:
SQLExceptionAuthorizeException
-
findByIdOrLegacyId
public Collection findByIdOrLegacyId(Context context, String id) throws SQLException
- Specified by:
findByIdOrLegacyIdin interfaceDSpaceObjectLegacySupportService<Collection>- Throws:
SQLException
-
findByLegacyId
public Collection findByLegacyId(Context context, int id) throws SQLException
Description copied from interface:DSpaceObjectLegacySupportServiceGeneric find for when the precise type of a DSO is not known, just the a pair of type number and database ID.- Specified by:
findByLegacyIdin interfaceDSpaceObjectLegacySupportService<Collection>- Parameters:
context- - the contextid- - the legacy id within table of type'd objects- Returns:
- the object found, or null if it does not exist.
- Throws:
SQLException- only upon failure accessing the database.
-
countTotal
public int countTotal(Context context) throws SQLException
- Specified by:
countTotalin interfaceCollectionService- Throws:
SQLException
-
getCollectionsWithBitstreamSizesTotal
public List<Map.Entry<Collection,Long>> getCollectionsWithBitstreamSizesTotal(Context context) throws SQLException
Description copied from interface:CollectionServiceThe map entry returned contains a collection as a key and sum of bitstream sizes in bytes as a value- Specified by:
getCollectionsWithBitstreamSizesTotalin interfaceCollectionService- Parameters:
context- DSpace Context- Returns:
- List of Collections and bitstream sizes map
- Throws:
SQLException- if database error
-
createDefaultReadGroup
public Group createDefaultReadGroup(Context context, Collection collection, String typeOfGroupString, int defaultRead) throws SQLException, AuthorizeException
Description copied from interface:CollectionServiceThis method will create a default read group for the given Collection. It'll create either a defaultItemRead or a defaultBitstreamRead group depending on the given parameters- Specified by:
createDefaultReadGroupin interfaceCollectionService- Parameters:
context- The relevant DSpace contextcollection- The collection for which it'll be createdtypeOfGroupString- The type of group to be made, item or bitstreamdefaultRead- The defaultRead int, item or bitstream- Returns:
- The created Group
- Throws:
SQLException- If something goes wrongAuthorizeException- If something goes wrong
-
getDefaultReadGroupName
public String getDefaultReadGroupName(Collection collection, String typeOfGroupString)
Description copied from interface:CollectionServiceThis method will return the name to give to the group created by theCollectionService.createDefaultReadGroup(Context, Collection, String, int)method- Specified by:
getDefaultReadGroupNamein interfaceCollectionService- Parameters:
collection- The DSpace collection to use in the name generationtypeOfGroupString- The type of group to use in the name generation- Returns:
- the name to give to the group that hold default read for the collection
-
findCollectionsWithSubmit
public List<Collection> findCollectionsWithSubmit(String q, Context context, Community community, int offset, int limit) throws SQLException, SearchServiceException
Description copied from interface:CollectionServiceReturns Collections for which the current user has 'submit' privileges. NOTE: for better performance, this method retrieves its results from an index (cache) and does not query the database directly. This means that results may be stale or outdated until https://github.com/DSpace/DSpace/issues/2853 is resolved"- Specified by:
findCollectionsWithSubmitin interfaceCollectionService- Parameters:
q- limit the returned collection to those with metadata values matching the query terms. The terms are used to make also a prefix query on SOLR so it can be used to implement an autosuggest feature over the collection namecontext- DSpace Contextcommunity- parent communityoffset- the position of the first result to returnlimit- paging limit- Returns:
- discovery search result objects
- Throws:
SQLException- if something goes wrongSearchServiceException- if search error
-
countCollectionsWithSubmit
public int countCollectionsWithSubmit(String q, Context context, Community community) throws SQLException, SearchServiceException
Description copied from interface:CollectionServiceCounts the number of Collection for which the current user has 'submit' privileges. NOTE: for better performance, this method retrieves its results from an index (cache) and does not query the database directly. This means that results may be stale or outdated until https://github.com/DSpace/DSpace/issues/2853 is resolved."- Specified by:
countCollectionsWithSubmitin interfaceCollectionService- Parameters:
q- limit the returned collection to those with metadata values matching the query terms. The terms are used to make also a prefix query on SOLR so it can be used to implement an autosuggest feature over the collection namecontext- DSpace Contextcommunity- parent community- Returns:
- total collections found
- Throws:
SQLException- if something goes wrongSearchServiceException- if search error
-
findCollectionsWithSubmit
public List<Collection> findCollectionsWithSubmit(String q, Context context, Community community, String entityType, int offset, int limit) throws SQLException, SearchServiceException
Description copied from interface:CollectionServiceReturns Collections for which the current user has 'submit' privileges. NOTE: for better performance, this method retrieves its results from an index (cache) and does not query the database directly. This means that results may be stale or outdated until https://github.com/DSpace/DSpace/issues/2853 is resolved"- Specified by:
findCollectionsWithSubmitin interfaceCollectionService- Parameters:
q- limit the returned collection to those with metadata values matching the query terms. The terms are used to make also a prefix query on SOLR so it can be used to implement an autosuggest feature over the collection namecontext- DSpace Contextcommunity- parent communityentityType- limit the returned collection to those related to given entity typeoffset- the position of the first result to returnlimit- paging limit- Returns:
- discovery search result objects
- Throws:
SQLException- if something goes wrongSearchServiceException- if search error
-
countCollectionsWithSubmit
public int countCollectionsWithSubmit(String q, Context context, Community community, String entityType) throws SQLException, SearchServiceException
Description copied from interface:CollectionServiceCounts the number of Collection for which the current user has 'submit' privileges. NOTE: for better performance, this method retrieves its results from an index (cache) and does not query the database directly. This means that results may be stale or outdated until https://github.com/DSpace/DSpace/issues/2853 is resolved."- Specified by:
countCollectionsWithSubmitin interfaceCollectionService- Parameters:
q- limit the returned collection to those with metadata values matching the query terms. The terms are used to make also a prefix query on SOLR so it can be used to implement an autosuggest feature over the collection namecontext- DSpace Contextcommunity- parent communityentityType- limit the returned collection to those related to given entity type- Returns:
- total collections found
- Throws:
SQLException- if something goes wrongSearchServiceException- if search error
-
-