Package org.dspace.identifier
Class VersionedHandleIdentifierProvider
- java.lang.Object
-
- org.dspace.identifier.IdentifierProvider
-
- org.dspace.identifier.VersionedHandleIdentifierProvider
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
@Component public class VersionedHandleIdentifierProvider extends IdentifierProvider implements org.springframework.beans.factory.InitializingBean
- Author:
- Fabio Bolognesi (fabio at atmire dot com), Mark Diggory (markd at atmire dot com), Ben Bosman (ben at atmire dot com), Pascal-Nicolas Becker (dspace at pascal dash becker dot de)
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentServiceFactorycontentServiceFactory-
Fields inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService
-
-
Constructor Summary
Constructors Constructor Description VersionedHandleIdentifierProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()After 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 VersionHistorygetHistory(Context context, String identifier)static StringgetPrefix()Get the configured Handle prefix string, or a defaultStringlookup(Context context, DSpaceObject dso)Return the identifier for a DSpaceObject.protected StringmakeIdentifierBasedOnHistory(Context context, DSpaceObject dso, VersionHistory history)Stringmint(Context context, DSpaceObject dso)Creates a new handle in the database.protected voidpopulateHandleMetadata(Context context, DSpaceObject dso, String handle)Stringregister(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.DSpaceObjectresolve(Context context, String identifier, String... attributes)Find the object named by a given identifier.protected voidrestoreItAsVersion(Context context, Item item, String identifier, int versionNumber)static StringretrieveHandleOutOfUrl(String url)booleansupports(Class<? extends Identifier> identifier)Can this provider provide identifiers of a given type?booleansupports(String identifier)Can this provider provide identifiers of a given type?-
Methods inherited from class org.dspace.identifier.IdentifierProvider
setConfigurationService, setParentService
-
-
-
-
Field Detail
-
contentServiceFactory
@Autowired(required=true) protected ContentServiceFactory contentServiceFactory
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws ExceptionAfter all the properties are set check that the versioning is enabled- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception- throws an exception if this isn't the case
-
supports
public boolean supports(Class<? extends Identifier> identifier)
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
public boolean supports(String identifier)
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
public String register(Context context, DSpaceObject dso)
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
public void register(Context context, DSpaceObject dso, String identifier) throws IdentifierException
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.- Throws:
IdentifierException- if identifier error
-
getHistory
protected VersionHistory getHistory(Context context, String identifier) throws SQLException
- Throws:
SQLException
-
restoreItAsVersion
protected void restoreItAsVersion(Context context, Item item, String identifier, int versionNumber) throws SQLException, AuthorizeException, IOException
-
reserve
public void reserve(Context context, DSpaceObject dso, String identifier)
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
public String mint(Context context, DSpaceObject dso)
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
public DSpaceObject resolve(Context context, String identifier, String... attributes)
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
public void delete(Context context, DSpaceObject dso, String identifier) throws IdentifierException
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
public void delete(Context context, DSpaceObject dso) throws IdentifierException
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
public static String retrieveHandleOutOfUrl(String url) throws SQLException
- Throws:
SQLException
-
getPrefix
public static String 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
-
populateHandleMetadata
protected void populateHandleMetadata(Context context, DSpaceObject dso, String handle) throws SQLException, IOException, AuthorizeException
-
-