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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Nov 5 16:28:37 GMT 2013


Author: whalley
Date: Tue Nov  5 16:28:37 2013
New Revision: 1651

Log:
adding timestamp to HepML formatter

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

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/HepMLFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/HepMLFormatter.java	Tue Nov  5 14:54:40 2013	(r1650)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/HepMLFormatter.java	Tue Nov  5 16:28:37 2013	(r1651)
@@ -6,17 +6,24 @@
 import cedar.hepdata.db.*;
 
 import java.util.*;
+import java.text.*;
 
 import org.antlr.stringtemplate.*;
 
 
 public class HepMLFormatter {
 
+    public static String _getTimestamp(){
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+        Date date = new Date();
+        return dateFormat.format(date);
+    }
+
     public static String format(Paper p) {
         if(p == null) return null;
 	    StringBuffer s = new StringBuffer();
         s.append("<hepml>\n");
-        s.append("  <data timestamp=''>\n");
+        s.append("  <data timestamp='" + _getTimestamp() + "'>\n");
         s.append("    <paper spiresId='" + p.getSpiresId() + "' inspireId='" + p.getInspireId() + "' redId='" + p.getRedId() + "' preprintDate=''>\n");
         s.append("      <title>\n");
         s.append("        " + p.getTitle() + "\n");


More information about the HepData-svn mailing list