mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 03:23:13 +00:00
Use handle.original.prefixes
This commit is contained in:
@@ -51,14 +51,14 @@ public class HandleIdentifierProvider extends IdentifierProvider {
|
|||||||
@Override
|
@Override
|
||||||
public boolean supports(String identifier)
|
public boolean supports(String identifier)
|
||||||
{
|
{
|
||||||
String prefix = handleService.getPrefix();
|
String prefix = handleService.getPrefix();
|
||||||
String canonicalPrefix = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("handle.canonical.prefix");
|
String canonicalPrefix = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("handle.canonical.prefix");
|
||||||
if (identifier == null)
|
if (identifier == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return true if handle has valid starting pattern
|
// return true if handle has valid starting pattern
|
||||||
if (identifier.startsWith(prefix)
|
if (identifier.startsWith(prefix + "/")
|
||||||
|| identifier.startsWith(canonicalPrefix)
|
|| identifier.startsWith(canonicalPrefix)
|
||||||
|| identifier.startsWith("hdl:")
|
|| identifier.startsWith("hdl:")
|
||||||
|| identifier.startsWith("info:hdl")
|
|| identifier.startsWith("info:hdl")
|
||||||
@@ -71,10 +71,11 @@ public class HandleIdentifierProvider extends IdentifierProvider {
|
|||||||
//Check additional prefixes supported in the config file
|
//Check additional prefixes supported in the config file
|
||||||
String[] additionalPrefixes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("handle.additional.prefixes");
|
String[] additionalPrefixes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("handle.additional.prefixes");
|
||||||
for(String additionalPrefix: additionalPrefixes) {
|
for(String additionalPrefix: additionalPrefixes) {
|
||||||
if (identifier.startsWith(additionalPrefix)) {
|
if (identifier.startsWith(additionalPrefix + "/")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return true if handle has valid starting pattern
|
// return true if handle has valid starting pattern
|
||||||
if (identifier.startsWith(prefix)
|
if (identifier.startsWith(prefix + "/")
|
||||||
|| identifier.startsWith(canonicalPrefix)
|
|| identifier.startsWith(canonicalPrefix)
|
||||||
|| identifier.startsWith("hdl:")
|
|| identifier.startsWith("hdl:")
|
||||||
|| identifier.startsWith("info:hdl")
|
|| identifier.startsWith("info:hdl")
|
||||||
@@ -87,13 +87,15 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// return true if base prefix matches in case of multi-instance deployment with derived prefixes demarcated by a dot "."
|
|
||||||
if(prefix.contains(".")) {
|
//Check additional prefixes supported in the config file
|
||||||
String[] splitPrefix = prefix.split("\\.");
|
String[] additionalPrefixes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("handle.additional.prefixes");
|
||||||
if(splitPrefix.length > 1 && identifier.startsWith(splitPrefix[0])) {
|
for(String additionalPrefix: additionalPrefixes) {
|
||||||
|
if (identifier.startsWith(additionalPrefix + "/")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, assume invalid handle
|
// otherwise, assume invalid handle
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ public class VersionedHandleIdentifierProviderWithCanonicalHandles extends Ident
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return true if handle has valid starting pattern
|
// return true if handle has valid starting pattern
|
||||||
if (identifier.startsWith(prefix)
|
if (identifier.startsWith(prefix + "/")
|
||||||
|| identifier.startsWith(canonicalPrefix)
|
|| identifier.startsWith(canonicalPrefix)
|
||||||
|| identifier.startsWith("hdl:")
|
|| identifier.startsWith("hdl:")
|
||||||
|| identifier.startsWith("info:hdl")
|
|| identifier.startsWith("info:hdl")
|
||||||
@@ -83,13 +83,15 @@ public class VersionedHandleIdentifierProviderWithCanonicalHandles extends Ident
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// return true if base prefix matches in case of multi-instance deployment with derived prefixes demarcated by a dot "."
|
|
||||||
if(prefix.contains(".")) {
|
//Check additional prefixes supported in the config file
|
||||||
String[] splitPrefix = prefix.split("\\.");
|
String[] additionalPrefixes = DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty("handle.additional.prefixes");
|
||||||
if(splitPrefix.length > 1 && identifier.startsWith(splitPrefix[0])) {
|
for(String additionalPrefix: additionalPrefixes) {
|
||||||
|
if (identifier.startsWith(additionalPrefix + "/")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, assume invalid handle
|
// otherwise, assume invalid handle
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user