public class LockComponent extends AbstractLogEnabled implements Serviceable, Component
JCRAmetysObject
s.Modifier and Type | Field and Description |
---|---|
protected CurrentUserProvider |
_currentUserProvider
The current user provider.
|
protected UnlockHelper |
_unlockHelper
The unlock helper.
|
static String |
ROLE
The avalon component role.
|
Constructor and Description |
---|
LockComponent() |
Modifier and Type | Method and Description |
---|---|
void |
addLockedContent(AmetysObject object)
Register a locked content for automatic unlocking
|
UserIdentity |
getCurrentUser()
Provides the current user.
|
UserIdentity |
getLockOwner(JCRAmetysObject object)
Get the lock owner of a
JCRAmetysObject . |
protected Node |
getNode(JCRAmetysObject object)
Get an object's base node.
|
boolean |
isLocked(JCRAmetysObject object)
Test if a
JCRAmetysObject is locked. |
void |
lock(JCRAmetysObject object)
Lock a
JCRAmetysObject . |
void |
removeLockedContent(AmetysObject object)
Unregister a locked content for automatic unlocking
|
void |
service(ServiceManager manager) |
void |
unlock(JCRAmetysObject object)
Unlock a
JCRAmetysObject . |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected UnlockHelper _unlockHelper
protected CurrentUserProvider _currentUserProvider
public LockComponent()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void addLockedContent(AmetysObject object)
object
- the locked AmetysObject
public void removeLockedContent(AmetysObject object)
object
- the locked AmetysObject
public UserIdentity getCurrentUser()
public void lock(JCRAmetysObject object) throws AmetysRepositoryException
JCRAmetysObject
.object
- the object to lock.AmetysRepositoryException
- if an error occurs.public void unlock(JCRAmetysObject object) throws AmetysRepositoryException
JCRAmetysObject
.object
- the object to unlock.AmetysRepositoryException
- if an error occurs.public boolean isLocked(JCRAmetysObject object) throws AmetysRepositoryException
JCRAmetysObject
is locked.object
- the object to test.AmetysRepositoryException
- if an error occurs.public UserIdentity getLockOwner(JCRAmetysObject object) throws AmetysRepositoryException
JCRAmetysObject
.object
- the object of which to get the lock owner.AmetysRepositoryException
- if an error occurs.protected Node getNode(JCRAmetysObject object)
object
- the object which node to get.