public static void upsertQueue(DbConn cnx, QueueDto dto) { if (dto.getId() != null) { cnx.runUpdate("q_update_changed_by_id", dto.isDefaultQueue(), dto.getDescription(), dto.getName(), dto.getId(), dto.isDefaultQueue(), dto.getDescription(), dto.getName()); } else { Queue.create(cnx, dto.getName(), dto.getDescription(), dto.isDefaultQueue()); } }
private static QueueDto mapQueue(ResultSet rs, int colShift) { try { QueueDto tmp = new QueueDto(); tmp.setId(rs.getInt(1 + colShift)); tmp.setDefaultQueue(rs.getBoolean(2 + colShift)); tmp.setDescription(rs.getString(3 + colShift)); tmp.setName(rs.getString(4 + colShift)); return tmp; } catch (SQLException e) { throw new JqmAdminApiInternalException(e); } }
Assert.assertTrue(q.isDefaultQueue()); Assert.assertFalse(q.isDefaultQueue());
public static void syncQueues(DbConn cnx, List<QueueDto> dtos) { for (QueueDto existing : getQueues(cnx)) { boolean foundInNewSet = false; for (QueueDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteQueue(cnx, existing.getId()); } } for (QueueDto dto : dtos) { upsertQueue(cnx, dto); } }
public static void syncQueues(DbConn cnx, List<QueueDto> dtos) { for (QueueDto existing : getQueues(cnx)) { boolean foundInNewSet = false; for (QueueDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteQueue(cnx, existing.getId()); } } for (QueueDto dto : dtos) { upsertQueue(cnx, dto); } }
public static void upsertQueue(DbConn cnx, QueueDto dto) { if (dto.getId() != null) { cnx.runUpdate("q_update_changed_by_id", dto.isDefaultQueue(), dto.getDescription(), dto.getName(), dto.getId(), dto.isDefaultQueue(), dto.getDescription(), dto.getName()); } else { Queue.create(cnx, dto.getName(), dto.getDescription(), dto.isDefaultQueue()); } }
private static QueueDto mapQueue(ResultSet rs, int colShift) { try { QueueDto tmp = new QueueDto(); tmp.setId(rs.getInt(1 + colShift)); tmp.setDefaultQueue(rs.getBoolean(2 + colShift)); tmp.setDescription(rs.getString(3 + colShift)); tmp.setName(rs.getString(4 + colShift)); return tmp; } catch (SQLException e) { throw new JqmAdminApiInternalException(e); } }