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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 16 11:14:19 BST 2015


Author: watt
Date: Tue Jun 16 11:14:19 2015
New Revision: 1867

Log:
Fixes to status and error labels

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

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Wed Jun 10 14:11:55 2015	(r1866)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Tue Jun 16 11:14:19 2015	(r1867)
@@ -26,11 +26,14 @@
 		s.append("*doi: "+p.getDOI()+"\n");
 	    }
 
+	    int nc = 0;
             for (Modification mod : p.getModifications()){
+		nc += 1;
 		if (mod.getAction()!=null) {
 		    s.append("*status: "+mod.getAction()+" "+mod.getComment()+" by "+mod.getModifier()+"\n");
 		} else {
-		    s.append("*status: Encoded "+mod.getComment()+" by "+mod.getModifier()+"\n");
+		    if (nc==1) { s.append("*status: Encoded "+mod.getComment()+" by "+mod.getModifier()+"\n"); }
+		    else { s.append("*status: Modified "+mod.getComment()+" by "+mod.getModifier()+"\n"); }
 		}
             }
 

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Wed Jun 10 14:11:55 2015	(r1866)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Tue Jun 16 11:14:19 2015	(r1867)
@@ -60,7 +60,7 @@
                     catch (IOException e){}
                     if(first){ 
                         s.append("\n---\n");
-                  //      s.append("#This is Table 0\n");
+                  //      s.append("# This is Table 0\n");
                         s.append("name: 'Table 0'\n");
                         s.append("label: 'Additional resources for the whole record'\n");
                         s.append("additional_resources:\n");
@@ -82,7 +82,7 @@
            if(testinsert.exists()){
                if(first) {
                         s.append("---\n");
-                       // s.append("#This is Table 0\n");
+                       // s.append("# This is Table 0\n");
                         s.append("name: 'Table 0'\n");
                         s.append("label: 'Additional resources for the whole record'\n");
                         s.append("additional_resources:\n");
@@ -106,7 +106,7 @@
         }
         for (Dataset ds : p.getDatasets()){
             s.append("---\n"); 
-            s.append("#This is Data "+ds.getId()+"\n");
+            s.append("# This is Data "+ds.getId()+"\n");
             s.append(_dataYAML(ds));  // dataset information in _data
         }
  
@@ -141,11 +141,16 @@
         }
         if(p.getModifications().size()>0){
             s.append("modifications: # what, by whom and when encoded or changed\n");
+	    int mcount=0;
             for (Modification m : p.getModifications()){
-                s.append(sp+"'"+m.getAction()+" by ");
-                s.append(m.getModifier()+" on ");
-                s.append(m.getComment());
-                s.append("'\n");
+		mcount++;
+		if (m.getAction()!=null) {
+		    s.append(sp+"{ action: '"+m.getAction()+"'");
+		} else {
+		    if (mcount==1) { s.append(sp+"{ action: 'Encoded'"); }
+		    else { s.append(sp+"{ action: 'Modified'"); }
+		}
+		s.append(", date: '"+m.getComment()+"', person: '"+m.getModifier()+"' }\n");
             }
         }
 
@@ -458,11 +463,11 @@
              if(error.getNormType()==ErrorNorm.PCT){  s.append("%"); }
              s.append("}");
          }
-         if(error.getSourceType()==ErrorSource.STAT) s.append(", label: stat");
-         else if(error.getSourceType()==ErrorSource.SYS) s.append(", label: sys");
-         else if(error.getSourceType()==ErrorSource.TOTAL) s.append(", label: total");
+         if(error.getSourceType()==ErrorSource.STAT) s.append(", label: 'stat");
+         else if(error.getSourceType()==ErrorSource.SYS) s.append(", label: 'sys");
+         else if(error.getSourceType()==ErrorSource.TOTAL) s.append(", label: 'total");
          if(!error.getComment().equals("")){ s.append(","+error.getComment()); }
-         s.append("}\n");
+         s.append("'}\n");
          return s.toString();
    }
 


More information about the HepData-svn mailing list