mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
port pr1839 minus xmlui
This commit is contained in:
@@ -271,9 +271,8 @@ public class ItemExportServiceImpl implements ItemExportService {
|
|||||||
("date".equals(metadataField.getElement()) && "accessioned".equals(qualifier)) ||
|
("date".equals(metadataField.getElement()) && "accessioned".equals(qualifier)) ||
|
||||||
("date".equals(metadataField.getElement()) && "available".equals(qualifier)) ||
|
("date".equals(metadataField.getElement()) && "available".equals(qualifier)) ||
|
||||||
("identifier".equals(metadataField.getElement()) && "uri".equals(qualifier) &&
|
("identifier".equals(metadataField.getElement()) && "uri".equals(qualifier) &&
|
||||||
(dcv.getValue() != null && dcv.getValue().startsWith("http://hdl.handle.net/" +
|
(dcv.getValue() != null && dcv.getValue().startsWith(
|
||||||
handleService
|
handleService.getCanonicalPrefix() + handleService.getPrefix() + "/"))) ||
|
||||||
.getPrefix() + "/"))) ||
|
|
||||||
("description".equals(metadataField.getElement()) && "provenance".equals(qualifier)) ||
|
("description".equals(metadataField.getElement()) && "provenance".equals(qualifier)) ||
|
||||||
("format".equals(metadataField.getElement()) && "extent".equals(qualifier)) ||
|
("format".equals(metadataField.getElement()) && "extent".equals(qualifier)) ||
|
||||||
("format".equals(metadataField.getElement()) && "mimetype".equals(qualifier))))) {
|
("format".equals(metadataField.getElement()) && "mimetype".equals(qualifier))))) {
|
||||||
|
@@ -31,11 +31,12 @@ import org.apache.commons.cli.PosixParser;
|
|||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.core.ConfigurationManager;
|
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.eperson.EPerson;
|
import org.dspace.eperson.EPerson;
|
||||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||||
import org.dspace.eperson.service.EPersonService;
|
import org.dspace.eperson.service.EPersonService;
|
||||||
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
|
import org.dspace.handle.service.HandleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides some batch editing capabilities for items in DSpace:
|
* Provides some batch editing capabilities for items in DSpace:
|
||||||
@@ -78,6 +79,7 @@ public class ItemUpdate {
|
|||||||
|
|
||||||
protected static final EPersonService epersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
protected static final EPersonService epersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||||
protected static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
protected static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||||
|
protected static final HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterAliases.put("ORIGINAL", "org.dspace.app.itemupdate.OriginalBitstreamFilter");
|
filterAliases.put("ORIGINAL", "org.dspace.app.itemupdate.OriginalBitstreamFilter");
|
||||||
@@ -330,10 +332,7 @@ public class ItemUpdate {
|
|||||||
iu.setEPerson(context, iu.eperson);
|
iu.setEPerson(context, iu.eperson);
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
HANDLE_PREFIX = ConfigurationManager.getProperty("handle.canonical.prefix");
|
HANDLE_PREFIX = handleService.getCanonicalPrefix();
|
||||||
if (HANDLE_PREFIX == null || HANDLE_PREFIX.length() == 0) {
|
|
||||||
HANDLE_PREFIX = "http://hdl.handle.net/";
|
|
||||||
}
|
|
||||||
|
|
||||||
iu.processArchive(context, sourcedir, itemField, metadataIndexName, alterProvenance, isTest);
|
iu.processArchive(context, sourcedir, itemField, metadataIndexName, alterProvenance, isTest);
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@ import org.dspace.core.ConfigurationManager;
|
|||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.core.SelfNamedPlugin;
|
import org.dspace.core.SelfNamedPlugin;
|
||||||
|
import org.dspace.handle.factory.HandleServiceFactory;
|
||||||
|
import org.dspace.handle.service.HandleService;
|
||||||
import org.jdom.Attribute;
|
import org.jdom.Attribute;
|
||||||
import org.jdom.Document;
|
import org.jdom.Document;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
@@ -95,6 +97,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
|||||||
protected final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
protected final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||||
protected final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
protected final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||||
protected final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
protected final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||||
|
protected final HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill in the plugin alias table from DSpace configuration entries
|
* Fill in the plugin alias table from DSpace configuration entries
|
||||||
@@ -418,7 +421,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
|||||||
protected List<MockMetadataValue> site2Metadata(Site site) {
|
protected List<MockMetadataValue> site2Metadata(Site site) {
|
||||||
List<MockMetadataValue> metadata = new ArrayList<>();
|
List<MockMetadataValue> metadata = new ArrayList<>();
|
||||||
|
|
||||||
String identifier_uri = "http://hdl.handle.net/"
|
String identifier_uri = handleService.getCanonicalPrefix()
|
||||||
+ site.getHandle();
|
+ site.getHandle();
|
||||||
String title = site.getName();
|
String title = site.getName();
|
||||||
String url = site.getURL();
|
String url = site.getURL();
|
||||||
@@ -452,7 +455,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
|||||||
String description = communityService.getMetadata(community, "introductory_text");
|
String description = communityService.getMetadata(community, "introductory_text");
|
||||||
String description_abstract = communityService.getMetadata(community, "short_description");
|
String description_abstract = communityService.getMetadata(community, "short_description");
|
||||||
String description_table = communityService.getMetadata(community, "side_bar_text");
|
String description_table = communityService.getMetadata(community, "side_bar_text");
|
||||||
String identifier_uri = "http://hdl.handle.net/"
|
String identifier_uri = handleService.getCanonicalPrefix()
|
||||||
+ community.getHandle();
|
+ community.getHandle();
|
||||||
String rights = communityService.getMetadata(community, "copyright_text");
|
String rights = communityService.getMetadata(community, "copyright_text");
|
||||||
String title = communityService.getMetadata(community, "name");
|
String title = communityService.getMetadata(community, "name");
|
||||||
@@ -495,7 +498,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
|
|||||||
String description = collectionService.getMetadata(collection, "introductory_text");
|
String description = collectionService.getMetadata(collection, "introductory_text");
|
||||||
String description_abstract = collectionService.getMetadata(collection, "short_description");
|
String description_abstract = collectionService.getMetadata(collection, "short_description");
|
||||||
String description_table = collectionService.getMetadata(collection, "side_bar_text");
|
String description_table = collectionService.getMetadata(collection, "side_bar_text");
|
||||||
String identifier_uri = "http://hdl.handle.net/"
|
String identifier_uri = handleService.getCanonicalPrefix()
|
||||||
+ collection.getHandle();
|
+ collection.getHandle();
|
||||||
String provenance = collectionService.getMetadata(collection, "provenance_description");
|
String provenance = collectionService.getMetadata(collection, "provenance_description");
|
||||||
String rights = collectionService.getMetadata(collection, "copyright_text");
|
String rights = collectionService.getMetadata(collection, "copyright_text");
|
||||||
|
@@ -1395,10 +1395,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
|||||||
|
|
||||||
if (values != null && values.size() > 0 && values.get(0) != null && values.get(0).getValue() != null) {
|
if (values != null && values.size() > 0 && values.get(0) != null && values.get(0).getValue() != null) {
|
||||||
// group on parent
|
// group on parent
|
||||||
String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix");
|
String handlePrefix = handleService.getCanonicalPrefix();
|
||||||
if (handlePrefix == null || handlePrefix.length() == 0) {
|
|
||||||
handlePrefix = "http://hdl.handle.net/";
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.addField("publication_grp", values.get(0).getValue().replaceFirst(handlePrefix, ""));
|
doc.addField("publication_grp", values.get(0).getValue().replaceFirst(handlePrefix, ""));
|
||||||
|
|
||||||
|
@@ -113,8 +113,7 @@ public class HandleServiceImpl implements HandleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCanonicalForm(String handle) {
|
public String getCanonicalPrefix() {
|
||||||
|
|
||||||
// Let the admin define a new prefix, if not then we'll use the
|
// Let the admin define a new prefix, if not then we'll use the
|
||||||
// CNRI default. This allows the admin to use "hdl:" if they want to or
|
// CNRI default. This allows the admin to use "hdl:" if they want to or
|
||||||
// use a locally branded prefix handle.myuni.edu.
|
// use a locally branded prefix handle.myuni.edu.
|
||||||
@@ -123,7 +122,12 @@ public class HandleServiceImpl implements HandleService {
|
|||||||
handlePrefix = "http://hdl.handle.net/";
|
handlePrefix = "http://hdl.handle.net/";
|
||||||
}
|
}
|
||||||
|
|
||||||
return handlePrefix + handle;
|
return handlePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCanonicalForm(String handle) {
|
||||||
|
return getCanonicalPrefix() + handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -98,7 +98,7 @@ public class UpdateHandlePrefix {
|
|||||||
MetadataValueService metadataValueService = ContentServiceFactory.getInstance()
|
MetadataValueService metadataValueService = ContentServiceFactory.getInstance()
|
||||||
.getMetadataValueService();
|
.getMetadataValueService();
|
||||||
|
|
||||||
String handlePrefix = configurationService.getProperty("handle.canonical.prefix");
|
String handlePrefix = handleService.getCanonicalPrefix();
|
||||||
Iterator<MetadataValue> metadataValues = metadataValueService
|
Iterator<MetadataValue> metadataValues = metadataValueService
|
||||||
.findByValueLike(context, handlePrefix + oldH);
|
.findByValueLike(context, handlePrefix + oldH);
|
||||||
|
|
||||||
|
@@ -55,6 +55,17 @@ public interface HandleService {
|
|||||||
public String resolveUrlToHandle(Context context, String url)
|
public String resolveUrlToHandle(Context context, String url)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides handle canonical prefix using http://hdl.handle.net if not
|
||||||
|
* overridden by the configuration property handle.canonical.prefix.
|
||||||
|
*
|
||||||
|
* No attempt is made to verify that handle is in fact valid.
|
||||||
|
*
|
||||||
|
* @param handle The handle
|
||||||
|
* @return The canonical form
|
||||||
|
*/
|
||||||
|
public String getCanonicalPrefix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms handle into a URI using http://hdl.handle.net if not
|
* Transforms handle into a URI using http://hdl.handle.net if not
|
||||||
* overridden by the configuration property handle.canonical.prefix.
|
* overridden by the configuration property handle.canonical.prefix.
|
||||||
|
@@ -364,19 +364,6 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
|||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String getCanonicalForm(String handle) {
|
|
||||||
|
|
||||||
// Let the admin define a new prefix, if not then we'll use the
|
|
||||||
// CNRI default. This allows the admin to use "hdl:" if they want to or
|
|
||||||
// use a locally branded prefix handle.myuni.edu.
|
|
||||||
String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix");
|
|
||||||
if (handlePrefix == null || handlePrefix.length() == 0) {
|
|
||||||
handlePrefix = "http://hdl.handle.net/";
|
|
||||||
}
|
|
||||||
|
|
||||||
return handlePrefix + handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String createNewIdentifier(Context context, DSpaceObject dso, String handleId) throws SQLException {
|
protected String createNewIdentifier(Context context, DSpaceObject dso, String handleId) throws SQLException {
|
||||||
if (handleId == null) {
|
if (handleId == null) {
|
||||||
return handleService.createHandle(context, dso);
|
return handleService.createHandle(context, dso);
|
||||||
@@ -425,7 +412,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
|||||||
|
|
||||||
protected void populateHandleMetadata(Context context, Item item, String handle)
|
protected void populateHandleMetadata(Context context, Item item, String handle)
|
||||||
throws SQLException, IOException, AuthorizeException {
|
throws SQLException, IOException, AuthorizeException {
|
||||||
String handleref = getCanonicalForm(handle);
|
String handleref = handleService.getCanonicalForm(handle);
|
||||||
// we want to remove the old handle and insert the new. To do so, we
|
// we want to remove the old handle and insert the new. To do so, we
|
||||||
// load all identifiers, clear the metadata field, re add all
|
// load all identifiers, clear the metadata field, re add all
|
||||||
// identifiers which are not from type handle and add the new handle.
|
// identifiers which are not from type handle and add the new handle.
|
||||||
|
@@ -411,19 +411,6 @@ public class VersionedHandleIdentifierProviderWithCanonicalHandles extends Ident
|
|||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String getCanonicalForm(String handle) {
|
|
||||||
|
|
||||||
// Let the admin define a new prefix, if not then we'll use the
|
|
||||||
// CNRI default. This allows the admin to use "hdl:" if they want to or
|
|
||||||
// use a locally branded prefix handle.myuni.edu.
|
|
||||||
String handlePrefix = ConfigurationManager.getProperty("handle.canonical.prefix");
|
|
||||||
if (handlePrefix == null || handlePrefix.length() == 0) {
|
|
||||||
handlePrefix = "http://hdl.handle.net/";
|
|
||||||
}
|
|
||||||
|
|
||||||
return handlePrefix + handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String createNewIdentifier(Context context, DSpaceObject dso, String handleId) throws SQLException {
|
protected String createNewIdentifier(Context context, DSpaceObject dso, String handleId) throws SQLException {
|
||||||
if (handleId == null) {
|
if (handleId == null) {
|
||||||
return handleService.createHandle(context, dso);
|
return handleService.createHandle(context, dso);
|
||||||
@@ -503,7 +490,7 @@ public class VersionedHandleIdentifierProviderWithCanonicalHandles extends Ident
|
|||||||
// we want to exchange the old handle against the new one. To do so, we
|
// we want to exchange the old handle against the new one. To do so, we
|
||||||
// load all identifiers, clear the metadata field, re add all
|
// load all identifiers, clear the metadata field, re add all
|
||||||
// identifiers which are not from type handle and add the new handle.
|
// identifiers which are not from type handle and add the new handle.
|
||||||
String handleref = getCanonicalForm(handle);
|
String handleref = handleService.getCanonicalForm(handle);
|
||||||
List<MetadataValue> identifiers = itemService
|
List<MetadataValue> identifiers = itemService
|
||||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, "identifier", "uri", Item.ANY);
|
.getMetadata(item, MetadataSchema.DC_SCHEMA, "identifier", "uri", Item.ANY);
|
||||||
itemService.clearMetadata(context, item, MetadataSchema.DC_SCHEMA, "identifier", "uri", Item.ANY);
|
itemService.clearMetadata(context, item, MetadataSchema.DC_SCHEMA, "identifier", "uri", Item.ANY);
|
||||||
|
Reference in New Issue
Block a user