Class UnlockHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.repository.lock.UnlockHelper
- All Implemented Interfaces:
LogEnabled
,Disposable
,Initializable
,Component
,Serviceable
,ThreadSafe
public class UnlockHelper
extends AbstractLogEnabled
implements Initializable, ThreadSafe, Component, Serviceable, Disposable
The helper for scheduling the unlocking of the contents.
At initialization all contents are scanned and locked ones will be automatically unlocked.
At initialization all contents are scanned and locked ones will be automatically unlocked.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancelUnlocking
(AmetysObject object) Cancel the unlocking of anAmetysObject
.void
dispose()
<A extends LockableAmetysObject>
Map<A,LocalDateTime> Get all current lockedLockableAmetysObject
.long
Get the period before unlocking a content.void
boolean
Check if the unlocking is enabled.void
scheduleUnlocking
(AmetysObject object) Schedule a task to unlock an object.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
_scheduler
The scheduler
-
-
Constructor Details
-
UnlockHelper
public UnlockHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
isUnlockingActivated
Check if the unlocking is enabled.- Returns:
- true if the unlocking is activated, false otherwise.
-
getTimeBeforeUnlock
Get the period before unlocking a content.- Returns:
- The period in hours.
-
scheduleUnlocking
Schedule a task to unlock an object.- Parameters:
object
- TheAmetysObject
to be unlocked.
-
cancelUnlocking
Cancel the unlocking of anAmetysObject
.- Parameters:
object
- The object to cancel the unlock scheduling.- Returns:
- true if the unlocking was cancelled, false otherwise.
-
getLockedObjects
Get all current lockedLockableAmetysObject
.- Type Parameters:
A
- the generic type extendingLockableAmetysObject
.- Returns:
- The contents as a Map of Content to LocalDateTime (the date time when they were locked).
-
dispose
- Specified by:
dispose
in interfaceDisposable
-