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