probably deprecating this class.
[vamsas.git] / src / org / vamsas / client / ClientDocument.java
index d3a3886..66eaef0 100644 (file)
@@ -14,26 +14,38 @@ import org.vamsas.objects.core.VamsasDocument;
  */
 public class ClientDocument implements IClientDocument {
   protected IClient vorba;
-
-  protected VamsasDocument doc;
-
+  protected org.vamsas.objects.core.VAMSAS[] roots;
   protected byte[] appData;
 
   /**
    * collection of org.vamsas.client.object references
    */
   protected Hashtable vamsasObjects;
-
+  
   /*
    * (non-Javadoc)
    * 
    * @see org.vamsas.client.IClientDocument#getApplicationData()
    */
 
+  /**
+   * 
+   * @param data
+   * @param doc
+   * @param objects
+   * @param vorba
+   */
+  protected ClientDocument(byte[] data, VAMSAS[] roots, Hashtable objects, IClient vorba) {
+    // TODO Auto-generated constructor stub
+    appData = data;
+    this.roots =roots;
+    vamsasObjects = objects;
+    this.vorba = vorba;
+  }
+
   public byte[] getApplicationData() {
     // Look up client byte stash using client and user handle
-    
-    return null;
+    return appData;
   }
 
   /*
@@ -64,7 +76,6 @@ public class ClientDocument implements IClientDocument {
    */
   public object[] getVamsasRoots() {
     // extract root objects
-    VAMSAS[] roots = doc.getVAMSAS();
     if (roots == null)
       return new VAMSAS[] { new VAMSAS() };
     return roots;
@@ -75,7 +86,6 @@ public class ClientDocument implements IClientDocument {
    */
   public void setVamsasRoots(VAMSAS[] newroots) {
     // extract root objects
-    VAMSAS[] roots = doc.getVAMSAS();
     if (newroots != null) {
       // check newroots for objects that were present in the old document
       // check to see if the 'old' objects have been modified
@@ -100,7 +110,7 @@ public class ClientDocument implements IClientDocument {
             }
           } else {
             throw new Error(
-                "Client error when using setVamsasRoots : The vorbaId for object "
+                "SimpleClient error when using setVamsasRoots : The vorbaId for object "
                     + i
                     + " does not refer to an object of type VAMSAS in the current document!");
           }
@@ -129,11 +139,9 @@ public class ClientDocument implements IClientDocument {
    * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.object)
    */
 public VorbaId registerObject(object unregistered) {
-    VorbaId rtn;
     if (!unregistered.isRegistered())
-      unregistered.VorbaId.(rtn=unregistered.__vorba.makeVorbaId());
-    else
-      return unregistered.getVorbaId();
+      unregistered.setVorbaId(unregistered.__vorba.makeVorbaId());
+    return unregistered.getVorbaId();
   }
   /*
    * (non-Javadoc)
@@ -141,7 +149,12 @@ public VorbaId registerObject(object unregistered) {
    * @see org.vamsas.client.IClientDocument#registerObjects(org.vamsas.client.object[])
    */
   public VorbaId[] registerObjects(object[] unregistered) {
-    // TODO Auto-generated method stub
+    if (unregistered!=null) {
+      VorbaId ids[] = new VorbaId[unregistered.length];
+      for (int i=0,k=unregistered.length; i<k; i++)
+        ids[i]=registerObject(unregistered[i]);
+      return ids;
+    }
     return null;
   }
 
@@ -151,7 +164,6 @@ public VorbaId registerObject(object unregistered) {
    * @see org.vamsas.client.IClientDocument#setApplicationData(byte[])
    */
   public void setApplicationData(byte[] newData) {
-    // TODO Auto-generated method stub
-
+    appData = newData;
   }
 }