Add back service.update after altering object to fire events

This commit is contained in:
Peter Dietz
2015-09-18 00:27:01 -04:00
parent dc4b91effd
commit 888921d68a
3 changed files with 25 additions and 9 deletions

View File

@@ -371,6 +371,7 @@ public class CollectionsResource extends Resource
log.trace("Installing item to collection(id=" + collectionId + ")."); log.trace("Installing item to collection(id=" + collectionId + ").");
dspaceItem = installItemService.installItem(context, workspaceItem); dspaceItem = installItemService.installItem(context, workspaceItem);
workspaceItemService.update(context, workspaceItem);
returnItem = new Item(dspaceItem, "", context); returnItem = new Item(dspaceItem, "", context);
@@ -453,6 +454,7 @@ public class CollectionsResource extends Resource
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.INTRODUCTORY_TEXT, collection.getIntroductoryText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.INTRODUCTORY_TEXT, collection.getIntroductoryText());
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SHORT_DESCRIPTION, collection.getShortDescription()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SHORT_DESCRIPTION, collection.getShortDescription());
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText());
collectionService.update(context, dspaceCollection);
context.complete(); context.complete();
@@ -465,8 +467,9 @@ public class CollectionsResource extends Resource
catch (SQLException e) catch (SQLException e)
{ {
processException("Could not update collection(id=" + collectionId + "), SQLException. Message: " + e, context); processException("Could not update collection(id=" + collectionId + "), SQLException. Message: " + e, context);
} } catch (AuthorizeException e) {
finally processException("Could not update collection(id=" + collectionId + "), AuthorizeException. Message: " + e, context);
} finally
{ {
processFinally(context); processFinally(context);
} }
@@ -514,6 +517,7 @@ public class CollectionsResource extends Resource
headers, request, context); headers, request, context);
collectionService.delete(context, dspaceCollection); collectionService.delete(context, dspaceCollection);
collectionService.update(context, dspaceCollection);
} }
catch (ContextException e) catch (ContextException e)
{ {
@@ -607,6 +611,8 @@ public class CollectionsResource extends Resource
} }
collectionService.removeItem(context, dspaceCollection, item); collectionService.removeItem(context, dspaceCollection, item);
collectionService.update(context, dspaceCollection);
itemService.update(context, item);
writeStats(dspaceCollection, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, writeStats(dspaceCollection, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor,
headers, request, context); headers, request, context);

View File

@@ -496,6 +496,7 @@ public class CommunitiesResource extends Resource
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText());
communityService.update(context, dspaceCommunity);
retCommunity = new Community(dspaceCommunity, "", context); retCommunity = new Community(dspaceCommunity, "", context);
context.complete(); context.complete();
@@ -557,13 +558,11 @@ public class CommunitiesResource extends Resource
try try
{ {
context = createContext(getUser(headers)); context = createContext(getUser(headers));
org.dspace.content.Community dspaceCommunity = findCommunity(context, communityId, org.dspace.core.Constants.WRITE);
org.dspace.content.Community dspaceCommunity = findCommunity(context, communityId, org.dspace.core.Constants.WRITE);
writeStats(dspaceCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, writeStats(dspaceCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor,
headers, request, context); headers, request, context);
org.dspace.content.Collection dspaceCollection = collectionService.create(context, dspaceCommunity); org.dspace.content.Collection dspaceCollection = collectionService.create(context, dspaceCommunity);
collectionService.setMetadata(context, dspaceCollection, "license", collection.getLicense()); collectionService.setMetadata(context, dspaceCollection, "license", collection.getLicense());
// dspaceCollection.setLogo(collection.getLogo()); // TODO Add this option. // dspaceCollection.setLogo(collection.getLogo()); // TODO Add this option.
collectionService.setMetadata(context, dspaceCollection, "name", collection.getName()); collectionService.setMetadata(context, dspaceCollection, "name", collection.getName());
@@ -571,7 +570,8 @@ public class CommunitiesResource extends Resource
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.INTRODUCTORY_TEXT, collection.getIntroductoryText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.INTRODUCTORY_TEXT, collection.getIntroductoryText());
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SHORT_DESCRIPTION, collection.getShortDescription()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SHORT_DESCRIPTION, collection.getShortDescription());
collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText());
collectionService.update(context, dspaceCollection);
communityService.update(context, dspaceCommunity);
retCollection = new Collection(dspaceCollection, "", context, 100, 0); retCollection = new Collection(dspaceCollection, "", context, 100, 0);
context.complete(); context.complete();
@@ -651,6 +651,8 @@ public class CommunitiesResource extends Resource
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText());
communityService.update(context, dspaceCommunity);
communityService.update(context, dspaceParentCommunity);
retCommunity = new Community(dspaceCommunity, "", context); retCommunity = new Community(dspaceCommunity, "", context);
context.complete(); context.complete();
@@ -727,7 +729,7 @@ public class CommunitiesResource extends Resource
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.INTRODUCTORY_TEXT, community.getIntroductoryText());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SHORT_DESCRIPTION, community.getShortDescription());
communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText());
communityService.update(context, dspaceCommunity);
context.complete(); context.complete();
} }
@@ -738,8 +740,9 @@ public class CommunitiesResource extends Resource
catch (ContextException e) catch (ContextException e)
{ {
processException("Could not update community(id=" + communityId + "), ContextException Message:" + e, context); processException("Could not update community(id=" + communityId + "), ContextException Message:" + e, context);
} } catch (AuthorizeException e) {
finally processException("Could not update community(id=" + communityId + "), AuthorizeException Message:" + e, context);
} finally
{ {
processFinally(context); processFinally(context);
} }
@@ -784,6 +787,7 @@ public class CommunitiesResource extends Resource
request, context); request, context);
communityService.delete(context, community); communityService.delete(context, community);
communityService.update(context, community);
context.complete(); context.complete();
} }
@@ -873,6 +877,8 @@ public class CommunitiesResource extends Resource
} }
communityService.removeCollection(context, community, collection); communityService.removeCollection(context, community, collection);
communityService.update(context, community);
collectionService.update(context, collection);
writeStats(community, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, writeStats(community, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers,
request, context); request, context);
@@ -972,6 +978,8 @@ public class CommunitiesResource extends Resource
} }
communityService.removeSubcommunity(context, parentCommunity, subcommunity); communityService.removeSubcommunity(context, parentCommunity, subcommunity);
communityService.update(context, parentCommunity);
communityService.update(context, subcommunity);
writeStats(parentCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, writeStats(parentCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor,
headers, request, context); headers, request, context);

View File

@@ -534,6 +534,8 @@ public class ItemsResource extends Resource
dspacePolicy.setStartDate(date); dspacePolicy.setStartDate(date);
} }
resourcePolicyService.update(context, dspacePolicy);
bitstreamService.updateLastModified(context, dspaceBitstream); bitstreamService.updateLastModified(context, dspaceBitstream);
} }
} }