Class RecordLockManager
java.lang.Object
io.goobi.viewer.model.security.recordlock.RecordLockManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlockRecord(String pi, String sessionId, Integer limit) booleanremoveLockForPiAndSessionId(String pi, String sessionId) intremoveLocksForSessionId(String sessionId, List<String> skipPiList) intremoveOldLocks(long maxAge) Removes all record locks that are older thatmaxAgemilliseconds.
-
Constructor Details
-
RecordLockManager
public RecordLockManager()
-
-
Method Details
-
lockRecord
- Parameters:
pi- Record identifiersessionId- HTTP session IDlimit- Optional number of concurrent views for the record- Returns:
- a
LockRecordResult, indicating that either a lock has been set, the lock limit was exceeded or that no action was necessary - Throws:
IllegalArgumentException- if the given pi is null
-
removeLocksForSessionId
- Parameters:
sessionId- HTTP session IDskipPiList- Optional list of identifiers to skip- Returns:
- number of records if session id removed successfully
-
removeLockForPiAndSessionId
- Parameters:
pi-sessionId-- Returns:
- true if lock removed successfully; false otherwise
-
removeOldLocks
public int removeOldLocks(long maxAge) Removes all record locks that are older thatmaxAgemilliseconds. Can be used to periodically clean up locks that might have been missed by the web socket mechanism.- Parameters:
maxAge-- Returns:
- Number of removed locks
-
emptyCacheForRecord
- Parameters:
pi-
-
getRecordAccessConditionsCache
- Returns:
- the recordAccessConditionsCache
-
getRecordLimitsCache
- Returns:
- the recordLimitsCache
-