renamed getId to avoid clashes.
[vamsas.git] / src / org / vamsas / client / object.java
1 /**
2  * 
3  */
4 package org.vamsas.client;
5 /**
6  * Base class for all Vamsas objects extracted 
7  * from an IClientDocument. 
8  * An object maybe registered or unregistered.
9  * 
10  * @author jimp
11  *
12  */
13 public abstract class object {
14
15     /**
16      * unique id for all vamsas objects
17      * allows unambiguous referencing
18      * to any object in the vamsas document
19      */
20         protected boolean __stored_in_document=false;
21     protected VorbaId vorbaId=null;
22     protected IVorbaIdFactory __vorba=null;
23     /**
24      * 
25      * @return true if object is registered
26      */
27     public boolean isRegistered() {
28       return (vorbaId!=null);
29     }
30     /**
31      * Method to get fixed reference for
32      * the object in the vamsas document.
33      * @returns null if object is neither registered 
34      * or not associated with a properly instantiated 
35      * VorbaIdFactory.
36      */
37     public String getVorbaId() {
38       if (vorbaId==null) {
39         // Try to use the associated factory.
40         if (__vorba!=null) 
41           if ((vorbaId = __vorba.makeVorbaId())==null)
42             return null; // Factory not valid.
43         else
44           return null;
45       }
46       return vorbaId.getId();
47     }
48     /**
49      * used by the IClient implementation
50      * to generate unique Id based on
51      * client applications current namespace.
52      */
53     protected void setVorbaId(VorbaId newid) {
54       vorbaId = newid;
55     }
56     
57     /**
58      * @return true if object is present in Vamsas Document.
59      */
60     public boolean is__stored_in_document() {
61       return __stored_in_document;
62     }
63     /**
64      * for use by Vorba agent to reflect state of 
65      * vamsas object to client application.
66      * @param __stored_in_document The __stored_in_document to set.
67      */
68     protected void set__stored_in_document(boolean __stored_in_document) {
69       this.__stored_in_document = __stored_in_document;
70     }
71 }