mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 19:43:10 +00:00
DS-1990: Events should contain all identifiers, not only handles.
This commit is contained in:
@@ -232,12 +232,15 @@ public class Community extends DSpaceObject
|
||||
myPolicy.setGroup(anonymousGroup);
|
||||
myPolicy.update();
|
||||
|
||||
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, c.getID(), c.handle));
|
||||
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, c.getID(),
|
||||
c.handle, c.lookupIdentifiers(context)));
|
||||
|
||||
// if creating a top-level Community, simulate an ADD event at the Site.
|
||||
if (parent == null)
|
||||
{
|
||||
context.addEvent(new Event(Event.ADD, Constants.SITE, Site.SITE_ID, Constants.COMMUNITY, c.getID(), c.handle));
|
||||
context.addEvent(new Event(Event.ADD, Constants.SITE, Site.SITE_ID,
|
||||
Constants.COMMUNITY, c.getID(), c.handle,
|
||||
c.lookupIdentifiers(context)));
|
||||
}
|
||||
|
||||
log.info(LogManager.getHeader(context, "create_community",
|
||||
@@ -527,12 +530,15 @@ public class Community extends DSpaceObject
|
||||
|
||||
if (modified)
|
||||
{
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY, getID(), null));
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
||||
getID(), null, lookupIdentifiers(ourContext)));
|
||||
modified = false;
|
||||
}
|
||||
if (modifiedMetadata)
|
||||
{
|
||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.COMMUNITY, getID(), getDetails()));
|
||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA,
|
||||
Constants.COMMUNITY, getID(), getDetails(),
|
||||
lookupIdentifiers(ourContext)));
|
||||
modifiedMetadata = false;
|
||||
clearDetails();
|
||||
}
|
||||
@@ -903,7 +909,9 @@ public class Community extends DSpaceObject
|
||||
mappingRow.setColumn("community_id", getID());
|
||||
mappingRow.setColumn("collection_id", c.getID());
|
||||
|
||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY, getID(), Constants.COLLECTION, c.getID(), c.getHandle()));
|
||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
||||
getID(), Constants.COLLECTION, c.getID(), c.getHandle(),
|
||||
lookupIdentifiers(ourContext)));
|
||||
|
||||
DatabaseManager.insert(ourContext, mappingRow);
|
||||
}
|
||||
@@ -978,7 +986,9 @@ public class Community extends DSpaceObject
|
||||
mappingRow.setColumn("parent_comm_id", getID());
|
||||
mappingRow.setColumn("child_comm_id", c.getID());
|
||||
|
||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY, getID(), Constants.COMMUNITY, c.getID(), c.getHandle()));
|
||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
||||
getID(), Constants.COMMUNITY, c.getID(), c.getHandle(),
|
||||
lookupIdentifiers(ourContext)));
|
||||
|
||||
DatabaseManager.insert(ourContext, mappingRow);
|
||||
}
|
||||
@@ -1016,6 +1026,7 @@ public class Community extends DSpaceObject
|
||||
// Capture ID & Handle of Collection we are removing, so we can trigger events later
|
||||
int removedId = c.getID();
|
||||
String removedHandle = c.getHandle();
|
||||
String[] removedIdentifiers = c.lookupIdentifiers(ourContext);
|
||||
|
||||
// How many parent(s) does this collection have?
|
||||
TableRow trow = DatabaseManager.querySingle(ourContext,
|
||||
@@ -1041,7 +1052,8 @@ public class Community extends DSpaceObject
|
||||
log.info(LogManager.getHeader(ourContext, "remove_collection",
|
||||
"community_id=" + getID() + ",collection_id=" + removedId));
|
||||
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COMMUNITY, getID(), Constants.COLLECTION, removedId, removedHandle));
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COMMUNITY, getID(),
|
||||
Constants.COLLECTION, removedId, removedHandle, removedIdentifiers));
|
||||
}
|
||||
catch(SQLException|IOException e)
|
||||
{
|
||||
@@ -1075,6 +1087,7 @@ public class Community extends DSpaceObject
|
||||
// Capture ID & Handle of Community we are removing, so we can trigger events later
|
||||
int removedId = c.getID();
|
||||
String removedHandle = c.getHandle();
|
||||
String[] removedIdentifiers = c.lookupIdentifiers(ourContext);
|
||||
|
||||
// How many parent(s) does this subcommunity have?
|
||||
TableRow trow = DatabaseManager.querySingle(ourContext,
|
||||
@@ -1100,7 +1113,7 @@ public class Community extends DSpaceObject
|
||||
log.info(LogManager.getHeader(ourContext, "remove_subcommunity",
|
||||
"parent_comm_id=" + getID() + ",child_comm_id=" + removedId));
|
||||
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COMMUNITY, getID(), Constants.COMMUNITY, removedId, removedHandle));
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COMMUNITY, getID(), Constants.COMMUNITY, removedId, removedHandle, removedIdentifiers));
|
||||
}
|
||||
catch(SQLException|IOException e)
|
||||
{
|
||||
@@ -1145,7 +1158,7 @@ public class Community extends DSpaceObject
|
||||
|
||||
// Since this is a top level Community, simulate a REMOVE event at the Site.
|
||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.SITE, Site.SITE_ID,
|
||||
Constants.COMMUNITY, getID(), getHandle()));
|
||||
Constants.COMMUNITY, getID(), getHandle(), lookupIdentifiers(ourContext)));
|
||||
} else {
|
||||
// This is a subcommunity, so let the parent remove it
|
||||
// NOTE: this essentially just logs event and calls "rawDelete()"
|
||||
@@ -1169,6 +1182,7 @@ public class Community extends DSpaceObject
|
||||
// Capture ID & Handle of object we are removing, so we can trigger events later
|
||||
int deletedId = getID();
|
||||
String deletedHandle = getHandle();
|
||||
String[] deletedIdentifiers = lookupIdentifiers(ourContext);
|
||||
|
||||
// Remove Community object from cache
|
||||
ourContext.removeCached(this, getID());
|
||||
@@ -1219,7 +1233,7 @@ public class Community extends DSpaceObject
|
||||
}
|
||||
|
||||
// If everything above worked, then trigger any associated events
|
||||
ourContext.addEvent(new Event(Event.DELETE, Constants.COMMUNITY, deletedId, deletedHandle));
|
||||
ourContext.addEvent(new Event(Event.DELETE, Constants.COMMUNITY, deletedId, deletedHandle, deletedIdentifiers));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1386,6 +1400,7 @@ public class Community extends DSpaceObject
|
||||
public void updateLastModified()
|
||||
{
|
||||
//Also fire a modified event since the community HAS been modified
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY, getID(), null));
|
||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
||||
getID(), null, lookupIdentifiers(ourContext)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user