LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  July 2015

HPS-SVN July 2015

Subject:

r3224 - in /java/branches/HPSJAVA-488: conditions/src/main/java/org/hps/conditions/ conditions/src/main/java/org/hps/conditions/api/ conditions/src/main/java/org/hps/conditions/beam/ conditions/src/main/java/org/hps/conditions/cli/ conditions/src/main/java/org/hps/conditions/database/ conditions/src/main/java/org/hps/conditions/dummy/ conditions/src/main/java/org/hps/conditions/ecal/ conditions/src/main/java/org/hps/conditions/run/ conditions/src/main/java/org/hps/conditions/svt/ conditions/src/test/java/org/hps/conditions/ conditions/src/test/java/org/hps/conditions/beam/ conditions/src/test/java/org/hps/conditions/database/ conditions/src/test/java/org/hps/conditions/dummy/ conditions/src/test/java/org/hps/conditions/ecal/ conditions/src/test/java/org/hps/conditions/svt/ monitoring-app/src/main/java/org/hps/monitoring/application/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 6 Jul 2015 19:04:14 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (10465 lines)

Author: [log in to unmask]
Date: Mon Jul  6 12:03:16 2015
New Revision: 3224

Log:
Implement fully text IO.  Many cosmetic and minor changes.

Removed:
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ecal/EcalHardwareConditionsTest.java
Modified:
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObject.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObjectCollection.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectCollection.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectUtilities.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/DatabaseObject.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/FieldValuesMap.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableMetaData.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableRegistry.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamConditions.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamCurrent.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/ImportBeamConditionsEngRun.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/package-info.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/RunSummaryCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/TagCommand.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/package-info.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsRecordConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsSeriesConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConnectionParameters.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Converter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConverterRegistry.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseUtilities.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Field.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/MultipleCollectionsAction.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Table.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/package-info.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObject.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObjectConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCrystalChannelMap.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalGain.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLedCalibration.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalTimeShift.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/package-info.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunRange.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/CalibrationHandler.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/ChannelConstants.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/DaqMapHandler.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/MotorPositionLoader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/OpeningAngleLoader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConstant.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsLoader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsReader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtGain.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstants.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstantsLoader.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java
    java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/package-info.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/EngRunConditionsTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/RunNumberTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamConditionsTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/CollectionIdTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/ConverterRegistryTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectCollectionTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectConverterTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ecal/EcalLedTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtTimingConstantsTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java
    java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java
    java/branches/HPSJAVA-488/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java	Mon Jul  6 12:03:16 2015
@@ -5,7 +5,6 @@
 import org.lcsim.util.Driver;
 
 /**
- * <p>
  * This {@link org.lcsim.util.Driver} can be used to customize the behavior of the {@link DatabaseConditionsManager}. It
  * allows the setting of a detector name and run number, as well as other parameters, if the user wishes to override the
  * default behavior of the conditions system, which is generally activated from LCSim events. It is not necessary to run

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObject.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObject.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObject.java	Mon Jul  6 12:03:16 2015
@@ -6,7 +6,6 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.text.SimpleDateFormat;
-import java.util.Date;
 
 import org.hps.conditions.database.Field;
 
@@ -67,11 +66,6 @@
     private FieldValues fieldValues;
 
     /**
-     * Flag to indicate that the object is locally changed and a database update has not been executed.
-     */
-    private boolean isDirty;
-
-    /**
      * The row ID of the object in its table. This will be -1 for new objects that are not in the database.
      */
     private int rowId = UNSET_ROW_ID;
@@ -116,9 +110,44 @@
         this.connection = connection;
         this.tableMetaData = tableMetaData;
         this.fieldValues = fields;
-
-        // Since a list of field values are being provided, this object is flagged as needing to be updated.
-        this.isDirty = true;
+    }
+
+    /**
+     * Create a SQL insert string for a prepared statement.
+     *
+     * @return the SQL insert string for a prepared statement
+     */
+    private String buildInsertStatement() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("INSERT INTO " + this.tableMetaData.getTableName() + " (");
+        for (final String fieldName : this.getTableMetaData().getFieldNames()) {
+            sb.append(fieldName + ", ");
+        }
+        sb.setLength(sb.length() - 2);
+        sb.append(") VALUES (");
+        for (final String fieldName : this.getTableMetaData().getFieldNames()) {
+            sb.append("?, ");
+        }
+        sb.setLength(sb.length() - 2);
+        sb.append(")");
+        final String insertSql = sb.toString();
+        return insertSql;
+    }
+
+    /**
+     * Build a SQL update string for a prepared statement.
+     *
+     * @return the SQL update string for a prepared statement
+     */
+    private String buildUpdateStatement() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("UPDATE " + this.tableMetaData.getTableName() + " SET ");
+        for (final String fieldName : this.tableMetaData.getFieldNames()) {
+            sb.append(fieldName + " = ?, ");
+        }
+        sb.setLength(sb.length() - 2);
+        sb.append(" WHERE id = ?");
+        return sb.toString();
     }
 
     /**
@@ -130,14 +159,14 @@
     @Override
     public final void delete() throws DatabaseObjectException, SQLException {
         if (this.isNew()) {
-            throw new DatabaseObjectException("Object is not in the database.", this);
+            throw new DatabaseObjectException("Missing valid row ID.", this);
         }
         this.connection.setAutoCommit(true);
         PreparedStatement statement = null;
         try {
             statement = this.connection.prepareStatement("DELETE FROM " + this.tableMetaData.getTableName()
                     + " WHERE id = ?");
-            statement.setInt(1, +this.getRowId());
+            statement.setInt(1, this.getRowId());
             statement.executeUpdate();
             this.rowId = UNSET_ROW_ID;
         } finally {
@@ -236,53 +265,24 @@
         if (!this.hasValidCollectionId()) {
             throw new DatabaseObjectException("Cannot insert object without a valid collection ID.", this);
         }
-        final StringBuffer sb = new StringBuffer();
-        sb.append("INSERT INTO " + this.tableMetaData.getTableName() + " (");
-        for (final String fieldName : this.fieldValues.getFieldNames()) {
-            sb.append(fieldName + ", ");
-        }
-        sb.setLength(sb.length() - 2);
-        sb.append(") VALUES (");
-        for (final Object value : this.fieldValues.getValues()) {
-            if (value instanceof Date) {
-                sb.append("STR_TO_DATE( '" + DEFAULT_DATE_FORMAT.format((Date) value) + "', '%Y-%m-%d %H:%i:%S' ), ");
-            } else {
-                sb.append("'" + value + "', ");
-            }
-        }
-        sb.setLength(sb.length() - 2);
-        sb.append(")");
-        final String sql = sb.toString();
-        Statement statement = null;
+        PreparedStatement insertStatement = null;
         ResultSet resultSet = null;
         try {
-            statement = this.connection.createStatement();
-            statement.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
-            resultSet = statement.getGeneratedKeys();
-            while (resultSet.next()) {
-                final int key = resultSet.getInt(1);
-                this.rowId = key;
-                break;
-            }
+            insertStatement = this.connection.prepareStatement(this.buildInsertStatement(),
+                    Statement.RETURN_GENERATED_KEYS);
+            ConditionsObjectUtilities.setupPreparedStatement(insertStatement, this);
+            insertStatement.executeUpdate();
+            resultSet = insertStatement.getGeneratedKeys();
+            resultSet.next();
+            this.rowId = resultSet.getInt(1);
         } finally {
             if (resultSet != null) {
                 resultSet.close();
             }
-            if (statement != null) {
-                statement.close();
-            }
-        }
-        this.isDirty = false;
-    }
-
-    /**
-     * Return <code>true</code> if object is dirty and needs a database update.
-     *
-     * @return <code>true</code> if object is dirty
-     */
-    @Override
-    public final boolean isDirty() {
-        return this.isDirty;
+            if (insertStatement != null) {
+                insertStatement.close();
+            }
+        }
     }
 
     /**
@@ -307,7 +307,7 @@
     public final boolean select(final int id) throws DatabaseObjectException, SQLException {
         this.rowId = id;
         if (id < 1) {
-            throw new IllegalArgumentException("bad row ID value: " + id);
+            throw new IllegalArgumentException("Invalid row ID: " + id);
         }
         final StringBuffer sb = new StringBuffer();
         sb.append("SELECT");
@@ -327,7 +327,7 @@
             selected = resultSet.next();
             if (selected) {
                 int columnIndex = 1;
-                for (String fieldName : this.tableMetaData.getFieldNames()) {
+                for (final String fieldName : this.tableMetaData.getFieldNames()) {
                     this.setFieldValue(fieldName, resultSet.getObject(columnIndex));
                     ++columnIndex;
                 }
@@ -373,7 +373,6 @@
     @Override
     public final void setFieldValue(final String name, final Object value) {
         this.fieldValues.setValue(name, value);
-        this.isDirty = true;
     }
 
     /**
@@ -384,7 +383,6 @@
     @Override
     public void setFieldValues(final FieldValues fieldValues) {
         this.fieldValues = fieldValues;
-        this.isDirty = true;
     }
 
     /**
@@ -419,44 +417,26 @@
     }
 
     /**
-     * Perform an update operation to insert this object's data in the database.
+     * Perform an update operation to insert this object's data into the database.
      *
      * @return <code>true</code> if an update occurred
      */
     @Override
     public final boolean update() throws DatabaseObjectException, SQLException {
         int rowsUpdated = 0;
-        if (this.isDirty()) {
-            if (this.isNew()) {
-                throw new DatabaseObjectException("Cannot update a new object.", this);
-            }
-            final StringBuffer sb = new StringBuffer();
-            sb.append("UPDATE " + this.tableMetaData.getTableName() + " SET ");
-            for (final String fieldName : this.fieldValues.getFieldNames()) {
-                sb.append(fieldName + "=");
-                final Object value = this.fieldValues.getValue(fieldName);
-                if (value instanceof Date) {
-                    sb.append("STR_TO_DATE( '" + DEFAULT_DATE_FORMAT.format((Date) value)
-                            + "', '%Y-%m-%d %H:%i:%S' ), ");
-                } else {
-                    sb.append("'" + value + "', ");
-                }
-            }
-            sb.setLength(sb.length() - 2);
-            sb.append(" WHERE id=" + this.getRowId());
-            final String sql = sb.toString();
-            Statement statement = null;
-            try {
-                statement = this.connection.createStatement();
-                rowsUpdated = statement.executeUpdate(sql);
-            } finally {
-                if (statement != null) {
-                    statement.close();
-                }
-            }
-        }
-        if (rowsUpdated > 0) {
-            this.isDirty = false;
+        if (this.isNew()) {
+            throw new DatabaseObjectException("Cannot perform an update on a new object.", this);
+        }
+        PreparedStatement updateStatement = null;
+        try {
+            updateStatement = this.connection.prepareStatement(this.buildUpdateStatement());
+            updateStatement.setInt(this.fieldValues.getFieldNames().size() + 1, this.getRowId());
+            ConditionsObjectUtilities.setupPreparedStatement(updateStatement, this);
+            rowsUpdated = updateStatement.executeUpdate();
+        } finally {
+            if (updateStatement != null) {
+                updateStatement.close();
+            }
         }
         return rowsUpdated != 0;
     }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObjectCollection.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObjectCollection.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/BaseConditionsObjectCollection.java	Mon Jul  6 12:03:16 2015
@@ -3,6 +3,7 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -12,6 +13,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -20,6 +22,7 @@
 
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVParser;
+import org.apache.commons.csv.CSVPrinter;
 import org.apache.commons.csv.CSVRecord;
 
 /**
@@ -40,11 +43,6 @@
      * The database connection.
      */
     private Connection connection;
-
-    /**
-     * Flag to indicate collection needs to be updated in the database.
-     */
-    private boolean isDirty;
 
     /**
      * The set of objects contained in the collection (no duplicate references allowed to the same object).
@@ -128,7 +126,6 @@
         if (!added) {
             throw new RuntimeException("Failed to add object.");
         }
-        this.isDirty = true;
         return added;
     }
 
@@ -142,6 +139,38 @@
         for (final ObjectType object : collection) {
             this.objects.add(object);
         }
+    }
+
+    /**
+     * Build a SQL insert statement.
+     *
+     * @return the SQL insert statement
+     */
+    private String buildInsertStatement() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("INSERT INTO " + this.getTableMetaData().getTableName() + " (");
+        for (final String field : this.getTableMetaData().getFieldNames()) {
+            sb.append(field + ", ");
+        }
+        sb.setLength(sb.length() - 2);
+        sb.append(") VALUES (");
+        for (final String fieldName : this.getTableMetaData().getFieldNames()) {
+            sb.append("?, ");
+        }
+        sb.setLength(sb.length() - 2);
+        sb.append(")");
+        final String updateStatement = sb.toString();
+        return updateStatement;
+    }
+
+    /**
+     * Clear the objects from this collection and reset its ID.
+     * <p>
+     * This has no effect on the underlying database values.
+     */
+    @Override
+    public void clear() {
+        this.objects.clear();
     }
 
     /**
@@ -246,7 +275,8 @@
      */
     private synchronized int getNextCollectionId() throws SQLException, DatabaseObjectException {
         final String log = "BaseConditionsObject generated new collection ID";
-        final String description = "inserted " + this.size() + " records into " + this.tableMetaData.getTableName();
+        final String description = System.getProperty("user.name") + " created new collection in "
+                + this.tableMetaData.getTableName();
         PreparedStatement statement = null;
         ResultSet resultSet = null;
         int nextCollectionId = -1;
@@ -319,46 +349,26 @@
                         + " table.", this);
             }
         }
-
         // Set collection ID on objects.
         try {
             this.setConditionsObjectCollectionIds();
         } catch (final ConditionsObjectException e) {
             throw new DatabaseObjectException("Error setting collection IDs on objects.", e, this);
         }
-
-        PreparedStatement insertObjects = null;
-        final StringBuffer sb = new StringBuffer();
-        sb.append("INSERT INTO " + this.getTableMetaData().getTableName() + " (");
-        for (final String field : this.getTableMetaData().getFieldNames()) {
-            sb.append(field + ", ");
-        }
-        sb.setLength(sb.length() - 2);
-        sb.append(") VALUES (");
-        for (String fieldName : this.getTableMetaData().getFieldNames()) {
-            sb.append("?, ");
-        }
-        sb.setLength(sb.length() - 2);
-        sb.append(")");
-        final String updateStatement = sb.toString();
-        try {
-            insertObjects = this.connection.prepareStatement(updateStatement, Statement.RETURN_GENERATED_KEYS);
+        PreparedStatement insertStatement = null;
+        try {
+            insertStatement = this.connection.prepareStatement(this.buildInsertStatement(),
+                    Statement.RETURN_GENERATED_KEYS);
             for (final ObjectType object : this) {
-                int fieldIndex = 1;
-                for (String fieldName : this.getTableMetaData().getFieldNames()) {
-                    insertObjects.setObject(fieldIndex,
-                            object.getFieldValue(this.getTableMetaData().getFieldType(fieldName), fieldName));
-                    fieldIndex++;
-                }
-                insertObjects.executeUpdate();
-                final ResultSet resultSet = insertObjects.getGeneratedKeys();
+                ConditionsObjectUtilities.setupPreparedStatement(insertStatement, object);
+                insertStatement.executeUpdate();
+                final ResultSet resultSet = insertStatement.getGeneratedKeys();
                 resultSet.next();
                 ((BaseConditionsObject) object).setRowId(resultSet.getInt(1));
                 resultSet.close();
             }
-            // Commit the object insert statements together.
+            // Commit all the object insert statements together.
             this.connection.commit();
-
         } catch (final SQLException e1) {
             e1.printStackTrace();
             if (this.connection != null) {
@@ -370,21 +380,11 @@
                 }
             }
         } finally {
-            if (insertObjects != null) {
-                insertObjects.close();
+            if (insertStatement != null) {
+                insertStatement.close();
             }
             this.connection.setAutoCommit(true);
         }
-    }
-
-    /**
-     * Return <code>true</code> if the collection has objects that need to be inserted into the database.
-     *
-     * @return <code>true</code> if the collection is dirty
-     */
-    @Override
-    public final boolean isDirty() {
-        return this.isDirty;
     }
 
     /**
@@ -421,76 +421,94 @@
      * @param file the CSV file
      */
     @Override
-    public void loadCsv(final File file) throws IOException, FileNotFoundException, ConditionsObjectException {
+    public void load(final File file, final Character delimiter) throws IOException, FileNotFoundException,
+            ConditionsObjectException {
 
         // Clear the objects from the collection.
         this.objects.clear();
-        
-        // Unset the collection ID.
-        this.collectionId = BaseConditionsObject.UNSET_COLLECTION_ID;
-                
+
+        final TableMetaData tableMetaData = this.getTableMetaData();
+
         // Check if the table info exists.
-        if (this.getTableMetaData() == null) {
+        if (tableMetaData == null) {
             // Table name is invalid.
             throw new RuntimeException("The table meta data is not set.");
         }
 
-        // Read in the CSV records.
-        final FileReader reader = new FileReader(file);
-        final CSVParser parser = new CSVParser(reader, CSVFormat.DEFAULT.withHeader());
-        final List<CSVRecord> records = parser.getRecords();
-
-        // Get the database field names from the table info.
-        final Set<String> fields = this.getTableMetaData().getFieldNames();
-
-        // Get the text file column headers from the parser.
-        final Map<String, Integer> headerMap = parser.getHeaderMap();
-        
-        // Get the headers that were read in from CSV.
-        final Set<String> headers = headerMap.keySet();
-        
-        // Make sure the headers are actually valid column names in the database.
-        for (final String header : headerMap.keySet()) {
-            if (!fields.contains(header)) {
-                // The field name does not match a table column.
-                throw new RuntimeException("Header " + header + " from CSV is not a column in the "
-                        + this.getTableMetaData().getTableName() + " table.");
-            }
-        }
-
-        // Get the class of the objects contained in this collection.
-        final Class<? extends ConditionsObject> objectClass = this.getTableMetaData().getObjectClass();
-
-        // Iterate over the CSV records.
-        for (final CSVRecord record : records) {
-            
-            // Create a new conditions object.
-            final ObjectType object;
-            try {
-                // Create a new conditions object and cast to correct type for adding to collection.
-                object = (ObjectType) objectClass.newInstance();
-            } catch (InstantiationException | IllegalAccessException e) {
-                throw new RuntimeException("Error creating conditions object.", e);
-            }
-            
-            // Set the field values on the object.
-            for (final String header : headers) {
-                // Set the value of a field in the object based on the header name, converting to the correct type.
-                object.setFieldValue(
-                        header,
-                        ConditionsObjectUtilities.convertValue(this.getTableMetaData().getFieldType(header), record.get(header)));
-            }
-            
-            // Add the object to the collection.
-            this.add(object);
-        }
-        
-        // Close the CSV parser and reader.
-        parser.close();
-        reader.close();
-        
-        // Flag collection as dirty (since it is read from text it is not explicitly in the database).
-        this.isDirty = true;
+        FileReader reader = null;
+        CSVParser parser = null;
+
+        try {
+
+            // Read in the CSV records.
+            reader = new FileReader(file);
+
+            // Default comma-delimited format.
+            CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader();
+
+            if (delimiter != null) {
+                if (delimiter == '\t') {
+                    // Tab-delimited format.
+                    csvFileFormat = CSVFormat.TDF.withHeader();
+                } else {
+                    // Custom delimiter was provided.
+                    csvFileFormat = CSVFormat.newFormat(delimiter);
+                }
+            }
+
+            parser = new CSVParser(reader, csvFileFormat);
+            final List<CSVRecord> records = parser.getRecords();
+
+            // Get the database field names from the table info.
+            final Set<String> fields = tableMetaData.getFieldNames();
+
+            // Get the text file column headers from the parser.
+            final Map<String, Integer> headerMap = parser.getHeaderMap();
+
+            // Get the headers that were read in from CSV.
+            final Set<String> headers = headerMap.keySet();
+
+            // Make sure the headers are actually valid column names in the database.
+            for (final String header : headerMap.keySet()) {
+                if (!fields.contains(header)) {
+                    // The field name does not match a table column.
+                    throw new RuntimeException("Header " + header + " from CSV is not a column in the "
+                            + tableMetaData.getTableName() + " table.");
+                }
+            }
+
+            // Get the class of the objects contained in this collection.
+            final Class<? extends ConditionsObject> objectClass = this.getTableMetaData().getObjectClass();
+
+            // Iterate over the CSV records.
+            for (final CSVRecord record : records) {
+
+                // Create a new conditions object.
+                final ObjectType object;
+                try {
+                    // Create a new conditions object and cast to correct type for adding to collection.
+                    object = (ObjectType) objectClass.newInstance();
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new RuntimeException("Error creating conditions object.", e);
+                }
+
+                // Set the field values on the object.
+                for (final String header : headers) {
+                    // Set the value of a field in the object based on the header name, converting to the correct type.
+                    object.setFieldValue(
+                            header,
+                            ConditionsObjectUtilities.convertValue(this.getTableMetaData().getFieldType(header),
+                                    record.get(header)));
+                }
+
+                // Add the object to the collection.
+                this.add(object);
+            }
+        } finally {
+            // Close the CSV parser and reader.
+            parser.close();
+            reader.close();
+        }
     }
 
     /**
@@ -498,7 +516,6 @@
      *
      * @return <code>true</code> if at least one object was selected
      */
-    // FIXME: Rewrite to use a PreparedStatement.
     @Override
     public final boolean select(final int collectionId) throws SQLException, DatabaseObjectException {
         this.collectionId = collectionId;
@@ -512,7 +529,7 @@
                 sb.append(fieldName + ", ");
             }
             sb.setLength(sb.length() - 2);
-            sb.append(" FROM " + this.tableMetaData.getTableName() + " WHERE collection_id=" + collectionId);
+            sb.append(" FROM " + this.tableMetaData.getTableName() + " WHERE collection_id = " + collectionId);
             final String sql = sb.toString();
             final ResultSet resultSet = statement.executeQuery(sql);
             while (resultSet.next()) {
@@ -522,10 +539,10 @@
                     newObject.setTableMetaData(this.tableMetaData);
                     final int id = resultSet.getInt(1);
                     ((BaseConditionsObject) newObject).setRowId(id);
-                    int fieldIndex = 2;
-                    for (String fieldName : this.tableMetaData.getFieldNames()) {
-                        newObject.setFieldValue(fieldName, resultSet.getObject(fieldIndex));
-                        ++fieldIndex;
+                    int column = 2;
+                    for (final String fieldName : this.tableMetaData.getFieldNames()) {
+                        newObject.setFieldValue(fieldName, resultSet.getObject(column));
+                        ++column;
                     }
                     try {
                         this.add(newObject);
@@ -657,35 +674,84 @@
     }
 
     /**
+     * Convert object to string.
+     *
+     * @return this object converted to a string
+     */
+    @Override
+    public String toString() {
+        final StringBuffer buff = new StringBuffer();
+        for (final ConditionsObject object : this.getObjects()) {
+            buff.append(object);
+            buff.append('\n');
+        }
+        return buff.toString();
+    }
+
+    /**
      * Perform database updates on the objects in the collection.
      *
      * @return <code>true</code> if at least one object was updated
      */
-    @Override
-    // FIXME: This method should execute a prepared statement in a transaction.
+    // FIXME: Rewrite to use PreparedStatement.
+    @Override
     public boolean update() throws DatabaseObjectException, SQLException {
         boolean updated = false;
         for (final ObjectType object : this.objects) {
-            if (object.isDirty()) {
-                if (object.update() && updated == false) {
-                    updated = true;
-                }
+            if (object.update() && updated == false) {
+                updated = true;
             }
         }
         return updated;
     }
-    
-    /**
-     * Convert object to string.
-     * 
-     * @return this object converted to a string
-     */
-    public String toString() {
-        StringBuffer buff = new StringBuffer();
-        for (ConditionsObject object : this.getObjects()) {
-            buff.append(object);
-            buff.append('\n');
-        }
-        return buff.toString();
-    }
-}
+
+    /**
+     * Write contents of this collection to a CSV file.
+     *
+     * @param file the output CSV file
+     */
+    @Override
+    public void write(final File file, final Character delimiter) throws IOException {
+        FileWriter fileWriter = null;
+        CSVPrinter csvFilePrinter = null;
+
+        // Default comma-delimited format.
+        CSVFormat csvFileFormat = CSVFormat.DEFAULT;
+
+        if (delimiter != null) {
+            if (delimiter == '\t') {
+                // Tab-delimited format.
+                csvFileFormat = CSVFormat.TDF;
+            } else {
+                // Custom delimiter was provided.
+                csvFileFormat = CSVFormat.newFormat(delimiter);
+            }
+        }
+        try {
+            fileWriter = new FileWriter(file);
+            csvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);
+            final List<String> fieldNameList = new ArrayList<String>(this.getTableMetaData().getFieldNames());
+            fieldNameList.remove(BaseConditionsObject.COLLECTION_ID_FIELD);
+            csvFilePrinter.printRecord(fieldNameList);
+            for (final ConditionsObject conditionsObject : this.getObjects()) {
+                final List<Object> conditionsObjectRecord = new ArrayList<Object>();
+                for (final String fieldName : fieldNameList) {
+                    Object value = conditionsObject.getFieldValue(fieldName);
+                    if (value instanceof Date) {
+                        value = BaseConditionsObject.DEFAULT_DATE_FORMAT.format(value);
+                    }
+                    conditionsObjectRecord.add(value);
+                }
+                csvFilePrinter.printRecord(conditionsObjectRecord);
+            }
+        } finally {
+            try {
+                fileWriter.flush();
+                fileWriter.close();
+                csvFilePrinter.close();
+            } catch (final IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectCollection.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectCollection.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectCollection.java	Mon Jul  6 12:03:16 2015
@@ -31,6 +31,13 @@
     void addAll(ConditionsObjectCollection<ObjectType> collection);
 
     /**
+     * Clear the objects from this collection and reset its ID.
+     * <p>
+     * This has no effect on the underlying database values.
+     */
+    void clear();
+
+    /**
      * Return <code>true</code> if collection contains this object.
      *
      * @param object the object to check
@@ -57,11 +64,13 @@
      * Load collection from a CSV file.
      *
      * @param file the input CSV file
+     * @param delimiter the field delimiter (leave blank for default which is comma-delimited)
      * @throws IOException if there is an error closing the reader
      * @throws FileNotFoundException if the input file does not exist
      * @throws ConditionsObjectException if there is an error creating a conditions object
      */
-    void loadCsv(File file) throws IOException, FileNotFoundException, ConditionsObjectException;
+    void load(final File file, Character delimiter) throws IOException, FileNotFoundException,
+            ConditionsObjectException;
 
     /**
      * Set the collection ID.
@@ -91,4 +100,12 @@
      * @return the sorted copy of the collection
      */
     ConditionsObjectCollection<ObjectType> sorted(final Comparator<ObjectType> comparator);
+
+    /**
+     * Write the collection contents to a text file.
+     *
+     * @param file the output text file
+     * @param delimiter the field delimiter (leave blank for default which is comma-delimited)
+     */
+    void write(File file, Character delimiter) throws IOException;
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectUtilities.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectUtilities.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/ConditionsObjectUtilities.java	Mon Jul  6 12:03:16 2015
@@ -1,28 +1,29 @@
 package org.hps.conditions.api;
 
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.util.Collection;
 import java.util.Date;
 
 import org.hps.conditions.database.DatabaseConditionsManager;
 
 /**
- * This is a collection of utility methods for {@link ConditionsObject}.
+ * This is a collection of utility methods for {@link ConditionsObject}s.
  *
  * @author Jeremy McCormick, SLAC
  */
 public final class ConditionsObjectUtilities {
-    
+
     /**
      * Static instance of conditions manager.
      */
     private static final DatabaseConditionsManager MANAGER = DatabaseConditionsManager.getInstance();
 
-    /**
-     * Default input date format from text data.
-     */
-    private static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    
     /**
      * Convert from a raw string into a specific type.
      *
@@ -41,43 +42,89 @@
             return Boolean.parseBoolean(value);
         } else if (Date.class.equals(type)) {
             try {
-                return DEFAULT_DATE_FORMAT.parse(value);
-            } catch (ParseException e) {
+                return BaseConditionsObject.DEFAULT_DATE_FORMAT.parse(value);
+            } catch (final ParseException e) {
                 throw new ConditionsObjectException("Error parsing date.", e);
             }
         } else {
             return value;
         }
     }
-                
+
+    /**
+     * Get the class name of a column.
+     *
+     * @param tableMetaData the table meta data
+     * @param columnName the column name
+     * @return the class name of a column
+     * @throws SQLException if there is a problem querying the database
+     */
+    public static String getColumnClassName(final TableMetaData tableMetaData, final String columnName)
+            throws SQLException {
+        final Statement st = MANAGER.getConnection().createStatement();
+        final ResultSet rs = st.executeQuery("SELECT * from " + tableMetaData.getTableName() + " LIMIT 1");
+        final ResultSetMetaData rsmd = rs.getMetaData();
+        for (int column = 1; column <= rsmd.getColumnCount(); column++) {
+            if (rsmd.getColumnName(column).equals(columnName)) {
+                return rsmd.getColumnClassName(column);
+            }
+        }
+        throw new IllegalArgumentException("unknown columnName: " + columnName);
+    }
+
     /**
      * Create a new conditions collection from the table name.
-     * 
+     *
      * @param tableName the name of the table
      * @return the new conditions collection
      * @throws ConditionsObjectException if there is an error creating the collection
      */
-    public static ConditionsObjectCollection<?> newCollection(String tableName) throws ConditionsObjectException {
-        TableMetaData tableInfo = TableRegistry.getTableRegistry().findByTableName(tableName);
-        ConditionsObjectCollection<?> collection = tableInfo.newCollection();
+    public static ConditionsObjectCollection<?> newCollection(final String tableName) throws ConditionsObjectException {
+        final TableMetaData tableInfo = TableRegistry.getTableRegistry().findByTableName(tableName);
+        final ConditionsObjectCollection<?> collection = tableInfo.newCollection();
         collection.setConnection(MANAGER.getConnection());
-        return collection; 
+        return collection;
     }
-    
+
     /**
      * Create a new conditions object from the table name.
-     * 
+     *
      * @param tableName the name of the table
      * @return the new conditions object
      * @throws ConditionsObjectException if there is an error creating the object
      */
-    public static ConditionsObject newObject(String tableName) throws ConditionsObjectException {
-        TableMetaData tableInfo = TableRegistry.getTableRegistry().findByTableName(tableName);
-        ConditionsObject object = tableInfo.newObject();
+    public static ConditionsObject newObject(final String tableName) throws ConditionsObjectException {
+        final TableMetaData tableInfo = TableRegistry.getTableRegistry().findByTableName(tableName);
+        final ConditionsObject object = tableInfo.newObject();
         object.setConnection(MANAGER.getConnection());
         return object;
     }
-    
+
+    /**
+     * Setup a prepared statement from {@link ConditionsObject} data.
+     *
+     * @param statement the SQL <code>PreparedStatement</code>
+     * @param object the {@link ConditionsObject} with the data
+     * @throws SQLException if there is a problem querying the database
+     */
+    public static void setupPreparedStatement(final PreparedStatement statement, final ConditionsObject object)
+            throws SQLException {
+        int column = 1;
+        final TableMetaData tableMetaData = object.getTableMetaData();
+        final Collection<String> fieldNames = object.getTableMetaData().getFieldNames();
+        for (final String fieldName : fieldNames) {
+            Object value = object.getFieldValue(fieldName);
+            if (value != null) {
+                final String className = ConditionsObjectUtilities.getColumnClassName(tableMetaData, fieldName);
+                if (className.equals(Timestamp.class.getName())) {
+                    value = new Timestamp(Date.class.cast(value).getTime());
+                }
+            }
+            statement.setObject(column, value);
+            ++column;
+        }
+    }
+
     /**
      * Do not allow class to be instantiated.
      */

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/DatabaseObject.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/DatabaseObject.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/DatabaseObject.java	Mon Jul  6 12:03:16 2015
@@ -6,7 +6,7 @@
 /**
  * This is a simple ORM interface for mapping Java objects to a database.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public interface DatabaseObject {
 
@@ -34,13 +34,6 @@
      * @throws SQLException
      */
     public void insert() throws DatabaseObjectException, SQLException;
-
-    /**
-     * Return <code>true</code> if there are local data modifications that have not been persisted to the database.
-     *
-     * @return <code>true</code> if there un-persisted local data modifications
-     */
-    boolean isDirty();
 
     /**
      * Return <code>true</code> if the record

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/FieldValuesMap.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/FieldValuesMap.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/FieldValuesMap.java	Mon Jul  6 12:03:16 2015
@@ -1,7 +1,7 @@
 package org.hps.conditions.api;
 
 import java.util.Collection;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -15,7 +15,7 @@
     /**
      * Map of field names to values.
      */
-    private final Map<String, Object> data = new HashMap<String, Object>();
+    private final Map<String, Object> data = new LinkedHashMap<String, Object>();
 
     /**
      * Class constructor.

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableMetaData.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableMetaData.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableMetaData.java	Mon Jul  6 12:03:16 2015
@@ -172,6 +172,38 @@
     }
 
     /**
+     * Create a new collection instance from the table meta data's collection type.
+     *
+     * @return the new object collection
+     * @throws ConditionsObjectException if there is an error creating a new collection
+     */
+    ConditionsObjectCollection<?> newCollection() throws ConditionsObjectException {
+        try {
+            final ConditionsObjectCollection<?> collection = this.getCollectionClass().newInstance();
+            collection.setTableMetaData(this);
+            return collection;
+        } catch (InstantiationException | IllegalAccessException e) {
+            throw new ConditionsObjectException("Error creating new conditions object collection.", e);
+        }
+    }
+
+    /**
+     * Create a new object instance from the table meta data's object type.
+     *
+     * @return the new conditions object
+     * @throws ConditionsObjectException if there is an error creating a new object
+     */
+    ConditionsObject newObject() throws ConditionsObjectException {
+        try {
+            final ConditionsObject object = this.getObjectClass().newInstance();
+            object.setTableMetaData(this);
+            return object;
+        } catch (InstantiationException | IllegalAccessException e) {
+            throw new ConditionsObjectException("Error creating new conditions object collection.", e);
+        }
+    }
+
+    /**
      * Set all the field names from an array of strings.
      *
      * @param fieldNames the names of the fields
@@ -230,36 +262,14 @@
         buff.append('\n');
         return buff.toString();
     }
-    
-    /**
-     * Create a new collection instance from the table meta data's collection type.
-     * 
-     * @return the new object collection
-     * @throws ConditionsObjectException if there is an error creating a new collection
-     */
-    ConditionsObjectCollection<?> newCollection() throws ConditionsObjectException {
-        try {
-            ConditionsObjectCollection<?> collection = this.getCollectionClass().newInstance();
-            collection.setTableMetaData(this);
-            return collection;
-        } catch (InstantiationException | IllegalAccessException e) {
-            throw new ConditionsObjectException("Error creating new conditions object collection.", e);
-        }
-    }
-    
-    /**
-     * Create a new object instance from the table meta data's object type.
-     * 
-     * @return the new conditions object
-     * @throws ConditionsObjectException if there is an error creating a new object
-     */
-    ConditionsObject newObject() throws ConditionsObjectException  {
-        try {
-            ConditionsObject object = this.getObjectClass().newInstance();
-            object.setTableMetaData(this);
-            return object;
-        } catch (InstantiationException | IllegalAccessException e) {
-            throw new ConditionsObjectException("Error creating new conditions object collection.", e);
-        }        
-    }
+
+    // TODO: add methods for getting SQL strings for PreparedStatements; can be setup once at initialization time for
+    // each table
+    // String getSelectStatement();
+    // String getInsertStatement();
+    // String getUpdateStatement();
+    // String getDeleteStatement();
+
+    // TODO: add method for getting column class name that maps to JDBC; see similar ConditionsObjectUtilities method
+    // String getColumnClassName(String columnName);
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableRegistry.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableRegistry.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/api/TableRegistry.java	Mon Jul  6 12:03:16 2015
@@ -18,7 +18,7 @@
 /**
  * This is a registry providing a map between tables and their meta-data.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @SuppressWarnings("serial")
 public final class TableRegistry extends HashMap<String, TableMetaData> {
@@ -107,7 +107,27 @@
         }
         return registry;
     }
-    
+
+    /**
+     * Find all available classes that extend ConditionsObject.
+     *
+     * @return The set of all available classes that extend ConditionsObject.
+     */
+    public static Set<Class<? extends ConditionsObject>> findConditionsObjectTypes() {
+        final Reflections reflections = new Reflections("org.hps.conditions");
+        final Set<Class<? extends ConditionsObject>> objectTypes = new HashSet<Class<? extends ConditionsObject>>();
+        for (final Class<? extends ConditionsObject> objectType : reflections.getSubTypesOf(ConditionsObject.class)) {
+            if (Modifier.isAbstract(objectType.getModifiers())) {
+                continue;
+            }
+            if (objectType.getAnnotation(Table.class) == null) {
+                continue;
+            }
+            objectTypes.add(objectType);
+        }
+        return objectTypes;
+    }
+
     /**
      * Get the class for the collection of the ConditionsObject type.
      *
@@ -130,39 +150,7 @@
         }
         return (Class<? extends BaseConditionsObjectCollection<? extends ConditionsObject>>) rawCollectionClass;
     }
-    
-
-    /**
-     * Get the global static instance of the registry.
-     *
-     * @return the global static instance of the registry
-     */
-    public synchronized static TableRegistry getTableRegistry() {
-        if (instance == null) {
-            // Create registry if it does not exist.
-            instance = TableRegistry.create();
-        }
-        return instance;
-    }
-
-    /**
-     * Map between collection types and meta data.
-     */
-    private final CollectionTypeMap collectionTypeMap = new CollectionTypeMap();
-
-    /**
-     * Map between object types and meta data.
-     */
-    private final ObjectTypeMap objectTypeMap = new ObjectTypeMap();
-
-    /**
-     * Prevent direct class instantiation by users.
-     * <p>
-     * Use the {@link #create()} method instead.
-     */
-    private TableRegistry() {
-    }
-    
+
     /**
      * Get the list of database field names for the class.
      *
@@ -191,7 +179,7 @@
         }
         return fieldNames;
     }
-    
+
     /**
      * Get the list of table names for the class.
      *
@@ -208,6 +196,37 @@
     }
 
     /**
+     * Get the global static instance of the registry.
+     *
+     * @return the global static instance of the registry
+     */
+    public synchronized static TableRegistry getTableRegistry() {
+        if (instance == null) {
+            // Create registry if it does not exist.
+            instance = TableRegistry.create();
+        }
+        return instance;
+    }
+
+    /**
+     * Map between collection types and meta data.
+     */
+    private final CollectionTypeMap collectionTypeMap = new CollectionTypeMap();
+
+    /**
+     * Map between object types and meta data.
+     */
+    private final ObjectTypeMap objectTypeMap = new ObjectTypeMap();
+
+    /**
+     * Prevent direct class instantiation by users.
+     * <p>
+     * Use the {@link #create()} method instead.
+     */
+    private TableRegistry() {
+    }
+
+    /**
      * Find meta data by collection type.
      *
      * @param collectionType the collection type
@@ -236,26 +255,6 @@
     public TableMetaData findByTableName(final String name) {
         return this.get(name);
     }
-    
-    /**
-     * Find all available classes that extend ConditionsObject.
-     *
-     * @return The set of all available classes that extend ConditionsObject.
-     */
-    public static Set<Class<? extends ConditionsObject>> findConditionsObjectTypes() {
-        final Reflections reflections = new Reflections("org.hps.conditions");
-        final Set<Class<? extends ConditionsObject>> objectTypes = new HashSet<Class<? extends ConditionsObject>>();
-        for (final Class<? extends ConditionsObject> objectType : reflections.getSubTypesOf(ConditionsObject.class)) {
-            if (Modifier.isAbstract(objectType.getModifiers())) {
-                continue;
-            }
-            if (objectType.getAnnotation(Table.class) == null) {
-                continue;
-            }
-            objectTypes.add(objectType);
-        }
-        return objectTypes;
-    }    
 
     /**
      * Convert this object to a string.

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamConditions.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamConditions.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamConditions.java	Mon Jul  6 12:03:16 2015
@@ -12,7 +12,7 @@
  * <p>
  * Unless otherwise stated, these are assumed to be average values for an entire run.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"beam"})
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.ERROR)
@@ -34,41 +34,41 @@
     /**
      * Get the average beam current (nA). A value of 0 indicates there was no beam. A null value means it was not
      * recorded.
-     * 
+     *
      * @return the beam current (nA)
      */
     @Field(names = {"current"})
     public Double getCurrent() {
-        return getFieldValue("current");
+        return this.getFieldValue("current");
+    }
+
+    /**
+     * Get the beam energy (GeV). A value of 0 indicates there was no beam. A null value means it was not recorded.
+     *
+     * @return the beam energy
+     */
+    @Field(names = {"energy"})
+    public Double getEnergy() {
+        return this.getFieldValue("energy");
     }
 
     /**
      * Get the average beam position in X (mm).
-     * 
+     *
      * @return the beam position (mm)
      */
     @Field(names = {"position_x"})
     public Double getPositionX() {
-        return getFieldValue("position_x");
+        return this.getFieldValue("position_x");
     }
 
     /**
      * Get the average beam position in Y (mm).
-     * 
+     *
      * @return the beam position (mm)
      */
     @Field(names = {"position_y"})
     public Double getPositionY() {
-        return getFieldValue("position_y");
-    }
-
-    /**
-     * Get the beam energy (GeV). A value of 0 indicates there was no beam. A null value means it was not recorded.
-     * 
-     * @return the beam energy
-     */
-    @Field(names = {"energy"})
-    public Double getEnergy() {
-        return getFieldValue("energy");
+        return this.getFieldValue("position_y");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamCurrent.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamCurrent.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/BeamCurrent.java	Mon Jul  6 12:03:16 2015
@@ -10,7 +10,7 @@
 /**
  * This class is a conditions object for integrated beam current values.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"beam_current"})
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
@@ -25,11 +25,11 @@
 
     /**
      * Get the integrated beam current.
-     * 
+     *
      * @return the integrated beam current
      */
     @Field(names = {"beam_current"})
     public Double getIntegratedBeamCurrent() {
-        return getFieldValue("beam_current");
+        return this.getFieldValue("beam_current");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/ImportBeamConditionsEngRun.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/ImportBeamConditionsEngRun.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/ImportBeamConditionsEngRun.java	Mon Jul  6 12:03:16 2015
@@ -22,7 +22,7 @@
  * <p>
  * The beam energy is hard-coded to 1.92 GeV for now, pending updates with better information.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class ImportBeamConditionsEngRun {
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/package-info.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/package-info.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/beam/package-info.java	Mon Jul  6 12:03:16 2015
@@ -1,7 +1,7 @@
 /**
  * Provides access to beam parameters through the conditions system.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 package org.hps.conditions.beam;
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AbstractCommand.java	Mon Jul  6 12:03:16 2015
@@ -10,19 +10,19 @@
 /**
  * This is the API that sub-commands such as 'load' or 'print' must implement in the conditions command line interface.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 abstract class AbstractCommand {
 
     /**
+     * The description of the command.
+     */
+    private final String description;
+
+    /**
      * The name of the (sub)command.
      */
-    private String name;
-
-    /**
-     * The description of the command.
-     */
-    private String description;
+    private final String name;
 
     /**
      * The options this command takes on the command line (Apache CLI).
@@ -36,7 +36,7 @@
 
     /**
      * Class constructor.
-     * 
+     *
      * @param name the string that invokes this command
      * @param description the description of this command
      * @param options the command's options (Apache CLI)
@@ -48,8 +48,24 @@
     }
 
     /**
+     * The sub-command execution method that should be implemented by sub-classes.
+     *
+     * @param arguments The command's argument list.
+     */
+    abstract void execute(final String[] arguments);
+
+    /**
+     * Get the description of this command.
+     *
+     * @return the description of this command
+     */
+    protected final String getDescription() {
+        return this.description;
+    }
+
+    /**
      * Get the name of this command.
-     * 
+     *
      * @return the name of this command
      */
     final String getName() {
@@ -57,42 +73,25 @@
     }
 
     /**
-     * Get the description of this command.
-     * 
-     * @return the description of this command
-     */
-    protected final String getDescription() {
-        return this.description;
-    }
-
-    /**
      * Get the <code>Options</code> for this command (Apache CLI).
-     * 
+     *
      * @return the <code>Options</code> object for this command
      */
     protected final Options getOptions() {
-        return options;
-    }
-
-    /**
-     * Print the usage of this sub-command.
-     */
-    protected final void printUsage() {
-        final HelpFormatter help = new HelpFormatter();
-        help.printHelp(getName(), getOptions());
+        return this.options;
     }
 
     /**
      * Parse the sub-command's options.
-     * 
+     *
      * @param arguments the sub-command's arguments
      * @return the parsed command line
      */
     protected final CommandLine parse(final String[] arguments) {
         CommandLine commandLine = null;
         try {
-            commandLine = parser.parse(options, arguments);
-        } catch (ParseException e) {
+            commandLine = this.parser.parse(this.options, arguments);
+        } catch (final ParseException e) {
             throw new RuntimeException(e);
         }
         if (commandLine.hasOption("h")) {
@@ -103,9 +102,10 @@
     }
 
     /**
-     * The sub-command execution method that should be implemented by sub-classes.
-     * 
-     * @param arguments The command's argument list.
+     * Print the usage of this sub-command.
      */
-    abstract void execute(final String[] arguments);
+    protected final void printUsage() {
+        final HelpFormatter help = new HelpFormatter();
+        help.printHelp(this.getName(), this.getOptions());
+    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/AddCommand.java	Mon Jul  6 12:03:16 2015
@@ -18,7 +18,7 @@
  * This is a command for the conditions CLI that will add a conditions record, making a conditions set with a particular
  * collection ID available by run number via the {@link org.hps.conditions.database.DatabaseConditionsManager}.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 final class AddCommand extends AbstractCommand {
 
@@ -95,7 +95,7 @@
     @Override
     final void execute(final String[] arguments) {
 
-        final CommandLine commandLine = parse(arguments);
+        final CommandLine commandLine = this.parse(arguments);
 
         // This command has 3 required options.
         if (commandLine.getOptions().length == 0) {
@@ -153,7 +153,7 @@
         }
 
         // Create the conditions record to insert.
-        final ConditionsRecord conditionsRecord = createConditionsRecord(runStart, runEnd, tableName, name,
+        final ConditionsRecord conditionsRecord = this.createConditionsRecord(runStart, runEnd, tableName, name,
                 collectionId, createdBy, tag, notes);
         try {
             boolean createdConnection = false;

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/CommandLineTool.java	Mon Jul  6 12:03:16 2015
@@ -23,7 +23,7 @@
  * Command line options can be used to supply a custom connection properties file or XML which will override the
  * default.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class CommandLineTool {
 
@@ -124,8 +124,8 @@
     private void run(final String[] arguments) {
         try {
             if (arguments.length == 0) {
-                printUsage();
-                exit(0);
+                this.printUsage();
+                this.exit(0);
             }
 
             CommandLine commandLine = null;
@@ -133,17 +133,17 @@
                 commandLine = this.parser.parse(OPTIONS, arguments, true);
             } catch (final ParseException e) {
                 LOGGER.log(Level.SEVERE, "Error parsing the options.", e);
-                printUsage();
-                exit(1);
+                this.printUsage();
+                this.exit(1);
             }
 
             if (commandLine.hasOption("h") || commandLine.getArgs().length == 0) {
-                printUsage();
-                exit(0);
+                this.printUsage();
+                this.exit(0);
             }
 
             // Setup conditions manager from command line options.
-            setupConditionsManager(commandLine);
+            this.setupConditionsManager(commandLine);
 
             // Get the sub-command to use.
             final String commandName = commandLine.getArgs()[0];
@@ -180,8 +180,8 @@
 
         // Set the conditions manager log level (does not affect logger of this class or sub-commands).
         if (commandLine.hasOption("l")) {
-            Level level = Level.parse(commandLine.getOptionValue("l"));
-            conditionsManager.setLogLevel(level);
+            final Level level = Level.parse(commandLine.getOptionValue("l"));
+            this.conditionsManager.setLogLevel(level);
             LOGGER.config("conditions manager log level will be set to " + level.toString());
         }
 
@@ -201,8 +201,8 @@
 
         // User specified tag of conditions records.
         if (commandLine.hasOption("t")) {
-            String tag = commandLine.getOptionValue("t");
-            conditionsManager.setTag(tag);
+            final String tag = commandLine.getOptionValue("t");
+            this.conditionsManager.setTag(tag);
             LOGGER.config("using tag " + tag);
         }
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/LoadCommand.java	Mon Jul  6 12:03:16 2015
@@ -1,15 +1,7 @@
 package org.hps.conditions.cli;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
 import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -18,9 +10,6 @@
 import org.apache.commons.cli.Options;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObject;
-import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.api.ConditionsObjectException;
-import org.hps.conditions.api.ConditionsObjectUtilities;
 import org.hps.conditions.api.DatabaseObjectException;
 import org.hps.conditions.api.TableMetaData;
 import org.hps.conditions.database.DatabaseConditionsManager;
@@ -28,10 +17,10 @@
 import org.lcsim.util.log.MessageOnlyLogFormatter;
 
 /**
- * This is a sub-command to add conditions data using an input text file. The file should be ASCII text that is tab or
- * space delimited and includes headers with the names of the database columns. (These must match exactly!) The user
- * must supply a table name as the target for the SQL insert. An optional collection ID can be supplied, which may not
- * exist already in the table. Otherwise, the command will fail. By default, the next collection ID will be found by the
+ * This is a sub-command to add conditions data using an input text file. The file should be ASCII text that is comma
+ * delimited with the first row containing headers that exactly match the table column names. The user must supply a
+ * table name as the target for the SQL insert. An optional collection ID can be supplied, which is not allowed to exist
+ * already in the table. Otherwise, the command will fail. By default, the next collection ID will be found by the
  * conditions manager.
  * <p>
  *
@@ -45,9 +34,9 @@
 final class LoadCommand extends AbstractCommand {
 
     /**
-     * The default separator for making tokens from input data.
+     * The default separator for making tokens from input data (tab-delimited).
      */
-    private static final String DEFAULT_FIELD_SEPARATOR = " \t";
+    private static final String DEFAULT_FIELD_SEPARATOR = "\t";
 
     /**
      * Setup the logger.
@@ -65,7 +54,7 @@
         OPTIONS.addOption(new Option("f", true, "input data file path (required)"));
         OPTIONS.getOption("f").setRequired(true);
         OPTIONS.addOption(new Option("d", true, "description of the collection for log"));
-        OPTIONS.addOption(new Option("s", true, "field seperator string (default is tabs or spaces)"));
+        OPTIONS.addOption(new Option("c", true, "field delimiter (default is tabs)"));
     }
 
     /**
@@ -111,8 +100,11 @@
         }
 
         String separator = DEFAULT_FIELD_SEPARATOR;
-        if (commandLine.hasOption("s")) {
-            separator = commandLine.getOptionValue("s");
+        if (commandLine.hasOption("c")) {
+            separator = commandLine.getOptionValue("c");
+            if (separator.length() > 1) {
+                throw new IllegalArgumentException("Separator must be a single character.");
+            }
             LOGGER.info("using separator character <" + separator + ">");
         }
 
@@ -131,7 +123,11 @@
         LOGGER.info("collection was assigned ID " + newCollection.getCollectionId());
 
         LOGGER.info("parsing input file " + fileName + " ...");
-        this.parseFile(fileName, newCollection, separator);
+        try {
+            newCollection.load(new File(fileName), separator.charAt(0));
+        } catch (final Exception e) {
+            throw new RuntimeException("Error loading CSV file.", e);
+        }
         LOGGER.info("Done parsing input file!");
 
         try {
@@ -143,124 +139,7 @@
         }
 
         conditionsManager.closeConnection(openedConnection);
-    }
 
-    /**
-     * Parse an input text file and create conditions objects from its row data.
-     *
-     * @param fileName the name of the text file
-     * @param collection the collection into which objects will be inserted
-     */
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    private final void parseFile(final String fileName, final ConditionsObjectCollection collection,
-            final String seperator) {
-
-        BufferedReader reader = null;
-
-        try {
-            final File inputFile = new File(fileName);
-            reader = new BufferedReader(new FileReader(inputFile));
-
-            LOGGER.info("reading in header line ...");
-
-            // Read in the header line with column names.
-            final String headerLine = reader.readLine();
-            LOGGER.info("got header line: " + headerLine);
-            if (headerLine == null) {
-                throw new IllegalArgumentException("The file is empty.");
-            }
-            StringTokenizer tokenizer = new StringTokenizer(headerLine, seperator);
-            final List<String> columnNames = new ArrayList<String>();
-            while (tokenizer.hasMoreTokens()) {
-                final String columnName = tokenizer.nextToken().trim();
-                LOGGER.info("read column name: " + columnName);
-                columnNames.add(columnName);
-            }
-            if (columnNames.isEmpty()) {
-                throw new RuntimeException("No column names found in file.");
-            }
-
-            // Get table info.
-            final TableMetaData tableMetaData = collection.getTableMetaData();
-            final Class<? extends ConditionsObject> objectClass = tableMetaData.getObjectClass();
-
-            // Get the field names from the table info.
-            final Set<String> fieldNames = tableMetaData.getFieldNames();
-            fieldNames.remove("collection_id");
-
-            // Check that the column names which were read in from the header row are valid.
-            for (final String columnName : columnNames) {
-                LOGGER.info("checking column: " + columnName);
-                if (!fieldNames.contains(columnName)) {
-                    throw new RuntimeException("Unknown column name: " + columnName);
-                }
-            }
-
-            // Read lines from the file.
-            String line = null;
-            int lineNumber = 1;
-            while ((line = reader.readLine()) != null) {
-
-                LOGGER.info("reading line " + lineNumber);
-
-                // Create a new conditions object for the row.
-                ConditionsObject object;
-                try {
-                    object = objectClass.newInstance();
-                } catch (InstantiationException | IllegalAccessException e) {
-                    throw new RuntimeException("Error creating new object.", e);
-                }
-
-                // Parse the line.
-                tokenizer = new StringTokenizer(line, " \t");
-                final int tokens = tokenizer.countTokens();
-
-                // Check that the number of data items is correct.
-                if (tokens != columnNames.size()) {
-                    throw new RuntimeException("Row " + lineNumber + " has wrong number of data items.");
-                }
-
-                // Iterate over the tokens.
-                for (int i = 0; i < tokens; i++) {
-
-                    LOGGER.info("proc token " + i);
-
-                    // Get the column name.
-                    final String columnName = columnNames.get(i);
-
-                    // Get the column type.
-                    final Class<?> columnType = tableMetaData.getFieldType(columnName);
-
-                    // Get the value of the cell.
-                    final String value = tokenizer.nextToken();
-
-                    LOGGER.info("columnName: " + columnName);
-                    LOGGER.info("columnType: " + columnType.getName());
-                    LOGGER.info("value: " + value);
-
-                    // Convert the value to a specific type and set the value on the object.
-                    object.setFieldValue(columnNames.get(i), ConditionsObjectUtilities.convertValue(columnType, value));
-
-                    // Add the object to the collection.
-                    LOGGER.info("adding conditions object: " + object);
-                    collection.add(object);
-                }
-                ++lineNumber;
-            }
-        } catch (final FileNotFoundException e) {
-            throw new RuntimeException("The input file does not exist.", e);
-        } catch (final IOException e) {
-            throw new RuntimeException("Error reading from the file.", e);
-        } catch (final ConditionsObjectException e) {
-            throw new RuntimeException("Error adding object to collection.", e);
-        } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (final IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
+        LOGGER.info("Collection was loaded successfully!");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	Mon Jul  6 12:03:16 2015
@@ -24,7 +24,7 @@
  * This sub-command of the conditions CLI prints conditions conditions table data by run number to the console or
  * optionally writes it to an output file.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 final class PrintCommand extends AbstractCommand {
 
@@ -87,7 +87,7 @@
     @Override
     final void execute(final String[] arguments) {
 
-        final CommandLine commandLine = parse(arguments);
+        final CommandLine commandLine = this.parse(arguments);
 
         final DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
 
@@ -154,7 +154,7 @@
         final Set<String> conditionsKeys = conditionsRecords.getConditionsKeys();
 
         // Print the records and the data.
-        printConditionsRecords(conditionsKeys);
+        this.printConditionsRecords(conditionsKeys);
         this.ps.flush();
         this.ps.close();
 
@@ -205,10 +205,10 @@
         // Loop over all the collections and print them.
         for (final ConditionsObjectCollection<?> collection : collectionList) {
             if (this.printHeaders) {
-                printCollectionHeader(collection);
-            }
-            printColumnNames(collection.getTableMetaData());
-            printCollection(collection);
+                this.printCollectionHeader(collection);
+            }
+            this.printColumnNames(collection.getTableMetaData());
+            this.printCollection(collection);
             this.ps.println();
         }
         this.ps.flush();
@@ -270,7 +270,7 @@
             collectionList.add(collection);
 
             // Print out all the collection data to console or file.
-            printCollections(collectionList);
+            this.printCollections(collectionList);
         }
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/RunSummaryCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/RunSummaryCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/RunSummaryCommand.java	Mon Jul  6 12:03:16 2015
@@ -23,8 +23,8 @@
  * any conditions objects, only the collection information. By default it will print information about the single
  * collection found for a given type, which is by convention the last one updated. The <code>-a</code> option can be
  * used to print out all collection information.
- * 
- * @author @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ *
+ * @author Jeremy McCormick, SLAC
  */
 final class RunSummaryCommand extends AbstractCommand {
 
@@ -58,7 +58,7 @@
     @Override
     final void execute(final String[] arguments) {
 
-        final CommandLine commandLine = parse(arguments);
+        final CommandLine commandLine = this.parse(arguments);
 
         final DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
 
@@ -68,39 +68,39 @@
 
         final int run = conditionsManager.getRun();
 
-        boolean printAll = commandLine.hasOption("a");
+        final boolean printAll = commandLine.hasOption("a");
         if (printAll) {
             LOGGER.info("All collections will be printed.");
         }
 
         // Get all the conditions records from the manager including those that overlap in time validity.
-        ConditionsRecordCollection conditionsRecords = conditionsManager.getConditionsRecords();
+        final ConditionsRecordCollection conditionsRecords = conditionsManager.getConditionsRecords();
         LOGGER.info('\n' + "Run " + run + " has " + conditionsRecords.size() + " conditions records.");
 
         // Get the list of unique conditions keys and sort them.
-        List<String> conditionsKeys = new ArrayList<String>(conditionsRecords.getConditionsKeys());
+        final List<String> conditionsKeys = new ArrayList<String>(conditionsRecords.getConditionsKeys());
         Collections.sort(conditionsKeys);
         LOGGER.info('\n' + "Found these unique conditions keys for the run ...");
-        for (String key : conditionsKeys) {
+        for (final String key : conditionsKeys) {
             LOGGER.info(key);
         }
         LOGGER.info("");
 
         // Loop over all the conditions keys that apply to this run.
-        for (String key : conditionsKeys) {
+        for (final String key : conditionsKeys) {
 
             // Get the table meta data for the key.
-            TableMetaData tableMetaData = conditionsManager.findTableMetaData(key);
+            final TableMetaData tableMetaData = conditionsManager.findTableMetaData(key);
 
             // Get all the conditions records that match this key.
-            ConditionsRecordCollection collectionRecords = conditionsRecords.findByKey(key);
+            final ConditionsRecordCollection collectionRecords = conditionsRecords.findByKey(key);
 
             // Get the table name.
             final String tableName = tableMetaData.getTableName();
 
             if (!printAll) {
                 // Print out the single collection that will be used if retrieved through the converter.
-                ConditionsObjectCollection<?> collection = conditionsManager.getCachedConditions(
+                final ConditionsObjectCollection<?> collection = conditionsManager.getCachedConditions(
                         tableMetaData.getCollectionClass(), key).getCachedData();
                 LOGGER.info(tableMetaData.getObjectClass().getSimpleName() + " collection "
                         + collection.getCollectionId() + " in " + tableName + " with " + collection.size() + " rows.");
@@ -109,7 +109,7 @@
                 // be used.
                 LOGGER.info(tableMetaData.getObjectClass().getSimpleName() + " has " + collectionRecords.size()
                         + " collection(s) in " + tableName + " for run.");
-                for (ConditionsRecord record : collectionRecords) {
+                for (final ConditionsRecord record : collectionRecords) {
                     LOGGER.info("  collection " + record.getCollectionId().toString() + " created on "
                             + record.getCreated().toString());
                 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/TagCommand.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/TagCommand.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/TagCommand.java	Mon Jul  6 12:03:16 2015
@@ -22,9 +22,8 @@
 /**
  * Create a conditions system tag.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
-// TODO: Add command switch to specify multiple records strategy (last updated, last created, latest run end, etc.).
 public class TagCommand extends AbstractCommand {
 
     /**
@@ -68,7 +67,7 @@
     @Override
     void execute(final String[] arguments) {
 
-        final CommandLine commandLine = parse(arguments);
+        final CommandLine commandLine = this.parse(arguments);
 
         final Set<Integer> runNumbers = new LinkedHashSet<Integer>();
         for (final String value : commandLine.getOptionValues("r")) {

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/package-info.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/package-info.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/cli/package-info.java	Mon Jul  6 12:03:16 2015
@@ -1,7 +1,7 @@
 /**
  * Command line interface to the conditions system.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 package org.hps.conditions.cli;
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsRecordConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsRecordConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsRecordConverter.java	Mon Jul  6 12:03:16 2015
@@ -16,7 +16,7 @@
 /**
  * Read {@link org.hps.conditions.api.ConditionsRecord} objects from the conditions database.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class ConditionsRecordConverter extends AbstractConditionsObjectConverter<ConditionsRecordCollection> {
 
@@ -82,7 +82,7 @@
             databaseConditionsManager.closeConnection();
         }
 
-        return getType().cast(collection);
+        return this.getType().cast(collection);
     }
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsSeriesConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsSeriesConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConditionsSeriesConverter.java	Mon Jul  6 12:03:16 2015
@@ -16,25 +16,25 @@
  * sets of conditions that may overlap in time validity. The user may then use whichever collections are of interest to
  * them.
  *
+ * @author Jeremy McCormick, SLAC
  * @see org.hps.conditions.api.ConditionsSeries
  * @see org.hps.conditions.api.ConditionsObjectCollection
  * @see org.hps.conditions.api.ConditionsObject
  * @see DatabaseConditionsManager
  * @param <ObjectType> The type of the ConditionsObject.
  * @param <CollectionType> The type of the collection.
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
 final class ConditionsSeriesConverter<ObjectType extends ConditionsObject, CollectionType extends ConditionsObjectCollection<ObjectType>> {
+
+    /**
+     * The type of the collection.
+     */
+    final Class<CollectionType> collectionType;
 
     /**
      * The type of the object.
      */
     final Class<ObjectType> objectType;
-
-    /**
-     * The type of the collection.
-     */
-    final Class<CollectionType> collectionType;
 
     /**
      * Class constructor.

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConnectionParameters.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConnectionParameters.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConnectionParameters.java	Mon Jul  6 12:03:16 2015
@@ -13,7 +13,7 @@
 /**
  * This class encapsulates the parameters for connecting to a database, including host name, port, user and password.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class ConnectionParameters {
 
@@ -145,13 +145,13 @@
      * @return the new <code>Connection</code> object
      */
     public Connection createConnection() {
-        final Properties connectionProperties = getConnectionProperties();
+        final Properties connectionProperties = this.getConnectionProperties();
         Connection connection = null;
         try {
-            connection = DriverManager.getConnection(getConnectionString(), connectionProperties);
-            connection.createStatement().execute("USE " + getDatabase());
+            connection = DriverManager.getConnection(this.getConnectionString(), connectionProperties);
+            connection.createStatement().execute("USE " + this.getDatabase());
         } catch (final SQLException x) {
-            throw new RuntimeException("Failed to connect to database: " + getConnectionString(), x);
+            throw new RuntimeException("Failed to connect to database: " + this.getConnectionString(), x);
         }
         return connection;
     }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Converter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Converter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Converter.java	Mon Jul  6 12:03:16 2015
@@ -12,23 +12,23 @@
  * classes.
  *
  * @see AbstractConditionsObjectConverter
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
 public @interface Converter {
+    /**
+     * Get a custom converter class for the type. (Optional)
+     *
+     * @return the custom converter for the type
+     */
+    Class<?> converter() default AbstractConditionsObjectConverter.class;
+
     /**
      * Get the action to perform in the converter when multiple conditions are found for the current configuration of
      * run number, detector and tag in the manager.
      *
      * @return the multiple collections action
      */
-    MultipleCollectionsAction multipleCollectionsAction() default MultipleCollectionsAction.ERROR;
-
-    /**
-     * Get a custom converter class for the type. (Optional)
-     *
-     * @return the custom converter for the type
-     */
-    Class<?> converter() default AbstractConditionsObjectConverter.class;
+    MultipleCollectionsAction multipleCollectionsAction() default MultipleCollectionsAction.LAST_CREATED;
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConverterRegistry.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConverterRegistry.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/ConverterRegistry.java	Mon Jul  6 12:03:16 2015
@@ -19,17 +19,11 @@
  * instantiate the specific converter class instead.
  *
  * @see AbstractConditionsObjectConverter
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @SuppressWarnings("serial")
 public final class ConverterRegistry extends
         HashMap<Class<? extends ConditionsObject>, AbstractConditionsObjectConverter> {
-
-    /**
-     * Class should not be instantiated by users. The {@link #create()} method should be used instead.
-     */
-    private ConverterRegistry() {
-    }
 
     /**
      * Automatically create converters for all {@link org.hps.conditions.api.ConditionsObject} classes.
@@ -43,25 +37,33 @@
         final Set<Class<? extends ConditionsObject>> objectTypes = reflections.getSubTypesOf(ConditionsObject.class);
         for (final Class<? extends ConditionsObject> objectType : objectTypes) {
             if (Modifier.isAbstract(objectType.getModifiers())) {
+                // Abstract classes are not mapped to the db.
                 continue;
             }
             if (objectType.getAnnotation(Table.class) == null) {
+                // Explicit table mapping is required.
                 continue;
             }
-            MultipleCollectionsAction multipleCollectionsAction = MultipleCollectionsAction.ERROR;
+
+            // Class of the converter.
             Class<?> converterClass = null;
+
+            // Annotation for converter parameters (optional).
             final Converter converterAnnotation = objectType.getAnnotation(Converter.class);
             if (converterAnnotation != null) {
-                multipleCollectionsAction = converterAnnotation.multipleCollectionsAction();
                 if (!converterAnnotation.converter().equals(AbstractConditionsObjectConverter.class)) {
+                    // Set class of converter from annotation (usually default is fine).
                     converterClass = converterAnnotation.converter();
                 }
             }
 
-            final Class<? extends BaseConditionsObjectCollection<? extends ConditionsObject>> collectionType = TableRegistry.getCollectionType(objectType);
+            // Type of the collection.
+            final Class<? extends BaseConditionsObjectCollection<? extends ConditionsObject>> collectionType = TableRegistry
+                    .getCollectionType(objectType);
 
             AbstractConditionsObjectConverter converter = null;
             if (converterClass == null) {
+                // Create a generic/anonymous converter.
                 converter = new AbstractConditionsObjectConverter() {
                     @Override
                     public Class getType() {
@@ -69,6 +71,7 @@
                     }
                 };
             } else {
+                // Create a converter instance from the provided type in the annotation.
                 try {
                     final Object object = converterClass.newInstance();
                     if (!(object instanceof AbstractConditionsObjectConverter)) {
@@ -80,22 +83,34 @@
                     throw new RuntimeException(e);
                 }
             }
-            converter.setMultipleCollectionsAction(multipleCollectionsAction);
+
+            // Set the converter's strategy for disambiguating overlapping time validity.
+            if (converterAnnotation != null && converterAnnotation.multipleCollectionsAction() != null) {
+                converter.setMultipleCollectionsAction(converterAnnotation.multipleCollectionsAction());
+            }
+
+            // Register the converter by its conversion type.
             registry.put(converter.getType(), converter);
         }
         return registry;
     }
 
     /**
+     * Class should not be instantiated by users. The {@link #create()} method should be used instead.
+     */
+    private ConverterRegistry() {
+    }
+
+    /**
      * Convert the object to a string.
-     * 
+     *
      * @return the object converted to a string
      */
     @Override
     @SuppressWarnings("rawtypes")
     public String toString() {
         final StringBuffer buff = new StringBuffer();
-        for (final Entry<Class<? extends ConditionsObject>, AbstractConditionsObjectConverter> entry : entrySet()) {
+        for (final Entry<Class<? extends ConditionsObject>, AbstractConditionsObjectConverter> entry : this.entrySet()) {
             buff.append(entry.getValue().toString());
         }
         return buff.toString();

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	Mon Jul  6 12:03:16 2015
@@ -56,7 +56,7 @@
  * Differences between Test Run and Engineering Run configurations are handled automatically.
  *
  * @see org.lcsim.conditions.ConditionsManager
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @SuppressWarnings("rawtypes")
 public final class DatabaseConditionsManager extends ConditionsManagerImplementation {

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseUtilities.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseUtilities.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/DatabaseUtilities.java	Mon Jul  6 12:03:16 2015
@@ -6,16 +6,10 @@
 /**
  * Database utility methods.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 // TODO: Merge this single method into the manager class or a connection utilities class.
 public final class DatabaseUtilities {
-
-    /**
-     * Do not allow instantiation.
-     */
-    private DatabaseUtilities() {
-    }
 
     /**
      * Cleanup a JDBC <code>ResultSet</code> by closing it and its <code>Statement</code>
@@ -26,22 +20,28 @@
         Statement statement = null;
         try {
             statement = resultSet.getStatement();
-        } catch (Exception e) {
+        } catch (final Exception e) {
         }
         try {
             if (resultSet != null) {
                 resultSet.close();
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
         }
         try {
             if (statement != null) {
                 statement.close();
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
         }
     }
 
+    /**
+     * Do not allow instantiation.
+     */
+    private DatabaseUtilities() {
+    }
+
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Field.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Field.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Field.java	Mon Jul  6 12:03:16 2015
@@ -7,6 +7,8 @@
 
 /**
  * This is a java <code>Annotation</code> for assigning a "get" method to one or more database table columns.
+ * 
+ * @author Jeremy McCormick, SLAC
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
@@ -14,7 +16,7 @@
 
     /**
      * The names of the table columns associated with this method.
-     * 
+     *
      * @return the names of the table columns associated with this method
      */
     String[] names() default "";

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/MultipleCollectionsAction.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/MultipleCollectionsAction.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/MultipleCollectionsAction.java	Mon Jul  6 12:03:16 2015
@@ -4,23 +4,23 @@
  * This is the action that should be used to pick a conditions set if there are multiple conditions sets returned from a
  * query on type and name.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public enum MultipleCollectionsAction {
+    /**
+     * Throw an error.
+     */
+    ERROR,
+    /**
+     * Use the creation date.
+     */
+    LAST_CREATED,
     /**
      * Use the updated date.
      */
     LAST_UPDATED,
     /**
-     * Use the creation date.
-     */
-    LAST_CREATED,
-    /**
      * Use the largest run start number.
      */
-    LATEST_RUN_START,
-    /**
-     * Throw an error.
-     */
-    ERROR
+    LATEST_RUN_START
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Table.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Table.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/Table.java	Mon Jul  6 12:03:16 2015
@@ -8,7 +8,7 @@
 /**
  * This annotation can be used to assign a class to one or more database tables.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
@@ -16,7 +16,7 @@
 
     /**
      * Get the names of the tables.
-     * 
+     *
      * @return the names of the tables
      */
     String[] names() default "";

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/package-info.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/package-info.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/database/package-info.java	Mon Jul  6 12:03:16 2015
@@ -2,11 +2,11 @@
  * This package contains classes for converting database information into conditions classes as well as updating the
  * records from the objects.
  *
+ * @author Jeremy McCormick, SLAC
  * @see DatabaseConditionsManager
  * @see TableMetaData
  * @see AbstractConditionsObjectConverter
  * @see ConditionsSeriesConverter
- * @author Jeremy McCormick <[log in to unmask]>
  */
 package org.hps.conditions.database;
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObject.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObject.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObject.java	Mon Jul  6 12:03:16 2015
@@ -2,6 +2,7 @@
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.Date;
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
@@ -11,11 +12,16 @@
 import org.hps.conditions.database.Table;
 
 /**
- * A dummy conditions object type.
+ * A dummy conditions object type for testing purposes.
+ *
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"dummy"})
 public final class DummyConditionsObject extends BaseConditionsObject {
 
+    /**
+     * Collection implementation.
+     */
     public static class DummyConditionsObjectCollection extends BaseConditionsObjectCollection<DummyConditionsObject> {
 
         public DummyConditionsObjectCollection() {
@@ -27,15 +33,49 @@
         }
     }
 
+    /**
+     * Class constructor.
+     */
     public DummyConditionsObject() {
     }
 
+    /**
+     * Class constructor.
+     *
+     * @param connection the database connection
+     * @param tableMetaData the table meta data
+     */
     public DummyConditionsObject(final Connection connection, final TableMetaData tableMetaData) {
         super(connection, tableMetaData);
     }
 
+    /**
+     * Dummy double value.
+     * 
+     * @return the dummy double value
+     */
     @Field(names = {"dummy"})
     public Double getDummy() {
         return this.getFieldValue(Double.class, "dummy");
     }
+
+    /**
+     * Dummy date.
+     * 
+     * @return the dummy date value
+     */
+    @Field(names = {"dummy_dt"})
+    public Date getDummyDt() {
+        return this.getFieldValue(Date.class, "dummy_dt");
+    }
+
+    /**
+     * Dummy timestamp.
+     * 
+     * @return the dummy timestamp value
+     */
+    @Field(names = {"dummy_ts"})
+    public Date getDummyTs() {
+        return this.getFieldValue(Date.class, "dummy_ts");
+    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObjectConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObjectConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/dummy/DummyConditionsObjectConverter.java	Mon Jul  6 12:03:16 2015
@@ -3,8 +3,19 @@
 import org.hps.conditions.api.AbstractConditionsObjectConverter;
 import org.hps.conditions.dummy.DummyConditionsObject.DummyConditionsObjectCollection;
 
+/**
+ * Converter for dummy conditions object.
+ *
+ * @author Jeremy McCormick, SLAC
+ */
 public final class DummyConditionsObjectConverter extends
         AbstractConditionsObjectConverter<DummyConditionsObjectCollection> {
+
+    /**
+     * Get the object's type.
+     *
+     * @return the object's type
+     */
     @Override
     public Class<DummyConditionsObjectCollection> getType() {
         return DummyConditionsObjectCollection.class;

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalBadChannel.java	Mon Jul  6 12:03:16 2015
@@ -5,16 +5,15 @@
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * This class represents an ECAL channel that is considered "bad" which means it should not be used in reconstruction.
+ * 
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"ecal_bad_channels", "test_run_ecal_bad_channels"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_UPDATED)
 public final class EcalBadChannel extends BaseConditionsObject {
 
     /**
@@ -24,21 +23,12 @@
     public static class EcalBadChannelCollection extends BaseConditionsObjectCollection<EcalBadChannel> {
 
         /**
-         * Sort and return the collection without modifying in place.
-         * 
-         * @return the sorted collection
-         */
-        public ConditionsObjectCollection<EcalBadChannel> sorted() {
-            return sorted(new ChannelIdComparator());
-        }
-
-        /**
          * Comparison class for ECAL bad channels, which uses channel ID.
          */
         class ChannelIdComparator implements Comparator<EcalBadChannel> {
             /**
              * Compare two ECAL bad channel objects.
-             * 
+             *
              * @param o1 the first object
              * @param o2 the second object
              * @return -1, 0, 1 if first channel ID is less than, equal to, or greater than the second
@@ -54,15 +44,24 @@
                 }
             }
         }
+
+        /**
+         * Sort and return the collection without modifying in place.
+         *
+         * @return the sorted collection
+         */
+        public ConditionsObjectCollection<EcalBadChannel> sorted() {
+            return this.sorted(new ChannelIdComparator());
+        }
     }
 
     /**
      * Get the ECAL channel ID.
-     * 
+     *
      * @return the ECAL channel ID
      */
     @Field(names = {"ecal_channel_id"})
     public Integer getChannelId() {
-        return getFieldValue("ecal_channel_id");
+        return this.getFieldValue("ecal_channel_id");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCalibration.java	Mon Jul  6 12:03:16 2015
@@ -5,36 +5,22 @@
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
- * This class is a simplistic representation of ECal pedestal and noise values from the conditions database. The
- * pedestal and noise are in units of ADC counts. They are the mean and the standard deviation of the digitized pre-amp
- * output.
+ * This class represents ECal pedestal and noise values from the conditions database. The pedestal and noise are in
+ * units of ADC counts. They are the mean and the standard deviation of the digitized pre-amp output.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
-@Table(names = {"ecal_calibrations", "test_run_ecal_calibrations", "ecal_hardware_calibrations"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
+@Table(names = {"ecal_calibrations", "test_run_ecal_calibrations"})
 public final class EcalCalibration extends BaseConditionsObject {
 
     /**
      * The collection implementation for the object class.
      */
-    @SuppressWarnings("serial")
     public static class EcalCalibrationCollection extends BaseConditionsObjectCollection<EcalCalibration> {
-
-        /**
-         * Sort and return the collection but do no modify in place.
-         * 
-         * @return the sorted collection
-         */
-        public ConditionsObjectCollection<EcalCalibration> sorted() {
-            return sorted(new ChannelIdComparator());
-        }
 
         /**
          * Comparison using channel ID.
@@ -42,7 +28,7 @@
         class ChannelIdComparator implements Comparator<EcalCalibration> {
             /**
              * Compare two ECAL calibration objects.
-             * 
+             *
              * @param o1 the first object
              * @param o2 the second object
              * @return -1, 0, 1 if first channel ID is less than, equal to, or greater than the second
@@ -58,6 +44,15 @@
                 }
             }
         }
+
+        /**
+         * Sort and return the collection but do no modify in place.
+         *
+         * @return the sorted collection
+         */
+        public ConditionsObjectCollection<EcalCalibration> sorted() {
+            return this.sorted(new ChannelIdComparator());
+        }
     }
 
     /**
@@ -68,7 +63,7 @@
 
     /**
      * Full qualified constructor.
-     * 
+     *
      * @param channelId the channel ID
      * @param pedestal the pedestal measurement (ADC counts)
      * @param noise the noise measured as RMS
@@ -81,31 +76,31 @@
 
     /**
      * Get the ECAL channel ID.
-     * 
+     *
      * @return the ECAL channel ID
      */
     @Field(names = {"ecal_channel_id"})
     public Integer getChannelId() {
-        return getFieldValue("ecal_channel_id");
+        return this.getFieldValue("ecal_channel_id");
+    }
+
+    /**
+     * Get the noise value in units of ADC counts, which is the standard deviation of the digitized preamplifier output.
+     *
+     * @return the noise value
+     */
+    @Field(names = {"noise"})
+    public Double getNoise() {
+        return this.getFieldValue("noise");
     }
 
     /**
      * Get the pedestal value in units of ADC counts, which is the mean of the digitized preamplifier output.
-     * 
+     *
      * @return the gain value
      */
     @Field(names = {"pedestal"})
     public Double getPedestal() {
-        return getFieldValue("pedestal");
-    }
-
-    /**
-     * Get the noise value in units of ADC counts, which is the standard deviation of the digitized preamplifier output.
-     * 
-     * @return the noise value
-     */
-    @Field(names = {"noise"})
-    public Double getNoise() {
-        return getFieldValue("noise");
+        return this.getFieldValue("pedestal");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannel.java	Mon Jul  6 12:03:16 2015
@@ -13,7 +13,6 @@
 import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.detector.identifier.ExpandedIdentifier;
@@ -25,10 +24,10 @@
  * This class encapsulates all the information about a single ECal channel, corresponding to one physical crystal in the
  * detector.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"ecal_channels", "test_run_ecal_channels"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED, converter = EcalChannel.EcalChannelConverter.class)
+@Converter(converter = EcalChannel.EcalChannelConverter.class)
 public final class EcalChannel extends BaseConditionsObject {
 
     /**
@@ -271,7 +270,7 @@
          * @return the sorted copy of the collection
          */
         public ConditionsObjectCollection<EcalChannel> sorted() {
-            return sorted(new ChannelIdComparator());
+            return this.sorted(new ChannelIdComparator());
         }
     }
 
@@ -388,7 +387,7 @@
      * @return the {@link #DaqId} for this ECAL channel
      */
     DaqId createDaqId() {
-        return new DaqId(new int[] {getCrate(), getSlot(), getChannel()});
+        return new DaqId(new int[] {this.getCrate(), this.getSlot(), this.getChannel()});
     }
 
     /**
@@ -399,7 +398,7 @@
      * @return the geometry ID
      */
     GeometryId createGeometryId(final IIdentifierHelper helper, final int system) {
-        return new GeometryId(helper, new int[] {system, getX(), getY()});
+        return new GeometryId(helper, new int[] {system, this.getX(), this.getY()});
     }
 
     /**
@@ -420,8 +419,9 @@
             return true;
         }
         final EcalChannel c = (EcalChannel) o;
-        return c.getChannelId() == getChannelId() && c.getCrate() == getCrate() && c.getSlot() == getSlot()
-                && c.getChannel() == getChannel() && c.getX() == getX() && c.getY() == getY();
+        return c.getChannelId() == this.getChannelId() && c.getCrate() == this.getCrate()
+                && c.getSlot() == this.getSlot() && c.getChannel() == this.getChannel() && c.getX() == this.getX()
+                && c.getY() == this.getY();
     }
 
     /**
@@ -431,7 +431,7 @@
      */
     @Field(names = {"channel"})
     public Integer getChannel() {
-        return getFieldValue("channel");
+        return this.getFieldValue("channel");
     }
 
     /**
@@ -441,7 +441,7 @@
      */
     @Field(names = {"channel_id"})
     public Integer getChannelId() {
-        return getFieldValue("channel_id");
+        return this.getFieldValue("channel_id");
     }
 
     /**
@@ -451,7 +451,7 @@
      */
     @Field(names = {"crate"})
     public Integer getCrate() {
-        return getFieldValue("crate");
+        return this.getFieldValue("crate");
     }
 
     /**
@@ -461,7 +461,7 @@
      */
     @Field(names = {"slot"})
     public Integer getSlot() {
-        return getFieldValue("slot");
+        return this.getFieldValue("slot");
     }
 
     /**
@@ -471,7 +471,7 @@
      */
     @Field(names = {"x"})
     public Integer getX() {
-        return getFieldValue("x");
+        return this.getFieldValue("x");
     }
 
     /**
@@ -481,6 +481,6 @@
      */
     @Field(names = {"y"})
     public Integer getY() {
-        return getFieldValue("y");
+        return this.getFieldValue("y");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java	Mon Jul  6 12:03:16 2015
@@ -2,8 +2,8 @@
 
 /**
  * This class represents the conditions of a single ECAL channel such as a calibration and gain.
- * 
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ *
+ * @author Jeremy McCormick, SLAC
  * @see EcalGain
  * @see EcalCalibration
  * @see EcalTimeShift
@@ -12,9 +12,9 @@
 public final class EcalChannelConstants {
 
     /**
-     * The channel {@link EcalGain} conditions.
+     * True if channel is bad and should not be used for reconstruction.
      */
-    private EcalGain gain = null;
+    private boolean badChannel = false;
 
     /**
      * The channel {@link EcalCalibration} conditions.
@@ -22,14 +22,14 @@
     private EcalCalibration calibration = null;
 
     /**
+     * The channel {@link EcalGain} conditions.
+     */
+    private EcalGain gain = null;
+
+    /**
      * The channel {@link EcalTimeShift} conditions.
      */
     private EcalTimeShift timeShift = null;
-
-    /**
-     * True if channel is bad and should not be used for reconstruction.
-     */
-    private boolean badChannel = false;
 
     /**
      * Class constructor, which is package protected.
@@ -38,8 +38,62 @@
     }
 
     /**
+     * Get the calibration.
+     *
+     * @return The calibration.
+     */
+    public EcalCalibration getCalibration() {
+        return this.calibration;
+    }
+
+    /**
+     * Get the gain.
+     *
+     * @return The gain.
+     */
+    public EcalGain getGain() {
+        return this.gain;
+    }
+
+    /**
+     * Get the time shift.
+     *
+     * @return The time shift.
+     */
+    public EcalTimeShift getTimeShift() {
+        return this.timeShift;
+    }
+
+    /**
+     * True if this is a bad channel.
+     *
+     * @return True if channel is bad.
+     */
+    public boolean isBadChannel() {
+        return this.badChannel;
+    }
+
+    /**
+     * Set whether this is a bad channel.
+     *
+     * @param badChannel set to true to flag channel as bad
+     */
+    void setBadChannel(final boolean badChannel) {
+        this.badChannel = badChannel;
+    }
+
+    /**
+     * Set the calibration.
+     *
+     * @param calibration the new calibration object
+     */
+    void setCalibration(final EcalCalibration calibration) {
+        this.calibration = calibration;
+    }
+
+    /**
      * Set the gain.
-     * 
+     *
      * @param gain the new gain object
      */
     void setGain(final EcalGain gain) {
@@ -47,65 +101,11 @@
     }
 
     /**
-     * Set the calibration.
-     * 
-     * @param calibration the new calibration object
-     */
-    void setCalibration(final EcalCalibration calibration) {
-        this.calibration = calibration;
-    }
-
-    /**
      * Set the time shift.
-     * 
+     *
      * @param timeShift the new time shift
      */
     void setTimeShift(final EcalTimeShift timeShift) {
         this.timeShift = timeShift;
     }
-
-    /**
-     * Set whether this is a bad channel.
-     * 
-     * @param badChannel set to true to flag channel as bad
-     */
-    void setBadChannel(final boolean badChannel) {
-        this.badChannel = badChannel;
-    }
-
-    /**
-     * Get the gain.
-     * 
-     * @return The gain.
-     */
-    public EcalGain getGain() {
-        return gain;
-    }
-
-    /**
-     * Get the calibration.
-     * 
-     * @return The calibration.
-     */
-    public EcalCalibration getCalibration() {
-        return calibration;
-    }
-
-    /**
-     * Get the time shift.
-     * 
-     * @return The time shift.
-     */
-    public EcalTimeShift getTimeShift() {
-        return timeShift;
-    }
-
-    /**
-     * True if this is a bad channel.
-     * 
-     * @return True if channel is bad.
-     */
-    public boolean isBadChannel() {
-        return badChannel;
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditions.java	Mon Jul  6 12:03:16 2015
@@ -16,9 +16,14 @@
  * a composite object containing data assembled from many other {@link org.hps.conditions.ConditionsObjects} and has a
  * special data converter {@link EcalConditionsConverter}.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class EcalConditions {
+
+    /**
+     * This is just used for a divider length in print output.
+     */
+    private static final int DIVIDER_SIZE = 91;
 
     /**
      * The collection of {@link EcalChannel} objects.
@@ -53,16 +58,13 @@
     }
 
     /**
-     * Set the channel map.
+     * Get the channel information for a geometric crystal.
      *
-     * @param channelCollection the channel map
+     * @param crystal the geometric crystal
+     * @return the channel information or null if does not exist
      */
-    void setChannelCollection(final EcalChannelCollection channelCollection) {
-        this.channelCollection = channelCollection;
-
-        // Build the map between crystals and channels.
-        this.crystalMap = new EcalCrystalChannelMap((HPSEcalAPI) this.subdetector.getDetectorElement(),
-                channelCollection);
+    public EcalChannel getChannel(final EcalCrystal crystal) {
+        return this.crystalMap.getEcalChannel(crystal);
     }
 
     /**
@@ -72,16 +74,6 @@
      */
     public EcalChannelCollection getChannelCollection() {
         return this.channelCollection;
-    }
-
-    /**
-     * Get the channel information for a geometric crystal.
-     *
-     * @param crystal the geometric crystal
-     * @return the channel information or null if does not exist
-     */
-    public EcalChannel getChannel(final EcalCrystal crystal) {
-        return this.crystalMap.getEcalChannel(crystal);
     }
 
     /**
@@ -106,9 +98,17 @@
     }
 
     /**
-     * This is just used for a divider length in print output.
+     * Set the channel map.
+     *
+     * @param channelCollection the channel map
      */
-    private static final int DIVIDER_SIZE = 91;
+    void setChannelCollection(final EcalChannelCollection channelCollection) {
+        this.channelCollection = channelCollection;
+
+        // Build the map between crystals and channels.
+        this.crystalMap = new EcalCrystalChannelMap((HPSEcalAPI) this.subdetector.getDetectorElement(),
+                channelCollection);
+    }
 
     /**
      * Convert this object to a string.
@@ -156,7 +156,7 @@
         // Loop over all channels.
         for (final EcalChannel channel : this.channelCollection) {
 
-            final EcalChannelConstants constants = getChannelConstants(channel);
+            final EcalChannelConstants constants = this.getChannelConstants(channel);
 
             final double gain = constants.getGain().getGain();
             final double pedestal = constants.getCalibration().getPedestal();

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java	Mon Jul  6 12:03:16 2015
@@ -17,8 +17,8 @@
  * This class loads all ECAL conditions into an {@link EcalConditions} object from the database, based on the current
  * run number known by the conditions manager.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  * @see EcalConditions
  * @see EcalChannel
  * @see EcalGain
@@ -29,23 +29,73 @@
 public class EcalConditionsConverter implements ConditionsConverter<EcalConditions> {
 
     /**
-     * Get the default {@link EcalChannel} collection.
+     * Create combined ECAL conditions object containing all data for the current run.
      *
      * @param manager the conditions manager
-     * @return the default ECAL channel object collection
+     * @param name the conditions set name (unused but must satisfy conditions API)
      */
-    protected EcalChannelCollection getEcalChannelCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();
-    }
+    @Override
+    public final EcalConditions getData(final ConditionsManager manager, final String name) {
 
-    /**
-     * Get the default {@link EcalGain} collection.
-     *
-     * @param manager the conditions manager
-     * @return the ECAL channel gain collection
-     */
-    protected EcalGainCollection getEcalGainCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalGainCollection.class, "ecal_gains").getCachedData();
+        final DatabaseConditionsManager databaseConditionsManager = (DatabaseConditionsManager) manager;
+
+        // Get the ECal channel map from the conditions database
+        final EcalChannelCollection channels = this.getEcalChannelCollection(databaseConditionsManager);
+
+        // Create the ECal conditions object that will be used to encapsulate
+        // ECal conditions collections
+        final Detector detector = databaseConditionsManager.getDetectorObject();
+        final EcalConditions conditions = new EcalConditions(detector.getSubdetector(databaseConditionsManager
+                .getEcalName()));
+
+        // Set the channel map.
+        conditions.setChannelCollection(channels);
+
+        // Get the ECal gains from the conditions database and add them to the
+        // conditions set
+        final EcalGainCollection gains = this.getEcalGainCollection(databaseConditionsManager);
+        for (final EcalGain gain : gains) {
+            final ChannelId channelId = new ChannelId(new int[] {gain.getChannelId()});
+            final EcalChannel channel = channels.findChannel(channelId);
+            conditions.getChannelConstants(channel).setGain(gain);
+        }
+
+        final ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> badChannelSeries = this
+                .getEcalBadChannelSeries(databaseConditionsManager);
+        // FIXME: How to get EcalBadChannelCollection here instead for the collection type?
+        // API of ConditionsSeries and ConditionsSeriesConverter needs to be changed!
+        for (final ConditionsObjectCollection<EcalBadChannel> badChannels : badChannelSeries) {
+            for (final EcalBadChannel badChannel : badChannels) {
+                final ChannelId channelId = new ChannelId(new int[] {badChannel.getChannelId()});
+                final EcalChannel channel = channels.findChannel(channelId);
+                conditions.getChannelConstants(channel).setBadChannel(true);
+            }
+        }
+
+        // Get the ECal calibrations from the conditions database and add them
+        // to the conditions set.
+        final EcalCalibrationCollection calibrations = this.getEcalCalibrationCollection(databaseConditionsManager);
+        for (final EcalCalibration calibration : calibrations) {
+            final ChannelId channelId = new ChannelId(new int[] {calibration.getChannelId()});
+            final EcalChannel channel = channels.findChannel(channelId);
+            conditions.getChannelConstants(channel).setCalibration(calibration);
+        }
+
+        // Get the ECal time shifts from the conditions database and add them to
+        // the conditions set.
+        if (databaseConditionsManager.hasConditionsRecord("ecal_time_shifts")) {
+            final EcalTimeShiftCollection timeShifts = this.getEcalTimeShiftCollection(databaseConditionsManager);
+            for (final EcalTimeShift timeShift : timeShifts) {
+                final ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
+                final EcalChannel channel = channels.findChannel(channelId);
+                conditions.getChannelConstants(channel).setTimeShift(timeShift);
+            }
+        } else {
+            DatabaseConditionsManager.getLogger().warning("no ecal_time_shifts collection found");
+        }
+
+        // Return the conditions object to caller.
+        return conditions;
     }
 
     /**
@@ -70,6 +120,26 @@
     }
 
     /**
+     * Get the default {@link EcalChannel} collection.
+     *
+     * @param manager the conditions manager
+     * @return the default ECAL channel object collection
+     */
+    protected EcalChannelCollection getEcalChannelCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();
+    }
+
+    /**
+     * Get the default {@link EcalGain} collection.
+     *
+     * @param manager the conditions manager
+     * @return the ECAL channel gain collection
+     */
+    protected EcalGainCollection getEcalGainCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(EcalGainCollection.class, "ecal_gains").getCachedData();
+    }
+
+    /**
      * Get the default {@link EcalTimeShift} collection.
      *
      * @param manager the conditions manager
@@ -77,75 +147,6 @@
      */
     protected EcalTimeShiftCollection getEcalTimeShiftCollection(final DatabaseConditionsManager manager) {
         return manager.getCachedConditions(EcalTimeShiftCollection.class, "ecal_time_shifts").getCachedData();
-    }
-
-    /**
-     * Create combined ECAL conditions object containing all data for the current run.
-     *
-     * @param manager the conditions manager
-     * @param name the conditions set name (unused but must satisfy conditions API)
-     */
-    @Override
-    public final EcalConditions getData(final ConditionsManager manager, final String name) {
-
-        final DatabaseConditionsManager databaseConditionsManager = (DatabaseConditionsManager) manager;
-
-        // Get the ECal channel map from the conditions database
-        final EcalChannelCollection channels = getEcalChannelCollection(databaseConditionsManager);
-
-        // Create the ECal conditions object that will be used to encapsulate
-        // ECal conditions collections
-        final Detector detector = databaseConditionsManager.getDetectorObject();
-        final EcalConditions conditions = new EcalConditions(detector.getSubdetector(databaseConditionsManager
-                .getEcalName()));
-
-        // Set the channel map.
-        conditions.setChannelCollection(channels);
-
-        // Get the ECal gains from the conditions database and add them to the
-        // conditions set
-        final EcalGainCollection gains = getEcalGainCollection(databaseConditionsManager);
-        for (final EcalGain gain : gains) {
-            final ChannelId channelId = new ChannelId(new int[] {gain.getChannelId()});
-            final EcalChannel channel = channels.findChannel(channelId);
-            conditions.getChannelConstants(channel).setGain(gain);
-        }
-
-        final ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> badChannelSeries = getEcalBadChannelSeries(databaseConditionsManager);
-        // FIXME: How to get EcalBadChannelCollection here instead for the collection type?
-        // API of ConditionsSeries and ConditionsSeriesConverter needs to be changed!
-        for (final ConditionsObjectCollection<EcalBadChannel> badChannels : badChannelSeries) {
-            for (final EcalBadChannel badChannel : badChannels) {
-                final ChannelId channelId = new ChannelId(new int[] {badChannel.getChannelId()});
-                final EcalChannel channel = channels.findChannel(channelId);
-                conditions.getChannelConstants(channel).setBadChannel(true);
-            }
-        }
-
-        // Get the ECal calibrations from the conditions database and add them
-        // to the conditions set.
-        final EcalCalibrationCollection calibrations = getEcalCalibrationCollection(databaseConditionsManager);
-        for (final EcalCalibration calibration : calibrations) {
-            final ChannelId channelId = new ChannelId(new int[] {calibration.getChannelId()});
-            final EcalChannel channel = channels.findChannel(channelId);
-            conditions.getChannelConstants(channel).setCalibration(calibration);
-        }
-
-        // Get the ECal time shifts from the conditions database and add them to
-        // the conditions set.
-        if (databaseConditionsManager.hasConditionsRecord("ecal_time_shifts")) {
-            final EcalTimeShiftCollection timeShifts = getEcalTimeShiftCollection(databaseConditionsManager);
-            for (final EcalTimeShift timeShift : timeShifts) {
-                final ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
-                final EcalChannel channel = channels.findChannel(channelId);
-                conditions.getChannelConstants(channel).setTimeShift(timeShift);
-            }
-        } else {
-            DatabaseConditionsManager.getLogger().warning("no ecal_time_shifts collection found");
-        }
-
-        // Return the conditions object to caller.
-        return conditions;
     }
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsUtil.java	Mon Jul  6 12:03:16 2015
@@ -9,18 +9,25 @@
 /**
  * This is a set of utility methods for the ECAL that use the database conditions system.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class EcalConditionsUtil {
 
     /**
      * The combined ECAL conditions object.
      */
-    private EcalConditions conditions;
+    private final EcalConditions conditions;
+
+    /**
+     * Constructor which will find the ECAL conditions from the static conditions manager instance.
+     */
+    public EcalConditionsUtil() {
+        this.conditions = DatabaseConditionsManager.getInstance().getEcalConditions();
+    }
 
     /**
      * Constructor which uses external reference to conditions object.
-     * 
+     *
      * @param conditions the ECAL conditions object
      */
     public EcalConditionsUtil(final EcalConditions conditions) {
@@ -28,15 +35,8 @@
     }
 
     /**
-     * Constructor which will find the ECAL conditions from the static conditions manager instance.
-     */
-    public EcalConditionsUtil() {
-        conditions = DatabaseConditionsManager.getInstance().getEcalConditions();
-    }
-
-    /**
      * Find a channel object from a cell ID, e.g. from a <code>CalorimeterHit</code>.
-     * 
+     *
      * @param helper the identifier helper of the hit
      * @param cellId the cell ID of the hit
      * @return the corresponding ECAL channel found from the physical (geometric) ID information
@@ -55,29 +55,29 @@
         final GeometryId geometryId = new GeometryId(helper, new int[] {system, x, y});
 
         // Find and return the channel object.
-        return conditions.getChannelCollection().findChannel(geometryId);
+        return this.conditions.getChannelCollection().findChannel(geometryId);
     }
 
     /**
      * Get the DAQ crate number from a cell ID.
-     * 
+     *
      * @param helper the identifier helper of the hit
      * @param cellId the cell ID of the hit
      * @return the crate number of the channel
      */
     public int getCrate(final IIdentifierHelper helper, final long cellId) {
-        return findChannel(helper, cellId).getCrate();
+        return this.findChannel(helper, cellId).getCrate();
     }
 
     /**
      * Get the DAQ slot number from a cell ID.
-     * 
+     *
      * @param helper the identifier helper of the hit
      * @param cellId the cell ID of the hit
      * @return the slot number of the channel
      */
     public int getSlot(final IIdentifierHelper helper, final long cellId) {
-        return findChannel(helper, cellId).getSlot();
+        return this.findChannel(helper, cellId).getSlot();
     }
 
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCrystalChannelMap.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCrystalChannelMap.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalCrystalChannelMap.java	Mon Jul  6 12:03:16 2015
@@ -11,19 +11,19 @@
  * This is a convenience utility for associating the geometric crystal objects with the conditions system channel
  * information and vice versa.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 final class EcalCrystalChannelMap {
+
+    /**
+     * Map of channel to crystal.
+     */
+    private final Map<EcalChannel, EcalCrystal> channelMap = new HashMap<EcalChannel, EcalCrystal>();
 
     /**
      * Map of crystal to channel.
      */
     private final Map<EcalCrystal, EcalChannel> crystalMap = new HashMap<EcalCrystal, EcalChannel>();
-
-    /**
-     * Map of channel to crystal.
-     */
-    private final Map<EcalChannel, EcalCrystal> channelMap = new HashMap<EcalChannel, EcalCrystal>();
 
     /**
      * Creates the map between crystals and channels.

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalGain.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalGain.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalGain.java	Mon Jul  6 12:03:16 2015
@@ -5,18 +5,15 @@
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * A per channel ECAL gain value.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
-@Table(names = {"ecal_gains", "test_run_ecal_gains", "ecal_hardware_gains"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
+@Table(names = {"ecal_gains", "test_run_ecal_gains"})
 public final class EcalGain extends BaseConditionsObject {
 
     /**
@@ -26,21 +23,12 @@
     public static final class EcalGainCollection extends BaseConditionsObjectCollection<EcalGain> {
 
         /**
-         * Sort and return a copy of the collection.
-         * 
-         * @return A sorted copy of the collection.
-         */
-        public ConditionsObjectCollection<EcalGain> sorted() {
-            return sorted(new ChannelIdComparator());
-        }
-
-        /**
          * Comparison implementation by channel ID.
          */
         class ChannelIdComparator implements Comparator<EcalGain> {
             /**
              * Compare two objects by their channel ID.
-             * 
+             *
              * @param o1 The first object.
              * @param o2 The second object.
              * @return -1, 0 or 1 if first channel ID is less than, equal to, or greater than second.
@@ -57,6 +45,25 @@
             }
 
         }
+
+        /**
+         * Sort and return a copy of the collection.
+         *
+         * @return A sorted copy of the collection.
+         */
+        public ConditionsObjectCollection<EcalGain> sorted() {
+            return this.sorted(new ChannelIdComparator());
+        }
+    }
+
+    /**
+     * Get the ECal channel ID.
+     *
+     * @return the ECal channel ID
+     */
+    @Field(names = {"ecal_channel_id"})
+    public Integer getChannelId() {
+        return this.getFieldValue("ecal_channel_id");
     }
 
     /**
@@ -66,16 +73,6 @@
      */
     @Field(names = {"gain"})
     public Double getGain() {
-        return getFieldValue("gain");
-    }
-
-    /**
-     * Get the ECal channel ID.
-     *
-     * @return the ECal channel ID
-     */
-    @Field(names = {"ecal_channel_id"})
-    public Integer getChannelId() {
-        return getFieldValue("ecal_channel_id");
+        return this.getFieldValue("gain");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLed.java	Mon Jul  6 12:03:16 2015
@@ -5,18 +5,15 @@
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * A conditions class for representing the setup of the LED system in the ECAL for one channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = "ecal_leds")
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class EcalLed extends BaseConditionsObject {
 
     /**
@@ -24,15 +21,6 @@
      */
     @SuppressWarnings("serial")
     public static class EcalLedCollection extends BaseConditionsObjectCollection<EcalLed> {
-
-        /**
-         * Sort and return a copy of this collection.
-         *
-         * @return the new sorted collection
-         */
-        public ConditionsObjectCollection<EcalLed> sorted() {
-            return sorted(new ChannelIdComparator());
-        }
 
         /**
          * Comparison implementation by channel ID.
@@ -57,6 +45,45 @@
             }
 
         }
+
+        /**
+         * Sort and return a copy of this collection.
+         *
+         * @return the new sorted collection
+         */
+        public ConditionsObjectCollection<EcalLed> sorted() {
+            return this.sorted(new ChannelIdComparator());
+        }
+    }
+
+    /**
+     * Get the amplitude high setting.
+     *
+     * @return the amplitude high setting
+     */
+    @Field(names = {"amplitude_high"})
+    public Double getAmplitudeHigh() {
+        return this.getFieldValue("amplitude_high");
+    }
+
+    /**
+     * Get the amplitude low setting.
+     *
+     * @return the amplitude low setting
+     */
+    @Field(names = {"amplitude_low"})
+    public Double getAmplitudeLow() {
+        return this.getFieldValue("amplitude_low");
+    }
+
+    /**
+     * Get the crate number assigned to this crystal.
+     *
+     * @return the crate number
+     */
+    @Field(names = {"crate"})
+    public Integer getCrateNumber() {
+        return this.getFieldValue("crate");
     }
 
     /**
@@ -66,17 +93,7 @@
      */
     @Field(names = {"ecal_channel_id"})
     public Integer getEcalChannelId() {
-        return getFieldValue("ecal_channel_id");
-    }
-
-    /**
-     * Get the crate number assigned to this crystal.
-     *
-     * @return the crate number
-     */
-    @Field(names = {"crate"})
-    public Integer getCrateNumber() {
-        return getFieldValue("crate");
+        return this.getFieldValue("ecal_channel_id");
     }
 
     /**
@@ -86,7 +103,7 @@
      */
     @Field(names = {"number"})
     public Integer getLedNumber() {
-        return getFieldValue("number");
+        return this.getFieldValue("number");
     }
 
     /**
@@ -96,26 +113,6 @@
      */
     @Field(names = {"time_delay"})
     public Double getTimeDelay() {
-        return getFieldValue("time_delay");
-    }
-
-    /**
-     * Get the amplitude high setting.
-     *
-     * @return the amplitude high setting
-     */
-    @Field(names = {"amplitude_high"})
-    public Double getAmplitudeHigh() {
-        return getFieldValue("amplitude_high");
-    }
-
-    /**
-     * Get the amplitude low setting.
-     *
-     * @return the amplitude low setting
-     */
-    @Field(names = {"amplitude_low"})
-    public Double getAmplitudeLow() {
-        return getFieldValue("amplitude_low");
+        return this.getFieldValue("time_delay");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLedCalibration.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLedCalibration.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalLedCalibration.java	Mon Jul  6 12:03:16 2015
@@ -2,24 +2,20 @@
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * ECAL LED calibration information per channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = "ecal_led_calibrations")
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class EcalLedCalibration extends BaseConditionsObject {
 
     /**
      * Generic collection class for these objects.
      */
-    @SuppressWarnings("serial")
     public static class EcalLedCalibrationCollection extends BaseConditionsObjectCollection<EcalLedCalibration> {
     }
 
@@ -31,7 +27,7 @@
 
     /**
      * Fully qualified constructor.
-     * 
+     *
      * @param channelId the ECAL channel ID (not the LED channel ID)
      * @param ledResponse the mean of the LED response
      * @param rms the RMS of the LED response
@@ -44,31 +40,31 @@
 
     /**
      * Get the ECAL channel ID.
-     * 
+     *
      * @return The ECAL channel ID.
      */
     @Field(names = {"ecal_channel_id"})
     public Integer getEcalChannelId() {
-        return getFieldValue("ecal_channel_id");
+        return this.getFieldValue("ecal_channel_id");
     }
 
     /**
      * Get the average LED response.
-     * 
+     *
      * @return the average LED response
      */
     @Field(names = {"led_response"})
     public Double getLedResponse() {
-        return getFieldValue("led_response");
+        return this.getFieldValue("led_response");
     }
 
     /**
      * Get the RMS of the LED response.
-     * 
+     *
      * @return the RMS of the LED response
      */
     @Field(names = {"rms"})
     public Integer getRms() {
-        return getFieldValue("rms");
+        return this.getFieldValue("rms");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalTimeShift.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalTimeShift.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/EcalTimeShift.java	Mon Jul  6 12:03:16 2015
@@ -5,34 +5,21 @@
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * This class represents a time shift calibration value for an ECAL channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"ecal_time_shifts", "test_run_ecal_time_shifts"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class EcalTimeShift extends BaseConditionsObject {
 
     /**
      * A collection of {@link EcalTimeShift} objects.
      */
-    @SuppressWarnings("serial")
     public static final class EcalTimeShiftCollection extends BaseConditionsObjectCollection<EcalTimeShift> {
-
-        /**
-         * Sort and return a copy of the collection.
-         * 
-         * @return The sorted copy of the collection.
-         */
-        public ConditionsObjectCollection<EcalTimeShift> sorted() {
-            return sorted(new ChannelIdComparator());
-        }
 
         /**
          * Compare two objects by their channel ID.
@@ -40,7 +27,7 @@
         class ChannelIdComparator implements Comparator<EcalTimeShift> {
             /**
              * Compare two objects by channel ID.
-             * 
+             *
              * @param o1 the first object
              * @param o2 the second object
              * @return -1, 0 or 1 if first channel ID is less than, equal to, or greater than second
@@ -56,25 +43,34 @@
                 }
             }
         }
+
+        /**
+         * Sort and return a copy of the collection.
+         *
+         * @return The sorted copy of the collection.
+         */
+        public ConditionsObjectCollection<EcalTimeShift> sorted() {
+            return this.sorted(new ChannelIdComparator());
+        }
     }
 
     /**
      * Get the channel ID.
-     * 
+     *
      * @return the ECAL channel ID
      */
     @Field(names = {"ecal_channel_id"})
     public Integer getChannelId() {
-        return getFieldValue("ecal_channel_id");
+        return this.getFieldValue("ecal_channel_id");
     }
 
     /**
      * Get the time shift in nanoseconds
-     * 
+     *
      * @return the time shift in nanoseconds
      */
     @Field(names = {"time_shift"})
     public Double getTimeShift() {
-        return getFieldValue("time_shift");
+        return this.getFieldValue("time_shift");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java	Mon Jul  6 12:03:16 2015
@@ -13,60 +13,65 @@
  * <p>
  * The default names are overridden to use tables that contain only Test Run data.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public final class TestRunEcalConditionsConverter extends EcalConditionsConverter {
 
     /**
+     * Get the collections of {@link EcalBadChannel} objects for Test Run.
+     *
+     * @param manager the conditions manager
+     * @return the Test Run bad channel collections
+     */
+    @Override
+    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries(
+            final DatabaseConditionsManager manager) {
+        return manager.getConditionsSeries(EcalBadChannelCollection.class, "test_run_ecal_bad_channels");
+    }
+
+    /**
+     * Get the {@link EcalCalibration} collection for Test Run.
+     *
+     * @param manager the conditions manager
+     * @return the Test Run ECAL calibration collection
+     */
+    @Override
+    protected EcalCalibrationCollection getEcalCalibrationCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(EcalCalibrationCollection.class, "test_run_ecal_calibrations")
+                .getCachedData();
+    }
+
+    /**
      * Get the {@link EcalChannel} collection for Test Run.
-     * 
+     *
      * @param manager the conditions manager
      * @return the Test Run ECAL channel collection
      */
-    protected EcalChannelCollection getEcalChannelCollection(DatabaseConditionsManager manager) {
+    @Override
+    protected EcalChannelCollection getEcalChannelCollection(final DatabaseConditionsManager manager) {
         return manager.getCachedConditions(EcalChannelCollection.class, "test_run_ecal_channels").getCachedData();
     }
 
     /**
      * Get the {@link EcalGain} collection for Test Run.
-     * 
+     *
      * @param manager the conditions manager
      * @return the Test Run ECAL gain collection
      */
-    protected EcalGainCollection getEcalGainCollection(DatabaseConditionsManager manager) {
+    @Override
+    protected EcalGainCollection getEcalGainCollection(final DatabaseConditionsManager manager) {
         return manager.getCachedConditions(EcalGainCollection.class, "test_run_ecal_gains").getCachedData();
     }
 
     /**
-     * Get the collections of {@link EcalBadChannel} objects for Test Run.
-     * 
-     * @param manager the conditions manager
-     * @return the Test Run bad channel collections
-     */
-    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries(
-            DatabaseConditionsManager manager) {
-        return manager.getConditionsSeries(EcalBadChannelCollection.class, "test_run_ecal_bad_channels");
-    }
-
-    /**
-     * Get the {@link EcalCalibration} collection for Test Run.
-     * 
-     * @param manager the conditions manager
-     * @return the Test Run ECAL calibration collection
-     */
-    protected EcalCalibrationCollection getEcalCalibrationCollection(DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalCalibrationCollection.class, "test_run_ecal_calibrations")
-                .getCachedData();
-    }
-
-    /**
      * Get the {@link EcalTimeShift} collection for Test Run.
-     * 
+     *
      * @param manager the conditions manager
      * @return the Test Run ECAL time shift collection
      */
-    protected EcalTimeShiftCollection getEcalTimeShiftCollection(DatabaseConditionsManager manager) {
+    @Override
+    protected EcalTimeShiftCollection getEcalTimeShiftCollection(final DatabaseConditionsManager manager) {
         return manager.getCachedConditions(EcalTimeShiftCollection.class, "test_run_ecal_time_shifts").getCachedData();
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/package-info.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/package-info.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/ecal/package-info.java	Mon Jul  6 12:03:16 2015
@@ -18,8 +18,8 @@
  * <p>
  * The energy of a hit is reconstructed by multiplying the gain by the pedestal-subtracted ADC integral (e.g. in Test
  * Run 2012 data).
- * 
- * @author Jeremy McCormick <[log in to unmask]>
+ *
+ * @author Jeremy McCormick, SLAC
  */
 package org.hps.conditions.ecal;
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunRange.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunRange.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunRange.java	Mon Jul  6 12:03:16 2015
@@ -11,24 +11,51 @@
 import org.apache.commons.csv.CSVRecord;
 
 /**
- * Used with the {@link RunSpreadsheet} to find ranges of runs where columns have the same values so they can be assigned
- * a conditions record with a run start and end range.
+ * Used with the {@link RunSpreadsheet} to find ranges of runs where columns have the same values so they can be
+ * assigned a conditions record with a run start and end range.
  * <p>
  * Bad rows such as ones without run numbers or with invalid data values are skipped and not included in a range.
- * 
- * @author Jeremy McCormick
+ *
+ * @author Jeremy McCormick, SLAC
  */
 public final class RunRange {
 
     /**
-     * Find run ranges for conditions data given a set of column names and the full run spreadsheet. 
-     * 
+     * Return <code>true</code> if the values are already in the unique values list.
+     *
+     * @param values the list of field values for a row
+     * @param uniqueValuesList the unique values list
+     * @return <code>true</code> if the values are already in the unique values list
+     */
+    private static boolean contains(final Collection<String> values, final List<Collection<String>> uniqueValuesList) {
+        for (final Collection<String> uniqueValues : uniqueValuesList) {
+            final Iterator<String> valuesIterator = values.iterator();
+            final Iterator<String> uniqueValuesIterator = uniqueValues.iterator();
+            boolean equals = true;
+            while (valuesIterator.hasNext() && uniqueValuesIterator.hasNext()) {
+                final String value = valuesIterator.next();
+                final String uniqueValue = uniqueValuesIterator.next();
+                if (!value.equals(uniqueValue)) {
+                    equals = false;
+                    break;
+                }
+            }
+            if (equals) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Find run ranges for conditions data given a set of column names and the full run spreadsheet.
+     *
      * @param runSheet the run spreadsheet data (from CSV file)
      * @param columnNames the names of the columns
      * @return the list of run ranges
      */
     public static final List<RunRange> findRunRanges(final RunSpreadsheet runSheet, final Set<String> columnNames) {
-        
+
         final List<RunRange> ranges = new ArrayList<RunRange>();
 
         final Iterator<CSVRecord> it = runSheet.getRecords().iterator();
@@ -42,17 +69,17 @@
             // Is the record valid?
             if (isValidRecord(record, columnNames)) {
                 if (range == null) {
-                    // Create new range for the valid row. 
+                    // Create new range for the valid row.
                     range = new RunRange(columnNames);
-                } else {                    
+                } else {
                     // If this record is not in the range then add a new range.
                     if (!range.inRange(record)) {
                         // Add the current range and create a new one.
                         ranges.add(range);
                         range = new RunRange(columnNames);
                     }
-                }                
-                
+                }
+
                 // Update the range from the current record.
                 range.update(record);
             } else {
@@ -66,11 +93,30 @@
 
         return ranges;
     }
-    
-    /**
-     * Return <code>true</code> if the <code>CSVRecord</code> is valid, which means it has a run number and 
-     * data in the columns used by this range.
-     * 
+
+    /**
+     * Get the list of unique values from a set of run ranges.
+     *
+     * @param ranges the run ranges
+     * @return the list of unique values from the field values
+     */
+    public static List<Collection<String>> getUniqueValues(final List<RunRange> ranges) {
+        final Iterator<RunRange> it = ranges.iterator();
+        final List<Collection<String>> uniqueValuesList = new ArrayList<Collection<String>>();
+        while (it.hasNext()) {
+            final RunRange range = it.next();
+            final Collection<String> values = range.getValues();
+            if (!contains(values, uniqueValuesList)) {
+                uniqueValuesList.add(values);
+            }
+        }
+        return uniqueValuesList;
+    }
+
+    /**
+     * Return <code>true</code> if the <code>CSVRecord</code> is valid, which means it has a run number and data in the
+     * columns used by this range.
+     *
      * @param record the <code>CSVRecord</code> to check
      * @param columnNames the names of the columns
      * @return <code>true</code> if record is valid
@@ -85,7 +131,8 @@
         }
         for (final String columnName : columnNames) {
             // Check that required column data is not null, blank, or empty string.
-            if (record.get(columnName) == null || "".equals(record.get(columnName)) || record.get(columnName).length() == 0) {                
+            if (record.get(columnName) == null || "".equals(record.get(columnName))
+                    || record.get(columnName).length() == 0) {
                 return false;
             }
         }
@@ -110,11 +157,11 @@
     /**
      * The mapping of column names to values.
      */
-    private Map<String, String> values = new LinkedHashMap<String, String>();
+    private final Map<String, String> values = new LinkedHashMap<String, String>();
 
     /**
      * Create a new range.
-     * 
+     *
      * @param columnNames the names of the columns
      */
     RunRange(final Set<String> columnNames) {
@@ -125,59 +172,59 @@
     }
 
     /**
+     * Get the names of the columns used by this range.
+     *
+     * @return the names of the columns
+     */
+    public Set<String> getColumnNames() {
+        return this.columnNames;
+    }
+
+    /**
      * Get the last run number in the range.
-     * 
+     *
      * @return the last run number in the range
      */
     public int getRunEnd() {
-        return runEnd;
+        return this.runEnd;
     }
 
     /**
      * Get the first run number in the range.
-     * 
+     *
      * @return the first run number in the range
      */
     public int getRunStart() {
-        return runStart;
-    }
-    
+        return this.runStart;
+    }
+
     /**
      * Get get value of a field by column name.
-     * 
+     *
      * @param columnName the column name
      * @return the value of the field
      */
-    public String getValue(String columnName) {
+    public String getValue(final String columnName) {
         return this.values.get(columnName);
     }
-    
+
     /**
      * Get the raw values of the data.
-     * 
+     *
      * @return the raw data values
      */
     public Collection<String> getValues() {
         return this.values.values();
     }
-    
-    /**
-     * Get the names of the columns used by this range.
-     * 
-     * @return the names of the columns
-     */
-    public Set<String> getColumnNames() {
-        return this.columnNames;
-    }
-
-    /**
-     * Return <code>true</code> if the record is in the range, e.g. its data values are the same.    
-     * 
+
+    /**
+     * Return <code>true</code> if the record is in the range, e.g. its data values are the same.
+     *
      * @param record the <code>CSVRecord</code> containing the run data
      * @return <code>true</code> if the the record is in range
      */
     private boolean inRange(final CSVRecord record) {
-        for (final String columnName : columnNames) {
+        for (final String columnName : this.columnNames) {
             if (!record.get(columnName).equals(this.values.get(columnName))) {
                 return false;
             }
@@ -186,85 +233,41 @@
     }
 
     /**
-     * Update the range from a record.     
-     * @param record the <code>CSVRecord</code> with the run's data
-     */
-    private void update(final CSVRecord record) {                
-        final int run = Integer.parseInt(record.get("run"));
-        if (run < runStart) {
-            this.runStart = run;
-        }
-        if (run > runEnd) {
-            this.runEnd = run;
-        }
-        if (values.size() == 0) {
-            for (final String columnName : columnNames) {
-                this.values.put(columnName, record.get(columnName));
-            }
-        }
-    }
-    
-    /**
      * Convert this object to a string.
-     * 
+     *
      * @return this object converted to a string
      */
+    @Override
     public String toString() {
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         sb.append("RunRange { ");
         sb.append("runStart: " + this.runStart + ", ");
         sb.append("runEnd: " + this.runEnd + ", ");
-        for (String columnName : columnNames) {
-            sb.append(columnName + ": " + values.get(columnName) + ", " );
+        for (final String columnName : this.columnNames) {
+            sb.append(columnName + ": " + this.values.get(columnName) + ", ");
         }
         sb.setLength(sb.length() - 2);
         sb.append(" }");
         return sb.toString();
     }
-    
-    /**
-     * Get the list of unique values from a set of run ranges.
+
+    /**
+     * Update the range from a record.
      * 
-     * @param ranges the run ranges
-     * @return the list of unique values from the field values
-     */
-    public static List<Collection<String>> getUniqueValues(List<RunRange> ranges) {
-        Iterator<RunRange> it = ranges.iterator();        
-        List<Collection<String>> uniqueValuesList = new ArrayList<Collection<String>>();
-        while(it.hasNext()) {        
-            RunRange range = it.next();
-            Collection<String> values = range.getValues();
-            if (!contains(values, uniqueValuesList)) {
-                uniqueValuesList.add(values);
-            }           
-        }
-        return uniqueValuesList;
-    }
-    
-    /**
-     * Return <code>true</code> if the values are already in the unique values list.
-     * 
-     * @param values the list of field values for a row
-     * @param uniqueValuesList the unique values list
-     * @return <code>true</code> if the values are already in the unique values list
-     */
-    private static boolean contains(Collection<String> values, List<Collection<String>> uniqueValuesList) {
-        for (Collection<String> uniqueValues : uniqueValuesList) {
-            Iterator<String> valuesIterator = values.iterator();
-            Iterator<String> uniqueValuesIterator = uniqueValues.iterator();
-            boolean equals = true;
-            while (valuesIterator.hasNext() && uniqueValuesIterator.hasNext()) {
-                String value = valuesIterator.next(); 
-                String uniqueValue = uniqueValuesIterator.next();
-                if (!value.equals(uniqueValue)) {
-                    equals = false;
-                    break;
-                }
-            }
-            if (equals) {
-                return true;
-            }
-        }
-        return false;
+     * @param record the <code>CSVRecord</code> with the run's data
+     */
+    private void update(final CSVRecord record) {
+        final int run = Integer.parseInt(record.get("run"));
+        if (run < this.runStart) {
+            this.runStart = run;
+        }
+        if (run > this.runEnd) {
+            this.runEnd = run;
+        }
+        if (this.values.size() == 0) {
+            for (final String columnName : this.columnNames) {
+                this.values.put(columnName, record.get(columnName));
+            }
+        }
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java	Mon Jul  6 12:03:16 2015
@@ -16,25 +16,95 @@
 import org.apache.commons.csv.CSVRecord;
 
 /**
- * A simple representation of the 2015 run spreadsheet (runs from 3/28 to 5/19) read from an exported CSV file as a list of records.
+ * A simple representation of the 2015 run spreadsheet (runs from 3/28 to 5/19) read from an exported CSV file as a list
+ * of records.
  * <p>
- * Master copy of the spreadsheet is located at 
- * <a href="https://docs.google.com/spreadsheets/d/1l1NurPpsmpgZKgr1qoQpLQBBLz1sszLz4xZF-So4xs8/edit#gid=43855609">HPS_Runs_2015</a>.
+ * Master copy of the spreadsheet is located at <a
+ * href="https://docs.google.com/spreadsheets/d/1l1NurPpsmpgZKgr1qoQpLQBBLz1sszLz4xZF-So4xs8/edit#gid=43855609"
+ * >HPS_Runs_2015</a>.
  * <p>
- * The rows are accessible as raw CSV data through the Apache Commons CSV library, and this data must be manually cleaned up and converted 
- * to the correct data type before being inserted into the conditions database.
+ * The rows are accessible as raw CSV data through the Apache Commons CSV library, and this data must be manually
+ * cleaned up and converted to the correct data type before being inserted into the conditions database.
  *
- * @author Jeremy McCormick
+ * @author Jeremy McCormick, SLAC
  */
 public final class RunSpreadsheet {
 
+    public static class RunData {
+
+        private Date endDate;
+        private final CSVRecord record;
+        private final int run;
+        private Date startDate;
+
+        RunData(final CSVRecord record) throws NumberFormatException {
+            this.record = record;
+            this.run = parseRunNumber(this.record);
+            try {
+                this.startDate = RunSpreadsheet.parseStartDate(this.record);
+            } catch (final ParseException e) {
+            }
+            try {
+                this.endDate = RunSpreadsheet.parseEndDate(this.record);
+            } catch (final ParseException e) {
+            }
+        }
+
+        public Date getEndDate() {
+            return this.endDate;
+        }
+
+        public CSVRecord getRecord() {
+            return this.record;
+        }
+
+        public int getRun() {
+            return this.run;
+        }
+
+        public Date getStartDate() {
+            return this.startDate;
+        }
+
+        @Override
+        public String toString() {
+            return "RunData { run: " + this.run + ", startDate: " + this.startDate + ", endDate: " + this.endDate
+                    + " }";
+        }
+    }
+
+    @SuppressWarnings("serial")
+    public static class RunMap extends LinkedHashMap<Integer, RunData> {
+        public RunMap() {
+            super();
+        }
+
+        public RunMap(final List<CSVRecord> records) {
+            super();
+            for (final CSVRecord record : records) {
+                try {
+                    this.addRunData(new RunData(record));
+                } catch (final NumberFormatException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        private void addRunData(final RunData runData) {
+            this.put(runData.getRun(), runData);
+        }
+    }
+
+    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy H:mm");
+
     /**
      * The column headers.
      */
-    private static String[] HEADERS = {"run", "date", "start_time", "end_time", "to_tape", "n_events", "trigger_rate", "target", "beam_current",
-        "beam_x", "beam_y", "trigger_config", "ecal_fadc_mode", "ecal_fadc_thresh", "ecal_fadc_window", "ecal_cluster_thresh_seed", "ecal_cluster_thresh_cluster",
-        "ecal_cluster_window_hits", "ecal_cluster_window_pairs", "ecal_scalers_fadc", "ecal_scalers_dsc", "svt_y_position", "svt_offset_phase", "svt_offset_time",
-        "ecal_temp", "ecal_lv_current", "notes"};
+    private static String[] HEADERS = {"run", "date", "start_time", "end_time", "to_tape", "n_events", "trigger_rate",
+            "target", "beam_current", "beam_x", "beam_y", "trigger_config", "ecal_fadc_mode", "ecal_fadc_thresh",
+            "ecal_fadc_window", "ecal_cluster_thresh_seed", "ecal_cluster_thresh_cluster", "ecal_cluster_window_hits",
+            "ecal_cluster_window_pairs", "ecal_scalers_fadc", "ecal_scalers_dsc", "svt_y_position", "svt_offset_phase",
+            "svt_offset_time", "ecal_temp", "ecal_lv_current", "notes"};
 
     /**
      * Read the CSV file from the command line and print the data to the terminal (just a basic test).
@@ -49,10 +119,22 @@
                 System.out.print("end date: " + parseEndDate(record) + ", ");
                 System.out.print(record);
                 System.out.println();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
             }
         }
+    }
+
+    private static Date parseEndDate(final CSVRecord record) throws ParseException {
+        return DATE_FORMAT.parse(record.get("date") + " " + record.get("end_time"));
+    }
+
+    private static int parseRunNumber(final CSVRecord record) throws NumberFormatException {
+        return Integer.parseInt(record.get("run"));
+    }
+
+    private static Date parseStartDate(final CSVRecord record) throws ParseException {
+        return DATE_FORMAT.parse(record.get("date") + " " + record.get("start_time"));
     }
 
     /**
@@ -86,7 +168,7 @@
      * @return the <code>CSVRecord</code> or <code>null</code> if not found
      */
     public CSVRecord findRun(final int run) {
-        for (final CSVRecord record : records) {
+        for (final CSVRecord record : this.records) {
             try {
                 if (run == Integer.parseInt(record.get("run"))) {
                     return record;
@@ -112,12 +194,12 @@
 
         final CSVParser parser = new CSVParser(reader, format);
 
-        records = parser.getRecords();
+        this.records = parser.getRecords();
 
         // Remove first three rows of headers.
-        records.remove(0);
-        records.remove(0);
-        records.remove(0);
+        this.records.remove(0);
+        this.records.remove(0);
+        this.records.remove(0);
 
         parser.close();
     }
@@ -128,109 +210,34 @@
      * @return the list of records read from the CSV file
      */
     public List<CSVRecord> getRecords() {
-        return records;
-    }
-    
-    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy H:mm"); 
-    
-    private static Date parseStartDate(CSVRecord record) throws ParseException {
-        return DATE_FORMAT.parse(record.get("date") + " " + record.get("start_time"));
-    }
-    
-    private static Date parseEndDate(CSVRecord record) throws ParseException {
-        return DATE_FORMAT.parse(record.get("date") + " " + record.get("end_time"));
-    }
-    
-    private static int parseRunNumber(CSVRecord record) throws NumberFormatException {
-        return Integer.parseInt(record.get("run"));
-    }
-    
-    public static class RunData {
-        
-        private int run;
-        private Date startDate;
-        private Date endDate;
-        private CSVRecord record;
-        
-        RunData(CSVRecord record) throws NumberFormatException {
-            this.record = record;
-            run = parseRunNumber(this.record);
-            try {
-                startDate = RunSpreadsheet.parseStartDate(this.record);
-            } catch (ParseException e) {                
-            }
-            try {
-                endDate = RunSpreadsheet.parseEndDate(this.record);
-            } catch (ParseException e) {                
-            }
-        }
-        
-        public int getRun() {
-            return run;
-        }
-        
-        public Date getStartDate() {
-            return startDate;
-        }
-        
-        public Date getEndDate() {
-            return endDate;
-        }      
-        
-        public String toString() {
-            return "RunData { run: " + run + ", startDate: " + startDate + ", endDate: " + endDate + " }";
-        }
-        
-        public CSVRecord getRecord() {
-            return record;
-        }
-    }
-    
-    @SuppressWarnings("serial")
-    public static class RunMap extends LinkedHashMap<Integer, RunData> {
-        public RunMap() {
-            super();
-        }
-        public RunMap(List<CSVRecord> records) {
-            super();
-            for (final CSVRecord record : records) {
-                try {
-                    addRunData(new RunData(record));
-                } catch (NumberFormatException e) {
-                    e.printStackTrace();
+        return this.records;
+    }
+
+    public RunMap getRunMap() {
+        return new RunMap(this.getRecords());
+    }
+
+    public RunMap getRunMap(final List<RunRange> ranges) {
+        final List<CSVRecord> records = new ArrayList<CSVRecord>();
+        for (final RunRange range : ranges) {
+            System.out.println(range.toString());
+            if (range.getColumnNames().contains("run")) {
+                if (!range.getValue("run").isEmpty()) {
+                    final CSVRecord record = this.findRun(Integer.parseInt(range.getValue("run")));
+                    if (record != null) {
+                        records.add(record);
+                    } else {
+                        throw new RuntimeException("this RunRange object was not found. This shouldn't happen. "
+                                + range.toString());
+                    }
+                } else {
+                    throw new RuntimeException("this RunRange object has an empty run value ");
                 }
-            }
-        }
-        private void addRunData(RunData runData) {
-            this.put(runData.getRun(), runData);
-        }
-    }
-    
-    public RunMap getRunMap() {
-        return new RunMap(getRecords());
-    } 
-
-    public RunMap getRunMap(List<RunRange> ranges) {
-        List<CSVRecord> records = new ArrayList<CSVRecord>();
-        for(RunRange range : ranges) {
-           System.out.println(range.toString());
-           if(range.getColumnNames().contains("run")) {
-               if(!range.getValue("run").isEmpty()) {
-                   CSVRecord record = findRun(Integer.parseInt(range.getValue("run")));
-                   if(record!=null) {
-                       records.add(record);
-                   } else {
-                       throw new RuntimeException("this RunRange object was not found. This shouldn't happen. " + range.toString());
-                   }
-               } else {
-                   throw new RuntimeException("this RunRange object has an empty run value ");
-               }
-           } else {
-               throw new RuntimeException("this RunRange object has no run column? " + range.toString());
-           }
+            } else {
+                throw new RuntimeException("this RunRange object has no run column? " + range.toString());
+            }
         }
         return new RunMap(records);
-    } 
-
-    
+    }
+
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtChannel.java	Mon Jul  6 12:03:16 2015
@@ -13,15 +13,10 @@
 /**
  * This abstract class provides basic setup information for an SVT sensor channel.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public abstract class AbstractSvtChannel extends BaseConditionsObject {
-
-    /**
-     * Default number of samples to read out.
-     */
-    // TODO: Put constants into their own class.
-    public static final int MAX_NUMBER_OF_SAMPLES = 6;
 
     /**
      * Collection implementation for {@link AbstractSvtChannel}.
@@ -57,6 +52,15 @@
         }
 
         /**
+         * Find the collection of channels of type extending {@link AbstractSvtChannel} that match a DAQ pair (FEB ID
+         * and FEB Hybrid ID).
+         *
+         * @param pair the DAQ pair
+         * @return the channels matching the DAQ pair or null if not found
+         */
+        public abstract Collection<T> find(final Pair<Integer, Integer> pair);
+
+        /**
          * Find a channel of type extending {@link AbstractSvtChannel} using the channel ID.
          *
          * @param channelID the channel ID
@@ -65,15 +69,6 @@
         public final T findChannel(final int channelID) {
             return this.channelMap.get(channelID);
         }
-
-        /**
-         * Find the collection of channels of type extending {@link AbstractSvtChannel} that match a DAQ pair (FEB ID
-         * and FEB Hybrid ID).
-         *
-         * @param pair the DAQ pair
-         * @return the channels matching the DAQ pair or null if not found
-         */
-        public abstract Collection<T> find(final Pair<Integer, Integer> pair);
 
         /**
          * Convert this object to a human readable string.
@@ -91,14 +86,10 @@
     }
 
     /**
-     * Get the channel ID.
-     *
-     * @return the SVT channel ID
+     * Default number of samples to read out.
      */
-    @Field(names = {"channel_id"})
-    public final Integer getChannelID() {
-        return getFieldValue("channel_id");
-    }
+    // TODO: Put constants into their own class.
+    public static final int MAX_NUMBER_OF_SAMPLES = 6;
 
     /**
      * Get the channel number (0-639). This is different from the ID.
@@ -107,7 +98,26 @@
      */
     @Field(names = {"channel"})
     public final Integer getChannel() {
-        return getFieldValue("channel");
+        return this.getFieldValue("channel");
+    }
+
+    /**
+     * Get the channel ID.
+     *
+     * @return the SVT channel ID
+     */
+    @Field(names = {"channel_id"})
+    public final Integer getChannelID() {
+        return this.getFieldValue("channel_id");
+    }
+
+    /**
+     * Set the channel number (0-639). This is different from the ID.
+     *
+     * @param channel the channel number
+     */
+    public final void setChannel(final int channel) {
+        this.setFieldValue("channel", channel);
     }
 
     /**
@@ -118,13 +128,4 @@
     public final void setChannelID(final int channelID) {
         this.setFieldValue("channel_id", channelID);
     }
-
-    /**
-     * Set the channel number (0-639). This is different from the ID.
-     *
-     * @param channel the channel number
-     */
-    public final void setChannel(final int channel) {
-        this.setFieldValue("channel", channel);
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditions.java	Mon Jul  6 12:03:16 2015
@@ -10,20 +10,14 @@
 /**
  * Abstract class providing some of the common functionality used to define an SVT conditions object.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public abstract class AbstractSvtConditions {
 
     /**
      * A map between the channel object and its conditions constants.
      */
-    private Map<AbstractSvtChannel, ChannelConstants> channelData = new HashMap<AbstractSvtChannel, ChannelConstants>();
-
-    /**
-     * The time shift collection.
-     */
-    // FIXME: Should be private with accessor methods.
-    protected AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> t0Shifts = null;
+    private final Map<AbstractSvtChannel, ChannelConstants> channelData = new HashMap<AbstractSvtChannel, ChannelConstants>();
 
     /**
      * The channel map.
@@ -38,11 +32,10 @@
     protected AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap = null;
 
     /**
-     * Get the DAQ map associated with these conditions.
-     *
-     * @return The SVT DAQ map.
+     * The time shift collection.
      */
-    public abstract AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> getDaqMap();
+    // FIXME: Should be private with accessor methods.
+    protected AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> t0Shifts = null;
 
     /**
      * Get the conditions constants for a specific channel. These will be created if they do not exist for the given
@@ -54,15 +47,15 @@
      */
     public final ChannelConstants getChannelConstants(final AbstractSvtChannel channel) {
         // This channel must come from the map.
-        if (!channelMap.contains(channel)) {
+        if (!this.channelMap.contains(channel)) {
             System.err.println("[ " + this.getClass().getSimpleName() + " ]: Channel not found in map => " + channel);
             throw new IllegalArgumentException("Channel was not found in map.");
         }
         // If channel has no data yet, then add it.
-        if (!channelData.containsKey(channel)) {
-            channelData.put(channel, new ChannelConstants());
+        if (!this.channelData.containsKey(channel)) {
+            this.channelData.put(channel, new ChannelConstants());
         }
-        return channelData.get(channel);
+        return this.channelData.get(channel);
     }
 
     /**
@@ -73,11 +66,27 @@
     public abstract AbstractSvtChannelCollection<? extends AbstractSvtChannel> getChannelMap();
 
     /**
+     * Get the DAQ map associated with these conditions.
+     *
+     * @return The SVT DAQ map.
+     */
+    public abstract AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> getDaqMap();
+
+    /**
      * Get the t0 shifts for this conditions set.
      *
      * @return the t0 shifts by sensor
      */
     public abstract AbstractSvtT0ShiftCollection<? extends AbstractSvtT0Shift> getT0Shifts();
+
+    /**
+     * Set the SVT channel map for this conditions set.
+     *
+     * @param channelMap the SVT channel map for this conditions set
+     */
+    public final void setChannelMap(final AbstractSvtChannelCollection<? extends AbstractSvtChannel> channelMap) {
+        this.channelMap = channelMap;
+    }
 
     /**
      * Set the DAQ map for this conditions set.
@@ -89,15 +98,6 @@
     }
 
     /**
-     * Set the SVT channel map for this conditions set.
-     *
-     * @param channelMap the SVT channel map for this conditions set
-     */
-    public final void setChannelMap(final AbstractSvtChannelCollection<? extends AbstractSvtChannel> channelMap) {
-        this.channelMap = channelMap;
-    }
-
-    /**
      * Set the sensor t0 shifts for this conditions set.
      *
      * @param t0Shifts for this conditions set

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtConditionsConverter.java	Mon Jul  6 12:03:16 2015
@@ -16,10 +16,15 @@
 /**
  * Abstract class providing some of the common methods used in creating SVT conditions objects from the database.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  * @param <T> SVT conditions object type
  */
 public abstract class AbstractSvtConditionsConverter<T extends AbstractSvtConditions> implements ConditionsConverter<T> {
+
+    /**
+     * Initialize logging.
+     */
+    static Logger logger = LogUtil.create(AbstractSvtConditionsConverter.class);
 
     /**
      * The combined detector conditions object.
@@ -28,19 +33,58 @@
     protected T conditions;
 
     /**
-     * Initialize logging.
-     */
-    static Logger logger = LogUtil.create(AbstractSvtConditionsConverter.class);
-
-    /**
-     * Get the default {@link SvtShapeFitParametersCollection} collection from the manager.
+     * Create and return the SVT conditions object.
      *
      * @param manager the current conditions manager
-     * @return the default {@link SvtShapeFitParametersCollection}
+     * @param name the conditions key, which is ignored for now
+     * @return the SVT conditions object
      */
-    protected SvtShapeFitParametersCollection getSvtShapeFitParametersCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(SvtShapeFitParametersCollection.class, "svt_shape_fit_parameters")
-                .getCachedData();
+    @Override
+    public T getData(final ConditionsManager manager, final String name) {
+
+        final DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
+
+        // Get the SVT calibrations (baseline, noise) from the conditions database
+        final SvtCalibrationCollection calibrations = this.getSvtCalibrationCollection(dbConditionsManager);
+        for (final SvtCalibration calibration : calibrations) {
+            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(calibration.getChannelID());
+            this.conditions.getChannelConstants(channel).setCalibration(calibration);
+        }
+
+        // Get the Channel pulse fit parameters from the conditions database
+        final SvtShapeFitParametersCollection shapeFitParametersCollection = this
+                .getSvtShapeFitParametersCollection(dbConditionsManager);
+        for (final SvtShapeFitParameters shapeFitParameters : shapeFitParametersCollection) {
+            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(
+                    shapeFitParameters.getChannelID());
+            this.conditions.getChannelConstants(channel).setShapeFitParameters(shapeFitParameters);
+        }
+
+        // Get the bad channels from the conditions database.
+        // If there aren't any bad channels, notify the user and move on.
+        try {
+            final ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> badChannelSeries = this
+                    .getSvtBadChannelSeries(dbConditionsManager);
+            for (final ConditionsObjectCollection<SvtBadChannel> badChannelCollection : badChannelSeries) {
+                for (final SvtBadChannel badChannel : badChannelCollection) {
+                    final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(
+                            badChannel.getChannelId());
+                    this.conditions.getChannelConstants(channel).setBadChannel(true);
+                }
+            }
+        } catch (final RuntimeException e) {
+            logger.warning("A set of SVT bad channels was not found.");
+        }
+
+        // Get the gains and offsets from the conditions database
+        final SvtGainCollection channelGains = this.getSvtGainCollection(dbConditionsManager);
+        for (final SvtGain channelGain : channelGains) {
+            final int channelId = channelGain.getChannelID();
+            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(channelId);
+            this.conditions.getChannelConstants(channel).setGain(channelGain);
+        }
+
+        return this.conditions;
     }
 
     /**
@@ -85,55 +129,13 @@
     }
 
     /**
-     * Create and return the SVT conditions object.
+     * Get the default {@link SvtShapeFitParametersCollection} collection from the manager.
      *
      * @param manager the current conditions manager
-     * @param name the conditions key, which is ignored for now
-     * @return the SVT conditions object
+     * @return the default {@link SvtShapeFitParametersCollection}
      */
-    @Override
-    public T getData(final ConditionsManager manager, final String name) {
-
-        final DatabaseConditionsManager dbConditionsManager = (DatabaseConditionsManager) manager;
-
-        // Get the SVT calibrations (baseline, noise) from the conditions database
-        final SvtCalibrationCollection calibrations = getSvtCalibrationCollection(dbConditionsManager);
-        for (final SvtCalibration calibration : calibrations) {
-            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(calibration.getChannelID());
-            this.conditions.getChannelConstants(channel).setCalibration(calibration);
-        }
-
-        // Get the Channel pulse fit parameters from the conditions database
-        final SvtShapeFitParametersCollection shapeFitParametersCollection = getSvtShapeFitParametersCollection(dbConditionsManager);
-        for (final SvtShapeFitParameters shapeFitParameters : shapeFitParametersCollection) {
-            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(
-                    shapeFitParameters.getChannelID());
-            this.conditions.getChannelConstants(channel).setShapeFitParameters(shapeFitParameters);
-        }
-
-        // Get the bad channels from the conditions database.
-        // If there aren't any bad channels, notify the user and move on.
-        try {
-            final ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> badChannelSeries = getSvtBadChannelSeries(dbConditionsManager);
-            for (final ConditionsObjectCollection<SvtBadChannel> badChannelCollection : badChannelSeries) {
-                for (final SvtBadChannel badChannel : badChannelCollection) {
-                    final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(
-                            badChannel.getChannelId());
-                    this.conditions.getChannelConstants(channel).setBadChannel(true);
-                }
-            }
-        } catch (final RuntimeException e) {
-            logger.warning("A set of SVT bad channels was not found.");
-        }
-
-        // Get the gains and offsets from the conditions database
-        final SvtGainCollection channelGains = getSvtGainCollection(dbConditionsManager);
-        for (final SvtGain channelGain : channelGains) {
-            final int channelId = channelGain.getChannelID();
-            final AbstractSvtChannel channel = this.conditions.getChannelMap().findChannel(channelId);
-            this.conditions.getChannelConstants(channel).setGain(channelGain);
-        }
-
-        return this.conditions;
+    protected SvtShapeFitParametersCollection getSvtShapeFitParametersCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(SvtShapeFitParametersCollection.class, "svt_shape_fit_parameters")
+                .getCachedData();
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java	Mon Jul  6 12:03:16 2015
@@ -9,7 +9,7 @@
 /**
  * This abstract class provides some of the basic functionality used to access SVT DAQ map variables.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public abstract class AbstractSvtDaqMapping extends BaseConditionsObject {
 
@@ -68,7 +68,7 @@
      */
     @Field(names = {"layer"})
     public final int getLayerNumber() {
-        return getFieldValue("layer");
+        return this.getFieldValue("layer");
     }
 
     /**
@@ -80,7 +80,7 @@
      */
     @Field(names = {"orientation"})
     public final String getOrientation() {
-        return getFieldValue("orientation");
+        return this.getFieldValue("orientation");
     }
 
     /**
@@ -90,7 +90,7 @@
      */
     @Field(names = {"svt_half"})
     public final String getSvtHalf() {
-        return getFieldValue("svt_half");
+        return this.getFieldValue("svt_half");
     }
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtT0Shift.java	Mon Jul  6 12:03:16 2015
@@ -8,14 +8,14 @@
 /**
  * Abstract class providing some of the basic functionality used to relate a t0 shift value with either a FEB ID/FEB
  * hybrid ID or an FPGA ID/hybrid ID.
- * 
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ *
+ * @author Omar Moreno, UCSC
  */
 public abstract class AbstractSvtT0Shift extends BaseConditionsObject {
 
     /**
      * The collection implementation for this class.
-     * 
+     *
      * @param <T> the type of the object in this collection which extends {@link AbstractSvtT0Shift}
      */
     @SuppressWarnings("serial")
@@ -38,6 +38,6 @@
      */
     @Field(names = {"t0_shift"})
     public final Double getT0Shift() {
-        return getFieldValue("t0_shift");
+        return this.getFieldValue("t0_shift");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/CalibrationHandler.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/CalibrationHandler.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/CalibrationHandler.java	Mon Jul  6 12:03:16 2015
@@ -16,7 +16,7 @@
 /**
  * Handler for calibration events.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 class CalibrationHandler extends DefaultHandler {
 
@@ -27,9 +27,14 @@
             Level.INFO);
 
     /**
-     * List of SVT channels.
+     * Baseline sample ID (0-5).
      */
-    private final SvtChannelCollection svtChannels;
+    private int baselineSampleID = 0;
+
+    /**
+     * An SVT calibration object encapsulating the baseline and noise values for a channel.
+     */
+    private SvtCalibration calibration = null;
 
     /**
      * List of SVT calibrations.
@@ -37,9 +42,9 @@
     private final SvtCalibrationCollection calibrations = new SvtCalibrationCollection();
 
     /**
-     * An SVT calibration object encapsulating the baseline and noise values for a channel.
+     * Channel number (0-639).
      */
-    private SvtCalibration calibration = null;
+    private int channel = 0;
 
     /**
      * The string content from parsing an XML calibration.
@@ -57,14 +62,10 @@
     private int hybridID = 0;
 
     /**
-     * Channel number (0-639).
+     * Flag denoting whether the calibrations of a given channel should be loaded into the conditions DB. If a channel
+     * is found to be missing baseline or noise values, is will be marked invalid.
      */
-    private int channel = 0;
-
-    /**
-     * Baseline sample ID (0-5).
-     */
-    private int baselineSampleID = 0;
+    private boolean isValidChannel = false;
 
     /**
      * Noise sample ID (0-5).
@@ -73,10 +74,9 @@
     private int noiseSampleID = 0;
 
     /**
-     * Flag denoting whether the calibrations of a given channel should be loaded into the conditions DB. If a channel
-     * is found to be missing baseline or noise values, is will be marked invalid.
+     * List of SVT channels.
      */
-    private boolean isValidChannel = false;
+    private final SvtChannelCollection svtChannels;
 
     /**
      * Default constructor.
@@ -84,6 +84,62 @@
     public CalibrationHandler() {
         this.svtChannels = DatabaseConditionsManager.getInstance()
                 .getCachedConditions(SvtChannelCollection.class, "svt_channels").getCachedData();
+    }
+
+    /**
+     * Method called to extract character data inside of an element.
+     *
+     * @param ch the characters
+     * @param start the start position in the character array
+     * @param length the number of characters to use from the character array
+     * @throws SAXException if there is an error processing the element (possibly wraps another exception type)
+     */
+    @Override
+    public void characters(final char[] ch, final int start, final int length) throws SAXException {
+        this.content = String.copyValueOf(ch, start, length).trim();
+    }
+
+    /**
+     * Method that is triggered when the end of a tag is encountered.
+     *
+     * @param uri the Namespace URI
+     * @param locaName the local name (without prefix)
+     * @param qName the qualified name (with prefix)
+     * @throws SAXException if there is an error processing the element
+     */
+    @Override
+    public void endElement(final String uri, final String localName, final String qName) throws SAXException {
+
+        switch (qName) {
+            case "channel":
+                if (this.isValidChannel) {
+                    try {
+                        this.calibrations.add(this.calibration);
+                    } catch (final ConditionsObjectException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+                break;
+            case "baseline":
+                this.calibration.setPedestal(this.baselineSampleID, Double.parseDouble(this.content));
+                this.isValidChannel = true;
+                break;
+            case "noise":
+                this.calibration.setNoise(this.baselineSampleID, Double.parseDouble(this.content));
+                this.isValidChannel = true;
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * Get the {@link SvtCalibrationCollection} created from parsing the XML input file.
+     *
+     * @return the {@link SvtCalibrationCollection} created from parsing the XML
+     */
+    public SvtCalibrationCollection getCalibrations() {
+        return this.calibrations;
     }
 
     /**
@@ -123,60 +179,4 @@
                 break;
         }
     }
-
-    /**
-     * Method that is triggered when the end of a tag is encountered.
-     *
-     * @param uri the Namespace URI
-     * @param locaName the local name (without prefix)
-     * @param qName the qualified name (with prefix)
-     * @throws SAXException if there is an error processing the element
-     */
-    @Override
-    public void endElement(final String uri, final String localName, final String qName) throws SAXException {
-
-        switch (qName) {
-            case "channel":
-                if (this.isValidChannel) {
-                    try {
-                        this.calibrations.add(this.calibration);
-                    } catch (final ConditionsObjectException e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-                break;
-            case "baseline":
-                this.calibration.setPedestal(this.baselineSampleID, Double.parseDouble(this.content));
-                this.isValidChannel = true;
-                break;
-            case "noise":
-                this.calibration.setNoise(this.baselineSampleID, Double.parseDouble(this.content));
-                this.isValidChannel = true;
-                break;
-            default:
-                break;
-        }
-    }
-
-    /**
-     * Method called to extract character data inside of an element.
-     *
-     * @param ch the characters
-     * @param start the start position in the character array
-     * @param length the number of characters to use from the character array
-     * @throws SAXException if there is an error processing the element (possibly wraps another exception type)
-     */
-    @Override
-    public void characters(final char[] ch, final int start, final int length) throws SAXException {
-        this.content = String.copyValueOf(ch, start, length).trim();
-    }
-
-    /**
-     * Get the {@link SvtCalibrationCollection} created from parsing the XML input file.
-     *
-     * @return the {@link SvtCalibrationCollection} created from parsing the XML
-     */
-    public SvtCalibrationCollection getCalibrations() {
-        return this.calibrations;
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/ChannelConstants.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/ChannelConstants.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/ChannelConstants.java	Mon Jul  6 12:03:16 2015
@@ -3,10 +3,15 @@
 /**
  * This class represents the combined conditions for a single SVT channel.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Omar Moreno, UCSC
+ * @author Jeremy McCormick, SLAC
  */
 public final class ChannelConstants {
+
+    /**
+     * Flag to indicate the channel is bad and should not be used for reconstruction.
+     */
+    private boolean badChannel = false;
 
     /**
      * The pedestal and noise for the channel.
@@ -24,14 +29,72 @@
     private SvtShapeFitParameters shapeFitParameters = null;
 
     /**
-     * Flag to indicate the channel is bad and should not be used for reconstruction.
-     */
-    private boolean badChannel = false;
-
-    /**
      * Class constructor.
      */
     ChannelConstants() {
+    }
+
+    /**
+     * Get the calibration.
+     *
+     * @return the calibration object
+     */
+    public SvtCalibration getCalibration() {
+        return this.calibration;
+    }
+
+    /**
+     * Get the gain.
+     *
+     * @return the gain object
+     */
+    public SvtGain getGain() {
+        return this.gain;
+    }
+
+    /**
+     * Get the shape fit parameters.
+     *
+     * @return the shape fit parameters
+     */
+    public SvtShapeFitParameters getShapeFitParameters() {
+        return this.shapeFitParameters;
+    }
+
+    /**
+     * Check if this is a bad channel.
+     *
+     * @return <code>true</code> if channel is bad
+     */
+    public boolean isBadChannel() {
+        return this.badChannel;
+    }
+
+    /**
+     * Set the bad channel flag.
+     *
+     * @param badChannel the bad channel flag value
+     */
+    void setBadChannel(final boolean badChannel) {
+        this.badChannel = badChannel;
+    }
+
+    /**
+     * Set the calibration.
+     *
+     * @param calibration the calibration object
+     */
+    void setCalibration(final SvtCalibration calibration) {
+        this.calibration = calibration;
+    }
+
+    /**
+     * Set the gain.
+     *
+     * @param gain the gain object
+     */
+    void setGain(final SvtGain gain) {
+        this.gain = gain;
     }
 
     /**
@@ -44,80 +107,18 @@
     }
 
     /**
-     * Set the gain.
-     *
-     * @param gain the gain object
-     */
-    void setGain(final SvtGain gain) {
-        this.gain = gain;
-    }
-
-    /**
-     * Set the calibration.
-     *
-     * @param calibration the calibration object
-     */
-    void setCalibration(final SvtCalibration calibration) {
-        this.calibration = calibration;
-    }
-
-    /**
-     * Set the bad channel flag.
-     *
-     * @param badChannel the bad channel flag value
-     */
-    void setBadChannel(final boolean badChannel) {
-        this.badChannel = badChannel;
-    }
-
-    /**
-     * Check if this is a bad channel.
-     *
-     * @return <code>true</code> if channel is bad
-     */
-    public boolean isBadChannel() {
-        return badChannel;
-    }
-
-    /**
-     * Get the shape fit parameters.
-     *
-     * @return the shape fit parameters
-     */
-    public SvtShapeFitParameters getShapeFitParameters() {
-        return shapeFitParameters;
-    }
-
-    /**
-     * Get the gain.
-     *
-     * @return the gain object
-     */
-    public SvtGain getGain() {
-        return gain;
-    }
-
-    /**
-     * Get the calibration.
-     *
-     * @return the calibration object
-     */
-    public SvtCalibration getCalibration() {
-        return calibration;
-    }
-
-    /**
      * Convert this object to a string.
      *
      * @return This object converted to a string.
      */
+    @Override
     public String toString() {
         final StringBuffer buffer = new StringBuffer();
-        buffer.append(getCalibration());
+        buffer.append(this.getCalibration());
         buffer.append(", ");
-        buffer.append(getGain());
+        buffer.append(this.getGain());
         buffer.append(", ");
-        buffer.append(getShapeFitParameters());
+        buffer.append(this.getShapeFitParameters());
         return buffer.toString();
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/DaqMapHandler.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/DaqMapHandler.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/DaqMapHandler.java	Mon Jul  6 12:03:16 2015
@@ -10,7 +10,7 @@
 /**
  * Handler for DAQ map events.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public final class DaqMapHandler extends DefaultHandler {
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/MotorPositionLoader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/MotorPositionLoader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/MotorPositionLoader.java	Mon Jul  6 12:03:16 2015
@@ -19,20 +19,20 @@
 import org.apache.commons.cli.PosixParser;
 
 /**
- * Load SVT motor positions from a MYA dump, figure out time ranges (same position for > 10 seconds), and then 
- * convert the motor stage to an opening angle.
+ * Load SVT motor positions from a MYA dump, figure out time ranges (same position for > 10 seconds), and then convert
+ * the motor stage to an opening angle.
  * <p>
  * The calculated angle ranges are written out to a comma delimited text file with double-quoted field values.
  *
- * @author Jeremy McCormick
+ * @author Jeremy McCormick, SLAC
  */
 public class MotorPositionLoader {
 
     class MotorPositionInterval {
 
+        private final double angle;
         private final Date endDate;
         private final Date startDate;
-        private final double angle;
         private final double yStage;
 
         MotorPositionInterval(final Date startDate, final Date endDate, final double angle, final double yStage) {
@@ -42,24 +42,26 @@
             this.yStage = yStage;
         }
 
+        double getAngle() {
+            return this.angle;
+        }
+
         Date getEndDate() {
-            return endDate;
+            return this.endDate;
         }
 
         Date getStartDate() {
-            return startDate;
-        }
-
-        double getAngle() {
-            return angle;
-        }
-        
+            return this.startDate;
+        }
+
         double getYStage() {
-            return yStage;
-        }
-        
+            return this.yStage;
+        }
+
+        @Override
         public String toString() {
-            return "MotorPositionInterval { start: " + startDate + ", end: " + endDate + ", angle: " + angle + ", yStage: " + yStage + " }";
+            return "MotorPositionInterval { start: " + this.startDate + ", end: " + this.endDate + ", angle: "
+                    + this.angle + ", yStage: " + this.yStage + " }";
         }
     }
 
@@ -74,11 +76,11 @@
         }
 
         Date getDate() {
-            return date;
+            return this.date;
         }
 
         double getPosition() {
-            return position;
+            return this.position;
         }
     }
 
@@ -89,8 +91,8 @@
     private static final double ANGLE_CONVERSION = 832.714;
 
     private static final double BOTTOM_ANGLE_CONSTANT = 17.397;
-    //private static final double BOTTOM_LAYER_CONSTANT1 = 0.363;
-    //private static final double BOTTOM_LAYER_CONSTANT2 = -6.815;
+    // private static final double BOTTOM_LAYER_CONSTANT1 = 0.363;
+    // private static final double BOTTOM_LAYER_CONSTANT2 = -6.815;
 
     private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
@@ -99,8 +101,8 @@
     private static final Options OPTIONS = new Options();
 
     private static final double TOP_ANGLE_CONSTANT = 17.821;
-    //private static final double TOP_LAYER_CONSTANT1 = -0.391;
-    //private static final double TOP_LAYER_CONSTANT2 = 7.472;
+    // private static final double TOP_LAYER_CONSTANT1 = -0.391;
+    // private static final double TOP_LAYER_CONSTANT2 = 7.472;
 
     static {
         OPTIONS.addOption("h", "help", false, "print help");
@@ -109,82 +111,10 @@
         OPTIONS.addOption("i", "input-file", true, "input text file dumped from MYA (required)");
         OPTIONS.getOption("i").setRequired(true);
         OPTIONS.addOption("o", "output-file", true, "output text file with computed angle intervals");
-        //OPTIONS.addOption("l", "layer", false, "write out layer 1 position instead of computed angle");
-    }
-    
-    public void setSide(Side side) {
-        this.side = side;
-        if (Side.TOP.equals(side)) {
-            this.motorConstant = TOP_ANGLE_CONSTANT;
-            //this.layerConstant1 = TOP_LAYER_CONSTANT1;
-            //this.layerConstant2 = TOP_LAYER_CONSTANT2;
-        } else if (Side.BOT.equals(side)) {
-            this.motorConstant = BOTTOM_ANGLE_CONSTANT;
-            //this.layerConstant1 = BOTTOM_LAYER_CONSTANT1;
-            //this.layerConstant2 = BOTTOM_LAYER_CONSTANT2;
-        }
-    }
-        
-    /**
-     * Run from command line arguments.
-     * 
-     * @param args
-     */
-    void run(final String args[]) {
-        
-        final PosixParser parser = new PosixParser();
-        
-        CommandLine cl = null;        
-        try {
-            cl = parser.parse(OPTIONS, args);
-        } catch (final Exception e) {
-            printUsage(1);
-            throw new RuntimeException();
-        }
-
-        if (cl.hasOption("h")) {
-            printUsage(0);
-        }
-
-        if (cl.hasOption("s")) {
-            setSide(Side.valueOf(cl.getOptionValue("s").toUpperCase()));
-        } else {
-            printUsage(0);
-        }
-        
-        this.setSide(side);
-                
-        String path = null;
-        if (cl.hasOption("i")) {
-            path = cl.getOptionValue("i");
-        } else {
-            printUsage(1);
-        }
-
-        //if (cl.hasOption("l")) {
-        //    setWriteLayerPosition(true);
-        //}
-
-        try {
-            load(path);
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
-
-        // Find the time intervals with a certain motor position setting.
-        findIntervals();
-
-        if (cl.hasOption("o")) {
-            final String outputPath = cl.getOptionValue("o");
-            try {
-                toCsv(outputPath);
-            } catch (final IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    public static void main(final String args[]) {        
+        // OPTIONS.addOption("l", "layer", false, "write out layer 1 position instead of computed angle");
+    }
+
+    public static void main(final String args[]) {
         new MotorPositionLoader().run(args);
     }
 
@@ -199,49 +129,45 @@
 
     private List<MotorPositionInterval> intervals;
 
-    //private double layerConstant1;
-    //private double layerConstant2;
-
     private double motorConstant;
 
     private List<MotorPositionMyaRecord> records;
 
-    //private boolean writeLayerPosition = false;
-    
+    // private double layerConstant1;
+    // private double layerConstant2;
+
     Side side = null;
 
     MotorPositionLoader() {
     }
 
+    // private boolean writeLayerPosition = false;
+
     private double computeAngle(final double yStage) {
-        double angle = (motorConstant - yStage) / ANGLE_CONVERSION;
-        if (Side.BOT.equals(side)) {
+        double angle = (this.motorConstant - yStage) / ANGLE_CONVERSION;
+        if (Side.BOT.equals(this.side)) {
             angle = -angle;
         }
         return angle;
     }
 
-    //private double computeLayer1Position(final double yStage) {
-    //    return layerConstant1 * yStage + layerConstant2;
-    //}
-
     List<MotorPositionInterval> findIntervals() {
-        intervals = new ArrayList<MotorPositionInterval>();
-        for (int i = 0; i < records.size() - 1; i++) {
-            final Date currentDate = records.get(i).getDate();
-            final Date nextDate = records.get(i + 1).getDate();
+        this.intervals = new ArrayList<MotorPositionInterval>();
+        for (int i = 0; i < this.records.size() - 1; i++) {
+            final Date currentDate = this.records.get(i).getDate();
+            final Date nextDate = this.records.get(i + 1).getDate();
             final long timeDiff = nextDate.getTime() - currentDate.getTime();
             if (timeDiff >= MIN_TIME_INTERVAL) {
-                final double yStage = records.get(i).getPosition();
-                double angle = this.computeAngle(yStage);
-                intervals.add(new MotorPositionInterval(currentDate, nextDate, angle, yStage));
+                final double yStage = this.records.get(i).getPosition();
+                final double angle = this.computeAngle(yStage);
+                this.intervals.add(new MotorPositionInterval(currentDate, nextDate, angle, yStage));
             }
         }
-        return intervals;
+        return this.intervals;
     }
 
     void load(final String path) throws IOException, ParseException, FileNotFoundException {
-        records = new ArrayList<MotorPositionMyaRecord>();
+        this.records = new ArrayList<MotorPositionMyaRecord>();
         try (BufferedReader br = new BufferedReader(new FileReader(path))) {
             String line;
             while ((line = br.readLine()) != null) {
@@ -250,7 +176,7 @@
                 try {
                     final Date date = DATE_FORMAT.parse(dateString);
                     final double position = Double.parseDouble(positionString);
-                    records.add(new MotorPositionMyaRecord(date, position));
+                    this.records.add(new MotorPositionMyaRecord(date, position));
                 } catch (final NumberFormatException e) {
                     e.printStackTrace();
                 }
@@ -258,15 +184,91 @@
         }
     }
 
-    //private void setWriteLayerPosition(final boolean writeLayer) {
-    //    this.writeLayerPosition = writeLayer;
-    //}
+    // private double computeLayer1Position(final double yStage) {
+    // return layerConstant1 * yStage + layerConstant2;
+    // }
+
+    /**
+     * Run from command line arguments.
+     *
+     * @param args
+     */
+    void run(final String args[]) {
+
+        final PosixParser parser = new PosixParser();
+
+        CommandLine cl = null;
+        try {
+            cl = parser.parse(OPTIONS, args);
+        } catch (final Exception e) {
+            printUsage(1);
+            throw new RuntimeException();
+        }
+
+        if (cl.hasOption("h")) {
+            printUsage(0);
+        }
+
+        if (cl.hasOption("s")) {
+            this.setSide(Side.valueOf(cl.getOptionValue("s").toUpperCase()));
+        } else {
+            printUsage(0);
+        }
+
+        this.setSide(this.side);
+
+        String path = null;
+        if (cl.hasOption("i")) {
+            path = cl.getOptionValue("i");
+        } else {
+            printUsage(1);
+        }
+
+        // if (cl.hasOption("l")) {
+        // setWriteLayerPosition(true);
+        // }
+
+        try {
+            this.load(path);
+        } catch (final Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        // Find the time intervals with a certain motor position setting.
+        this.findIntervals();
+
+        if (cl.hasOption("o")) {
+            final String outputPath = cl.getOptionValue("o");
+            try {
+                this.toCsv(outputPath);
+            } catch (final IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public void setSide(final Side side) {
+        this.side = side;
+        if (Side.TOP.equals(side)) {
+            this.motorConstant = TOP_ANGLE_CONSTANT;
+            // this.layerConstant1 = TOP_LAYER_CONSTANT1;
+            // this.layerConstant2 = TOP_LAYER_CONSTANT2;
+        } else if (Side.BOT.equals(side)) {
+            this.motorConstant = BOTTOM_ANGLE_CONSTANT;
+            // this.layerConstant1 = BOTTOM_LAYER_CONSTANT1;
+            // this.layerConstant2 = BOTTOM_LAYER_CONSTANT2;
+        }
+    }
+
+    // private void setWriteLayerPosition(final boolean writeLayer) {
+    // this.writeLayerPosition = writeLayer;
+    // }
 
     private void toCsv(final String path) throws IOException {
-        System.out.println("writing " + intervals.size() + " intervals to file to " + path + " ...");
+        System.out.println("writing " + this.intervals.size() + " intervals to file to " + path + " ...");
         final FileWriter fw = new FileWriter(new File(path));
         final BufferedWriter bw = new BufferedWriter(fw);
-        for (final MotorPositionInterval interval : intervals) {
+        for (final MotorPositionInterval interval : this.intervals) {
             bw.write("\"" + DATE_FORMAT.format(interval.getStartDate()) + "\",");
             bw.write("\"" + DATE_FORMAT.format(interval.getEndDate()) + "\",");
             bw.write("\"" + interval.getAngle() + "\"");

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/OpeningAngleLoader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/OpeningAngleLoader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/OpeningAngleLoader.java	Mon Jul  6 12:03:16 2015
@@ -14,37 +14,91 @@
 import org.hps.conditions.svt.MotorPositionLoader.MotorPositionInterval;
 import org.hps.conditions.svt.MotorPositionLoader.Side;
 
+/**
+ * @author Jeremy McCormick, SLAC
+ */
 public class OpeningAngleLoader {
 
+    private static final String BOT_FILE = "mya_svt_bot.txt";
+    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMMM dd YYYY HH:mm z");
+    private static final String OUT_FILE = "svt_opening_angles.txt";
+    private static final String RUN_FILE = "runs.csv";
+
     private static final String TOP_FILE = "mya_svt_top.txt";
-    private static final String BOT_FILE = "mya_svt_bot.txt";
-    private static final String RUN_FILE = "runs.csv";
-    private static final String OUT_FILE = "svt_opening_angles.txt";
-    
-    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMMM dd YYYY HH:mm z");
-    
-    public static void main(String[] args) throws Exception {
-        
+
+    /**
+     * Check if the run record looks good.
+     *
+     * @param data
+     * @return
+     */
+    private static boolean acceptRun(final RunData data) {
+        return !data.getRecord().get("to_tape").equals("JUNK")
+                && data.getRecord().get("trigger_config").trim().length() > 0
+                && !data.getRecord().get("trigger_config").contains("cosmic") && data.getStartDate() != null;
+    }
+
+    private static MotorPositionInterval findInterval(final List<MotorPositionInterval> intervals, final Date date) {
+        MotorPositionInterval interval = null;
+        final Iterator<MotorPositionInterval> it = intervals.listIterator();
+        while ((interval = it.next()) != null) {
+
+            // Start and end dates in the interval.
+            final Date startDate = interval.getStartDate();
+            final Date endDate = interval.getEndDate();
+
+            // Check if given date is within the interval.
+            if ((startDate.compareTo(date) == -1 || startDate.compareTo(date) == 0) && endDate.compareTo(date) == 1
+                    || endDate.compareTo(date) == 0) {
+                break;
+            }
+
+            // Didn't find it.
+            if (!it.hasNext()) {
+                interval = null;
+                break;
+            }
+        }
+        return interval;
+    }
+
+    private static List<MotorPositionInterval> getMotorPositionIntervals(final String path, final Side side)
+            throws Exception {
+        final MotorPositionLoader loader = new MotorPositionLoader();
+        loader.setSide(side);
+        loader.load(path);
+        return loader.findIntervals();
+    }
+
+    private static RunMap loadRunMap(final String path) {
+        final File runFile = new File(path);
+        final RunSpreadsheet runSpreadsheet = new RunSpreadsheet(runFile);
+        return runSpreadsheet.getRunMap();
+    }
+
+    public static void main(final String[] args) throws Exception {
+
         // Load top and bottom intervals from MYA dump.
-        List<MotorPositionInterval> topIntervals = getMotorPositionIntervals(TOP_FILE, Side.TOP);
-        List<MotorPositionInterval> botIntervals = getMotorPositionIntervals(BOT_FILE, Side.BOT);
-        
+        final List<MotorPositionInterval> topIntervals = getMotorPositionIntervals(TOP_FILE, Side.TOP);
+        final List<MotorPositionInterval> botIntervals = getMotorPositionIntervals(BOT_FILE, Side.BOT);
+
         // Load run map from spreadsheet.
-        RunMap runMap = loadRunMap(RUN_FILE);
-        
+        final RunMap runMap = loadRunMap(RUN_FILE);
+
         // Write out run data combined with SVT opening angle intervals.
-        PrintStream ps = new PrintStream(new FileOutputStream(OUT_FILE));
+        final PrintStream ps = new PrintStream(new FileOutputStream(OUT_FILE));
         for (final RunData data : runMap.values()) {
             if (acceptRun(data)) {
                 final MotorPositionInterval topInterval = findInterval(topIntervals, data.getStartDate());
                 final MotorPositionInterval botInterval = findInterval(botIntervals, data.getStartDate());
                 printLine(ps, data, topInterval, botInterval);
             }
-        }        
+        }
         ps.close();
     }
-    
-    private static void printLine(PrintStream ps, RunData data, MotorPositionInterval topInterval, MotorPositionInterval botInterval) {
+
+    private static void printLine(final PrintStream ps, final RunData data, final MotorPositionInterval topInterval,
+            final MotorPositionInterval botInterval) {
         ps.print("run: " + data.getRun() + " @ [" + data.getRecord().get("svt_y_position") + "], ");
         if (topInterval != null) {
             ps.print("start(top): " + DATE_FORMAT.format(topInterval.getStartDate()) + ", ");
@@ -82,52 +136,4 @@
         ps.println();
         ps.flush();
     }
-    
-    private static List<MotorPositionInterval> getMotorPositionIntervals(String path, Side side) throws Exception {
-        MotorPositionLoader loader = new MotorPositionLoader();
-        loader.setSide(side);
-        loader.load(path);
-        return loader.findIntervals();
-    }
-
-    /**
-     * Check if the run record looks good.
-     * 
-     * @param data
-     * @return
-     */
-    private static boolean acceptRun(RunData data) {
-        return !data.getRecord().get("to_tape").equals("JUNK") && data.getRecord().get("trigger_config").trim().length() > 0
-                && !data.getRecord().get("trigger_config").contains("cosmic") && data.getStartDate() != null;
-    }
-    
-    private static RunMap loadRunMap(String path) {
-        final File runFile = new File(path);
-        final RunSpreadsheet runSpreadsheet = new RunSpreadsheet(runFile);
-        return runSpreadsheet.getRunMap();
-    }
-
-    private static MotorPositionInterval findInterval(List<MotorPositionInterval> intervals, Date date) {
-        MotorPositionInterval interval = null;
-        Iterator<MotorPositionInterval> it = intervals.listIterator();
-        while ((interval = it.next()) != null) {
-                
-            // Start and end dates in the interval.
-            Date startDate = interval.getStartDate();
-            Date endDate = interval.getEndDate();
-
-            // Check if given date is within the interval.
-            if ((startDate.compareTo(date) == -1 || startDate.compareTo(date) == 0) && endDate.compareTo(date) == 1
-                    || endDate.compareTo(date) == 0) {
-                break;
-            }
-                
-            // Didn't find it.
-            if (!it.hasNext()) {
-                interval = null;
-                break;
-            }            
-        }
-        return interval;
-    }   
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtAlignmentConstant.java	Mon Jul  6 12:03:16 2015
@@ -12,6 +12,7 @@
  * translation or rotation of a detector component.
  * <p>
  * The format of the keys is ABCDE where:<br>
+ * 
  * <pre>
  * A == half == [1,2]
  * B == alignment type == [1,2]
@@ -21,7 +22,7 @@
  * <p>
  * The key naming conventions are from the <a href="http://www.desy.de/~blobel/mptalks.html">Millipede</a> package.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = "svt_alignments")
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_UPDATED)
@@ -32,16 +33,22 @@
      */
     @SuppressWarnings("serial")
     public static class SvtAlignmentConstantCollection extends BaseConditionsObjectCollection<SvtAlignmentConstant> {
-        
-        public SvtAlignmentConstant find(int id) {
-            for (SvtAlignmentConstant constant : this) {
+
+        /**
+         * Find an alignment constant by its parameter ID.
+         * 
+         * @param id the parameter ID
+         * @return the first object with matching parameter ID or <code>null</code> if not found
+         */
+        public SvtAlignmentConstant find(final int id) {
+            for (final SvtAlignmentConstant constant : this) {
                 if (constant.getParameter().equals(id)) {
                     return constant;
                 }
             }
             return null;
         }
-        
+
     };
 
     /**
@@ -51,8 +58,7 @@
      */
     @Field(names = {"parameter"})
     public Integer getParameter() {
-        //System.out.println("parameter = " + this.getFieldValues().get("parameter") + "; type = " + this.getFieldValues().get("parameter").getClass());
-        return getFieldValue("parameter");
+        return this.getFieldValue("parameter");
     }
 
     /**
@@ -62,7 +68,7 @@
      */
     @Field(names = {"value"})
     public Double getValue() {
-        return getFieldValue("value");
+        return this.getFieldValue("value");
     }
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBadChannel.java	Mon Jul  6 12:03:16 2015
@@ -2,19 +2,16 @@
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * Represents a channel that has been flagged as bad, which should not be used for physics reconstructions. This might
  * be done if the channel is extremely noisy, etc.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"svt_bad_channels", "test_run_svt_bad_channels"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtBadChannel extends BaseConditionsObject {
 
     /**
@@ -26,21 +23,21 @@
 
     /**
      * Get the channel ID.
-     * 
+     *
      * @return the channel ID
      */
     @Field(names = {"svt_channel_id"})
     public Integer getChannelId() {
-        return getFieldValue("svt_channel_id");
+        return this.getFieldValue("svt_channel_id");
     }
 
     /**
      * Get a note about the bad channel.
-     * 
+     *
      * @return a note about the bad channel
      */
     @Field(names = {"notes"})
     public Integer getNote() {
-        return getFieldValue("notes");
+        return this.getFieldValue("notes");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java	Mon Jul  6 12:03:16 2015
@@ -3,13 +3,16 @@
  */
 package org.hps.conditions.svt;
 
-import hep.aida.*;
+import hep.aida.IDataPoint;
+import hep.aida.IDataPointSet;
+import hep.aida.IDataPointSetFactory;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashSet;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -33,19 +36,25 @@
 import org.hps.conditions.svt.SvtBiasMyaDumpReader.SvtBiasMyaRange;
 import org.hps.conditions.svt.SvtBiasMyaDumpReader.SvtBiasMyaRanges;
 import org.hps.conditions.svt.SvtBiasMyaDumpReader.SvtBiasRunRange;
-import org.hps.conditions.svt.SvtTimingConstants.SvtTimingConstantsCollection;
 import org.hps.util.BasicLogFormatter;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.util.log.LogUtil;
 
 /**
- * @author Per Hansson Adrian <[log in to unmask]>
+ * @author Per Hansson Adrian, SLAC
  */
 public class SvtBiasConditionsLoader {
 
+    /**
+     * Setup control plots.
+     */
+    private static AIDA aida = AIDA.defaultInstance();
+    static IDataPointSet dpsBiasRuns = null;
+
+    static IDataPointSet dpsRuns = null;
     private static final Set<String> FIELDS = new HashSet<String>();
+
     private static Logger logger = LogUtil.create(SvtBiasConditionsLoader.class, new BasicLogFormatter(), Level.INFO);
-
     /**
      * Setup conditions.
      */
@@ -57,12 +66,202 @@
         FIELDS.add("end_time");
     }
 
-    /**
-     * Setup control plots.
-     */
-    private static AIDA aida = AIDA.defaultInstance();
-    static IDataPointSet dpsRuns = null;
-    static IDataPointSet dpsBiasRuns = null;
+    private static IDataPoint addPoint(final IDataPointSet dps, final long mstime, final double val) {
+        final IDataPoint dp = dps.addPoint();
+        dp.coordinate(0).setValue(mstime / 1000.);
+        dp.coordinate(1).setValue(val);
+        return dp;
+    }
+
+    private final static SvtBiasConstantCollection findCollection(final List<SvtBiasConstantCollection> list,
+            final Date date) {
+        for (final SvtBiasConstantCollection collection : list) {
+            if (collection.find(date) != null) {
+                return collection;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Check validity of @link RunData
+     *
+     * @param data the @link RunData to check
+     * @return <code>true</code> if valid, <code>false</code> otherwise.
+     */
+    private static boolean isValid(final RunData data) {
+        if (data.getStartDate() == null || data.getEndDate() == null || data.getStartDate().before(new Date(99, 1, 1))) {
+            logger.warning("This run data is not valid: " + data.toString());
+            return false;
+        }
+        if (data.getStartDate().after(data.getEndDate())) {
+            throw new RuntimeException("start date is after end date?!" + data.toString());
+        }
+        return true;
+    }
+
+    private static final void loadToConditionsDB(final List<SvtBiasRunRange> ranges, final boolean doIt) {
+        logger.info("Load to DB...");
+
+        // Create a new collection for each run
+        final List<Integer> runsadded = new ArrayList<Integer>();
+
+        for (final SvtBiasRunRange range : ranges) {
+            logger.info("Loading " + range.toString());
+            final RunData rundata = range.getRun();
+            if (runsadded.contains(rundata.getRun())) {
+                logger.warning("Run " + Integer.toString(rundata.getRun()) + " was already added?");
+                throw new RuntimeException("Run " + Integer.toString(rundata.getRun()) + " was already added?");
+            }
+            runsadded.add(rundata.getRun());
+            for (final SvtBiasMyaRange biasRange : range.getRanges()) {
+                // create a collection
+                final SvtBiasConstantCollection collection = new SvtBiasConstantCollection();
+                // create a constant and add to the collection
+                final SvtBiasConstant constant = new SvtBiasConstant();
+                constant.setFieldValue("start", biasRange.getStartDate());
+                constant.setFieldValue("end", biasRange.getEndDate());
+                constant.setFieldValue("value", biasRange.getStart().getValue());
+                try {
+                    collection.add(constant);
+                } catch (final ConditionsObjectException e) {
+                    throw new RuntimeException(e);
+                }
+
+                final ConditionsRecord condition = new ConditionsRecord();
+                condition.setFieldValue("run_start", rundata.getRun());
+                condition.setFieldValue("run_end", rundata.getRun());
+                condition.setFieldValue("name", "svt_bias");
+                condition.setFieldValue("table_name", "svt_bias");
+                condition.setFieldValue("notes", "constants from mya");
+                condition.setFieldValue("created", new Date());
+                condition.setFieldValue("created_by", System.getProperty("user.name"));
+
+                condition.setFieldValue("collection_id", collection.getCollectionId());
+
+                logger.info(condition.toString());
+
+                if (doIt) {
+                    try {
+                        condition.insert();
+                    } catch (final Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            }
+        }
+
+    }
+
+    // private static Options options = null;
+
+    /**
+     * Load SVT HV bias constants into the conditions database.
+     *
+     * @param args the command line arguments (requires a CVS run log file and a MYA dump file.)
+     */
+    public static void main(final String[] args) {
+
+        final Options options = new Options();
+        options.addOption(new Option("c", true, "CVS run file"));
+        options.addOption(new Option("m", true, "MYA dump file"));
+        options.addOption(new Option("g", false, "Actually load stuff into DB"));
+        options.addOption(new Option("s", false, "Show plots"));
+
+        final CommandLineParser parser = new PosixParser();
+        CommandLine cl = null;
+        try {
+            cl = parser.parse(options, args);
+        } catch (final ParseException e) {
+            throw new RuntimeException("Cannot parse.", e);
+        }
+
+        // Setup plots
+        setupPlots(cl.hasOption("s") ? true : false);
+
+        // Load in CSV records from the exported run spreadsheet.
+        final String path = cl.getOptionValue("c");
+        logger.info(path);
+        final RunSpreadsheet runSheet = new RunSpreadsheet(new File(path));
+
+        // Find the run ranges that have the same fields values.
+        final List<RunRange> ranges = RunRange.findRunRanges(runSheet, FIELDS);
+        logger.info("Found " + ranges.size() + " ranges.");
+        for (final RunRange range : ranges) {
+            logger.info(range.toString());
+        }
+        // find the run records (has converted dates and stuff) for these ranges
+        final RunMap runmap = runSheet.getRunMap(ranges);
+        logger.info("Found " + runmap.size() + " runs in the run map.");
+
+        // Load MYA dump
+        final SvtBiasMyaDumpReader biasMyaReader = new SvtBiasMyaDumpReader(cl.getOptionValue("m"));
+        logger.info("Got " + biasMyaReader.getRanges().size() + " bias ranges");
+
+        // Combine them to run ranges when bias was on
+        // each run may have multiple bias ranges
+
+        final List<SvtBiasRunRange> biasRunRanges = new ArrayList<SvtBiasRunRange>();
+        // loop over runs from CSV
+        RunData prev = null;
+        for (final Entry<Integer, RunData> entry : runmap.entrySet()) {
+            final int run = entry.getKey();
+            final RunData data = entry.getValue();
+            logger.info("Processing " + run + " " + data.toString());
+
+            // check that data is ok
+            if (isValid(data)) {
+                if (prev != null) {
+                    if (isValid(prev)) {
+                        if (prev.getEndDate().after(data.getStartDate())) {
+                            throw new RuntimeException("prev end date after run started?: " + prev.toString() + "   "
+                                    + data.toString());
+                        } else if (prev.getStartDate().after(data.getEndDate())) {
+                            throw new RuntimeException("prev start date before run ended?: " + prev.toString() + "   "
+                                    + data.toString());
+                        }
+                    }
+                }
+
+                // find the bias ranges applicable to this run
+                final SvtBiasMyaRanges overlaps = biasMyaReader.findOverlappingRanges(data.getStartDate(),
+                        data.getEndDate());
+                logger.fine("Found " + overlaps.size() + " overlapping bias ranges");
+                logger.fine(overlaps.toString());
+
+                biasRunRanges.add(new SvtBiasRunRange(data, overlaps));
+                prev = data;
+
+            }
+        }
+
+        // fill graphs
+        if (cl.hasOption("s")) {
+            for (final SvtBiasRunRange r : biasRunRanges) {
+                logger.info(r.toString());
+                if (r.getRun().getRun() > 5600) {// 9999999999999.0) {
+                    // if(dpsRuns.size()/4.0<500) {//9999999999999.0) {
+                    addPoint(dpsRuns, r.getRun().getStartDate().getTime(), 0.0);
+                    addPoint(dpsRuns, r.getRun().getStartDate().getTime(), 1.0);
+                    addPoint(dpsRuns, r.getRun().getEndDate().getTime(), 1.0);
+                    addPoint(dpsRuns, r.getRun().getEndDate().getTime(), 0.0);
+
+                    for (final SvtBiasMyaRange br : r.getRanges()) {
+                        addPoint(dpsBiasRuns, br.getStart().getDate().getTime(), 0.0);
+                        addPoint(dpsBiasRuns, br.getStart().getDate().getTime(), 0.5);
+                        addPoint(dpsBiasRuns, br.getEnd().getDate().getTime(), 0.5);
+                        addPoint(dpsBiasRuns, br.getEnd().getDate().getTime(), 0.0);
+                    }
+
+                }
+
+            }
+        }
+
+        // load to DB
+        loadToConditionsDB(biasRunRanges, cl.hasOption("g") ? true : false);
+
+    }
 
     private static void setupPlots(final boolean show) {
         final IDataPointSetFactory dpsf = aida.analysisFactory().createDataPointSetFactory(aida.tree());
@@ -82,207 +281,9 @@
 
     }
 
-    private static IDataPoint addPoint(final IDataPointSet dps, final long mstime, final double val) {
-        final IDataPoint dp = dps.addPoint();
-        dp.coordinate(0).setValue(mstime / 1000.);
-        dp.coordinate(1).setValue(val);
-        return dp;
-    }
-
     /**
      * Default constructor
      */
     public SvtBiasConditionsLoader() {
     }
-
-    /**
-     * Check validity of @link RunData
-     *
-     * @param data the @link RunData to check
-     * @return <code>true</code> if valid, <code>false</code> otherwise.
-     */
-    private static boolean isValid(final RunData data) {
-        if (data.getStartDate() == null || data.getEndDate() == null || data.getStartDate().before(new Date(99, 1, 1))) {
-            logger.warning("This run data is not valid: " + data.toString());
-            return false;
-        }
-        if (data.getStartDate().after(data.getEndDate())) {
-            throw new RuntimeException("start date is after end date?!" + data.toString());
-        }
-        return true;
-    }
-
-    // private static Options options = null;
-
-    /**
-     * Load SVT HV bias constants into the conditions database.
-     *
-     * @param args the command line arguments (requires a CVS run log file and a MYA dump file.)
-     */
-    public static void main(final String[] args) {
-
-        final Options options = new Options();
-        options.addOption(new Option("c", true, "CVS run file"));
-        options.addOption(new Option("m", true, "MYA dump file"));
-        options.addOption(new Option("g", false, "Actually load stuff into DB"));
-        options.addOption(new Option("s", false, "Show plots"));
-
-        final CommandLineParser parser = new PosixParser();
-        CommandLine cl = null;
-        try {
-            cl = parser.parse(options, args);
-        } catch (final ParseException e) {
-            throw new RuntimeException("Cannot parse.", e);
-        }
-
-        // Setup plots
-        setupPlots(cl.hasOption("s") ? true : false);
-
-        // Load in CSV records from the exported run spreadsheet.
-        final String path = cl.getOptionValue("c");
-        logger.info(path);
-        final RunSpreadsheet runSheet = new RunSpreadsheet(new File(path));
-
-        // Find the run ranges that have the same fields values.
-        final List<RunRange> ranges = RunRange.findRunRanges(runSheet, FIELDS);
-        logger.info("Found " + ranges.size() + " ranges.");
-        for (final RunRange range : ranges) {
-            logger.info(range.toString());
-        }
-        // find the run records (has converted dates and stuff) for these ranges
-        final RunMap runmap = runSheet.getRunMap(ranges);
-        logger.info("Found " + runmap.size() + " runs in the run map.");
-
-        // Load MYA dump
-        final SvtBiasMyaDumpReader biasMyaReader = new SvtBiasMyaDumpReader(cl.getOptionValue("m"));
-        logger.info("Got " + biasMyaReader.getRanges().size() + " bias ranges");
-
-        // Combine them to run ranges when bias was on
-        // each run may have multiple bias ranges
-
-        final List<SvtBiasRunRange> biasRunRanges = new ArrayList<SvtBiasRunRange>();
-        // loop over runs from CSV
-        RunData prev = null;
-        for (final Entry<Integer, RunData> entry : runmap.entrySet()) {
-            final int run = entry.getKey();
-            final RunData data = entry.getValue();
-            logger.info("Processing " + run + " " + data.toString());
-
-            // check that data is ok
-            if (isValid(data)) {
-                if (prev != null) {
-                    if (isValid(prev)) {
-                        if (prev.getEndDate().after(data.getStartDate())) {
-                            throw new RuntimeException("prev end date after run started?: " + prev.toString() + "   "
-                                    + data.toString());
-                        } else if (prev.getStartDate().after(data.getEndDate())) {
-                            throw new RuntimeException("prev start date before run ended?: " + prev.toString() + "   "
-                                    + data.toString());
-                        }
-                    }
-                }
-
-                // find the bias ranges applicable to this run
-                final SvtBiasMyaRanges overlaps = biasMyaReader.findOverlappingRanges(data.getStartDate(),
-                        data.getEndDate());
-                logger.fine("Found " + overlaps.size() + " overlapping bias ranges");
-                logger.fine(overlaps.toString());
-
-                biasRunRanges.add(new SvtBiasRunRange(data, overlaps));
-                prev = data;
-
-            }
-        }
-
-        // fill graphs
-        if (cl.hasOption("s")) {
-            for (final SvtBiasRunRange r : biasRunRanges) {
-                logger.info(r.toString());
-                if (r.getRun().getRun() > 5600) {// 9999999999999.0) {
-                    // if(dpsRuns.size()/4.0<500) {//9999999999999.0) {
-                    addPoint(dpsRuns, r.getRun().getStartDate().getTime(), 0.0);
-                    addPoint(dpsRuns, r.getRun().getStartDate().getTime(), 1.0);
-                    addPoint(dpsRuns, r.getRun().getEndDate().getTime(), 1.0);
-                    addPoint(dpsRuns, r.getRun().getEndDate().getTime(), 0.0);
-
-                    for (final SvtBiasMyaRange br : r.getRanges()) {
-                        addPoint(dpsBiasRuns, br.getStart().getDate().getTime(), 0.0);
-                        addPoint(dpsBiasRuns, br.getStart().getDate().getTime(), 0.5);
-                        addPoint(dpsBiasRuns, br.getEnd().getDate().getTime(), 0.5);
-                        addPoint(dpsBiasRuns, br.getEnd().getDate().getTime(), 0.0);
-                    }
-
-                }
-
-            }
-        }
-
-        // load to DB
-        loadToConditionsDB(biasRunRanges, cl.hasOption("g") ? true : false);
-
-    }
-
-    private final static SvtBiasConstantCollection findCollection(final List<SvtBiasConstantCollection> list,
-            final Date date) {
-        for (final SvtBiasConstantCollection collection : list) {
-            if (collection.find(date) != null) {
-                return collection;
-            }
-        }
-        return null;
-    }
-
-    private static final void loadToConditionsDB(final List<SvtBiasRunRange> ranges, final boolean doIt) {
-        logger.info("Load to DB...");
-
-        // Create a new collection for each run
-        final List<Integer> runsadded = new ArrayList<Integer>();
-
-        for(final SvtBiasRunRange range : ranges) {
-            logger.info("Loading " + range.toString());
-            final RunData rundata = range.getRun();
-            if(runsadded.contains(rundata.getRun())) {
-                logger.warning("Run " + Integer.toString(rundata.getRun()) + " was already added?");
-                throw new RuntimeException("Run " + Integer.toString(rundata.getRun()) + " was already added?");
-            }
-            runsadded.add(rundata.getRun());
-            for (final SvtBiasMyaRange biasRange : range.getRanges()) {
-                //create a collection
-                final SvtBiasConstantCollection collection = new SvtBiasConstantCollection();
-                //create a constant and add to the collection
-                final SvtBiasConstant constant = new SvtBiasConstant();
-                constant.setFieldValue("start", biasRange.getStartDate());
-                constant.setFieldValue("end", biasRange.getEndDate());
-                constant.setFieldValue("value", biasRange.getStart().getValue());
-                try {
-                    collection.add(constant);
-                } catch (final ConditionsObjectException e) {
-                    throw new RuntimeException(e);
-                }
-
-                final ConditionsRecord condition = new ConditionsRecord();
-                condition.setFieldValue("run_start", rundata.getRun());
-                condition.setFieldValue("run_end", rundata.getRun());
-                condition.setFieldValue("name", "svt_bias");
-                condition.setFieldValue("table_name", "svt_bias");
-                condition.setFieldValue("notes", "constants from mya");
-                condition.setFieldValue("created", new Date());
-                condition.setFieldValue("created_by", System.getProperty("user.name"));
-
-                condition.setFieldValue("collection_id", collection.getCollectionId());
-
-                logger.info(condition.toString());
-
-                if(doIt) {
-                    try {
-                        condition.insert();
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            }
-        }
-
-
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConstant.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConstant.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConstant.java	Mon Jul  6 12:03:16 2015
@@ -1,6 +1,3 @@
-/**
- * 
- */
 package org.hps.conditions.svt;
 
 import java.util.Date;
@@ -13,13 +10,11 @@
 import org.hps.conditions.database.Table;
 
 /**
- * 
  * Encapsulates an SVT bias constant, which is range in time where bias was ON.
- * 
- * @author Per Hansson Adrian <[log in to unmask]>
  *
+ * @author Per Hansson Adrian, SLAC
  */
-@Table(names  = "svt_bias")
+@Table(names = "svt_bias")
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_UPDATED)
 public final class SvtBiasConstant extends BaseConditionsObject {
 
@@ -28,52 +23,51 @@
      */
     @SuppressWarnings("serial")
     public static class SvtBiasConstantCollection extends BaseConditionsObjectCollection<SvtBiasConstant> {
-        
-        
+
         /**
          * Find bias constant by date.
-         * 
+         *
          * @param date the offset
          * @return the constant containing the date or <code>null</code> otherwise.
-         * 
          */
-        public SvtBiasConstant find(Date date) {
-            for (SvtBiasConstant constant : this) {
-                if(date.after(constant.getStart()) && date.before(constant.getEnd())) {
+        public SvtBiasConstant find(final Date date) {
+            for (final SvtBiasConstant constant : this) {
+                if (date.after(constant.getStart()) && date.before(constant.getEnd())) {
                     return constant;
                 }
             }
             return null;
         }
     }
-    
-    
+
     /**
-     * The start date. 
+     * The end date.
+     * 
+     * @return the end date
+     */
+    @Field(names = {"end"})
+    public Date getEnd() {
+        return this.getFieldValue("end");
+    }
+
+    /**
+     * The start date.
+     * 
      * @return the start date
      */
     @Field(names = {"start"})
     public Date getStart() {
-        return getFieldValue("start");
+        return this.getFieldValue("start");
     }
 
     /**
-     * The end date. 
-     * @return the end date
-     */
-    @Field(names = {"end"})
-    public Date getEnd() {
-        return getFieldValue("end");
-    }
-
-    /**
-     * The bias value
-     * . 
+     * The bias value .
+     * 
      * @return the bias value
      */
     @Field(names = {"value"})
     public double getValue() {
-        return getFieldValue("value");
+        return this.getFieldValue("value");
     }
-    
+
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java	Mon Jul  6 12:03:16 2015
@@ -16,258 +16,281 @@
 import org.hps.util.BasicLogFormatter;
 import org.lcsim.util.log.LogUtil;
 
-
-
+/**
+ * @author Per Hansson Adrian, SLAC
+ */
 public class SvtBiasMyaDumpReader {
-    
+
+    public static final class SvtBiasMyaEntry {
+        private final Date date;
+        private final String name;
+        private final double value;
+
+        public SvtBiasMyaEntry(final String name, final Date date, final double value) {
+            this.date = date;
+            this.name = name;
+            this.value = value;
+        }
+
+        public Date getDate() {
+            return this.date;
+        }
+
+        public double getValue() {
+            return this.value;
+        }
+
+        @Override
+        public String toString() {
+            return this.name + " " + this.date.toString() + " value " + this.value;
+        }
+    }
+
+    public static class SvtBiasMyaRange {
+        private SvtBiasMyaEntry end;
+        private SvtBiasMyaEntry start;
+
+        public SvtBiasMyaRange() {
+        }
+
+        public SvtBiasMyaRange(final SvtBiasMyaEntry start) {
+            this.start = start;
+        }
+
+        public SvtBiasMyaEntry getEnd() {
+            return this.end;
+        }
+
+        public Date getEndDate() {
+            return this.getEnd().getDate();
+        }
+
+        public SvtBiasMyaEntry getStart() {
+            return this.start;
+        }
+
+        public Date getStartDate() {
+            return this.getStart().getDate();
+        }
+
+        public boolean overlap(final Date date_start, final Date date_end) {
+            if (date_end.before(this.getStartDate())) {
+                return false;
+            } else if (date_start.after(this.getEndDate())) {
+                return false;
+            }
+            return true;
+        }
+
+        public void setEnd(final SvtBiasMyaEntry end) {
+            this.end = end;
+        }
+
+        public void setStart(final SvtBiasMyaEntry start) {
+            this.start = start;
+        }
+
+        @Override
+        public String toString() {
+            return "START: " + this.start.toString() + "   END: " + this.end.toString();
+        }
+    }
+
+    public static final class SvtBiasMyaRanges extends ArrayList<SvtBiasMyaRange> {
+        public SvtBiasMyaRanges() {
+        }
+
+        public SvtBiasMyaRanges findOverlappingRanges(final Date date_start, final Date date_end) {
+            logger.fine("look for overlaps from " + date_start.toString() + " to " + date_end.toString());
+            final SvtBiasMyaRanges overlaps = new SvtBiasMyaRanges();
+            for (final SvtBiasMyaRange range : this) {
+                logger.fine("loop bias range " + range.toString());
+                if (range.overlap(date_start, date_end)) {
+                    overlaps.add(range);
+                    logger.fine("overlap found!! ");
+                }
+            }
+            return overlaps;
+        }
+
+        @Override
+        public String toString() {
+            final StringBuffer sb = new StringBuffer();
+            for (final SvtBiasMyaRange range : this) {
+                sb.append(range.toString() + "\n");
+            }
+            return sb.toString();
+        }
+    }
+
+    public static final class SvtBiasRunRange {
+        private SvtBiasMyaRanges ranges;
+        private RunData run;
+
+        public SvtBiasRunRange(final RunData run, final SvtBiasMyaRanges ranges) {
+            this.setRun(run);
+            this.setRanges(ranges);
+        }
+
+        public SvtBiasMyaRanges getRanges() {
+            return this.ranges;
+        }
+
+        public RunData getRun() {
+            return this.run;
+        }
+
+        public void setRanges(final SvtBiasMyaRanges ranges) {
+            this.ranges = ranges;
+        }
+
+        public void setRun(final RunData run) {
+            this.run = run;
+        }
+
+        @Override
+        public String toString() {
+            final StringBuffer sb = new StringBuffer();
+            sb.append("\nRun " + this.run.toString() + ":");
+            for (final SvtBiasMyaRange r : this.ranges) {
+                sb.append("\n" + r.toString());
+            }
+            return sb.toString();
+        }
+    }
+
+    private static final double BIASVALUEON = 178.0;
+    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
     private static Logger logger = LogUtil.create(SvtBiasMyaDumpReader.class, new BasicLogFormatter(), Level.INFO);
 
-    
-    public static void main(String[] args) {
-        
-        SvtBiasMyaDumpReader dumpReader = new SvtBiasMyaDumpReader(args);
-        
+    public static void main(final String[] args) {
+
+        final SvtBiasMyaDumpReader dumpReader = new SvtBiasMyaDumpReader(args);
+
         dumpReader.printRanges();
-      
-        
-    }
-    
-    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    private static final double BIASVALUEON = 178.0;
-    private List<SvtBiasMyaEntry> myaEntries = new ArrayList<SvtBiasMyaEntry>();
-    private SvtBiasMyaRanges biasRanges = new SvtBiasMyaRanges();
-    
-    public SvtBiasMyaDumpReader() {
-    }
-
-    public SvtBiasMyaRanges findOverlappingRanges(Date date_start, Date date_end) {
-        return this.biasRanges.findOverlappingRanges(date_start, date_end);
-    }
-    
-    private void readFromFile(File file) {
-        addEntries(readMyaDump(file));
-        logger.info("Got " + getEntries().size() + " entries from " + file.getName());
-       
-    }
-    public void buildFromFiles(String[] args) {
-        for( int i=0; i<args.length; ++i) {
-            readFromFile(new File(args[i]));
-        }
-        buildRanges();       
-    }
-    
-    public SvtBiasMyaDumpReader(String[] args) {
-        buildFromFiles(args);
-    }
-    
-    public SvtBiasMyaDumpReader(String filepath) {
-        String[] files = {filepath};
-        buildFromFiles(files);
-    }
-
-    
-    public void addEntry(SvtBiasMyaEntry e) {
-        this.myaEntries.add(e);
-    }
-
-    public void addEntries(List<SvtBiasMyaEntry> e) {
-        this.myaEntries.addAll(e);
-    }
-
-    public List<SvtBiasMyaEntry> getEntries() {
-        return this.myaEntries;
-    }
-
-    public SvtBiasMyaRanges getRanges() {
-        return this.biasRanges;
-    }
-
-    
-    private void printRanges() {
-        for( SvtBiasMyaRange r : biasRanges) {
-            logger.info(r.toString());
-        }
-     }
-    
-    
-    protected static List<SvtBiasMyaEntry> readMyaDump(File file) {
-
-        List<SvtBiasMyaEntry> myaEntries = new ArrayList<SvtBiasMyaEntry>();
+
+    }
+
+    protected static List<SvtBiasMyaEntry> readMyaDump(final File file) {
+
+        final List<SvtBiasMyaEntry> myaEntries = new ArrayList<SvtBiasMyaEntry>();
         try {
 
-            BufferedReader br = new BufferedReader(new FileReader(file));
+            final BufferedReader br = new BufferedReader(new FileReader(file));
             String line;
             while ((line = br.readLine()) != null) {
-                //System.out.println(line);
-                String arr[] = line.split(" ");
+                // System.out.println(line);
+                final String arr[] = line.split(" ");
                 try {
-                    
-                    if(arr.length<3) {
-                        throw new ParseException("this line is not correct.",0);
+
+                    if (arr.length < 3) {
+                        throw new ParseException("this line is not correct.", 0);
                     }
-                    Date date = DATE_FORMAT.parse(arr[0] + " " + arr[1]);
-                    double value = Double.parseDouble(arr[2]);
-                    SvtBiasMyaEntry entry = new SvtBiasMyaEntry(file.getName(), date, value);
+                    final Date date = DATE_FORMAT.parse(arr[0] + " " + arr[1]);
+                    final double value = Double.parseDouble(arr[2]);
+                    final SvtBiasMyaEntry entry = new SvtBiasMyaEntry(file.getName(), date, value);
                     myaEntries.add(entry);
-                } catch (ParseException e) {
+                } catch (final ParseException e) {
                     e.printStackTrace();
                 }
             }
             br.close();
 
-        } catch (IOException e) {
+        } catch (final IOException e) {
             e.printStackTrace();
         }
         return myaEntries;
 
     }
-    
+
+    private final SvtBiasMyaRanges biasRanges = new SvtBiasMyaRanges();
+
+    private final List<SvtBiasMyaEntry> myaEntries = new ArrayList<SvtBiasMyaEntry>();
+
+    public SvtBiasMyaDumpReader() {
+    }
+
+    public SvtBiasMyaDumpReader(final String filepath) {
+        final String[] files = {filepath};
+        this.buildFromFiles(files);
+    }
+
+    public SvtBiasMyaDumpReader(final String[] args) {
+        this.buildFromFiles(args);
+    }
+
+    public void addEntries(final List<SvtBiasMyaEntry> e) {
+        this.myaEntries.addAll(e);
+    }
+
+    public void addEntry(final SvtBiasMyaEntry e) {
+        this.myaEntries.add(e);
+    }
+
+    public void buildFromFiles(final String[] args) {
+        for (final String arg : args) {
+            this.readFromFile(new File(arg));
+        }
+        this.buildRanges();
+    }
+
     public void buildRanges() {
         SvtBiasMyaRange range = null;
         SvtBiasMyaEntry eprev = null;
-        for(SvtBiasMyaEntry e : this.myaEntries) {
-            
-            //System.out.println(e.toString());
-            
-            if(eprev!=null) {
-                if(e.getDate().before(eprev.getDate())) {
+        for (final SvtBiasMyaEntry e : this.myaEntries) {
+
+            // System.out.println(e.toString());
+
+            if (eprev != null) {
+                if (e.getDate().before(eprev.getDate())) {
                     throw new RuntimeException("date list is not ordered: " + eprev.toString() + " vs " + e.toString());
                 }
             }
-            
-            if( e.getValue() > BIASVALUEON) {
-                if (range==null) {
+
+            if (e.getValue() > BIASVALUEON) {
+                if (range == null) {
                     logger.fine("BIAS ON: " + e.toString());
                     range = new SvtBiasMyaRange();
                     range.setStart(e);
-                } 
+                }
             } else {
-                //close it
-                if (range!=null) {
+                // close it
+                if (range != null) {
                     logger.fine("BIAS TURNED OFF: " + e.toString());
                     range.setEnd(e);
                     this.biasRanges.add(range);
                     range = null;
                 }
-            }            
+            }
             eprev = e;
         }
         logger.info("Built " + this.biasRanges.size() + " ranges");
-        
-    }
-    
-    
-    public static final class SvtBiasMyaEntry {
-        private Date date;
-        private String name;
-        private double value;
-        public SvtBiasMyaEntry(String name, Date date, double value) {
-            this.date = date;
-            this.name = name;
-            this.value = value;
-        }
-        public double getValue() {
-            return value;
-        }
-        public Date getDate() {
-            return this.date;
-        }
-        public String toString() {
-            return name + " " + date.toString() + " value " + value;
-        }
-    }
-
-
-    
-    public static final class SvtBiasMyaRanges extends ArrayList<SvtBiasMyaRange> {
-        public SvtBiasMyaRanges() {}
-        public SvtBiasMyaRanges findOverlappingRanges(Date date_start, Date date_end) {
-            logger.fine("look for overlaps from " + date_start.toString() + " to " + date_end.toString());
-            SvtBiasMyaRanges overlaps = new SvtBiasMyaRanges();
-            for(SvtBiasMyaRange range : this) {
-                logger.fine("loop bias range " + range.toString());
-                if( range.overlap(date_start,date_end) ) {
-                    overlaps.add(range);
-                    logger.fine("overlap found!! ");
-                }
-            }
-            return overlaps;
-        }
-        public String toString() {
-            StringBuffer sb = new StringBuffer();
-            for(SvtBiasMyaRange range : this) {
-                sb.append(range.toString() + "\n");
-            }
-            return sb.toString();
-        }
-    }
-    
-    public static class SvtBiasMyaRange {
-        private SvtBiasMyaEntry start;
-        private SvtBiasMyaEntry end;
-        public SvtBiasMyaRange() {}
-        public Date getStartDate() {
-            return getStart().getDate();
-        }
-        public Date getEndDate() {
-            return getEnd().getDate();
-        }
-        public boolean overlap(Date date_start, Date date_end) {
-            if( date_end.before(getStartDate()) ) {
-                return false;
-            } else if ( date_start.after(getEndDate())) {
-                return false;
-            } 
-            return true;
-        }
-        public SvtBiasMyaRange(SvtBiasMyaEntry start) {
-            this.start = start;
-        }
-        public SvtBiasMyaEntry getEnd() {
-            return end;
-        }
-        public void setEnd(SvtBiasMyaEntry end) {
-            this.end = end;
-        }
-        public SvtBiasMyaEntry getStart() {
-            return start;
-        }
-        public void setStart(SvtBiasMyaEntry start) {
-            this.start = start;
-        }
-        public String toString() {
-            return "START: " + start.toString() + "   END: " + end.toString();
-        }
-    }
-    
-    public static final class SvtBiasRunRange {
-        private RunData run;
-        private SvtBiasMyaRanges ranges;
-        public SvtBiasRunRange(RunData run, SvtBiasMyaRanges ranges) {
-            setRun(run);
-            setRanges(ranges);
-        }
-        public RunData getRun() {
-            return run;
-        }
-        public void setRun(RunData run) {
-            this.run = run;
-        }
-        public SvtBiasMyaRanges getRanges() {
-            return ranges;
-        }
-        public void setRanges(SvtBiasMyaRanges ranges) {
-            this.ranges = ranges;
-        }
-        public String toString() {
-            StringBuffer sb  = new StringBuffer();
-            sb.append("\nRun " + run.toString() + ":");
-            for (SvtBiasMyaRange r : ranges) {
-                sb.append("\n" + r.toString());
-            }
-            return sb.toString();
-        }
-    }
-    
+
+    }
+
+    public SvtBiasMyaRanges findOverlappingRanges(final Date date_start, final Date date_end) {
+        return this.biasRanges.findOverlappingRanges(date_start, date_end);
+    }
+
+    public List<SvtBiasMyaEntry> getEntries() {
+        return this.myaEntries;
+    }
+
+    public SvtBiasMyaRanges getRanges() {
+        return this.biasRanges;
+    }
+
+    private void printRanges() {
+        for (final SvtBiasMyaRange r : this.biasRanges) {
+            logger.info(r.toString());
+        }
+    }
+
+    private void readFromFile(final File file) {
+        this.addEntries(readMyaDump(file));
+        logger.info("Got " + this.getEntries().size() + " entries from " + file.getName());
+
+    }
 
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java	Mon Jul  6 12:03:16 2015
@@ -1,4 +1,6 @@
 package org.hps.conditions.svt;
+
+import static org.hps.conditions.svt.AbstractSvtChannel.MAX_NUMBER_OF_SAMPLES;
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
@@ -7,13 +9,11 @@
 import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
-import static org.hps.conditions.svt.SvtChannel.MAX_NUMBER_OF_SAMPLES;
-
 /**
  * This class encapsulates noise and pedestal measurement for an SVT channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"svt_calibrations", "test_run_svt_calibrations"})
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_UPDATED)
@@ -48,7 +48,7 @@
      */
     @Field(names = {"svt_channel_id"})
     public Integer getChannelID() {
-        return getFieldValue("svt_channel_id");
+        return this.getFieldValue("svt_channel_id");
     }
 
     /**
@@ -62,7 +62,7 @@
         if (sample < 0 || sample > MAX_NUMBER_OF_SAMPLES) {
             throw new IllegalArgumentException("Sample number is not within range.");
         }
-        return getFieldValue(Double.class, "noise_" + Integer.toString(sample));
+        return this.getFieldValue(Double.class, "noise_" + Integer.toString(sample));
     }
 
     /**
@@ -76,7 +76,7 @@
         if (sample < 0 || sample > MAX_NUMBER_OF_SAMPLES) {
             throw new IllegalArgumentException("Sample number is not within range.");
         }
-        return getFieldValue(Double.class, "pedestal_" + Integer.toString(sample));
+        return this.getFieldValue(Double.class, "pedestal_" + Integer.toString(sample));
     }
 
     /**
@@ -116,6 +116,7 @@
      * @return This object converted to a string.
      */
     // FIXME: This is a mess when it prints to console.
+    @Override
     public String toString() {
         final StringBuffer buffer = new StringBuffer();
         buffer.append("Channel ID: " + this.getChannelID());

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	Mon Jul  6 12:03:16 2015
@@ -4,75 +4,18 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 
 /**
  * This class represents SVT channel setup information, including FEB ID, FEB Hybrid ID, and channel numbers.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"svt_channels"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtChannel extends AbstractSvtChannel {
-
-    /**
-     * Maximum channel number.
-     */
-    private static final int MAX_CHANNEL = 639;
-
-    /**
-     * Minimum channel number.
-     */
-    private static final int MIN_CHANNEL = 0;
-
-    /**
-     * Maximum FEB Hybrid ID.
-     */
-    private static final int MAX_FEB_HYBRID_ID = 3;
-
-    /**
-     * Minimum FEB hybrid ID.
-     */
-    private static final int MIN_FEB_HYBRID_ID = 0;
-
-    /**
-     * Maximum FEB ID.
-     */
-    private static final int MAX_FEB_ID = 9;
-
-    /**
-     * Minimum FEB ID.
-     */
-    private static final int MIN_FEB_ID = 0;
-
-    /**
-     * Default constructor.
-     */
-    public SvtChannel() {
-    }
-
-    /**
-     * Fully qualified constructor.
-     *
-     * @param channelID the SVT channel ID
-     * @param febID the Front End Board (FEB) ID (0-9)
-     * @param febHybridID the hybrid ID (0-3)
-     * @param channel the channel number (0-639)
-     */
-    public SvtChannel(final int channelID, final int febID, final int febHybridID, final int channel) {
-        if (!this.isValidFeb(febID) || !this.isValidFebHybridID(febHybridID) || !this.isValidPhysicalChannel(channel)) {
-            throw new RuntimeException("Invalid FEB ID, FEB hybrid ID or physical channel number is being used.");
-        }
-        this.setChannelID(channelID);
-        this.setFebID(febID);
-        this.setFebHybridID(febHybridID);
-        this.setChannel(channel);
-    }
 
     /**
      * Collection implementation for {@link SvtChannel}.
@@ -120,71 +63,57 @@
     }
 
     /**
-     * Get the FEB ID associated with this SVT channel ID.
-     *
-     * @return The FEB ID.
-     */
-    @Field(names = {"feb_id"})
-    public Integer getFebID() {
-        return getFieldValue("feb_id");
-    }
-
-    /**
-     * Get the FEB hybrid ID associated with this SVT channel ID.
-     *
-     * @return The FEB hybrid ID.
-     */
-    @Field(names = {"feb_hybrid_id"})
-    public Integer getFebHybridID() {
-        return getFieldValue("feb_hybrid_id");
-    }
-
-    /**
-     * Set the FEB ID associated with this SVT channel ID.
-     *
-     * @param febID the FEB ID
-     */
-    public void setFebID(final int febID) {
-        this.setFieldValue("feb_id", febID);
-    }
-
-    /**
-     * Set the FEB hybrid ID associated with this SVT channel ID.
-     *
-     * @param febHybridID : The FEB hybrid ID
-     */
-    public void setFebHybridID(final int febHybridID) {
-        this.setFieldValue("feb_hybrid_id", febHybridID);
-    }
-
-    /**
-     * Checks if a FEB ID is valid.
-     *
-     * @param febID the Front End Board (FEB) ID
-     * @return <code>true</code> if the FEB ID lies within the range 0-9
-     */
-    public boolean isValidFeb(final int febID) {
-        return febID >= MIN_FEB_ID && febID <= MAX_FEB_ID ? true : false;
-    }
-
-    /**
-     * Checks if a Front End Board hybrid ID is valid.
-     *
-     * @param febHybridID the hybrid ID
-     * @return <code>true</code> if the hybrid ID lies within the range 0-3
-     */
-    public boolean isValidFebHybridID(final int febHybridID) {
-        return febHybridID >= MIN_FEB_HYBRID_ID && febHybridID <= MAX_FEB_HYBRID_ID ? true : false;
-    }
-
-    /**
-     * Checks if a physical channel number is valid.
-     *
-     * @param channel the physical channel number
-     * @return <code>true</code> if the channel number lies within the range 0-639
-     */
-    public boolean isValidPhysicalChannel(final int channel) {
-        return channel >= MIN_CHANNEL && channel <= MAX_CHANNEL ? true : false;
+     * Maximum channel number.
+     */
+    private static final int MAX_CHANNEL = 639;
+
+    /**
+     * Maximum FEB Hybrid ID.
+     */
+    private static final int MAX_FEB_HYBRID_ID = 3;
+
+    /**
+     * Maximum FEB ID.
+     */
+    private static final int MAX_FEB_ID = 9;
+
+    /**
+     * Minimum channel number.
+     */
+    private static final int MIN_CHANNEL = 0;
+
+    /**
+     * Minimum FEB hybrid ID.
+     */
+    private static final int MIN_FEB_HYBRID_ID = 0;
+
+    /**
+     * Minimum FEB ID.
+     */
+    private static final int MIN_FEB_ID = 0;
+
+    /**
+     * Default constructor.
+     */
+    public SvtChannel() {
+    }
+
+    /**
+     * Fully qualified constructor.
+     *
+     * @param channelID the SVT channel ID
+     * @param febID the Front End Board (FEB) ID (0-9)
+     * @param febHybridID the hybrid ID (0-3)
+     * @param channel the channel number (0-639)
+     */
+    public SvtChannel(final int channelID, final int febID, final int febHybridID, final int channel) {
+        if (!this.isValidFeb(febID) || !this.isValidFebHybridID(febHybridID) || !this.isValidPhysicalChannel(channel)) {
+            throw new RuntimeException("Invalid FEB ID, FEB hybrid ID or physical channel number is being used.");
+        }
+        this.setChannelID(channelID);
+        this.setFebID(febID);
+        this.setFebHybridID(febHybridID);
+        this.setChannel(channel);
     }
 
     /**
@@ -204,7 +133,75 @@
             return true;
         }
         final SvtChannel channel = (SvtChannel) o;
-        return getChannelID() == channel.getChannelID() && getFebID() == channel.getFebID()
-                && getFebHybridID() == channel.getFebHybridID() && getChannel() == channel.getChannel();
+        return this.getChannelID() == channel.getChannelID() && this.getFebID() == channel.getFebID()
+                && this.getFebHybridID() == channel.getFebHybridID() && this.getChannel() == channel.getChannel();
+    }
+
+    /**
+     * Get the FEB hybrid ID associated with this SVT channel ID.
+     *
+     * @return The FEB hybrid ID.
+     */
+    @Field(names = {"feb_hybrid_id"})
+    public Integer getFebHybridID() {
+        return this.getFieldValue("feb_hybrid_id");
+    }
+
+    /**
+     * Get the FEB ID associated with this SVT channel ID.
+     *
+     * @return The FEB ID.
+     */
+    @Field(names = {"feb_id"})
+    public Integer getFebID() {
+        return this.getFieldValue("feb_id");
+    }
+
+    /**
+     * Checks if a FEB ID is valid.
+     *
+     * @param febID the Front End Board (FEB) ID
+     * @return <code>true</code> if the FEB ID lies within the range 0-9
+     */
+    public boolean isValidFeb(final int febID) {
+        return febID >= MIN_FEB_ID && febID <= MAX_FEB_ID ? true : false;
+    }
+
+    /**
+     * Checks if a Front End Board hybrid ID is valid.
+     *
+     * @param febHybridID the hybrid ID
+     * @return <code>true</code> if the hybrid ID lies within the range 0-3
+     */
+    public boolean isValidFebHybridID(final int febHybridID) {
+        return febHybridID >= MIN_FEB_HYBRID_ID && febHybridID <= MAX_FEB_HYBRID_ID ? true : false;
+    }
+
+    /**
+     * Checks if a physical channel number is valid.
+     *
+     * @param channel the physical channel number
+     * @return <code>true</code> if the channel number lies within the range 0-639
+     */
+    public boolean isValidPhysicalChannel(final int channel) {
+        return channel >= MIN_CHANNEL && channel <= MAX_CHANNEL ? true : false;
+    }
+
+    /**
+     * Set the FEB hybrid ID associated with this SVT channel ID.
+     *
+     * @param febHybridID : The FEB hybrid ID
+     */
+    public void setFebHybridID(final int febHybridID) {
+        this.setFieldValue("feb_hybrid_id", febHybridID);
+    }
+
+    /**
+     * Set the FEB ID associated with this SVT channel ID.
+     *
+     * @param febID the FEB ID
+     */
+    public void setFebID(final int febID) {
+        this.setFieldValue("feb_id", febID);
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java	Mon Jul  6 12:03:16 2015
@@ -6,14 +6,12 @@
 import org.hps.conditions.svt.SvtDaqMapping.SvtDaqMappingCollection;
 import org.hps.conditions.svt.SvtT0Shift.SvtT0ShiftCollection;
 
-// TODO: Move all constants to their own class
-
 /**
  * This class contains all test run SVT conditions data by readout channel. {@link SvtChannel} objects from the SVT
  * channel map can be used to lookup the conditions for individual channels.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public final class SvtConditions extends AbstractSvtConditions {
 
@@ -117,7 +115,7 @@
         for (final SvtChannel channel : this.getChannelMap()) {
 
             // Get the conditions for the channel.
-            final ChannelConstants constants = getChannelConstants(channel);
+            final ChannelConstants constants = this.getChannelConstants(channel);
             final SvtGain gain = constants.getGain();
             final SvtShapeFitParameters shapeFit = constants.getShapeFitParameters();
             final SvtCalibration calibration = constants.getCalibration();
@@ -153,7 +151,7 @@
         buff.append("Printing SVT DAQ Map...");
         buff.append('\n');
         buff.append('\n');
-        buff.append(getDaqMap());
+        buff.append(this.getDaqMap());
 
         return buff.toString();
     }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsConverter.java	Mon Jul  6 12:03:16 2015
@@ -10,8 +10,8 @@
  * This class creates an {@link SvtConditions} object from the database, based on the current run number known by the
  * conditions manager.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public final class SvtConditionsConverter extends AbstractSvtConditionsConverter<SvtConditions> {
 
@@ -39,26 +39,26 @@
 
         // Create the SVT conditions object to use to encapsulate SVT condition
         // collections
-        conditions.setChannelMap(channels);
+        this.conditions.setChannelMap(channels);
 
         // Get the DAQ map from the conditions database
         final SvtDaqMappingCollection daqMap = dbConditionsManager.getCachedConditions(SvtDaqMappingCollection.class,
                 "svt_daq_map").getCachedData();
-        conditions.setDaqMap(daqMap);
+        this.conditions.setDaqMap(daqMap);
 
         // Get the collection of T0 shifts from the conditions database
         final SvtT0ShiftCollection t0Shifts = dbConditionsManager.getCachedConditions(SvtT0ShiftCollection.class,
                 "svt_t0_shifts").getCachedData();
-        conditions.setT0Shifts(t0Shifts);
+        this.conditions.setT0Shifts(t0Shifts);
 
-        conditions = super.getData(manager, name);
+        this.conditions = super.getData(manager, name);
 
-        return conditions;
+        return this.conditions;
     }
 
     /**
      * Get the type handled by this converter.
-     * 
+     *
      * @return The type handled by this converter.
      */
     @Override

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsLoader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsLoader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsLoader.java	Mon Jul  6 12:03:16 2015
@@ -23,7 +23,7 @@
 /**
  * Command line tool used to load SVT conditions into the conditions database.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public final class SvtConditionsLoader {
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsReader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsReader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConditionsReader.java	Mon Jul  6 12:03:16 2015
@@ -12,7 +12,7 @@
 /**
  * Reader used to parse SVT conditions.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public final class SvtConditionsReader {
 

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtConfiguration.java	Mon Jul  6 12:03:16 2015
@@ -20,7 +20,7 @@
 /**
  * This class is the conditions object model for an SVT configuration saved into the database.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"svt_configurations"})
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_UPDATED)
@@ -34,13 +34,18 @@
     }
 
     /**
-     * Get the filename associated with this configuration.
+     * Convert the raw database content for the configuration into an XML document.
      *
-     * @return The filename associated with the configuration.
+     * @return The Document created from the raw data.
+     * @throws IOException if there is an IO error
+     * @throws JDOMException is there is an XML parsing error
      */
-    @Field(names = {"filename"})
-    public String getFileName() {
-        return getFieldValue("filename");
+    public Document createDocument() throws IOException, JDOMException {
+        final byte[] bytes = this.getFieldValue("content");
+        final InputStream inputStream = new ByteArrayInputStream(bytes);
+        final SAXBuilder builder = new SAXBuilder();
+        builder.setValidation(false);
+        return builder.build(inputStream);
     }
 
     /**
@@ -50,22 +55,30 @@
      */
     @Field(names = {"content"})
     public byte[] getContent() {
-        return getFieldValue("content");
+        return this.getFieldValue("content");
     }
 
     /**
-     * Convert the raw database content for the configuration into an XML document.
+     * Get the filename associated with this configuration.
      *
-     * @return The Document created from the raw data.
-     * @throws IOException if there is an IO error
-     * @throws JDOMException is there is an XML parsing error
+     * @return The filename associated with the configuration.
      */
-    public Document createDocument() throws IOException, JDOMException {
-        final byte[] bytes = getFieldValue("content");
-        final InputStream inputStream = new ByteArrayInputStream(bytes);
-        final SAXBuilder builder = new SAXBuilder();
-        builder.setValidation(false);
-        return builder.build(inputStream);
+    @Field(names = {"filename"})
+    public String getFileName() {
+        return this.getFieldValue("filename");
+    }
+
+    /**
+     * Save this configuration to a local file on disk using its name from the database.
+     */
+    public void writeToFile() {
+        final XMLOutputter out = new XMLOutputter();
+        out.setFormat(Format.getPrettyFormat());
+        try {
+            out.output(this.createDocument(), new FileWriter(this.getFileName()));
+        } catch (IOException | JDOMException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /**
@@ -77,20 +90,7 @@
         final XMLOutputter out = new XMLOutputter();
         out.setFormat(Format.getPrettyFormat());
         try {
-            out.output(createDocument(), new FileWriter(filename));
-        } catch (IOException | JDOMException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    /**
-     * Save this configuration to a local file on disk using its name from the database.
-     */
-    public void writeToFile() {
-        final XMLOutputter out = new XMLOutputter();
-        out.setFormat(Format.getPrettyFormat());
-        try {
-            out.output(createDocument(), new FileWriter(getFileName()));
+            out.output(this.createDocument(), new FileWriter(filename));
         } catch (IOException | JDOMException e) {
             throw new RuntimeException(e);
         }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java	Mon Jul  6 12:03:16 2015
@@ -1,8 +1,6 @@
 package org.hps.conditions.svt;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 import org.lcsim.detector.tracker.silicon.HpsSiSensor;
@@ -10,11 +8,10 @@
 /**
  * This class encapsulates the SVT DAQ map.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"svt_daq_map"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public class SvtDaqMapping extends AbstractSvtDaqMapping {
 
     /**
@@ -138,7 +135,7 @@
      */
     @Field(names = {"feb_hybrid_id"})
     public final Integer getFebHybridID() {
-        return getFieldValue("feb_hybrid_id");
+        return this.getFieldValue("feb_hybrid_id");
     }
 
     /**
@@ -148,7 +145,7 @@
      */
     @Field(names = {"feb_id"})
     public final Integer getFebID() {
-        return getFieldValue("feb_id");
+        return this.getFieldValue("feb_id");
     }
 
     /**
@@ -160,7 +157,7 @@
      */
     @Field(names = {"side"})
     public final String getSide() {
-        return getFieldValue("side");
+        return this.getFieldValue("side");
     }
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	Mon Jul  6 12:03:16 2015
@@ -21,15 +21,19 @@
 import org.lcsim.util.log.LogUtil;
 
 /**
- * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code>
- * objects.
+ * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code> objects.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public final class SvtDetectorSetup implements ConditionsListener {
 
     /**
+     * Initialize logger.
+     */
+    private static Logger logger = LogUtil.create(SvtDetectorSetup.class);
+
+    /**
      * The number of noise samples.
      */
     private static final int NOISE_COUNT = 6;
@@ -40,19 +44,14 @@
     private static final int PEDESTAL_COUNT = 6;
 
     /**
-     * Initialize logger.
-     */
-    private static Logger logger = LogUtil.create(SvtDetectorSetup.class);
+     * Flag to enable/disable this class from within conditions manager.
+     */
+    private boolean enabled = true;
 
     /**
      * The name of the SVT subdetector in the detector model.
      */
     private String svtName = "Tracker";
-
-    /**
-     * Flag to enable/disable this class from within conditions manager.
-     */
-    private boolean enabled = true;
 
     /**
      * Constructor that takes name of SVT.
@@ -64,57 +63,28 @@
     }
 
     /**
-     * Set the name of the SVT in the detector model.
-     *
-     * @param svtName the name of the SVt in the detector model.
-     */
-    public void setSvtName(final String svtName) {
-        this.svtName = svtName;
-    }
-
-    /**
-     * Set whether this class is enabled to be activated on conditions changes.
-     *
-     * @param enabled <code>true</code> to enable
-     */
-    public void setEnabled(final boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    /**
-     * Set the log level.
-     *
-     * @param level the log level
-     */
-    public void setLogLevel(final Level level) {
-        logger.setLevel(level);
-        logger.getHandlers()[0].setLevel(level);
-    }
-
-    /**
-     * Hook that activates this class when conditions change (new detector or
-     * run number).
+     * Hook that activates this class when conditions change (new detector or run number).
      *
      * @param event the conditions event
      */
     @Override
     public void conditionsChanged(final ConditionsEvent event) {
-        if (enabled) {
+        if (this.enabled) {
             final DatabaseConditionsManager manager = (DatabaseConditionsManager) event.getConditionsManager();
-            final Subdetector subdetector = manager.getDetectorObject().getSubdetector(svtName);
+            final Subdetector subdetector = manager.getDetectorObject().getSubdetector(this.svtName);
             if (subdetector != null) {
                 if (manager.isTestRun()) {
                     final TestRunSvtConditions svtConditions = manager.getCachedConditions(TestRunSvtConditions.class,
                             "test_run_svt_conditions").getCachedData();
-                    loadTestRun(subdetector, svtConditions);
+                    this.loadTestRun(subdetector, svtConditions);
                 } else {
                     final SvtConditions svtConditions = manager.getCachedConditions(SvtConditions.class,
                             "svt_conditions").getCachedData();
-                    loadDefault(subdetector, svtConditions);
+                    this.loadDefault(subdetector, svtConditions);
                 }
             } else {
                 logger.warning("no SVT detector was found so SvtDetectorSetup was NOT activated");
-                enabled = false;
+                this.enabled = false;
             }
         } else {
             logger.config("disabled");
@@ -140,7 +110,7 @@
         final SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
 
         // Loop over sensors.
-        for (HpsSiSensor sensor : sensors) {
+        for (final HpsSiSensor sensor : sensors) {
 
             // Reset possible existing conditions data on sensor.
             sensor.reset();
@@ -159,9 +129,9 @@
 
             // Set the orientation of the sensor
             final String orientation = daqMap.getOrientation(daqPair);
-            if (orientation != null && orientation.contentEquals(SvtDaqMapping.AXIAL)) {
+            if (orientation != null && orientation.contentEquals(AbstractSvtDaqMapping.AXIAL)) {
                 sensor.setAxial(true);
-            } else if (orientation != null && orientation.contains(SvtDaqMapping.STEREO)) {
+            } else if (orientation != null && orientation.contains(AbstractSvtDaqMapping.STEREO)) {
                 sensor.setStereo(true);
             }
 
@@ -169,7 +139,7 @@
             final Collection<SvtChannel> channels = channelMap.find(daqPair);
 
             // Loop over the channels of the sensor.
-            for (SvtChannel channel : channels) {
+            for (final SvtChannel channel : channels) {
 
                 // Get conditions data for this channel.
                 final ChannelConstants constants = conditions.getChannelConstants(channel);
@@ -205,7 +175,8 @@
             // Set the t0 shift for the sensor.
             final SvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair);
             if (sensorT0Shift == null) {
-                throw new RuntimeException("Failed to find T0 shift for sensor: " + sensor.getName() + ", FEB hybrid ID " + daqPair.getFirstElement() + ", FEB ID " + daqPair.getSecondElement());
+                throw new RuntimeException("Failed to find T0 shift for sensor: " + sensor.getName()
+                        + ", FEB hybrid ID " + daqPair.getFirstElement() + ", FEB ID " + daqPair.getSecondElement());
             }
             sensor.setT0Shift(sensorT0Shift.getT0Shift());
         }
@@ -230,7 +201,7 @@
         final TestRunSvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
 
         // Loop over sensors.
-        for (HpsSiSensor sensor : sensors) {
+        for (final HpsSiSensor sensor : sensors) {
 
             // Reset possible existing conditions data on sensor.
             sensor.reset();
@@ -249,9 +220,9 @@
 
             // Set the orientation of the sensor
             final String orientation = daqMap.getOrientation(daqPair);
-            if (orientation != null && orientation.contentEquals(TestRunSvtDaqMapping.AXIAL)) {
+            if (orientation != null && orientation.contentEquals(AbstractSvtDaqMapping.AXIAL)) {
                 sensor.setAxial(true);
-            } else if (orientation != null && orientation.contains(TestRunSvtDaqMapping.STEREO)) {
+            } else if (orientation != null && orientation.contains(AbstractSvtDaqMapping.STEREO)) {
                 sensor.setStereo(true);
             }
 
@@ -259,7 +230,7 @@
             final Collection<TestRunSvtChannel> channels = channelMap.find(daqPair);
 
             // Loop over the channels of the sensor.
-            for (TestRunSvtChannel channel : channels) {
+            for (final TestRunSvtChannel channel : channels) {
 
                 // Get conditions data for this channel.
                 final ChannelConstants constants = conditions.getChannelConstants(channel);
@@ -277,7 +248,7 @@
                 // channel
                 final double[] pedestal = new double[6];
                 final double[] noise = new double[6];
-                for (int sampleN = 0; sampleN < HpsTestRunSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
+                for (int sampleN = 0; sampleN < HpsSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
                     pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
                     noise[sampleN] = constants.getCalibration().getNoise(sampleN);
                 }
@@ -297,4 +268,32 @@
             sensor.setT0Shift(sensorT0Shift.getT0Shift());
         }
     }
+
+    /**
+     * Set whether this class is enabled to be activated on conditions changes.
+     *
+     * @param enabled <code>true</code> to enable
+     */
+    public void setEnabled(final boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    /**
+     * Set the log level.
+     *
+     * @param level the log level
+     */
+    public void setLogLevel(final Level level) {
+        logger.setLevel(level);
+        logger.getHandlers()[0].setLevel(level);
+    }
+
+    /**
+     * Set the name of the SVT in the detector model.
+     *
+     * @param svtName the name of the SVt in the detector model.
+     */
+    public void setSvtName(final String svtName) {
+        this.svtName = svtName;
+    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtGain.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtGain.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtGain.java	Mon Jul  6 12:03:16 2015
@@ -2,18 +2,15 @@
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * This class represents the signal gain measurement for a single SVT channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"svt_gains", "test_run_svt_gains"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtGain extends BaseConditionsObject {
 
     /**
@@ -30,7 +27,7 @@
      */
     @Field(names = {"svt_channel_id"})
     public Integer getChannelID() {
-        return getFieldValue(Integer.class, "svt_channel_id");
+        return this.getFieldValue(Integer.class, "svt_channel_id");
     }
 
     /**
@@ -40,7 +37,7 @@
      */
     @Field(names = {"gain"})
     public Double getGain() {
-        return getFieldValue(Double.class, "gain");
+        return this.getFieldValue(Double.class, "gain");
     }
 
     /**
@@ -50,6 +47,6 @@
      */
     @Field(names = {"offset"})
     public Double getOffset() {
-        return getFieldValue(Double.class, "offset");
+        return this.getFieldValue(Double.class, "offset");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtShapeFitParameters.java	Mon Jul  6 12:03:16 2015
@@ -2,20 +2,16 @@
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
  * This class encapsulates the shape fit parameters for an SVT channel.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"svt_shape_fit_parameters", "test_run_svt_shape_fit_parameters"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
-// TODO: This class needs better documentation as to what these parameters actually mean.
 public final class SvtShapeFitParameters extends BaseConditionsObject {
 
     /**
@@ -37,7 +33,7 @@
      */
     @Field(names = {"amplitude"})
     public Double getAmplitude() {
-        return getFieldValue(Double.class, "amplitude");
+        return this.getFieldValue(Double.class, "amplitude");
     }
 
     /**
@@ -47,7 +43,7 @@
      */
     @Field(names = {"svt_channel_id"})
     public Integer getChannelID() {
-        return getFieldValue(Integer.class, "svt_channel_id");
+        return this.getFieldValue(Integer.class, "svt_channel_id");
     }
 
     /**
@@ -57,7 +53,7 @@
      */
     @Field(names = {"t0"})
     public Double getT0() {
-        return getFieldValue(Double.class, "t0");
+        return this.getFieldValue(Double.class, "t0");
     }
 
     /**
@@ -67,7 +63,7 @@
      */
     @Field(names = {"tp"})
     public Double getTp() {
-        return getFieldValue(Double.class, "tp");
+        return this.getFieldValue(Double.class, "tp");
     }
 
     /**
@@ -77,7 +73,7 @@
      */
     @Field(names = {"tp2"})
     public Double getTp2() {
-        return getFieldValue(Double.class, "tp2");
+        return this.getFieldValue(Double.class, "tp2");
     }
 
     /**
@@ -87,10 +83,10 @@
      */
     public double[] toArray() {
         final double[] values = new double[ARRAY_SIZE];
-        values[0] = getAmplitude();
-        values[1] = getT0();
-        values[2] = getTp();
-        values[3] = getTp2();
+        values[0] = this.getAmplitude();
+        values[1] = this.getT0();
+        values[2] = this.getTp();
+        values[3] = this.getTp2();
         return values;
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java	Mon Jul  6 12:03:16 2015
@@ -1,8 +1,6 @@
 package org.hps.conditions.svt;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 
@@ -10,11 +8,10 @@
  * This class is a data holder for associating a t0 time shift with a specific sensor by DAQ pair (FEB ID and FEB hybrid
  * ID).
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"svt_t0_shifts"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtT0Shift extends AbstractSvtT0Shift {
 
     /**
@@ -43,22 +40,22 @@
     }
 
     /**
+     * Get the FEB hybrid ID.
+     *
+     * @return the FEB hybrid ID
+     */
+    @Field(names = {"feb_hybrid_id"})
+    public Integer getFebHybridID() {
+        return this.getFieldValue("feb_hybrid_id");
+    }
+
+    /**
      * Get the FEB ID.
      *
      * @return the FEB ID
      */
     @Field(names = {"feb_id"})
     public Integer getFebID() {
-        return getFieldValue("feb_id");
-    }
-
-    /**
-     * Get the FEB hybrid ID.
-     *
-     * @return the FEB hybrid ID
-     */
-    @Field(names = {"feb_hybrid_id"})
-    public Integer getFebHybridID() {
-        return getFieldValue("feb_hybrid_id");
+        return this.getFieldValue("feb_id");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstants.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstants.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstants.java	Mon Jul  6 12:03:16 2015
@@ -2,9 +2,7 @@
 
 import org.hps.conditions.api.BaseConditionsObject;
 import org.hps.conditions.api.BaseConditionsObjectCollection;
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 
 /**
@@ -12,10 +10,9 @@
  * <p>
  * There will generally be only one of these records per run.
  *
- * @author Jeremy McCormick
+ * @author Jeremy McCormick, SLAC
  */
 @Table(names = {"svt_timing_constants"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtTimingConstants extends BaseConditionsObject {
 
     /**

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstantsLoader.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstantsLoader.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/SvtTimingConstantsLoader.java	Mon Jul  6 12:03:16 2015
@@ -19,10 +19,10 @@
 /**
  * Load SVT timing constant data from the run spreadsheet and insert into the conditions database.
  * <p>
- * Be very careful about running this, because it will create many new conditions records that may already be present in the database. In fact, don't
- * run this at all without talking to me first. :-)
+ * Be very careful about running this, because it will create many new conditions records that may already be present in
+ * the database. In fact, don't run this at all without talking to me first. :-)
  *
- * @author Jeremy McCormick
+ * @author Jeremy McCormick, SLAC
  */
 public final class SvtTimingConstantsLoader {
 
@@ -61,7 +61,7 @@
             final SvtTimingConstantsCollection collection = new SvtTimingConstantsCollection();
             try {
                 collection.add(timing);
-            } catch (ConditionsObjectException e) {
+            } catch (final ConditionsObjectException e) {
                 throw new RuntimeException(e);
             }
             collections.add(collection);
@@ -79,8 +79,8 @@
      * @param offsetTime the offset time
      * @return the matching collection or <code>null</code> if not found
      */
-    private static SvtTimingConstantsCollection findCollection(final List<SvtTimingConstantsCollection> timingConstantsList, final int offsetPhase,
-            final double offsetTime) {
+    private static SvtTimingConstantsCollection findCollection(
+            final List<SvtTimingConstantsCollection> timingConstantsList, final int offsetPhase, final double offsetTime) {
         for (final SvtTimingConstantsCollection collection : timingConstantsList) {
             if (collection.find(offsetPhase, offsetTime) != null) {
                 return collection;
@@ -107,8 +107,8 @@
         final List<Collection<String>> uniqueValues = RunRange.getUniqueValues(ranges);
 
         /*
-         * System.out.println("unique values ..."); for (Collection<String> collection : uniqueValues) { for (String value : collection) {
-         * System.out.print(value + " "); } System.out.println(); }
+         * System.out.println("unique values ..."); for (Collection<String> collection : uniqueValues) { for (String
+         * value : collection) { System.out.print(value + " "); } System.out.println(); }
          */
 
         // Create a new collection for each unique combination set of timing constants.
@@ -138,7 +138,8 @@
             // Find the matching timing constants collection to use.
             final SvtTimingConstantsCollection collection = findCollection(collections, offsetPhase, offsetTime);
             if (collection != null) {
-                System.out.println("offset_phase : " + collection.get(0).getOffsetPhase() + ", offset_time: " + collection.get(0).getOffsetTime());
+                System.out.println("offset_phase : " + collection.get(0).getOffsetPhase() + ", offset_time: "
+                        + collection.get(0).getOffsetTime());
             }
 
             // Create a new conditions record with the run range.

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtChannel.java	Mon Jul  6 12:03:16 2015
@@ -4,19 +4,16 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 
 /**
  * The implementation of {@link AbstractSvtChannel} for Test Run conditions.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"test_run_svt_channels"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class TestRunSvtChannel extends AbstractSvtChannel {
 
     /**
@@ -47,26 +44,6 @@
     }
 
     /**
-     * Get the FPGA ID.
-     *
-     * @return the FPGA ID
-     */
-    @Field(names = {"fpga"})
-    public Integer getFpgaID() {
-        return getFieldValue("fpga");
-    }
-
-    /**
-     * Get the hybrid ID.
-     *
-     * @return the hybrid ID
-     */
-    @Field(names = {"hybrid"})
-    public Integer getHybridID() {
-        return getFieldValue("hybrid");
-    }
-
-    /**
      * Implementation of equals.
      *
      * @param o the other object
@@ -84,7 +61,27 @@
             return true;
         }
         final TestRunSvtChannel channel = (TestRunSvtChannel) o;
-        return getChannelID() == channel.getChannelID() && getFpgaID() == channel.getFpgaID()
-                && getHybridID() == channel.getHybridID() && getChannel() == channel.getChannel();
+        return this.getChannelID() == channel.getChannelID() && this.getFpgaID() == channel.getFpgaID()
+                && this.getHybridID() == channel.getHybridID() && this.getChannel() == channel.getChannel();
+    }
+
+    /**
+     * Get the FPGA ID.
+     *
+     * @return the FPGA ID
+     */
+    @Field(names = {"fpga"})
+    public Integer getFpgaID() {
+        return this.getFieldValue("fpga");
+    }
+
+    /**
+     * Get the hybrid ID.
+     *
+     * @return the hybrid ID
+     */
+    @Field(names = {"hybrid"})
+    public Integer getHybridID() {
+        return this.getFieldValue("hybrid");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditions.java	Mon Jul  6 12:03:16 2015
@@ -13,8 +13,8 @@
  * SVT channel map should be used to lookup the conditions using the {@link #getChannelConstants(TestRunSvtChannel)}
  * method.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 public final class TestRunSvtConditions extends AbstractSvtConditions {
 
@@ -24,6 +24,16 @@
     private static final int DIVIDER_LEN = 115;
 
     /**
+     * Get the {@link TestRunSvtChannelCollection} for this set of conditions.
+     *
+     * @return The SVT channel map.
+     */
+    @Override
+    public TestRunSvtChannelCollection getChannelMap() {
+        return (TestRunSvtChannelCollection) this.channelMap;
+    }
+
+    /**
      * Get the {@link TestRunSvtDaqMappingCollection} associated with these conditions.
      *
      * @return The SVT DAQ map.
@@ -31,16 +41,6 @@
     @Override
     public TestRunSvtDaqMappingCollection getDaqMap() {
         return (TestRunSvtDaqMappingCollection) this.daqMap;
-    }
-
-    /**
-     * Get the {@link TestRunSvtChannelCollection} for this set of conditions.
-     *
-     * @return The SVT channel map.
-     */
-    @Override
-    public TestRunSvtChannelCollection getChannelMap() {
-        return (TestRunSvtChannelCollection) this.channelMap;
     }
 
     /**
@@ -125,7 +125,7 @@
             System.out.println("Channel: " + channel.toString());
 
             // Get the conditions for the channel.
-            final ChannelConstants constants = getChannelConstants(channel);
+            final ChannelConstants constants = this.getChannelConstants(channel);
             final SvtGain gain = constants.getGain();
             final SvtShapeFitParameters shapeFit = constants.getShapeFitParameters();
             final SvtCalibration calibration = constants.getCalibration();
@@ -161,7 +161,7 @@
         buff.append("Printing SVT DAQ Map...");
         buff.append('\n');
         buff.append('\n');
-        buff.append(getDaqMap());
+        buff.append(this.getDaqMap());
 
         return buff.toString();
     }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtConditionsConverter.java	Mon Jul  6 12:03:16 2015
@@ -14,7 +14,7 @@
 /**
  * Converter for combined Test Run SVT conditions {@link TestRunSvtConditions} object.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class TestRunSvtConditionsConverter extends AbstractSvtConditionsConverter<TestRunSvtConditions> {
 
@@ -23,48 +23,6 @@
      */
     public TestRunSvtConditionsConverter() {
         this.conditions = new TestRunSvtConditions();
-    }
-
-    /**
-     * Get the Test Run {@link SvtShapeFitParametersCollection}.
-     *
-     * @param manager the conditions manager
-     * @return the Test Run {@link SvtShapeFitParametersCollection}
-     */
-    protected SvtShapeFitParametersCollection getSvtShapeFitParametersCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(SvtShapeFitParametersCollection.class, "test_run_svt_shape_fit_parameters")
-                .getCachedData();
-    }
-
-    /**
-     * Get the Test Run series of {@link SvtBadChannelCollection} objects
-     *
-     * @param manager the conditions manager
-     * @return the Test Run bad channel collections
-     */
-    protected ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> getSvtBadChannelSeries(
-            final DatabaseConditionsManager manager) {
-        return manager.getConditionsSeries(SvtBadChannelCollection.class, "test_run_svt_bad_channels");
-    }
-
-    /**
-     * Get the Test Run {@link SvtCalibrationCollection}.
-     *
-     * @param manager the conditions manager
-     * @return the Test Run {@link SvtCalibrationCollection}
-     */
-    protected SvtCalibrationCollection getSvtCalibrationCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(SvtCalibrationCollection.class, "test_run_svt_calibrations").getCachedData();
-    }
-
-    /**
-     * Get the Test Run {@link SvtGainCollection}.
-     *
-     * @param manager the conditions manager
-     * @return the Test Run {@link SvtGainCollection}
-     */
-    protected SvtGainCollection getSvtGainCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(SvtGainCollection.class, "test_run_svt_gains").getCachedData();
     }
 
     /**
@@ -84,26 +42,72 @@
 
         // Create the SVT conditions object to use to encapsulate SVT condition
         // collections
-        conditions.setChannelMap(channels);
+        this.conditions.setChannelMap(channels);
 
         // Get the DAQ map from the conditions database
         final TestRunSvtDaqMappingCollection daqMap = dbConditionsManager.getCachedConditions(
                 TestRunSvtDaqMappingCollection.class, "test_run_svt_daq_map").getCachedData();
-        conditions.setDaqMap(daqMap);
+        this.conditions.setDaqMap(daqMap);
 
         // Get the collection of T0 shifts from the conditions database
         final TestRunSvtT0ShiftCollection t0Shifts = dbConditionsManager.getCachedConditions(
                 TestRunSvtT0ShiftCollection.class, "test_run_svt_t0_shifts").getCachedData();
-        conditions.setT0Shifts(t0Shifts);
+        this.conditions.setT0Shifts(t0Shifts);
 
-        conditions = super.getData(manager, name);
+        this.conditions = super.getData(manager, name);
 
-        return conditions;
+        return this.conditions;
+    }
+
+    /**
+     * Get the Test Run series of {@link SvtBadChannelCollection} objects
+     *
+     * @param manager the conditions manager
+     * @return the Test Run bad channel collections
+     */
+    @Override
+    protected ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> getSvtBadChannelSeries(
+            final DatabaseConditionsManager manager) {
+        return manager.getConditionsSeries(SvtBadChannelCollection.class, "test_run_svt_bad_channels");
+    }
+
+    /**
+     * Get the Test Run {@link SvtCalibrationCollection}.
+     *
+     * @param manager the conditions manager
+     * @return the Test Run {@link SvtCalibrationCollection}
+     */
+    @Override
+    protected SvtCalibrationCollection getSvtCalibrationCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(SvtCalibrationCollection.class, "test_run_svt_calibrations").getCachedData();
+    }
+
+    /**
+     * Get the Test Run {@link SvtGainCollection}.
+     *
+     * @param manager the conditions manager
+     * @return the Test Run {@link SvtGainCollection}
+     */
+    @Override
+    protected SvtGainCollection getSvtGainCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(SvtGainCollection.class, "test_run_svt_gains").getCachedData();
+    }
+
+    /**
+     * Get the Test Run {@link SvtShapeFitParametersCollection}.
+     *
+     * @param manager the conditions manager
+     * @return the Test Run {@link SvtShapeFitParametersCollection}
+     */
+    @Override
+    protected SvtShapeFitParametersCollection getSvtShapeFitParametersCollection(final DatabaseConditionsManager manager) {
+        return manager.getCachedConditions(SvtShapeFitParametersCollection.class, "test_run_svt_shape_fit_parameters")
+                .getCachedData();
     }
 
     /**
      * Get the type handled by this converter.
-     * 
+     *
      * @return The type handled by this converter.
      */
     @Override

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDaqMapping.java	Mon Jul  6 12:03:16 2015
@@ -1,8 +1,6 @@
 package org.hps.conditions.svt;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 import org.lcsim.detector.tracker.silicon.HpsSiSensor;
@@ -11,10 +9,9 @@
 /**
  * This class encapsulates the Test Run SVT DAQ map.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"test_run_svt_daq_map"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class TestRunSvtDaqMapping extends AbstractSvtDaqMapping {
 
     /**
@@ -106,7 +103,7 @@
      */
     @Field(names = {"fpga"})
     public Integer getFpgaID() {
-        return getFieldValue("fpga");
+        return this.getFieldValue("fpga");
     }
 
     /**
@@ -116,6 +113,6 @@
      */
     @Field(names = {"hybrid"})
     public Integer getHybridID() {
-        return getFieldValue("hybrid");
+        return this.getFieldValue("hybrid");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java	Mon Jul  6 12:03:16 2015
@@ -1,18 +1,15 @@
 package org.hps.conditions.svt;
 
-import org.hps.conditions.database.Converter;
 import org.hps.conditions.database.Field;
-import org.hps.conditions.database.MultipleCollectionsAction;
 import org.hps.conditions.database.Table;
 import org.hps.util.Pair;
 
 /**
  * This class is a container that allows associating a t0 shift with a specific sensor by FPGA ID and hybrid ID.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 @Table(names = {"test_run_svt_t0_shifts"})
-@Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class TestRunSvtT0Shift extends AbstractSvtT0Shift {
 
     /**
@@ -48,7 +45,7 @@
      */
     @Field(names = {"fpga"})
     public Integer getFpgaID() {
-        return getFieldValue("fpga");
+        return this.getFieldValue("fpga");
     }
 
     /**
@@ -58,6 +55,6 @@
      */
     @Field(names = {"hybrid"})
     public Integer getHybridID() {
-        return getFieldValue("hybrid");
+        return this.getFieldValue("hybrid");
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/package-info.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/package-info.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/main/java/org/hps/conditions/svt/package-info.java	Mon Jul  6 12:03:16 2015
@@ -1,6 +1,8 @@
 /**
  * Implementation of detector conditions API for the HPS SVT.
  *
+ * @author Omar Moreno, UCSC
+ * @author Jeremy McCormick, SLAC
  * @see org.hps.conditions.api
  * @see org.hps.conditions.api.ConditionsObject
  * @see org.hps.conditions.api.ConditionsObjectCollection
@@ -10,8 +12,6 @@
  * @see SvtCalibration
  * @see SvtT0Shift
  * @see SvtBadChannel
- * @author <a href="[log in to unmask]">Omar Moreno</a>
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
  */
 package org.hps.conditions.svt;
 

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ConditionsDriverTest.java	Mon Jul  6 12:03:16 2015
@@ -15,9 +15,26 @@
 /**
  * This is a basic test of using ConditionsDriver that doesn't actually check anything at the moment.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class ConditionsDriverTest extends TestCase {
+
+    /**
+     * This {@link org.lcsim.util.Driver} prints out when the conditions change.
+     */
+    static class CheckDriver extends Driver {
+
+        /**
+         * Hook for conditions system change.
+         * 
+         * @param detector the detector object
+         */
+        @Override
+        public void detectorChanged(final Detector detector) {
+            System.out.println("detectorChanged - detector " + detector.getDetectorName() + " and run #"
+                    + DatabaseConditionsManager.getInstance().getRun());
+        }
+    }
 
     /**
      * The run number to use for the test.
@@ -26,6 +43,7 @@
 
     /**
      * Test the {@link ConditionsDriver} on Test Run data.
+     * 
      * @throws Exception if there is a test error or conditions error
      */
     public void testConditionsDriverTestRun() throws Exception {
@@ -48,19 +66,4 @@
         loop.add(new CheckDriver());
         loop.loop(-1);
     }
-
-    /**
-     * This {@link org.lcsim.util.Driver} prints out when the conditions change.
-     */
-    static class CheckDriver extends Driver {
-
-        /**
-         * Hook for conditions system change.
-         * @param detector the detector object
-         */
-        public void detectorChanged(final Detector detector) {
-            System.out.println("detectorChanged - detector " + detector.getDetectorName()
-                    + " and run #" + DatabaseConditionsManager.getInstance().getRun());
-        }
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/EngRunConditionsTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/EngRunConditionsTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/EngRunConditionsTest.java	Mon Jul  6 12:03:16 2015
@@ -34,73 +34,31 @@
  * <p>
  * This test will need to be updated if the default conditions sets are changed for the Eng Run.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class EngRunConditionsTest extends TestCase {
 
     /**
-     * Number of events to process.
-     */
-    private static final int EVENT_COUNT = 100;
-
-    /**
-     * Data file URL.
-     */
-    private static final String URL = "http://www.lcsim.org/test/hps-java/hps_003393.0_recon_20141225-0-100.slcio";
-
-    /**
-     * The run number to use for the test.
-     */
-    private static final int RUN_NUMBER = 3393;
-
-    /**
-     * Number of ECAL channels.
-     */
-    private static final int CHANNEL_COUNT = 442;
-
-    /**
-     * Test Eng Run conditions.
-     *
-     * @throws Exception if there is an error (record processing problem)
-     */
-    public void test() throws Exception {
-
-        final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
-        DatabaseConditionsManager.getLogger().setLevel(Level.ALL);
-        manager.setTag("pass0");
-        manager.setXmlConfig("/org/hps/conditions/config/conditions_database_engrun.xml");
-
-        final FileCache cache = new FileCache();
-        final File inputFile = cache.getCachedFile(new URL(URL));
-
-        final LCSimLoop loop = new LCSimLoop();
-        loop.add(new EventMarkerDriver());
-        loop.add(new ConditionsCheckDriver());
-        loop.setLCIORecordSource(inputFile);
-        loop.loop(EVENT_COUNT);
-    }
-
-    /**
-     * Check the run numbers of the conditions records.
-     *
-     * @param collection the conditions collection
-     */
-    static void checkRunNumbers(final BaseConditionsObjectCollection<?> collection) {
-        // assertTrue("Run start out of range.", collection.getConditionsRecord().getRunStart() >= RUN_START);
-        // assertTrue("Run end out of range.", collection.getConditionsRecord().getRunEnd() <= RUN_END);
-    }
-
-    /**
      * This {@link org.lcsim.util.Driver} performs basic conditions data checks.
      */
     static class ConditionsCheckDriver extends Driver {
 
         /**
+         * Collection ID of calibrations.
+         */
+        private static final Integer CALIBRATIONS_COLLECTION_ID = 4;
+
+        /**
          * Answer for gain value check of single channel.
          */
         private static final double GAIN_ANSWER = 0.17;
 
         /**
+         * Collection ID of gains.
+         */
+        private static final Integer GAINS_COLLECTION_ID = 4;
+
+        /**
          * Answer for noise value check of single channel.
          */
         private static final double NOISE_ANSWER = 2.74;
@@ -109,16 +67,6 @@
          * Answer for pedestal value check of single channel.
          */
         private static final double PEDESTAL_ANSWER = 105.78;
-
-        /**
-         * Collection ID of calibrations.
-         */
-        private static final Integer CALIBRATIONS_COLLECTION_ID = 4;
-
-        /**
-         * Collection ID of gains.
-         */
-        private static final Integer GAINS_COLLECTION_ID = 4;
 
         /**
          * Flag if {@link #detectorChanged(Detector)} is activated.
@@ -186,6 +134,16 @@
             assertEquals("Wrong gain value.", GAIN_ANSWER, channelInfo.getGain().getGain());
 
             this.detectorChangedCalled = true;
+        }
+
+        /**
+         * End of data hook. Checks that {@link #detectorChanged(Detector)} was called.
+         */
+        @Override
+        public void endOfData() {
+            if (!this.detectorChangedCalled) {
+                throw new RuntimeException("The detectorChanged method was never called.");
+            }
         }
 
         /**
@@ -221,15 +179,57 @@
                 }
             }
         }
-
-        /**
-         * End of data hook. Checks that {@link #detectorChanged(Detector)} was called.
-         */
-        @Override
-        public void endOfData() {
-            if (!this.detectorChangedCalled) {
-                throw new RuntimeException("The detectorChanged method was never called.");
-            }
-        }
+    }
+
+    /**
+     * Number of ECAL channels.
+     */
+    private static final int CHANNEL_COUNT = 442;
+
+    /**
+     * Number of events to process.
+     */
+    private static final int EVENT_COUNT = 100;
+
+    /**
+     * The run number to use for the test.
+     */
+    private static final int RUN_NUMBER = 3393;
+
+    /**
+     * Data file URL.
+     */
+    private static final String URL = "http://www.lcsim.org/test/hps-java/hps_003393.0_recon_20141225-0-100.slcio";
+
+    /**
+     * Check the run numbers of the conditions records.
+     *
+     * @param collection the conditions collection
+     */
+    static void checkRunNumbers(final BaseConditionsObjectCollection<?> collection) {
+        // assertTrue("Run start out of range.", collection.getConditionsRecord().getRunStart() >= RUN_START);
+        // assertTrue("Run end out of range.", collection.getConditionsRecord().getRunEnd() <= RUN_END);
+    }
+
+    /**
+     * Test Eng Run conditions.
+     *
+     * @throws Exception if there is an error (record processing problem)
+     */
+    public void test() throws Exception {
+
+        final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
+        DatabaseConditionsManager.getLogger().setLevel(Level.ALL);
+        manager.setTag("pass0");
+        manager.setXmlConfig("/org/hps/conditions/config/conditions_database_engrun.xml");
+
+        final FileCache cache = new FileCache();
+        final File inputFile = cache.getCachedFile(new URL(URL));
+
+        final LCSimLoop loop = new LCSimLoop();
+        loop.add(new EventMarkerDriver());
+        loop.add(new ConditionsCheckDriver());
+        loop.setLCIORecordSource(inputFile);
+        loop.loop(EVENT_COUNT);
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/RunNumberTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/RunNumberTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/RunNumberTest.java	Mon Jul  6 12:03:16 2015
@@ -20,9 +20,63 @@
 /**
  * This class checks that event processing works correctly for files that have multiple runs in them.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class RunNumberTest extends TestCase {
+
+    /**
+     * Simple Driver to store information about runs processed.
+     */
+    static class RunNumberDriver extends Driver {
+
+        /**
+         * Reference to conditions manager.
+         */
+        private static DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+
+        /**
+         * Number of times {@link #detectorChanged(Detector)} was called.
+         */
+        private int nDetectorChanged = 0;
+
+        /**
+         * Number of runs processed.
+         */
+        private int nRuns = 0;
+
+        /**
+         * List of run numbers processed.
+         */
+        private final List<Integer> runsProcessed = new ArrayList<Integer>();
+
+        /**
+         * Set of unique detector objects.
+         */
+        private final Set<Detector> uniqueDetectorObjects = new HashSet<Detector>();
+
+        /**
+         * Set of unique run numbers processed.
+         */
+        private final Set<Integer> uniqueRuns = new LinkedHashSet<Integer>();
+
+        /**
+         * Hook for conditions changed used to test multiple run processing.
+         */
+        @Override
+        public void detectorChanged(final Detector detector) {
+            final int run = conditionsManager.getRun();
+            this.uniqueRuns.add(run);
+            this.runsProcessed.add(run);
+            ++this.nRuns;
+            ++this.nDetectorChanged;
+            this.uniqueDetectorObjects.add(detector);
+        }
+    }
+
+    /**
+     * Number of runs that should be processed in the job.
+     */
+    private static final int RUN_COUNT = 9;
 
     /**
      * Test file with a few events from each of the "good runs" of the 2012 Test Run.
@@ -30,12 +84,8 @@
     private static final String URL = "http://www.lcsim.org/test/hps-java/ConditionsTest.slcio";
 
     /**
-     * Number of runs that should be processed in the job.
-     */
-    private static final int RUN_COUNT = 9;
-
-    /**
      * Run the test.
+     * 
      * @throws Exception if there is a test error
      */
     public void test() throws Exception {
@@ -61,7 +111,7 @@
 
         // Print out unique runs.
         System.out.println("Unique run numbers in this job ...");
-        for (int runNumber : runNumberDriver.uniqueRuns) {
+        for (final int runNumber : runNumberDriver.uniqueRuns) {
             System.out.println(runNumber);
         }
 
@@ -69,7 +119,7 @@
 
         // Print out runs processed.
         System.out.println("Processed runs in order ...");
-        for (int runNumber : runNumberDriver.runsProcessed) {
+        for (final int runNumber : runNumberDriver.runsProcessed) {
             System.out.println(runNumber);
         }
 
@@ -80,59 +130,11 @@
         assertEquals("Number of unique runs was incorrect.", RUN_COUNT, runNumberDriver.uniqueRuns.size());
 
         // Check that detectorChanged was called the correct number of times.
-        assertEquals("The detectorChanged method was called an incorrect number of times.",
-                RUN_COUNT, runNumberDriver.nDetectorChanged);
+        assertEquals("The detectorChanged method was called an incorrect number of times.", RUN_COUNT,
+                runNumberDriver.nDetectorChanged);
 
         // Check that there was a unique Detector created for each run.
-        assertEquals("The number of Detector objects created was not correct.",
-                RUN_COUNT, runNumberDriver.uniqueDetectorObjects.size());
-    }
-
-    /**
-     * Simple Driver to store information about runs processed.
-     */
-    static class RunNumberDriver extends Driver {
-
-        /**
-         * Number of runs processed.
-         */
-        private int nRuns = 0;
-
-        /**
-         * Number of times {@link #detectorChanged(Detector)} was called.
-         */
-        private int nDetectorChanged = 0;
-
-        /**
-         * List of run numbers processed.
-         */
-        private List<Integer> runsProcessed = new ArrayList<Integer>();
-
-        /**
-         * Set of unique run numbers processed.
-         */
-        private Set<Integer> uniqueRuns = new LinkedHashSet<Integer>();
-
-        /**
-         * Set of unique detector objects.
-         */
-        private Set<Detector> uniqueDetectorObjects = new HashSet<Detector>();
-
-        /**
-         * Reference to conditions manager.
-         */
-        private static DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-
-        /**
-         * Hook for conditions changed used to test multiple run processing.
-         */
-        public void detectorChanged(final Detector detector) {
-            final int run = conditionsManager.getRun();
-            uniqueRuns.add(run);
-            runsProcessed.add(run);
-            ++nRuns;
-            ++nDetectorChanged;
-            uniqueDetectorObjects.add(detector);
-        }
+        assertEquals("The number of Detector objects created was not correct.", RUN_COUNT,
+                runNumberDriver.uniqueDetectorObjects.size());
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamConditionsTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamConditionsTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamConditionsTest.java	Mon Jul  6 12:03:16 2015
@@ -21,7 +21,7 @@
 /**
  * Load beam conditions for every run from the ECAL commissioning.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class BeamConditionsTest extends TestCase {
 
@@ -40,37 +40,8 @@
             3455, 3456, 3457, 3458, 3459, 3461, 3462, 3463, 3216, 2926, 2935, 2934, 2937};
 
     /**
-     * Test the beam conditions.
-     */
-    public void testBeamConditions() {
-        final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
-        manager.setLogLevel(Level.SEVERE);
-        System.out.println("run id current position_x position_y energy");
-        final Map<Integer, BeamConditions> beamConditions = new LinkedHashMap<Integer, BeamConditions>();
-        for (final int run : runs) {
-            try {
-                manager.setDetector("HPS-ECalCommissioning", run);
-            } catch (final ConditionsNotFoundException e) {
-                throw new RuntimeException(e);
-            }
-            final BeamConditionsCollection beamCollection = manager.getCachedConditions(BeamConditionsCollection.class,
-                    "beam").getCachedData();
-            final BeamConditions beam = beamCollection.get(0);
-            System.out.print(run + " ");
-            System.out.print(beam.getRowId() + " ");
-            System.out.print(beam.getCurrent() + " ");
-            System.out.print(beam.getPositionX() + " ");
-            System.out.print(beam.getPositionY() + " ");
-            System.out.print(beam.getEnergy());
-            System.out.println();
-            beamConditions.put(run, beam);
-        }
-        writeBeamTuple(beamConditions);
-    }
-
-    /**
      * Write out an AIDA tuple with the beam conditions.
-     * 
+     *
      * @param beamConditions the beam conditions
      */
     private static void writeBeamTuple(final Map<Integer, BeamConditions> beamConditions) {
@@ -118,4 +89,33 @@
             throw new RuntimeException(e);
         }
     }
+
+    /**
+     * Test the beam conditions.
+     */
+    public void testBeamConditions() {
+        final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
+        manager.setLogLevel(Level.SEVERE);
+        System.out.println("run id current position_x position_y energy");
+        final Map<Integer, BeamConditions> beamConditions = new LinkedHashMap<Integer, BeamConditions>();
+        for (final int run : runs) {
+            try {
+                manager.setDetector("HPS-ECalCommissioning", run);
+            } catch (final ConditionsNotFoundException e) {
+                throw new RuntimeException(e);
+            }
+            final BeamConditionsCollection beamCollection = manager.getCachedConditions(BeamConditionsCollection.class,
+                    "beam").getCachedData();
+            final BeamConditions beam = beamCollection.get(0);
+            System.out.print(run + " ");
+            System.out.print(beam.getRowId() + " ");
+            System.out.print(beam.getCurrent() + " ");
+            System.out.print(beam.getPositionX() + " ");
+            System.out.print(beam.getPositionY() + " ");
+            System.out.print(beam.getEnergy());
+            System.out.println();
+            beamConditions.put(run, beam);
+        }
+        writeBeamTuple(beamConditions);
+    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/beam/BeamCurrentTest.java	Mon Jul  6 12:03:16 2015
@@ -17,17 +17,47 @@
 /**
  * This test checks the Test Run beam current values by run.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class BeamCurrentTest extends TestCase {
+
+    /**
+     * This Driver will check the beam current for a run against the answer key.
+     */
+    static class BeamCurrentChecker extends Driver {
+
+        /**
+         * The current run number.
+         */
+        private int currentRun = Integer.MIN_VALUE;
+
+        /**
+         * This method will check the beam current against the answer key for the first event of a new run.
+         *
+         * @param the LCSim event
+         */
+        @Override
+        protected void process(final EventHeader event) {
+            if (this.currentRun != event.getRunNumber()) {
+                this.currentRun = event.getRunNumber();
+                final BeamCurrentCollection collection = DatabaseConditionsManager.getInstance()
+                        .getCachedConditions(BeamCurrentCollection.class, "beam_current").getCachedData();
+                final BeamCurrent beamCurrent = collection.iterator().next();
+                System.out.println("Run " + event.getRunNumber() + " has integrated beam current "
+                        + beamCurrent.getIntegratedBeamCurrent() + " nC.");
+                assertEquals("Wrong beam current for run.", ANSWER_KEY.get(this.currentRun),
+                        beamCurrent.getIntegratedBeamCurrent());
+            }
+        }
+    }
+
+    /** Answer key for beam current by run. */
+    private static final Map<Integer, Double> ANSWER_KEY = new HashMap<Integer, Double>();
 
     /**
      * This test file has a few events from the "good runs" of the Test Run.
      */
     private static final String URL = "http://www.lcsim.org/test/hps-java/ConditionsTest.slcio";
-
-    /** Answer key for beam current by run. */
-    private static final Map<Integer, Double> ANSWER_KEY = new HashMap<Integer, Double>();
 
     /** Setup the beam current answer key by run. */
     static {
@@ -63,34 +93,4 @@
         loop.add(new BeamCurrentChecker());
         loop.loop(-1, null);
     }
-
-    /**
-     * This Driver will check the beam current for a run against the answer key.
-     */
-    static class BeamCurrentChecker extends Driver {
-
-        /**
-         * The current run number.
-         */
-        private int currentRun = Integer.MIN_VALUE;
-
-        /**
-         * This method will check the beam current against the answer key for the first event of a new run.
-         *
-         * @param the LCSim event
-         */
-        @Override
-        protected void process(final EventHeader event) {
-            if (this.currentRun != event.getRunNumber()) {
-                this.currentRun = event.getRunNumber();
-                final BeamCurrentCollection collection = DatabaseConditionsManager.getInstance()
-                        .getCachedConditions(BeamCurrentCollection.class, "beam_current").getCachedData();
-                final BeamCurrent beamCurrent = collection.iterator().next();
-                System.out.println("Run " + event.getRunNumber() + " has integrated beam current "
-                        + beamCurrent.getIntegratedBeamCurrent() + " nC.");
-                assertEquals("Wrong beam current for run.", ANSWER_KEY.get(this.currentRun),
-                        beamCurrent.getIntegratedBeamCurrent());
-            }
-        }
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/CollectionIdTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/CollectionIdTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/CollectionIdTest.java	Mon Jul  6 12:03:16 2015
@@ -12,7 +12,7 @@
 /**
  * Test adding a new collection and getting its unique ID.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public class CollectionIdTest extends TestCase {
 

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/ConverterRegistryTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/ConverterRegistryTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/database/ConverterRegistryTest.java	Mon Jul  6 12:03:16 2015
@@ -5,7 +5,7 @@
 /**
  * This test loads the {@link ConverterRegistry}.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 // FIXME: Doesn't test anything.
 public final class ConverterRegistryTest extends TestCase {

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectCollectionTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectCollectionTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectCollectionTest.java	Mon Jul  6 12:03:16 2015
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.sql.Connection;
+import java.util.Date;
 
 import junit.framework.TestCase;
 
@@ -12,43 +13,58 @@
 import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.conditions.dummy.DummyConditionsObject.DummyConditionsObjectCollection;
 
+/**
+ * Test collections API using a dummy class.
+ *
+ * @author Jeremy McCormick, SLAC
+ */
 public class DummyConditionsObjectCollectionTest extends TestCase {
 
-    public void testBaseConditionsObjectCollection() throws Exception {
+    private Connection connection;
+    final TableMetaData tableMetaData = TableRegistry.getTableRegistry().findByTableName("dummy");
 
+    @Override
+    public void setUp() {
         // Configure the conditions system.
         final DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance();
         manager.setConnectionResource("/org/hps/conditions/config/jeremym_dev_connection.prop");
         manager.setXmlConfig("/org/hps/conditions/config/conditions_database_no_svt.xml");
-        final Connection connection = manager.getConnection();
+        this.connection = manager.getConnection();
+    }
 
-        // Setup basic table meta data.
-        final TableMetaData tableMetaData = TableRegistry.getTableRegistry().findByTableName("dummy");
+    public void testBaseConditionsObjectCollection() throws Exception {
+
+        System.out.println("DummyConditionsObjectCollectionTest.testBaseConditionsObjectCollection");
 
         // Create a new collection.
-        final DummyConditionsObjectCollection collection = new DummyConditionsObjectCollection(connection,
-                tableMetaData);
+        final DummyConditionsObjectCollection collection = new DummyConditionsObjectCollection(this.connection,
+                this.tableMetaData);
 
         // Add object to collection.
-        final DummyConditionsObject object1 = new DummyConditionsObject(connection, tableMetaData);
+        final DummyConditionsObject object1 = new DummyConditionsObject(this.connection, this.tableMetaData);
         object1.setFieldValue("dummy", 1.0);
+        object1.setFieldValue("dummy_ts", new Date());
+        object1.setFieldValue("dummy_dt", new Date());
         collection.add(object1);
 
         // Add object to collection.
-        final DummyConditionsObject object2 = new DummyConditionsObject(connection, tableMetaData);
+        final DummyConditionsObject object2 = new DummyConditionsObject(this.connection, this.tableMetaData);
         object2.setFieldValue("dummy", 2.0);
+        object2.setFieldValue("dummy_ts", new Date());
+        object2.setFieldValue("dummy_dt", new Date());
         collection.add(object2);
 
         // Insert all objects into the database.
         collection.insert();
 
         System.out.println(collection.size() + " objects inserted into " + collection.getCollectionId());
+        System.out.println(collection);
 
         assertTrue("Collection isNew returned wrong value.", !collection.isNew());
 
         // Create another collection.
-        final DummyConditionsObjectCollection anotherCollection = new DummyConditionsObjectCollection(connection,
-                tableMetaData);
+        final DummyConditionsObjectCollection anotherCollection = new DummyConditionsObjectCollection(this.connection,
+                this.tableMetaData);
 
         // Select the previously created objects into this collection by using the collection_id value.
         anotherCollection.select(collection.getCollectionId());
@@ -56,7 +72,11 @@
 
         // Change the objects locally.
         anotherCollection.get(0).setFieldValue("dummy", 3.0);
+        anotherCollection.get(0).setFieldValue("dummy_ts", new Date());
+        anotherCollection.get(0).setFieldValue("dummy_dt", new Date());
         anotherCollection.get(1).setFieldValue("dummy", 4.0);
+        anotherCollection.get(1).setFieldValue("dummy_ts", new Date());
+        anotherCollection.get(1).setFieldValue("dummy_dt", new Date());
 
         // Update all objects.
         System.out.println("updating objects from collection " + collection.getCollectionId());
@@ -67,15 +87,76 @@
         collection.delete();
     }
 
-    public void testCsv() throws Exception {        
+    public void testCsv() throws Exception {
+
+        System.out.println("DummyConditionsObjectCollectionTest.testCsv");
+
+        // Create a new collection.
+        final DummyConditionsObjectCollection collection = new DummyConditionsObjectCollection(this.connection,
+                this.tableMetaData);
+
+        // Add object to collection.
+        final DummyConditionsObject object1 = new DummyConditionsObject(this.connection, this.tableMetaData);
+        object1.setFieldValue("dummy", 1.0);
+        object1.setFieldValue("dummy_ts", new Date());
+        object1.setFieldValue("dummy_dt", new Date());
+        collection.add(object1);
+
+        // Add object to collection.
+        final DummyConditionsObject object2 = new DummyConditionsObject(this.connection, this.tableMetaData);
+        object2.setFieldValue("dummy", 2.0);
+        object2.setFieldValue("dummy_ts", new Date());
+        object2.setFieldValue("dummy_dt", new Date());
+        collection.add(object2);
+
+        // Write to CSV file.
+        collection.write(new File("dummy.csv"), null);
+        System.out.println("wrote CSV values");
+        System.out.println(collection);
 
         // Create an object collection.
-        final ConditionsObjectCollection<?> collection = ConditionsObjectUtilities.newCollection("dummy");
-        
+        final ConditionsObjectCollection<?> csvCollection = ConditionsObjectUtilities.newCollection("dummy");
+
         // Load CSV data.
-        collection.loadCsv(new File("dummy.txt"));
-        
-        System.out.println("loaded dummy collection ...");
-        System.out.println(collection.toString());
+        collection.load(new File("dummy.csv"), null);
+
+        System.out.println("loaded CSV values");
+        System.out.println(csvCollection);
+    }
+
+    public void testTsv() throws Exception {
+        System.out.println("DummyConditionsObjectCollectionTest.testTsv");
+
+        // Create a new collection.
+        final DummyConditionsObjectCollection collection = new DummyConditionsObjectCollection(this.connection,
+                this.tableMetaData);
+
+        // Add object to collection.
+        final DummyConditionsObject object1 = new DummyConditionsObject(this.connection, this.tableMetaData);
+        object1.setFieldValue("dummy", 1.0);
+        object1.setFieldValue("dummy_ts", new Date());
+        object1.setFieldValue("dummy_dt", new Date());
+        collection.add(object1);
+
+        // Add object to collection.
+        final DummyConditionsObject object2 = new DummyConditionsObject(this.connection, this.tableMetaData);
+        object2.setFieldValue("dummy", 2.0);
+        object2.setFieldValue("dummy_ts", new Date());
+        object2.setFieldValue("dummy_dt", new Date());
+        collection.add(object2);
+
+        // Write to CSV file.
+        collection.write(new File("dummy.tsv"), '\t');
+        System.out.println("wrote TSV values");
+        System.out.println(collection);
+
+        // Create an object collection.
+        final ConditionsObjectCollection<?> csvCollection = ConditionsObjectUtilities.newCollection("dummy");
+
+        // Load CSV data.
+        collection.load(new File("dummy.tsv"), '\t');
+
+        System.out.println("loaded TSV values");
+        System.out.println(csvCollection);
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectConverterTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectConverterTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectConverterTest.java	Mon Jul  6 12:03:16 2015
@@ -8,7 +8,9 @@
 import org.hps.conditions.dummy.DummyConditionsObject.DummyConditionsObjectCollection;
 
 /**
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * Test converter API using a dummy class.
+ * 
+ * @author Jeremy McCormick, SLAC
  */
 public class DummyConditionsObjectConverterTest extends TestCase {
 

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/dummy/DummyConditionsObjectTest.java	Mon Jul  6 12:03:16 2015
@@ -12,23 +12,11 @@
 import org.hps.conditions.database.DatabaseConditionsManager;
 
 /**
- * Perform create, select, update, and delete operations on the <code>BaseConditionsObject</code> class via a dummy
- * conditions class implementation with a single double value.
+ * Test object API using a dummy class.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class DummyConditionsObjectTest extends TestCase {
-
-    private static DatabaseConditionsManager manager;
-
-    @Override
-    public void setUp() {
-        // Configure the conditions system. This uses my local development database that is not globally accessible.
-        // --JM
-        manager = DatabaseConditionsManager.getInstance();
-        manager.setConnectionResource("/org/hps/conditions/config/jeremym_dev_connection.prop");
-        manager.setXmlConfig("/org/hps/conditions/config/conditions_database_no_svt.xml");
-    }
 
     /**
      * Dummy value.
@@ -39,6 +27,38 @@
      * Another dummy value.
      */
     private static final double DUMMY_VALUE2 = 2.0;
+
+    private static DatabaseConditionsManager manager;
+
+    @Override
+    public void setUp() {
+        // Configure the conditions system. This uses a local development database that is not globally accessible.
+        manager = DatabaseConditionsManager.getInstance();
+        manager.setConnectionResource("/org/hps/conditions/config/jeremym_dev_connection.prop");
+        manager.setXmlConfig("/org/hps/conditions/config/conditions_database_no_svt.xml");
+    }
+
+    /**
+     * Cleanup the table used for the test.
+     */
+    @Override
+    public void tearDown() {
+        Statement statement = null;
+        try {
+            statement = manager.getConnection().createStatement();
+            statement.executeUpdate("DELETE from dummy");
+        } catch (final SQLException e) {
+            e.printStackTrace();
+        }
+        try {
+            if (statement != null) {
+                statement.close();
+            }
+        } catch (final SQLException e) {
+            e.printStackTrace();
+        }
+        manager.closeConnection();
+    }
 
     /**
      * Perform the test.
@@ -77,8 +97,12 @@
         }
 
         // The update operation should fail with an error.
-        final boolean updated = newObject.update();
-        assertTrue("The update operation on a new object should have failed.", !updated);
+        try {
+            newObject.update();
+            throw new RuntimeException("The update operation should have failed.");
+        } catch (final DatabaseObjectException e) {
+            e.printStackTrace();
+        }
 
         newObject.setFieldValue("collection_id", 42); /* Use an arbitrary collection ID value. */
         newObject.setFieldValue("dummy", DUMMY_VALUE1);
@@ -86,7 +110,6 @@
         System.out.println("Inserted object with id " + newObject.getRowId() + " into "
                 + newObject.getTableMetaData().getTableName() + " table.");
         assertEquals("The isNew method returned the wrong value.", false, newObject.isNew());
-        assertEquals("The isDirty method returned the wrong value.", false, newObject.isDirty());
         assertEquals("Object does not have a valid collection after insert.", true, newObject.hasValidCollectionId());
 
         // Select into another object by ID.
@@ -106,13 +129,11 @@
         newObject.setFieldValue("dummy", DUMMY_VALUE2);
         System.out.println("Set dummy to " + DUMMY_VALUE2 + " in existing object.");
         assertEquals("The value is wrong before update.", DUMMY_VALUE2, newObject.getDummy());
-        assertEquals("The isDirty method returned the wrong value.", true, newObject.isDirty());
         assertEquals("The updated method returned the wrong value.", true, newObject.update());
         assertEquals("The value is wrong after update.", DUMMY_VALUE2, newObject.getDummy());
-        assertEquals("The isDirty method returned the wrong value.", false, newObject.isDirty());
 
         // Update which should be ignored on non-dirty record.
-        assertEquals("The update method should have returned false.", false, newObject.update());
+        // assertEquals("The update method should have returned false.", false, newObject.update());
 
         // Select again into another object.
         anotherObject.select(newObject.getRowId());
@@ -130,19 +151,4 @@
         final boolean selected = anotherObject.select(rowId);
         assertEquals("The select operation returned the wrong value after delete.", false, selected);
     }
-
-    /**
-     * Cleanup the table used for the test.
-     */
-    @Override
-    public void tearDown() {
-        Statement statement = null;
-        try {
-            statement = manager.getConnection().createStatement();
-            statement.executeUpdate("DELETE from dummy");
-        } catch (final SQLException e) {
-            e.printStackTrace();
-        }
-        manager.closeConnection();
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ecal/EcalLedTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ecal/EcalLedTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/ecal/EcalLedTest.java	Mon Jul  6 12:03:16 2015
@@ -11,7 +11,7 @@
 /**
  * A test to make sure ECAL LED information is readable from the conditions dev database.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class EcalLedTest extends TestCase {
 

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtBadChannelTest.java	Mon Jul  6 12:03:16 2015
@@ -20,14 +20,56 @@
 /**
  * This class tests that the correct bad channel conditions are found for the test run.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class SvtBadChannelTest extends TestCase {
 
     /**
-     * This test file has a few events from each of the "good runs" of the 2012 Test Run.
+     * This Driver will check the number of bad channels for a run against the answer key.
      */
-    private static final String TEST_FILE_URL = "http://www.lcsim.org/test/hps/conditions_test.slcio";
+    static class SvtBadChannelChecker extends Driver {
+
+        /**
+         * The current run number.
+         */
+        private int currentRun = -1;
+
+        /**
+         * This method will check the number of bad channels against the answer key for the first event of a new run.
+         * 
+         * @param the LCSim event
+         */
+        @Override
+        public void process(final EventHeader event) {
+            final int run = event.getRunNumber();
+            if (run != this.currentRun) {
+                this.currentRun = run;
+                final Detector detector = event.getDetector();
+                int badChannels = 0;
+                final List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
+                for (final HpsSiSensor sensor : sensors) {
+                    final int nchannels = sensor.getNumberOfChannels();
+                    for (int i = 0; i < nchannels; i++) {
+                        if (sensor.isBadChannel(i)) {
+                            ++badChannels;
+                        }
+                    }
+                }
+                System.out.println("Run " + this.currentRun + " has " + badChannels + " SVT bad channels.");
+                if (ANSWER_KEY.containsKey(this.currentRun)) {
+                    final Integer badChannelsExpected = ANSWER_KEY.get(run);
+                    TestCase.assertEquals("Wrong number of bad channels found.", (int) badChannelsExpected, badChannels);
+                } else {
+                    TestCase.assertEquals("Wrong number of bad channels found.", BAD_CHANNELS_QA_ANSWER, badChannels);
+                }
+            }
+        }
+    }
+
+    /**
+     * Answer key for number of bad channels per run.
+     */
+    private static final Map<Integer, Integer> ANSWER_KEY = new HashMap<Integer, Integer>();
 
     /**
      * This is the number of bad channels in the conditions set that covers all run numbers.
@@ -35,9 +77,9 @@
     private static final int BAD_CHANNELS_QA_ANSWER = 50;
 
     /**
-     * Answer key for number of bad channels per run.
+     * This test file has a few events from each of the "good runs" of the 2012 Test Run.
      */
-    private static final Map<Integer, Integer> ANSWER_KEY = new HashMap<Integer, Integer>();
+    private static final String TEST_FILE_URL = "http://www.lcsim.org/test/hps/conditions_test.slcio";
 
     /**
      * Setup the answer key.
@@ -53,6 +95,7 @@
 
     /**
      * Run the test.
+     * 
      * @throws Exception if there is an event processing error
      */
     public void test() throws Exception {
@@ -74,48 +117,4 @@
         // Run over all events.
         loop.loop(-1, null);
     }
-
-    /**
-     * This Driver will check the number of bad channels for a run against the answer key.
-     */
-    static class SvtBadChannelChecker extends Driver {
-
-        /**
-         * The current run number.
-         */
-        private int currentRun = -1;
-
-        /**
-         * This method will check the number of bad channels against the answer
-         * key for the first event of a new run.
-         * @param the LCSim event
-         */
-        public void process(final EventHeader event) {
-            final int run = event.getRunNumber();
-            if (run != currentRun) {
-                currentRun = run;
-                final Detector detector = event.getDetector();
-                int badChannels = 0;
-                final List<HpsSiSensor> sensors = detector.getDetectorElement()
-                        .findDescendants(HpsSiSensor.class);
-                for (final HpsSiSensor sensor : sensors) {
-                    final int nchannels = sensor.getNumberOfChannels();
-                    for (int i = 0; i < nchannels; i++) {
-                        if (sensor.isBadChannel(i)) {
-                            ++badChannels;
-                        }
-                    }
-                }
-                System.out.println("Run " + currentRun + " has " + badChannels + " SVT bad channels.");
-                if (ANSWER_KEY.containsKey(currentRun)) {
-                    final Integer badChannelsExpected = ANSWER_KEY.get(run);
-                    TestCase.assertEquals("Wrong number of bad channels found.",
-                            (int) badChannelsExpected, (int) badChannels);
-                } else {
-                    TestCase.assertEquals("Wrong number of bad channels found.",
-                            (int) BAD_CHANNELS_QA_ANSWER, (int) badChannels);
-                }
-            }
-        }
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtConfigurationTest.java	Mon Jul  6 12:03:16 2015
@@ -12,7 +12,7 @@
 /**
  * Load an SVT XML configuration from the database.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class SvtConfigurationTest extends TestCase {
 

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDaqMappingTest.java	Mon Jul  6 12:03:16 2015
@@ -9,14 +9,14 @@
  * This test checks if the SVT DAQ map was loaded with reasonable values and is being read correctly from the conditions
  * database.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public final class SvtDaqMappingTest extends TestCase {
 
     /**
-     * Total number of SVT sensors.
+     * Maximum FEB Hybrid ID.
      */
-    public static final int TOTAL_NUMBER_OF_SENSORS = 36;
+    public static final int MAX_FEB_HYBRID_ID = 3;
 
     /**
      * Minimum FEB Hybrid ID.
@@ -24,9 +24,9 @@
     public static final int MIN_FEB_HYBRID_ID = 0;
 
     /**
-     * Maximum FEB Hybrid ID.
+     * Total number of SVT sensors.
      */
-    public static final int MAX_FEB_HYBRID_ID = 3;
+    public static final int TOTAL_NUMBER_OF_SENSORS = 36;
 
     /**
      * Load the DAQ map from the database.

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java	Mon Jul  6 12:03:16 2015
@@ -9,15 +9,34 @@
 import org.lcsim.geometry.Detector;
 
 /**
- * This test loads {@link SvtConditions} data onto the detector and then checks
- * that all channels of each sensor have non-zero data values for applicable
- * parameters.
+ * This test loads {@link SvtConditions} data onto the detector and then checks that all channels of each sensor have
+ * non-zero data values for applicable parameters.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
  */
 // TODO: Update this test with more meaningful assertions.
 public final class SvtDetectorSetupTest extends TestCase {
+
+    /**
+     * Maximum channel number.
+     */
+    public static final int MAX_CHANNEL_NUMBER = 639;
+
+    /**
+     * Maximum FEB Hybrid ID.
+     */
+    public static final int MAX_FEB_HYBRID_ID = 3;
+
+    /**
+     * Maximum FEB ID.
+     */
+    public static final int MAX_FEB_ID = 9;
+
+    /**
+     * Name of SVT subdetector.
+     */
+    public static final String SVT_SUBDETECTOR_NAME = "Tracker";
 
     /**
      * Total number of SVT sensors.
@@ -25,27 +44,17 @@
     public static final int TOTAL_NUMBER_OF_SENSORS = 36;
 
     /**
-     * Maximum FEB ID.
+     * Print debug message.
+     * 
+     * @param debugMessage the message
      */
-    public static final int MAX_FEB_ID = 9;
-
-    /**
-     * Maximum FEB Hybrid ID.
-     */
-    public static final int MAX_FEB_HYBRID_ID = 3;
-
-    /**
-     * Maximum channel number.
-     */
-    public static final int MAX_CHANNEL_NUMBER = 639;
-
-    /**
-     * Name of SVT subdetector.
-     */
-    public static final String SVT_SUBDETECTOR_NAME = "Tracker";
+    private void printDebug(final String debugMessage) {
+        System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+    }
 
     /**
      * Load SVT conditions data onto the detector and then perform basic checks.
+     * 
      * @throws Exception if there is a test error
      */
     public void test() throws Exception {
@@ -57,8 +66,8 @@
         final Detector detector = conditionsManager.getCachedConditions(Detector.class, "compact.xml").getCachedData();
 
         // Get all SVT conditions.
-        final SvtConditions conditions = conditionsManager.getCachedConditions(
-                SvtConditions.class, "svt_conditions").getCachedData();
+        final SvtConditions conditions = conditionsManager.getCachedConditions(SvtConditions.class, "svt_conditions")
+                .getCachedData();
 
         // Load the SVT conditions onto detector.
         final SvtDetectorSetup loader = new SvtDetectorSetup("Tracker");
@@ -74,7 +83,7 @@
 
         // Loop over sensors.
         int totalSensors = 0;
-        for (HpsSiSensor sensor : sensors) {
+        for (final HpsSiSensor sensor : sensors) {
 
             final int nChannels = sensor.getNumberOfChannels();
             assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
@@ -86,8 +95,8 @@
             assertTrue("FEB ID is invalid.  The FEB ID should be less than " + MAX_FEB_ID, febID <= MAX_FEB_ID);
 
             final int febHybridID = sensor.getFebHybridID();
-            assertTrue("FEB Hybrid ID is invalid.  The FEB Hybrid ID should be less than "
-                    + MAX_FEB_HYBRID_ID, febHybridID <= MAX_FEB_HYBRID_ID);
+            assertTrue("FEB Hybrid ID is invalid.  The FEB Hybrid ID should be less than " + MAX_FEB_HYBRID_ID,
+                    febHybridID <= MAX_FEB_HYBRID_ID);
 
             for (int channel = 0; channel < nChannels; channel++) {
 
@@ -106,12 +115,4 @@
 
         System.out.println("Successfully loaded conditions data onto " + totalSensors + " SVT sensors!");
     }
-
-    /**
-     * Print debug message.
-     * @param debugMessage the message
-     */
-    private void printDebug(String debugMessage) {
-        System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtTimingConstantsTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtTimingConstantsTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/SvtTimingConstantsTest.java	Mon Jul  6 12:03:16 2015
@@ -11,7 +11,7 @@
 /**
  * Read SVT timing constants from the conditions database.
  *
- * @author Jeremy McCormick
+ * @author Jeremy McCormick, SLAC
  */
 public class SvtTimingConstantsTest extends TestCase {
 
@@ -23,9 +23,9 @@
     /**
      * This is a list of run start values to check.
      */
-    private static final int[] RUNS = new int[] {4871, 5038, 5076, 5139, 5174, 5218, 5236, 5251, 5263, 5299, 5310, 5375, 5400, 5533, 5558, 5575,
-            5596, 5601, 5603, 5610, 4871, 5038, 5076, 5139, 5174, 5218, 5236, 5251, 5263, 5299, 5310, 5375, 5400, 5533, 5558, 5575, 5596, 5601, 5603,
-            5610, 5640, 5641, 5642, 5686, 5722, 5779};
+    private static final int[] RUNS = new int[] {4871, 5038, 5076, 5139, 5174, 5218, 5236, 5251, 5263, 5299, 5310,
+            5375, 5400, 5533, 5558, 5575, 5596, 5601, 5603, 5610, 4871, 5038, 5076, 5139, 5174, 5218, 5236, 5251, 5263,
+            5299, 5310, 5375, 5400, 5533, 5558, 5575, 5596, 5601, 5603, 5610, 5640, 5641, 5642, 5686, 5722, 5779};
 
     /**
      * Load SVT timing constants and print them out by run range.
@@ -38,11 +38,12 @@
         // manager.setConnectionResource("/org/hps/conditions/config/jeremym_dev_connection.prop");
         for (final int run : RUNS) {
             manager.setDetector(DETECTOR, run);
-            final SvtTimingConstantsCollection collection = manager.getCachedConditions(SvtTimingConstantsCollection.class, "svt_timing_constants")
-                    .getCachedData();
+            final SvtTimingConstantsCollection collection = manager.getCachedConditions(
+                    SvtTimingConstantsCollection.class, "svt_timing_constants").getCachedData();
             final ConditionsRecord condi = manager.findConditionsRecords("svt_timing_constants").get(0);
-            System.out.println("run_start: " + condi.getRunStart() + ", run_end: " + condi.getRunEnd() + ", offset_phase: "
-                    + collection.get(0).getOffsetPhase() + ", offset_time: " + collection.get(0).getOffsetTime());
+            System.out.println("run_start: " + condi.getRunStart() + ", run_end: " + condi.getRunEnd()
+                    + ", offset_phase: " + collection.get(0).getOffsetPhase() + ", offset_time: "
+                    + collection.get(0).getOffsetTime());
         }
     }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java	Mon Jul  6 12:03:16 2015
@@ -11,54 +11,39 @@
 import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
 
 /**
- * This test reads Test Run bad channel collections from the database
- * using a conditions series and checks that the correct number
- * of channels are flagged using several different runs.
+ * This test reads Test Run bad channel collections from the database using a conditions series and checks that the
+ * correct number of channels are flagged using several different runs.
  *
- * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class TestRunSvtBadChannelsTest extends TestCase {
 
     /*
-    mysql> select run_start, run_end, name from conditions where table_name like 'test_run_svt_bad_channels';
-    +-----------+---------+---------------------------+
-    | run_start | run_end | name                      |
-    +-----------+---------+---------------------------+
-    |         0 |    1365 | test_run_svt_bad_channels |
-    |      1351 |    1351 | test_run_svt_bad_channels |
-    |      1353 |    1353 | test_run_svt_bad_channels |
-    |      1354 |    1354 | test_run_svt_bad_channels |
-    |      1358 |    1358 | test_run_svt_bad_channels |
-    |      1359 |    1359 | test_run_svt_bad_channels |
-    |      1360 |    1360 | test_run_svt_bad_channels |
-    +-----------+---------+---------------------------+
-    */
+     * mysql> select collection_id, count(*) from test_run_svt_bad_channels group by collection_id;
+     * +---------------+----------+ | collection_id | count(*) | +---------------+----------+ | 1 | 50 | | 2 | 392 | | 3
+     * | 427 | | 4 | 457 | | 5 | 298 | | 6 | 424 | | 7 | 424 | +---------------+----------+
+     */
+    /**
+     * The bad channel count for each run.
+     */
+    private static int[] BAD_CHANNEL_COUNTS = {50, 392, 427, 457, 298, 424, 424};
+
+    /*
+     * mysql> select run_start, run_end, name from conditions where table_name like 'test_run_svt_bad_channels';
+     * +-----------+---------+---------------------------+ | run_start | run_end | name |
+     * +-----------+---------+---------------------------+ | 0 | 1365 | test_run_svt_bad_channels | | 1351 | 1351 |
+     * test_run_svt_bad_channels | | 1353 | 1353 | test_run_svt_bad_channels | | 1354 | 1354 | test_run_svt_bad_channels
+     * | | 1358 | 1358 | test_run_svt_bad_channels | | 1359 | 1359 | test_run_svt_bad_channels | | 1360 | 1360 |
+     * test_run_svt_bad_channels | +-----------+---------+---------------------------+
+     */
     /**
      * The run numbers to check.
      */
     private static final int[] RUN_NUMBERS = new int[] {0, 1351, 1353, 1354, 1358, 1359, 1360};
 
-    /*
-    mysql> select collection_id, count(*) from test_run_svt_bad_channels group by collection_id;
-    +---------------+----------+
-    | collection_id | count(*) |
-    +---------------+----------+
-    |             1 |       50 |
-    |             2 |      392 |
-    |             3 |      427 |
-    |             4 |      457 |
-    |             5 |      298 |
-    |             6 |      424 |
-    |             7 |      424 |
-    +---------------+----------+
-    */
-    /**
-     * The bad channel count for each run.
-     */
-    private static int[] BAD_CHANNEL_COUNTS = {50, 392, 427, 457, 298, 424, 424};
-
     /**
      * Test the bad channel numbers for various runs of the Test Run.
+     * 
      * @throws ConditionsNotFoundException if there is a conditions error
      */
     public void testSvtBadChannels() throws ConditionsNotFoundException {
@@ -69,7 +54,7 @@
 
         for (int i = 0; i < RUN_NUMBERS.length; i++) {
 
-            int runNumber = RUN_NUMBERS[i];
+            final int runNumber = RUN_NUMBERS[i];
 
             System.out.println("-------------");
             System.out.println("Run #" + runNumber);
@@ -78,12 +63,12 @@
 
             conditionsManager.setDetector("HPS-TestRun-v5", runNumber);
 
-            final ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> series =
-                    conditionsManager.getConditionsSeries(SvtBadChannelCollection.class, "test_run_svt_bad_channels");
+            final ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> series = conditionsManager
+                    .getConditionsSeries(SvtBadChannelCollection.class, "test_run_svt_bad_channels");
 
             int totalBadChannels = 0;
-            for (ConditionsObjectCollection<SvtBadChannel> collection : series) {
-                //System.out.println(collection.getConditionsRecord());
+            for (final ConditionsObjectCollection<SvtBadChannel> collection : series) {
+                // System.out.println(collection.getConditionsRecord());
                 totalBadChannels += collection.size();
             }
             System.out.println("found " + totalBadChannels + " total bad channels");

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtConditionsConverterTest.java	Mon Jul  6 12:03:16 2015
@@ -7,7 +7,7 @@
 /**
  * Create combined SVT conditions for Test Run.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class TestRunSvtConditionsConverterTest extends TestCase {
 
@@ -18,6 +18,7 @@
 
     /**
      * Create combined SVT Test Run conditions.
+     * 
      * @throws Exception if there is a conditions system error
      */
     public void test() throws Exception {

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDaqMappingTest.java	Mon Jul  6 12:03:16 2015
@@ -9,9 +9,39 @@
  * This test checks if the test run SVT DAQ map was loaded with reasonable values and is being read correctly from the
  * conditions database.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Jeremy McCormick, SLAC
  */
 public final class TestRunSvtDaqMappingTest extends TestCase {
+
+    /**
+     * Maximum FPGA ID.
+     */
+    private static final int MAX_FPGA_ID = 6;
+
+    /**
+     * Maximum Hybrid ID.
+     */
+    private static final int MAX_HYBRID_ID = 2;
+
+    /**
+     * Maximum layer number.
+     */
+    private static final int MAX_LAYER_NUMBER = 10;
+
+    /**
+     * Minimum FPGA ID.
+     */
+    private static final int MIN_FPGA_ID = 0;
+
+    /**
+     * Minimum Hybrid ID.
+     */
+    private static final int MIN_HYBRID_ID = 0;
+
+    /**
+     * Minimum layer number.
+     */
+    private static final int MIN_LAYER_NUMBER = 1;
 
     /**
      * The run number to use for the test.
@@ -24,34 +54,13 @@
     private static final int TOTAL_NUMBER_OF_SENSORS = 20;
 
     /**
-     * Minimum FPGA ID.
+     * Print debug message.
+     *
+     * @param debugMessage the message
      */
-    private static final int MIN_FPGA_ID = 0;
-
-    /**
-     * Maximum FPGA ID.
-     */
-    private static final int MAX_FPGA_ID = 6;
-
-    /**
-     * Minimum Hybrid ID.
-     */
-    private static final int MIN_HYBRID_ID = 0;
-
-    /**
-     * Maximum Hybrid ID.
-     */
-    private static final int MAX_HYBRID_ID = 2;
-
-    /**
-     * Minimum layer number.
-     */
-    private static final int MIN_LAYER_NUMBER = 1;
-
-    /**
-     * Maximum layer number.
-     */
-    private static final int MAX_LAYER_NUMBER = 10;
+    private void printDebug(final String debugMessage) {
+        System.out.println("[ " + this.getClass().getSimpleName() + " ]: " + debugMessage);
+    }
 
     /**
      * Perform checks of SVT DAQ mapping for Test Run.
@@ -93,13 +102,4 @@
         this.printDebug("Total number of sensors found: " + totalSensors);
         assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
     }
-
-    /**
-     * Print debug message.
-     *
-     * @param debugMessage the message
-     */
-    private void printDebug(final String debugMessage) {
-        System.out.println("[ " + this.getClass().getSimpleName() + " ]: " + debugMessage);
-    }
 }

Modified: java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java
 =============================================================================
--- java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java	(original)
+++ java/branches/HPSJAVA-488/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java	Mon Jul  6 12:03:16 2015
@@ -9,23 +9,17 @@
 import org.lcsim.geometry.Detector;
 
 /**
- * This test loads {@link TestRunSvtConditions} data onto the detector and then
- * checks that all channels of each sensor have non-zero data values for
- * applicable parameters.
+ * This test loads {@link TestRunSvtConditions} data onto the detector and then checks that all channels of each sensor
+ * have non-zero data values for applicable parameters.
  *
- * @author <a href="mailto:[log in to unmask]">Omar Moreno</a>
+ * @author Omar Moreno, UCSC
  */
 public final class TestRunSvtDetectorSetupTest extends TestCase {
 
     /**
-     * Run number to use for test.
+     * Maximum channel number.
      */
-    private static final int RUN_NUMBER = 1351;
-
-    /**
-     * Total number of SVT sensors.
-     */
-    private static final int TOTAL_NUMBER_OF_SENSORS = 20;
+    private static final int MAX_CHANNEL_NUMBER = 639;
 
     /**
      * Maximum FPGA ID.
@@ -38,9 +32,9 @@
     private static final int MAX_HYBRID_ID = 2;
 
     /**
-     * Maximum channel number.
+     * Run number to use for test.
      */
-    private static final int MAX_CHANNEL_NUMBER = 639;
+    private static final int RUN_NUMBER = 1351;
 
     /**
      * Name of SVT subdetector.
@@ -48,7 +42,22 @@
     private static final String SVT_SUBDETECTOR_NAME = "Tracker";
 
     /**
+     * Total number of SVT sensors.
+     */
+    private static final int TOTAL_NUMBER_OF_SENSORS = 20;
+
+    /**
+     * Print debug message.
+     * 
+     * @param debugMessage the message
+     */
+    private void printDebug(final String debugMessage) {
+        System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+    }
+
+    /**
      * Load SVT conditions data onto the detector and then perform basic checks of channel conditions data.
+     * 
      * @throws Exception if there is a test error
      */
     public void test() throws Exception {
@@ -70,7 +79,7 @@
 
         // Loop over sensors.
         int totalSensors = 0;
-        for (HpsTestRunSiSensor sensor : sensors) {
+        for (final HpsTestRunSiSensor sensor : sensors) {
 
             final int nChannels = sensor.getNumberOfChannels();
             assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
@@ -82,8 +91,8 @@
             assertTrue("FPGA ID is invalid.  The FPGA ID should be less than " + MAX_FPGA_ID, fpgaID <= MAX_FPGA_ID);
 
             final int hybridID = sensor.getHybridID();
-            assertTrue("Hybrid ID is invalid.  The Hybrid ID should be less than "
-                    + MAX_HYBRID_ID, hybridID <= MAX_HYBRID_ID);
+            assertTrue("Hybrid ID is invalid.  The Hybrid ID should be less than " + MAX_HYBRID_ID,
+                    hybridID <= MAX_HYBRID_ID);
 
             for (int channel = 0; channel < nChannels; channel++) {
 
@@ -103,12 +112,4 @@
         System.out.println("Successfully loaded test run conditions data onto " + totalSensors + " SVT sensors!");
     }
 
-    /**
-     * Print debug message.
-     * @param debugMessage the message
-     */
-    private void printDebug(String debugMessage) {
-        System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
-    }
-
 }

Modified: java/branches/HPSJAVA-488/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java
 =============================================================================
--- java/branches/HPSJAVA-488/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java	(original)
+++ java/branches/HPSJAVA-488/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java	Mon Jul  6 12:03:16 2015
@@ -131,7 +131,7 @@
      */
     private void setupColumns(final TableMetaData tableInfo) {
 
-        final int fieldNameCount = tableInfo.getFieldNames().length;
+        final int fieldNameCount = tableInfo.getFieldNames().size();
         this.columnCount = fieldNameCount + 1;
 
         this.columnTypes = new Class<?>[this.columnCount];
@@ -140,10 +140,10 @@
         this.columnNames[0] = "id";
         this.columnTypes[0] = int.class;
 
-        for (int i = 0; i < fieldNameCount; i++) {
-            final String fieldName = tableInfo.getFieldNames()[i];
-            this.columnNames[i + 1] = fieldName;
-            this.columnTypes[i + 1] = tableInfo.getFieldType(fieldName);
+        int columnNumber = 1;
+        for (String fieldName : tableInfo.getFieldNames()) {
+            this.columnNames[columnNumber + 1] = fieldName;
+            this.columnTypes[columnNumber + 1] = tableInfo.getFieldType(fieldName);
         }
     }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use