@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 PessimisticLock | createNewPessimisticLock(Document document,
                                                Map editMode,
                                                Person user)This method creates a new  PessimisticLockobject using the given document and user. | 
| void | delete(String id)This method deletes the given lock object | 
| Map | establishLocks(Document document,
                            Map editMode,
                            Person user)This implementation will check the given document, editMode map, and user object to verify Pessimistic Locking. | 
| void | establishWorkflowPessimisticLocking(Document document)This method creates a new  PessimisticLockwhen Workflow processing requires one | 
| PessimisticLock | generateNewLock(String documentNumber)This method will generate a new  PessimisticLockobject with a 'document'
 lock descriptor | 
| PessimisticLock | generateNewLock(String documentNumber,
                              Person user)This method will generate a new  PessimisticLockobject with a 'document'
 lock descriptor | 
| PessimisticLock | generateNewLock(String documentNumber,
                              String lockDescriptor)This method will generate a new  PessimisticLockobject with a lock descriptor of
 the given parameter | 
| PessimisticLock | generateNewLock(String documentNumber,
                              String lockDescriptor,
                              Person user)This method will generate a new  PessimisticLockobject with a lock descriptor of
 the given parameter | 
| DataDictionaryService | getDataDictionaryService() | 
| Set | getDocumentActions(Document document,
                                    Person user,
                                    Set<String> documentActions) | 
| protected Map | getEditModeWithEditableModesRemoved(Map currentEditMode)This method is used to remove edit modes from the given map that allow the user to edit data on the document. | 
| protected Map | getEntryEditModeReplacementMode(Map.Entry entry)This method is used to return values needed to replace the given 'entry type' edit mode  Map.Entrywith 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  PessimisticLockobjects required by
 Workflow.The default is the Kuali system user defined by RiceConstants#SYSTEM_USER. | 
| protected boolean | hasPreRouteEditAuthorization(Document document,
                                                        Person user)This method checks to see that the given user has a lock on the document and return true if one is found. | 
| protected boolean | isEntryEditMode(Map.Entry entry)This method is used to check if the given  Map.Entryis an 'entry type' edit mode and that the value is set to
 signify that this user has that edit mode available to them | 
| protected boolean | isLockRequiredByUser(Document document,
                                        Map editMode,
                                        Person user)This method is used to check if the given parameters warrant a new lock to be created for the given user. | 
| boolean | isPessimisticLockAdminUser(Person user)This method is used to identify who is an admin user for  PessimisticLockobjects | 
| 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) | 
protected DataObjectService dataObjectService
protected DataDictionaryService dataDictionaryService
protected PermissionService permissionService
protected PersonService personService
public PessimisticLockServiceImpl()
public void delete(String id)
PessimisticLockServicedelete in interface PessimisticLockServiceid - - the id of the lock to deletePessimisticLockService.delete(java.lang.String)public PessimisticLock generateNewLock(String documentNumber)
PessimisticLockServicePessimisticLock object with a 'document'
 lock descriptorgenerateNewLock in interface PessimisticLockServicedocumentNumber - - the document number of the document associated with the new lockPessimisticLockPessimisticLockService.generateNewLock(String)public PessimisticLock generateNewLock(String documentNumber, String lockDescriptor)
PessimisticLockServicePessimisticLock object with a lock descriptor of
 the given parametergenerateNewLock in interface PessimisticLockServicedocumentNumber - - 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)
PessimisticLockServicePessimisticLock object with a 'document'
 lock descriptorgenerateNewLock in interface PessimisticLockServicedocumentNumber - - the document number of the document associated with the new lockuser - - the user to set on the new lock being generatedPessimisticLockPessimisticLockService.generateNewLock(java.lang.String, org.kuali.rice.kim.api.identity.Person)public PessimisticLock generateNewLock(String documentNumber, String lockDescriptor, Person user)
PessimisticLockServicePessimisticLock object with a lock descriptor of
 the given parametergenerateNewLock in interface PessimisticLockServicedocumentNumber - - 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)
PessimisticLockServicegetPessimisticLocksForDocument in interface PessimisticLockServicedocumentNumber - - the document number of the document requiring locksPessimisticLock objects
 found for the given documentNumberPessimisticLockService.getPessimisticLocksForDocument(java.lang.String)public List<PessimisticLock> getPessimisticLocksForSession(String sessionId)
PessimisticLockServicegetPessimisticLocksForSession in interface PessimisticLockServicesessionId - - the session idPessimisticLock objects
 found for the given sessionIdPessimisticLockService.getPessimisticLocksForSession(java.lang.String)public boolean isPessimisticLockAdminUser(Person user)
PessimisticLockServicePessimisticLock objectsisPessimisticLockAdminUser in interface PessimisticLockServiceuser - - user to verify as adminPessimisticLockService.isPessimisticLockAdminUser(org.kuali.rice.kim.api.identity.Person)public void releaseAllLocksForUser(List<PessimisticLock> locks, Person user)
PessimisticLockServicereleaseAllLocksForUser in interface PessimisticLockServicelocks - - 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)
PessimisticLockServicereleaseAllLocksForUser in interface PessimisticLockServicelocks - - 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)
PessimisticLockServicesave in interface PessimisticLockServicePessimisticLockService.save(org.kuali.rice.krad.document.authorization.PessimisticLock)public Set getDocumentActions(Document document, Person user, Set<String> documentActions)
getDocumentActions in interface PessimisticLockServicedocument - user - 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).protected boolean usesPessimisticLocking(Document document)
public void establishWorkflowPessimisticLocking(Document document)
PessimisticLock when Workflow processing requires oneestablishWorkflowPessimisticLocking in interface PessimisticLockServicedocument - - 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 PessimisticLockServicedocument - - 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 objectpublic 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 PessimisticLockServicedocument - - 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)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' byprotected 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) methodprotected 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 replaceprotected 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–2014 The Kuali Foundation. All rights reserved.