Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS-2779 #4

Merged
merged 2 commits into from
Oct 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,14 @@ public void modifyHandleDSpaceObject(Context context, String handle, DSpaceObjec
Handle dbHandle = findHandleInternal(context, handle);
if(dbHandle != null)
{
//Remove the old handle from the current handle list
dbHandle.getDSpaceObject().getHandles().remove(dbHandle);
//Transfer the current handle to the new object
// Check if we have to remove the handle from the current handle list
// or if object is alreday deleted.
if (dbHandle.getDSpaceObject() != null)
{
// Remove the old handle from the current handle list
dbHandle.getDSpaceObject().getHandles().remove(dbHandle);
}
// Transfer the current handle to the new object
dbHandle.setDSpaceObject(newOwner);
dbHandle.setResourceTypeId(newOwner.getType());
newOwner.getHandles().add(0, dbHandle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;

/**
*
Expand Down Expand Up @@ -95,7 +96,9 @@ public void removeVersion(Context c, Version version) throws SQLException {
//Delete the item linked to the version
Item item = version.getItem();
// Completely delete the item
itemService.delete(c, item);
if (item != null) {
itemService.delete(c, item);
}
}catch (Exception e) {
c.abort();
throw new RuntimeException(e.getMessage(), e);
Expand Down Expand Up @@ -171,10 +174,10 @@ protected Version createVersion(Context c, VersionHistory vh, Item item, String

protected int getNextVersionNumer(Version latest){
if(latest==null) return 1;

return latest.getVersionNumber()+1;
}

}
@Required
public void setProvider(DefaultItemVersionProvider provider) {
this.provider = provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -255,11 +256,13 @@ protected void doDSPost(Context context, HttpServletRequest request,
// Delete the item - if "cancel" was pressed this would be
// picked up above
// FIXME: Don't know if this does all it should - remove Handle?
List<Collection> collections = item.getCollections();

Iterator<Collection> collIter = item.getCollections().iterator();
// Remove item from all the collections it's in
for (Collection c : collections)
while(collIter.hasNext())
{
Collection c = collIter.next();
collIter.remove();
collectionService.removeItem(context, c, item);
}

Expand Down
6 changes: 3 additions & 3 deletions dspace/config/spring/api/versioning-service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Default Item Versioning Provider, defines behavior for replicating
Item, Metadata, Bundles and Bitstreams. Autowired at this time.
-->
<bean id="org.dspace.versioning.VersioningService"
<bean id="org.dspace.versioning.service.VersioningService"
class="org.dspace.versioning.VersioningServiceImpl"
autowire="byType"
scope="singleton">
Expand All @@ -36,7 +36,7 @@

</bean>
</property>

</bean>

</beans>