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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancelUnlocking(AmetysObject object) Cancel the unlocking of anAmetysObject.voiddispose()<A extends LockableAmetysObject>
Map<A,LocalDateTime> Get all current lockedLockableAmetysObject.longGet the period before unlocking a content.voidbooleanCheck if the unlocking is enabled.voidscheduleUnlocking(AmetysObject object) Schedule a task to unlock an object.voidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
- Specified by:
initializein 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- TheAmetysObjectto 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:
disposein interfaceDisposable
-