Package org.dspace.content.dao.impl
Class ItemDAOImpl
- All Implemented Interfaces:
DSpaceObjectDAO<Item>,DSpaceObjectLegacySupportDAO<Item>,ItemDAO,GenericDAO<Item>
Hibernate implementation of the Database Access Object interface class for the Item object.
This class is responsible for all database calls for the Item object and is autowired by spring
This class should never be accessed directly.
- Author:
- kevinvandevelde at atmire.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountArchivedByCollectionExcludingOwning(Context context, Collection collection) Counts all the items that are archived and for which the given Collection is part of the Item's Collections but it is not the owning CollectionlongcountForMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, String regexClause) intcountItems(Context context, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) Count number of items based on specific status flagsintcountItems(Context context, List<Collection> collections, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) Count number of unique items across several collections at once.intcountItems(Context context, Collection collection, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) Count number of items in a given collectionintcountItems(Context context, EPerson submitter, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) Count number of items from the specified submitter based on specific status flagsintCount total number of items (rows in item table)findAll(Context context, boolean archived, boolean withdrawn, boolean discoverable, Instant lastModified) Get all Items installed or withdrawn, discoverable, and modified since a Date.findAllByCollection(Context context, Collection collection) findAllByCollection(Context context, Collection collection, Integer limit, Integer offset) findAllRegularItems(Context context) Find all items that are: - NOT in the workspace - NOT in the workflow - NOT a template item for e.g. a collection This implies that the result also contains older versions of items and withdrawn items.findArchivedByCollection(Context context, Collection collection, Integer limit, Integer offset) findArchivedByCollectionExcludingOwning(Context context, Collection collection, Integer limit, Integer offset) Returns all the Items in an iterator that are archived and for which the given Collection is part of the Item's Collections but it is not the owning collectionfindByAuthorityValue(Context context, MetadataField metadataField, String authority, boolean inArchive) findByLastModifiedSince(Context context, Instant since) Find all Items modified since a Date.findByMetadataField(Context context, MetadataField metadataField, String value, boolean inArchive) findByMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, String regexClause, long offset, int limit) Returns all the Items that belong to the specified aollections (if any) and match the provided predicates.findBySubmitter(Context context, EPerson eperson) findBySubmitter(Context context, EPerson eperson, boolean retrieveAllItems) Find all the items by a given submitter.findBySubmitter(Context context, EPerson eperson, MetadataField metadataField, int limit) Methods inherited from class org.dspace.core.AbstractHibernateDSODAO
addMetadataLeftJoin, addMetadataSortQuery, addMetadataSortQuery, addMetadataValueWhereQuery, findByLegacyIdMethods inherited from class org.dspace.core.AbstractHibernateDAO
count, count, countLong, create, createQuery, createQuery, delete, executeCriteriaQuery, findAll, findAll, findByID, findByID, findByID, findByX, findMany, findMany, findUnique, getCriteriaBuilder, getCriteriaQuery, getHibernateSession, iterate, list, list, list, list, save, singleResult, singleResult, uniqueResult, uniqueResultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.content.dao.DSpaceObjectLegacySupportDAO
findByLegacyId
-
Constructor Details
-
ItemDAOImpl
protected ItemDAOImpl()
-
-
Method Details
-
findAll
- Specified by:
findAllin interfaceItemDAO- Throws:
SQLException
-
findAll
public Iterator<Item> findAll(Context context, boolean archived, int limit, int offset) throws SQLException - Specified by:
findAllin interfaceItemDAO- Throws:
SQLException
-
findAll
public Iterator<Item> findAll(Context context, boolean archived, boolean withdrawn) throws SQLException - Specified by:
findAllin interfaceItemDAO- Throws:
SQLException
-
findAllRegularItems
Description copied from interface:ItemDAOFind all items that are: - NOT in the workspace - NOT in the workflow - NOT a template item for e.g. a collection This implies that the result also contains older versions of items and withdrawn items.- Specified by:
findAllRegularItemsin interfaceItemDAO- Parameters:
context- the DSpace context.- Returns:
- iterator over all regular items.
- Throws:
SQLException- if database error.
-
findAll
public Iterator<Item> findAll(Context context, boolean archived, boolean withdrawn, boolean discoverable, Instant lastModified) throws SQLException Description copied from interface:ItemDAOGet all Items installed or withdrawn, discoverable, and modified since a Date.- Specified by:
findAllin interfaceItemDAO- Parameters:
context- contextarchived- whether to find archivedwithdrawn- whether to find withdrawndiscoverable- whether to find discoverablelastModified- earliest interesting last-modified date.- Returns:
- iterator over items
- Throws:
SQLException- if database error
-
findBySubmitter
- Specified by:
findBySubmitterin interfaceItemDAO- Throws:
SQLException
-
findBySubmitter
public Iterator<Item> findBySubmitter(Context context, EPerson eperson, boolean retrieveAllItems) throws SQLException Description copied from interface:ItemDAOFind all the items by a given submitter. The order is indeterminate. All items are included.- Specified by:
findBySubmitterin interfaceItemDAO- Parameters:
context- DSpace context objecteperson- the submitterretrieveAllItems- flag to determine if only archive should be returned- Returns:
- an iterator over the items submitted by eperson
- Throws:
SQLException- if database error
-
findBySubmitter
public Iterator<Item> findBySubmitter(Context context, EPerson eperson, MetadataField metadataField, int limit) throws SQLException - Specified by:
findBySubmitterin interfaceItemDAO- Throws:
SQLException
-
findByMetadataField
public Iterator<Item> findByMetadataField(Context context, MetadataField metadataField, String value, boolean inArchive) throws SQLException - Specified by:
findByMetadataFieldin interfaceItemDAO- Throws:
SQLException
-
findByMetadataQuery
public List<Item> findByMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, String regexClause, long offset, int limit) throws SQLException Description copied from interface:ItemDAOReturns all the Items that belong to the specified aollections (if any) and match the provided predicates.- Specified by:
findByMetadataQueryin interfaceItemDAO- Parameters:
context- The relevant DSpace contextqueryPredicates- List of predicates that returned items are required to matchcollectionUuids- UUIDs of the collections to search. If none are provided, the entire repository will be searched.regexClause- Syntactic expression used to query the database using a regular expression (e.g.: "value ~ ?")offset- The offset for the querylimit- Maximum number of items to return- Returns:
- A list containing the items that match the provided criteria
- Throws:
SQLException- if something goes wrong
-
countForMetadataQuery
public long countForMetadataQuery(Context context, List<QueryPredicate> queryPredicates, List<UUID> collectionUuids, String regexClause) throws SQLException - Specified by:
countForMetadataQueryin interfaceItemDAO- Throws:
SQLException
-
findByAuthorityValue
public Iterator<Item> findByAuthorityValue(Context context, MetadataField metadataField, String authority, boolean inArchive) throws SQLException - Specified by:
findByAuthorityValuein interfaceItemDAO- Throws:
SQLException
-
findArchivedByCollection
public Iterator<Item> findArchivedByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException - Specified by:
findArchivedByCollectionin interfaceItemDAO- Throws:
SQLException
-
findArchivedByCollectionExcludingOwning
public Iterator<Item> findArchivedByCollectionExcludingOwning(Context context, Collection collection, Integer limit, Integer offset) throws SQLException Description copied from interface:ItemDAOReturns all the Items in an iterator that are archived and for which the given Collection is part of the Item's Collections but it is not the owning collection- Specified by:
findArchivedByCollectionExcludingOwningin interfaceItemDAO- Parameters:
context- The relevant DSpace contextcollection- The collection to check onlimit- The limit for the queryoffset- The offset for the query- Returns:
- An iterator containing the items for which the constraints hold true
- Throws:
SQLException- If something goes wrong
-
countArchivedByCollectionExcludingOwning
public int countArchivedByCollectionExcludingOwning(Context context, Collection collection) throws SQLException Description copied from interface:ItemDAOCounts all the items that are archived and for which the given Collection is part of the Item's Collections but it is not the owning Collection- Specified by:
countArchivedByCollectionExcludingOwningin interfaceItemDAO- Parameters:
context- The relevant DSpace contextcollection- The collection to check on- Returns:
- The total amount of items that fit the constraints
- Throws:
SQLException- If something goes wrong
-
findAllByCollection
public Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException - Specified by:
findAllByCollectionin interfaceItemDAO- Throws:
SQLException
-
findAllByCollection
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset) throws SQLException - Specified by:
findAllByCollectionin interfaceItemDAO- Throws:
SQLException
-
countItems
public int countItems(Context context, Collection collection, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) throws SQLException Description copied from interface:ItemDAOCount number of items in a given collection- Specified by:
countItemsin interfaceItemDAO- Parameters:
context- contextcollection- the collectionincludeArchived- whether to include archived items in countincludeWithdrawn- whether to include withdrawn items in count- Returns:
- item count
- Throws:
SQLException- if database error
-
countItems
public int countItems(Context context, List<Collection> collections, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) throws SQLException Description copied from interface:ItemDAOCount number of unique items across several collections at once. This method can be used withCommunityService.getAllCollections(Context, Community)to determine the unique number of items in a Community.- Specified by:
countItemsin interfaceItemDAO- Parameters:
context- contextcollections- the list of collectionsincludeArchived- whether to include archived items in countincludeWithdrawn- whether to include withdrawn items in count- Returns:
- item count
- Throws:
SQLException- if database error
-
findByLastModifiedSince
Description copied from interface:ItemDAOFind all Items modified since a Date.- Specified by:
findByLastModifiedSincein interfaceItemDAO- Parameters:
context- Contextsince- Earliest interesting last-modified date.- Returns:
- iterator over items
- Throws:
SQLException- if database error
-
countRows
Description copied from interface:ItemDAOCount total number of items (rows in item table)- Specified by:
countRowsin interfaceItemDAO- Parameters:
context- context- Returns:
- total count
- Throws:
SQLException- if database error
-
countItems
public int countItems(Context context, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) throws SQLException Description copied from interface:ItemDAOCount number of items based on specific status flags- Specified by:
countItemsin interfaceItemDAO- Parameters:
context- contextincludeArchived- whether to include archived items in countincludeWithdrawn- whether to include withdrawn items in count- Returns:
- count of items
- Throws:
SQLException- if database error
-
countItems
public int countItems(Context context, EPerson submitter, boolean includeArchived, boolean includeWithdrawn, boolean discoverable) throws SQLException Description copied from interface:ItemDAOCount number of items from the specified submitter based on specific status flags- Specified by:
countItemsin interfaceItemDAO- Parameters:
context- contextsubmitter- the submitterincludeArchived- whether to include archived items in countincludeWithdrawn- whether to include withdrawn items in count- Returns:
- count of items
- Throws:
SQLException- if database error
-