public class UnlockHelper extends AbstractLogEnabled implements Initializable, ThreadSafe, Component, Serviceable, Disposable
| Modifier and Type | Field and Description |
|---|---|
private static String |
__ACTIVATE_PARAMETER |
private static String |
__PERIOD_PARAMETER |
private boolean |
_activated |
private Map<String,LocalDateTime> |
_lockedObjects
The map of locked contents id (String) and their locked time (value)
|
private long |
_period |
private AmetysObjectResolver |
_resolver |
protected Scheduler |
_scheduler
The scheduler
|
static String |
ROLE
Avalon Role
|
| Constructor and Description |
|---|
UnlockHelper() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
_cancelUnlocking(AmetysObject object) |
private void |
_initializeLockedObjects()
Search and stores references to all locked
AmetysObjects in the repository.Should not be called by clients. |
boolean |
cancelUnlocking(AmetysObject object)
Cancel the unlocking of an
AmetysObject. |
void |
dispose() |
<A extends LockableAmetysObject> |
getLockedObjects()
Get all current locked
LockableAmetysObject. |
long |
getTimeBeforeUnlock()
Get the period before unlocking a content.
|
void |
initialize() |
boolean |
isUnlockingActivated()
Check if the unlocking is enabled.
|
void |
scheduleUnlocking(AmetysObject object)
Schedule a task to unlock an object.
|
void |
service(ServiceManager manager) |
getLogger, setLoggerprivate static final String __ACTIVATE_PARAMETER
private static final String __PERIOD_PARAMETER
protected Scheduler _scheduler
private boolean _activated
private long _period
private Map<String,LocalDateTime> _lockedObjects
private AmetysObjectResolver _resolver
public UnlockHelper()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void initialize() throws Exception
initialize in interface InitializableExceptionprivate void _initializeLockedObjects()
AmetysObjects in the repository.public boolean isUnlockingActivated()
public long getTimeBeforeUnlock()
public void scheduleUnlocking(AmetysObject object)
object - The AmetysObject to be unlocked.public boolean cancelUnlocking(AmetysObject object)
AmetysObject.object - The object to cancel the unlock scheduling.private boolean _cancelUnlocking(AmetysObject object)
public <A extends LockableAmetysObject> Map<A,LocalDateTime> getLockedObjects()
LockableAmetysObject.A - the generic type extending LockableAmetysObject.public void dispose()
dispose in interface Disposable