[HepData-svn] r1619 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Apr 30 12:10:44 BST 2013


Author: whalley
Date: Tue Apr 30 12:10:44 2013
New Revision: 1619

Log:
use table locations in names of extra files

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Mon Apr 29 15:00:06 2013	(r1618)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue Apr 30 12:10:44 2013	(r1619)
@@ -112,10 +112,16 @@
 // This next sections adds any extra information to the specific table.
 // Not ideal because the relative table Id could change but I see no better was.
 // Requires two files:   description.n and link.n in the specific resource direcotry
-       String descname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/description."+_dataset.getId();
-       String linkname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/link."+_dataset.getId();
-       File descfile = new File(descname);
-       if(descfile.exists()) {
+        String location=""; 
+        for (String comment : _dataset.getComments()){
+           if(comment.startsWith("Location:")) {
+               location = comment.substring(10).replaceAll(" ","_");
+           }
+        }
+        String descname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/description."+location;
+        String linkname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/link."+location;
+        File descfile = new File(descname);
+        if(descfile.exists()) {
            try{
                BufferedReader indesc=new BufferedReader(new FileReader(descname));
                BufferedReader inlink=new BufferedReader(new FileReader(linkname));
@@ -653,25 +659,6 @@
 //        writer.attributes("value", getSearchString());
 //        writer.end();
 //
-// This next sections adds any extra information to the specific table.
-// Not ideal because the relative table Id could change but I see no better was.
-// Requires two files:   description.n and link.n in the specific resource direcotry
-//       String descname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/description."+_dataset.getId();
-//       String linkname="/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/link."+_dataset.getId();
-//       File descfile = new File(descname);
-//       if(descfile.exists()) {
-//           try{
-//               BufferedReader indesc=new BufferedReader(new FileReader(descname));
-//               BufferedReader inlink=new BufferedReader(new FileReader(linkname));
-//               String desc = indesc.readLine();
-//               String link = inlink.readLine();
-//               writer.write(desc);
-//               writer.element("a");
-//               writer.attributes("href","/resource/"+_dataset.getPaper().getSpiresId()+"/"+link);
-//               writer.write("here");
-//               writer.end();
-//           } catch (IOException e){}
-//       }
     }
 
 


More information about the HepData-svn mailing list