Example usage for org.springframework.dao DataAccessException getMessage

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

Introduction

In this page you can find the example usage for org.springframework.dao DataAccessException 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.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean deleteNewsLinks(Long personId, Long contextId) {
    if (log.isDebugEnabled()) {
        log.debug("deleteNewsLinks( " + personId + "," + contextId + ")");
    }//from w ww  .  j a v  a2  s. c o m

    try {
        getJdbcTemplate().update(getStatement("delete.NewsLinks.by.person.context"),
                new Object[] { personId, contextId });
        return true;
    } catch (DataAccessException ex) {
        log.warn("deleteCalendarLinks: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean deleteNewsLinksBefore(Date expireBefore, boolean starred, boolean hidden) {
    log.info("deleteNewsLinksBefore( " + expireBefore + "," + starred + "," + hidden + ")");

    try {/*from w  ww. j av a  2  s  .  c  om*/
        getJdbcTemplate().update(getStatement("delete.NewsLinks.by.item_newsTime.starred.hidden"),
                new Object[] { expireBefore, new Boolean(starred), new Boolean(hidden) });
        return true;
    } catch (DataAccessException ex) {
        log.warn("deleteNewsLinksBefore: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean deleteTaskLocks(String task) {
    if (log.isDebugEnabled()) {
        log.debug("deleteTaskLocks( " + task + ")");
    }/*from   ww w. jav  a 2  s.co m*/

    try {
        getJdbcTemplate().update(getStatement("delete.TaskLock.by.task"), new Object[] { task });
        return true;
    } catch (DataAccessException ex) {
        log.warn("deleteTaskLocks: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public List<AvailabilityCheck> getAvailabilityChecksBeforeTime(Date time) {
    if (log.isDebugEnabled()) {
        log.debug("getAvailabilityChecksBeforeTime(" + time + ")");
    }//from ww w .  j a v a2  s  .c o  m
    String sql = getStatement("select.AvailabilityChecks.before.date");
    Object[] params = new Object[] { time };
    try {
        return (List<AvailabilityCheck>) getJdbcTemplate().query(sql, params, new AvailabilityCheckMapper());
    } catch (DataAccessException ex) {
        log.warn("getAvailabilityChecksBeforeTime: Error executing query: " + ex.getClass() + ":"
                + ex.getMessage());
        return new ArrayList<AvailabilityCheck>();
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public RepeatingCalendarItem getRepeatingCalendarItem(String entityReference, String calendarTimeLabelKey) {
    if (log.isDebugEnabled()) {
        log.debug("getRepeatingCalendarItem(" + entityReference + "," + calendarTimeLabelKey + ")");
    }/*  w  w w .java2s  .c o m*/

    try {
        return (RepeatingCalendarItem) getJdbcTemplate().queryForObject(
                getStatement("select.RepeatingCalendarItem.by.entityReference.calendarTimeLabelKey"),
                new Object[] { entityReference, calendarTimeLabelKey }, new RepeatingCalendarItemMapper());
    } catch (DataAccessException ex) {
        log.warn("getRepeatingCalendarItem: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return null;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public List<RepeatingCalendarItem> getRepeatingCalendarItems() {
    if (log.isDebugEnabled()) {
        log.debug("getRepeatingCalendarItems()");
    }/*from  ww w .  j  av  a2 s. c  o  m*/
    String sql = getStatement("select.RepeatingEvents");
    try {
        return (List<RepeatingCalendarItem>) getJdbcTemplate().query(sql, new RepeatingCalendarItemMapper());
    } catch (DataAccessException ex) {
        log.warn("getRepeatingCalendarItems: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return new ArrayList<RepeatingCalendarItem>();
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public CalendarItem getCalendarItem(String entityReference, String calendarTimeLabelKey,
        Integer sequenceNumber) {
    if (log.isDebugEnabled()) {
        log.debug(/* w  w  w.  j a  va 2 s.co m*/
                "getCalendarItem(" + entityReference + "," + calendarTimeLabelKey + "," + sequenceNumber + ")");
    }

    String sql = null;
    Object[] params = null;
    if (sequenceNumber == null) {
        sql = getStatement("select.CalendarItem.by.entityReference.calendarTimeLabelKey");
        params = new Object[] { entityReference, calendarTimeLabelKey };
    } else if (calendarTimeLabelKey == null) {
        sql = getStatement("select.CalendarItem.by.entityReference.sequenceNumber");
        params = new Object[] { entityReference, sequenceNumber };
    } else {
        sql = getStatement("select.CalendarItem.by.entityReference.calendarTimeLabelKey.sequenceNumber");
        params = new Object[] { entityReference, calendarTimeLabelKey, sequenceNumber };
    }

    try {
        return (CalendarItem) getJdbcTemplate().queryForObject(sql, params, new CalendarItemMapper());
    } catch (EmptyResultDataAccessException ex) {
        log.debug("getCalendarItem: Empty result executing query: " + ex.getClass() + ":" + ex.getMessage());
        // System.out.println("addCalendarItem: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return null;
    } catch (DataAccessException e) {
        log.warn("getCalendarItem: Error executing query: " + e.getClass() + ":" + e.getMessage());
        // System.out.println("addCalendarItem: Error executing query: " + e.getClass() + ":" + e.getMessage());
        return null;
    } catch (Exception e) {
        log.warn("addCalendarItem: Error executing query: " + e.getClass() + ":" + e.getMessage());
        // System.out.println("addCalendarItem: Error executing query: " + e.getClass() + ":" + e.getMessage());
        return null;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean addEvent(Date eventDate, String event, String itemRef, String contextId, String sessionId,
        String eventCode) {/*from ww w .ja v a2 s. co m*/
    if (log.isDebugEnabled()) {
        log.debug("saveEvent( " + eventDate + "," + event + "," + itemRef + "," + contextId + "," + sessionId
                + "," + eventCode + ")");
    }

    //  insert.EventLog = insert into dash_event (event_date, event, ref, context, session_id, event_code) values (?, ?, ?, ?, ?, ?)
    String sql = getStatement("insert.EventLog");
    Object[] params = new Object[] { eventDate, event, itemRef, contextId, sessionId, eventCode };

    try {
        getJdbcTemplate().update(sql, params);
        return true;
    } catch (DataIntegrityViolationException e) {
        // this means we're trying to insert a duplicate
        log.debug("addEvent() " + e);
        return false;
    } catch (DataAccessException ex) {
        log.warn("saveEvent: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        //System.out.println("addRepeatingCalendarItem: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }

}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean updateCalendarItemTime(Long id, Date newTime) {
    if (log.isDebugEnabled()) {
        log.debug("updateCalendarItemTime( " + id + "," + newTime + ")");
    }//from   w ww  .j  a  va2 s . c  o m

    try {
        getJdbcTemplate().update(getStatement("update.CalendarItem.calendarTime"),
                new Object[] { newTime, id });
        return true;
    } catch (DataAccessException ex) {
        log.warn("updateCalendarItemTime: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }
}

From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java

public boolean updateCalendarItemTime(String entityReference, String labelKey, Integer sequenceNumber,
        Date newDate) {/*w  w  w.  ja  v  a2  s . c  o m*/
    if (log.isDebugEnabled()) {
        log.debug("updateCalendarItemTime( " + entityReference + "," + labelKey + "," + sequenceNumber + ","
                + newDate + ")");
    }

    try {
        if (sequenceNumber == null) {
            getJdbcTemplate().update(getStatement("update.CalendarItem.calendarTime.entityReference.labelKey"),
                    new Object[] { newDate, entityReference, labelKey });
        } else {
            getJdbcTemplate().update(
                    getStatement("update.CalendarItem.calendarTime.entityReference.labelKey.sequenceNumber"),
                    new Object[] { newDate, entityReference, labelKey, sequenceNumber });
        }
        return true;
    } catch (DataAccessException ex) {
        log.warn("updateCalendarItemTime: Error executing query: " + ex.getClass() + ":" + ex.getMessage());
        return false;
    }
}