Salome HOME
Siman codebase is refactored. Spring beans are introduced in the context.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / bo / som / Timestamp.java
diff --git a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Timestamp.java b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Timestamp.java
new file mode 100644 (file)
index 0000000..6593c54
--- /dev/null
@@ -0,0 +1,88 @@
+package org.splat.dal.bo.som;
+/**
+ * 
+ * @author    Daniel Brunier-Coulin
+ * @copyright OPEN CASCADE 2012
+ */
+
+import java.util.Comparator;
+import java.util.Date;
+
+import org.splat.dal.bo.kernel.Any;
+import org.splat.dal.bo.kernel.Attribute;
+import org.splat.dal.bo.kernel.User;
+
+
+public class Timestamp extends Any {
+
+    private  StampRelation  context;
+    private  ValidationStep mytype;
+    private  User           author;
+    private  Date           sdate;
+
+    public static class ComparatorByDate implements Comparator<Timestamp> {
+//  ---------------------------------------------------------------------
+      public int compare(Timestamp t1, Timestamp t2)
+      {
+        return t1.getDate().compareTo(t2.getDate());
+      }
+    }
+
+//  ==============================================================================================================================
+//  Construction
+//  ==============================================================================================================================
+
+//  Database fetch constructor
+    protected Timestamp () {
+    }
+//  Internal constructors
+    public Timestamp (ValidationStep type, Document from, User to, Date sdate) {
+//  -----------------------------------------------------------------------------
+      super((Attribute)null);       // For building the collection of attributes
+      this.mytype  = type;
+      this.author  = to;
+      this.sdate   = sdate;
+      this.context = new StampRelation(from, this);
+    }
+
+//  ==============================================================================================================================
+//  Public member functions
+//  ==============================================================================================================================
+
+    public User getAuthor () {
+//  ------------------------
+      return author;
+    }
+
+    public String getComment () {
+//  ---------------------------
+      CommentAttribute   field  = (CommentAttribute)this.getAttribute(CommentAttribute.class);
+      String             result = null;
+      if (field != null) result = field.getValue();
+      return result;
+    }
+
+    public Date getDate () {
+//  ----------------------
+      return sdate;
+    }
+
+    public ValidationStep getType () {
+//  --------------------------------
+      return mytype;
+    }
+
+    public void setComment (String comment) {
+//  ---------------------------------------
+      if (comment != null) this.setAttribute( new CommentAttribute(this, comment) );
+    }
+
+//  ==============================================================================================================================
+//  Protected services
+//  ==============================================================================================================================
+
+    protected StampRelation getContext () {
+//  -------------------------------------
+      return context;
+    }
+}
\ No newline at end of file