[HepData-svn] r1837 - trunk/hepdata-model/src/main/java/cedar/hepdata/model

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Dec 4 16:55:06 GMT 2014


Author: watt
Date: Thu Dec  4 16:55:05 2014
New Revision: 1837

Log:
Add functions for ModAction and display date updated in better format

Modified:
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Modification.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Thu Dec  4 16:53:12 2014	(r1836)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Thu Dec  4 16:55:05 2014	(r1837)
@@ -30,6 +30,10 @@
     @Column(name="LocalId", nullable=false)
     private Integer _localId;
 
+    /** Type of dataset, normal, correlation, 3D etc. */
+    @Column(name="DataType", nullable=true, length=20)
+    private String _dataType;
+
     /** Searchable dataset properties. */
     @OneToMany(mappedBy="_dataset")
     @org.hibernate.annotations.Cascade(value={org.hibernate.annotations.CascadeType.ALL,
@@ -278,7 +282,16 @@
         return this;
     }
 
+    /** Get datatype. */
+    public String getDataType(){
+	return _dataType;
+    }
 
+    /** Set datatype. */
+    public Dataset setDataType(String datatype){
+	_dataType  =datatype;
+	return this;
+    }
 
     /** Get parent paper. */
     public Paper getPaper() {

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Modification.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Modification.java	Thu Dec  4 16:53:12 2014	(r1836)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Modification.java	Thu Dec  4 16:55:05 2014	(r1837)
@@ -22,6 +22,9 @@
     @Column(name="ModComment", nullable=true, length=10000)
     private String _comment;
 
+    /** The action of the modification (Encoded, Updated, Checked etc.). */
+    @Column(name="ModAction", nullable=true)
+    private String _action;
 
     //////////////////////////////////////////////////////////
 
@@ -71,6 +74,16 @@
     }
 
 
+    /** Get the action of this modification. */
+    public String getAction() {
+        return _action;
+    }
+    /** Set the action of this modification. */
+    public Modification setAction(String action) {
+        _action = action;
+        return this;
+    }
+
     //////////////////////////////////////////////////////////
 
 
@@ -99,7 +112,8 @@
         StringBuffer s = new StringBuffer();
         s.append(getTimestamp().toString() + ", ");
         s.append(getModifier() + "\n");
-        s.append(getComment());
+        s.append(getComment() + "\n");
+	s.append(getAction());
         return s.toString();
     }
 
@@ -116,6 +130,7 @@
         if (getTimestamp() != null) code ^= getTimestamp().hashCode();
         if (getModifier() != null)  code ^= getModifier().hashCode();
         if (getComment() != null)   code ^= getComment().hashCode();
+	if (getAction() != null)   code ^= getAction().hashCode();
         return code;
     }
 

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Thu Dec  4 16:53:12 2014	(r1836)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Thu Dec  4 16:55:05 2014	(r1837)
@@ -338,11 +338,18 @@
 	        nc += 1;
 	        if(nc == n){
 	            if( mod.getModifier()!=null){
-	                if(n==1) { s.append("DES = Encoded " + mod.getComment() + " by " + mod.getModifier() + ";"); }
+			if ( mod.getAction()!=null ) {
+			    if(n==1) { s.append("DES = " + mod.getAction() + mod.getComment() + " by " + mod.getModifier() + ";"); }
+		            else     { s.append("DES.= " + mod.getAction() + mod.getComment() + " by " + mod.getModifier() + ";"); }    
+			    modstring = s.toString();
+		            break;
+			} else {
+			    if(n==1) { s.append("DES = Encoded " + mod.getComment() + " by " + mod.getModifier() + ";"); }
 		            else     { s.append("DES.= Modified " + mod.getComment() + " by " + mod.getModifier() + ";"); }    
-	                modstring = s.toString();
+			    modstring = s.toString();
 		            break;
-		        }
+			}
+		    }
 	        }
 	    }
 	    return modstring;
@@ -589,7 +596,15 @@
 
     /** Get paper/record dateupdated */
     public String getDateUpdated() {
-        return _dateupdated;
+	// G.W. 03/12/2014 Make more readable than just yyyyMMddhhmmss.
+	String yyyy = _dateupdated.substring(0,4);
+	String MM = _dateupdated.substring(4,6);
+	String dd = _dateupdated.substring(6,8);
+	String hh = _dateupdated.substring(8,10);
+	String mm = _dateupdated.substring(10,12);
+	String ss = _dateupdated.substring(12,14);
+	String dateupdated = dd + "/" + MM + "/" + yyyy + " " + hh + ":" + mm + ":" + ss;
+        return dateupdated;
     }
     /** Set paper/record dateupdated */
     public Paper setDateUpdated(String dateupdated) {
@@ -843,6 +858,7 @@
         } else {
             for (Modification mod : getModifications()) {
                 s.append("\n" + indent + mod.getTimestamp());
+		s.append(" " + mod.getAction());
                 s.append(" by " + mod.getModifier());
                 if (mod.getComment() != null && mod.getComment().length() != 0)
                     s.append(": " + mod.getComment());


More information about the HepData-svn mailing list