org.kuali.rice.krad.service
Interface PessimisticLockService

All Known Implementing Classes:
PessimisticLockServiceImpl

public interface PessimisticLockService

This is the service interface for documents to use the Pessimistic Locking mechanism

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
 void delete(String id)
          This method deletes the given lock object
 Map establishLocks(Document document, Map editMode, Person user)
           
 void establishWorkflowPessimisticLocking(Document document)
           
 PessimisticLock generateNewLock(String documentNumber)
          This method will generate a new PessimisticLock object with a 'document' lock descriptor
 PessimisticLock generateNewLock(String documentNumber, Person user)
          This method will generate a new PessimisticLock object with a 'document' lock descriptor
 PessimisticLock generateNewLock(String documentNumber, String lockDescriptor)
          This method will generate a new PessimisticLock object with a lock descriptor of the given parameter
 PessimisticLock generateNewLock(String documentNumber, String lockDescriptor, Person user)
          This method will generate a new PessimisticLock object with a lock descriptor of the given parameter
 Set getDocumentActions(Document document, Person user, Set<String> documentActions)
           
 List<PessimisticLock> getPessimisticLocksForDocument(String documentNumber)
          This method gets all locks associated with the given document number
 boolean isPessimisticLockAdminUser(Person user)
          This method is used to identify who is an admin user for PessimisticLock objects
 void releaseAllLocksForUser(List<PessimisticLock> locks, Person user)
          This method will release all locks in the given list that are owned by the given user
 void releaseAllLocksForUser(List<PessimisticLock> locks, Person user, String lockDescriptor)
          This method will release all locks in the given list that are owned by the given user that have a matching lock descriptor value
 void releaseWorkflowPessimisticLocking(Document document)
           
 PessimisticLock save(PessimisticLock lock)
          This method saves the given lock object
 

Method Detail

delete

void delete(String id)
This method deletes the given lock object

Parameters:
id - - the id of the lock to delete

generateNewLock

PessimisticLock generateNewLock(String documentNumber)
This method will generate a new PessimisticLock object with a 'document' lock descriptor

Parameters:
documentNumber - - the document number of the document associated with the new lock
Returns:
the newly generated document descriptor PessimisticLock

generateNewLock

PessimisticLock generateNewLock(String documentNumber,
                                String lockDescriptor)
This method will generate a new PessimisticLock object with a lock descriptor of the given parameter

Parameters:
documentNumber - - the document number of the document associated with the new lock
lockDescriptor - - the lock descriptor the new PessimisticLock object should contain
Returns:
the newly generated PessimisticLock containing the given lockDescriptor

generateNewLock

PessimisticLock generateNewLock(String documentNumber,
                                Person user)
This method will generate a new PessimisticLock object with a 'document' lock descriptor

Parameters:
documentNumber - - the document number of the document associated with the new lock
user - - the user to set on the new lock being generated
Returns:
the newly generated document descriptor PessimisticLock

generateNewLock

PessimisticLock generateNewLock(String documentNumber,
                                String lockDescriptor,
                                Person user)
This method will generate a new PessimisticLock object with a lock descriptor of the given parameter

Parameters:
documentNumber - - the document number of the document associated with the new lock
lockDescriptor - - the lock descriptor the new PessimisticLock object should contain
user - - the user to set on the new lock being generated
Returns:
the newly generated PessimisticLock containing the given lockDescriptor

getPessimisticLocksForDocument

List<PessimisticLock> getPessimisticLocksForDocument(String documentNumber)
This method gets all locks associated with the given document number

Parameters:
documentNumber - - the document number of the document requiring locks
Returns:
an empty list if no locks are found or the list of PessimisticLock objects found for the given documentNumber

isPessimisticLockAdminUser

boolean isPessimisticLockAdminUser(Person user)
This method is used to identify who is an admin user for PessimisticLock objects

Parameters:
user - - user to verify as admin
Returns:
true if the given use is an admin user or false if not

releaseAllLocksForUser

void releaseAllLocksForUser(List<PessimisticLock> locks,
                            Person user)
This method will release all locks in the given list that are owned by the given user

Parameters:
locks - - locks to release if owned by given user
user - - user to check for lock ownership

releaseAllLocksForUser

void releaseAllLocksForUser(List<PessimisticLock> locks,
                            Person user,
                            String lockDescriptor)
This method will release all locks in the given list that are owned by the given user that have a matching lock descriptor value

Parameters:
locks - - locks to release if owned by given user
user - - user to check for lock ownership
lockDescriptor - - lock descriptor value to match locks against

save

PessimisticLock save(PessimisticLock lock)
This method saves the given lock object


establishLocks

Map establishLocks(Document document,
                   Map editMode,
                   Person user)
Parameters:
document - - the document locks are to be established against or by
editMode - - the editMode returned by the method #getEditMode(Document, Person)
user - - the user locks are being established for
Returns:
New map generated by locking logic combined with passed in parameter editMode. Map contains keys AuthorizationConstants.EditMode value (String) which indicates what operations the user is currently allowed to take on that document. This may be a modified list of

establishWorkflowPessimisticLocking

void establishWorkflowPessimisticLocking(Document document)
Parameters:
document - - the document to create the lock against and add the lock to

releaseWorkflowPessimisticLocking

void releaseWorkflowPessimisticLocking(Document document)
Parameters:
document - - document to release locks from

getDocumentActions

Set getDocumentActions(Document document,
                       Person user,
                       Set<String> documentActions)
Parameters:
document -
user -
Returns:
Set of actions are permitted the given user on the given document


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.