DS-1990: Events should contain all identifiers, not only handles.

This commit is contained in:
Pascal-Nicolas Becker
2014-05-15 21:29:53 +02:00
parent 2dec016ed2
commit b1e822a87f
13 changed files with 299 additions and 49 deletions

View File

@@ -200,7 +200,8 @@ public class Item extends DSpaceObject
i.update();
context.restoreAuthSystemState();
context.addEvent(new Event(Event.CREATE, Constants.ITEM, i.getID(), null));
context.addEvent(new Event(Event.CREATE, Constants.ITEM, i.getID(),
null, i.lookupIdentifiers(context)));
log.info(LogManager.getHeader(context, "create_item", "item_id="
+ row.getIntColumn("item_id")));
@@ -357,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));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null, lookupIdentifiers(ourContext)));
} catch (SQLException e) {
log.error(LogManager.getHeader(ourContext, "Error while updating last modified timestamp", "Item: " + getID()));
}
@@ -1304,7 +1305,9 @@ public class Item extends DSpaceObject
mappingRow.setColumn("bundle_id", b.getID());
DatabaseManager.insert(ourContext, mappingRow);
ourContext.addEvent(new Event(Event.ADD, Constants.ITEM, getID(), Constants.BUNDLE, b.getID(), b.getName()));
ourContext.addEvent(new Event(Event.ADD, Constants.ITEM, getID(),
Constants.BUNDLE, b.getID(), b.getName(),
lookupIdentifiers(ourContext)));
}
/**
@@ -1345,7 +1348,8 @@ public class Item extends DSpaceObject
"AND bundle_id= ? ",
getID(), b.getID());
ourContext.addEvent(new Event(Event.REMOVE, Constants.ITEM, getID(), Constants.BUNDLE, b.getID(), b.getName()));
ourContext.addEvent(new Event(Event.REMOVE, Constants.ITEM, getID(),
Constants.BUNDLE, b.getID(), b.getName(), lookupIdentifiers(ourContext)));
// If the bundle is orphaned, it's removed
TableRowIterator tri = DatabaseManager.query(ourContext,
@@ -1805,12 +1809,14 @@ public class Item extends DSpaceObject
if (dublinCoreChanged)
{
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.ITEM, getID(), getDetails()));
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.ITEM, getID(),
getDetails(), lookupIdentifiers(ourContext)));
clearDetails();
dublinCoreChanged = false;
}
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
null, lookupIdentifiers(ourContext)));
modified = false;
}
}
@@ -1902,7 +1908,8 @@ public class Item extends DSpaceObject
// Update item in DB
update();
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), "WITHDRAW"));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
"WITHDRAW", lookupIdentifiers(ourContext)));
// remove all authorization policies, saving the custom ones
AuthorizeManager.removeAllPoliciesByDSOAndTypeNotEqualsTo(ourContext, this, ResourcePolicy.TYPE_CUSTOM);
@@ -1959,7 +1966,8 @@ public class Item extends DSpaceObject
// Update item in DB
update();
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), "REINSTATE"));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
"REINSTATE", lookupIdentifiers(ourContext)));
// authorization policies
if (colls.length > 0)
@@ -1992,7 +2000,8 @@ public class Item extends DSpaceObject
// leaving the database in an inconsistent state
AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);
ourContext.addEvent(new Event(Event.DELETE, Constants.ITEM, getID(), getHandle()));
ourContext.addEvent(new Event(Event.DELETE, Constants.ITEM, getID(),
getHandle(), lookupIdentifiers(ourContext)));
log.info(LogManager.getHeader(ourContext, "delete_item", "item_id="
+ getID()));
@@ -2414,7 +2423,8 @@ public class Item extends DSpaceObject
// Note that updating the owning collection above will have the same effect,
// so we only do this here if the owning collection hasn't changed.
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), null));
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
null, lookupIdentifiers(ourContext)));
}
}