Package org.dspace.versioning
Class VersioningServiceImpl
- java.lang.Object
-
- org.dspace.versioning.VersioningServiceImpl
-
- All Implemented Interfaces:
VersioningService
public class VersioningServiceImpl extends Object implements VersioningService
- 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 VersionDAOversionDAOprotected WorkflowItemServiceworkflowItemService
-
Constructor Summary
Constructors Modifier Constructor Description protectedVersioningServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountVersionsByHistoryWithItem(Context context, VersionHistory versionHistory)This method count versions of an version history that have items assigned.VersioncreateNewVersion(Context c, Item item)VersioncreateNewVersion(Context c, Item item, String summary)VersioncreateNewVersion(Context context, VersionHistory history, Item item, String summary, Date date, int versionNumber)protected VersioncreateVersion(Context c, VersionHistory vh, Item item, String summary, Date date)voiddelete(Context c, Version version)Delete a Versionprotected intgetNextVersionNumer(Context c, VersionHistory vh)VersiongetVersion(Context c, int versionID)VersiongetVersion(Context c, Item item)List<Version>getVersionsByHistory(Context c, VersionHistory vh)Returns all versions of a version history.List<Version>getVersionsByHistoryWithItems(Context c, VersionHistory vh, int offset, int limit)Return a paginated list of versions of a version history.voidremoveVersion(Context c, Item item)VersionrestoreVersion(Context c, Version version)VersionrestoreVersion(Context c, Version version, String summary)voidsetProvider(DefaultItemVersionProvider provider)voidupdate(Context context, Version version)Update the VersionVersionupdateVersion(Context c, Item item, String summary)
-
-
-
Field Detail
-
versionDAO
@Autowired(required=true) protected VersionDAO versionDAO
-
workflowItemService
@Autowired(required=true) protected WorkflowItemService workflowItemService
-
-
Method Detail
-
setProvider
@Autowired(required=true) public void setProvider(DefaultItemVersionProvider provider)
-
createNewVersion
public Version createNewVersion(Context c, Item item)
- Specified by:
createNewVersionin interfaceVersioningService
-
createNewVersion
public Version createNewVersion(Context c, Item item, String summary)
- Specified by:
createNewVersionin interfaceVersioningService
-
delete
public void delete(Context c, Version version) throws SQLException
Description copied from interface:VersioningServiceDelete a Version- Specified by:
deletein interfaceVersioningService- Parameters:
c- contextversion- version- Throws:
SQLException- if database error
-
removeVersion
public void removeVersion(Context c, Item item) throws SQLException
- Specified by:
removeVersionin interfaceVersioningService- Throws:
SQLException
-
getVersion
public Version getVersion(Context c, int versionID) throws SQLException
- Specified by:
getVersionin interfaceVersioningService- Throws:
SQLException
-
restoreVersion
public Version restoreVersion(Context c, Version version)
- Specified by:
restoreVersionin interfaceVersioningService
-
restoreVersion
public Version restoreVersion(Context c, Version version, String summary)
- Specified by:
restoreVersionin interfaceVersioningService
-
updateVersion
public Version updateVersion(Context c, Item item, String summary) throws SQLException
- Specified by:
updateVersionin interfaceVersioningService- Throws:
SQLException
-
getVersion
public Version getVersion(Context c, Item item) throws SQLException
- Specified by:
getVersionin interfaceVersioningService- Throws:
SQLException
-
createNewVersion
public Version createNewVersion(Context context, VersionHistory history, Item item, String summary, Date date, int versionNumber)
- Specified by:
createNewVersionin interfaceVersioningService
-
getVersionsByHistory
public List<Version> getVersionsByHistory(Context c, VersionHistory vh) throws SQLException
Description copied from interface:VersioningServiceReturns all versions of a version history. To keep version numbers stable we do not delete versions, we do only set the item, date, summary and eperson null. This methods returns only those versions that have an item assigned.- Specified by:
getVersionsByHistoryin interfaceVersioningService- Parameters:
c- The relevant DSpace Context.vh- version history- Returns:
- All versions of a version history that have an item assigned.
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getVersionsByHistoryWithItems
public List<Version> getVersionsByHistoryWithItems(Context c, VersionHistory vh, int offset, int limit) throws SQLException
Description copied from interface:VersioningServiceReturn a paginated list of versions of a version history. To keep version numbers stable we do not delete versions, we do only set the item, date, summary and eperson null. This methods returns only those versions that have an item assigned.- Specified by:
getVersionsByHistoryWithItemsin interfaceVersioningService- Parameters:
c- The relevant DSpace Context.vh- Version historyoffset- The position of the first result to returnlimit- Paging limit- Throws:
SQLException- If database error
-
createVersion
protected Version createVersion(Context c, VersionHistory vh, Item item, String summary, Date date) throws SQLException
- Throws:
SQLException
-
getNextVersionNumer
protected int getNextVersionNumer(Context c, VersionHistory vh) throws SQLException
- Throws:
SQLException
-
update
public void update(Context context, Version version) throws SQLException
Description copied from interface:VersioningServiceUpdate the Version- Specified by:
updatein interfaceVersioningService- Parameters:
context- contextversion- version- Throws:
SQLException- if database error
-
countVersionsByHistoryWithItem
public int countVersionsByHistoryWithItem(Context context, VersionHistory versionHistory) throws SQLException
Description copied from interface:VersioningServiceThis method count versions of an version history that have items assigned. We do not delete versions to keep version numbers stable. To remove a version we set the item, date, summary and eperson null. This method returns only versions that aren't soft deleted and have items assigned.- Specified by:
countVersionsByHistoryWithItemin interfaceVersioningService- Parameters:
context- The relevant DSpace Context.versionHistory- Version history- Returns:
- Total versions of an version history that have items assigned.
- Throws:
SQLException- If database error
-
-