Interface PessimisticLockService


public interface PessimisticLockService
Service interface for documents to use the Pessimistic Locking mechanism
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Details

    • 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
    • getPessimisticLocksForSession

      List<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 PessimisticLock objects found for the given sessionId
    • 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

      This method saves the given lock object
    • establishPessimisticLocks

      boolean establishPessimisticLocks(Document document, Person user, boolean canEdit)
      Establishes pessimistic locks for user on the document based whether the user can edit the document.

      Will only establish a new pessimistic lock if one doesn't exist for the user and one can be created based on other pessimistic locks in the system and whether user can edit the document. Will return true if either a new pessimistic lock was established or one already exists for the user.

      Parameters:
      document - the document on which the locks will be established
      user - the user for which the locks are being established
      canEdit - 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, Person user)
      Deprecated.
      For KRAD, use @{code establishPessimisticLocks} to generate locks and calculatePessimisticLockEditModes to get the edit modes based on the current locks
      Parameters:
      document - - the document locks are to be established against or by
      editMode - - the editMode
      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

      @Deprecated Set getDocumentActions(Document document, Person user, Set<String> documentActions)
      Deprecated.
      KRAD has integrated this functionality into TransactionalDocumentAuthorizerBase
      Parameters:
      document -
      user -
      Returns:
      Set of actions are permitted the given user on the given document