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