Enhancing the PR for DS-1990.

Adds a cache to the Identifier array in the DSpaceObject class.
Renames the method from lookupIdentifiers into getIdentifiers.
This commit is contained in:
Pascal-Nicolas Becker
2014-08-12 16:12:16 +02:00
parent 446c7efc31
commit 3fdc76c8ea
11 changed files with 108 additions and 69 deletions

View File

@@ -201,7 +201,7 @@ public class Item extends DSpaceObject
context.restoreAuthSystemState();
context.addEvent(new Event(Event.CREATE, Constants.ITEM, i.getID(),
null, i.lookupIdentifiers(context)));
null, i.getIdentifiers(context)));
log.info(LogManager.getHeader(context, "create_item", "item_id="
+ row.getIntColumn("item_id")));
@@ -358,7 +358,7 @@ public class Item extends DSpaceObject
itemRow.setColumn("last_modified", lastModified);
DatabaseManager.updateQuery(ourContext, "UPDATE item SET last_modified = ? WHERE item_id= ? ", lastModified, getID());
//Also fire a modified event since the item HAS been modified
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null, lookupIdentifiers(ourContext)));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null, getIdentifiers(ourContext)));
} catch (SQLException e) {
log.error(LogManager.getHeader(ourContext, "Error while updating last modified timestamp", "Item: " + getID()));
}
@@ -1307,7 +1307,7 @@ public class Item extends DSpaceObject
ourContext.addEvent(new Event(Event.ADD, Constants.ITEM, getID(),
Constants.BUNDLE, b.getID(), b.getName(),
lookupIdentifiers(ourContext)));
getIdentifiers(ourContext)));
}
/**
@@ -1349,7 +1349,7 @@ public class Item extends DSpaceObject
getID(), b.getID());
ourContext.addEvent(new Event(Event.REMOVE, Constants.ITEM, getID(),
Constants.BUNDLE, b.getID(), b.getName(), lookupIdentifiers(ourContext)));
Constants.BUNDLE, b.getID(), b.getName(), getIdentifiers(ourContext)));
// If the bundle is orphaned, it's removed
TableRowIterator tri = DatabaseManager.query(ourContext,
@@ -1810,13 +1810,13 @@ public class Item extends DSpaceObject
if (dublinCoreChanged)
{
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.ITEM, getID(),
getDetails(), lookupIdentifiers(ourContext)));
getDetails(), getIdentifiers(ourContext)));
clearDetails();
dublinCoreChanged = false;
}
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
null, lookupIdentifiers(ourContext)));
null, getIdentifiers(ourContext)));
modified = false;
}
}
@@ -1909,7 +1909,7 @@ public class Item extends DSpaceObject
update();
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
"WITHDRAW", lookupIdentifiers(ourContext)));
"WITHDRAW", getIdentifiers(ourContext)));
// remove all authorization policies, saving the custom ones
AuthorizeManager.removeAllPoliciesByDSOAndTypeNotEqualsTo(ourContext, this, ResourcePolicy.TYPE_CUSTOM);
@@ -1967,7 +1967,7 @@ public class Item extends DSpaceObject
update();
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
"REINSTATE", lookupIdentifiers(ourContext)));
"REINSTATE", getIdentifiers(ourContext)));
// authorization policies
if (colls.length > 0)
@@ -2001,7 +2001,7 @@ public class Item extends DSpaceObject
AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);
ourContext.addEvent(new Event(Event.DELETE, Constants.ITEM, getID(),
getHandle(), lookupIdentifiers(ourContext)));
getHandle(), getIdentifiers(ourContext)));
log.info(LogManager.getHeader(ourContext, "delete_item", "item_id="
+ getID()));
@@ -2424,7 +2424,7 @@ public class Item extends DSpaceObject
// so we only do this here if the owning collection hasn't changed.
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
null, lookupIdentifiers(ourContext)));
null, getIdentifiers(ourContext)));
}
}