mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +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:
@@ -79,6 +79,9 @@ public interface BrowseCreateDAO
|
||||
* @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
|
||||
|
@@ -132,9 +132,9 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
||||
try
|
||||
{
|
||||
String createComView = "CREATE VIEW " + view + " AS " +
|
||||
"SELECT Community2Item.community_id, " + table + ".* " +
|
||||
"FROM " + table + ", Community2Item " +
|
||||
"WHERE " + table + ".item_id = Community2Item.item_id";
|
||||
"SELECT Communities2Item.community_id, " + table + ".* " +
|
||||
"FROM " + table + ", Communities2Item " +
|
||||
"WHERE " + table + ".item_id = Communities2Item.item_id";
|
||||
|
||||
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)
|
||||
* @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)
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
String createComView = "CREATE VIEW " + view + " as " +
|
||||
"SELECT Community2Item.community_id, " + table + ".* " +
|
||||
"FROM " + table + ", Community2Item " +
|
||||
"WHERE " + table + ".item_id = Community2Item.item_id;";
|
||||
"SELECT Communities2Item.community_id, " + table + ".* " +
|
||||
"FROM " + table + ", Communities2Item " +
|
||||
"WHERE " + table + ".item_id = Communities2Item.item_id;";
|
||||
|
||||
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)
|
||||
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
|
||||
*/
|
||||
@@ -496,7 +515,31 @@ 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)
|
||||
* @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 + ") ";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
BrowseIndex[] bis = getBrowseIndices();
|
||||
String[] returnTables = new String[bis.length + 1];
|
||||
String[] returnTables = new String[bis.length];
|
||||
for (int i = 0; i < bis.length; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -44,6 +44,7 @@ import org.dspace.content.Item;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BrowseItemDAOOracle implements BrowseItemDAO
|
||||
{
|
||||
@@ -87,61 +88,78 @@ public class BrowseItemDAOOracle implements BrowseItemDAO
|
||||
|
||||
public BrowseItem[] findAll() throws SQLException
|
||||
{
|
||||
TableRowIterator tri = DatabaseManager.query(context, findAll);
|
||||
ArrayList items = new ArrayList();
|
||||
TableRowIterator tri = null;
|
||||
List<BrowseItem> items = new ArrayList<BrowseItem>();
|
||||
|
||||
while (tri.hasNext())
|
||||
try
|
||||
{
|
||||
TableRow row = tri.next();
|
||||
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
|
||||
row.getBooleanColumn("in_archive"),
|
||||
row.getBooleanColumn("withdrawn")));
|
||||
tri = DatabaseManager.query(context, findAll);
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow row = tri.next();
|
||||
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
|
||||
row.getBooleanColumn("in_archive"),
|
||||
row.getBooleanColumn("withdrawn")));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
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)
|
||||
throws SQLException
|
||||
{
|
||||
ArrayList values = new ArrayList();
|
||||
TableRowIterator tri;
|
||||
List<DCValue> values = new ArrayList<DCValue>();
|
||||
TableRowIterator tri = null;
|
||||
|
||||
if (qualifier == null)
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataElement, params);
|
||||
}
|
||||
else if (Item.ANY.equals(qualifier))
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, qualifier, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadata, params);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (qualifier == null)
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataElement, params);
|
||||
}
|
||||
else if (Item.ANY.equals(qualifier))
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, qualifier, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadata, params);
|
||||
}
|
||||
|
||||
if (!tri.hasNext())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!tri.hasNext())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow tr = tri.next();
|
||||
DCValue dcv = new DCValue();
|
||||
dcv.schema = schema;
|
||||
dcv.element = tr.getStringColumn("element");
|
||||
dcv.qualifier = tr.getStringColumn("qualifier");
|
||||
dcv.language = tr.getStringColumn("text_lang");
|
||||
dcv.value = tr.getStringColumn("text_value");
|
||||
values.add(dcv);
|
||||
}
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow tr = tri.next();
|
||||
DCValue dcv = new DCValue();
|
||||
dcv.schema = schema;
|
||||
dcv.element = tr.getStringColumn("element");
|
||||
dcv.qualifier = tr.getStringColumn("qualifier");
|
||||
dcv.language = tr.getStringColumn("text_lang");
|
||||
dcv.value = tr.getStringColumn("text_value");
|
||||
values.add(dcv);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BrowseItemDAOPostgres implements BrowseItemDAO
|
||||
{
|
||||
@@ -87,61 +88,78 @@ public class BrowseItemDAOPostgres implements BrowseItemDAO
|
||||
|
||||
public BrowseItem[] findAll() throws SQLException
|
||||
{
|
||||
TableRowIterator tri = DatabaseManager.query(context, findAll);
|
||||
ArrayList items = new ArrayList();
|
||||
TableRowIterator tri = null;
|
||||
List<BrowseItem> items = new ArrayList<BrowseItem>();
|
||||
|
||||
while (tri.hasNext())
|
||||
try
|
||||
{
|
||||
TableRow row = tri.next();
|
||||
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
|
||||
row.getBooleanColumn("in_archive"),
|
||||
row.getBooleanColumn("withdrawn")));
|
||||
tri = DatabaseManager.query(context, findAll);
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow row = tri.next();
|
||||
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
|
||||
row.getBooleanColumn("in_archive"),
|
||||
row.getBooleanColumn("withdrawn")));
|
||||
}
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
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)
|
||||
throws SQLException
|
||||
{
|
||||
ArrayList values = new ArrayList();
|
||||
TableRowIterator tri;
|
||||
List<DCValue> values = new ArrayList<DCValue>();
|
||||
TableRowIterator tri = null;
|
||||
|
||||
if (qualifier == null)
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataElement, params);
|
||||
}
|
||||
else if (Item.ANY.equals(qualifier))
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, qualifier, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadata, params);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (qualifier == null)
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataElement, params);
|
||||
}
|
||||
else if (Item.ANY.equals(qualifier))
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object[] params = { new Integer(itemId), element, qualifier, schema };
|
||||
tri = DatabaseManager.query(context, getByMetadata, params);
|
||||
}
|
||||
|
||||
if (!tri.hasNext())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow tr = tri.next();
|
||||
DCValue dcv = new DCValue();
|
||||
dcv.schema = schema;
|
||||
dcv.element = tr.getStringColumn("element");
|
||||
dcv.qualifier = tr.getStringColumn("qualifier");
|
||||
dcv.language = tr.getStringColumn("text_lang");
|
||||
dcv.value = tr.getStringColumn("text_value");
|
||||
values.add(dcv);
|
||||
}
|
||||
if (!tri.hasNext())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
while (tri.hasNext())
|
||||
{
|
||||
TableRow tr = tri.next();
|
||||
DCValue dcv = new DCValue();
|
||||
dcv.schema = schema;
|
||||
dcv.element = tr.getStringColumn("element");
|
||||
dcv.qualifier = tr.getStringColumn("qualifier");
|
||||
dcv.language = tr.getStringColumn("text_lang");
|
||||
dcv.value = tr.getStringColumn("text_value");
|
||||
values.add(dcv);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tri != null)
|
||||
tri.close();
|
||||
}
|
||||
|
||||
DCValue[] dcvs = new DCValue[values.size()];
|
||||
return (DCValue[]) values.toArray(dcvs);
|
||||
return values.toArray(dcvs);
|
||||
}
|
||||
}
|
||||
|
@@ -102,8 +102,8 @@ public class IndexBrowse
|
||||
|
||||
/** the DAO for write operations on the database */
|
||||
private BrowseCreateDAO dao;
|
||||
|
||||
/** the outputter class */
|
||||
|
||||
/** the outputter class */
|
||||
private BrowseOutput output;
|
||||
|
||||
/**
|
||||
@@ -392,12 +392,14 @@ public class IndexBrowse
|
||||
// Remove from the item indexes (archive and withdrawn)
|
||||
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
||||
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
||||
dao.deleteCommunityMappings(item.getID());
|
||||
|
||||
// Index any archived item that isn't withdrawn
|
||||
if (item.isArchived() && !item.isWithdrawn())
|
||||
{
|
||||
Map<Integer, String> sortMap = getSortValues(item, itemMDMap);
|
||||
dao.insertIndex(BrowseIndex.getItemBrowseIndex().getTableName(), item.getID(), sortMap);
|
||||
dao.insertCommunityMappings(item.getID());
|
||||
}
|
||||
else if (item.isWithdrawn())
|
||||
{
|
||||
@@ -557,6 +559,7 @@ public class IndexBrowse
|
||||
// Remove from the item indexes (archive and withdrawn)
|
||||
removeIndex(item.getID(), BrowseIndex.getItemBrowseIndex().getTableName());
|
||||
removeIndex(item.getID(), BrowseIndex.getWithdrawnBrowseIndex().getTableName());
|
||||
dao.deleteCommunityMappings(item.getID());
|
||||
|
||||
// Ensure that we remove any invalid entries
|
||||
pruneIndexes();
|
||||
|
@@ -142,7 +142,7 @@ public class Harvest
|
||||
}
|
||||
else if (scope.getType() == Constants.COMMUNITY)
|
||||
{
|
||||
query += ", community2item";
|
||||
query += ", communities2item";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ public class Harvest
|
||||
}
|
||||
else if (scope.getType() == Constants.COMMUNITY)
|
||||
{
|
||||
query += " AND community2item.community_id= ? " +
|
||||
" AND community2item.item_id=handle.resource_id";
|
||||
query += " AND communities2item.community_id= ? " +
|
||||
" AND communities2item.item_id=handle.resource_id";
|
||||
parameters.add(new Integer(scope.getID()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user