latest schema.
[vamsas.git] / src / org / vamsas / client / object.java
index c34d771..e1384a4 100644 (file)
@@ -1,10 +1,15 @@
 /**
- * org.vamsas.client.object
  * 
  */
-
 package org.vamsas.client;
-
+/**
+ * Base class for all Vamsas objects extracted 
+ * from an IClientDocument. 
+ * An object maybe registered or unregistered.
+ * 
+ * @author jimp
+ *
+ */
 public abstract class object {
 
     /**
@@ -12,17 +17,66 @@ public abstract class object {
      * allows unambiguous referencing
      * to any object in the vamsas document
      */
-
-    protected String __vorba_id;
+       protected boolean __stored_in_document=false;
+    protected long __last_hash=0;
+    protected VorbaId vorbaId=null;
+    protected IVorbaIdFactory __vorba=null;
+    /**
+     * 
+     * @return true if object is registered
+     */
+    public boolean isRegistered() {
+      return (vorbaId!=null);
+    }
     /**
      * Method to get fixed reference for
      * the object in the vamsas document.
+     * @returns null if object is neither registered 
+     * or not associated with a properly instantiated 
+     * VorbaIdFactory.
      */
-    public string getVorbaId();
+    public String getVorbaId() {
+      if (vorbaId==null) {
+        // Try to use the associated factory.
+        if (__vorba!=null) 
+          if ((vorbaId = __vorba.makeVorbaId())==null)
+            return null; // Factory not valid.
+        else
+          return null;
+      }
+      return vorbaId.getId();
+    }
     /**
-     * used by the Iclient implementation
+     * used by the IClient implementation
      * to generate unique Id based on
      * client applications current namespace.
      */
-    protected string setVorbaId();
+    protected void setVorbaId(VorbaId newid) {
+      vorbaId = newid;
+    }
+    
+    /**
+     * @return true if object is present in Vamsas Document.
+     */
+    public boolean is__stored_in_document() {
+      return __stored_in_document;
+    }
+    /**
+     * for use by Vorba agent to reflect state of 
+     * vamsas object to client application.
+     * @param __stored_in_document The __stored_in_document to set.
+     */
+    protected void set__stored_in_document(boolean __stored_in_document) {
+      this.__stored_in_document = __stored_in_document;
+    }
+    /**
+     * __last_hash is the hash value computed 
+     * when the object was last checked against 
+     * a IClientDocument generated by the 
+     * object's parent IClient instance.
+     * @return Returns the __last_hash.
+     */
+    public long get__last_hash() {
+      return __last_hash;
+    }
 }