mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #2391 from 4Science/DS-4166_mydspace
DS-4166 Index workspace, workflow and tasks in SOLR
This commit is contained in:
@@ -20,11 +20,13 @@ import com.sun.syndication.feed.module.opensearch.OpenSearchModule;
|
||||
import com.sun.syndication.feed.module.opensearch.entity.OSQuery;
|
||||
import com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl;
|
||||
import com.sun.syndication.io.FeedException;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.service.OpenSearchService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
@@ -118,7 +120,7 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
||||
@Override
|
||||
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
||||
int pageSize,
|
||||
DSpaceObject scope, List<DSpaceObject> results,
|
||||
IndexableObject scope, List<IndexableObject> results,
|
||||
Map<String, String> labels) throws IOException {
|
||||
try {
|
||||
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
||||
@@ -132,7 +134,7 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
||||
@Override
|
||||
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
||||
int pageSize,
|
||||
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
|
||||
IndexableObject scope, List<IndexableObject> results, Map<String, String> labels)
|
||||
throws IOException {
|
||||
try {
|
||||
return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels)
|
||||
@@ -144,8 +146,8 @@ public class OpenSearchServiceImpl implements OpenSearchService {
|
||||
}
|
||||
|
||||
protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start,
|
||||
int pageSize,
|
||||
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels) {
|
||||
int pageSize, IndexableObject scope,
|
||||
List<IndexableObject> results, Map<String, String> labels) {
|
||||
// Encode results in requested format
|
||||
if ("rss".equals(format)) {
|
||||
format = "rss_2.0";
|
||||
|
@@ -52,6 +52,7 @@ import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.handle.factory.HandleServiceFactory;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
@@ -179,12 +180,12 @@ public class SyndicationFeed {
|
||||
*
|
||||
* @param request request
|
||||
* @param context context
|
||||
* @param dso DSpaceObject
|
||||
* @param dso the scope
|
||||
* @param items array of objects
|
||||
* @param labels label map
|
||||
*/
|
||||
public void populate(HttpServletRequest request, Context context, DSpaceObject dso,
|
||||
List<? extends DSpaceObject> items, Map<String, String> labels) {
|
||||
public void populate(HttpServletRequest request, Context context, IndexableObject dso,
|
||||
List<IndexableObject> items, Map<String, String> labels) {
|
||||
String logoURL = null;
|
||||
String objectURL = null;
|
||||
String defaultTitle = null;
|
||||
@@ -208,6 +209,7 @@ public class SyndicationFeed {
|
||||
if (cols != null && cols.length() > 1 && cols.contains(col.getHandle())) {
|
||||
podcastFeed = true;
|
||||
}
|
||||
objectURL = resolveURL(request, col);
|
||||
} else if (dso.getType() == Constants.COMMUNITY) {
|
||||
Community comm = (Community) dso;
|
||||
defaultTitle = comm.getName();
|
||||
@@ -217,8 +219,9 @@ public class SyndicationFeed {
|
||||
if (comms != null && comms.length() > 1 && comms.contains(comm.getHandle())) {
|
||||
podcastFeed = true;
|
||||
}
|
||||
objectURL = resolveURL(request, comm);
|
||||
}
|
||||
objectURL = resolveURL(request, dso);
|
||||
|
||||
if (logo != null) {
|
||||
logoURL = urlOfBitstream(request, logo);
|
||||
}
|
||||
@@ -247,11 +250,11 @@ public class SyndicationFeed {
|
||||
// add entries for items
|
||||
if (items != null) {
|
||||
List<SyndEntry> entries = new ArrayList<SyndEntry>();
|
||||
for (DSpaceObject itemDSO : items) {
|
||||
if (itemDSO.getType() != Constants.ITEM) {
|
||||
for (IndexableObject idxObj : items) {
|
||||
if (idxObj.getType() != Constants.ITEM) {
|
||||
continue;
|
||||
}
|
||||
Item item = (Item) itemDSO;
|
||||
Item item = (Item) idxObj;
|
||||
boolean hasDate = false;
|
||||
SyndEntry entry = new SyndEntryImpl();
|
||||
entries.add(entry);
|
||||
|
@@ -473,6 +473,26 @@ public class Util {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a list in an array of i sub-lists uniformly sized
|
||||
*
|
||||
* @param idsList the list to split
|
||||
* @param i the number of sublists to return
|
||||
*
|
||||
* @return an array of sub-lists of fixed size
|
||||
*/
|
||||
public static <T> List<T>[] splitList(List<T> idsList, int i) {
|
||||
int setmin = idsList.size() / i;
|
||||
List<T>[] result = new List[i];
|
||||
int offset = 0;
|
||||
for (int idx = 0; idx < i - 1; idx++) {
|
||||
result[idx] = idsList.subList(offset, offset + setmin);
|
||||
offset += setmin;
|
||||
}
|
||||
result[i - 1] = idsList.subList(offset, idsList.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<String> differenceInSubmissionFields(Collection fromCollection, Collection toCollection)
|
||||
throws DCInputsReaderException {
|
||||
DCInputsReader reader = new DCInputsReader();
|
||||
|
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
@@ -83,7 +84,7 @@ public interface OpenSearchService {
|
||||
* @param totalResults - the hit count
|
||||
* @param start - start result index
|
||||
* @param pageSize - page size
|
||||
* @param scope - search scope, null or community/collection handle
|
||||
* @param scope - search scope, null or the community/collection
|
||||
* @param results the retreived DSpace objects satisfying search
|
||||
* @param labels labels to apply - format specific
|
||||
* @return formatted search results
|
||||
@@ -91,7 +92,7 @@ public interface OpenSearchService {
|
||||
*/
|
||||
public String getResultsString(Context context, String format, String query, int totalResults, int start,
|
||||
int pageSize,
|
||||
DSpaceObject scope, List<DSpaceObject> results,
|
||||
IndexableObject scope, List<IndexableObject> results,
|
||||
Map<String, String> labels) throws IOException;
|
||||
|
||||
/**
|
||||
@@ -103,7 +104,7 @@ public interface OpenSearchService {
|
||||
* @param totalResults - the hit count
|
||||
* @param start - start result index
|
||||
* @param pageSize - page size
|
||||
* @param scope - search scope, null or community/collection handle
|
||||
* @param scope - search scope, null or the community/collection
|
||||
* @param results the retreived DSpace objects satisfying search
|
||||
* @param labels labels to apply - format specific
|
||||
* @return formatted search results
|
||||
@@ -111,7 +112,7 @@ public interface OpenSearchService {
|
||||
*/
|
||||
public Document getResultsDoc(Context context, String format, String query, int totalResults, int start,
|
||||
int pageSize,
|
||||
DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels)
|
||||
IndexableObject scope, List<IndexableObject> results, Map<String, String> labels)
|
||||
throws IOException;
|
||||
|
||||
public DSpaceObject resolveScope(Context context, String scope) throws SQLException;
|
||||
|
@@ -767,4 +767,10 @@ public class AuthorizeServiceImpl implements AuthorizeService {
|
||||
return policy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourcePolicy> getPoliciesActionFilterExceptRpType(Context c, DSpaceObject o, int actionID,
|
||||
String rpType) throws SQLException {
|
||||
return resourcePolicyService.findExceptRpType(c, o, actionID, rpType);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -307,4 +307,10 @@ public class ResourcePolicyServiceImpl implements ResourcePolicyService {
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourcePolicy> findExceptRpType(Context c, DSpaceObject o, int actionID, String rpType)
|
||||
throws SQLException {
|
||||
return resourcePolicyDAO.findByDSoAndActionExceptRpType(c, o, actionID, rpType);
|
||||
}
|
||||
}
|
||||
|
@@ -66,4 +66,17 @@ public interface ResourcePolicyDAO extends GenericDAO<ResourcePolicy> {
|
||||
public void deleteByDsoEPersonPolicies(Context context, DSpaceObject dso, EPerson ePerson) throws SQLException;
|
||||
|
||||
public void deleteByDsoAndTypeNotEqualsTo(Context c, DSpaceObject o, String type) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return a list of policies for an object that match the action except the record labeled with the rpType
|
||||
*
|
||||
* @param c context
|
||||
* @param o DSpaceObject policies relate to
|
||||
* @param actionID action (defined in class Constants)
|
||||
* @param rpType the resource policy type
|
||||
* @return list of resource policies
|
||||
* @throws SQLException if there's a database problem
|
||||
*/
|
||||
public List<ResourcePolicy> findByDSoAndActionExceptRpType(Context c, DSpaceObject o, int actionID,
|
||||
String rpType) throws SQLException;
|
||||
}
|
||||
|
@@ -131,8 +131,7 @@ public class ResourcePolicyDAOImpl extends AbstractHibernateDAO<ResourcePolicy>
|
||||
criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.actionId), action),
|
||||
criteriaBuilder
|
||||
.or(criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.eperson), e),
|
||||
criteriaBuilder
|
||||
.in(resourcePolicyRoot.get(ResourcePolicy_.epersonGroup).in(groups)))
|
||||
(resourcePolicyRoot.get(ResourcePolicy_.epersonGroup).in(groups)))
|
||||
)
|
||||
);
|
||||
return list(context, criteriaQuery, false, ResourcePolicy.class, 1, -1);
|
||||
@@ -201,4 +200,35 @@ public class ResourcePolicyDAOImpl extends AbstractHibernateDAO<ResourcePolicy>
|
||||
query.setParameter("rptype", type);
|
||||
query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourcePolicy> findByDSoAndActionExceptRpType(Context context, DSpaceObject dso, int action,
|
||||
String rpType) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ResourcePolicy.class);
|
||||
|
||||
Root<ResourcePolicy> resourcePolicyRoot = criteriaQuery.from(ResourcePolicy.class);
|
||||
criteriaQuery.select(resourcePolicyRoot);
|
||||
if (rpType != null) {
|
||||
criteriaQuery.where(
|
||||
criteriaBuilder.and(criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.dSpaceObject), dso),
|
||||
criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.actionId), action),
|
||||
criteriaBuilder.or(
|
||||
criteriaBuilder.notEqual(resourcePolicyRoot.get(ResourcePolicy_.rptype),
|
||||
rpType),
|
||||
criteriaBuilder.isNull(resourcePolicyRoot.get(ResourcePolicy_.rptype))
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
criteriaQuery.where(
|
||||
criteriaBuilder.and(
|
||||
criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.dSpaceObject), dso),
|
||||
criteriaBuilder.equal(resourcePolicyRoot.get(ResourcePolicy_.actionId), action),
|
||||
criteriaBuilder.isNotNull(resourcePolicyRoot.get(ResourcePolicy_.rptype))
|
||||
)
|
||||
);
|
||||
}
|
||||
return list(context, criteriaQuery, false, ResourcePolicy.class, 1, -1);
|
||||
}
|
||||
}
|
||||
|
@@ -312,6 +312,18 @@ public interface AuthorizeService {
|
||||
*/
|
||||
public List<ResourcePolicy> getPoliciesActionFilter(Context c, DSpaceObject o, int actionID) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return a list of policies for an object that match the action except the record labeled with the rpType
|
||||
*
|
||||
* @param c context
|
||||
* @param o DSpaceObject policies relate to
|
||||
* @param actionID action (defined in class Constants)
|
||||
* @param rpType the resource policy type
|
||||
* @return list of resource policies
|
||||
* @throws SQLException if there's a database problem
|
||||
*/
|
||||
public List<ResourcePolicy> getPoliciesActionFilterExceptRpType(Context c, DSpaceObject o, int actionID,
|
||||
String rpType) throws SQLException;
|
||||
/**
|
||||
* Add policies to an object to match those from a previous object
|
||||
*
|
||||
|
@@ -76,4 +76,16 @@ public interface ResourcePolicyService extends DSpaceCRUDService<ResourcePolicy>
|
||||
public void removeDsoAndTypeNotEqualsToPolicies(Context c, DSpaceObject o, String type)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* Return a list of policies for an object that match the action except the record labeled with the rpType
|
||||
*
|
||||
* @param c context
|
||||
* @param o DSpaceObject policies relate to
|
||||
* @param actionID action (defined in class Constants)
|
||||
* @param rpType the resource policy type
|
||||
* @return list of resource policies
|
||||
* @throws SQLException if there's a database problem
|
||||
*/
|
||||
public List<ResourcePolicy> findExceptRpType(Context c, DSpaceObject o, int actionID, String rpType)
|
||||
throws SQLException;
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.sort.SortException;
|
||||
import org.dspace.sort.SortOption;
|
||||
|
||||
@@ -114,6 +115,8 @@ public class BrowserScope {
|
||||
|
||||
private String authority = null;
|
||||
|
||||
private String userLocale = null;
|
||||
|
||||
/**
|
||||
* Construct a new BrowserScope using the given Context
|
||||
*
|
||||
@@ -131,7 +134,7 @@ public class BrowserScope {
|
||||
* @param dso the container object; a Community or Collection
|
||||
* @throws BrowseException if browse error
|
||||
*/
|
||||
public void setBrowseContainer(DSpaceObject dso)
|
||||
public void setBrowseContainer(IndexableObject dso)
|
||||
throws BrowseException {
|
||||
if (dso instanceof Collection) {
|
||||
this.collection = (Collection) dso;
|
||||
@@ -582,4 +585,12 @@ public class BrowserScope {
|
||||
public void setAuthorityValue(String value) {
|
||||
authority = value;
|
||||
}
|
||||
|
||||
public void setUserLocale(String userLocale) {
|
||||
this.userLocale = userLocale;
|
||||
}
|
||||
|
||||
public String getUserLocale() {
|
||||
return userLocale;
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
@@ -29,6 +28,7 @@ import org.dspace.discovery.DiscoverQuery.SORT_ORDER;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.DiscoverResult.FacetResult;
|
||||
import org.dspace.discovery.DiscoverResult.SearchDocument;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.discovery.SearchService;
|
||||
import org.dspace.discovery.SearchServiceException;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
|
||||
@@ -308,7 +308,7 @@ public class SolrBrowseDAO implements BrowseDAO {
|
||||
DiscoverResult resp = getSolrResponse();
|
||||
|
||||
List<Item> bitems = new ArrayList<>();
|
||||
for (DSpaceObject solrDoc : resp.getDspaceObjects()) {
|
||||
for (IndexableObject<UUID> solrDoc : resp.getIndexableObjects()) {
|
||||
// FIXME introduce project, don't retrieve Item immediately when
|
||||
// processing the query...
|
||||
Item item = (Item) solrDoc;
|
||||
@@ -332,7 +332,7 @@ public class SolrBrowseDAO implements BrowseDAO {
|
||||
}
|
||||
if (resp.getTotalSearchResults() > 0) {
|
||||
SearchDocument doc = resp.getSearchDocument(
|
||||
resp.getDspaceObjects().get(0)).get(0);
|
||||
resp.getIndexableObjects().get(0)).get(0);
|
||||
return (String) doc.getSearchFieldValues(column).get(0);
|
||||
}
|
||||
return null;
|
||||
|
@@ -12,6 +12,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -31,6 +32,7 @@ import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@@ -53,7 +55,7 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@Table(name = "collection")
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
|
||||
public class Collection extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
public class Collection extends DSpaceObject implements DSpaceObjectLegacySupport, IndexableObject<UUID> {
|
||||
|
||||
@Column(name = "collection_id", insertable = false, updatable = false)
|
||||
private Integer legacyId;
|
||||
|
@@ -275,6 +275,15 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
return collectionDAO.findByID(context, Collection.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the find method needed to avoid ambiguity between the IndexableObjectService interface
|
||||
* and the DSpaceObjectService interface
|
||||
*/
|
||||
public Collection findIndexableObject(Context context, UUID id) throws SQLException {
|
||||
return collectionDAO.findByID(context, Collection.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(Context context, Collection collection, String field, String value)
|
||||
throws MissingResourceException, SQLException {
|
||||
@@ -781,6 +790,15 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
return Constants.COLLECTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the getSupportsTypeConstant method needed to avoid ambiguity between the
|
||||
* IndexableObjectService interface and the DSpaceObjectService interface
|
||||
*/
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return getSupportsTypeConstant();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException {
|
||||
List<Collection> myResults = new ArrayList<>();
|
||||
|
@@ -11,6 +11,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -31,6 +32,7 @@ import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@@ -49,7 +51,7 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@Table(name = "community")
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include = "non-lazy")
|
||||
public class Community extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
public class Community extends DSpaceObject implements DSpaceObjectLegacySupport, IndexableObject<UUID> {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
|
@@ -137,6 +137,15 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
return communityDAO.findByID(context, Community.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the find method needed to avoid ambiguity between the IndexableObjectService interface
|
||||
* and the DSpaceObjectService interface
|
||||
*/
|
||||
public Community findIndexableObject(Context context, UUID id) throws SQLException {
|
||||
return find(context, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Community> findAll(Context context) throws SQLException {
|
||||
MetadataField sortField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
@@ -508,6 +517,14 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
return Constants.COMMUNITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the getSupportsTypeConstant method needed to avoid ambiguity between the
|
||||
* IndexableObjectService interface and the DSpaceObjectService interface
|
||||
*/
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return getSupportsTypeConstant();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method to remove the community and all its children from the
|
||||
|
@@ -11,6 +11,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -26,7 +27,6 @@ import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.handle.Handle;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
@@ -37,8 +37,7 @@ import org.hibernate.annotations.GenericGenerator;
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
@Table(name = "dspaceobject")
|
||||
public abstract class DSpaceObject implements Serializable, ReloadableEntity<java.util.UUID>,
|
||||
BrowsableObject<UUID> {
|
||||
public abstract class DSpaceObject implements Serializable, ReloadableEntity<java.util.UUID> {
|
||||
@Id
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
|
||||
|
@@ -10,7 +10,7 @@ package org.dspace.content;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ import org.dspace.eperson.EPerson;
|
||||
* @author Robert Tansley
|
||||
* @version $Revision$
|
||||
*/
|
||||
public interface InProgressSubmission<ID extends Serializable> extends BrowsableObject<ID> {
|
||||
public interface InProgressSubmission<ID extends Serializable> extends IndexableObject<ID> {
|
||||
/**
|
||||
* Get the internal ID of this submission
|
||||
*
|
||||
|
@@ -13,6 +13,7 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
@@ -34,6 +35,7 @@ import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
|
||||
@@ -53,7 +55,7 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "item")
|
||||
public class Item extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
public class Item extends DSpaceObject implements DSpaceObjectLegacySupport, IndexableObject<UUID> {
|
||||
|
||||
/**
|
||||
* log4j logger
|
||||
|
@@ -158,6 +158,15 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the find method needed to avoid ambiguity between the IndexableObjectService interface
|
||||
* and the DSpaceObjectService interface
|
||||
*/
|
||||
public Item findIndexableObject(Context context, UUID id) throws SQLException {
|
||||
return find(context, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException {
|
||||
if (workspaceItem.getItem() != null) {
|
||||
@@ -644,6 +653,15 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
return Constants.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* This method is an alias of the getSupportsTypeConstant method needed to avoid ambiguity between the
|
||||
* IndexableObjectService interface and the DSpaceObjectService interface
|
||||
*/
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return getSupportsTypeConstant();
|
||||
}
|
||||
|
||||
protected void rawDelete(Context context, Item item) throws AuthorizeException, SQLException, IOException {
|
||||
authorizeService.authorizeAction(context, item, Constants.REMOVE);
|
||||
|
||||
|
@@ -27,10 +27,10 @@ import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
@@ -45,7 +45,7 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@Entity
|
||||
@Table(name = "workspaceitem")
|
||||
public class WorkspaceItem
|
||||
implements InProgressSubmission<Integer>, Serializable, ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
||||
implements InProgressSubmission<Integer>, Serializable, ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "workspace_item_id", unique = true, nullable = false)
|
||||
|
@@ -61,12 +61,12 @@ public class WorkspaceItemServiceImpl implements WorkspaceItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportsTypeConstant() {
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return Constants.WORKSPACEITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceItem find(Context context, Integer id) throws SQLException {
|
||||
public WorkspaceItem find(Context context, int id) throws SQLException {
|
||||
WorkspaceItem workspaceItem = workspaceItemDAO.findByID(context, WorkspaceItem.class, id);
|
||||
|
||||
if (workspaceItem == null) {
|
||||
@@ -83,6 +83,14 @@ public class WorkspaceItemServiceImpl implements WorkspaceItemService {
|
||||
return workspaceItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceItem findIndexableObject(Context context, Integer id) throws SQLException {
|
||||
if (id != null) {
|
||||
return find(context, id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceItem create(Context context, Collection collection, boolean template)
|
||||
throws AuthorizeException, SQLException {
|
||||
|
@@ -10,19 +10,18 @@ package org.dspace.content.factory;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.InProgressSubmission;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BrowsableObjectService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||
import org.dspace.content.service.DSpaceObjectService;
|
||||
import org.dspace.content.service.InProgressSubmissionService;
|
||||
import org.dspace.content.service.IndexableObjectService;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
@@ -31,6 +30,7 @@ import org.dspace.content.service.MetadataValueService;
|
||||
import org.dspace.content.service.SiteService;
|
||||
import org.dspace.content.service.SupervisedItemService;
|
||||
import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
|
||||
@@ -42,7 +42,12 @@ import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
*/
|
||||
public abstract class ContentServiceFactory {
|
||||
|
||||
public abstract List<BrowsableObjectService> getBrowsableDSpaceObjectServices();
|
||||
/**
|
||||
* Return the list of all the available implementations of the IndexableObjectService interface
|
||||
*
|
||||
* @return the list of IndexableObjectService
|
||||
*/
|
||||
public abstract List<IndexableObjectService> getIndexableObjectServices();
|
||||
|
||||
public abstract List<DSpaceObjectService<? extends DSpaceObject>> getDSpaceObjectServices();
|
||||
|
||||
@@ -103,15 +108,15 @@ public abstract class ContentServiceFactory {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends BrowsableObject<PK>, PK extends Serializable> BrowsableObjectService<T, PK>
|
||||
getBrowsableDSpaceObjectService(int type) {
|
||||
for (int i = 0; i < getBrowsableDSpaceObjectServices().size(); i++) {
|
||||
BrowsableObjectService objectService = getBrowsableDSpaceObjectServices().get(i);
|
||||
if (objectService.getSupportsTypeConstant() == type) {
|
||||
return (BrowsableObjectService<T, PK>) objectService;
|
||||
public <T extends IndexableObject<PK>, PK extends Serializable> IndexableObjectService<T, PK>
|
||||
getIndexableObjectService(int type) {
|
||||
for (int i = 0; i < getIndexableObjectServices().size(); i++) {
|
||||
IndexableObjectService objectService = getIndexableObjectServices().get(i);
|
||||
if (objectService.getSupportsIndexableObjectTypeConstant() == type) {
|
||||
return (IndexableObjectService<T, PK>) objectService;
|
||||
}
|
||||
}
|
||||
throw new UnsupportedOperationException("Unknown Browsable DSpace type: " + type);
|
||||
throw new UnsupportedOperationException("Unknown Findable Object type: " + type);
|
||||
}
|
||||
|
||||
public DSpaceObjectLegacySupportService<? extends DSpaceObject> getDSpaceLegacyObjectService(int type) {
|
||||
|
@@ -12,12 +12,12 @@ import java.util.List;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BrowsableObjectService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||
import org.dspace.content.service.DSpaceObjectService;
|
||||
import org.dspace.content.service.IndexableObjectService;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
@@ -70,8 +70,8 @@ public class ContentServiceFactoryImpl extends ContentServiceFactory {
|
||||
private SiteService siteService;
|
||||
|
||||
@Override
|
||||
public List<BrowsableObjectService> getBrowsableDSpaceObjectServices() {
|
||||
return new DSpace().getServiceManager().getServicesByType(BrowsableObjectService.class);
|
||||
public List<IndexableObjectService> getIndexableObjectServices() {
|
||||
return new DSpace().getServiceManager().getServicesByType(IndexableObjectService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.content.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
/**
|
||||
* Service interface class for any BrowsableDSpaceObject.
|
||||
* All BrowsableObject service classes should implement this class since it offers some basic methods which all
|
||||
* BrowsableObjects are required to have.
|
||||
*
|
||||
* @param <T> class type
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
public interface BrowsableObjectService<T extends BrowsableObject<PK>, PK extends Serializable> {
|
||||
|
||||
|
||||
/**
|
||||
* Generic find for when the precise type of a BDSO is not known, just the
|
||||
* a pair of type number and database ID.
|
||||
*
|
||||
* @param context - the context
|
||||
* @param id - id within table of type'd objects
|
||||
* @return the object found, or null if it does not exist.
|
||||
* @throws SQLException only upon failure accessing the database.
|
||||
*/
|
||||
public T find(Context context, PK id) throws SQLException;
|
||||
|
||||
/**
|
||||
* Returns the Constants which this service supports
|
||||
*
|
||||
* @return a org.dspace.core.Constants that represents a BrowsableDSpaceObject type
|
||||
*/
|
||||
public int getSupportsTypeConstant();
|
||||
}
|
@@ -13,6 +13,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -30,7 +31,8 @@ import org.dspace.eperson.Group;
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface CollectionService
|
||||
extends DSpaceObjectService<Collection>, DSpaceObjectLegacySupportService<Collection> {
|
||||
extends DSpaceObjectService<Collection>, DSpaceObjectLegacySupportService<Collection>,
|
||||
IndexableObjectService<Collection, UUID> {
|
||||
|
||||
/**
|
||||
* Create a new collection with a new ID.
|
||||
|
@@ -12,6 +12,7 @@ import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -27,7 +28,8 @@ import org.dspace.eperson.Group;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface CommunityService extends DSpaceObjectService<Community>, DSpaceObjectLegacySupportService<Community> {
|
||||
public interface CommunityService extends DSpaceObjectService<Community>, DSpaceObjectLegacySupportService<Community>,
|
||||
IndexableObjectService<Community, UUID> {
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -28,7 +28,17 @@ import org.dspace.core.Context;
|
||||
* @param <T> class type
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface DSpaceObjectService<T extends DSpaceObject> extends BrowsableObjectService<T, UUID> {
|
||||
public interface DSpaceObjectService<T extends DSpaceObject> {
|
||||
|
||||
/**
|
||||
* Generic find for when the precise type of an Entity is not known
|
||||
*
|
||||
* @param context - the context
|
||||
* @param uuid - uuid within table of type'd dspace objects
|
||||
* @return the dspace object found, or null if it does not exist.
|
||||
* @throws SQLException only upon failure accessing the database.
|
||||
*/
|
||||
public T find(Context context, UUID uuid) throws SQLException;
|
||||
|
||||
/**
|
||||
* Get a proper name for the object. This may return <code>null</code>.
|
||||
@@ -361,7 +371,6 @@ public interface DSpaceObjectService<T extends DSpaceObject> extends BrowsableOb
|
||||
|
||||
public void delete(Context context, T dso) throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
|
||||
void addAndShiftRightMetadata(Context context, T dso, String schema, String element, String qualifier, String lang,
|
||||
String value, String authority, int confidence, int index) throws SQLException;
|
||||
|
||||
@@ -370,4 +379,11 @@ public interface DSpaceObjectService<T extends DSpaceObject> extends BrowsableOb
|
||||
|
||||
void moveMetadata(Context context, T dso, String schema, String element, String qualifier, int from, int to)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Returns the Constants which this service supports
|
||||
*
|
||||
* @return a org.dspace.core.Constants that represents a IndexableObject type
|
||||
*/
|
||||
public int getSupportsTypeConstant();
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import org.dspace.core.Context;
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface InProgressSubmissionService<T extends InProgressSubmission<ID>, ID extends Serializable>
|
||||
extends BrowsableObjectService<T, ID> {
|
||||
extends IndexableObjectService<T, ID> {
|
||||
|
||||
/**
|
||||
* Deletes submission wrapper, doesn't delete item contents
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.content.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
|
||||
/**
|
||||
* Base Service interface class for any IndexableObject. The name of the methods contains IndexableObject to avoid
|
||||
* ambiguity reference as some implementation supports both this interface than the DSpaceObectService interface
|
||||
*
|
||||
* @param <T>
|
||||
* class type of the indexable object
|
||||
* @param <PK>
|
||||
* class type of the primary key
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
public interface IndexableObjectService<T extends IndexableObject<PK>, PK extends Serializable> {
|
||||
|
||||
/**
|
||||
* Generic find for when the precise type of an IndexableObject is not known
|
||||
*
|
||||
* @param context - the context
|
||||
* @param id - id within table of type'd indexable objects
|
||||
* @return the indexable object found, or null if it does not exist.
|
||||
* @throws SQLException only upon failure accessing the database.
|
||||
*/
|
||||
public T findIndexableObject(Context context, PK id) throws SQLException;
|
||||
|
||||
/**
|
||||
* Returns the Constants which this service supports
|
||||
*
|
||||
* @return a org.dspace.core.Constants that represents a IndexableObject type
|
||||
*/
|
||||
public int getSupportsIndexableObjectTypeConstant();
|
||||
}
|
@@ -36,7 +36,8 @@ import org.dspace.eperson.Group;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface ItemService extends DSpaceObjectService<Item>, DSpaceObjectLegacySupportService<Item> {
|
||||
public interface ItemService
|
||||
extends DSpaceObjectService<Item>, DSpaceObjectLegacySupportService<Item>, IndexableObjectService<Item, UUID> {
|
||||
|
||||
public Thumbnail getThumbnail(Context context, Item item, boolean requireOriginal) throws SQLException;
|
||||
|
||||
|
@@ -29,6 +29,17 @@ import org.dspace.workflow.WorkflowItem;
|
||||
*/
|
||||
public interface WorkspaceItemService extends InProgressSubmissionService<WorkspaceItem, Integer> {
|
||||
|
||||
/**
|
||||
* Get a workspace item from the database. The item, collection and
|
||||
* submitter are loaded into memory.
|
||||
*
|
||||
* @param context DSpace context object
|
||||
* @param id ID of the workspace item
|
||||
* @return the workspace item, or null if the ID is invalid.
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public WorkspaceItem find(Context context, int id) throws SQLException;
|
||||
|
||||
/**
|
||||
* Create a new workspace item, with a new ID. An Item is also created. The
|
||||
* submitter is the current user in the context.
|
||||
|
@@ -69,6 +69,8 @@ public class DiscoverQuery {
|
||||
**/
|
||||
private Map<String, List<String>> properties;
|
||||
|
||||
private String discoveryConfigurationName;
|
||||
|
||||
public DiscoverQuery() {
|
||||
//Initialize all our lists
|
||||
this.filterQueries = new ArrayList<String>();
|
||||
@@ -331,6 +333,7 @@ public class DiscoverQuery {
|
||||
// Example: 2001 and a gap from 10 we need the following result: 2010 - 2000 ; 2000 - 1990 hence the top
|
||||
// year
|
||||
int topYear = getTopYear(newestYear, gap);
|
||||
|
||||
if (gap == 1) {
|
||||
//We need a list of our years
|
||||
//We have a date range add faceting for our field
|
||||
@@ -376,4 +379,22 @@ public class DiscoverQuery {
|
||||
return (int) (Math.ceil((float) (newestYear) / gap) * gap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of discovery configuration used by this query
|
||||
*
|
||||
* @return the discovery configuration name used
|
||||
*/
|
||||
public String getDiscoveryConfigurationName() {
|
||||
return discoveryConfigurationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of discovery configuration to use to run this query
|
||||
*
|
||||
* @param discoveryConfigurationName
|
||||
* the name of the discovery configuration to use to run this query
|
||||
*/
|
||||
public void setDiscoveryConfigurationName(String discoveryConfigurationName) {
|
||||
this.discoveryConfigurationName = discoveryConfigurationName;
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||
|
||||
@@ -28,32 +27,31 @@ public class DiscoverResult {
|
||||
|
||||
private long totalSearchResults;
|
||||
private int start;
|
||||
private List<DSpaceObject> dspaceObjects;
|
||||
private List<IndexableObject> indexableObjects;
|
||||
private Map<String, List<FacetResult>> facetResults;
|
||||
|
||||
/**
|
||||
* A map that contains all the documents sougth after, the key is a string representation of the DSpace object
|
||||
* A map that contains all the documents sougth after, the key is a string representation of the Indexable Object
|
||||
*/
|
||||
private Map<String, List<SearchDocument>> searchDocuments;
|
||||
private int maxResults = -1;
|
||||
private int searchTime;
|
||||
private Map<String, DSpaceObjectHighlightResult> highlightedResults;
|
||||
private Map<String, IndexableObjectHighlightResult> highlightedResults;
|
||||
private String spellCheckQuery;
|
||||
|
||||
|
||||
public DiscoverResult() {
|
||||
dspaceObjects = new ArrayList<DSpaceObject>();
|
||||
indexableObjects = new ArrayList<IndexableObject>();
|
||||
facetResults = new LinkedHashMap<String, List<FacetResult>>();
|
||||
searchDocuments = new LinkedHashMap<String, List<SearchDocument>>();
|
||||
highlightedResults = new HashMap<String, DSpaceObjectHighlightResult>();
|
||||
highlightedResults = new HashMap<String, IndexableObjectHighlightResult>();
|
||||
}
|
||||
|
||||
|
||||
public void addDSpaceObject(DSpaceObject dso) {
|
||||
this.dspaceObjects.add(dso);
|
||||
public void addIndexableObject(IndexableObject idxObj) {
|
||||
this.indexableObjects.add(idxObj);
|
||||
}
|
||||
|
||||
public List<DSpaceObject> getDspaceObjects() {
|
||||
return dspaceObjects;
|
||||
public List<IndexableObject> getIndexableObjects() {
|
||||
return indexableObjects;
|
||||
}
|
||||
|
||||
public long getTotalSearchResults() {
|
||||
@@ -107,19 +105,19 @@ public class DiscoverResult {
|
||||
|
||||
public List<FacetResult> getFacetResult(DiscoverySearchFilterFacet field) {
|
||||
List<DiscoverResult.FacetResult> facetValues = getFacetResult(field.getIndexFieldName());
|
||||
//Check if we are dealing with a date, sometimes the facet values arrive as dates !
|
||||
// Check if we are dealing with a date, sometimes the facet values arrive as dates !
|
||||
if (facetValues.size() == 0 && field.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)) {
|
||||
facetValues = getFacetResult(field.getIndexFieldName() + ".year");
|
||||
}
|
||||
return ListUtils.emptyIfNull(facetValues);
|
||||
}
|
||||
|
||||
public DSpaceObjectHighlightResult getHighlightedResults(DSpaceObject dso) {
|
||||
return highlightedResults.get(dso.getHandle());
|
||||
public IndexableObjectHighlightResult getHighlightedResults(IndexableObject dso) {
|
||||
return highlightedResults.get(dso.getUniqueIndexID());
|
||||
}
|
||||
|
||||
public void addHighlightedResult(DSpaceObject dso, DSpaceObjectHighlightResult highlightedResult) {
|
||||
this.highlightedResults.put(dso.getHandle(), highlightedResult);
|
||||
public void addHighlightedResult(IndexableObject dso, IndexableObjectHighlightResult highlightedResult) {
|
||||
this.highlightedResults.put(dso.getUniqueIndexID(), highlightedResult);
|
||||
}
|
||||
|
||||
public static final class FacetResult {
|
||||
@@ -131,7 +129,7 @@ public class DiscoverResult {
|
||||
private String fieldType;
|
||||
|
||||
public FacetResult(String asFilterQuery, String displayedValue, String authorityKey, String sortValue,
|
||||
long count, String fieldType) {
|
||||
long count, String fieldType) {
|
||||
this.asFilterQuery = asFilterQuery;
|
||||
this.displayedValue = displayedValue;
|
||||
this.authorityKey = authorityKey;
|
||||
@@ -141,6 +139,10 @@ public class DiscoverResult {
|
||||
}
|
||||
|
||||
public String getAsFilterQuery() {
|
||||
if (asFilterQuery == null) {
|
||||
// missing facet filter query
|
||||
return "[* TO *]";
|
||||
}
|
||||
return asFilterQuery;
|
||||
}
|
||||
|
||||
@@ -161,7 +163,7 @@ public class DiscoverResult {
|
||||
}
|
||||
|
||||
public String getFilterType() {
|
||||
return authorityKey != null ? "authority" : "equals";
|
||||
return authorityKey != null ? "authority" : asFilterQuery != null ? "equals" : "notequals";
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
@@ -177,30 +179,51 @@ public class DiscoverResult {
|
||||
this.spellCheckQuery = spellCheckQuery;
|
||||
}
|
||||
|
||||
public static final class DSpaceObjectHighlightResult {
|
||||
private DSpaceObject dso;
|
||||
/**
|
||||
* An utility class to represent the highlighting section of a Discovery Search
|
||||
*
|
||||
*/
|
||||
public static final class IndexableObjectHighlightResult {
|
||||
private IndexableObject indexableObject;
|
||||
private Map<String, List<String>> highlightResults;
|
||||
|
||||
public DSpaceObjectHighlightResult(DSpaceObject dso, Map<String, List<String>> highlightResults) {
|
||||
this.dso = dso;
|
||||
public IndexableObjectHighlightResult(IndexableObject idxObj, Map<String, List<String>> highlightResults) {
|
||||
this.indexableObject = idxObj;
|
||||
this.highlightResults = highlightResults;
|
||||
}
|
||||
|
||||
public DSpaceObject getDso() {
|
||||
return dso;
|
||||
/**
|
||||
* Return the indexable object that the highlighting snippets refer to
|
||||
*
|
||||
* @return the indexable object
|
||||
*/
|
||||
public IndexableObject getIndexableObject() {
|
||||
return indexableObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* The matching snippets for a specific metadata ignoring any authority value
|
||||
*
|
||||
* @param metadataKey
|
||||
* the metadata where the snippets have been found
|
||||
* @return the matching snippets
|
||||
*/
|
||||
public List<String> getHighlightResults(String metadataKey) {
|
||||
return highlightResults.get(metadataKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* All the matching snippets in whatever metadata ignoring any authority value
|
||||
*
|
||||
* @return All the matching snippets
|
||||
*/
|
||||
public Map<String, List<String>> getHighlightResults() {
|
||||
return highlightResults;
|
||||
}
|
||||
}
|
||||
|
||||
public void addSearchDocument(DSpaceObject dso, SearchDocument searchDocument) {
|
||||
String dsoString = SearchDocument.getDspaceObjectStringRepresentation(dso);
|
||||
public void addSearchDocument(IndexableObject dso, SearchDocument searchDocument) {
|
||||
String dsoString = SearchDocument.getIndexableObjectStringRepresentation(dso);
|
||||
List<SearchDocument> docs = searchDocuments.get(dsoString);
|
||||
if (docs == null) {
|
||||
docs = new ArrayList<SearchDocument>();
|
||||
@@ -212,11 +235,12 @@ public class DiscoverResult {
|
||||
/**
|
||||
* Returns all the sought after search document values
|
||||
*
|
||||
* @param dso the dspace object we want our search documents for
|
||||
* @param idxObj
|
||||
* the indexable object we want our search documents for
|
||||
* @return the search documents list
|
||||
*/
|
||||
public List<SearchDocument> getSearchDocument(DSpaceObject dso) {
|
||||
String dsoString = SearchDocument.getDspaceObjectStringRepresentation(dso);
|
||||
public List<SearchDocument> getSearchDocument(IndexableObject idxObj) {
|
||||
String dsoString = SearchDocument.getIndexableObjectStringRepresentation(idxObj);
|
||||
List<SearchDocument> result = searchDocuments.get(dsoString);
|
||||
if (result == null) {
|
||||
return new ArrayList<SearchDocument>();
|
||||
@@ -256,8 +280,8 @@ public class DiscoverResult {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDspaceObjectStringRepresentation(DSpaceObject dso) {
|
||||
return dso.getType() + ":" + dso.getID();
|
||||
public static String getIndexableObjectStringRepresentation(IndexableObject idxObj) {
|
||||
return idxObj.getType() + ":" + idxObj.getID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||
|
||||
@@ -46,8 +45,8 @@ public class FacetYearRange {
|
||||
return oldestYear != -1 && newestYear != -1;
|
||||
}
|
||||
|
||||
public void calculateRange(Context context, List<String> filterQueries, DSpaceObject scope,
|
||||
SearchService searchService) throws SearchServiceException {
|
||||
public void calculateRange(Context context, List<String> filterQueries, IndexableObject scope,
|
||||
SearchService searchService, DiscoverQuery parentQuery) throws SearchServiceException {
|
||||
dateFacet = facet.getIndexFieldName() + ".year";
|
||||
//Get a range query so we can create facet queries ranging from our first to our last date
|
||||
//Attempt to determine our oldest & newest year by checking for previously selected filters
|
||||
@@ -55,7 +54,7 @@ public class FacetYearRange {
|
||||
|
||||
//Check if we have found a range, if not then retrieve our first & last year using Solr
|
||||
if (oldestYear == -1 && newestYear == -1) {
|
||||
calculateNewRangeBasedOnSearchIndex(context, filterQueries, scope, searchService);
|
||||
calculateNewRangeBasedOnSearchIndex(context, filterQueries, scope, searchService, parentQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +92,11 @@ public class FacetYearRange {
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateNewRangeBasedOnSearchIndex(Context context, List<String> filterQueries, DSpaceObject scope,
|
||||
SearchService searchService) throws SearchServiceException {
|
||||
private void calculateNewRangeBasedOnSearchIndex(Context context, List<String> filterQueries,
|
||||
IndexableObject scope, SearchService searchService,
|
||||
DiscoverQuery parentQuery) throws SearchServiceException {
|
||||
DiscoverQuery yearRangeQuery = new DiscoverQuery();
|
||||
yearRangeQuery.setDiscoveryConfigurationName(parentQuery.getDiscoveryConfigurationName());
|
||||
yearRangeQuery.setMaxResults(1);
|
||||
//Set our query to anything that has this value
|
||||
yearRangeQuery.addFieldPresentQueries(dateFacet);
|
||||
@@ -105,9 +106,9 @@ public class FacetYearRange {
|
||||
yearRangeQuery.addSearchField(dateFacet);
|
||||
DiscoverResult lastYearResult = searchService.search(context, scope, yearRangeQuery);
|
||||
|
||||
if (0 < lastYearResult.getDspaceObjects().size()) {
|
||||
if (0 < lastYearResult.getIndexableObjects().size()) {
|
||||
List<DiscoverResult.SearchDocument> searchDocuments = lastYearResult
|
||||
.getSearchDocument(lastYearResult.getDspaceObjects().get(0));
|
||||
.getSearchDocument(lastYearResult.getIndexableObjects().get(0));
|
||||
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
||||
oldestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
||||
}
|
||||
@@ -115,9 +116,9 @@ public class FacetYearRange {
|
||||
//Now get the first year
|
||||
yearRangeQuery.setSortField(dateFacet + "_sort", DiscoverQuery.SORT_ORDER.desc);
|
||||
DiscoverResult firstYearResult = searchService.search(context, scope, yearRangeQuery);
|
||||
if (0 < firstYearResult.getDspaceObjects().size()) {
|
||||
if (0 < firstYearResult.getIndexableObjects().size()) {
|
||||
List<DiscoverResult.SearchDocument> searchDocuments = firstYearResult
|
||||
.getSearchDocument(firstYearResult.getDspaceObjects().get(0));
|
||||
.getSearchDocument(firstYearResult.getIndexableObjects().get(0));
|
||||
if (0 < searchDocuments.size() && 0 < searchDocuments.get(0).getSearchFieldValues(dateFacet).size()) {
|
||||
newestYear = Integer.parseInt(searchDocuments.get(0).getSearchFieldValues(dateFacet).get(0));
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.discovery;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
@@ -19,7 +20,6 @@ import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
@@ -59,7 +59,7 @@ public class IndexClient {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
String usage = "org.dspace.discovery.IndexClient [-cbhf] | [-r <handle>] | [-i <handle>] or nothing to " +
|
||||
"update/clean an existing index.";
|
||||
"update/clean an existing index.";
|
||||
Options options = new Options();
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
CommandLine line = null;
|
||||
@@ -72,10 +72,10 @@ public class IndexClient {
|
||||
.create("r"));
|
||||
|
||||
options.addOption(OptionBuilder
|
||||
.withArgName("handle to add or update")
|
||||
.withArgName("handle or uuid to add or update")
|
||||
.hasArg(true)
|
||||
.withDescription(
|
||||
"add or update an Item, Collection or Community based on its handle")
|
||||
"add or update an Item, Collection or Community based on its handle or uuid")
|
||||
.create("i"));
|
||||
|
||||
options.addOption(OptionBuilder
|
||||
@@ -151,17 +151,36 @@ public class IndexClient {
|
||||
} else if (line.hasOption('s')) {
|
||||
checkRebuildSpellCheck(line, indexer);
|
||||
} else if (line.hasOption('i')) {
|
||||
final String handle = line.getOptionValue('i');
|
||||
final DSpaceObject dso = HandleServiceFactory.getInstance().getHandleService()
|
||||
.resolveToObject(context, handle);
|
||||
if (dso == null) {
|
||||
throw new IllegalArgumentException("Cannot resolve " + handle + " to a DSpace object");
|
||||
final String param = line.getOptionValue('i');
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(param);
|
||||
} catch (Exception e) {
|
||||
// nothing to do, it should be an handle
|
||||
}
|
||||
log.info("Forcibly Indexing " + handle);
|
||||
IndexableObject dso = null;
|
||||
if (uuid != null) {
|
||||
dso = ContentServiceFactory.getInstance().getItemService().find(context, uuid);
|
||||
if (dso == null) {
|
||||
// it could be a community
|
||||
dso = ContentServiceFactory.getInstance().getCommunityService().find(context, uuid);
|
||||
if (dso == null) {
|
||||
// it could be a collection
|
||||
dso = ContentServiceFactory.getInstance().getCollectionService().find(context, uuid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dso = (IndexableObject) HandleServiceFactory.getInstance()
|
||||
.getHandleService().resolveToObject(context, param);
|
||||
}
|
||||
if (dso == null) {
|
||||
throw new IllegalArgumentException("Cannot resolve " + param + " to a DSpace object");
|
||||
}
|
||||
log.info("Indexing " + param + " force " + line.hasOption("f"));
|
||||
final long startTimeMillis = System.currentTimeMillis();
|
||||
final long count = indexAll(indexer, ContentServiceFactory.getInstance().getItemService(), context, dso);
|
||||
final long seconds = (System.currentTimeMillis() - startTimeMillis) / 1000;
|
||||
log.info("Indexed " + count + " DSpace object" + (count > 1 ? "s" : "") + " in " + seconds + " seconds");
|
||||
log.info("Indexed " + count + " object" + (count > 1 ? "s" : "") + " in " + seconds + " seconds");
|
||||
} else {
|
||||
log.info("Updating and Cleaning Index");
|
||||
indexer.cleanIndex(line.hasOption("f"));
|
||||
@@ -186,7 +205,7 @@ public class IndexClient {
|
||||
private static long indexAll(final IndexingService indexingService,
|
||||
final ItemService itemService,
|
||||
final Context context,
|
||||
final DSpaceObject dso)
|
||||
final IndexableObject dso)
|
||||
throws IOException, SearchServiceException, SQLException {
|
||||
long count = 0;
|
||||
|
||||
|
@@ -33,10 +33,10 @@ public class IndexEventConsumer implements Consumer {
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(IndexEventConsumer.class);
|
||||
|
||||
// collect Items, Collections, Communities that need indexing
|
||||
private Set<DSpaceObject> objectsToUpdate = null;
|
||||
private Set<IndexableObject> objectsToUpdate = null;
|
||||
|
||||
// handles to delete since IDs are not useful by now.
|
||||
private Set<String> handlesToDelete = null;
|
||||
// unique search IDs to delete
|
||||
private Set<String> uniqueIdsToDelete = null;
|
||||
|
||||
IndexingService indexer = DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName(IndexingService.class.getName(),
|
||||
@@ -58,8 +58,8 @@ public class IndexEventConsumer implements Consumer {
|
||||
public void consume(Context ctx, Event event) throws Exception {
|
||||
|
||||
if (objectsToUpdate == null) {
|
||||
objectsToUpdate = new HashSet<DSpaceObject>();
|
||||
handlesToDelete = new HashSet<String>();
|
||||
objectsToUpdate = new HashSet<IndexableObject>();
|
||||
uniqueIdsToDelete = new HashSet<String>();
|
||||
}
|
||||
|
||||
int st = event.getSubjectType();
|
||||
@@ -107,7 +107,7 @@ public class IndexEventConsumer implements Consumer {
|
||||
+ ", perhaps it has been deleted.");
|
||||
} else {
|
||||
log.debug("consume() adding event to update queue: " + event.toString());
|
||||
objectsToUpdate.add(subject);
|
||||
objectsToUpdate.add((IndexableObject)subject);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -120,17 +120,17 @@ public class IndexEventConsumer implements Consumer {
|
||||
+ ", perhaps it has been deleted.");
|
||||
} else {
|
||||
log.debug("consume() adding event to update queue: " + event.toString());
|
||||
objectsToUpdate.add(object);
|
||||
objectsToUpdate.add((IndexableObject)object);
|
||||
}
|
||||
break;
|
||||
|
||||
case Event.DELETE:
|
||||
String detail = event.getDetail();
|
||||
if (detail == null) {
|
||||
log.warn("got null detail on DELETE event, skipping it.");
|
||||
if (event.getSubjectType() == -1 || event.getSubjectID() == null) {
|
||||
log.warn("got null subject type and/or ID on DELETE event, skipping it.");
|
||||
} else {
|
||||
String detail = event.getSubjectType() + "-" + event.getSubjectID().toString();
|
||||
log.debug("consume() adding event to delete queue: " + event.toString());
|
||||
handlesToDelete.add(detail);
|
||||
uniqueIdsToDelete.add(detail);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -151,37 +151,37 @@ public class IndexEventConsumer implements Consumer {
|
||||
@Override
|
||||
public void end(Context ctx) throws Exception {
|
||||
|
||||
if (objectsToUpdate != null && handlesToDelete != null) {
|
||||
if (objectsToUpdate != null && uniqueIdsToDelete != null) {
|
||||
|
||||
// update the changed Items not deleted because they were on create list
|
||||
for (DSpaceObject o : objectsToUpdate) {
|
||||
for (IndexableObject iu : objectsToUpdate) {
|
||||
/* we let all types through here and
|
||||
* allow the search indexer to make
|
||||
* decisions on indexing and/or removal
|
||||
*/
|
||||
DSpaceObject iu = ctx.reloadEntity(o);
|
||||
String hdl = iu.getHandle();
|
||||
if (hdl != null && !handlesToDelete.contains(hdl)) {
|
||||
iu = ctx.reloadEntity(iu);
|
||||
String uniqueIndexID = iu.getUniqueIndexID();
|
||||
if (uniqueIndexID != null && !uniqueIdsToDelete.contains(uniqueIndexID)) {
|
||||
try {
|
||||
indexer.indexContent(ctx, iu, true);
|
||||
indexer.indexContent(ctx, iu, true, true);
|
||||
log.debug("Indexed "
|
||||
+ Constants.typeText[iu.getType()]
|
||||
+ ", id=" + String.valueOf(iu.getID())
|
||||
+ ", handle=" + hdl);
|
||||
+ ", unique_id=" + uniqueIndexID);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed while indexing object: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String hdl : handlesToDelete) {
|
||||
for (String uid : uniqueIdsToDelete) {
|
||||
try {
|
||||
indexer.unIndexContent(ctx, hdl, true);
|
||||
indexer.unIndexContent(ctx, uid, true);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UN-Indexed Item, handle=" + hdl);
|
||||
log.debug("UN-Indexed Item, handle=" + uid);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed while UN-indexing object: " + hdl, e);
|
||||
log.error("Failed while UN-indexing object: " + uid, e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class IndexEventConsumer implements Consumer {
|
||||
|
||||
// "free" the resources
|
||||
objectsToUpdate = null;
|
||||
handlesToDelete = null;
|
||||
uniqueIdsToDelete = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -5,21 +5,22 @@
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.browse;
|
||||
package org.dspace.discovery;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
||||
/**
|
||||
* This is the basic interface that a data model entity need to implement to support browsing/retrieval
|
||||
* This is the basic interface that a data model entity need to implement to be indexable in Discover
|
||||
*
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*
|
||||
* @param <PK>
|
||||
* the Class of the primary key
|
||||
*/
|
||||
public interface BrowsableObject<PK extends Serializable> {
|
||||
public interface IndexableObject<PK extends Serializable> extends ReloadableEntity<PK> {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,12 +28,6 @@ public interface BrowsableObject<PK extends Serializable> {
|
||||
*/
|
||||
public int getType();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the primary key of the Entity instance
|
||||
*/
|
||||
public PK getID();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return an unique id to index
|
@@ -10,11 +10,10 @@ package org.dspace.discovery;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
/**
|
||||
* Interface used for indexing dspaceobject into discovery
|
||||
* Interface used for indexing IndexableObject into discovery
|
||||
*
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
@@ -22,28 +21,28 @@ import org.dspace.core.Context;
|
||||
*/
|
||||
public interface IndexingService {
|
||||
|
||||
void indexContent(Context context, DSpaceObject dso)
|
||||
void indexContent(Context context, IndexableObject dso)
|
||||
throws SQLException;
|
||||
|
||||
void indexContent(Context context, DSpaceObject dso,
|
||||
void indexContent(Context context, IndexableObject dso,
|
||||
boolean force) throws SQLException;
|
||||
|
||||
void indexContent(Context context, DSpaceObject dso,
|
||||
void indexContent(Context context, IndexableObject dso,
|
||||
boolean force, boolean commit) throws SQLException, SearchServiceException;
|
||||
|
||||
void unIndexContent(Context context, DSpaceObject dso)
|
||||
void unIndexContent(Context context, IndexableObject dso)
|
||||
throws SQLException, IOException;
|
||||
|
||||
void unIndexContent(Context context, DSpaceObject dso, boolean commit)
|
||||
void unIndexContent(Context context, IndexableObject dso, boolean commit)
|
||||
throws SQLException, IOException;
|
||||
|
||||
void unIndexContent(Context context, String handle)
|
||||
throws SQLException, IOException;
|
||||
void unIndexContent(Context context, String uniqueSearchID)
|
||||
throws IOException;
|
||||
|
||||
void unIndexContent(Context context, String handle, boolean commit)
|
||||
throws SQLException, IOException;
|
||||
void unIndexContent(Context context, String uniqueSearchID, boolean commit)
|
||||
throws IOException;
|
||||
|
||||
void reIndexContent(Context context, DSpaceObject dso)
|
||||
void reIndexContent(Context context, IndexableObject dso)
|
||||
throws SQLException, IOException;
|
||||
|
||||
void createIndex(Context context) throws SQLException, IOException;
|
||||
@@ -52,9 +51,14 @@ public interface IndexingService {
|
||||
|
||||
void updateIndex(Context context, boolean force);
|
||||
|
||||
void updateIndex(Context context, boolean force, int type);
|
||||
|
||||
void cleanIndex(boolean force) throws IOException,
|
||||
SQLException, SearchServiceException;
|
||||
|
||||
void cleanIndex(boolean force, int type) throws IOException,
|
||||
SQLException, SearchServiceException;
|
||||
|
||||
void commit() throws SearchServiceException;
|
||||
|
||||
void optimize() throws SearchServiceException;
|
||||
|
@@ -7,11 +7,9 @@
|
||||
*/
|
||||
package org.dspace.discovery;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.configuration.DiscoveryMoreLikeThisConfiguration;
|
||||
@@ -50,7 +48,7 @@ public interface SearchService {
|
||||
* @return discovery search result object
|
||||
* @throws SearchServiceException if search error
|
||||
*/
|
||||
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query)
|
||||
DiscoverResult search(Context context, IndexableObject dso, DiscoverQuery query)
|
||||
throws SearchServiceException;
|
||||
|
||||
/**
|
||||
@@ -74,19 +72,11 @@ public interface SearchService {
|
||||
* @return discovery search result object
|
||||
* @throws SearchServiceException if search error
|
||||
*/
|
||||
DiscoverResult search(Context context, DSpaceObject dso, DiscoverQuery query, boolean includeWithdrawn)
|
||||
DiscoverResult search(Context context, IndexableObject dso, DiscoverQuery query, boolean includeWithdrawn)
|
||||
throws SearchServiceException;
|
||||
|
||||
|
||||
InputStream searchJSON(Context context, DiscoverQuery query, String jsonIdentifier) throws SearchServiceException;
|
||||
|
||||
InputStream searchJSON(Context context, DiscoverQuery query, DSpaceObject dso, String jsonIdentifier)
|
||||
throws SearchServiceException;
|
||||
|
||||
|
||||
List<DSpaceObject> search(Context context, String query, String orderfield, boolean ascending, int offset, int max,
|
||||
String... filterquery);
|
||||
|
||||
List<IndexableObject> search(Context context, String query, String orderfield, boolean ascending, int offset,
|
||||
int max, String... filterquery);
|
||||
|
||||
/**
|
||||
* Transforms the given string field and value into a filter query
|
||||
@@ -138,8 +128,9 @@ public interface SearchService {
|
||||
*/
|
||||
String escapeQueryChars(String query);
|
||||
|
||||
FacetYearRange getFacetYearRange(Context context, DSpaceObject scope, DiscoverySearchFilterFacet facet,
|
||||
List<String> filterQueries) throws SearchServiceException;
|
||||
FacetYearRange getFacetYearRange(Context context, IndexableObject scope, DiscoverySearchFilterFacet facet,
|
||||
List<String> filterQueries, DiscoverQuery parentQuery)
|
||||
throws SearchServiceException;
|
||||
|
||||
/**
|
||||
* This method returns us either the highest or lowest value for the field that we give to it
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.discovery;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -16,10 +17,12 @@ import java.util.Map;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfigurationService;
|
||||
import org.dspace.kernel.ServiceManager;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Util methods used by discovery
|
||||
@@ -48,13 +51,43 @@ public class SearchUtils {
|
||||
}
|
||||
|
||||
public static DiscoveryConfiguration getDiscoveryConfiguration() {
|
||||
return getDiscoveryConfiguration(null);
|
||||
return getDiscoveryConfiguration(null, null);
|
||||
}
|
||||
|
||||
public static DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso) {
|
||||
return getDiscoveryConfiguration(null, dso);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the discovery configuration to use in a specific scope for the king of search identified by the prefix. A
|
||||
* null prefix mean the normal query, other predefined values are workspace or workflow
|
||||
*
|
||||
* @param prefix
|
||||
* the namespace of the configuration to lookup if any
|
||||
* @param dso
|
||||
* the DSpaceObject
|
||||
* @return the discovery configuration for the specified scope
|
||||
*/
|
||||
public static DiscoveryConfiguration getDiscoveryConfiguration(String prefix, DSpaceObject dso) {
|
||||
if (prefix != null) {
|
||||
return getDiscoveryConfigurationByName(dso != null ? prefix + "." + dso.getHandle() : prefix);
|
||||
} else {
|
||||
return getDiscoveryConfigurationByName(dso != null ? dso.getHandle() : null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the discovery configuration identified by the specified name
|
||||
*
|
||||
* @param configurationName the configuration name assigned to the bean in the
|
||||
* discovery.xml
|
||||
* @return the discovery configuration
|
||||
*/
|
||||
public static DiscoveryConfiguration getDiscoveryConfigurationByName(
|
||||
String configurationName) {
|
||||
DiscoveryConfigurationService configurationService = getConfigurationService();
|
||||
|
||||
return configurationService.getDiscoveryConfiguration(dso);
|
||||
return configurationService.getDiscoveryConfiguration(configurationName);
|
||||
}
|
||||
|
||||
public static DiscoveryConfigurationService getConfigurationService() {
|
||||
@@ -76,23 +109,57 @@ public class SearchUtils {
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Item item) throws SQLException {
|
||||
List<Collection> collections = item.getCollections();
|
||||
return getAllDiscoveryConfigurations(null, collections, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the discovery configuration applicable to the provided workspace item
|
||||
* @param witem a workspace item
|
||||
* @return a list of discovery configuration
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(WorkspaceItem witem) throws SQLException {
|
||||
List<Collection> collections = new ArrayList<Collection>();
|
||||
collections.add(witem.getCollection());
|
||||
return getAllDiscoveryConfigurations("workspace", collections, witem.getItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the discovery configuration applicable to the provided workflow item
|
||||
* @param witem a workflow item
|
||||
* @return a list of discovery configuration
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(WorkflowItem witem) throws SQLException {
|
||||
List<Collection> collections = new ArrayList<Collection>();
|
||||
collections.add(witem.getCollection());
|
||||
return getAllDiscoveryConfigurations("workflow", collections, witem.getItem());
|
||||
}
|
||||
|
||||
private static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(String prefix,
|
||||
List<Collection> collections, Item item)
|
||||
throws SQLException {
|
||||
Map<String, DiscoveryConfiguration> result = new HashMap<String, DiscoveryConfiguration>();
|
||||
|
||||
List<Collection> collections = item.getCollections();
|
||||
for (Collection collection : collections) {
|
||||
DiscoveryConfiguration configuration = getDiscoveryConfiguration(collection);
|
||||
DiscoveryConfiguration configuration = getDiscoveryConfiguration(prefix, collection);
|
||||
if (!result.containsKey(configuration.getId())) {
|
||||
result.put(configuration.getId(), configuration);
|
||||
}
|
||||
}
|
||||
|
||||
//Also add one for the default
|
||||
DiscoveryConfiguration configuration = getDiscoveryConfiguration(null);
|
||||
if (!result.containsKey(configuration.getId())) {
|
||||
result.put(configuration.getId(), configuration);
|
||||
}
|
||||
addConfigurationIfExists(result, prefix);
|
||||
|
||||
return Arrays.asList(result.values().toArray(new DiscoveryConfiguration[result.size()]));
|
||||
}
|
||||
|
||||
private static void addConfigurationIfExists(Map<String, DiscoveryConfiguration> result, String confName) {
|
||||
DiscoveryConfiguration configurationExtra = getDiscoveryConfigurationByName(confName);
|
||||
if (!result.containsKey(configurationExtra.getId())) {
|
||||
result.put(configurationExtra.getId(), configurationExtra);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
@@ -30,7 +29,7 @@ import org.dspace.core.Context;
|
||||
public class SolrServiceContentInOriginalBundleFilterPlugin implements SolrServiceIndexPlugin {
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||
if (dso instanceof Item) {
|
||||
Item item = (Item) dso;
|
||||
boolean hasOriginalBundleWithContent = hasOriginalBundleWithContent(item);
|
||||
|
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
@@ -41,7 +40,7 @@ public class SolrServiceFileInfoPlugin implements SolrServiceIndexPlugin {
|
||||
private static final String SOLR_FIELD_NAME_FOR_DESCRIPTIONS = "original_bundle_descriptions";
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||
if (dso instanceof Item) {
|
||||
Item item = (Item) dso;
|
||||
List<Bundle> bundles = item.getBundles();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
package org.dspace.discovery;
|
||||
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
|
||||
@@ -20,7 +19,7 @@ import org.dspace.core.Context;
|
||||
public class SolrServiceIndexOutputPlugin implements SolrServiceIndexPlugin {
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
System.out.println("Currently indexing: " + dso.getHandle());
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||
System.out.println("Currently indexing: " + dso.getUniqueIndexID());
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
package org.dspace.discovery;
|
||||
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
/**
|
||||
@@ -20,5 +19,5 @@ import org.dspace.core.Context;
|
||||
*/
|
||||
public interface SolrServiceIndexPlugin {
|
||||
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document);
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document);
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.browse.BrowseException;
|
||||
import org.dspace.browse.BrowseIndex;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.authority.service.ChoiceAuthorityService;
|
||||
@@ -57,7 +56,7 @@ public class SolrServiceMetadataBrowseIndexingPlugin implements SolrServiceIndex
|
||||
protected ChoiceAuthorityService choiceAuthorityService;
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||
// Only works for Items
|
||||
if (!(dso instanceof Item)) {
|
||||
return;
|
||||
|
@@ -11,6 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
@@ -54,34 +55,44 @@ public class SolrServiceResourceRestrictionPlugin implements SolrServiceIndexPlu
|
||||
protected ResourcePolicyService resourcePolicyService;
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
try {
|
||||
List<ResourcePolicy> policies = authorizeService.getPoliciesActionFilter(context, dso, Constants.READ);
|
||||
for (ResourcePolicy resourcePolicy : policies) {
|
||||
String fieldValue;
|
||||
if (resourcePolicy.getGroup() != null) {
|
||||
//We have a group add it to the value
|
||||
fieldValue = "g" + resourcePolicy.getGroup().getID();
|
||||
} else {
|
||||
//We have an eperson add it to the value
|
||||
fieldValue = "e" + resourcePolicy.getEPerson().getID();
|
||||
public void additionalIndex(Context context, IndexableObject idxObj, SolrInputDocument document) {
|
||||
if (idxObj instanceof DSpaceObject) {
|
||||
DSpaceObject dso = (DSpaceObject) idxObj;
|
||||
try {
|
||||
List<ResourcePolicy> policies = authorizeService.getPoliciesActionFilter(context, dso, Constants.READ);
|
||||
for (ResourcePolicy resourcePolicy : policies) {
|
||||
String fieldValue;
|
||||
if (resourcePolicy.getGroup() != null) {
|
||||
//We have a group add it to the value
|
||||
fieldValue = "g" + resourcePolicy.getGroup().getID();
|
||||
} else {
|
||||
//We have an eperson add it to the value
|
||||
fieldValue = "e" + resourcePolicy.getEPerson().getID();
|
||||
|
||||
}
|
||||
|
||||
document.addField("read", fieldValue);
|
||||
|
||||
//remove the policy from the cache to save memory
|
||||
context.uncacheEntity(resourcePolicy);
|
||||
}
|
||||
|
||||
document.addField("read", fieldValue);
|
||||
|
||||
//remove the policy from the cache to save memory
|
||||
context.uncacheEntity(resourcePolicy);
|
||||
} catch (SQLException e) {
|
||||
log.error(LogManager.getHeader(context, "Error while indexing resource policies",
|
||||
"DSpace object: (id " + dso.getID() + " type " + dso.getType() + ")"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(LogManager.getHeader(context, "Error while indexing resource policies",
|
||||
"DSpace object: (id " + dso.getID() + " type " + dso.getType() + ")"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void additionalSearchParameters(Context context, DiscoverQuery discoveryQuery, SolrQuery solrQuery) {
|
||||
try {
|
||||
// skip workspace and workflow queries as security for it them is builtin in the SolrServiceImpl
|
||||
if (StringUtils.startsWith(discoveryQuery.getDiscoveryConfigurationName(),
|
||||
SolrServiceImpl.DISCOVER_WORKSPACE_CONFIGURATION_NAME)
|
||||
|| StringUtils.startsWith(discoveryQuery.getDiscoveryConfigurationName(),
|
||||
SolrServiceImpl.DISCOVER_WORKFLOW_CONFIGURATION_NAME)) {
|
||||
return;
|
||||
}
|
||||
if (!authorizeService.isAdmin(context)) {
|
||||
StringBuilder resourceQuery = new StringBuilder();
|
||||
//Always add the anonymous group id to the query
|
||||
|
@@ -10,7 +10,6 @@ package org.dspace.discovery;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.service.ItemService;
|
||||
@@ -30,7 +29,7 @@ public class SolrServiceSpellIndexingPlugin implements SolrServiceIndexPlugin {
|
||||
protected ItemService itemService;
|
||||
|
||||
@Override
|
||||
public void additionalIndex(Context context, DSpaceObject dso, SolrInputDocument document) {
|
||||
public void additionalIndex(Context context, IndexableObject dso, SolrInputDocument document) {
|
||||
if (dso instanceof Item) {
|
||||
Item item = (Item) dso;
|
||||
List<MetadataValue> dcValues = itemService.getMetadata(item, Item.ANY, Item.ANY, Item.ANY, Item.ANY);
|
||||
|
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
@@ -39,12 +40,14 @@ public class DiscoveryConfigurationService {
|
||||
this.toIgnoreMetadataFields = toIgnoreMetadataFields;
|
||||
}
|
||||
|
||||
public DiscoveryConfiguration getDiscoveryConfiguration(DSpaceObject dso) {
|
||||
public DiscoveryConfiguration getDiscoveryConfiguration(IndexableObject dso) {
|
||||
String name;
|
||||
if (dso == null) {
|
||||
name = "site";
|
||||
} else if (dso instanceof DSpaceObject) {
|
||||
name = ((DSpaceObject) dso).getHandle();
|
||||
} else {
|
||||
name = dso.getHandle();
|
||||
name = dso.getUniqueIndexID();
|
||||
}
|
||||
|
||||
return getDiscoveryConfiguration(name);
|
||||
@@ -64,7 +67,7 @@ public class DiscoveryConfigurationService {
|
||||
}
|
||||
|
||||
public DiscoveryConfiguration getDiscoveryConfigurationByNameOrDso(final String configurationName,
|
||||
final DSpaceObject dso) {
|
||||
final IndexableObject dso) {
|
||||
if (StringUtils.isNotBlank(configurationName) && getMap().containsKey(configurationName)) {
|
||||
return getMap().get(configurationName);
|
||||
} else {
|
||||
|
@@ -28,6 +28,7 @@ import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.DiscoverQuery;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.discovery.SearchServiceException;
|
||||
import org.dspace.discovery.SearchUtils;
|
||||
import org.dspace.eperson.Group;
|
||||
@@ -139,9 +140,10 @@ public class Harvest {
|
||||
DiscoverResult discoverResult = SearchUtils.getSearchService().search(context, discoverQuery);
|
||||
|
||||
// Process results of query into HarvestedItemInfo objects
|
||||
Iterator<DSpaceObject> dsoIterator = discoverResult.getDspaceObjects().iterator();
|
||||
Iterator<IndexableObject> dsoIterator = discoverResult.getIndexableObjects().iterator();
|
||||
while (dsoIterator.hasNext() && ((limit == 0) || (itemCounter < limit))) {
|
||||
DSpaceObject dso = dsoIterator.next();
|
||||
// the query is limited to ITEM
|
||||
DSpaceObject dso = (DSpaceObject) dsoIterator.next();
|
||||
HarvestedItemInfo itemInfo = new HarvestedItemInfo();
|
||||
itemInfo.context = context;
|
||||
itemInfo.handle = dso.getHandle();
|
||||
|
@@ -30,6 +30,16 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
|
||||
public T create(Context context, Item item, Collection collection) throws SQLException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* Get a workflow item from the database.
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param id ID of the workflow item
|
||||
* @return the workflow item, or null if the ID is invalid.
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public T find(Context context, int id) throws SQLException;
|
||||
|
||||
/**
|
||||
* return all workflowitems
|
||||
*
|
||||
|
@@ -54,7 +54,7 @@ public class BasicWorkflowItemServiceImpl implements BasicWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportsTypeConstant() {
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return Constants.WORKFLOWITEM;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BasicWorkflowItemServiceImpl implements BasicWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem find(Context context, Integer id) throws SQLException {
|
||||
public BasicWorkflowItem find(Context context, int id) throws SQLException {
|
||||
BasicWorkflowItem workflowItem = workflowItemDAO.findByID(context, BasicWorkflowItem.class, id);
|
||||
|
||||
if (workflowItem == null) {
|
||||
@@ -90,6 +90,14 @@ public class BasicWorkflowItemServiceImpl implements BasicWorkflowItemService {
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem findIndexableObject(Context context, Integer id) throws SQLException {
|
||||
if (id != null) {
|
||||
return find(context, id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findAll(Context context) throws SQLException {
|
||||
return workflowItemDAO.findAll(context, BasicWorkflowItem.class);
|
||||
|
@@ -18,10 +18,10 @@ import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ import org.dspace.eperson.EPerson;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cwf_claimtask")
|
||||
public class ClaimedTask implements ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
||||
public class ClaimedTask implements ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "claimtask_id")
|
||||
|
@@ -38,7 +38,7 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportsTypeConstant() {
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return Constants.CLAIMEDTASK;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClaimedTask find(Context context, Integer id) throws SQLException {
|
||||
public ClaimedTask findIndexableObject(Context context, Integer id) throws SQLException {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
|
@@ -19,10 +19,10 @@ import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.dspace.eperson.Group;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cwf_pooltask")
|
||||
public class PoolTask implements ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
||||
public class PoolTask implements ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "pooltask_id")
|
||||
|
@@ -49,7 +49,7 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportsTypeConstant() {
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return Constants.POOLTASK;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoolTask find(Context context, Integer id) throws SQLException {
|
||||
public PoolTask findIndexableObject(Context context, Integer id) throws SQLException {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
|
@@ -21,12 +21,12 @@ import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.dspace.workflow.WorkflowItem;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cwf_workflowitem")
|
||||
public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>, BrowsableObject<Integer> {
|
||||
public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>, IndexableObject<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "workflowitem_id")
|
||||
|
@@ -64,7 +64,7 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportsTypeConstant() {
|
||||
public int getSupportsIndexableObjectTypeConstant() {
|
||||
return Constants.WORKFLOWITEM;
|
||||
}
|
||||
|
||||
@@ -78,10 +78,9 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem find(Context context, Integer id) throws SQLException {
|
||||
public XmlWorkflowItem find(Context context, int id) throws SQLException {
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowItemDAO.findByID(context, XmlWorkflowItem.class, id);
|
||||
|
||||
|
||||
if (workflowItem == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(LogManager.getHeader(context, "find_workflow_item",
|
||||
@@ -96,6 +95,14 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem findIndexableObject(Context context, Integer id) throws SQLException {
|
||||
if (id != null) {
|
||||
return find(context, id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findAll(Context context) throws SQLException {
|
||||
return xmlWorkflowItemDAO.findAll(context, XmlWorkflowItem.class);
|
||||
|
@@ -11,7 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.service.BrowsableObjectService;
|
||||
import org.dspace.content.service.IndexableObjectService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
@@ -26,7 +26,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface ClaimedTaskService extends DSpaceCRUDService<ClaimedTask>,
|
||||
BrowsableObjectService<ClaimedTask, Integer> {
|
||||
IndexableObjectService<ClaimedTask, Integer> {
|
||||
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.service.BrowsableObjectService;
|
||||
import org.dspace.content.service.IndexableObjectService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
@@ -26,7 +26,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface PoolTaskService extends DSpaceCRUDService<PoolTask>, BrowsableObjectService<PoolTask, Integer> {
|
||||
public interface PoolTaskService extends DSpaceCRUDService<PoolTask>, IndexableObjectService<PoolTask, Integer> {
|
||||
public List<PoolTask> findByEperson(Context context, EPerson ePerson)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
|
@@ -70,7 +70,7 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public SearchSupportResource getSearchSupport(@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String
|
||||
configurationName)
|
||||
configuration)
|
||||
throws Exception {
|
||||
|
||||
SearchSupportRest searchSupportRest = discoveryRestRepository.getSearchSupport();
|
||||
@@ -82,14 +82,14 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/search")
|
||||
public SearchConfigurationResource getSearchConfiguration(
|
||||
@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String configurationName) throws Exception {
|
||||
@RequestParam(name = "configuration", required = false) String configuration) throws Exception {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Retrieving search configuration for scope " + StringUtils.trimToEmpty(dsoScope)
|
||||
+ " and configuration name " + StringUtils.trimToEmpty(configurationName));
|
||||
+ " and configuration name " + StringUtils.trimToEmpty(configuration));
|
||||
}
|
||||
|
||||
SearchConfigurationRest searchConfigurationRest = discoveryRestRepository
|
||||
.getSearchConfiguration(dsoScope, configurationName);
|
||||
.getSearchConfiguration(dsoScope, configuration);
|
||||
|
||||
SearchConfigurationResource searchConfigurationResource = new SearchConfigurationResource(
|
||||
searchConfigurationRest);
|
||||
@@ -101,20 +101,20 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
public FacetsResource getFacets(@RequestParam(name = "query", required = false) String query,
|
||||
@RequestParam(name = "dsoType", required = false) String dsoType,
|
||||
@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String configurationName,
|
||||
@RequestParam(name = "configuration", required = false) String configuration,
|
||||
List<SearchFilter> searchFilters,
|
||||
Pageable page) throws Exception {
|
||||
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Searching with scope: " + StringUtils.trimToEmpty(dsoScope)
|
||||
+ ", configuration name: " + StringUtils.trimToEmpty(configurationName)
|
||||
+ ", configuration name: " + StringUtils.trimToEmpty(configuration)
|
||||
+ ", dsoType: " + StringUtils.trimToEmpty(dsoType)
|
||||
+ ", query: " + StringUtils.trimToEmpty(query)
|
||||
+ ", filters: " + Objects.toString(searchFilters));
|
||||
}
|
||||
|
||||
SearchResultsRest searchResultsRest = discoveryRestRepository
|
||||
.getAllFacets(query, dsoType, dsoScope, configurationName, searchFilters);
|
||||
.getAllFacets(query, dsoType, dsoScope, configuration, searchFilters);
|
||||
|
||||
FacetsResource facetsResource = new FacetsResource(searchResultsRest, page);
|
||||
halLinkService.addLinks(facetsResource, page);
|
||||
@@ -129,12 +129,12 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
@RequestParam(name = "dsoType", required = false) String dsoType,
|
||||
@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String
|
||||
configurationName,
|
||||
configuration,
|
||||
List<SearchFilter> searchFilters,
|
||||
Pageable page) throws Exception {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Searching with scope: " + StringUtils.trimToEmpty(dsoScope)
|
||||
+ ", configuration name: " + StringUtils.trimToEmpty(configurationName)
|
||||
+ ", configuration name: " + StringUtils.trimToEmpty(configuration)
|
||||
+ ", dsoType: " + StringUtils.trimToEmpty(dsoType)
|
||||
+ ", query: " + StringUtils.trimToEmpty(query)
|
||||
+ ", filters: " + Objects.toString(searchFilters)
|
||||
@@ -144,7 +144,7 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
//Get the Search results in JSON format
|
||||
SearchResultsRest searchResultsRest = null;
|
||||
searchResultsRest = discoveryRestRepository
|
||||
.getSearchObjects(query, dsoType, dsoScope, configurationName, searchFilters, page);
|
||||
.getSearchObjects(query, dsoType, dsoScope, configuration, searchFilters, page);
|
||||
|
||||
//Convert the Search JSON results to paginated HAL resources
|
||||
SearchResultsResource searchResultsResource = new SearchResultsResource(searchResultsRest, utils, page);
|
||||
@@ -155,15 +155,15 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/facets")
|
||||
public FacetConfigurationResource getFacetsConfiguration(
|
||||
@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String configurationName,
|
||||
@RequestParam(name = "configuration", required = false) String configuration,
|
||||
Pageable pageable) throws Exception {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Retrieving facet configuration for scope " + StringUtils.trimToEmpty(dsoScope)
|
||||
+ " and configuration name " + StringUtils.trimToEmpty(configurationName));
|
||||
+ " and configuration name " + StringUtils.trimToEmpty(configuration));
|
||||
}
|
||||
|
||||
FacetConfigurationRest facetConfigurationRest = discoveryRestRepository
|
||||
.getFacetsConfiguration(dsoScope, configurationName);
|
||||
.getFacetsConfiguration(dsoScope, configuration);
|
||||
FacetConfigurationResource facetConfigurationResource = new FacetConfigurationResource(facetConfigurationRest);
|
||||
|
||||
halLinkService.addLinks(facetConfigurationResource, pageable);
|
||||
@@ -176,6 +176,8 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
@RequestParam(name = "query", required = false) String query,
|
||||
@RequestParam(name = "dsoType", required = false) String dsoType,
|
||||
@RequestParam(name = "scope", required = false) String dsoScope,
|
||||
@RequestParam(name = "configuration", required = false) String
|
||||
configuration,
|
||||
List<SearchFilter> searchFilters,
|
||||
Pageable page) throws Exception {
|
||||
if (log.isTraceEnabled()) {
|
||||
@@ -188,7 +190,7 @@ public class DiscoveryRestController implements InitializingBean {
|
||||
}
|
||||
|
||||
FacetResultsRest facetResultsRest = discoveryRestRepository
|
||||
.getFacetObjects(facetName, prefix, query, dsoType, dsoScope, searchFilters, page);
|
||||
.getFacetObjects(facetName, prefix, query, dsoType, dsoScope, configuration, searchFilters, page);
|
||||
|
||||
FacetResultsResource facetResultsResource = new FacetResultsResource(facetResultsRest);
|
||||
|
||||
|
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -22,7 +24,6 @@ import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.dspace.app.rest.utils.ContextUtil;
|
||||
import org.dspace.app.rest.utils.ScopeResolver;
|
||||
import org.dspace.app.util.SyndicationFeed;
|
||||
@@ -30,7 +31,6 @@ import org.dspace.app.util.factory.UtilServiceFactory;
|
||||
import org.dspace.app.util.service.OpenSearchService;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
@@ -38,17 +38,16 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.discovery.DiscoverQuery;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.discovery.SearchServiceException;
|
||||
import org.dspace.discovery.SearchUtils;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilter;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
@@ -113,7 +112,7 @@ public class OpenSearchController {
|
||||
}
|
||||
|
||||
// then the rest - we are processing the query
|
||||
DSpaceObject container = null;
|
||||
IndexableObject<UUID> container = null;
|
||||
|
||||
// support pagination parameters
|
||||
DiscoverQuery queryArgs = new DiscoverQuery();
|
||||
@@ -140,7 +139,7 @@ public class OpenSearchController {
|
||||
|
||||
// format and return results
|
||||
Map<String, String> labelMap = getLabels(request);
|
||||
List<DSpaceObject> dsoResults = qResults.getDspaceObjects();
|
||||
List<IndexableObject> dsoResults = qResults.getIndexableObjects();
|
||||
Document resultsDoc = openSearchService.getResultsDoc(context, format, query,
|
||||
(int) qResults.getTotalSearchResults(), qResults.getStart(),
|
||||
qResults.getMaxResults(), container, dsoResults, labelMap);
|
||||
|
@@ -42,7 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public abstract class AInprogressItemConverter<T extends InProgressSubmission<ID>,
|
||||
R extends AInprogressSubmissionRest<ID>, ID extends Serializable>
|
||||
extends BrowsableDSpaceObjectConverter<T, R> {
|
||||
implements IndexableObjectConverter<T, R> {
|
||||
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(AInprogressItemConverter.class);
|
||||
|
||||
|
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class AuthorityEntryRestConverter extends DSpaceConverter<Choice, AuthorityEntryRest> {
|
||||
public class AuthorityEntryRestConverter implements DSpaceConverter<Choice, AuthorityEntryRest> {
|
||||
|
||||
@Override
|
||||
public AuthorityEntryRest fromModel(Choice choice) {
|
||||
|
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class AuthorityRestConverter extends DSpaceConverter<ChoiceAuthority, AuthorityRest> {
|
||||
public class AuthorityRestConverter implements DSpaceConverter<ChoiceAuthority, AuthorityRest> {
|
||||
|
||||
@Override
|
||||
public AuthorityRest fromModel(ChoiceAuthority step) {
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.BitstreamFormatRest;
|
||||
import org.dspace.content.BitstreamFormat;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -17,9 +18,9 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class BitstreamFormatConverter extends DSpaceConverter<org.dspace.content.BitstreamFormat, BitstreamFormatRest> {
|
||||
public class BitstreamFormatConverter implements DSpaceConverter<BitstreamFormat, BitstreamFormatRest> {
|
||||
@Override
|
||||
public BitstreamFormatRest fromModel(org.dspace.content.BitstreamFormat obj) {
|
||||
public BitstreamFormatRest fromModel(BitstreamFormat obj) {
|
||||
BitstreamFormatRest bf = new BitstreamFormatRest();
|
||||
bf.setDescription(obj.getDescription());
|
||||
bf.setExtensions(bf.getExtensions());
|
||||
@@ -31,7 +32,7 @@ public class BitstreamFormatConverter extends DSpaceConverter<org.dspace.content
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.dspace.content.BitstreamFormat toModel(BitstreamFormatRest obj) {
|
||||
public BitstreamFormat toModel(BitstreamFormatRest obj) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class BrowseIndexConverter extends DSpaceConverter<BrowseIndex, BrowseIndexRest> {
|
||||
public class BrowseIndexConverter implements DSpaceConverter<BrowseIndex, BrowseIndexRest> {
|
||||
@Override
|
||||
public BrowseIndexRest fromModel(BrowseIndex obj) {
|
||||
BrowseIndexRest bir = new BrowseIndexRest();
|
||||
|
@@ -8,7 +8,7 @@
|
||||
package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.ClaimedTaskRest;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class ClaimedTaskConverter
|
||||
extends BrowsableDSpaceObjectConverter<ClaimedTask, org.dspace.app.rest.model.ClaimedTaskRest> {
|
||||
implements IndexableObjectConverter<ClaimedTask, org.dspace.app.rest.model.ClaimedTaskRest> {
|
||||
|
||||
@Autowired
|
||||
private WorkflowItemConverter workflowItemConverter;
|
||||
@@ -49,7 +49,7 @@ public class ClaimedTaskConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(BrowsableObject object) {
|
||||
public boolean supportsModel(IndexableObject object) {
|
||||
return object instanceof ClaimedTask;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.services.RequestService;
|
||||
import org.dspace.services.model.Request;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -37,7 +38,8 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class CollectionConverter
|
||||
extends DSpaceObjectConverter<org.dspace.content.Collection, org.dspace.app.rest.model.CollectionRest> {
|
||||
extends DSpaceObjectConverter<org.dspace.content.Collection, org.dspace.app.rest.model.CollectionRest>
|
||||
implements IndexableObjectConverter<Collection, CollectionRest> {
|
||||
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(CollectionConverter.class);
|
||||
|
||||
@@ -110,4 +112,9 @@ public class CollectionConverter
|
||||
protected Class<org.dspace.content.Collection> getModelClass() {
|
||||
return org.dspace.content.Collection.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(IndexableObject idxo) {
|
||||
return idxo instanceof Collection;
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ import org.dspace.app.rest.model.CommunityRest;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -26,7 +27,9 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class CommunityConverter
|
||||
extends DSpaceObjectConverter<org.dspace.content.Community, org.dspace.app.rest.model.CommunityRest> {
|
||||
extends DSpaceObjectConverter<org.dspace.content.Community, org.dspace.app.rest.model.CommunityRest>
|
||||
implements IndexableObjectConverter<Community, CommunityRest> {
|
||||
|
||||
@Autowired
|
||||
private BitstreamConverter bitstreamConverter;
|
||||
|
||||
@@ -77,4 +80,9 @@ public class CommunityConverter
|
||||
protected Class<org.dspace.content.Community> getModelClass() {
|
||||
return org.dspace.content.Community.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(IndexableObject idxo) {
|
||||
return idxo instanceof Community;
|
||||
}
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@ package org.dspace.app.rest.converter;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
public abstract class DSpaceConverter<M, R> implements Converter<M, R> {
|
||||
public interface DSpaceConverter<M, R> extends Converter<M, R> {
|
||||
@Override
|
||||
public R convert(M source) {
|
||||
public default R convert(M source) {
|
||||
return fromModel(source);
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -20,8 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
public abstract class DSpaceObjectConverter<M extends DSpaceObject, R extends org.dspace.app.rest.model
|
||||
.DSpaceObjectRest>
|
||||
extends BrowsableDSpaceObjectConverter<M, R> {
|
||||
.DSpaceObjectRest> implements DSpaceConverter<M, R> {
|
||||
|
||||
@Autowired(required = true)
|
||||
private MetadataConverter metadataConverter;
|
||||
@@ -43,7 +41,7 @@ public abstract class DSpaceObjectConverter<M extends DSpaceObject, R extends or
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean supportsModel(BrowsableObject object) {
|
||||
public boolean supportsModel(DSpaceObject object) {
|
||||
return object != null && object.getClass().equals(getModelClass());
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ public class DiscoverFacetConfigurationConverter {
|
||||
DiscoveryConfiguration configuration) {
|
||||
FacetConfigurationRest facetConfigurationRest = new FacetConfigurationRest();
|
||||
|
||||
facetConfigurationRest.setConfigurationName(configurationName);
|
||||
facetConfigurationRest.setConfiguration(configurationName);
|
||||
facetConfigurationRest.setScope(scope);
|
||||
|
||||
if (configuration != null) {
|
||||
|
@@ -19,6 +19,7 @@ import org.dspace.core.Context;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -27,8 +28,11 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class DiscoverFacetResultsConverter {
|
||||
@Autowired
|
||||
private DiscoverFacetValueConverter facetValueConverter;
|
||||
|
||||
private DiscoverFacetValueConverter facetValueConverter = new DiscoverFacetValueConverter();
|
||||
@Autowired
|
||||
private SearchFilterToAppliedFilterConverter searchFilterToAppliedFilterConverter;
|
||||
|
||||
public FacetResultsRest convert(Context context, String facetName, String prefix, String query, String dsoType,
|
||||
String dsoScope, List<SearchFilter> searchFilters, DiscoverResult searchResult,
|
||||
@@ -80,8 +84,6 @@ public class DiscoverFacetResultsConverter {
|
||||
|
||||
facetResultsRest.setSearchFilters(searchFilters);
|
||||
|
||||
SearchFilterToAppliedFilterConverter searchFilterToAppliedFilterConverter = new
|
||||
SearchFilterToAppliedFilterConverter();
|
||||
for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(searchFilters)) {
|
||||
facetResultsRest
|
||||
.addAppliedFilter(searchFilterToAppliedFilterConverter.convertSearchFilter(context, searchFilter));
|
||||
|
@@ -9,10 +9,12 @@ package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.SearchFacetValueRest;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* This class' purpose is to convert a DiscoverResult.FacetResult object into a SearchFacetValueRest object
|
||||
*/
|
||||
@Component
|
||||
public class DiscoverFacetValueConverter {
|
||||
|
||||
public SearchFacetValueRest convert(final DiscoverResult.FacetResult value) {
|
||||
|
@@ -50,61 +50,71 @@ public class DiscoverFacetsConverter {
|
||||
return searchResultsRest;
|
||||
}
|
||||
|
||||
|
||||
private void addFacetValues(Context context, final DiscoverResult searchResult,
|
||||
final SearchResultsRest searchResultsRest,
|
||||
final DiscoveryConfiguration configuration) {
|
||||
/**
|
||||
* Fill the facet values information in the SearchResultsRest using the information in the api DiscoverResult object
|
||||
* according to the configuration applied to the discovery query
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace context
|
||||
* @param searchResult
|
||||
* The DiscoverResult containing the discovery result
|
||||
* @param resultsRest
|
||||
* The SearchResultsRest that need to be filled in
|
||||
* @param configuration
|
||||
* The DiscoveryConfiguration applied to the query
|
||||
*/
|
||||
public void addFacetValues(Context context, final DiscoverResult searchResult, final SearchResultsRest resultsRest,
|
||||
final DiscoveryConfiguration configuration) {
|
||||
|
||||
List<DiscoverySearchFilterFacet> facets = configuration.getSidebarFacets();
|
||||
for (DiscoverySearchFilterFacet field : CollectionUtils.emptyIfNull(facets)) {
|
||||
|
||||
List<DiscoverResult.FacetResult> facetValues = searchResult.getFacetResult(field);
|
||||
|
||||
SearchFacetEntryRest facetEntry = new SearchFacetEntryRest(field.getIndexFieldName());
|
||||
int valueCount = 0;
|
||||
facetEntry.setHasMore(false);
|
||||
facetEntry.setFacetLimit(field.getFacetLimit());
|
||||
facetEntry.setExposeMinMax(field.exposeMinAndMaxValue());
|
||||
if (field.exposeMinAndMaxValue()) {
|
||||
handleExposeMinMaxValues(context,field,facetEntry);
|
||||
handleExposeMinMaxValues(context, field, facetEntry);
|
||||
}
|
||||
facetEntry.setExposeMinMax(field.exposeMinAndMaxValue());
|
||||
facetEntry.setFacetType(field.getType());
|
||||
for (DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) {
|
||||
//The discover results contains max facetLimit + 1 values. If we reach the "+1", indicate that there are
|
||||
//more results available.
|
||||
// The discover results contains max facetLimit + 1 values. If we reach the "+1", indicate that there
|
||||
// are
|
||||
// more results available.
|
||||
if (valueCount < field.getFacetLimit()) {
|
||||
SearchFacetValueRest valueRest = facetValueConverter.convert(value);
|
||||
|
||||
facetEntry.addValue(valueRest);
|
||||
} else {
|
||||
facetEntry.setHasMore(true);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(facetEntry.getFacetType())) {
|
||||
facetEntry.setFacetType(value.getFieldType());
|
||||
}
|
||||
|
||||
valueCount++;
|
||||
}
|
||||
|
||||
searchResultsRest.addFacetEntry(facetEntry);
|
||||
resultsRest.addFacetEntry(facetEntry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will fill the facetEntry with the appropriate min and max values if they're not empty
|
||||
* @param context The relevant DSpace context
|
||||
* @param field The DiscoverySearchFilterFacet field to search for this value in solr
|
||||
* @param facetEntry The SearchFacetEntryRest facetEntry for which this needs to be filled in
|
||||
*/
|
||||
private void handleExposeMinMaxValues(Context context,DiscoverySearchFilterFacet field,
|
||||
SearchFacetEntryRest facetEntry) {
|
||||
* This method will fill the facetEntry with the appropriate min and max values if they're not empty
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace context
|
||||
* @param field
|
||||
* The DiscoverySearchFilterFacet field to search for this value in solr
|
||||
* @param facetEntry
|
||||
* The SearchFacetEntryRest facetEntry for which this needs to be filled in
|
||||
*/
|
||||
private void handleExposeMinMaxValues(Context context, DiscoverySearchFilterFacet field,
|
||||
SearchFacetEntryRest facetEntry) {
|
||||
try {
|
||||
String minValue = searchService.calculateExtremeValue(context,
|
||||
field.getIndexFieldName() + "_min",
|
||||
field.getIndexFieldName() + "_min_sort",
|
||||
DiscoverQuery.SORT_ORDER.asc);
|
||||
String maxValue = searchService.calculateExtremeValue(context,
|
||||
field.getIndexFieldName() + "_max",
|
||||
field.getIndexFieldName() + "_max_sort",
|
||||
DiscoverQuery.SORT_ORDER.desc);
|
||||
String minValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_min",
|
||||
field.getIndexFieldName() + "_min_sort", DiscoverQuery.SORT_ORDER.asc);
|
||||
String maxValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_max",
|
||||
field.getIndexFieldName() + "_max_sort", DiscoverQuery.SORT_ORDER.desc);
|
||||
|
||||
if (StringUtils.isNotBlank(minValue) && StringUtils.isNotBlank(maxValue)) {
|
||||
facetEntry.setMinValue(minValue);
|
||||
@@ -115,13 +125,12 @@ public class DiscoverFacetsConverter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setRequestInformation(final Context context, final String query, final String dsoType,
|
||||
final String configurationName, final String scope,
|
||||
final List<SearchFilter> searchFilters, final Pageable page,
|
||||
final SearchResultsRest resultsRest) {
|
||||
resultsRest.setQuery(query);
|
||||
resultsRest.setConfigurationName(configurationName);
|
||||
resultsRest.setConfiguration(configurationName);
|
||||
resultsRest.setDsoType(dsoType);
|
||||
resultsRest.setSort(SearchResultsRest.Sorting.fromPage(page));
|
||||
|
||||
|
@@ -12,23 +12,16 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.rest.converter.query.SearchQueryConverter;
|
||||
import org.dspace.app.rest.model.DSpaceObjectRest;
|
||||
import org.dspace.app.rest.model.SearchFacetEntryRest;
|
||||
import org.dspace.app.rest.model.SearchFacetValueRest;
|
||||
import org.dspace.app.rest.model.RestAddressableModel;
|
||||
import org.dspace.app.rest.model.SearchResultEntryRest;
|
||||
import org.dspace.app.rest.model.SearchResultsRest;
|
||||
import org.dspace.app.rest.parameter.SearchFilter;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.DiscoverQuery;
|
||||
import org.dspace.discovery.DiscoverResult;
|
||||
import org.dspace.discovery.SearchService;
|
||||
import org.dspace.discovery.SearchServiceException;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -43,12 +36,11 @@ public class DiscoverResultConverter {
|
||||
private static final Logger log = Logger.getLogger(DiscoverResultConverter.class);
|
||||
|
||||
@Autowired
|
||||
private List<DSpaceObjectConverter> converters;
|
||||
|
||||
private List<IndexableObjectConverter> converters;
|
||||
@Autowired
|
||||
private SearchService searchService;
|
||||
|
||||
private DiscoverFacetValueConverter facetValueConverter = new DiscoverFacetValueConverter();
|
||||
private DiscoverFacetsConverter facetConverter;
|
||||
@Autowired
|
||||
private SearchFilterToAppliedFilterConverter searchFilterToAppliedFilterConverter;
|
||||
|
||||
public SearchResultsRest convert(final Context context, final String query, final String dsoType,
|
||||
final String configurationName, final String scope,
|
||||
@@ -69,77 +61,19 @@ public class DiscoverResultConverter {
|
||||
}
|
||||
|
||||
private void addFacetValues(Context context, final DiscoverResult searchResult, final SearchResultsRest resultsRest,
|
||||
final DiscoveryConfiguration configuration) {
|
||||
|
||||
List<DiscoverySearchFilterFacet> facets = configuration.getSidebarFacets();
|
||||
for (DiscoverySearchFilterFacet field : CollectionUtils.emptyIfNull(facets)) {
|
||||
List<DiscoverResult.FacetResult> facetValues = searchResult.getFacetResult(field);
|
||||
|
||||
SearchFacetEntryRest facetEntry = new SearchFacetEntryRest(field.getIndexFieldName());
|
||||
int valueCount = 0;
|
||||
facetEntry.setHasMore(false);
|
||||
facetEntry.setFacetLimit(field.getFacetLimit());
|
||||
if (field.exposeMinAndMaxValue()) {
|
||||
handleExposeMinMaxValues(context,field,facetEntry);
|
||||
}
|
||||
facetEntry.setExposeMinMax(field.exposeMinAndMaxValue());
|
||||
for (DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) {
|
||||
//The discover results contains max facetLimit + 1 values. If we reach the "+1", indicate that there are
|
||||
//more results available.
|
||||
if (valueCount < field.getFacetLimit()) {
|
||||
SearchFacetValueRest valueRest = facetValueConverter.convert(value);
|
||||
|
||||
facetEntry.addValue(valueRest);
|
||||
} else {
|
||||
facetEntry.setHasMore(true);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(facetEntry.getFacetType())) {
|
||||
facetEntry.setFacetType(value.getFieldType());
|
||||
}
|
||||
|
||||
valueCount++;
|
||||
}
|
||||
|
||||
resultsRest.addFacetEntry(facetEntry);
|
||||
}
|
||||
final DiscoveryConfiguration configuration) {
|
||||
facetConverter.addFacetValues(context, searchResult, resultsRest, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will fill the facetEntry with the appropriate min and max values if they're not empty
|
||||
* @param context The relevant DSpace context
|
||||
* @param field The DiscoverySearchFilterFacet field to search for this value in solr
|
||||
* @param facetEntry The SearchFacetEntryRest facetEntry for which this needs to be filled in
|
||||
*/
|
||||
private void handleExposeMinMaxValues(Context context,DiscoverySearchFilterFacet field,
|
||||
SearchFacetEntryRest facetEntry) {
|
||||
try {
|
||||
String minValue = searchService.calculateExtremeValue(context,
|
||||
field.getIndexFieldName() + "_min",
|
||||
field.getIndexFieldName() + "_min_sort",
|
||||
DiscoverQuery.SORT_ORDER.asc);
|
||||
String maxValue = searchService.calculateExtremeValue(context,
|
||||
field.getIndexFieldName() + "_max",
|
||||
field.getIndexFieldName() + "_max_sort",
|
||||
DiscoverQuery.SORT_ORDER.desc);
|
||||
|
||||
if (StringUtils.isNotBlank(minValue) && StringUtils.isNotBlank(maxValue)) {
|
||||
facetEntry.setMinValue(minValue);
|
||||
facetEntry.setMaxValue(maxValue);
|
||||
}
|
||||
} catch (SearchServiceException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
private void addSearchResults(final DiscoverResult searchResult, final SearchResultsRest resultsRest) {
|
||||
for (DSpaceObject dspaceObject : CollectionUtils.emptyIfNull(searchResult.getDspaceObjects())) {
|
||||
for (IndexableObject dspaceObject : CollectionUtils.emptyIfNull(searchResult.getIndexableObjects())) {
|
||||
SearchResultEntryRest resultEntry = new SearchResultEntryRest();
|
||||
|
||||
//Convert the DSpace Object to its REST model
|
||||
resultEntry.setDspaceObject(convertDSpaceObject(dspaceObject));
|
||||
resultEntry.setIndexableObject(convertDSpaceObject(dspaceObject));
|
||||
|
||||
//Add hit highlighting for this DSO if present
|
||||
DiscoverResult.DSpaceObjectHighlightResult highlightedResults = searchResult
|
||||
DiscoverResult.IndexableObjectHighlightResult highlightedResults = searchResult
|
||||
.getHighlightedResults(dspaceObject);
|
||||
if (highlightedResults != null && MapUtils.isNotEmpty(highlightedResults.getHighlightResults())) {
|
||||
for (Map.Entry<String, List<String>> metadataHighlight : highlightedResults.getHighlightResults()
|
||||
@@ -152,10 +86,10 @@ public class DiscoverResultConverter {
|
||||
}
|
||||
}
|
||||
|
||||
private DSpaceObjectRest convertDSpaceObject(final DSpaceObject dspaceObject) {
|
||||
for (DSpaceObjectConverter converter : converters) {
|
||||
private RestAddressableModel convertDSpaceObject(final IndexableObject dspaceObject) {
|
||||
for (IndexableObjectConverter<IndexableObject, RestAddressableModel> converter : converters) {
|
||||
if (converter.supportsModel(dspaceObject)) {
|
||||
return converter.fromModel(dspaceObject);
|
||||
return converter.convert(dspaceObject);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -166,7 +100,7 @@ public class DiscoverResultConverter {
|
||||
final List<SearchFilter> searchFilters, final Pageable page,
|
||||
final SearchResultsRest resultsRest) {
|
||||
resultsRest.setQuery(query);
|
||||
resultsRest.setConfigurationName(configurationName);
|
||||
resultsRest.setConfiguration(configurationName);
|
||||
resultsRest.setDsoType(dsoType);
|
||||
|
||||
resultsRest.setScope(scope);
|
||||
@@ -178,12 +112,9 @@ public class DiscoverResultConverter {
|
||||
SearchQueryConverter searchQueryConverter = new SearchQueryConverter();
|
||||
List<SearchFilter> transformedFilters = searchQueryConverter.convert(searchFilters);
|
||||
|
||||
SearchFilterToAppliedFilterConverter searchFilterToAppliedFilterConverter =
|
||||
new SearchFilterToAppliedFilterConverter();
|
||||
for (SearchFilter searchFilter : CollectionUtils.emptyIfNull(transformedFilters)) {
|
||||
|
||||
resultsRest
|
||||
.addAppliedFilter(searchFilterToAppliedFilterConverter.convertSearchFilter(context, searchFilter));
|
||||
.addAppliedFilter(searchFilterToAppliedFilterConverter.convertSearchFilter(context, searchFilter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
|
||||
/**
|
||||
* This is the base converter from/to objects in the DSpace API data model and
|
||||
@@ -17,15 +17,15 @@ import org.dspace.browse.BrowsableObject;
|
||||
* @param <R> the Class in the DSpace REST data model
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
public abstract class BrowsableDSpaceObjectConverter<M extends BrowsableObject,
|
||||
public interface IndexableObjectConverter<M extends IndexableObject,
|
||||
R extends org.dspace.app.rest.model.RestAddressableModel> extends DSpaceConverter<M, R> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bdso
|
||||
* the browsableDSpaceObject to check
|
||||
* @return true if the actual converter implementation is able to manage the supplied BrowsableDSpaceObject
|
||||
* @param idxo
|
||||
* the IndexableObject to check
|
||||
* @return true if the actual converter implementation is able to manage the supplied IndexableObject
|
||||
*/
|
||||
public abstract boolean supportsModel(BrowsableObject bdso);
|
||||
public boolean supportsModel(IndexableObject idxo);
|
||||
|
||||
}
|
@@ -17,6 +17,7 @@ import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -27,7 +28,10 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class ItemConverter extends DSpaceObjectConverter<org.dspace.content.Item, org.dspace.app.rest.model.ItemRest> {
|
||||
public class ItemConverter
|
||||
extends DSpaceObjectConverter<org.dspace.content.Item, org.dspace.app.rest.model.ItemRest>
|
||||
implements IndexableObjectConverter<Item, ItemRest> {
|
||||
|
||||
@Autowired(required = true)
|
||||
private CollectionConverter collectionConverter;
|
||||
@Autowired(required = true)
|
||||
@@ -85,4 +89,8 @@ public class ItemConverter extends DSpaceObjectConverter<org.dspace.content.Item
|
||||
return Item.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(IndexableObject idxo) {
|
||||
return idxo instanceof Item;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class MetadataFieldConverter extends DSpaceConverter<org.dspace.content.MetadataField, MetadataFieldRest> {
|
||||
public class MetadataFieldConverter implements DSpaceConverter<org.dspace.content.MetadataField, MetadataFieldRest> {
|
||||
@Autowired(required = true)
|
||||
private MetadataSchemaConverter metadataSchemaConverter;
|
||||
|
||||
|
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class MetadataSchemaConverter extends DSpaceConverter<org.dspace.content.MetadataSchema, MetadataSchemaRest> {
|
||||
public class MetadataSchemaConverter implements DSpaceConverter<org.dspace.content.MetadataSchema, MetadataSchemaRest> {
|
||||
@Override
|
||||
public MetadataSchemaRest fromModel(org.dspace.content.MetadataSchema obj) {
|
||||
MetadataSchemaRest schema = new MetadataSchemaRest();
|
||||
|
@@ -8,7 +8,7 @@
|
||||
package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.PoolTaskRest;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class PoolTaskConverter
|
||||
extends BrowsableDSpaceObjectConverter<PoolTask, org.dspace.app.rest.model.PoolTaskRest> {
|
||||
implements IndexableObjectConverter<PoolTask, org.dspace.app.rest.model.PoolTaskRest> {
|
||||
|
||||
@Autowired
|
||||
private WorkflowItemConverter workflowItemConverter;
|
||||
@@ -57,7 +57,7 @@ public class PoolTaskConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(BrowsableObject object) {
|
||||
public boolean supportsModel(IndexableObject object) {
|
||||
return object instanceof PoolTask;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class ResourcePolicyConverter extends DSpaceConverter<ResourcePolicy, ResourcePolicyRest> {
|
||||
public class ResourcePolicyConverter implements DSpaceConverter<ResourcePolicy, ResourcePolicyRest> {
|
||||
|
||||
@Autowired
|
||||
ResourcePolicyService resourcePolicyService;
|
||||
|
@@ -13,18 +13,28 @@ import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.service.AuthorityValueService;
|
||||
import org.dspace.core.Context;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* This class' purpose is to convert the SearchFilter object into a SearchResultsRest.AppliedFilter object
|
||||
*/
|
||||
@Component
|
||||
public class SearchFilterToAppliedFilterConverter {
|
||||
|
||||
@Autowired
|
||||
private AuthorityValueService authorityValueService;
|
||||
|
||||
public SearchResultsRest.AppliedFilter convertSearchFilter(Context context, SearchFilter searchFilter) {
|
||||
|
||||
AuthorityValue authorityValue = null;
|
||||
if (searchFilter.hasAuthorityOperator()) {
|
||||
// FIXME this is obviously wrong as it assumes that the authorityValueService is able to retrieve the label
|
||||
// for each Authority. Indeed, the AuthorityValueService regardless to his name is specific of the
|
||||
// "SOLRAuthority" implementation and should not have a prominent role.
|
||||
// Moreover, it is not possible to discover which authority is responsible for the value selected in the
|
||||
// facet as the authority is bind at the metadata level and so a facet could contains values from multiple
|
||||
// authorities
|
||||
// https://jira.duraspace.org/browse/DS-4209
|
||||
authorityValue = authorityValueService.findByUID(context, searchFilter.getValue());
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class SubmissionDefinitionConverter extends DSpaceConverter<SubmissionConfig, SubmissionDefinitionRest> {
|
||||
public class SubmissionDefinitionConverter implements DSpaceConverter<SubmissionConfig, SubmissionDefinitionRest> {
|
||||
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager
|
||||
.getLogger(SubmissionDefinitionConverter.class);
|
||||
|
@@ -36,7 +36,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Andrea Bollini (andrea.bollini at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class SubmissionFormConverter extends DSpaceConverter<DCInputSet, SubmissionFormRest> {
|
||||
public class SubmissionFormConverter implements DSpaceConverter<DCInputSet, SubmissionFormRest> {
|
||||
|
||||
private static final String INPUT_TYPE_ONEBOX = "onebox";
|
||||
private static final String INPUT_TYPE_NAME = "name";
|
||||
|
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
|
||||
*/
|
||||
@Component
|
||||
public class SubmissionSectionConverter extends DSpaceConverter<SubmissionStepConfig, SubmissionSectionRest> {
|
||||
public class SubmissionSectionConverter implements DSpaceConverter<SubmissionStepConfig, SubmissionSectionRest> {
|
||||
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(SubmissionSectionConverter.class);
|
||||
|
||||
|
@@ -9,7 +9,7 @@ package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.WorkflowItemRest;
|
||||
import org.dspace.app.util.SubmissionConfigReaderException;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class WorkflowItemConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(BrowsableObject object) {
|
||||
public boolean supportsModel(IndexableObject object) {
|
||||
return object instanceof XmlWorkflowItem;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ package org.dspace.app.rest.converter;
|
||||
|
||||
import org.dspace.app.rest.model.WorkspaceItemRest;
|
||||
import org.dspace.app.util.SubmissionConfigReaderException;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class WorkspaceItemConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsModel(BrowsableObject object) {
|
||||
public boolean supportsModel(IndexableObject object) {
|
||||
return object instanceof WorkspaceItem;
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ public abstract class DiscoveryRestHalLinkFactory<T> extends HalLinkFactory<T, D
|
||||
try {
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn()
|
||||
.getSearchObjects(data.getQuery(), data.getDsoType(),
|
||||
data.getScope(), data.getConfigurationName(),
|
||||
data.getScope(), data.getConfiguration(),
|
||||
null, null));
|
||||
|
||||
return addFilterParams(uriBuilder, data);
|
||||
@@ -39,13 +39,11 @@ public abstract class DiscoveryRestHalLinkFactory<T> extends HalLinkFactory<T, D
|
||||
}
|
||||
}
|
||||
|
||||
protected UriComponentsBuilder buildFacetBaseLink(final FacetResultsRest data) throws Exception {
|
||||
protected UriComponentsBuilder buildFacetBaseLink(final FacetResultsRest data) {
|
||||
try {
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn()
|
||||
.getFacetValues(data.getFacetEntry().getName(),
|
||||
data.getPrefix(), data.getQuery(),
|
||||
data.getDsoType(), data.getScope(),
|
||||
null, null));
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(
|
||||
getMethodOn().getFacetValues(data.getFacetEntry().getName(), data.getPrefix(), data.getQuery(),
|
||||
data.getDsoType(), data.getScope(), data.getConfiguration(), null, null));
|
||||
|
||||
return addFilterParams(uriBuilder, data);
|
||||
} catch (Exception ex) {
|
||||
@@ -56,9 +54,8 @@ public abstract class DiscoveryRestHalLinkFactory<T> extends HalLinkFactory<T, D
|
||||
|
||||
protected UriComponentsBuilder buildSearchFacetsBaseLink(final SearchResultsRest data) {
|
||||
try {
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn()
|
||||
.getFacets(data.getQuery(), data.getDsoType(), data.getScope(),
|
||||
data.getConfigurationName(), null, null));
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn().getFacets(data.getQuery(), data.getDsoType(),
|
||||
data.getScope(), data.getConfiguration(), null, null));
|
||||
|
||||
uriBuilder = addSortingParms(uriBuilder, data);
|
||||
|
||||
@@ -75,7 +72,7 @@ public abstract class DiscoveryRestHalLinkFactory<T> extends HalLinkFactory<T, D
|
||||
for (SearchResultsRest.AppliedFilter filter : data.getAppliedFilters()) {
|
||||
//TODO Make sure the filter format is defined in only one place
|
||||
uriComponentsBuilder
|
||||
.queryParam("f." + filter.getFilter(), filter.getValue() + "," + filter.getOperator());
|
||||
.queryParam("f." + filter.getFilter(), filter.getValue() + "," + filter.getOperator());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ public class FacetConfigurationResourceHalLinkFactory extends DiscoveryRestHalLi
|
||||
|
||||
if (data != null) {
|
||||
list.add(buildLink(Link.REL_SELF, getMethodOn()
|
||||
.getFacetsConfiguration(data.getScope(), data.getConfigurationName(), page)));
|
||||
.getFacetsConfiguration(data.getScope(), data.getConfiguration(), page)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ public class SearchConfigurationResourceHalLinkFactory
|
||||
if (data != null) {
|
||||
|
||||
list.add(buildLink(Link.REL_SELF, getMethodOn()
|
||||
.getSearchConfiguration(data.getScope(), data.getConfigurationName())));
|
||||
.getSearchConfiguration(data.getScope(), data.getConfiguration())));
|
||||
|
||||
list.add(buildLink("objects", getMethodOn().getSearchObjects(null, null, null, null, null, null)));
|
||||
list.add(buildLink("facets", getMethodOn().getFacets(null, null, null, null, null, null)));
|
||||
|
@@ -40,10 +40,10 @@ public class SearchFacetEntryHalLinkFactory extends DiscoveryRestHalLinkFactory<
|
||||
String query = searchData == null ? null : searchData.getQuery();
|
||||
String dsoType = searchData == null ? null : searchData.getDsoType();
|
||||
String scope = searchData == null ? null : searchData.getScope();
|
||||
String configuration = searchData == null ? null : searchData.getConfiguration();
|
||||
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn()
|
||||
.getFacetValues(facetData.getName(), null, query, dsoType,
|
||||
scope, null, null));
|
||||
UriComponentsBuilder uriBuilder = uriBuilder(getMethodOn().getFacetValues(facetData.getName(), null, query,
|
||||
dsoType, scope, configuration, null, null));
|
||||
|
||||
addFilterParams(uriBuilder, searchData);
|
||||
|
||||
|
@@ -33,8 +33,9 @@ public class SearchResultEntryHalLinkFactory extends DiscoveryRestHalLinkFactory
|
||||
throws Exception {
|
||||
SearchResultEntryRest data = halResource.getContent();
|
||||
|
||||
if (data != null && data.getDspaceObject() != null) {
|
||||
list.add(utils.linkToSingleResource(data.getDspaceObject(), SearchResultEntryResource.DSPACE_OBJECT_LINK));
|
||||
if (data != null && data.getIndexableObject() != null) {
|
||||
list.add(utils.linkToSingleResource(data.getIndexableObject(),
|
||||
SearchResultEntryResource.INDEXABLE_OBJECT_LINK));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import org.dspace.app.rest.DiscoveryRestController;
|
||||
import org.dspace.app.rest.parameter.SearchFilter;
|
||||
|
||||
@@ -28,6 +29,9 @@ public abstract class DiscoveryResultsRest extends BaseObjectRest<String> {
|
||||
private SearchResultsRest.Sorting sort;
|
||||
@JsonIgnore
|
||||
private String dsoType;
|
||||
@JsonIgnore
|
||||
private List<SearchFilter> searchFilters;
|
||||
private String configuration;
|
||||
|
||||
public String getCategory() {
|
||||
return CATEGORY;
|
||||
@@ -94,16 +98,14 @@ public abstract class DiscoveryResultsRest extends BaseObjectRest<String> {
|
||||
}
|
||||
|
||||
|
||||
public String getConfigurationName() {
|
||||
return configurationName;
|
||||
public String getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public void setConfigurationName(final String configurationName) {
|
||||
this.configurationName = configurationName;
|
||||
public void setConfiguration(final String configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
private String configurationName;
|
||||
|
||||
public void setSearchFilters(final List<SearchFilter> searchFilters) {
|
||||
this.searchFilters = searchFilters;
|
||||
}
|
||||
@@ -112,6 +114,5 @@ public abstract class DiscoveryResultsRest extends BaseObjectRest<String> {
|
||||
return searchFilters;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private List<SearchFilter> searchFilters;
|
||||
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.rest.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public class ErrorRest {
|
||||
*/
|
||||
public List<String> getPaths() {
|
||||
if (this.paths == null) {
|
||||
this.paths = new ArrayList<String>();
|
||||
this.paths = new LinkedList<String>();
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ public class FacetConfigurationRest extends BaseObjectRest<String> {
|
||||
|
||||
private String scope;
|
||||
|
||||
private String configurationName;
|
||||
private String configuration;
|
||||
|
||||
@JsonIgnore
|
||||
private LinkedList<SearchFacetEntryRest> sidebarFacets = new LinkedList<>();
|
||||
@@ -50,12 +50,12 @@ public class FacetConfigurationRest extends BaseObjectRest<String> {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getConfigurationName() {
|
||||
return configurationName;
|
||||
public String getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public void setConfigurationName(String configurationName) {
|
||||
this.configurationName = configurationName;
|
||||
public void setConfiguration(String configurationName) {
|
||||
this.configuration = configurationName;
|
||||
}
|
||||
|
||||
public List<SearchFacetEntryRest> getSidebarFacets() {
|
||||
@@ -73,8 +73,8 @@ public class FacetConfigurationRest extends BaseObjectRest<String> {
|
||||
.append(this.getType(), ((FacetConfigurationRest) object).getType())
|
||||
.append(this.getController(), ((FacetConfigurationRest) object).getController())
|
||||
.append(this.getScope(), ((FacetConfigurationRest) object).getScope())
|
||||
.append(this.getConfigurationName(),
|
||||
((FacetConfigurationRest) object).getConfigurationName())
|
||||
.append(this.getConfiguration(),
|
||||
((FacetConfigurationRest) object).getConfiguration())
|
||||
.append(this.getSidebarFacets(), ((FacetConfigurationRest) object).getSidebarFacets())
|
||||
.isEquals());
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class FacetConfigurationRest extends BaseObjectRest<String> {
|
||||
.append(this.getType())
|
||||
.append(this.getController())
|
||||
.append(this.getScope())
|
||||
.append(this.getConfigurationName())
|
||||
.append(this.getConfiguration())
|
||||
.append(this.getSidebarFacets())
|
||||
.toHashCode();
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ public class SearchConfigurationRest extends BaseObjectRest<String> {
|
||||
@JsonIgnore
|
||||
private String scope;
|
||||
@JsonIgnore
|
||||
private String configurationName;
|
||||
private String configuration;
|
||||
|
||||
private List<Filter> filters = new LinkedList<>();
|
||||
private List<SortOption> sortOptions = new LinkedList<>();
|
||||
@@ -51,12 +51,12 @@ public class SearchConfigurationRest extends BaseObjectRest<String> {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getConfigurationName() {
|
||||
return configurationName;
|
||||
public String getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public void setConfigurationName(String configurationName) {
|
||||
this.configurationName = configurationName;
|
||||
public void setConfiguration(String configurationName) {
|
||||
this.configuration = configurationName;
|
||||
}
|
||||
|
||||
public void addFilter(Filter filter) {
|
||||
@@ -82,8 +82,8 @@ public class SearchConfigurationRest extends BaseObjectRest<String> {
|
||||
.append(this.getType(), ((SearchConfigurationRest) object).getType())
|
||||
.append(this.getController(), ((SearchConfigurationRest) object).getController())
|
||||
.append(this.getScope(), ((SearchConfigurationRest) object).getScope())
|
||||
.append(this.getConfigurationName(),
|
||||
((SearchConfigurationRest) object).getConfigurationName())
|
||||
.append(this.getConfiguration(),
|
||||
((SearchConfigurationRest) object).getConfiguration())
|
||||
.append(this.getFilters(), ((SearchConfigurationRest) object).getFilters())
|
||||
.append(this.getSortOptions(), ((SearchConfigurationRest) object).getSortOptions())
|
||||
.isEquals());
|
||||
@@ -96,7 +96,7 @@ public class SearchConfigurationRest extends BaseObjectRest<String> {
|
||||
.append(this.getType())
|
||||
.append(this.getController())
|
||||
.append(this.getScope())
|
||||
.append(this.getConfigurationName())
|
||||
.append(this.getConfiguration())
|
||||
.append(this.getFilters())
|
||||
.append(this.getSortOptions())
|
||||
.toHashCode();
|
||||
|
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import org.dspace.app.rest.DiscoveryRestController;
|
||||
|
||||
/**
|
||||
@@ -24,10 +25,9 @@ public class SearchResultEntryRest implements RestAddressableModel {
|
||||
|
||||
private Map<String, List<String>> hitHighlights;
|
||||
|
||||
private RestAddressableModel indexableObject;
|
||||
|
||||
@JsonIgnore
|
||||
private DSpaceObjectRest dspaceObject;
|
||||
|
||||
|
||||
public String getCategory() {
|
||||
return CATEGORY;
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class SearchResultEntryRest implements RestAddressableModel {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Class getController() {
|
||||
return DiscoveryRestController.class;
|
||||
}
|
||||
@@ -55,11 +56,12 @@ public class SearchResultEntryRest implements RestAddressableModel {
|
||||
this.hitHighlights = hitHighlights;
|
||||
}
|
||||
|
||||
public DSpaceObjectRest getDspaceObject() {
|
||||
return dspaceObject;
|
||||
@JsonIgnore
|
||||
public RestAddressableModel getIndexableObject() {
|
||||
return indexableObject;
|
||||
}
|
||||
|
||||
public void setDspaceObject(final DSpaceObjectRest dspaceObject) {
|
||||
this.dspaceObject = dspaceObject;
|
||||
public void setIndexableObject(final RestAddressableModel indexableObject) {
|
||||
this.indexableObject = indexableObject;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user