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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 15 14:06:49 BST 2012


Author: whalley
Date: Wed Aug 15 14:06:49 2012
New Revision: 1565

Log:
Aida formatter files name according to URL spires or inspire

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	Tue Aug  7 14:13:18 2012	(r1564)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Wed Aug 15 14:06:49 2012	(r1565)
@@ -39,6 +39,8 @@
         // Handle pattern parsing separately
         Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain.txt|yoda|aida|pyroot.py|root|mpl|bdms|hepml|jhepwork.py|input)" + "\\Z",
                                        Pattern.CASE_INSENSITIVE);
+        Pattern patt2 = Pattern.compile("\\A" + "(irn\\d+)" + "\\Z",Pattern.CASE_INSENSITIVE);
+        String stype = "i";
         for (int i = 0; i < context.getCount(); i++) {
             String ps = context.get(String.class, i);
             Matcher m = patt.matcher(ps);
@@ -47,6 +49,10 @@
             } else {
                 setQueryParam("format", "full");
             }
+            m = patt2.matcher(ps);
+            if (m.matches()) {
+                stype = "s";
+            } 
         }
 
         // Now handle the special formats (after parsing *all* context elements)
@@ -57,7 +63,7 @@
             if (fmt.equals("bdms")) return asBDMS();
             if (fmt.equals("input")) return asINPUT();
             if (fmt.equals("plain.txt")) return asPlain();
-            if (fmt.equals("aida")) return asAIDA();
+            if (fmt.equals("aida")) return asAIDA(stype);
             if (fmt.equals("pyroot.py")) return asPyROOT();
             if (fmt.equals("yoda")) return asYODA();
             if (fmt.equals("root")) return asROOT();
@@ -163,9 +169,9 @@
     public Object getAidaContext() {
         return formatContext("aida");
     }
-    public StreamResponse asAIDA() {
+    public StreamResponse asAIDA(String stype) {
         Set<Dataset> ds = getDatasets();
-        String asAIDA = AidaFormatter.format(ds);
+        String asAIDA = AidaFormatter.format(ds,stype);
         if (asAIDA == null) {
             asAIDA = "No valid paper and dataset specified";
         }


More information about the HepData-svn mailing list