Search in sources :

Example 1 with OptimisticLockException

use of org.apache.ojb.broker.OptimisticLockException in project cu-kfs by CU-CommunityApps.

the class DocumentRouteHeaderDAOOjbImpl method saveRouteHeader.

public void saveRouteHeader(DocumentRouteHeaderValue routeHeader) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("About to Save the route Header: " + routeHeader.getDocumentId() + " / version=" + routeHeader.getVersionNumber());
        DocumentRouteHeaderValue currHeader = findRouteHeader(routeHeader.getDocumentId());
        if (currHeader != null) {
            LOG.debug("Current Header Version: " + currHeader.getVersionNumber());
        } else {
            LOG.debug("Current Header: null");
        }
        LOG.debug(ExceptionUtils.getStackTrace(new Throwable()));
    }
    try {
        getPersistenceBrokerTemplate().store(routeHeader);
        /*
             * FINP-7381 changes from KualiCo patch release 2021-02-26 applied to
             * original KEW-to-KFS KualiCo patch release 2021-01-28 version of the file.
             */
        getPersistenceBrokerTemplate().store(getDocumentContentToStore(routeHeader));
    } catch (RuntimeException ex) {
        if (ex.getCause() instanceof OptimisticLockException) {
            LOG.error("Optimistic Locking Exception saving document header or content. Offending object: " + ((OptimisticLockException) ex.getCause()).getSourceObject() + "; DocumentId = " + routeHeader.getDocumentId() + " ;  Version Number = " + routeHeader.getVersionNumber());
        }
        LOG.error("Unable to save document header or content. Route Header: " + routeHeader, ex);
        throw ex;
    }
}
Also used : WorkflowRuntimeException(org.kuali.kfs.kew.api.WorkflowRuntimeException) OptimisticLockException(org.apache.ojb.broker.OptimisticLockException) DocumentRouteHeaderValue(org.kuali.kfs.kew.routeheader.DocumentRouteHeaderValue)

Aggregations

OptimisticLockException (org.apache.ojb.broker.OptimisticLockException)1 WorkflowRuntimeException (org.kuali.kfs.kew.api.WorkflowRuntimeException)1 DocumentRouteHeaderValue (org.kuali.kfs.kew.routeheader.DocumentRouteHeaderValue)1