mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
[DS-3952] First try at writability, untested.
This commit is contained in:

committed by
Mark H. Wood

parent
5048105cf6
commit
0a1babdb54
@@ -16,6 +16,8 @@ import org.apache.solr.client.solrj.SolrServerException;
|
|||||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Manage queries of the Solr authority core.
|
||||||
|
*
|
||||||
* @author Antoine Snyers (antoine at atmire.com)
|
* @author Antoine Snyers (antoine at atmire.com)
|
||||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||||
* @author Ben Bosman (ben at atmire dot com)
|
* @author Ben Bosman (ben at atmire dot com)
|
||||||
@@ -26,6 +28,13 @@ public interface AuthoritySearchService {
|
|||||||
public QueryResponse search(SolrQuery query)
|
public QueryResponse search(SolrQuery query)
|
||||||
throws SolrServerException, MalformedURLException, IOException;
|
throws SolrServerException, MalformedURLException, IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all the metadata fields which are indexed in the authority control.
|
||||||
|
*
|
||||||
|
* @return names of indexed fields.
|
||||||
|
* @throws SolrServerException passed through.
|
||||||
|
* @throws MalformedURLException passed through.
|
||||||
|
*/
|
||||||
public List<String> getAllIndexedMetadataFields() throws Exception;
|
public List<String> getAllIndexedMetadataFields() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -14,14 +14,21 @@ import org.dspace.content.Item;
|
|||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service interface class for the Metadata Authority
|
* Service interface class for the Metadata Authority.
|
||||||
* The implementation of this class is responsible for all business logic calls for the Metadata Authority and is
|
* The implementation of this class is responsible for all business logic calls
|
||||||
* autowired by spring
|
* for the Metadata Authority and is autowired by Spring.
|
||||||
*
|
*
|
||||||
* @author kevinvandevelde at atmire.com
|
* @author kevinvandevelde at atmire.com
|
||||||
*/
|
*/
|
||||||
public interface AuthorityService {
|
public interface AuthorityService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an {@link Item} to the authority index.
|
||||||
|
* @param context current DSpace session.
|
||||||
|
* @param item the Item to be added.
|
||||||
|
* @throws SQLException passed through.
|
||||||
|
* @throws AuthorizeException passed through.
|
||||||
|
*/
|
||||||
public void indexItem(Context context, Item item) throws SQLException, AuthorizeException;
|
public void indexItem(Context context, Item item) throws SQLException, AuthorizeException;
|
||||||
|
|
||||||
public boolean isConfigurationValid();
|
public boolean isConfigurationValid();
|
||||||
|
@@ -8,15 +8,20 @@
|
|||||||
|
|
||||||
package org.dspace.app.rest.repository;
|
package org.dspace.app.rest.repository;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import org.dspace.app.requestitem.RequestItem;
|
import org.dspace.app.requestitem.RequestItem;
|
||||||
import org.dspace.app.requestitem.service.RequestItemService;
|
import org.dspace.app.requestitem.service.RequestItemService;
|
||||||
import org.dspace.app.rest.converter.RequestItemConverter;
|
import org.dspace.app.rest.converter.RequestItemConverter;
|
||||||
|
import org.dspace.app.rest.exception.RepositoryMethodNotImplementedException;
|
||||||
import org.dspace.app.rest.model.RequestItemRest;
|
import org.dspace.app.rest.model.RequestItemRest;
|
||||||
import org.dspace.app.rest.model.hateoas.RequestItemResource;
|
import org.dspace.app.rest.model.hateoas.RequestItemResource;
|
||||||
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -28,6 +33,8 @@ import org.springframework.data.domain.Pageable;
|
|||||||
@Named(RequestItemRest.CATEGORY + '.' + RequestItemRest.NAME)
|
@Named(RequestItemRest.CATEGORY + '.' + RequestItemRest.NAME)
|
||||||
public class RequestItemRepository
|
public class RequestItemRepository
|
||||||
extends DSpaceRestRepository<RequestItemRest, String> {
|
extends DSpaceRestRepository<RequestItemRest, String> {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(RequestItemRepository.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected RequestItemService requestItemService;
|
protected RequestItemService requestItemService;
|
||||||
|
|
||||||
@@ -46,6 +53,26 @@ public class RequestItemRepository
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RequestItemRest save(Context context, RequestItemRest ri) {
|
||||||
|
try {
|
||||||
|
requestItemService.createRequest(context, ri.getBitstream(),
|
||||||
|
ri.getItem(), ri.isAllfiles(), ri.getReqEmail(),
|
||||||
|
ri.getReqName(), ri.getReqMessage());
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
LOG.error("New RequestItem not saved.", ex);
|
||||||
|
// TODO how to inform caller that request was not saved?
|
||||||
|
}
|
||||||
|
return ri;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTICE: there is no service method for this -- requests are never deleted?
|
||||||
|
@Override
|
||||||
|
public void delete(Context context, String token)
|
||||||
|
throws AuthorizeException, RepositoryMethodNotImplementedException {
|
||||||
|
throw new RepositoryMethodNotImplementedException("RequestItemRest", "delete");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<RequestItemRest> getDomainClass() {
|
public Class<RequestItemRest> getDomainClass() {
|
||||||
return RequestItemRest.class;
|
return RequestItemRest.class;
|
||||||
|
Reference in New Issue
Block a user