mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 12:03:09 +00:00
DS-2180 Fix findBySubmitterDateSorted to work in metadata4all
This commit is contained in:
@@ -254,23 +254,14 @@ public class Item extends DSpaceObject
|
||||
*/
|
||||
public static ItemIterator findBySubmitterDateSorted(Context context, EPerson eperson, Integer limit) throws SQLException
|
||||
{
|
||||
String querySorted = "SELECT \n" +
|
||||
" item.item_id, \n" +
|
||||
" item.submitter_id, \n" +
|
||||
" item.in_archive, \n" +
|
||||
" item.withdrawn, \n" +
|
||||
" item.owning_collection, \n" +
|
||||
" item.last_modified, \n" +
|
||||
" metadatavalue.text_value\n" +
|
||||
"FROM \n" +
|
||||
" public.item, \n" +
|
||||
" public.metadatafieldregistry, \n" +
|
||||
" public.metadatavalue\n" +
|
||||
"WHERE \n" +
|
||||
" metadatafieldregistry.metadata_field_id = metadatavalue.metadata_field_id AND\n" +
|
||||
" metadatavalue.item_id = item.item_id AND\n" +
|
||||
" metadatafieldregistry.element = 'date' AND \n" +
|
||||
" metadatafieldregistry.qualifier = 'accessioned' AND \n" +
|
||||
String querySorted = "SELECT item.item_id, item.submitter_id, item.in_archive, item.withdrawn, " +
|
||||
"item.owning_collection, item.last_modified, metadatavalue.text_value " +
|
||||
"FROM item, metadatafieldregistry, metadatavalue " +
|
||||
"WHERE metadatafieldregistry.metadata_field_id = metadatavalue.metadata_field_id AND " +
|
||||
" metadatavalue.resource_id = item.item_id AND " +
|
||||
" metadatavalue.resource_type_id = ? AND " +
|
||||
" metadatafieldregistry.element = 'date' AND " +
|
||||
" metadatafieldregistry.qualifier = 'accessioned' AND " +
|
||||
" item.submitter_id = ? AND \n" +
|
||||
" item.in_archive = true\n" +
|
||||
"ORDER BY\n" +
|
||||
@@ -280,10 +271,10 @@ public class Item extends DSpaceObject
|
||||
|
||||
if(limit != null && limit > 0) {
|
||||
querySorted += " limit ? ;";
|
||||
rows = DatabaseManager.query(context, querySorted, eperson.getID(), limit);
|
||||
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID(), limit);
|
||||
} else {
|
||||
querySorted += ";";
|
||||
rows = DatabaseManager.query(context, querySorted, eperson.getID());
|
||||
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID());
|
||||
}
|
||||
|
||||
return new ItemIterator(context, rows);
|
||||
|
Reference in New Issue
Block a user