mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
Fix to SF bug #1827521 - recent submissions not showing sub-community submissions.
- adds communities2item table maintenance back into browse, includes new SQL to query the community hierarchy more efficiently than the Item/Community API - by extension, fixes a problem where items in an upgraded database can't be deleted due to their existence in communities2item - also, changes Harvest to use communities2item instead of community2item, so RSS feeds will work on the same basis of recent submissions, and include the sub-community content git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2447 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -80,6 +80,9 @@ public interface BrowseCreateDAO
|
|||||||
*/
|
*/
|
||||||
public void deleteByItemID(String table, int itemID) throws BrowseException;
|
public void deleteByItemID(String table, int itemID) throws BrowseException;
|
||||||
|
|
||||||
|
public void deleteCommunityMappings(int itemID) throws BrowseException;
|
||||||
|
public void insertCommunityMappings(int itemID) throws BrowseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert an index record into the given table for the given item id. The Map should contain
|
* Insert an index record into the given table for the given item id. The Map should contain
|
||||||
* key value pairs representing the sort column integer representation and the normalised
|
* key value pairs representing the sort column integer representation and the normalised
|
||||||
|
@@ -132,9 +132,9 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
String createComView = "CREATE VIEW " + view + " AS " +
|
String createComView = "CREATE VIEW " + view + " AS " +
|
||||||
"SELECT Community2Item.community_id, " + table + ".* " +
|
"SELECT Communities2Item.community_id, " + table + ".* " +
|
||||||
"FROM " + table + ", Community2Item " +
|
"FROM " + table + ", Communities2Item " +
|
||||||
"WHERE " + table + ".item_id = Community2Item.item_id";
|
"WHERE " + table + ".item_id = Communities2Item.item_id";
|
||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
{
|
{
|
||||||
@@ -371,6 +371,25 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.dspace.browse.BrowseCreateDAO#deleteCommunityMappings(java.lang.String, int)
|
||||||
|
*/
|
||||||
|
public void deleteCommunityMappings(int itemID)
|
||||||
|
throws BrowseException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object[] params = { new Integer(itemID) };
|
||||||
|
String dquery = "DELETE FROM Communities2Item WHERE item_id = ?";
|
||||||
|
DatabaseManager.updateQuery(context, dquery, params);
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new BrowseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
|
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
|
||||||
*/
|
*/
|
||||||
@@ -495,6 +514,30 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.dspace.browse.BrowseCreateDAO#insertCommunityMappings(java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void insertCommunityMappings(int itemID) throws BrowseException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int[] commID = getAllCommunityIDs(itemID);
|
||||||
|
|
||||||
|
for (int i = 0; i < commID.length; i++)
|
||||||
|
{
|
||||||
|
TableRow row = DatabaseManager.create(context, "Communities2Item");
|
||||||
|
row.setColumn("item_id", itemID);
|
||||||
|
row.setColumn("community_id", commID[i]);
|
||||||
|
DatabaseManager.update(context, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new BrowseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseCreateDAO#insertDistinctRecord(java.lang.String, java.lang.String, java.lang.String)
|
* @see org.dspace.browse.BrowseCreateDAO#insertDistinctRecord(java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -751,4 +794,89 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* perform a database query to get all the communities that this item belongs to,
|
||||||
|
* including all mapped communities, and ancestors
|
||||||
|
*
|
||||||
|
* this is done here instead of using the Item api, because for reindexing we may
|
||||||
|
* not have Item objects, and in any case this is *much* faster
|
||||||
|
*
|
||||||
|
* @param itemId
|
||||||
|
* @return
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private int[] getAllCommunityIDs(int itemId) throws SQLException
|
||||||
|
{
|
||||||
|
List<Integer> commIdList = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.queryTable(context, "Community2Item",
|
||||||
|
"SELECT * FROM Community2Item WHERE item_id=?", itemId);
|
||||||
|
|
||||||
|
while (tri.hasNext())
|
||||||
|
{
|
||||||
|
TableRow row = tri.next();
|
||||||
|
int commId = row.getIntColumn("community_id");
|
||||||
|
commIdList.add(commId);
|
||||||
|
|
||||||
|
// Get the parent community, and continue to get all ancestors
|
||||||
|
Integer parentId = getParentCommunityID(commId);
|
||||||
|
while (parentId != null)
|
||||||
|
{
|
||||||
|
commIdList.add(parentId);
|
||||||
|
parentId = getParentCommunityID(parentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to iterate the array as toArray will produce an array Integers,
|
||||||
|
// not ints as we need.
|
||||||
|
int[] cIds = new int[commIdList.size()];
|
||||||
|
for (int i = 0; i < commIdList.size(); i++)
|
||||||
|
{
|
||||||
|
cIds[i] = commIdList.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the id of the parent community. Returns Integer, as null is used to
|
||||||
|
* signify that there are no parents (ie. top-level).
|
||||||
|
*
|
||||||
|
* @param commId
|
||||||
|
* @return
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private Integer getParentCommunityID(int commId) throws SQLException
|
||||||
|
{
|
||||||
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.queryTable(context, "Community2Community",
|
||||||
|
"SELECT * FROM Community2Community WHERE child_comm_id=?", commId);
|
||||||
|
|
||||||
|
if (tri.hasNext())
|
||||||
|
{
|
||||||
|
return tri.next().getIntColumn("parent_comm_id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -127,9 +127,9 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
String createComView = "CREATE VIEW " + view + " as " +
|
String createComView = "CREATE VIEW " + view + " as " +
|
||||||
"SELECT Community2Item.community_id, " + table + ".* " +
|
"SELECT Communities2Item.community_id, " + table + ".* " +
|
||||||
"FROM " + table + ", Community2Item " +
|
"FROM " + table + ", Communities2Item " +
|
||||||
"WHERE " + table + ".item_id = Community2Item.item_id;";
|
"WHERE " + table + ".item_id = Communities2Item.item_id;";
|
||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
{
|
{
|
||||||
@@ -375,6 +375,25 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.dspace.browse.BrowseCreateDAO#deleteCommunityMappings(java.lang.String, int)
|
||||||
|
*/
|
||||||
|
public void deleteCommunityMappings(int itemID)
|
||||||
|
throws BrowseException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object[] params = { new Integer(itemID) };
|
||||||
|
String dquery = "DELETE FROM Communities2Item WHERE item_id = ?";
|
||||||
|
DatabaseManager.updateQuery(context, dquery, params);
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new BrowseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
|
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
|
||||||
*/
|
*/
|
||||||
@@ -497,6 +516,30 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.dspace.browse.BrowseCreateDAO#insertCommunityMappings(java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void insertCommunityMappings(int itemID) throws BrowseException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int[] commID = getAllCommunityIDs(itemID);
|
||||||
|
|
||||||
|
for (int i = 0; i < commID.length; i++)
|
||||||
|
{
|
||||||
|
TableRow row = DatabaseManager.create(context, "Communities2Item");
|
||||||
|
row.setColumn("item_id", itemID);
|
||||||
|
row.setColumn("community_id", commID[i]);
|
||||||
|
DatabaseManager.update(context, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new BrowseException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseCreateDAO#insertDistinctRecord(java.lang.String, java.lang.String, java.lang.String)
|
* @see org.dspace.browse.BrowseCreateDAO#insertDistinctRecord(java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -704,4 +747,89 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
|
|
||||||
return " VARCHAR(" + size + ") ";
|
return " VARCHAR(" + size + ") ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* perform a database query to get all the communities that this item belongs to,
|
||||||
|
* including all mapped communities, and ancestors
|
||||||
|
*
|
||||||
|
* this is done here instead of using the Item api, because for reindexing we may
|
||||||
|
* not have Item objects, and in any case this is *much* faster
|
||||||
|
*
|
||||||
|
* @param itemId
|
||||||
|
* @return
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private int[] getAllCommunityIDs(int itemId) throws SQLException
|
||||||
|
{
|
||||||
|
List<Integer> commIdList = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.queryTable(context, "Community2Item",
|
||||||
|
"SELECT * FROM Community2Item WHERE item_id=?", itemId);
|
||||||
|
|
||||||
|
while (tri.hasNext())
|
||||||
|
{
|
||||||
|
TableRow row = tri.next();
|
||||||
|
int commId = row.getIntColumn("community_id");
|
||||||
|
commIdList.add(commId);
|
||||||
|
|
||||||
|
// Get the parent community, and continue to get all ancestors
|
||||||
|
Integer parentId = getParentCommunityID(commId);
|
||||||
|
while (parentId != null)
|
||||||
|
{
|
||||||
|
commIdList.add(parentId);
|
||||||
|
parentId = getParentCommunityID(parentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to iterate the array as toArray will produce an array Integers,
|
||||||
|
// not ints as we need.
|
||||||
|
int[] cIds = new int[commIdList.size()];
|
||||||
|
for (int i = 0; i < commIdList.size(); i++)
|
||||||
|
{
|
||||||
|
cIds[i] = commIdList.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the id of the parent community. Returns Integer, as null is used to
|
||||||
|
* signify that there are no parents (ie. top-level).
|
||||||
|
*
|
||||||
|
* @param commId
|
||||||
|
* @return
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private Integer getParentCommunityID(int commId) throws SQLException
|
||||||
|
{
|
||||||
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.queryTable(context, "Community2Community",
|
||||||
|
"SELECT * FROM Community2Community WHERE child_comm_id=?", commId);
|
||||||
|
|
||||||
|
if (tri.hasNext())
|
||||||
|
{
|
||||||
|
return tri.next().getIntColumn("parent_comm_id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -641,16 +641,12 @@ public class BrowseIndex
|
|||||||
throws BrowseException
|
throws BrowseException
|
||||||
{
|
{
|
||||||
BrowseIndex[] bis = getBrowseIndices();
|
BrowseIndex[] bis = getBrowseIndices();
|
||||||
String[] returnTables = new String[bis.length + 1];
|
String[] returnTables = new String[bis.length];
|
||||||
for (int i = 0; i < bis.length; i++)
|
for (int i = 0; i < bis.length; i++)
|
||||||
{
|
{
|
||||||
returnTables[i] = bis[i].getTableName();
|
returnTables[i] = bis[i].getTableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this complies with the old BrowseTables method, but I'm
|
|
||||||
// not really sure why it's here
|
|
||||||
returnTables[bis.length] = "Communities2Item";
|
|
||||||
|
|
||||||
return returnTables;
|
return returnTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,7 @@ import org.dspace.content.Item;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BrowseItemDAOOracle implements BrowseItemDAO
|
public class BrowseItemDAOOracle implements BrowseItemDAO
|
||||||
{
|
{
|
||||||
@@ -87,9 +88,12 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
|||||||
|
|
||||||
public BrowseItem[] findAll() throws SQLException
|
public BrowseItem[] findAll() throws SQLException
|
||||||
{
|
{
|
||||||
TableRowIterator tri = DatabaseManager.query(context, findAll);
|
TableRowIterator tri = null;
|
||||||
ArrayList items = new ArrayList();
|
List<BrowseItem> items = new ArrayList<BrowseItem>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.query(context, findAll);
|
||||||
while (tri.hasNext())
|
while (tri.hasNext())
|
||||||
{
|
{
|
||||||
TableRow row = tri.next();
|
TableRow row = tri.next();
|
||||||
@@ -97,17 +101,25 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
|||||||
row.getBooleanColumn("in_archive"),
|
row.getBooleanColumn("in_archive"),
|
||||||
row.getBooleanColumn("withdrawn")));
|
row.getBooleanColumn("withdrawn")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
BrowseItem[] bis = new BrowseItem[items.size()];
|
BrowseItem[] bis = new BrowseItem[items.size()];
|
||||||
return (BrowseItem[]) items.toArray((BrowseItem[]) bis);
|
return items.toArray(bis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
|
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
ArrayList values = new ArrayList();
|
List<DCValue> values = new ArrayList<DCValue>();
|
||||||
TableRowIterator tri;
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (qualifier == null)
|
if (qualifier == null)
|
||||||
{
|
{
|
||||||
Object[] params = { new Integer(itemId), element, schema };
|
Object[] params = { new Integer(itemId), element, schema };
|
||||||
@@ -140,8 +152,14 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
|||||||
dcv.value = tr.getStringColumn("text_value");
|
dcv.value = tr.getStringColumn("text_value");
|
||||||
values.add(dcv);
|
values.add(dcv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
DCValue[] dcvs = new DCValue[values.size()];
|
DCValue[] dcvs = new DCValue[values.size()];
|
||||||
return (DCValue[]) values.toArray(dcvs);
|
return values.toArray(dcvs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ import org.dspace.content.Item;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BrowseItemDAOPostgres implements BrowseItemDAO
|
public class BrowseItemDAOPostgres implements BrowseItemDAO
|
||||||
{
|
{
|
||||||
@@ -87,9 +88,12 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
|||||||
|
|
||||||
public BrowseItem[] findAll() throws SQLException
|
public BrowseItem[] findAll() throws SQLException
|
||||||
{
|
{
|
||||||
TableRowIterator tri = DatabaseManager.query(context, findAll);
|
TableRowIterator tri = null;
|
||||||
ArrayList items = new ArrayList();
|
List<BrowseItem> items = new ArrayList<BrowseItem>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tri = DatabaseManager.query(context, findAll);
|
||||||
while (tri.hasNext())
|
while (tri.hasNext())
|
||||||
{
|
{
|
||||||
TableRow row = tri.next();
|
TableRow row = tri.next();
|
||||||
@@ -97,17 +101,25 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
|||||||
row.getBooleanColumn("in_archive"),
|
row.getBooleanColumn("in_archive"),
|
||||||
row.getBooleanColumn("withdrawn")));
|
row.getBooleanColumn("withdrawn")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
BrowseItem[] bis = new BrowseItem[items.size()];
|
BrowseItem[] bis = new BrowseItem[items.size()];
|
||||||
return (BrowseItem[]) items.toArray((BrowseItem[]) bis);
|
return items.toArray(bis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
|
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
ArrayList values = new ArrayList();
|
List<DCValue> values = new ArrayList<DCValue>();
|
||||||
TableRowIterator tri;
|
TableRowIterator tri = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (qualifier == null)
|
if (qualifier == null)
|
||||||
{
|
{
|
||||||
Object[] params = { new Integer(itemId), element, schema };
|
Object[] params = { new Integer(itemId), element, schema };
|
||||||
@@ -140,8 +152,14 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
|||||||
dcv.value = tr.getStringColumn("text_value");
|
dcv.value = tr.getStringColumn("text_value");
|
||||||
values.add(dcv);
|
values.add(dcv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tri != null)
|
||||||
|
tri.close();
|
||||||
|
}
|
||||||
|
|
||||||
DCValue[] dcvs = new DCValue[values.size()];
|
DCValue[] dcvs = new DCValue[values.size()];
|
||||||
return (DCValue[]) values.toArray(dcvs);
|
return values.toArray(dcvs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -392,12 +392,14 @@ public class IndexBrowse
|
|||||||
// Remove from the item indexes (archive and withdrawn)
|
// Remove from the item indexes (archive and withdrawn)
|
||||||
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
||||||
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
||||||
|
dao.deleteCommunityMappings(item.getID());
|
||||||
|
|
||||||
// Index any archived item that isn't withdrawn
|
// Index any archived item that isn't withdrawn
|
||||||
if (item.isArchived() && !item.isWithdrawn())
|
if (item.isArchived() && !item.isWithdrawn())
|
||||||
{
|
{
|
||||||
Map<Integer, String> sortMap = getSortValues(item, itemMDMap);
|
Map<Integer, String> sortMap = getSortValues(item, itemMDMap);
|
||||||
dao.insertIndex(BrowseIndex.getItemBrowseIndex().getTableName(), item.getID(), sortMap);
|
dao.insertIndex(BrowseIndex.getItemBrowseIndex().getTableName(), item.getID(), sortMap);
|
||||||
|
dao.insertCommunityMappings(item.getID());
|
||||||
}
|
}
|
||||||
else if (item.isWithdrawn())
|
else if (item.isWithdrawn())
|
||||||
{
|
{
|
||||||
@@ -557,6 +559,7 @@ public class IndexBrowse
|
|||||||
// Remove from the item indexes (archive and withdrawn)
|
// Remove from the item indexes (archive and withdrawn)
|
||||||
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
||||||
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
||||||
|
dao.deleteCommunityMappings(item.getID());
|
||||||
|
|
||||||
// Ensure that we remove any invalid entries
|
// Ensure that we remove any invalid entries
|
||||||
pruneIndexes();
|
pruneIndexes();
|
||||||
|
@@ -142,7 +142,7 @@ public class Harvest
|
|||||||
}
|
}
|
||||||
else if (scope.getType() == Constants.COMMUNITY)
|
else if (scope.getType() == Constants.COMMUNITY)
|
||||||
{
|
{
|
||||||
query += ", community2item";
|
query += ", communities2item";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +158,8 @@ public class Harvest
|
|||||||
}
|
}
|
||||||
else if (scope.getType() == Constants.COMMUNITY)
|
else if (scope.getType() == Constants.COMMUNITY)
|
||||||
{
|
{
|
||||||
query += " AND community2item.community_id= ? " +
|
query += " AND communities2item.community_id= ? " +
|
||||||
" AND community2item.item_id=handle.resource_id";
|
" AND communities2item.item_id=handle.resource_id";
|
||||||
parameters.add(new Integer(scope.getID()));
|
parameters.add(new Integer(scope.getID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user