public DataSets retrieveTemplate(int sessionID) throws DBException, UnknownHostException, SNMPException, DAOCreationException {
PreparedStatement statement;
ResultSet results;
DataCollectorDAO collectorDAO;
DataCollector collector;
DataSets data;
//Device device;
//int dataTypeID;
//boolean storing;
//String portString;
//String collectorType;
try {
collectorDAO = DAOFactory.getDataCollectorDAO(connection, sessionID);
collector = collectorDAO.retrieve(sessionID);
statement = connection.prepareStatement(RETRIEVE_TEMPLATE);
statement.setInt(1, sessionID);
results = statement.executeQuery();
results.next();
data = new DataSets(collector.getDataType(), collector, collector.getDevice(), results.getInt("pollInterval"),
results.getString("port"), results.getInt("direction"), results.getString("title"), results.getBoolean("storing"));
results.close();
statement.close();
// Nasty - fix it up please
if ( collector.getDataType() == DataType.OID ) {
CustomOIDCollector oidCollector;
oidCollector = (CustomOIDCollector)collector;
for (int i = 0; i < oidCollector.getOIDs().size() ; i++) {
data.addSet(oidCollector.getOIDs().elementAt(i).label);
}