mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
port pr 1862
This commit is contained in:
@@ -244,6 +244,12 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
|||||||
return itemDAO.findAllByCollection(context, collection);
|
return itemDAO.findAllByCollection(context, collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
||||||
|
throws SQLException {
|
||||||
|
return itemDAO.findAllByCollection(context, collection, limit, offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Date since)
|
public Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince(Context context, Date since)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
@@ -1161,6 +1167,12 @@ prevent the generation of resource policy entry values with null dspace_object a
|
|||||||
return itemDAO.countItems(context, collection, true, false);
|
return itemDAO.countItems(context, collection, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countAllItems(Context context, Collection collection) throws SQLException {
|
||||||
|
return itemDAO.countItems(context, collection, true, false) + itemDAO.countItems(context, collection,
|
||||||
|
false, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countItems(Context context, Community community) throws SQLException {
|
public int countItems(Context context, Community community) throws SQLException {
|
||||||
// First we need a list of all collections under this community in the hierarchy
|
// First we need a list of all collections under this community in the hierarchy
|
||||||
@@ -1170,6 +1182,16 @@ prevent the generation of resource policy entry values with null dspace_object a
|
|||||||
return itemDAO.countItems(context, collections, true, false);
|
return itemDAO.countItems(context, collections, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countAllItems(Context context, Community community) throws SQLException {
|
||||||
|
// First we need a list of all collections under this community in the hierarchy
|
||||||
|
List<Collection> collections = communityService.getAllCollections(context, community);
|
||||||
|
|
||||||
|
// Now, lets count unique items across that list of collections
|
||||||
|
return itemDAO.countItems(context, collections, true, false) + itemDAO.countItems(context, collections,
|
||||||
|
false, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values,
|
protected void getAuthoritiesAndConfidences(String fieldKey, Collection collection, List<String> values,
|
||||||
List<String> authorities, List<Integer> confidences, int i) {
|
List<String> authorities, List<Integer> confidences, int i) {
|
||||||
|
@@ -64,6 +64,9 @@ public interface ItemDAO extends DSpaceObjectLegacySupportDAO<Item> {
|
|||||||
|
|
||||||
public Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException;
|
public Iterator<Item> findAllByCollection(Context context, Collection collection) throws SQLException;
|
||||||
|
|
||||||
|
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count number of items in a given collection
|
* Count number of items in a given collection
|
||||||
*
|
*
|
||||||
|
@@ -247,6 +247,22 @@ public class ItemDAOImpl extends AbstractHibernateDSODAO<Item> implements ItemDA
|
|||||||
return iterate(query);
|
return iterate(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
||||||
|
throws SQLException {
|
||||||
|
Query query = createQuery(context, "select i from Item i join i.collections c WHERE :collection IN c");
|
||||||
|
query.setParameter("collection", collection);
|
||||||
|
|
||||||
|
if (offset != null) {
|
||||||
|
query.setFirstResult(offset);
|
||||||
|
}
|
||||||
|
if (limit != null) {
|
||||||
|
query.setMaxResults(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return iterate(query);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countItems(Context context, Collection collection, boolean includeArchived, boolean includeWithdrawn)
|
public int countItems(Context context, Collection collection, boolean includeArchived, boolean includeWithdrawn)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
@@ -123,7 +123,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the items in this collection. The order is indeterminate.
|
* Get all the archived items in this collection. The order is indeterminate.
|
||||||
*
|
*
|
||||||
* @param context DSpace context object
|
* @param context DSpace context object
|
||||||
* @param collection Collection (parent)
|
* @param collection Collection (parent)
|
||||||
@@ -133,7 +133,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
public Iterator<Item> findByCollection(Context context, Collection collection) throws SQLException;
|
public Iterator<Item> findByCollection(Context context, Collection collection) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the items in this collection. The order is indeterminate.
|
* Get all the archived items in this collection. The order is indeterminate.
|
||||||
*
|
*
|
||||||
* @param context DSpace context object
|
* @param context DSpace context object
|
||||||
* @param collection Collection (parent)
|
* @param collection Collection (parent)
|
||||||
@@ -145,6 +145,19 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
public Iterator<Item> findByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
public Iterator<Item> findByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the items (including private and withdrawn) in this collection. The order is indeterminate.
|
||||||
|
*
|
||||||
|
* @param context DSpace context object
|
||||||
|
* @param collection Collection (parent)
|
||||||
|
* @return an iterator over the items in the collection.
|
||||||
|
* @param limit limited number of items
|
||||||
|
* @param offset offset value
|
||||||
|
* @throws SQLException if database error
|
||||||
|
*/
|
||||||
|
public Iterator<Item> findAllByCollection(Context context, Collection collection, Integer limit, Integer offset)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Items installed or withdrawn, discoverable, and modified since a Date.
|
* Get all Items installed or withdrawn, discoverable, and modified since a Date.
|
||||||
*
|
*
|
||||||
@@ -157,7 +170,7 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the items in this collection. The order is indeterminate.
|
* Get all the items (including private and withdrawn) in this collection. The order is indeterminate.
|
||||||
*
|
*
|
||||||
* @param context DSpace context object
|
* @param context DSpace context object
|
||||||
* @param collection Collection (parent)
|
* @param collection Collection (parent)
|
||||||
@@ -539,6 +552,16 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
*/
|
*/
|
||||||
public int countItems(Context context, Collection collection) throws SQLException;
|
public int countItems(Context context, Collection collection) throws SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* counts all items in the given collection including withdrawn items
|
||||||
|
*
|
||||||
|
* @param context DSpace context object
|
||||||
|
* @param collection Collection
|
||||||
|
* @return total items
|
||||||
|
* @throws SQLException if database error
|
||||||
|
*/
|
||||||
|
public int countAllItems(Context context, Collection collection) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all Items modified since a Date.
|
* Find all Items modified since a Date.
|
||||||
*
|
*
|
||||||
@@ -560,6 +583,16 @@ public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLega
|
|||||||
*/
|
*/
|
||||||
public int countItems(Context context, Community community) throws SQLException;
|
public int countItems(Context context, Community community) throws SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* counts all items in the given community including withdrawn
|
||||||
|
*
|
||||||
|
* @param context DSpace context object
|
||||||
|
* @param community Community
|
||||||
|
* @return total items
|
||||||
|
* @throws SQLException if database error
|
||||||
|
*/
|
||||||
|
public int countAllItems(Context context, Community community) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* counts all items
|
* counts all items
|
||||||
*
|
*
|
||||||
|
@@ -120,7 +120,7 @@ public class FilteredCollection extends DSpaceObject {
|
|||||||
this.setNumberItemsProcessed(0);
|
this.setNumberItemsProcessed(0);
|
||||||
if (itemFilters.size() > 0) {
|
if (itemFilters.size() > 0) {
|
||||||
Iterator<org.dspace.content.Item> childItems = itemService
|
Iterator<org.dspace.content.Item> childItems = itemService
|
||||||
.findByCollection(context, collection, limit, offset);
|
.findAllByCollection(context, collection, limit, offset);
|
||||||
int numProc = itemFilterSet
|
int numProc = itemFilterSet
|
||||||
.processSaveItems(context, servletContext, childItems, items, reportItems, expand);
|
.processSaveItems(context, servletContext, childItems, items, reportItems, expand);
|
||||||
this.setNumberItemsProcessed(numProc);
|
this.setNumberItemsProcessed(numProc);
|
||||||
@@ -129,7 +129,7 @@ public class FilteredCollection extends DSpaceObject {
|
|||||||
if (!expandFields.contains("all")) {
|
if (!expandFields.contains("all")) {
|
||||||
this.addExpand("all");
|
this.addExpand("all");
|
||||||
}
|
}
|
||||||
this.setNumberItems(itemService.countItems(context, collection));
|
this.setNumberItems(itemService.countAllItems(context, collection));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumberItems() {
|
public Integer getNumberItems() {
|
||||||
|
Reference in New Issue
Block a user