Package org.kuali.rice.krad.service
Interface PessimisticLockService
public interface PessimisticLockService
Service interface for documents to use the Pessimistic Locking mechanism
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionvoidThis method deletes the given lock objectestablishLocks(Document document, Map editMode, org.kuali.rice.kim.api.identity.Person user) Deprecated.booleanestablishPessimisticLocks(Document document, org.kuali.rice.kim.api.identity.Person user, boolean canEdit) Establishes pessimistic locks foruseron thedocumentbased whether theusercan edit the document.voidestablishWorkflowPessimisticLocking(Document document) org.kuali.rice.krad.document.authorization.PessimisticLockgenerateNewLock(String documentNumber) This method will generate a newPessimisticLockobject with a 'document' lock descriptororg.kuali.rice.krad.document.authorization.PessimisticLockgenerateNewLock(String documentNumber, String lockDescriptor) This method will generate a newPessimisticLockobject with a lock descriptor of the given parameterorg.kuali.rice.krad.document.authorization.PessimisticLockgenerateNewLock(String documentNumber, String lockDescriptor, org.kuali.rice.kim.api.identity.Person user) This method will generate a newPessimisticLockobject with a lock descriptor of the given parameterorg.kuali.rice.krad.document.authorization.PessimisticLockgenerateNewLock(String documentNumber, org.kuali.rice.kim.api.identity.Person user) This method will generate a newPessimisticLockobject with a 'document' lock descriptorgetDocumentActions(Document document, org.kuali.rice.kim.api.identity.Person user, Set<String> documentActions) Deprecated.KRAD has integrated this functionality intoTransactionalDocumentAuthorizerBaseList<org.kuali.rice.krad.document.authorization.PessimisticLock> getPessimisticLocksForDocument(String documentNumber) This method gets all locks associated with the given document numberList<org.kuali.rice.krad.document.authorization.PessimisticLock> getPessimisticLocksForSession(String sessionId) Return all locks associated with the given session idbooleanisPessimisticLockAdminUser(org.kuali.rice.kim.api.identity.Person user) This method is used to identify who is an admin user forPessimisticLockobjectsvoidreleaseAllLocksForUser(List<org.kuali.rice.krad.document.authorization.PessimisticLock> locks, org.kuali.rice.kim.api.identity.Person user) This method will release all locks in the given list that are owned by the given uservoidreleaseAllLocksForUser(List<org.kuali.rice.krad.document.authorization.PessimisticLock> locks, org.kuali.rice.kim.api.identity.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 valuevoidreleaseWorkflowPessimisticLocking(Document document) org.kuali.rice.krad.document.authorization.PessimisticLocksave(org.kuali.rice.krad.document.authorization.PessimisticLock lock) This method saves the given lock object
-
Method Details
-
delete
This method deletes the given lock object- Parameters:
id- - the id of the lock to delete
-
generateNewLock
This method will generate a newPessimisticLockobject 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
org.kuali.rice.krad.document.authorization.PessimisticLock generateNewLock(String documentNumber, String lockDescriptor) This method will generate a newPessimisticLockobject with a lock descriptor of the given parameter- Parameters:
documentNumber- - the document number of the document associated with the new locklockDescriptor- - the lock descriptor the new PessimisticLock object should contain- Returns:
- the newly generated
PessimisticLockcontaining the given lockDescriptor
-
generateNewLock
org.kuali.rice.krad.document.authorization.PessimisticLock generateNewLock(String documentNumber, org.kuali.rice.kim.api.identity.Person user) This method will generate a newPessimisticLockobject with a 'document' lock descriptor- Parameters:
documentNumber- - the document number of the document associated with the new lockuser- - the user to set on the new lock being generated- Returns:
- the newly generated document descriptor
PessimisticLock
-
generateNewLock
org.kuali.rice.krad.document.authorization.PessimisticLock generateNewLock(String documentNumber, String lockDescriptor, org.kuali.rice.kim.api.identity.Person user) This method will generate a newPessimisticLockobject with a lock descriptor of the given parameter- Parameters:
documentNumber- - the document number of the document associated with the new locklockDescriptor- - the lock descriptor the new PessimisticLock object should containuser- - the user to set on the new lock being generated- Returns:
- the newly generated
PessimisticLockcontaining the given lockDescriptor
-
getPessimisticLocksForDocument
List<org.kuali.rice.krad.document.authorization.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
PessimisticLockobjects found for the given documentNumber
-
getPessimisticLocksForSession
List<org.kuali.rice.krad.document.authorization.PessimisticLock> getPessimisticLocksForSession(String sessionId) Return all locks associated with the given session id- Parameters:
sessionId- - the session id- Returns:
- an empty list of no locks are found or the list of
PessimisticLockobjects found for the given sessionId
-
isPessimisticLockAdminUser
boolean isPessimisticLockAdminUser(org.kuali.rice.kim.api.identity.Person user) This method is used to identify who is an admin user forPessimisticLockobjects- 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<org.kuali.rice.krad.document.authorization.PessimisticLock> locks, org.kuali.rice.kim.api.identity.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 useruser- - user to check for lock ownership
-
releaseAllLocksForUser
void releaseAllLocksForUser(List<org.kuali.rice.krad.document.authorization.PessimisticLock> locks, org.kuali.rice.kim.api.identity.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 useruser- - user to check for lock ownershiplockDescriptor- - lock descriptor value to match locks against
-
save
org.kuali.rice.krad.document.authorization.PessimisticLock save(org.kuali.rice.krad.document.authorization.PessimisticLock lock) This method saves the given lock object -
establishPessimisticLocks
boolean establishPessimisticLocks(Document document, org.kuali.rice.kim.api.identity.Person user, boolean canEdit) Establishes pessimistic locks foruseron thedocumentbased whether theusercan edit the document.Will only establish a new pessimistic lock if one doesn't exist for the
userand one can be created based on other pessimistic locks in the system and whetherusercan edit the document. Will return true if either a new pessimistic lock was established or one already exists for theuser.- Parameters:
document- the document on which the locks will be establisheduser- the user for which the locks are being establishedcanEdit- whether the user currently can edit the document- Returns:
- true if a pessimistic lock has been established, false otherwise
-
establishLocks
@Deprecated Map establishLocks(Document document, Map editMode, org.kuali.rice.kim.api.identity.Person user) Deprecated.For KRAD, use @{code establishPessimisticLocks} to generate locks andcalculatePessimisticLockEditModesto get the edit modes based on the current locks- Parameters:
document- - the document locks are to be established against or byeditMode- - the editModeuser- - 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
- Parameters:
document- - the document to create the lock against and add the lock to
-
releaseWorkflowPessimisticLocking
- Parameters:
document- - document to release locks from
-
getDocumentActions
@Deprecated Set getDocumentActions(Document document, org.kuali.rice.kim.api.identity.Person user, Set<String> documentActions) Deprecated.KRAD has integrated this functionality intoTransactionalDocumentAuthorizerBase- Parameters:
document-user-- Returns:
- Set of actions are permitted the given user on the given document
-
calculatePessimisticLockEditModesto get the edit modes based on the current locks