mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
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:
@@ -212,7 +212,7 @@ public class Bitstream extends DSpaceObject
|
|||||||
bitstream.setFormat(null);
|
bitstream.setFormat(null);
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.BITSTREAM,
|
context.addEvent(new Event(Event.CREATE, Constants.BITSTREAM,
|
||||||
bitstreamID, null, bitstream.lookupIdentifiers(context)));
|
bitstreamID, null, bitstream.getIdentifiers(context)));
|
||||||
|
|
||||||
return bitstream;
|
return bitstream;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ public class Bitstream extends DSpaceObject
|
|||||||
bitstream.setFormat(null);
|
bitstream.setFormat(null);
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.BITSTREAM,
|
context.addEvent(new Event(Event.CREATE, Constants.BITSTREAM,
|
||||||
bitstreamID, "REGISTER", bitstream.lookupIdentifiers(context)));
|
bitstreamID, "REGISTER", bitstream.getIdentifiers(context)));
|
||||||
|
|
||||||
return bitstream;
|
return bitstream;
|
||||||
}
|
}
|
||||||
@@ -509,14 +509,14 @@ public class Bitstream extends DSpaceObject
|
|||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
bContext.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM,
|
bContext.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM,
|
||||||
getID(), null, lookupIdentifiers(bContext)));
|
getID(), null, getIdentifiers(bContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
bContext.addEvent(new Event(Event.MODIFY_METADATA,
|
bContext.addEvent(new Event(Event.MODIFY_METADATA,
|
||||||
Constants.BITSTREAM, getID(), getDetails(),
|
Constants.BITSTREAM, getID(), getDetails(),
|
||||||
lookupIdentifiers(bContext)));
|
getIdentifiers(bContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
clearDetails();
|
clearDetails();
|
||||||
}
|
}
|
||||||
@@ -544,7 +544,7 @@ public class Bitstream extends DSpaceObject
|
|||||||
"bitstream_id=" + getID()));
|
"bitstream_id=" + getID()));
|
||||||
|
|
||||||
bContext.addEvent(new Event(Event.DELETE, Constants.BITSTREAM, getID(),
|
bContext.addEvent(new Event(Event.DELETE, Constants.BITSTREAM, getID(),
|
||||||
String.valueOf(getSequenceID()), lookupIdentifiers(bContext)));
|
String.valueOf(getSequenceID()), getIdentifiers(bContext)));
|
||||||
|
|
||||||
// Remove from cache
|
// Remove from cache
|
||||||
bContext.removeCached(this, getID());
|
bContext.removeCached(this, getID());
|
||||||
@@ -751,6 +751,6 @@ public class Bitstream extends DSpaceObject
|
|||||||
{
|
{
|
||||||
//Also fire a modified event since the bitstream HAS been modified
|
//Also fire a modified event since the bitstream HAS been modified
|
||||||
bContext.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM, getID(),
|
bContext.addEvent(new Event(Event.MODIFY, Constants.BITSTREAM, getID(),
|
||||||
null, lookupIdentifiers(bContext)));
|
null, getIdentifiers(bContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -448,7 +448,7 @@ public class Bundle extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.ADD, Constants.BUNDLE, getID(),
|
ourContext.addEvent(new Event(Event.ADD, Constants.BUNDLE, getID(),
|
||||||
Constants.BITSTREAM, b.getID(), String.valueOf(b.getSequenceID()),
|
Constants.BITSTREAM, b.getID(), String.valueOf(b.getSequenceID()),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
|
|
||||||
// copy authorization policies from bundle to bitstream
|
// copy authorization policies from bundle to bitstream
|
||||||
// FIXME: multiple inclusion is affected by this...
|
// FIXME: multiple inclusion is affected by this...
|
||||||
@@ -553,7 +553,7 @@ public class Bundle extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.BUNDLE, getID(),
|
ourContext.addEvent(new Event(Event.REMOVE, Constants.BUNDLE, getID(),
|
||||||
Constants.BITSTREAM, b.getID(), String.valueOf(b.getSequenceID()),
|
Constants.BITSTREAM, b.getID(), String.valueOf(b.getSequenceID()),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
|
|
||||||
//Ensure that the last modified from the item is triggered !
|
//Ensure that the last modified from the item is triggered !
|
||||||
Item owningItem = (Item) getParentObject();
|
Item owningItem = (Item) getParentObject();
|
||||||
@@ -614,13 +614,13 @@ public class Bundle extends DSpaceObject
|
|||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.BUNDLE, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.BUNDLE, getID(),
|
||||||
null, lookupIdentifiers(ourContext)));
|
null, getIdentifiers(ourContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.BUNDLE,
|
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.BUNDLE,
|
||||||
getID(), null, lookupIdentifiers(ourContext)));
|
getID(), null, getIdentifiers(ourContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ public class Bundle extends DSpaceObject
|
|||||||
+ getID()));
|
+ getID()));
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.DELETE, Constants.BUNDLE, getID(),
|
ourContext.addEvent(new Event(Event.DELETE, Constants.BUNDLE, getID(),
|
||||||
getName(), lookupIdentifiers(ourContext)));
|
getName(), getIdentifiers(ourContext)));
|
||||||
|
|
||||||
// Remove from cache
|
// Remove from cache
|
||||||
ourContext.removeCached(this, getID());
|
ourContext.removeCached(this, getID());
|
||||||
|
@@ -280,7 +280,7 @@ public class Collection extends DSpaceObject
|
|||||||
myPolicy.update();
|
myPolicy.update();
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.COLLECTION,
|
context.addEvent(new Event(Event.CREATE, Constants.COLLECTION,
|
||||||
c.getID(), c.handle, c.lookupIdentifiers(context)));
|
c.getID(), c.handle, c.getIdentifiers(context)));
|
||||||
|
|
||||||
log.info(LogManager.getHeader(context, "create_collection",
|
log.info(LogManager.getHeader(context, "create_collection",
|
||||||
"collection_id=" + row.getIntColumn("collection_id"))
|
"collection_id=" + row.getIntColumn("collection_id"))
|
||||||
@@ -971,7 +971,7 @@ public class Collection extends DSpaceObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
||||||
getID(), "remove_template_item", lookupIdentifiers(ourContext)));
|
getID(), "remove_template_item", getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1003,7 +1003,7 @@ public class Collection extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.ADD, Constants.COLLECTION, getID(),
|
ourContext.addEvent(new Event(Event.ADD, Constants.COLLECTION, getID(),
|
||||||
Constants.ITEM, item.getID(), item.getHandle(),
|
Constants.ITEM, item.getID(), item.getHandle(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1043,7 +1043,7 @@ public class Collection extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
|
ourContext.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
|
||||||
getID(), Constants.ITEM, item.getID(), item.getHandle(),
|
getID(), Constants.ITEM, item.getID(), item.getHandle(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1067,14 +1067,14 @@ public class Collection extends DSpaceObject
|
|||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
||||||
getID(), null, lookupIdentifiers(ourContext)));
|
getID(), null, getIdentifiers(ourContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA,
|
ourContext.addEvent(new Event(Event.MODIFY_METADATA,
|
||||||
Constants.COLLECTION, getID(), getDetails(),
|
Constants.COLLECTION, getID(), getDetails(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
clearDetails();
|
clearDetails();
|
||||||
}
|
}
|
||||||
@@ -1141,7 +1141,7 @@ public class Collection extends DSpaceObject
|
|||||||
"collection_id=" + getID()));
|
"collection_id=" + getID()));
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.DELETE, Constants.COLLECTION,
|
ourContext.addEvent(new Event(Event.DELETE, Constants.COLLECTION,
|
||||||
getID(), getHandle(), lookupIdentifiers(ourContext)));
|
getID(), getHandle(), getIdentifiers(ourContext)));
|
||||||
|
|
||||||
// Remove from cache
|
// Remove from cache
|
||||||
ourContext.removeCached(this, getID());
|
ourContext.removeCached(this, getID());
|
||||||
@@ -1577,6 +1577,6 @@ public class Collection extends DSpaceObject
|
|||||||
{
|
{
|
||||||
//Also fire a modified event since the collection HAS been modified
|
//Also fire a modified event since the collection HAS been modified
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION,
|
||||||
getID(), null, lookupIdentifiers(ourContext)));
|
getID(), null, getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -233,14 +233,14 @@ public class Community extends DSpaceObject
|
|||||||
myPolicy.update();
|
myPolicy.update();
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, c.getID(),
|
context.addEvent(new Event(Event.CREATE, Constants.COMMUNITY, c.getID(),
|
||||||
c.handle, c.lookupIdentifiers(context)));
|
c.handle, c.getIdentifiers(context)));
|
||||||
|
|
||||||
// if creating a top-level Community, simulate an ADD event at the Site.
|
// if creating a top-level Community, simulate an ADD event at the Site.
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
context.addEvent(new Event(Event.ADD, Constants.SITE, Site.SITE_ID,
|
context.addEvent(new Event(Event.ADD, Constants.SITE, Site.SITE_ID,
|
||||||
Constants.COMMUNITY, c.getID(), c.handle,
|
Constants.COMMUNITY, c.getID(), c.handle,
|
||||||
c.lookupIdentifiers(context)));
|
c.getIdentifiers(context)));
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(LogManager.getHeader(context, "create_community",
|
log.info(LogManager.getHeader(context, "create_community",
|
||||||
@@ -531,14 +531,14 @@ public class Community extends DSpaceObject
|
|||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
||||||
getID(), null, lookupIdentifiers(ourContext)));
|
getID(), null, getIdentifiers(ourContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA,
|
ourContext.addEvent(new Event(Event.MODIFY_METADATA,
|
||||||
Constants.COMMUNITY, getID(), getDetails(),
|
Constants.COMMUNITY, getID(), getDetails(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
clearDetails();
|
clearDetails();
|
||||||
}
|
}
|
||||||
@@ -911,7 +911,7 @@ public class Community extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
||||||
getID(), Constants.COLLECTION, c.getID(), c.getHandle(),
|
getID(), Constants.COLLECTION, c.getID(), c.getHandle(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
|
|
||||||
DatabaseManager.insert(ourContext, mappingRow);
|
DatabaseManager.insert(ourContext, mappingRow);
|
||||||
}
|
}
|
||||||
@@ -988,7 +988,7 @@ public class Community extends DSpaceObject
|
|||||||
|
|
||||||
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
ourContext.addEvent(new Event(Event.ADD, Constants.COMMUNITY,
|
||||||
getID(), Constants.COMMUNITY, c.getID(), c.getHandle(),
|
getID(), Constants.COMMUNITY, c.getID(), c.getHandle(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
|
|
||||||
DatabaseManager.insert(ourContext, mappingRow);
|
DatabaseManager.insert(ourContext, mappingRow);
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1026,7 @@ public class Community extends DSpaceObject
|
|||||||
// Capture ID & Handle of Collection we are removing, so we can trigger events later
|
// Capture ID & Handle of Collection we are removing, so we can trigger events later
|
||||||
int removedId = c.getID();
|
int removedId = c.getID();
|
||||||
String removedHandle = c.getHandle();
|
String removedHandle = c.getHandle();
|
||||||
String[] removedIdentifiers = c.lookupIdentifiers(ourContext);
|
String[] removedIdentifiers = c.getIdentifiers(ourContext);
|
||||||
|
|
||||||
// How many parent(s) does this collection have?
|
// How many parent(s) does this collection have?
|
||||||
TableRow trow = DatabaseManager.querySingle(ourContext,
|
TableRow trow = DatabaseManager.querySingle(ourContext,
|
||||||
@@ -1087,7 +1087,7 @@ public class Community extends DSpaceObject
|
|||||||
// Capture ID & Handle of Community we are removing, so we can trigger events later
|
// Capture ID & Handle of Community we are removing, so we can trigger events later
|
||||||
int removedId = c.getID();
|
int removedId = c.getID();
|
||||||
String removedHandle = c.getHandle();
|
String removedHandle = c.getHandle();
|
||||||
String[] removedIdentifiers = c.lookupIdentifiers(ourContext);
|
String[] removedIdentifiers = c.getIdentifiers(ourContext);
|
||||||
|
|
||||||
// How many parent(s) does this subcommunity have?
|
// How many parent(s) does this subcommunity have?
|
||||||
TableRow trow = DatabaseManager.querySingle(ourContext,
|
TableRow trow = DatabaseManager.querySingle(ourContext,
|
||||||
@@ -1158,7 +1158,7 @@ public class Community extends DSpaceObject
|
|||||||
|
|
||||||
// Since this is a top level Community, simulate a REMOVE event at the Site.
|
// 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,
|
ourContext.addEvent(new Event(Event.REMOVE, Constants.SITE, Site.SITE_ID,
|
||||||
Constants.COMMUNITY, getID(), getHandle(), lookupIdentifiers(ourContext)));
|
Constants.COMMUNITY, getID(), getHandle(), getIdentifiers(ourContext)));
|
||||||
} else {
|
} else {
|
||||||
// This is a subcommunity, so let the parent remove it
|
// This is a subcommunity, so let the parent remove it
|
||||||
// NOTE: this essentially just logs event and calls "rawDelete()"
|
// NOTE: this essentially just logs event and calls "rawDelete()"
|
||||||
@@ -1182,7 +1182,7 @@ public class Community extends DSpaceObject
|
|||||||
// Capture ID & Handle of object we are removing, so we can trigger events later
|
// Capture ID & Handle of object we are removing, so we can trigger events later
|
||||||
int deletedId = getID();
|
int deletedId = getID();
|
||||||
String deletedHandle = getHandle();
|
String deletedHandle = getHandle();
|
||||||
String[] deletedIdentifiers = lookupIdentifiers(ourContext);
|
String[] deletedIdentifiers = getIdentifiers(ourContext);
|
||||||
|
|
||||||
// Remove Community object from cache
|
// Remove Community object from cache
|
||||||
ourContext.removeCached(this, getID());
|
ourContext.removeCached(this, getID());
|
||||||
@@ -1401,6 +1401,6 @@ public class Community extends DSpaceObject
|
|||||||
{
|
{
|
||||||
//Also fire a modified event since the community HAS been modified
|
//Also fire a modified event since the community HAS been modified
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.COMMUNITY,
|
||||||
getID(), null, lookupIdentifiers(ourContext)));
|
getID(), null, getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,8 @@ public abstract class DSpaceObject
|
|||||||
// e.g. to document metadata fields touched, etc.
|
// e.g. to document metadata fields touched, etc.
|
||||||
private StringBuffer eventDetails = null;
|
private StringBuffer eventDetails = null;
|
||||||
|
|
||||||
|
private String[] identifiers = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the cache of event details.
|
* Reset the cache of event details.
|
||||||
*/
|
*/
|
||||||
@@ -109,26 +111,52 @@ public abstract class DSpaceObject
|
|||||||
* Tries to lookup all Identifiers of this DSpaceObject.
|
* Tries to lookup all Identifiers of this DSpaceObject.
|
||||||
* @return An array containing all found identifiers or an array with a length of 0.
|
* @return An array containing all found identifiers or an array with a length of 0.
|
||||||
*/
|
*/
|
||||||
public String[] lookupIdentifiers(Context context)
|
public String[] getIdentifiers(Context context)
|
||||||
{
|
{
|
||||||
String[] identifiers = new String[0];
|
if (identifiers == null)
|
||||||
IdentifierService identifierService =
|
|
||||||
new DSpace().getSingletonService(IdentifierService.class);
|
|
||||||
|
|
||||||
if (identifierService != null)
|
|
||||||
{
|
{
|
||||||
return identifierService.lookup(context, this);
|
log.debug("This DSO's identifiers cache is empty, looking for identifiers...");
|
||||||
|
identifiers = new String[0];
|
||||||
|
|
||||||
|
IdentifierService identifierService =
|
||||||
|
new DSpace().getSingletonService(IdentifierService.class);
|
||||||
|
|
||||||
|
if (identifierService != null)
|
||||||
|
{
|
||||||
|
identifiers = identifierService.lookup(context, this);
|
||||||
|
} else {
|
||||||
|
log.warn("No IdentifierService found, will return an array containing "
|
||||||
|
+ "the Handle only.");
|
||||||
|
if (getHandle() != null)
|
||||||
|
{
|
||||||
|
identifiers = new String[] { HandleManager.getCanonicalForm(getHandle()) };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.warn("No IdentifierService found, will return an array containing "
|
if (log.isDebugEnabled())
|
||||||
+ "the Handle only.");
|
|
||||||
|
|
||||||
if (getHandle() != null)
|
|
||||||
{
|
{
|
||||||
return new String[] { HandleManager.getCanonicalForm(getHandle()) };
|
StringBuilder dbgMsg = new StringBuilder();
|
||||||
|
for (String id : identifiers)
|
||||||
|
{
|
||||||
|
if (dbgMsg.capacity() == 0)
|
||||||
|
{
|
||||||
|
dbgMsg.append("This DSO's Identifiers are: ");
|
||||||
|
} else {
|
||||||
|
dbgMsg.append(", ");
|
||||||
|
}
|
||||||
|
dbgMsg.append(id);
|
||||||
|
}
|
||||||
|
dbgMsg.append(".");
|
||||||
|
log.debug(dbgMsg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String[0];
|
return identifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetIdentifiersCache()
|
||||||
|
{
|
||||||
|
identifiers = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -224,7 +224,7 @@ public class InstallItem
|
|||||||
|
|
||||||
// Notify interested parties of newly archived Item
|
// Notify interested parties of newly archived Item
|
||||||
c.addEvent(new Event(Event.INSTALL, Constants.ITEM, item.getID(),
|
c.addEvent(new Event(Event.INSTALL, Constants.ITEM, item.getID(),
|
||||||
item.getHandle(), item.lookupIdentifiers(c)));
|
item.getHandle(), item.getIdentifiers(c)));
|
||||||
|
|
||||||
// remove in-progress submission
|
// remove in-progress submission
|
||||||
is.deleteWrapper();
|
is.deleteWrapper();
|
||||||
|
@@ -201,7 +201,7 @@ public class Item extends DSpaceObject
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.ITEM, i.getID(),
|
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="
|
log.info(LogManager.getHeader(context, "create_item", "item_id="
|
||||||
+ row.getIntColumn("item_id")));
|
+ row.getIntColumn("item_id")));
|
||||||
@@ -358,7 +358,7 @@ public class Item extends DSpaceObject
|
|||||||
itemRow.setColumn("last_modified", lastModified);
|
itemRow.setColumn("last_modified", lastModified);
|
||||||
DatabaseManager.updateQuery(ourContext, "UPDATE item SET last_modified = ? WHERE item_id= ? ", lastModified, getID());
|
DatabaseManager.updateQuery(ourContext, "UPDATE item SET last_modified = ? WHERE item_id= ? ", lastModified, getID());
|
||||||
//Also fire a modified event since the item HAS been modified
|
//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) {
|
} catch (SQLException e) {
|
||||||
log.error(LogManager.getHeader(ourContext, "Error while updating last modified timestamp", "Item: " + getID()));
|
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(),
|
ourContext.addEvent(new Event(Event.ADD, Constants.ITEM, getID(),
|
||||||
Constants.BUNDLE, b.getID(), b.getName(),
|
Constants.BUNDLE, b.getID(), b.getName(),
|
||||||
lookupIdentifiers(ourContext)));
|
getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1349,7 +1349,7 @@ public class Item extends DSpaceObject
|
|||||||
getID(), b.getID());
|
getID(), b.getID());
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.REMOVE, Constants.ITEM, 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
|
// If the bundle is orphaned, it's removed
|
||||||
TableRowIterator tri = DatabaseManager.query(ourContext,
|
TableRowIterator tri = DatabaseManager.query(ourContext,
|
||||||
@@ -1810,13 +1810,13 @@ public class Item extends DSpaceObject
|
|||||||
if (dublinCoreChanged)
|
if (dublinCoreChanged)
|
||||||
{
|
{
|
||||||
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.ITEM, getID(),
|
||||||
getDetails(), lookupIdentifiers(ourContext)));
|
getDetails(), getIdentifiers(ourContext)));
|
||||||
clearDetails();
|
clearDetails();
|
||||||
dublinCoreChanged = false;
|
dublinCoreChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
||||||
null, lookupIdentifiers(ourContext)));
|
null, getIdentifiers(ourContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1909,7 +1909,7 @@ public class Item extends DSpaceObject
|
|||||||
update();
|
update();
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
||||||
"WITHDRAW", lookupIdentifiers(ourContext)));
|
"WITHDRAW", getIdentifiers(ourContext)));
|
||||||
|
|
||||||
// remove all authorization policies, saving the custom ones
|
// remove all authorization policies, saving the custom ones
|
||||||
AuthorizeManager.removeAllPoliciesByDSOAndTypeNotEqualsTo(ourContext, this, ResourcePolicy.TYPE_CUSTOM);
|
AuthorizeManager.removeAllPoliciesByDSOAndTypeNotEqualsTo(ourContext, this, ResourcePolicy.TYPE_CUSTOM);
|
||||||
@@ -1967,7 +1967,7 @@ public class Item extends DSpaceObject
|
|||||||
update();
|
update();
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
||||||
"REINSTATE", lookupIdentifiers(ourContext)));
|
"REINSTATE", getIdentifiers(ourContext)));
|
||||||
|
|
||||||
// authorization policies
|
// authorization policies
|
||||||
if (colls.length > 0)
|
if (colls.length > 0)
|
||||||
@@ -2001,7 +2001,7 @@ public class Item extends DSpaceObject
|
|||||||
AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);
|
AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.DELETE, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.DELETE, Constants.ITEM, getID(),
|
||||||
getHandle(), lookupIdentifiers(ourContext)));
|
getHandle(), getIdentifiers(ourContext)));
|
||||||
|
|
||||||
log.info(LogManager.getHeader(ourContext, "delete_item", "item_id="
|
log.info(LogManager.getHeader(ourContext, "delete_item", "item_id="
|
||||||
+ getID()));
|
+ getID()));
|
||||||
@@ -2424,7 +2424,7 @@ public class Item extends DSpaceObject
|
|||||||
// so we only do this here if the owning collection hasn't changed.
|
// so we only do this here if the owning collection hasn't changed.
|
||||||
|
|
||||||
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(),
|
||||||
null, lookupIdentifiers(ourContext)));
|
null, getIdentifiers(ourContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -547,7 +547,7 @@ public class EPerson extends DSpaceObject
|
|||||||
+ e.getID()));
|
+ e.getID()));
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.EPERSON, e.getID(),
|
context.addEvent(new Event(Event.CREATE, Constants.EPERSON, e.getID(),
|
||||||
null, e.lookupIdentifiers(context)));
|
null, e.getIdentifiers(context)));
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -578,7 +578,7 @@ public class EPerson extends DSpaceObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
myContext.addEvent(new Event(Event.DELETE, Constants.EPERSON, getID(),
|
myContext.addEvent(new Event(Event.DELETE, Constants.EPERSON, getID(),
|
||||||
getEmail(), lookupIdentifiers(myContext)));
|
getEmail(), getIdentifiers(myContext)));
|
||||||
|
|
||||||
// Remove from cache
|
// Remove from cache
|
||||||
myContext.removeCached(this, getID());
|
myContext.removeCached(this, getID());
|
||||||
@@ -1008,13 +1008,13 @@ public class EPerson extends DSpaceObject
|
|||||||
if (modified)
|
if (modified)
|
||||||
{
|
{
|
||||||
myContext.addEvent(new Event(Event.MODIFY, Constants.EPERSON,
|
myContext.addEvent(new Event(Event.MODIFY, Constants.EPERSON,
|
||||||
getID(), null, lookupIdentifiers(myContext)));
|
getID(), null, getIdentifiers(myContext)));
|
||||||
modified = false;
|
modified = false;
|
||||||
}
|
}
|
||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
myContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.EPERSON,
|
myContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.EPERSON,
|
||||||
getID(), getDetails(), lookupIdentifiers(myContext)));
|
getID(), getDetails(), getIdentifiers(myContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
clearDetails();
|
clearDetails();
|
||||||
}
|
}
|
||||||
|
@@ -215,7 +215,7 @@ public class Group extends DSpaceObject
|
|||||||
+ g.getID()));
|
+ g.getID()));
|
||||||
|
|
||||||
context.addEvent(new Event(Event.CREATE, Constants.GROUP, g.getID(),
|
context.addEvent(new Event(Event.CREATE, Constants.GROUP, g.getID(),
|
||||||
null, g.lookupIdentifiers(context)));
|
null, g.getIdentifiers(context)));
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ public class Group extends DSpaceObject
|
|||||||
|
|
||||||
myContext.addEvent(new Event(Event.ADD, Constants.GROUP, getID(),
|
myContext.addEvent(new Event(Event.ADD, Constants.GROUP, getID(),
|
||||||
Constants.EPERSON, e.getID(), e.getEmail(),
|
Constants.EPERSON, e.getID(), e.getEmail(),
|
||||||
lookupIdentifiers(myContext)));
|
getIdentifiers(myContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -297,7 +297,7 @@ public class Group extends DSpaceObject
|
|||||||
|
|
||||||
myContext.addEvent(new Event(Event.ADD, Constants.GROUP, getID(),
|
myContext.addEvent(new Event(Event.ADD, Constants.GROUP, getID(),
|
||||||
Constants.GROUP, g.getID(), g.getName(),
|
Constants.GROUP, g.getID(), g.getName(),
|
||||||
lookupIdentifiers(myContext)));
|
getIdentifiers(myContext)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -315,7 +315,7 @@ public class Group extends DSpaceObject
|
|||||||
epeopleChanged = true;
|
epeopleChanged = true;
|
||||||
myContext.addEvent(new Event(Event.REMOVE, Constants.GROUP, getID(),
|
myContext.addEvent(new Event(Event.REMOVE, Constants.GROUP, getID(),
|
||||||
Constants.EPERSON, e.getID(), e.getEmail(),
|
Constants.EPERSON, e.getID(), e.getEmail(),
|
||||||
lookupIdentifiers(myContext)));
|
getIdentifiers(myContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ public class Group extends DSpaceObject
|
|||||||
groupsChanged = true;
|
groupsChanged = true;
|
||||||
myContext.addEvent(new Event(Event.REMOVE, Constants.GROUP, getID(),
|
myContext.addEvent(new Event(Event.REMOVE, Constants.GROUP, getID(),
|
||||||
Constants.GROUP, g.getID(), g.getName(),
|
Constants.GROUP, g.getID(), g.getName(),
|
||||||
lookupIdentifiers(myContext)));
|
getIdentifiers(myContext)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ public class Group extends DSpaceObject
|
|||||||
// FIXME: authorizations
|
// FIXME: authorizations
|
||||||
|
|
||||||
myContext.addEvent(new Event(Event.DELETE, Constants.GROUP, getID(),
|
myContext.addEvent(new Event(Event.DELETE, Constants.GROUP, getID(),
|
||||||
getName(), lookupIdentifiers(myContext)));
|
getName(), getIdentifiers(myContext)));
|
||||||
|
|
||||||
// Remove from cache
|
// Remove from cache
|
||||||
myContext.removeCached(this, getID());
|
myContext.removeCached(this, getID());
|
||||||
@@ -1116,7 +1116,7 @@ public class Group extends DSpaceObject
|
|||||||
if (modifiedMetadata)
|
if (modifiedMetadata)
|
||||||
{
|
{
|
||||||
myContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.GROUP,
|
myContext.addEvent(new Event(Event.MODIFY_METADATA, Constants.GROUP,
|
||||||
getID(), getDetails(), lookupIdentifiers(myContext)));
|
getID(), getDetails(), getIdentifiers(myContext)));
|
||||||
modifiedMetadata = false;
|
modifiedMetadata = false;
|
||||||
clearDetails();
|
clearDetails();
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,7 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
{
|
{
|
||||||
service.register(context, dso);
|
service.register(context, dso);
|
||||||
}
|
}
|
||||||
|
dso.resetIdentifiersCache();
|
||||||
//Update our item
|
//Update our item
|
||||||
dso.update();
|
dso.update();
|
||||||
}
|
}
|
||||||
@@ -105,6 +106,7 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
throw new IdentifierException("Cannot register identifier: Didn't "
|
throw new IdentifierException("Cannot register identifier: Didn't "
|
||||||
+ "find a provider that supports this identifier.");
|
+ "find a provider that supports this identifier.");
|
||||||
}
|
}
|
||||||
|
object.resetIdentifiersCache();
|
||||||
//Update our item
|
//Update our item
|
||||||
object.update();
|
object.update();
|
||||||
}
|
}
|
||||||
@@ -160,6 +162,13 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
identifiers.add(result);
|
identifiers.add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (IdentifierNotFoundException ex)
|
||||||
|
{
|
||||||
|
log.info(service.getClass().getName() + " doesn't find an "
|
||||||
|
+ "Identifier for " + dso.getTypeText() + ", "
|
||||||
|
+ Integer.toString(dso.getID()) + ".");
|
||||||
|
log.debug(ex.getMessage(), ex);
|
||||||
|
}
|
||||||
catch (IdentifierException ex)
|
catch (IdentifierException ex)
|
||||||
{
|
{
|
||||||
log.error(ex.getMessage(), ex);
|
log.error(ex.getMessage(), ex);
|
||||||
@@ -227,6 +236,7 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dso.resetIdentifiersCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -243,5 +253,6 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dso.resetIdentifiersCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ public class VersioningConsumer implements Consumer {
|
|||||||
//and browse index we need to fire a new event
|
//and browse index we need to fire a new event
|
||||||
ctx.addEvent(new Event(Event.MODIFY,
|
ctx.addEvent(new Event(Event.MODIFY,
|
||||||
previousItem.getType(), previousItem.getID(),
|
previousItem.getType(), previousItem.getID(),
|
||||||
null, previousItem.lookupIdentifiers(ctx)));
|
null, previousItem.getIdentifiers(ctx)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user