public class AwardSyncServiceImpl extends Object implements AwardSyncService
| Modifier and Type | Class and Description |
|---|---|
protected class |
AwardSyncServiceImpl.RunSyncOnAward
Runnable that calls
AwardSyncServiceImpl#applyChanges in a separate thread. |
protected class |
AwardSyncServiceImpl.SendAdHocRequests
Runnable that sends a list of ad hoc requests in a separate thread.
|
protected class |
AwardSyncServiceImpl.SyncRunnable
Parent for thread based runnables related to award sync to provide a finished flag that
supports ensuring all threads are finished.
|
protected static class |
AwardSyncServiceImpl.SyncType
Validation or running full sync
|
protected class |
AwardSyncServiceImpl.TransactionRunnable
Abstract class that is used to generate runnables to run in transactions.
|
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CHANGE_LOG_SUCCESS |
protected static String |
IGNORED_MESSAGE_KEYS |
protected org.apache.commons.logging.Log |
LOG |
protected static String |
SYNC_FAILURE_MESSAGE |
protected static String |
SYNC_SAVED_MESSAGE |
protected static String |
SYNC_SUCCESS_MESSAGE |
protected static String |
VALIDATION_FAILURE_MESSAGE |
protected static String |
VALIDATION_SUCCESS_MESSAGE |
| Constructor and Description |
|---|
AwardSyncServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
applyAndValidateChanges(Award award,
AwardSyncStatus awardStatus,
List<AwardSyncChange> changes)
Apply the list of changes against the award and then validate the changes.
|
void |
applyAwardSyncChangesToHierarchy(Award award)
Apply the sync changes queued on the specified award against the award hierarchy
|
protected boolean |
applyChange(Award award,
AwardSyncChange change,
AwardSyncStatus awardStatus)
Apply single sync change to award.
|
protected void |
applyChange(Award award,
AwardSyncHelper syncHelper,
AwardSyncChange change)
Apply the specific change to the award using the specified syncHelper.
|
protected boolean |
areRunnablesFinished(List<AwardSyncServiceImpl.SyncRunnable> runnables)
Loops through all runnables and check their finished flags.
|
protected Award |
checkAwardVersions(String awardNumber,
AwardSyncStatus awardStatus,
String failureMessage)
Check and validate the status of the award.
|
protected void |
clearSyncStatuses(Award award)
Clears sync status from parent award as long as it has an award number(not the parent status),
and it is not yet complete.
|
protected void |
finalizeAward(AwardDocument awardDocument,
AwardSyncStatus awardSyncStatus)
Blanket Approve the award document.
|
protected void |
finalizeAwardStatus(AwardDocument awardDocument,
AwardSyncStatus awardStatus,
String successMessage,
AwardSyncServiceImpl.SyncType syncType,
List<String> principalsToNotify)
Finalize the award sync.
|
protected AwardSyncStatus |
findAwardSyncStatus(Award parentAward,
String awardNumber)
Find or create a new award status for the award number.
|
protected Award |
getActiveAward(String awardNumber)
Get the active version of an award if it exists.
|
protected List<String> |
getAllPrincipalsToNotify(List<AwardSyncServiceImpl.SyncRunnable> runnables)
Collects all prinicipalsToNotify from
#RunSyncOnAward runnables in the list
of runnables. |
protected AwardHierarchyService |
getAwardHierarchyService() |
AwardDocument |
getAwardLockingHierarchyForSync(AwardDocument awardDocument,
String principalId)
Checks to see if the award hierarchy is locked for the given principal.
|
protected AwardService |
getAwardService() |
protected AwardSyncCreationService |
getAwardSyncCreationService() |
protected AwardSyncHelpersService |
getAwardSyncHelpersService() |
protected AwardSyncSelectorService |
getAwardSyncSelectorService() |
protected AwardSyncUtilityService |
getAwardSyncUtilityService() |
protected org.kuali.rice.krad.service.BusinessObjectService |
getBusinessObjectService() |
protected org.kuali.rice.krad.service.DocumentService |
getDocumentService() |
protected KraAuthorizationService |
getKraAuthorizationService() |
protected KraWorkflowService |
getKraWorkflowService() |
protected List<String> |
getNotificationList(AwardDocument awardDocument)
Save award and generate a list of workflow recipients as if this document
were normally routed to later be used in an FYI list of the parent award.
|
protected AwardSyncStatus |
getParentAwardStatus(Award parentAward)
Finds the parents award status log entry, the one without an award listed.
|
protected Award |
getPendingAward(String awardNumber)
Get the pending version for the award if it exists.
|
protected org.kuali.rice.kim.api.identity.PersonService |
getPersonService() |
protected org.kuali.rice.krad.service.PessimisticLockService |
getPessimisticLockService() |
protected org.springframework.core.task.TaskExecutor |
getSyncExecutor() |
protected AwardSyncHelper |
getSyncHelper(String className)
Get the syncHelper from the syncHelpers for the given className.
|
protected VersionHistoryService |
getVersionHistoryService() |
protected boolean |
hasAwardPermission(AwardSyncStatus awardStatus,
Award award,
String principalId)
Ensure that the person specified by principalId has modify permission on the award specified.
|
protected AwardDocument |
loadAwardDocument(Award award)
Attempts to load the award document for the specified award.
|
protected void |
logFailure(AwardSyncStatus awardStatus,
String statusMessage,
String logMessage)
Set the status to failure and set the status to the message and add the log message.
|
protected org.kuali.rice.krad.UserSession |
replaceSessionWithRoutedBy(Award parentAward)
Replace the UserSession with one for the user who routed the parent award.
|
protected void |
runInTransaction(AwardSyncServiceImpl.TransactionRunnable runnable)
Run the runnable in a separate transaction, commiting when finished or rolling back
if an exception is generated.
|
protected void |
runSync(Award award,
AwardSyncServiceImpl.SyncType syncType)
Run validation or full sync depending on syncType on the award hierarchy under award.
|
protected void |
runSyncChanges(Award parentAward,
AwardHierarchy hierarchy,
AwardSyncServiceImpl.SyncType syncType,
List<AwardSyncChange> changes,
List<String> principalsToNotify)
Run the actual sync changes against the specific award in the hierarchy.
|
protected void |
runSyncInThread(Award parentAward,
AwardHierarchy hierarchy,
AwardSyncServiceImpl.SyncType syncType,
List<AwardSyncChange> changes,
List<AwardSyncServiceImpl.SyncRunnable> runnables)
Run
AwardSyncServiceImpl#applyChanges through the use of #RunSyncOnAward. |
protected void |
runSyncOnHierarchy(Award parentAward,
AwardHierarchy hierarchy,
List<AwardSyncChange> changes,
AwardSyncServiceImpl.SyncType syncType,
List<AwardSyncServiceImpl.SyncRunnable> runnables)
Run the sync recursively down the hierarchy.
|
protected void |
saveInTransaction(Object object)
Save or delete object in a separate thread using
#SaveBo. |
protected void |
sendAdHocRequestsInThread(AwardDocument document,
String annotation,
List<org.kuali.rice.krad.bo.AdHocRouteRecipient> recipients,
List<AwardSyncServiceImpl.SyncRunnable> runnables)
Send ad hoc requests in a thread.
|
protected void |
sendSyncFYIs(Award award,
List<String> principalsToNotify,
List<AwardSyncServiceImpl.SyncRunnable> runnables)
Sends FYIs to all principals listed in principalsToNotify for award.
|
void |
setAwardHierarchyService(AwardHierarchyService awardHierarchyService) |
void |
setAwardService(AwardService awardService) |
void |
setAwardSyncCreationService(AwardSyncCreationService awardSyncCreationService) |
void |
setAwardSyncHelpersService(AwardSyncHelpersService awardSyncHelpersService) |
void |
setAwardSyncSelectorService(AwardSyncSelectorService awardSyncSelectorService) |
void |
setAwardSyncUtilityService(AwardSyncUtilityService awardSyncUtilityService) |
void |
setBusinessObjectService(org.kuali.rice.krad.service.BusinessObjectService businessObjectService) |
void |
setDocumentService(org.kuali.rice.krad.service.DocumentService documentService) |
void |
setKraAuthorizationService(KraAuthorizationService kraAuthorizationService) |
void |
setKraWorkflowService(KraWorkflowService kraWorkflowService) |
protected void |
setParentAwardStatus(Award parentAward,
boolean success,
String newStatus)
Sets the parent award status for the sync.
|
void |
setPersonService(org.kuali.rice.kim.api.identity.PersonService personService) |
void |
setPessimisticLockService(org.kuali.rice.krad.service.PessimisticLockService pessimisticLockService) |
void |
setSyncExecutor(org.springframework.core.task.TaskExecutor syncExecutor) |
void |
setVersionHistoryService(VersionHistoryService versionHistoryService) |
void |
validateHierarchyChanges(Award award)
Run all validation checks against the award in the hierarchy and the sync changes attached to the specified award
|
protected boolean |
validateModifiedAward(AwardDocument award,
AwardSyncStatus awardStatus)
Run the
DocumentRuleBase.processSaveDocument(org.kuali.rice.krad.document.Document) and AwardDocumentRule.processRunAuditBusinessRules(org.kuali.rice.krad.document.Document)
against award. |
protected AwardDocument |
versionAndPrepareAwardDocument(Award parentAward,
Award oldAward,
AwardSyncStatus awardStatus)
Create new version of oldAward and prepare document for sync by setting document
description, transaction type, etc.
|
protected void |
waitTillRunablesFinished(List<AwardSyncServiceImpl.SyncRunnable> runnables)
Wait forever until all runnables are finished.
|
protected static final String VALIDATION_SUCCESS_MESSAGE
protected static final String VALIDATION_FAILURE_MESSAGE
protected static final String SYNC_SAVED_MESSAGE
protected static final String SYNC_SUCCESS_MESSAGE
protected static final String SYNC_FAILURE_MESSAGE
protected static final String CHANGE_LOG_SUCCESS
protected static final String IGNORED_MESSAGE_KEYS
protected final org.apache.commons.logging.Log LOG
public void validateHierarchyChanges(Award award)
AwardSyncServicevalidateHierarchyChanges in interface AwardSyncServiceAwardSyncService.validateHierarchyChanges(org.kuali.kra.award.home.Award)public void applyAwardSyncChangesToHierarchy(Award award)
AwardSyncServiceapplyAwardSyncChangesToHierarchy in interface AwardSyncServiceAwardSyncService.applyAwardSyncChangesToHierarchy(org.kuali.kra.award.home.Award)public AwardDocument getAwardLockingHierarchyForSync(AwardDocument awardDocument, String principalId)
AwardSyncServicegetAwardLockingHierarchyForSync in interface AwardSyncServiceAwardSyncService.getAwardLockingHierarchyForSync(org.kuali.kra.award.document.AwardDocument, java.lang.String)protected void runSync(Award award, AwardSyncServiceImpl.SyncType syncType)
award - syncType - protected void runSyncOnHierarchy(Award parentAward, AwardHierarchy hierarchy, List<AwardSyncChange> changes, AwardSyncServiceImpl.SyncType syncType, List<AwardSyncServiceImpl.SyncRunnable> runnables)
parentAward - hierarchy - changes - syncType - runnables - protected void clearSyncStatuses(Award award)
award - runnables - protected void sendSyncFYIs(Award award, List<String> principalsToNotify, List<AwardSyncServiceImpl.SyncRunnable> runnables) throws org.kuali.rice.kew.api.exception.WorkflowException
award - principalsToNotify - runnables - org.kuali.rice.kew.api.exception.WorkflowExceptionprotected void setParentAwardStatus(Award parentAward, boolean success, String newStatus)
parentAward - success - newStatus - runnables - protected AwardSyncStatus getParentAwardStatus(Award parentAward)
parentAward - protected AwardSyncStatus findAwardSyncStatus(Award parentAward, String awardNumber)
parentAward - awardNumber - protected org.kuali.rice.krad.UserSession replaceSessionWithRoutedBy(Award parentAward)
parentAward - protected Award checkAwardVersions(String awardNumber, AwardSyncStatus awardStatus, String failureMessage)
awardNumber - awardStatus - failureMessage - protected void runSyncChanges(Award parentAward, AwardHierarchy hierarchy, AwardSyncServiceImpl.SyncType syncType, List<AwardSyncChange> changes, List<String> principalsToNotify)
parentAward - hierarchy - syncType - changes - principalsToNotify - RuntimeExceptionprotected boolean applyAndValidateChanges(Award award, AwardSyncStatus awardStatus, List<AwardSyncChange> changes)
award - awardStatus - changes - protected void finalizeAwardStatus(AwardDocument awardDocument, AwardSyncStatus awardStatus, String successMessage, AwardSyncServiceImpl.SyncType syncType, List<String> principalsToNotify) throws org.kuali.rice.kew.api.exception.WorkflowException
awardDocument - awardStatus - successMessage - syncType - principalsToNotify - org.kuali.rice.kew.api.exception.WorkflowExceptionprotected AwardDocument loadAwardDocument(Award award)
awardStatus - award - errorMessage - runnables - protected void logFailure(AwardSyncStatus awardStatus, String statusMessage, String logMessage)
awardStatus - statusMessage - logMessage - protected boolean hasAwardPermission(AwardSyncStatus awardStatus, Award award, String principalId)
awardStatus - award - principalId - errorMessage - runnables - protected boolean validateModifiedAward(AwardDocument award, AwardSyncStatus awardStatus)
DocumentRuleBase.processSaveDocument(org.kuali.rice.krad.document.Document) and AwardDocumentRule.processRunAuditBusinessRules(org.kuali.rice.krad.document.Document)
against award. Add all messages generated from running the rules to logList as AwardSyncLog.
Return false if any of the error keys generated by the rules are not in the ignoredMessageKeys list.award - logs - protected void applyChange(Award award, AwardSyncHelper syncHelper, AwardSyncChange change) throws Exception
award - syncHelper - change - Exceptionprotected AwardSyncHelper getSyncHelper(String className)
className - protected Award getActiveAward(String awardNumber)
awardNumber - protected Award getPendingAward(String awardNumber)
awardNumber - protected void waitTillRunablesFinished(List<AwardSyncServiceImpl.SyncRunnable> runnables) throws AwardSyncException
runnables - AwardSyncExceptionprotected List<String> getAllPrincipalsToNotify(List<AwardSyncServiceImpl.SyncRunnable> runnables)
#RunSyncOnAward runnables in the list
of runnables.runnables - protected boolean areRunnablesFinished(List<AwardSyncServiceImpl.SyncRunnable> runnables)
runnables - protected boolean applyChange(Award award, AwardSyncChange change, AwardSyncStatus awardStatus)
parentAward - award - change - logList - protected AwardDocument versionAndPrepareAwardDocument(Award parentAward, Award oldAward, AwardSyncStatus awardStatus)
parentAward - oldAward - logList - protected List<String> getNotificationList(AwardDocument awardDocument) throws org.kuali.rice.kew.api.exception.WorkflowException
awardDocument - org.kuali.rice.kew.api.exception.WorkflowExceptionprotected void finalizeAward(AwardDocument awardDocument, AwardSyncStatus awardSyncStatus)
newAwardDocument - org.kuali.rice.kew.api.exception.WorkflowExceptionprotected void saveInTransaction(Object object)
#SaveBo.object - delete - runnables - protected void runInTransaction(AwardSyncServiceImpl.TransactionRunnable runnable)
runnable - protected void runSyncInThread(Award parentAward, AwardHierarchy hierarchy, AwardSyncServiceImpl.SyncType syncType, List<AwardSyncChange> changes, List<AwardSyncServiceImpl.SyncRunnable> runnables)
AwardSyncServiceImpl#applyChanges through the use of #RunSyncOnAward.parentAward - currentVersion - changes - runnables - protected void sendAdHocRequestsInThread(AwardDocument document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> recipients, List<AwardSyncServiceImpl.SyncRunnable> runnables)
document - annotation - recipients - runnables - protected AwardHierarchyService getAwardHierarchyService()
public void setAwardHierarchyService(AwardHierarchyService awardHierarchyService)
protected AwardService getAwardService()
public void setAwardService(AwardService awardService)
protected VersionHistoryService getVersionHistoryService()
public void setVersionHistoryService(VersionHistoryService versionHistoryService)
protected org.kuali.rice.krad.service.BusinessObjectService getBusinessObjectService()
public void setBusinessObjectService(org.kuali.rice.krad.service.BusinessObjectService businessObjectService)
protected org.kuali.rice.krad.service.DocumentService getDocumentService()
public void setDocumentService(org.kuali.rice.krad.service.DocumentService documentService)
protected org.springframework.core.task.TaskExecutor getSyncExecutor()
public void setSyncExecutor(org.springframework.core.task.TaskExecutor syncExecutor)
protected AwardSyncSelectorService getAwardSyncSelectorService()
public void setAwardSyncSelectorService(AwardSyncSelectorService awardSyncSelectorService)
protected org.kuali.rice.kim.api.identity.PersonService getPersonService()
public void setPersonService(org.kuali.rice.kim.api.identity.PersonService personService)
protected org.kuali.rice.krad.service.PessimisticLockService getPessimisticLockService()
public void setPessimisticLockService(org.kuali.rice.krad.service.PessimisticLockService pessimisticLockService)
protected KraWorkflowService getKraWorkflowService()
public void setKraWorkflowService(KraWorkflowService kraWorkflowService)
protected AwardSyncHelpersService getAwardSyncHelpersService()
public void setAwardSyncHelpersService(AwardSyncHelpersService awardSyncHelpersService)
protected AwardSyncCreationService getAwardSyncCreationService()
public void setAwardSyncCreationService(AwardSyncCreationService awardSyncCreationService)
protected AwardSyncUtilityService getAwardSyncUtilityService()
public void setAwardSyncUtilityService(AwardSyncUtilityService awardSyncUtilityService)
protected KraAuthorizationService getKraAuthorizationService()
public void setKraAuthorizationService(KraAuthorizationService kraAuthorizationService)
Copyright © 2013 The Kuali Foundation. All Rights Reserved.