[HepData-svn] r1797 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed May 7 15:30:43 BST 2014


Author: whalley
Date: Wed May  7 15:30:42 2014
New Revision: 1797

Log:
fix to input formatter to output spicifc tables only

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Wed May  7 15:29:46 2014	(r1796)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Wed May  7 15:30:42 2014	(r1797)
@@ -35,6 +35,10 @@
     // Decode URL context into the params map
     public StreamResponse onActivate(EventContext context) {
         // Do the basic parsing via the base class
+        for (int ii=0; ii<context.getCount(); ii++){
+           System.out.println("Context: "+context.get(String.class,ii)); 
+           System.out.println("ContextSize: "+context.getCount()); 
+        }  
         parseBaseViewContext(context);
 
         // Handle pattern parsing separately
@@ -63,7 +67,7 @@
             if (fmt.equals("hepml")) return asHepML();
             if (fmt.equals("marcxml")) return asMarcXML();
             if (fmt.equals("bdms")) return asBDMS();
-            if (fmt.equals("input")) return asINPUT();
+            if (fmt.equals("input")) return asINPUT(context);
             if (fmt.equals("plain.txt")) return asPlain();
             if (fmt.equals("aida")) return asAIDA(stype);
             if (fmt.equals("pyroot.py")) return asPyROOT();
@@ -144,11 +148,13 @@
     public Object getInputContext() {
         return formatContext("input");
     }
-    public StreamResponse asINPUT() {
-        Paper p = getPaper();
-        String asINPUT = InputFormatter.format(p);
+    public StreamResponse asINPUT(EventContext context) {
+        Paper p = null;
+        if(context.getCount()==2) { p = getPaper(); }
+        Set<Dataset> ds = getDatasets();
+        String asINPUT = InputFormatter.format(ds, p);
         if (asINPUT == null) {
-            asINPUT = "No valid paper specified";
+            asINPUT = "No valid paper and dataset specified";
         }
         return new TextStreamResponse("text/plain", asINPUT);
     }


More information about the HepData-svn mailing list