do {
// rs was next'd above already
String name = rs.getString(1);
String dns = rs.getString(2);
long fileTime = rs.getLong(3);
Association assoc = new Association(dns);
assoc.setFileTime(fileTime);
pstmt2 = c.prepareStatement(SQL_SELECT_ASSOCIATION);
pstmt2.setString(1, name);
rs2 = pstmt2.executeQuery();
ArrayList entries = new ArrayList();
while (rs2.next()) {
AssociationEntry entry =
new AssociationEntry(rs2.getString(2),
rs2.getString(3),
rs2.getString(4),
rs2.getString(5),
rs2.getString(6),
rs2.getString(7));
entry.setInUse(rs2.getBoolean(8));
// Encoding that MAC is explicit in the MAC field itself.
// better to introduce a new field to schema?
String mac = entry.getMac();
if (mac.startsWith(AssociationPersistenceUtil.EXPLICIT_MAC_PREFIX)) {
mac = mac.substring(AssociationPersistenceUtil.EXPLICIT_MAC_PREFIX.length());
entry.setMac(mac);
entry.setExplicitMac(true);
}
entries.add(entry);
}
assoc.setEntries(entries);
assocs.put(name,assoc);
if (this.dbTrace) {
logger.trace("found previously stored network '" +
name + "':\n" + assoc);
}