diff --git a/dspace-rest/src/main/java/org/dspace/rest/CollectionsResource.java b/dspace-rest/src/main/java/org/dspace/rest/CollectionsResource.java index c782dc3d3c..8ed520c665 100644 --- a/dspace-rest/src/main/java/org/dspace/rest/CollectionsResource.java +++ b/dspace-rest/src/main/java/org/dspace/rest/CollectionsResource.java @@ -371,6 +371,7 @@ public class CollectionsResource extends Resource log.trace("Installing item to collection(id=" + collectionId + ")."); dspaceItem = installItemService.installItem(context, workspaceItem); + workspaceItemService.update(context, workspaceItem); 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.SHORT_DESCRIPTION, collection.getShortDescription()); collectionService.setMetadata(context, dspaceCollection, org.dspace.content.Collection.SIDEBAR_TEXT, collection.getSidebarText()); + collectionService.update(context, dspaceCollection); context.complete(); @@ -465,8 +467,9 @@ public class CollectionsResource extends Resource catch (SQLException e) { processException("Could not update collection(id=" + collectionId + "), SQLException. Message: " + e, context); - } - finally + } catch (AuthorizeException e) { + processException("Could not update collection(id=" + collectionId + "), AuthorizeException. Message: " + e, context); + } finally { processFinally(context); } @@ -514,6 +517,7 @@ public class CollectionsResource extends Resource headers, request, context); collectionService.delete(context, dspaceCollection); + collectionService.update(context, dspaceCollection); } catch (ContextException e) { @@ -607,6 +611,8 @@ public class CollectionsResource extends Resource } collectionService.removeItem(context, dspaceCollection, item); + collectionService.update(context, dspaceCollection); + itemService.update(context, item); writeStats(dspaceCollection, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, request, context); diff --git a/dspace-rest/src/main/java/org/dspace/rest/CommunitiesResource.java b/dspace-rest/src/main/java/org/dspace/rest/CommunitiesResource.java index 4dc5fb3e1a..19621d3ccf 100644 --- a/dspace-rest/src/main/java/org/dspace/rest/CommunitiesResource.java +++ b/dspace-rest/src/main/java/org/dspace/rest/CommunitiesResource.java @@ -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.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); + communityService.update(context, dspaceCommunity); retCommunity = new Community(dspaceCommunity, "", context); context.complete(); @@ -557,13 +558,11 @@ public class CommunitiesResource extends Resource try { 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, headers, request, context); - org.dspace.content.Collection dspaceCollection = collectionService.create(context, dspaceCommunity); - collectionService.setMetadata(context, dspaceCollection, "license", collection.getLicense()); // dspaceCollection.setLogo(collection.getLogo()); // TODO Add this option. 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.SHORT_DESCRIPTION, collection.getShortDescription()); 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); 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.SHORT_DESCRIPTION, community.getShortDescription()); 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); 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.SHORT_DESCRIPTION, community.getShortDescription()); communityService.setMetadata(context, dspaceCommunity, org.dspace.content.Community.SIDEBAR_TEXT, community.getSidebarText()); - + communityService.update(context, dspaceCommunity); context.complete(); } @@ -738,8 +740,9 @@ public class CommunitiesResource extends Resource catch (ContextException e) { processException("Could not update community(id=" + communityId + "), ContextException Message:" + e, context); - } - finally + } catch (AuthorizeException e) { + processException("Could not update community(id=" + communityId + "), AuthorizeException Message:" + e, context); + } finally { processFinally(context); } @@ -784,6 +787,7 @@ public class CommunitiesResource extends Resource request, context); communityService.delete(context, community); + communityService.update(context, community); context.complete(); } @@ -873,6 +877,8 @@ public class CommunitiesResource extends Resource } communityService.removeCollection(context, community, collection); + communityService.update(context, community); + collectionService.update(context, collection); writeStats(community, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, request, context); @@ -972,6 +978,8 @@ public class CommunitiesResource extends Resource } communityService.removeSubcommunity(context, parentCommunity, subcommunity); + communityService.update(context, parentCommunity); + communityService.update(context, subcommunity); writeStats(parentCommunity, UsageEvent.Action.UPDATE, user_ip, user_agent, xforwardedfor, headers, request, context); diff --git a/dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java b/dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java index 2a63eed31f..7bf3ef9f58 100644 --- a/dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java +++ b/dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java @@ -534,6 +534,8 @@ public class ItemsResource extends Resource dspacePolicy.setStartDate(date); } + resourcePolicyService.update(context, dspacePolicy); + bitstreamService.updateLastModified(context, dspaceBitstream); } }