if ((element = lookupCache(cacheManager).get(DbUtils.hashCodeCacheKeyFor(id))) != null) {
log.debug("Cache hit on map for Kit " + id);
return (Kit)element.getObjectValue();
}
}
Kit kit = null;
try {
KitDescriptor kd = getKitDescriptorById(rs.getInt("kitDescriptorId"));
KitType kitType = kd.getKitType();
if (kitType.equals(KitType.CLUSTERING)) {
kit = new ClusterKit();
}
else if (kitType.equals(KitType.EMPCR)) {
kit = new EmPcrKit();
}
else if (kitType.equals(KitType.LIBRARY)) {
kit = new LibraryKit();
}
else if (kitType.equals(KitType.MULTIPLEXING)) {
kit = new MultiplexingKit();
}
else if (kitType.equals(KitType.SEQUENCING)) {
kit = new SequencingKit();
}
else {
throw new SQLException("Unsupported KitType: "+kitType.getKey());
}
kit.setId(id);
kit.setIdentificationBarcode(rs.getString("identificationBarcode"));
kit.setLocationBarcode(rs.getString("locationBarcode"));
kit.setLotNumber(rs.getString("lotNumber"));
kit.setKitDate(rs.getDate("kitDate"));
kit.setKitDescriptor(kd);
kit.setNotes(noteDAO.listByKit(rs.getLong("kitId")));
}
catch (IOException e) {
e.printStackTrace();
}
return kit;