@Transactional public class PessimisticLockServiceImpl extends Object implements PessimisticLockService
Modifier and Type | Field and Description |
---|---|
protected DataDictionaryService |
dataDictionaryService |
protected DataObjectService |
dataObjectService |
protected PermissionService |
permissionService |
protected PersonService |
personService |
Constructor and Description |
---|
PessimisticLockServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkExistingPessimisticLocks(Document document,
List<String> userOwnedLockDescriptors,
Map<String,Set<String>> otherOwnedLockDescriptors)
Check to make sure that the current user doesn't erroneously share the same lock with another user.
|
protected PessimisticLock |
createNewPessimisticLock(Document document,
Map editMode,
Person user)
Deprecated.
|
protected PessimisticLock |
createNewPessimisticLock(Document document,
Person user)
|
void |
delete(String id)
This method deletes the given lock object
|
Map |
establishLocks(Document document,
Map editMode,
Person user)
Deprecated.
|
boolean |
establishPessimisticLocks(Document document,
Person user,
boolean canEdit)
Establishes pessimistic locks for
user on the document based whether the user can edit
the document. |
void |
establishWorkflowPessimisticLocking(Document document)
This method creates a new
PessimisticLock when Workflow processing requires one |
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 |
DataDictionaryService |
getDataDictionaryService() |
Set |
getDocumentActions(Document document,
Person user,
Set<String> documentActions)
Deprecated.
|
protected Map |
getEditModeWithEditableModesRemoved(Map currentEditMode)
Deprecated.
|
protected Map |
getEntryEditModeReplacementMode(Map.Entry entry)
This method is used to return values needed to replace the given 'entry type' edit mode
Map.Entry with one that will not allow the user to enter data on the document |
PermissionService |
getPermissionService() |
PersonService |
getPersonService() |
List<PessimisticLock> |
getPessimisticLocksForDocument(String documentNumber)
This method gets all locks associated with the given document number
|
List<PessimisticLock> |
getPessimisticLocksForSession(String sessionId)
Return all locks associated with the given session id
|
protected Person |
getWorkflowPessimisticLockOwnerUser()
This method identifies the user that should be used to create and clear
PessimisticLock objects required by
Workflow.The default is the Kuali system user defined by RiceConstants#SYSTEM_USER . |
protected boolean |
hasPreRouteEditAuthorization(Document document,
Person user)
Deprecated.
Different mechanism of obtaining authorization in KRAD
|
protected boolean |
isEntryEditMode(Map.Entry entry)
Deprecated.
|
protected boolean |
isLockRequiredByUser(Document document,
Map editMode,
Person user)
Deprecated.
|
boolean |
isPessimisticLockAdminUser(Person user)
This method is used to identify who is an admin user for
PessimisticLock objects |
protected boolean |
isPessimisticLockNeeded(Document document,
Person user,
boolean canEdit)
Determines whether to add a pessimistic lock on the
document for user based on the current
pessimistic locks and edit modes. |
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)
This method releases locks created via the
establishWorkflowPessimisticLocking(Document) method for the given document |
PessimisticLock |
save(PessimisticLock lock)
This method saves the given lock object
|
void |
setDataDictionaryService(DataDictionaryService dataDictionaryService) |
void |
setDataObjectService(DataObjectService dataObjectService) |
protected boolean |
usesPessimisticLocking(Document document)
Deprecated.
|
protected DataObjectService dataObjectService
protected DataDictionaryService dataDictionaryService
protected PermissionService permissionService
protected PersonService personService
public PessimisticLockServiceImpl()
public void delete(String id)
PessimisticLockService
delete
in interface PessimisticLockService
id
- - the id of the lock to deletePessimisticLockService.delete(java.lang.String)
public PessimisticLock generateNewLock(String documentNumber)
PessimisticLockService
PessimisticLock
object with a 'document'
lock descriptorgenerateNewLock
in interface PessimisticLockService
documentNumber
- - the document number of the document associated with the new lockPessimisticLock
PessimisticLockService.generateNewLock(String)
public PessimisticLock generateNewLock(String documentNumber, String lockDescriptor)
PessimisticLockService
PessimisticLock
object with a lock descriptor of
the given parametergenerateNewLock
in interface PessimisticLockService
documentNumber
- - the document number of the document associated with the new locklockDescriptor
- - the lock descriptor the new PessimisticLock object should containPessimisticLock
containing the given lockDescriptorPessimisticLockService.generateNewLock(java.lang.String)
public PessimisticLock generateNewLock(String documentNumber, Person user)
PessimisticLockService
PessimisticLock
object with a 'document'
lock descriptorgenerateNewLock
in interface PessimisticLockService
documentNumber
- - the document number of the document associated with the new lockuser
- - the user to set on the new lock being generatedPessimisticLock
PessimisticLockService.generateNewLock(java.lang.String, org.kuali.rice.kim.api.identity.Person)
public PessimisticLock generateNewLock(String documentNumber, String lockDescriptor, Person user)
PessimisticLockService
PessimisticLock
object with a lock descriptor of
the given parametergenerateNewLock
in interface PessimisticLockService
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 generatedPessimisticLock
containing the given lockDescriptorPessimisticLockService.generateNewLock(java.lang.String, java.lang.String, org.kuali.rice.kim.api.identity.Person)
public List<PessimisticLock> getPessimisticLocksForDocument(String documentNumber)
PessimisticLockService
getPessimisticLocksForDocument
in interface PessimisticLockService
documentNumber
- - the document number of the document requiring locksPessimisticLock
objects
found for the given documentNumberPessimisticLockService.getPessimisticLocksForDocument(java.lang.String)
public List<PessimisticLock> getPessimisticLocksForSession(String sessionId)
PessimisticLockService
getPessimisticLocksForSession
in interface PessimisticLockService
sessionId
- - the session idPessimisticLock
objects
found for the given sessionIdPessimisticLockService.getPessimisticLocksForSession(java.lang.String)
public boolean isPessimisticLockAdminUser(Person user)
PessimisticLockService
PessimisticLock
objectsisPessimisticLockAdminUser
in interface PessimisticLockService
user
- - user to verify as adminPessimisticLockService.isPessimisticLockAdminUser(org.kuali.rice.kim.api.identity.Person)
public void releaseAllLocksForUser(List<PessimisticLock> locks, Person user)
PessimisticLockService
releaseAllLocksForUser
in interface PessimisticLockService
locks
- - locks to release if owned by given useruser
- - user to check for lock ownershipPessimisticLockService.releaseAllLocksForUser(java.util.List, org.kuali.rice.kim.api.identity.Person)
public void releaseAllLocksForUser(List<PessimisticLock> locks, Person user, String lockDescriptor)
PessimisticLockService
releaseAllLocksForUser
in interface PessimisticLockService
locks
- - locks to release if owned by given useruser
- - user to check for lock ownershiplockDescriptor
- - lock descriptor value to match locks againstPessimisticLockService.releaseAllLocksForUser(java.util.List, org.kuali.rice.kim.api.identity.Person, java.lang.String)
public PessimisticLock save(PessimisticLock lock)
PessimisticLockService
save
in interface PessimisticLockService
PessimisticLockService.save(org.kuali.rice.krad.document.authorization.PessimisticLock)
public boolean establishPessimisticLocks(Document document, Person user, boolean canEdit)
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
.
establishPessimisticLocks
in interface PessimisticLockService
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 documentprotected boolean isPessimisticLockNeeded(Document document, Person user, boolean canEdit)
document
for user
based on the current
pessimistic locks and edit modes.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 documentprotected void checkExistingPessimisticLocks(Document document, List<String> userOwnedLockDescriptors, Map<String,Set<String>> otherOwnedLockDescriptors)
document
- the document to check for erroneous locksuserOwnedLockDescriptors
- the list of lock descriptors for the current userotherOwnedLockDescriptors
- the map of other lock descriptors to all of the other users that own themprotected PessimisticLock createNewPessimisticLock(Document document, Person user)
PessimisticLock
on a document
for a user
.
If the document
uses custom lock descriptors, then the new lock is generated with a custom lock
descriptor for a portion of the document. Otherwise, it will create a lock over the entire document.
document
- the document on which the locks will be establisheduser
- the user for which the locks are being established@Deprecated public Set getDocumentActions(Document document, Person user, Set<String> documentActions)
getDocumentActions
in interface PessimisticLockService
@Deprecated protected boolean hasPreRouteEditAuthorization(Document document, Person user)
document
- - document to checkuser
- - current user#hasInitiateAuthorization(Document, Person)
), and the document has a lock owned by the given
user. If the document is not using Pessimistic Locking the value returned will be that returned by
#hasInitiateAuthorization(Document, Person)
.@Deprecated protected boolean usesPessimisticLocking(Document document)
public void establishWorkflowPessimisticLocking(Document document)
PessimisticLock
when Workflow processing requires oneestablishWorkflowPessimisticLocking
in interface PessimisticLockService
document
- - the document to create the lock against and add the lock toorg.kuali.rice.kns.document.authorization.DocumentAuthorizer#establishWorkflowPessimisticLocking(org.kuali.rice.krad.document.Document)
public void releaseWorkflowPessimisticLocking(Document document)
establishWorkflowPessimisticLocking(Document)
method for the given documentreleaseWorkflowPessimisticLocking
in interface PessimisticLockService
document
- - document to release locks fromorg.kuali.rice.kns.document.authorization.DocumentAuthorizer#releaseWorkflowPessimisticLocking(org.kuali.rice.krad.document.Document)
protected Person getWorkflowPessimisticLockOwnerUser()
PessimisticLock
objects required by
Workflow.RiceConstants#SYSTEM_USER
. This method can be overriden by
implementing documents if another user is needed.Person
object@Deprecated public Map establishLocks(Document document, Map editMode, Person user)
PessimisticLock
object will be created and set on the document for the given user.establishLocks
in interface PessimisticLockService
document
- - the document locks are to be established against or byeditMode
- - the editModeuser
- - the user locks are being established fororg.kuali.rice.kns.document.authorization.DocumentAuthorizer#establishLocks(org.kuali.rice.krad.document.Document,
java.util.Map, org.kuali.rice.kim.api.identity.Person)
@Deprecated protected boolean isLockRequiredByUser(Document document, Map editMode, Person user)
isEntryEditMode(java.util.Map.Entry)
method.document
- -
document to verify lock creation againsteditMode
- -
edit modes list to check for 'entry type' edit modesuser
- -
user the lock will be 'owned' by@Deprecated protected Map getEditModeWithEditableModesRemoved(Map currentEditMode)
isEntryEditMode(java.util.Map.Entry)
method to identify if an edit mode is defined as an
'entry type' edit mode. It also uses the getEntryEditModeReplacementMode(java.util.Map.Entry)
method to replace
any 'entry type' edit modes it finds.currentEditMode
- -
current set of edit modes the user has assigned to themgetEntryEditModeReplacementMode(java.util.Map.Entry)
method@Deprecated protected boolean isEntryEditMode(Map.Entry entry)
Map.Entry
is an 'entry type' edit mode and that the value is set to
signify that this user has that edit mode available to thementry
- -
the Map.Entry
object that contains an edit mode such as the ones returned but
#getEditMode(Document, Person)
#EDIT_MODE_DEFAULT_TRUE_VALUE
... false if notprotected Map getEntryEditModeReplacementMode(Map.Entry entry)
Map.Entry
with one that will not allow the user to enter data on the documententry
- - the current 'entry type' edit mode to replace@Deprecated protected PessimisticLock createNewPessimisticLock(Document document, Map editMode, Person user)
PessimisticLock
object using the given document and user. If the document's
useCustomLockDescriptors() method returns true then the new lock will also have a custom lock descriptor
value set to the return value of the document's getCustomLockDescriptor(Person) method.document
- -
document to place the lock oneditMode
- -
current edit modes for given useruser
- -
user who will 'own' the new lock objectpublic PersonService getPersonService()
public DataDictionaryService getDataDictionaryService()
public void setDataDictionaryService(DataDictionaryService dataDictionaryService)
public PermissionService getPermissionService()
public void setDataObjectService(DataObjectService dataObjectService)
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.