Package org.dspace.identifier
Class VersionedHandleIdentifierProviderWithCanonicalHandles
java.lang.Object
org.dspace.identifier.IdentifierProvider
org.dspace.identifier.VersionedHandleIdentifierProviderWithCanonicalHandles
- All Implemented Interfaces:
InitializingBean
public class VersionedHandleIdentifierProviderWithCanonicalHandles
extends IdentifierProvider
implements InitializingBean
- Author:
- Fabio Bolognesi (fabio at atmire dot com), Mark Diggory (markd at atmire dot com), Ben Bosman (ben at atmire dot com)
-
Field Summary
Fields inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAfter all the properties are set check that the versioning is enabledprotected StringcreateNewIdentifier(Context context, DSpaceObject dso, String handleId) voiddelete(Context context, DSpaceObject dso) Unbind this type of identifier(s) from an object.voiddelete(Context context, DSpaceObject dso, String identifier) Unbind the given identifier from an object.protected StringgetCanonical(String identifier) protected StringgetCanonical(Context context, Item item) protected VersionHistorygetHistory(Context context, String identifier) static StringGet the configured Handle prefix string, or a defaultlookup(Context context, DSpaceObject dso) Return the identifier for a DSpaceObject.protected StringmakeIdentifierBasedOnHistory(Context context, DSpaceObject dso, VersionHistory history) mint(Context context, DSpaceObject dso) Creates a new handle in the database.protected voidmodifyHandleMetadata(Context context, DSpaceObject dso, String handle) Remove all handles from an item's metadata and add the supplied handle instead.register(Context context, DSpaceObject dso) Create and apply an identifier to a DSpaceObject.voidregister(Context context, DSpaceObject dso, String identifier) Create a specific identifier and apply it to an object.voidreserve(Context context, DSpaceObject dso, String identifier) Set an object's identifier.Find the object named by a given identifier.protected voidrestoreItAsCanonical(Context context, DSpaceObject dso, String identifier, Item item, String canonical) protected voidrestoreItAsVersion(Context context, DSpaceObject dso, String identifier, Item item, String canonical, VersionHistory history) static Stringbooleansupports(Class<? extends Identifier> identifier) Can this provider provide identifiers of a given type?booleanCan this provider provide identifiers of a given type?Methods inherited from class org.dspace.identifier.IdentifierProvider
setConfigurationService, setParentService
-
Constructor Details
-
VersionedHandleIdentifierProviderWithCanonicalHandles
public VersionedHandleIdentifierProviderWithCanonicalHandles()
-
-
Method Details
-
afterPropertiesSet
After all the properties are set check that the versioning is enabled- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception- throws an exception if this isn't the case
-
supports
Description copied from class:IdentifierProviderCan this provider provide identifiers of a given type?- Specified by:
supportsin classIdentifierProvider- Parameters:
identifier- requested type.- Returns:
- true if the given type is assignable from this provider's type.
-
supports
Description copied from class:IdentifierProviderCan this provider provide identifiers of a given type?- Specified by:
supportsin classIdentifierProvider- Parameters:
identifier- requested type.- Returns:
- true if this provider can provide the named type of identifier.
-
register
Description copied from class:IdentifierProviderCreate and apply an identifier to a DSpaceObject.- Specified by:
registerin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be named.- Returns:
- existing identifier of
itemif it has one, else a new identifier.
-
register
Description copied from class:IdentifierProviderCreate a specific identifier and apply it to an object.- Specified by:
registerin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- to be identified.identifier- to be created.
-
getHistory
- Throws:
SQLException
-
restoreItAsVersion
protected void restoreItAsVersion(Context context, DSpaceObject dso, String identifier, Item item, String canonical, VersionHistory history) throws SQLException, IOException, AuthorizeException -
restoreItAsCanonical
protected void restoreItAsCanonical(Context context, DSpaceObject dso, String identifier, Item item, String canonical) throws SQLException, IOException, AuthorizeException -
reserve
Description copied from class:IdentifierProviderSet an object's identifier.- Specified by:
reservein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be identified.identifier- to be set on the object.
-
mint
Creates a new handle in the database.- Specified by:
mintin classIdentifierProvider- Parameters:
context- DSpace contextdso- The DSpaceObject to create a handle for- Returns:
- The newly created handle
-
resolve
Description copied from class:IdentifierProviderFind the object named by a given identifier.- Specified by:
resolvein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.identifier- to be resolved.attributes- additional information for resolvingidentifier.- Returns:
- the named object.
-
lookup
public String lookup(Context context, DSpaceObject dso) throws IdentifierNotFoundException, IdentifierNotResolvableException Description copied from class:IdentifierProviderReturn the identifier for a DSpaceObject.- Specified by:
lookupin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- The object to be looked up.- Returns:
- identifier for
object. - Throws:
IdentifierNotFoundException- if identifier not foundIdentifierNotResolvableException- if identifier not resolvable
-
delete
Description copied from class:IdentifierProviderUnbind the given identifier from an object.- Specified by:
deletein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be de-identified.identifier- to be removed.- Throws:
IdentifierException- if identifier error
-
delete
Description copied from class:IdentifierProviderUnbind this type of identifier(s) from an object.- Specified by:
deletein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to lose its identity.- Throws:
IdentifierException- if identifier error
-
retrieveHandleOutOfUrl
-
getPrefix
Get the configured Handle prefix string, or a default- Returns:
- configured prefix or "123456789"
-
createNewIdentifier
protected String createNewIdentifier(Context context, DSpaceObject dso, String handleId) throws SQLException - Throws:
SQLException
-
makeIdentifierBasedOnHistory
protected String makeIdentifierBasedOnHistory(Context context, DSpaceObject dso, VersionHistory history) throws AuthorizeException, SQLException - Throws:
AuthorizeExceptionSQLException
-
getCanonical
-
getCanonical
-
modifyHandleMetadata
protected void modifyHandleMetadata(Context context, DSpaceObject dso, String handle) throws SQLException, AuthorizeException Remove all handles from an item's metadata and add the supplied handle instead.- Parameters:
context- The relevant DSpace Context.dso- which dso to modifyhandle- which handle to add- Throws:
SQLException- if database errorAuthorizeException- if authorization error
-