@Test(groups = "slow") public void testInsertAcknowledgementLog() throws Exception { final List<ConfDataAlertIncidentLog> alertIncidentLogs = confDataDAO.selectAll(ConfDataAlertIncidentLog.TYPE_NAME, ConfDataAlertIncidentLog.class); final List<ConfDataPerson> confDataPersons = confDataDAO.selectAll(ConfDataPerson.TYPE_NAME, ConfDataPerson.class); final List<ConfDataAcknowledgementLog> acknowledgementLogs = confDataDAO.selectAll(ConfDataAcknowledgementLog.TYPE_NAME, ConfDataAcknowledgementLog.class); Assert.assertEquals(alertIncidentLogs.size(), 0); Assert.assertEquals(confDataPersons.size(), 0); Assert.assertEquals(acknowledgementLogs.size(), 0); final long alertIncidentId = createAndCheckAlertIncidentLog(); final long personId = createAndCheckPerson(); createAndCheckAcknowledgmentLog(alertIncidentId, personId); }
public <T extends ConfDataObject> List<T> selectAll(final String table, final Class<T> type) throws ConfDataDAOException { try { return dbi.withHandle(new HandleCallback<List<T>>() { public List<T> withHandle(final Handle handle) throws Exception { return handle.createQuery("select * from " + table) .map(new LowerToCamelBeanMapper<T>(type)) .list(); } }); } catch (RuntimeException e) { log.warn(e); throw new ConfDataDAOException("Problem selecting data from table " + table, e); } }
ConfDataDAO { public <T extends ConfDataObject> List<T> selectAll(final String table, final Class<T> type) throws ConfDataDAOException { try { return dbi.withHandle(new HandleCallback<List<T>>() { public List<T> withHandle(final Handle handle) throws Exception { return handle.createQuery("select * from " + table) .map(new LowerToCamelBeanMapper<T>(type)) .list(); } }); } catch (RuntimeException e) { log.warn(e); throw new ConfDataDAOException("Problem selecting data from table " + table, e); } } }
ConfDataDAO { public <T extends ConfDataObject> List<T> selectAll(final String table, final Class<T> type) throws ConfDataDAOException { try { return dbi.withHandle(new HandleCallback<List<T>>() { public List<T> withHandle(final Handle handle) throws Exception { return handle.createQuery("select * from " + table) .map(new LowerToCamelBeanMapper<T>(type)) .list(); } }); } catch (RuntimeException e) { log.warn(e); throw new ConfDataDAOException("Problem selecting data from table " + table, e); } } @Inject  ConfDataDAO(final DBI dbi); }
ConfDataDAO { public <T extends ConfDataObject> List<T> selectAll(final String table, final Class<T> type) throws ConfDataDAOException { try { return dbi.withHandle(new HandleCallback<List<T>>() { public List<T> withHandle(final Handle handle) throws Exception { return handle.createQuery("select * from " + table) .map(new LowerToCamelBeanMapper<T>(type)) .list(); } }); } catch (RuntimeException e) { log.warn(e); throw new ConfDataDAOException("Problem selecting data from table " + table, e); } } @Inject  ConfDataDAO(final DBI dbi); Integer insert(final T data); Integer update(final T data); Integer delete(final T data); List<T> selectAll(final String table, final Class<T> type); T selectById(final Long id, final String table, final Class<T> type); List<T> selectByColumn(final String column, final Object columnVal, final String table, final Class<T> type); List<T> selectByDateColumnRange(final String column, final long columnVal1, final long columnVal2, final String table, final Class<T> type); Long compoundInsertUpdateDelete(final Iterable<ConfDataObject> insertIter,
                                           final Iterable<ConfDataObject> updateIter,
                                           final Iterable<ConfDataObject> deleteIter); }
ConfDataDAO { public <T extends ConfDataObject> List<T> selectAll(final String table, final Class<T> type) throws ConfDataDAOException { try { return dbi.withHandle(new HandleCallback<List<T>>() { public List<T> withHandle(final Handle handle) throws Exception { return handle.createQuery("select * from " + table) .map(new LowerToCamelBeanMapper<T>(type)) .list(); } }); } catch (RuntimeException e) { log.warn(e); throw new ConfDataDAOException("Problem selecting data from table " + table, e); } } @Inject  ConfDataDAO(final DBI dbi); Integer insert(final T data); Integer update(final T data); Integer delete(final T data); List<T> selectAll(final String table, final Class<T> type); T selectById(final Long id, final String table, final Class<T> type); List<T> selectByColumn(final String column, final Object columnVal, final String table, final Class<T> type); List<T> selectByDateColumnRange(final String column, final long columnVal1, final long columnVal2, final String table, final Class<T> type); Long compoundInsertUpdateDelete(final Iterable<ConfDataObject> insertIter,
                                           final Iterable<ConfDataObject> updateIter,
                                           final Iterable<ConfDataObject> deleteIter);  }