[HepData-svn] r1566 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 15 14:07:12 BST 2012


Author: whalley
Date: Wed Aug 15 14:07:12 2012
New Revision: 1566

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

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java	Wed Aug 15 14:06:49 2012	(r1565)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java	Wed Aug 15 14:07:12 2012	(r1566)
@@ -38,7 +38,7 @@
     }
 
 
-    public static String _datasetXML(Dataset d) {
+    public static String _datasetXML(Dataset d,String stype) {
         StringBuffer s = new StringBuffer();
         try {
             Paper pp = d.getPaper();
@@ -56,7 +56,7 @@
             StringTemplate t_pname = new StringTemplate("$expts$$year$_$spiresId$");
             t_pname.setAttribute("expts", expts);
             t_pname.setAttribute("year", year);
-            if(d.getPaper().getInspireId() == 917009) { t_pname.setAttribute("spiresId", "I"+d.getPaper().getInspireId()); } 
+            if(stype.equals("i")) { t_pname.setAttribute("spiresId", "I"+d.getPaper().getInspireId()); } 
             else { t_pname.setAttribute("spiresId", "S"+d.getPaper().getSpiresId()); }
             String pname = t_pname.toString();
             String path = "/REF/" + pname;
@@ -151,32 +151,32 @@
 
 
 
-    public static String format(Paper p) {
+    public static String format(Paper p,String stype) {
         String out = null;
         if (p != null) {
-            out = AidaFormatter.format(p.getDatasets());
+            out = AidaFormatter.format(p.getDatasets(),stype);
         }
         return out;
     }
 
 
-    public static String format(Collection<Dataset> ds) {
+    public static String format(Collection<Dataset> ds,String stype) {
         StringBuffer s = new StringBuffer();
         s.append(_headerXML());
         for (Dataset d : ds) {
-            s.append(_datasetXML(d));
+            s.append(_datasetXML(d,stype));
         }
         s.append(_footerXML());
         return s.toString();
     }
 
 
-    public static String format(Dataset d) {
+    public static String format(Dataset d,String stype) {
         String out = null;
         if (d != null) {
             StringBuffer s = new StringBuffer();
             s.append(_headerXML());
-            s.append(_datasetXML(d));
+            s.append(_datasetXML(d,stype));
             s.append(_footerXML());
             out = s.toString();
         }


More information about the HepData-svn mailing list