mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
try to handle rights exception
This commit is contained in:
@@ -547,7 +547,7 @@ public class Util {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static List<String> diff(Collection fromCollection, Collection toCollection) throws Exception {
|
||||
public static List<String> diff(Collection fromCollection, Collection toCollection) throws DCInputsReaderException {
|
||||
DCInputsReader reader = new DCInputsReader();
|
||||
List<DCInputSet> from = reader.getInputsByCollectionHandle(fromCollection.getHandle());
|
||||
List<DCInputSet> to = reader.getInputsByCollectionHandle(toCollection.getHandle());
|
||||
|
@@ -16,6 +16,7 @@ import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.util.DCInput;
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
import org.dspace.app.util.Util;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
@@ -261,7 +262,7 @@ public class WorkspaceItemServiceImpl implements WorkspaceItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(Context context, WorkspaceItem source, Collection fromCollection, Collection toCollection) throws Exception {
|
||||
public void move(Context context, WorkspaceItem source, Collection fromCollection, Collection toCollection) throws DCInputsReaderException {
|
||||
source.setCollection(toCollection);
|
||||
|
||||
List<MetadataValue> remove = new ArrayList<>();
|
||||
|
@@ -7,14 +7,14 @@
|
||||
*/
|
||||
package org.dspace.content.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.InProgressSubmission;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Service interface class for the InProgressSubmission.
|
||||
* All InProgressSubmission service classes should implement this class since it offers some basic methods which all InProgressSubmissions
|
||||
@@ -43,5 +43,5 @@ public interface InProgressSubmissionService<T extends InProgressSubmission> {
|
||||
*/
|
||||
public void update(Context context, T inProgressSubmission) throws SQLException, AuthorizeException;
|
||||
|
||||
public void move(Context context, T inProgressSubmission, Collection fromCollection, Collection toCollection) throws Exception;
|
||||
public void move(Context context, T inProgressSubmission, Collection fromCollection, Collection toCollection) throws DCInputsReaderException;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import org.dspace.app.rest.exception.PatchUnprocessableEntityException;
|
||||
import org.dspace.app.rest.model.DirectlyAddressableRestModel;
|
||||
import org.dspace.app.rest.model.hateoas.DSpaceResource;
|
||||
import org.dspace.app.rest.model.step.UploadStatusResponse;
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -160,13 +161,13 @@ extends AbstractDSpaceRestRepository
|
||||
try {
|
||||
patch(context, request, apiCategory, model, id, patch);
|
||||
context.commit();
|
||||
} catch (SQLException | AuthorizeException e) {
|
||||
} catch (SQLException | AuthorizeException | DCInputsReaderException e) {
|
||||
throw new PatchUnprocessableEntityException(e.getMessage());
|
||||
}
|
||||
return findOne(id);
|
||||
}
|
||||
|
||||
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, ID id, Patch patch) throws HttpRequestMethodNotSupportedException, SQLException, AuthorizeException {
|
||||
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, ID id, Patch patch) throws HttpRequestMethodNotSupportedException, SQLException, AuthorizeException, DCInputsReaderException {
|
||||
throw new HttpRequestMethodNotSupportedException("No implementation found; Method not allowed!");
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,9 @@
|
||||
*/
|
||||
package org.dspace.app.rest.submit.factory.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
@@ -35,7 +38,7 @@ public class CollectionReplacePatchOperation extends ReplacePatchOperation<Strin
|
||||
|
||||
@Override
|
||||
void replace(Context context, Request currentRequest, WorkspaceItem source, String path, Object value)
|
||||
throws Exception {
|
||||
throws SQLException, DCInputsReaderException {
|
||||
String uuid = (String) value;
|
||||
|
||||
Collection fromCollection = source.getCollection();
|
||||
|
Reference in New Issue
Block a user