Example usage for org.springframework.dao RecoverableDataAccessException getMessage

List of usage examples for org.springframework.dao RecoverableDataAccessException getMessage

Introduction

In this page you can find the example usage for org.springframework.dao RecoverableDataAccessException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:org.alfresco.reporting.processor.NodeRefBasedPropertyProcessor.java

public void processQueueValues(String table) throws Exception {
    if (logger.isDebugEnabled())
        logger.debug("Enter processQueueValues table=" + table);

    // Statement stmt = null;
    // Properties tableDesc = dbhb.getTableDescription(stmt, table);

    if (logger.isDebugEnabled())
        logger.debug(//from  w w  w  .  j  a v  a  2  s .  co m
                "************ Found " + queue.size() + " entries in " + table + " **************** " + method);
    ReportLine rl = new ReportLine(table, getSimpleDateFormat(), reportingHelper);

    // Create the processing object once...

    long now_before = (new Date()).getTime();
    int queuesize = queue.size();
    for (int q = 0; q < queue.size(); q++) {
        String identifier = queue.get(q).toString();
        try {
            NodeRef nodeRef = new NodeRef(identifier.split(",")[0]);

            if (logger.isDebugEnabled()) {
                String name = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
                logger.debug("processQueueValues: " + q + "/" + queuesize + ": " + name);
            }

            // run each queue entry through the processing object
            rl = processNodeToMap(identifier, table, rl);

            int numberOfRows = 0;
            if (logger.isDebugEnabled())
                logger.debug("Current method=" + this.method);
            try { // SINGLE_INSTANCE,
                  // logger.debug(method + " ##### " + rl.size());
                if ((rl.size() > 0) /*
                                    * &&
                                    * (rl.getValue("sys_node_uuid").length(
                                    * )>5)
                                    */) {
                    // logger.debug("method="+method+" && row exists?");

                    if (this.method.equals(Constants.INSERT_ONLY)) {
                        // if (logger.isDebugEnabled()) logger.debug("Going
                        // INSERT_ONLY");

                        numberOfRows = dbhb.insertIntoTable(rl);
                        // logger.debug(numberOfRows+ " rows inserted");
                    }

                    // -------------------------------------------------------------

                    if (this.method.equals(Constants.SINGLE_INSTANCE)) {
                        // if (logger.isDebugEnabled()) logger.debug("Going
                        // SINGLE_INSTANCE");

                        if (dbhb.rowExists(rl)) {
                            numberOfRows = dbhb.updateIntoTable(rl);
                            // logger.debug(numberOfRows+ " rows updated");
                        } else {
                            numberOfRows = dbhb.insertIntoTable(rl);
                            // logger.debug(numberOfRows+ " rows inserted");

                        }

                    }

                    // -------------------------------------------------------------

                    if (this.method.equals(Constants.UPDATE_VERSIONED)) {
                        if (logger.isDebugEnabled())
                            logger.debug("Going UPDATE_VERSIONED");
                        try {
                            if (dbhb.rowExists(rl)) {
                                numberOfRows = dbhb.updateVersionedIntoTable(rl);
                                // numberOfRows = dbhb.insertIntoTable(rl);
                                if (logger.isDebugEnabled())
                                    logger.debug(numberOfRows + " rows updated");
                            } else {
                                if (logger.isDebugEnabled()) {
                                    logger.debug("No rows exist");
                                    logger.debug("## Set " + rl.getInsertListOfKeys());
                                    logger.debug("## Values " + rl.getInsertListOfValues());
                                }
                                numberOfRows = dbhb.insertIntoTable(rl);
                                if (logger.isDebugEnabled())
                                    logger.debug(numberOfRows + " rows inserted");

                            }
                        } catch (org.springframework.dao.RecoverableDataAccessException rdae) {
                            throw new AlfrescoRuntimeException("processQueueValues1: " + rdae.getMessage());
                        } catch (Exception ee) {
                            ee.printStackTrace();
                            logger.fatal("processQueueValues Exception1: " + ee.getMessage());
                        }
                    }
                } // end if rl.size>0

            } catch (org.springframework.dao.RecoverableDataAccessException rdae) {
                throw new AlfrescoRuntimeException("processQueueValues2: " + rdae.getMessage());
            } catch (Exception e) {
                logger.fatal("processQueueValues Exception2: " + e.getStackTrace());
                e.printStackTrace();
            } finally {
                rl.reset();
            }
        } catch (Exception e) {
            logger.info("Bad node detected; ignoring... " + identifier);
        }
    } // end for scriptnode in queue

    long now_after = (new Date()).getTime();

    if (logger.isInfoEnabled()) {

        logger.info("processQueueValues summary: " + queuesize + " rows in " + (now_after - now_before)
                + "ms = " + (now_after - now_before) / queuesize + "ms per row");
    }

    if (logger.isDebugEnabled())
        logger.debug("Exit processQueueValues");
}