mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
DS-3851 cleanup the BrowsableObject interface
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
package org.dspace.browse;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dspace.core.Constants;
|
||||
|
||||
@@ -22,32 +20,6 @@ import org.dspace.core.Constants;
|
||||
* the Class of the primary key
|
||||
*/
|
||||
public interface BrowsableObject<PK extends Serializable> {
|
||||
Map<String, Object> extraInfo = new HashMap<String, Object>();
|
||||
|
||||
/**
|
||||
* A map of additional information exposed by the Entity to the browse/retrieve system
|
||||
*
|
||||
* @return a map of extra information, by default an empty map is returned
|
||||
*/
|
||||
default public Map<String, Object> getExtraInfo() {
|
||||
return extraInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if the Entity should be considered finalized (archived in terms of DSpace Item)
|
||||
*/
|
||||
default public boolean isArchived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if the Entity should be included in the public discovery system (search/browse)
|
||||
*/
|
||||
default public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -77,9 +49,4 @@ public interface BrowsableObject<PK extends Serializable> {
|
||||
return Constants.typeText[getType()];
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the handle, if any of the object
|
||||
*/
|
||||
public String getHandle();
|
||||
}
|
||||
|
@@ -334,14 +334,4 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
|
||||
return Constants.typeText[Constants.COLLECTION];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -276,14 +276,4 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
return communityService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -259,24 +259,9 @@ public class WorkspaceItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return Constants.WORKSPACEITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1884,7 +1884,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
} else if (dso instanceof Collection) {
|
||||
discoveryQuery.addFilterQueries("location:l" + dso.getID());
|
||||
} else if (dso instanceof Item) {
|
||||
discoveryQuery.addFilterQueries(HANDLE_FIELD + ":" + dso.getHandle());
|
||||
discoveryQuery.addFilterQueries(HANDLE_FIELD + ":" + ((Item) dso).getHandle());
|
||||
}
|
||||
}
|
||||
return search(context, discoveryQuery, includeUnDiscoverable);
|
||||
@@ -2228,11 +2228,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
o = (BrowsableObject) contentServiceFactory.getBrowsableObjectService(type).find(context, uid);
|
||||
}
|
||||
|
||||
if (o != null) {
|
||||
for (String f : doc.getFieldNames()) {
|
||||
o.getExtraInfo().put(f, doc.getFirstValue(f));
|
||||
}
|
||||
} else {
|
||||
if (o == null) {
|
||||
log.warn("Not able to retrieve object RESOURCE_ID:" + id + " - RESOURCE_TYPE_ID:" + type + " - HANDLE:" +
|
||||
handle);
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.browse.BrowsableObject;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
@@ -52,8 +53,10 @@ public class DiscoveryConfigurationService {
|
||||
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);
|
||||
|
@@ -207,8 +207,4 @@ public class BasicWorkflowItem implements WorkflowItem {
|
||||
return Constants.WORKFLOWITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandle() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -129,18 +129,4 @@ public class ClaimedTask implements ReloadableEntity<Integer>, BrowsableObject<I
|
||||
return Constants.WORKFLOW_CLAIMED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandle() {
|
||||
return getType() + "-" + getID();
|
||||
}
|
||||
}
|
||||
|
@@ -144,18 +144,4 @@ public class PoolTask implements ReloadableEntity<Integer>, BrowsableObject<Inte
|
||||
return Constants.WORKFLOW_POOL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandle() {
|
||||
return getType() + "-" + getID();
|
||||
}
|
||||
}
|
||||
|
@@ -165,19 +165,4 @@ public class XmlWorkflowItem implements WorkflowItem, ReloadableEntity<Integer>,
|
||||
return Constants.WORKFLOWITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArchived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user