mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Make Packager restore item mappings to non-owning Collections
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5397 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -1034,6 +1034,22 @@ public class Item extends DSpaceObject
|
||||
modified = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* See whether this Item is contained by a given Collection.
|
||||
* @param collection
|
||||
* @return true if {@code collection} contains this Item.
|
||||
* @throws SQLException
|
||||
*/
|
||||
public boolean isIn(Collection collection) throws SQLException
|
||||
{
|
||||
TableRow tr = DatabaseManager.querySingle(ourContext,
|
||||
"SELECT COUNT(*) AS count" +
|
||||
" FROM collection2item" +
|
||||
" WHERE collection_id = ? AND item_id = ?",
|
||||
collection.getID(), itemRow.getIntColumn("item_id"));
|
||||
return tr.getLongColumn("count") > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the collections this item is in. The order is indeterminate.
|
||||
*
|
||||
|
Reference in New Issue
Block a user