Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.webapp.edit.lock
Class LockActionsBean

java.lang.Object
  extended by org.nuxeo.ecm.webapp.edit.lock.LockActionsBean
All Implemented Interfaces:
Serializable, LockActions

@Name(value="lockActions")
@Scope(value=EVENT)
@Install(precedence=10)
public class LockActionsBean
extends Object
implements LockActions

This is the action listener that knows to decide if an user has the right to take the lock or release the lock of a document.

Most of the logic of this bean should either be moved into a DocumentModel adapter or directly into the core API.

Author:
Bogdan Tatar
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.webapp.edit.lock.LockActions
LOCK_CREATED, LOCK_TIME, LOCKER
 
Constructor Summary
LockActionsBean()
           
 
Method Summary
 Boolean getCanLockCurrentDoc()
          Tests if the user can get the lock of the current document.
 Boolean getCanLockDoc(DocumentModel document)
          Tests if the user can get the lock of a document.
 Boolean getCanUnlockCurrentDoc()
          Tests if the user can unlock the current document.
 Boolean getCanUnlockDoc(DocumentModel document)
          Tests if the user can unlock a document.
 Map<String,Serializable> getCurrentDocLockDetails()
          Gets the details about the lock of the current document, who did the lock and when the lock took place.
 Map<String,Serializable> getLockDetails(DocumentModel document)
          Gets the details about the lock of a document,who did the lock and when the lock took place.
 Action getLockOrUnlockAction()
          Returns the action of lock or unlock for a document.
 Boolean isCurrentDocumentLiveEditable()
          Deprecated. use LiveEditBootstrapHelper.isCurrentDocumentLiveEditable() instead
 String lockCurrentDocument()
          Gets the lock of the current document.
 String lockDocument(DocumentModel document)
          Gets the lock of the document.
 void lockDocuments(List<DocumentModel> documents)
          Gets the locks of the documents from the list.
 void resetLockState()
           
 String unlockCurrentDocument()
          Releases the lock of the current document.
 String unlockDocument(DocumentModel document)
          Releases the lock of the document.
 void unlockDocuments(List<DocumentModel> documents)
          Releases the locks of the documents from the list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockActionsBean

public LockActionsBean()
Method Detail

getCanLockDoc

public Boolean getCanLockDoc(DocumentModel document)
Description copied from interface: LockActions
Tests if the user can get the lock of a document.

Specified by:
getCanLockDoc in interface LockActions
Returns:
true if the user has this right, false otherwise

getCanLockCurrentDoc

@Factory(value="currentDocumentCanBeLocked",
         scope=EVENT)
public Boolean getCanLockCurrentDoc()
Description copied from interface: LockActions
Tests if the user can get the lock of the current document.

Specified by:
getCanLockCurrentDoc in interface LockActions
Returns:
true if the user has this right, false otherwise

getCanUnlockDoc

public Boolean getCanUnlockDoc(DocumentModel document)
Description copied from interface: LockActions
Tests if the user can unlock a document.

Specified by:
getCanUnlockDoc in interface LockActions
Returns:
true if the user has this right, false otherwise

getCanUnlockCurrentDoc

@Factory(value="currentDocumentCanBeUnlocked",
         scope=EVENT)
public Boolean getCanUnlockCurrentDoc()
Description copied from interface: LockActions
Tests if the user can unlock the current document.

Specified by:
getCanUnlockCurrentDoc in interface LockActions
Returns:
true if the user has this right, false otherwise

lockCurrentDocument

public String lockCurrentDocument()
                           throws ClientException
Description copied from interface: LockActions
Gets the lock of the current document.

Specified by:
lockCurrentDocument in interface LockActions
Throws:
ClientException

lockDocument

public String lockDocument(DocumentModel document)
                    throws ClientException
Description copied from interface: LockActions
Gets the lock of the document.

Specified by:
lockDocument in interface LockActions
Parameters:
document - the document of which lock is to be taken
Throws:
ClientException

unlockCurrentDocument

public String unlockCurrentDocument()
                             throws ClientException
Description copied from interface: LockActions
Releases the lock of the current document.

Specified by:
unlockCurrentDocument in interface LockActions
Throws:
ClientException

unlockDocument

public String unlockDocument(DocumentModel document)
                      throws ClientException
Description copied from interface: LockActions
Releases the lock of the document.

Specified by:
unlockDocument in interface LockActions
Parameters:
document - the document of which lock is to be released
Throws:
ClientException

lockDocuments

public void lockDocuments(List<DocumentModel> documents)
Description copied from interface: LockActions
Gets the locks of the documents from the list.

Specified by:
lockDocuments in interface LockActions
Parameters:
documents - the list with the documents of which locks are to be taken

unlockDocuments

public void unlockDocuments(List<DocumentModel> documents)
Description copied from interface: LockActions
Releases the locks of the documents from the list.

Specified by:
unlockDocuments in interface LockActions
Parameters:
documents - the list with the documents of which locks are to be released

getLockOrUnlockAction

public Action getLockOrUnlockAction()
Description copied from interface: LockActions
Returns the action of lock or unlock for a document.

Specified by:
getLockOrUnlockAction in interface LockActions
Returns:
the action of lock or unlock for a document

getCurrentDocLockDetails

@Factory(value="currentDocumentLockDetails",
         scope=EVENT)
public Map<String,Serializable> getCurrentDocLockDetails()
                                                  throws ClientException
Description copied from interface: LockActions
Gets the details about the lock of the current document, who did the lock and when the lock took place.

Specified by:
getCurrentDocLockDetails in interface LockActions
Returns:
the user who took the look and the time when he/she did this in a map
Throws:
ClientException

getLockDetails

public Map<String,Serializable> getLockDetails(DocumentModel document)
                                        throws ClientException
Description copied from interface: LockActions
Gets the details about the lock of a document,who did the lock and when the lock took place.

Specified by:
getLockDetails in interface LockActions
Parameters:
document - the document for which this information is needed
Returns:
the user who took the look and the time when he/she did this in a map
Throws:
ClientException

isCurrentDocumentLiveEditable

@Deprecated
public Boolean isCurrentDocumentLiveEditable()
Deprecated. use LiveEditBootstrapHelper.isCurrentDocumentLiveEditable() instead

Description copied from interface: LockActions
This method is used to test whether the live-edit link should appear on a document.

Specified by:
isCurrentDocumentLiveEditable in interface LockActions
Returns:
true if the link can appear, false otherwise

resetLockState

@BypassInterceptors
public void resetLockState()
Specified by:
resetLockState in interface LockActions

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.