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  January 2015

HPS-SVN January 2015

Subject:

r1823 - /java/trunk/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 2 Jan 2015 07:12:23 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (119 lines)

Author: [log in to unmask]
Date: Thu Jan  1 23:12:18 2015
New Revision: 1823

Log:
Simplify handling of multiple collections for now.

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/cli/PrintCommand.java	Thu Jan  1 23:12:18 2015
@@ -11,10 +11,9 @@
 import java.util.logging.Level;
 
 import org.apache.commons.cli.Option;
-import org.hps.conditions.api.AbstractConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsObject;
+import org.hps.conditions.api.ConditionsObjectCollection;
 import org.hps.conditions.api.ConditionsRecord.ConditionsRecordCollection;
-import org.hps.conditions.api.ConditionsSeries;
 import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.conditions.database.TableMetaData;
 
@@ -32,9 +31,6 @@
     // Print IDs along with field values. 
     boolean printIDs = false;
     
-    // Print all available conditions sets without disambiguation.
-    boolean printAllAvailable = false;
-
     // Print conditions record and table info (default is yes).
     boolean printHeaders = true;
 
@@ -43,7 +39,7 @@
     
     PrintCommand() {
         super("print", "Print the table data for a conditions set");
-        this.options.addOption(new Option("t", true, "Set the conditions set name"));
+        this.options.addOption(new Option("t", true, "Set the table name"));
         this.options.addOption(new Option("a", false, "Use all available conditions for the run number and key name"));
         this.options.addOption(new Option("i", false, "Print the ID for the records (off by default)"));
         this.options.addOption(new Option("f", true, "Write print output to a file"));
@@ -84,11 +80,6 @@
                 System.exit(1);
             }
         }              
-
-        // Print all available conditions with this key and run number and do not disambiguate the collections (e.g. by date).
-        if (this.commandLine.hasOption("a")) {
-            printAllAvailable = true;
-        }
         
         // Print IDs in the output.
         if (this.commandLine.hasOption("i")) {
@@ -125,7 +116,7 @@
         for (String conditionsKey : conditionsKeys) {
                        
             // The list of collections to print.
-            List<AbstractConditionsObjectCollection> collectionList = new ArrayList<AbstractConditionsObjectCollection>();
+            List<ConditionsObjectCollection> collectionList = new ArrayList<ConditionsObjectCollection>();
         
             // Get the table meta data for the conditions key.
             TableMetaData tableMetaData = conditionsManager.findTableMetaData(conditionsKey);
@@ -135,17 +126,10 @@
                 throw new RuntimeException("The table meta data for " + conditionsKey + " does not exist.  The key might be invalid.");
             }
         
-            // Should all available collections be printed?
-            if (printAllAvailable) {
-                // Use all available conditions sets for this run number and key, without performing any disambiguation.
-                ConditionsSeries series = conditionsManager.getConditionsSeries(conditionsKey);
-                collectionList.addAll(series);
-            } else {
-                // Use only the single collection which would be seen by a user job for this run number and key.
-                AbstractConditionsObjectCollection collection = conditionsManager.getCollection(tableMetaData.getCollectionClass());
-                collectionList.add(collection);
-            }
-
+            // Use only the single collection which would be seen by a user job for this run number and key.
+            ConditionsObjectCollection collection = conditionsManager.getCollection(tableMetaData.getCollectionClass());
+            collectionList.add(collection);
+        
             // Print out all the collection data to console or file.
             printCollections(collectionList);
         }   
@@ -153,9 +137,9 @@
         ps.close();
     }
 
-    private void printCollections(List<AbstractConditionsObjectCollection> collectionList) {
+    private void printCollections(List<ConditionsObjectCollection> collectionList) {
         // Loop over all the collections and print them.
-        for (AbstractConditionsObjectCollection collection : collectionList) {
+        for (ConditionsObjectCollection collection : collectionList) {
             if (printHeaders) {
                 printCollectionHeader(collection);
             }
@@ -165,7 +149,7 @@
         }
     }
 
-    private void printCollection(AbstractConditionsObjectCollection collection) {
+    private void printCollection(ConditionsObjectCollection collection) {
         StringBuffer buffer = new StringBuffer();
         for (Object object : collection) {
             for (String columnName : collection.getTableMetaData().getFieldNames()) {
@@ -178,7 +162,7 @@
         ps.print(buffer.toString());
     }
 
-    private void printCollectionHeader(AbstractConditionsObjectCollection collection) {
+    private void printCollectionHeader(ConditionsObjectCollection collection) {
         ps.println("--------------------------------------");
         ps.println();
         ps.println(collection.getConditionsRecord());

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