mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Cleanup for loops and collections.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2164 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -84,7 +84,7 @@ public class BrowseConsumer implements Consumer
|
||||
private static Logger log = Logger.getLogger(BrowseConsumer.class);
|
||||
|
||||
// items to be updated in browse index
|
||||
private Set toUpdate = null;
|
||||
private Set<Item> toUpdate = null;
|
||||
|
||||
public void initialize()
|
||||
throws Exception
|
||||
@@ -97,7 +97,7 @@ public class BrowseConsumer implements Consumer
|
||||
{
|
||||
if(toUpdate == null)
|
||||
{
|
||||
toUpdate = new HashSet();
|
||||
toUpdate = new HashSet<Item>();
|
||||
}
|
||||
|
||||
DSpaceObject subj = event.getSubject(ctx);
|
||||
@@ -110,14 +110,14 @@ public class BrowseConsumer implements Consumer
|
||||
|
||||
// If an Item is created or modified..
|
||||
case Constants.ITEM:
|
||||
toUpdate.add(subj);
|
||||
toUpdate.add((Item)subj);
|
||||
break;
|
||||
// track ADD and REMOVE from collections, that changes browse index.
|
||||
case Constants.COLLECTION:
|
||||
if (event.getObjectType() == Constants.ITEM
|
||||
&& (et == Event.ADD || et == Event.REMOVE))
|
||||
{
|
||||
DSpaceObject obj = event.getObject(ctx);
|
||||
Item obj = (Item)event.getObject(ctx);
|
||||
if (obj != null)
|
||||
toUpdate.add(obj);
|
||||
}
|
||||
@@ -137,9 +137,8 @@ public class BrowseConsumer implements Consumer
|
||||
{
|
||||
|
||||
// Update/Add items
|
||||
for (Iterator ui = toUpdate.iterator(); ui.hasNext();)
|
||||
for (Item i : toUpdate)
|
||||
{
|
||||
Item i = (Item) ui.next();
|
||||
// FIXME: there is an exception handling problem here
|
||||
try
|
||||
{
|
||||
|
@@ -67,10 +67,10 @@ public class SearchConsumer implements Consumer
|
||||
private static Logger log = Logger.getLogger(SearchConsumer.class);
|
||||
|
||||
// collect Items, Collections, Communities that need indexing
|
||||
private Set objectsToUpdate = null;
|
||||
private Set<DSpaceObject> objectsToUpdate = null;
|
||||
|
||||
// handles to delete since IDs are not useful by now.
|
||||
private Set handlesToDelete = null;
|
||||
private Set<String> handlesToDelete = null;
|
||||
|
||||
public void initialize() throws Exception
|
||||
{
|
||||
@@ -92,8 +92,8 @@ public class SearchConsumer implements Consumer
|
||||
|
||||
if (objectsToUpdate == null)
|
||||
{
|
||||
objectsToUpdate = new HashSet();
|
||||
handlesToDelete = new HashSet();
|
||||
objectsToUpdate = new HashSet<DSpaceObject>();
|
||||
handlesToDelete = new HashSet<String>();
|
||||
}
|
||||
|
||||
int st = event.getSubjectType();
|
||||
@@ -179,9 +179,8 @@ public class SearchConsumer implements Consumer
|
||||
{
|
||||
|
||||
// update the changed Items not deleted because they were on create list
|
||||
for (Iterator ii = objectsToUpdate.iterator(); ii.hasNext();)
|
||||
for (DSpaceObject iu : objectsToUpdate)
|
||||
{
|
||||
DSpaceObject iu = (DSpaceObject) ii.next();
|
||||
if (iu.getType() != Constants.ITEM || ((Item) iu).isArchived())
|
||||
{
|
||||
// if handle is NOT in list of deleted objects, index it:
|
||||
@@ -205,9 +204,8 @@ public class SearchConsumer implements Consumer
|
||||
}
|
||||
}
|
||||
|
||||
for (Iterator ii = handlesToDelete.iterator(); ii.hasNext();)
|
||||
for (String hdl : handlesToDelete)
|
||||
{
|
||||
String hdl = (String) ii.next();
|
||||
try
|
||||
{
|
||||
DSIndexer.unIndexContent(ctx, hdl);
|
||||
|
Reference in New Issue
Block a user