13 modified files
java/trunk/conditions/src/main/java/org/hps/conditions
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsRecord.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -30,8 +30,7 @@
String name;
String formatVersion;
String tableName;
- String fieldName;
- int fieldValue;
+ int collectionId;
protected ConditionsRecord() {
}
@@ -47,7 +46,7 @@
runStart = rs.getInt(2);
runEnd = rs.getInt(3);
updated = rs.getTimestamp(4);
- created = rs.getDate(5);
+ created = rs.getTimestamp(5); // ??
validFrom = rs.getDate(6);
validTo = rs.getDate(7);
createdBy = rs.getString(8);
@@ -59,8 +58,7 @@
name = rs.getString(10);
formatVersion = rs.getString(11);
tableName = rs.getString(12);
- fieldName = rs.getString(13);
- fieldValue = rs.getInt(14);
+ collectionId = rs.getInt(13);
} catch (SQLException e) {
throw new RuntimeException(e);
@@ -162,21 +160,13 @@
public String getTableName() {
return tableName;
}
-
+
/**
- * Get the field that will define which set of conditions to fetch.
- * @return The field used as a group ID of the conditions.
- */
- public String getFieldName() {
- return fieldName;
- }
-
- /**
* Get the value of the identifying field.
* @return The value of identifying field for these conditions.
*/
- public int getFieldValue() {
- return fieldValue;
+ public int getCollectionId() {
+ return collectionId;
}
/**
@@ -196,8 +186,7 @@
buff.append("notes: " + notes + '\n');
buff.append("formatVersion: " + formatVersion + '\n');
buff.append("tableName: " + tableName + '\n');
- buff.append("fieldName: " + fieldName + '\n');
- buff.append("fieldValue: " + fieldValue + '\n');
+ buff.append("collectionId: " + collectionId + '\n');
return buff.toString();
}
@@ -216,9 +205,6 @@
if (conditionsRecords.size() == 0) {
throw new IllegalArgumentException("No ConditionsRecord with name: " + name);
}
- //if (conditionsRecords.size() > 1) {
- // throw new IllegalArgumentException("Duplicate ConditionsRecord with name: " + name);
- //}
return conditionsRecords;
}
java/trunk/conditions/src/main/java/org/hps/conditions/beam
--- java/trunk/conditions/src/main/java/org/hps/conditions/beam/BeamCurrentConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/beam/BeamCurrentConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -33,8 +33,7 @@
// Get the table name, field name, and field value defining the applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Collection to be returned to caller.
BeamCurrentCollection collection = new BeamCurrentCollection(getTableMetaData(name), collectionId, true);
@@ -44,7 +43,7 @@
// Construct the query to find matching records using the ID field.
String query = "SELECT id, beam_current FROM "
- + tableName + " WHERE " + fieldName + " = " + collectionId;
+ + tableName + " WHERE collection_id = " + collectionId;
// Execute the query and get the results.
ResultSet resultSet = connectionManager.query(query);
java/trunk/conditions/src/main/java/org/hps/conditions/ecal
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannelConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannelConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -43,12 +43,11 @@
// Get the table name, field name, and field value defining the
// applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int fieldValue = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Query for getting back bad channel records.
- String query = "SELECT id, ecal_channel_id FROM " + tableName + " WHERE "
- + fieldName + " = " + fieldValue + " ORDER BY id ASC";
+ String query = "SELECT id, ecal_channel_id FROM " + tableName + " WHERE collection_id = "
+ + collectionId + " ORDER BY id ASC";
ResultSet resultSet = ConnectionManager.getConnectionManager().query(query);
// Loop over the records.
java/trunk/conditions/src/main/java/org/hps/conditions/ecal
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibrationConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibrationConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -37,8 +37,7 @@
// Get the table name, field name, and field value defining the
// applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Collection to be returned to caller.
EcalCalibrationCollection collection = new EcalCalibrationCollection(getTableMetaData(name), collectionId, true);
@@ -49,8 +48,8 @@
// The query to get conditions.
String query = "SELECT id, ecal_channel_id, pedestal, noise FROM "
- + tableName + " WHERE "
- + fieldName + " = " + collectionId + " ORDER BY ecal_channel_id ASC";
+ + tableName + " WHERE collection_id = " + collectionId
+ + " ORDER BY ecal_channel_id ASC";
// Execute the query.
resultSet = connectionManager.query(query);
java/trunk/conditions/src/main/java/org/hps/conditions/ecal
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelMapConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelMapConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -16,6 +16,7 @@
*
* @author Jeremy McCormick <[log in to unmask]>
*/
+// TODO: Needs to support different collectionIDs.
public class EcalChannelMapConverter extends DatabaseConditionsConverter<EcalChannelMap> {
public EcalChannelMapConverter(ConditionsObjectFactory objectFactory) {
java/trunk/conditions/src/main/java/org/hps/conditions/ecal
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalGainConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalGainConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -37,8 +37,7 @@
// Get the table name, field name, and field value defining the
// applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Objects for building the return value.
ConditionsTableMetaData tableMetaData = _objectFactory.getTableRegistry().getTableMetaData(tableName);
@@ -50,8 +49,8 @@
// Database query on ecal gain table.
String query = "SELECT id, ecal_channel_id, gain FROM "
- + tableName + " WHERE "
- + fieldName + " = " + collectionId + " ORDER BY id ASC";
+ + tableName + " WHERE collection_id = "
+ + collectionId + " ORDER BY id ASC";
// Execute the query and get the results.
ResultSet resultSet = connectionManager.query(query);
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannelConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannelConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -38,36 +38,26 @@
SvtBadChannelCollection collection = new SvtBadChannelCollection();
// Loop over ConditionsRecords. For this particular type of condition, multiple
- // sets of bad channels are possible.
-
- // Collection to be returned to caller.
+ // sets of bad channels with overlapping validity are okay.
for (ConditionsRecord record : records) {
- // Get the table name, field name, and field value defining the
- // applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int fieldValue = record.getFieldValue();
-
- ConditionsTableMetaData tableMetaData = _objectFactory.getTableRegistry().getTableMetaData(tableName);
+ int collectionId = record.getCollectionId();
// Query for getting back bad channel records.
- String query = "SELECT id, svt_channel_id FROM " + tableName + " WHERE "
- + fieldName + " = " + fieldValue + " ORDER BY id ASC";
+ String query = "SELECT id, svt_channel_id FROM " + tableName
+ + " WHERE collection_id = " + collectionId
+ + " ORDER BY id ASC";
+
ResultSet resultSet = ConnectionManager.getConnectionManager().query(query);
// Loop over the records.
try {
while (resultSet.next()) {
- //int channelId = resultSet.getInt(1);
- //badChannels.add(channelId);
- int rowId = resultSet.getInt(1);
-
+ int rowId = resultSet.getInt(1);
FieldValueMap fieldValues = new FieldValueMap();
- fieldValues.put("svt_channel_id", resultSet.getInt(2));
-
- SvtBadChannel newObject = _objectFactory.createObject(SvtBadChannel.class, tableName, rowId, fieldValues, true);
-
+ fieldValues.put("svt_channel_id", resultSet.getInt(2));
+ SvtBadChannel newObject = _objectFactory.createObject(SvtBadChannel.class, tableName, rowId, fieldValues, true);
collection.add(newObject);
}
} catch (SQLException x) {
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibrationConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibrationConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -41,8 +41,7 @@
// Get the table name, field name, and field value defining the
// applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Objects for building the return value.
SvtCalibrationCollection collection =
@@ -51,11 +50,10 @@
// Get a connection from the manager.
ConnectionManager connectionManager = getConnectionManager();
- // Construct the query to find matching calibration records using the ID
- // field.
- String query = "SELECT id, svt_channel_id, noise, pedestal FROM "
- + tableName + " WHERE "
- + fieldName + " = " + collectionId + " ORDER BY svt_channel_id ASC";
+ // Construct the query to find matching calibration records.
+ String query = "SELECT id, svt_channel_id, noise, pedestal FROM " + tableName
+ + " WHERE collection_id = " + collectionId
+ + " ORDER BY svt_channel_id ASC";
// Execute the query and get the results.
ResultSet resultSet = connectionManager.query(query);
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannelCollectionConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannelCollectionConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -16,8 +16,7 @@
* This class converts a table of SVT channel setup data into an {@link SvtChannelCollection}.
* @author Jeremy McCormick <[log in to unmask]>
*/
-// FIXME: This converter and the associated classes and tables need to use the collection ID
-// concept so that multiple channel maps are supported.
+// TODO: This needs to support different collectionIDs.
public class SvtChannelCollectionConverter extends DatabaseConditionsConverter<SvtChannelCollection> {
public SvtChannelCollectionConverter(ConditionsObjectFactory objectFactory) {
@@ -53,22 +52,13 @@
try {
// Loop over records.
while (resultSet.next()) {
- // Add SVT channel data for this record.
- //int id = resultSet.getInt(1);
- //int fpga = resultSet.getInt(2);
- //int hybrid = resultSet.getInt(3);
- //int channel = resultSet.getInt(4);
- //SvtChannel data = new SvtChannel(id, fpga, hybrid, channel);
- //channels.put(data.getId(), data);
FieldValueMap fieldValues = new FieldValueMap();
fieldValues.put("id", resultSet.getInt(1));
fieldValues.put("fpga", resultSet.getInt(2));
fieldValues.put("hybrid", resultSet.getInt(3));
- fieldValues.put("channel", resultSet.getInt(4));
-
+ fieldValues.put("channel", resultSet.getInt(4));
SvtChannel newObject = _objectFactory.createObject(
- SvtChannel.class, name, resultSet.getInt(1), fieldValues, true);
-
+ SvtChannel.class, name, resultSet.getInt(1), fieldValues, true);
channels.add(newObject);
}
} catch (SQLException x) {
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -38,8 +38,7 @@
// Get the table name, field name, and field value defining the applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// The object to be returned to caller.
SvtDaqMap collection =
@@ -49,8 +48,8 @@
ConnectionManager connectionManager = ConnectionManager.getConnectionManager();
// Construct the query to find matching calibration records using the ID field.
- String query = "SELECT id, half, layer, hybrid, fpga FROM "
- + tableName + " WHERE " + fieldName + " = " + collectionId
+ String query = "SELECT id, half, layer, hybrid, fpga FROM " + tableName
+ + " WHERE collection_id = " + collectionId
+ " ORDER BY half ASC, layer ASC";
// Execute the query and get the results.
@@ -58,10 +57,8 @@
try {
// Loop over the database records.
- while(resultSet.next()) {
-
- int rowId = resultSet.getInt(1);
-
+ while(resultSet.next()) {
+ int rowId = resultSet.getInt(1);
FieldValueMap fieldValues = new FieldValueMap();
fieldValues.put("half", resultSet.getInt(2));
fieldValues.put("layer", resultSet.getInt(3));
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtGainConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtGainConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -38,8 +38,7 @@
// Get the table name, field name, and field value defining the applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Objects for building the return value.
ConditionsTableMetaData tableMetaData = _objectFactory.getTableRegistry().getTableMetaData(tableName);
@@ -50,8 +49,8 @@
ConnectionManager connectionManager = ConnectionManager.getConnectionManager();
// Construct the query to find matching calibration records using the ID field.
- String query = "SELECT id, svt_channel_id, gain, offset FROM "
- + tableName + " WHERE " + fieldName + " = " + collectionId
+ String query = "SELECT id, svt_channel_id, gain, offset FROM " + tableName
+ + " WHERE collection_id = " + collectionId
+ " ORDER BY svt_channel_id ASC";
// Execute the query and get the results.
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtPulseParametersConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtPulseParametersConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -40,8 +40,7 @@
// Get the table name, field name, and field value defining the
// applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Object for building the return value.
ConditionsTableMetaData tableMetaData = _objectFactory
@@ -53,12 +52,8 @@
ConnectionManager connectionManager = getConnectionManager();
// Construct the query to find matching calibration records.
- String query = "SELECT id, svt_channel_id, amplitude, t0, tp, chisq FROM "
- + tableName
- + " WHERE "
- + fieldName
- + " = "
- + collectionId
+ String query = "SELECT id, svt_channel_id, amplitude, t0, tp, chisq FROM " + tableName
+ + " WHERE collection_id = " + collectionId
+ " ORDER BY id ASC";
// Execute the query and get the results.
java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtTimeShiftConverter.java 2014-03-18 19:10:30 UTC (rev 313)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtTimeShiftConverter.java 2014-03-18 21:05:08 UTC (rev 314)
@@ -34,8 +34,7 @@
// Get the table name, field name, and field value defining the applicable conditions.
String tableName = record.getTableName();
- String fieldName = record.getFieldName();
- int collectionId = record.getFieldValue();
+ int collectionId = record.getCollectionId();
// Collection that will be returned.
SvtTimeShiftCollection collection =
@@ -46,8 +45,8 @@
ConnectionManager connectionManager = ConnectionManager.getConnectionManager();
// Construct the query to find matching records.
- String query = "SELECT id, fpga, hybrid, time_shift FROM "
- + tableName + " WHERE " + fieldName + " = " + collectionId;
+ String query = "SELECT id, fpga, hybrid, time_shift FROM " + tableName
+ + " WHERE collection_id = " + collectionId;
// Execute the query and get the results.
ResultSet resultSet = connectionManager.query(query);
SVNspam 0.1