mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
w2p-80200 Retain UUIDs of DSpace objects when using packager
This commit is contained in:
@@ -190,6 +190,23 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item create(Context context, WorkspaceItem workspaceItem,
|
||||
UUID uuid) throws SQLException, AuthorizeException {
|
||||
if (workspaceItem.getItem() != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Attempting to create an item for a workspace item that already contains an item");
|
||||
}
|
||||
Item item = createItem(context, uuid);
|
||||
workspaceItem.setItem(item);
|
||||
|
||||
|
||||
log.info(LogManager.getHeader(context, "create_item", "item_id="
|
||||
+ item.getID()));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException {
|
||||
if (collection == null || collection.getTemplateItem() != null) {
|
||||
@@ -418,6 +435,30 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
return bitstreamList;
|
||||
}
|
||||
|
||||
protected Item createItem(Context context, UUID uuid) throws SQLException, AuthorizeException {
|
||||
Item item;
|
||||
if (uuid != null) {
|
||||
item = itemDAO.create(context, new Item(uuid));
|
||||
} else {
|
||||
item = itemDAO.create(context, new Item());
|
||||
}
|
||||
// set discoverable to true (default)
|
||||
item.setDiscoverable(true);
|
||||
|
||||
// Call update to give the item a last modified date. OK this isn't
|
||||
// amazingly efficient but creates don't happen that often.
|
||||
context.turnOffAuthorisationSystem();
|
||||
update(context, item);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
context.addEvent(new Event(Event.CREATE, Constants.ITEM, item.getID(),
|
||||
null, getIdentifiers(context, item)));
|
||||
|
||||
log.info(LogManager.getHeader(context, "create_item", "item_id=" + item.getID()));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
protected Item createItem(Context context) throws SQLException, AuthorizeException {
|
||||
Item item = itemDAO.create(context, new Item());
|
||||
// set discoverable to true (default)
|
||||
|
Reference in New Issue
Block a user