arlut.csd.ganymede
Class DBObject

java.lang.Object
  |
  +--arlut.csd.ganymede.DBObject
All Implemented Interfaces:
db_object, FieldType, java.rmi.Remote
Direct Known Subclasses:
DBEditObject

public class DBObject
extends java.lang.Object
implements db_object, FieldType, java.rmi.Remote

Class to hold a typed, read-only database object as represented in the Ganymede DBStore database. DBObjects can be exported via RMI for remote access by remote clients. Clients directly access instances of DBObject for viewing or editing in the form of a db_object RMI interface type passed as return value in calls made on the Session remote interface.

A DBObject is identified by a unique identifier called an Invid and contains a set of DBField objects which hold the actual data values held in the object. The client typically interacts with the fields held in this object directly using the db_field remote interface which is returned by the DBObject getField methods. DBObject is not directly involved in the client's interaction with the DBFields, although the DBFields will call methods on the owning DBObject to consult about permissions and the like. Clients that call the GanymedeSession's view_db_object() method to view a DBObject actually interact with a copy of the DBObject created by the view_db_object() method to enforce appropriate read permissions.

A plain DBObject is not editable; all value-changing calls to DBFields contained in a plain DBObject will reject any change requests. In order to edit a DBObject, a client must get access to a DBEditObject object derived from the DBObject. This is typically done by calling edit_db_object on the server's Session remote interface.

The DBStore contains a single read-only DBObject in its database for each Invid. In order to change a DBObject, that DBObject must have its createShadow method called. This is a synchronized method which attaches a new DBEditObject to the DBObject. Only one DBEditObject can be created from a single DBObject at a time, and it must be created in the context of a DBEditSet transaction object. Once the DBEditObject is created, that transaction has exclusive right to make changes to the DBEditObject. When the transaction is committed, a new DBObject is created from the values held in the DBEditObject. That DBObject is then placed back into the DBStore, replacing the original DBObject. If instead the transaction is aborted, the DBObject forgets about the DBEditObject that had been attached to it and the DBObject is once again available for other transactions to edit.

Actually, the above picture is a bit too simple. The server's DBStore object does not directly contain DBObjects, but instead contains DBObjectBase objects, which define a type of DBObject, and contain all DBObjects of that type in turn. The DBObjectBase is responsible for making sure that each DBObject has its own unique Invid based on the DBObjectBase's type id and a unique number for the individual DBObject.

In terms of type definition, the DBObjectBase object acts as a template for objects of the type. Each DBObjectBase contains a set of DBObjectBaseField objects which define the names and types of DBFields that a DBObject of that type is meant to store.

In addition, each DBObjectBase can be linked to a custom DBEditObject subclass that oversees all kinds of operations on DBObjects of this kind. Custom DBEditObject subclasses can define special logic for object creation, viewing, and editing, including custom object linking logic, acceptable value constraints, and even step-by-step wizard dialog sequences to oversee certain kinds of operations.

All DBObjects have a certain number of DBFields pre-defined, including an InvidDBField listing the owner groups that this DBObject belongs to, a number of StringDBFields that contain information about the last admin to modify this DBObject, DateDBFields recording the creation and last modification dates of this object, and so on. See SchemaConstants for details on the built-in field types.

DBObject has had its synchronization revised so that only the createShadow, clearShadow, getFieldPerm, receive, and emitXML methods are sync'ed on the DBObject itself. Everything else syncs on the field table held within the DBObject. createShadow() and clearShadow() in particular must remain sync'ed on the same monitor, but for most things we want to sync on the interior fieldAry.

Is all this clear? Good!


Field Summary
(package private) static boolean debug
           
(package private) static boolean debugEmit
           
protected  arlut.csd.ganymede.DBField[] fieldAry
          Our fields, hashed into an array
protected  arlut.csd.ganymede.GanymedeSession gSession
          if this object is being viewed by a particular Ganymede Session, we record that here.
(package private)  arlut.csd.ganymede.Invid myInvid
          A fixed copy of our Invid, so that we don't have to create new ones all the time when people call getInvid() on us.
(package private)  arlut.csd.ganymede.DBObject next
          used by the DBObjectTable logic
protected  arlut.csd.ganymede.DBObjectBase objectBase
          The type definition for this object.
protected  arlut.csd.ganymede.PermEntry[] permCacheAry
          Permission cache for our fields, hashed into an array using the same indexing as fieldAry.
(package private)  arlut.csd.ganymede.DBEditObject shadowObject
          if this object is being edited or removed, this points to the DBEditObject copy that is being edited.
 
Fields inherited from interface arlut.csd.ganymede.FieldType
BOOLEAN, DATE, FIRSTFIELD, FLOAT, INVID, IP, LASTFIELD, NUMERIC, PASSWORD, PERMISSIONMATRIX, STRING
 
Constructor Summary
  DBObject()
          No param constructor, here to allow DBEditObject to have a no-param constructor for a static method handle
(package private) DBObject(arlut.csd.ganymede.DBEditObject eObj)
          This constructor is used to create a non-editable DBObject from a DBEditObject that we have finished editing.
(package private) DBObject(arlut.csd.ganymede.DBObjectBase objectBase)
          Base constructor, used to create a new object of type objectBase.
(package private) DBObject(arlut.csd.ganymede.DBObjectBase objectBase, java.io.DataInput in, boolean journalProcessing)
          Read constructor.
(package private) DBObject(arlut.csd.ganymede.DBObjectBase objectBase, int id)
          Constructor to create an object of type objectBase with the specified object number.
  DBObject(arlut.csd.ganymede.DBObject original, arlut.csd.ganymede.GanymedeSession gSession)
          This is a view-copy constructor, designed to make a view-only duplicate of an object from the database.
 
Method Summary
private  void appendObjectInfo(java.lang.StringBuffer buffer, java.lang.String prefix, boolean local)
          This method is used to concatenate a textual description of this object to the passed-in StringBuffer.
 boolean canInactivate()
          Returns true if inactivate() is a valid operation on checked-out objects of this type.
 java.util.Vector checkRequiredFields()
          This method scans through all fields defined in the DBObjectBase for this object type and determines if all required fields have been filled in.
 void clearField(short id)
          This method removes a DBField that has the a field id matching the argument from this object's fieldAry.
 void clearFieldPerm(short id)
          This method clears any cached PermEntry value for the given field id.
(package private)  boolean clearShadow(arlut.csd.ganymede.DBEditSet editset)
          This method is the complement to createShadow, and is used during editset release.
(package private)  arlut.csd.ganymede.DBEditObject createShadow(arlut.csd.ganymede.DBEditSet editset)
          Check this object out from the datastore for editing.
(package private)  void emit(java.io.DataOutput out)
          The emit() method is part of the process of dumping the DBStore to disk.
 void emitXML(arlut.csd.ganymede.XMLDumpContext xmlOut)
          This method is used when this object is being dumped.
 boolean equals(java.lang.Object param)
          Simple equals test..
 void exportFields()
          This method makes the fields in this object remotely accessible.
 short findField(short id)
          This method finds the index for the given field id in this object's fieldAry and permCacheAry tables.
 java.util.Vector getASymmetricTargets()
          This method returns a Vector of Invids for objects that are pointed to from this object by way of non-symmetric links.
 java.util.Vector getBackLinks()
          This method returns a Vector of Invids that point to this object via asymmetric link fields.
 arlut.csd.ganymede.DBObjectBase getBase()
          Returns the data dictionary for this object
 java.lang.String getContainingLabel()
          This method is a convenience for server-side code.
 java.util.Vector getEmailTargets()
          Returns a vector of email addresses that can be used to send 'in-care-of' email for this object.
 java.util.Date getExpirationDate()
          Returns the date that this object is to be automatically inactivated if it has an expiration date set.
 arlut.csd.ganymede.db_field getField(short id)
          Get access to a field from this object.
 arlut.csd.ganymede.db_field getField(java.lang.String fieldname)
          Get read-only access to a field from this object, by name.
 arlut.csd.ganymede.DBObjectBaseField getFieldDef(short fieldcode)
          Returns the field definition for the given field code, or null if that field code is not registered with this object type.
 short getFieldId(java.lang.String fieldname)
          This method returns the short field id code for the named field, if the field is present in this object, or -1 if the field could not be found.
 java.util.Vector getFieldInfoVector()
          Get read-only Vector of DBFieldInfo objects for the custom DBFields contained in this object, in display order.
 java.lang.String getFieldName(short id)
          Returns the name of a field from this object.
 arlut.csd.ganymede.PermEntry getFieldPerm(short fieldcode)
           
 java.lang.Object getFieldValue(short fieldID)
          Shortcut method to get a field's value.
 java.lang.Object getFieldValueLocal(short fieldID)
          Shortcut method to get a field's value.
 java.util.Vector getFieldValues(short fieldID)
          Shortcut method to set a field's value.
 java.util.Vector getFieldValuesLocal(short fieldID)
          Shortcut method to set a field's value.
 java.util.Vector getFieldVect()
          This method provides a Vector of DBFields contained in this object in a fashion that does not contribute to fieldAry threadlock.
 java.util.Vector getFieldVector(boolean customOnly)
          Get a display-order sorted list of DBFields contained in this object.
 arlut.csd.ganymede.GanymedeSession getGSession()
          Returns the GanymedeSession that this object is checked out in care of.
 int getID()
          Returns the numeric id of the object in the objectBase
 arlut.csd.ganymede.Invid getInvid()
          Returns the invid of this object for the db_object remote interface
 java.lang.String getLabel()
          Returns the primary label of this object..
 arlut.csd.ganymede.db_field getLabelField()
          Get access to the field that serves as this object's label
 short getLabelFieldID()
          Get access to the field id for the field that serves as this object's label, if any.
 java.lang.String getPrintString()
          This server-side method returns a summary description of this object, including a listing of all non-null fields and their contents.
 java.util.Date getRemovalDate()
          Returns the date that this object is to go through final removal if it has been inactivated.
 java.lang.StringBuffer getSummaryDescription()
          This method is used to provide a summary description of this object, including a listing of all non-null fields and their contents.
 java.lang.String getTypeDesc()
          Returns the string of the object's type
 short getTypeID()
          Returns the numeric id of the object's objectBase
 java.lang.String getTypeName()
          Returns the name of the object's objectBase
 boolean hasEmailTarget()
          Returns true if this object has an 'in-care-of' email address that should be notified when this object is changed.
 int hashCode()
           
 boolean isEmbedded()
          Returns true if this object is an embedded type.
 boolean isInactivated()
          Returns true if this object has been inactivated and is pending deletion.
 boolean isSet(short fieldID)
          This method is for use on the server, so that custom code can call a simple method to test to see if a boolean field is defined and has a true value.
 boolean isValid()
          Returns true if this object has all its required fields defined
 arlut.csd.ganymede.db_field[] listFields()
          Get complete list of DBFields contained in this object.
 java.lang.String lookupLabel(arlut.csd.ganymede.DBObject object)
          This method is used to provide a hook to allow different objects to generate different labels for a given object based on their perspective.
 void print(java.io.PrintStream out)
          Generate a complete printed representation of the object, suitable for printing to a debug or log stream.
 void print(java.io.PrintWriter out)
          Generate a complete printed representation of the object, suitable for printing to a debug or log stream.
(package private)  void receive(java.io.DataInput in, boolean journalProcessing)
          The receive() method is part of the process of loading the DBStore from disk.
 void replaceField(arlut.csd.ganymede.DBField field)
          This method replaces a DBField with a given field id in this object's fieldAry DBField array with a new DBField sharing the same id.
 arlut.csd.ganymede.DBField retrieveField(short id)
          This method retrieves a DBField from this object's fieldAry DBField array.
 void saveField(arlut.csd.ganymede.DBField field)
          This method places a DBField into a slot in this object's fieldAry DBField array.
(package private)  void setBackPointers()
          This method is called to register all asymmetric pointers in this object with the DBStore's backPointers hash structure.
static void setDebug(boolean val)
           
 arlut.csd.ganymede.ReturnVal setFieldValue(short fieldID, java.lang.Object value)
          Shortcut method to set a field's value.
 java.lang.String toString()
          Provide easy server-side access to this object's name in a String context.
(package private)  void unsetBackPointers()
          This method is called to unregister all asymmetric pointers in this object from the DBStore's backPointers hash structure.
(package private)  void updateBaseRefs(arlut.csd.ganymede.DBObjectBase newBase)
          This method is used to correct this object's base pointers when the base changes.
 boolean willBeRemoved()
          Returns true if this object has a removal date set.
 boolean willExpire()
          Returns true if this object has an expiration date set.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

static boolean debug

debugEmit

static final boolean debugEmit
See Also:
Constant Field Values

objectBase

protected arlut.csd.ganymede.DBObjectBase objectBase
The type definition for this object.


fieldAry

protected arlut.csd.ganymede.DBField[] fieldAry
Our fields, hashed into an array

See Also:
DBField

permCacheAry

protected arlut.csd.ganymede.PermEntry[] permCacheAry
Permission cache for our fields, hashed into an array using the same indexing as fieldAry.


shadowObject

arlut.csd.ganymede.DBEditObject shadowObject
if this object is being edited or removed, this points to the DBEditObject copy that is being edited. If this object is not being edited, this field will be null, and we are available for someone to edit.


gSession

protected arlut.csd.ganymede.GanymedeSession gSession
if this object is being viewed by a particular Ganymede Session, we record that here.


myInvid

arlut.csd.ganymede.Invid myInvid
A fixed copy of our Invid, so that we don't have to create new ones all the time when people call getInvid() on us.


next

arlut.csd.ganymede.DBObject next
used by the DBObjectTable logic

Constructor Detail

DBObject

public DBObject()
No param constructor, here to allow DBEditObject to have a no-param constructor for a static method handle


DBObject

DBObject(arlut.csd.ganymede.DBObjectBase objectBase)
Base constructor, used to create a new object of type objectBase. Note that DBObject itself is a mere carrier of data and there is nothing application type specific in a base DBObject. The only type information is represented by the DBObjectBase passed in to this constructor.


DBObject

DBObject(arlut.csd.ganymede.DBObjectBase objectBase,
         int id)
Constructor to create an object of type objectBase with the specified object number.


DBObject

DBObject(arlut.csd.ganymede.DBObjectBase objectBase,
         java.io.DataInput in,
         boolean journalProcessing)
   throws java.io.IOException
Read constructor. Constructs an objectBase from a DataInput stream.


DBObject

DBObject(arlut.csd.ganymede.DBEditObject eObj)

This constructor is used to create a non-editable DBObject from a DBEditObject that we have finished editing. Whenever a transaction checks a created or edited shadow back into the DBStore, it actually does so by creating a new DBObject to replace any previous version of the object in the DBStore.

Parameters:
eObj - The shadow object to copy into the new DBObject
See Also:
DBEditSet.commit(), DBEditSet.release()

DBObject

public DBObject(arlut.csd.ganymede.DBObject original,
                arlut.csd.ganymede.GanymedeSession gSession)

This is a view-copy constructor, designed to make a view-only duplicate of an object from the database. This view-only object knows who is looking at it through its GanymedeSession reference, and so can properly enforce field access permissions.

<gSession> may be null, in which case the returned DBObject will be simply an un-linked fresh copy of <original>.

Method Detail

setDebug

public static void setDebug(boolean val)

exportFields

public final void exportFields()
This method makes the fields in this object remotely accessible. Used by GanymedeSession when it provides a DBObject to the client.


hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

getID

public final int getID()
Returns the numeric id of the object in the objectBase

Specified by:
getID in interface db_object
See Also:
db_object

getInvid

public final arlut.csd.ganymede.Invid getInvid()
Returns the invid of this object for the db_object remote interface

Specified by:
getInvid in interface db_object
See Also:
db_object

getTypeID

public final short getTypeID()
Returns the numeric id of the object's objectBase

Specified by:
getTypeID in interface db_object
See Also:
db_object

getTypeName

public final java.lang.String getTypeName()
Returns the name of the object's objectBase

Specified by:
getTypeName in interface db_object
See Also:
db_object

getBase

public final arlut.csd.ganymede.DBObjectBase getBase()
Returns the data dictionary for this object


getFieldDef

public final arlut.csd.ganymede.DBObjectBaseField getFieldDef(short fieldcode)
Returns the field definition for the given field code, or null if that field code is not registered with this object type.


getFieldPerm

public final arlut.csd.ganymede.PermEntry getFieldPerm(short fieldcode)

getGSession

public final arlut.csd.ganymede.GanymedeSession getGSession()

Returns the GanymedeSession that this object is checked out in care of.


toString

public java.lang.String toString()
Provide easy server-side access to this object's name in a String context.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object param)
Simple equals test.. doesn't really test to see if things are value-equals, but rather identity equals.

Overrides:
equals in class java.lang.Object

getLabel

public java.lang.String getLabel()

Returns the primary label of this object.. calls getLabelHook() on the DBEditObject serving as the objectHook for this object's DBObjectBase to get the label for this object.

If the objectHook customization object doesn't define a getLabelHook() method, this base implementation will return a string based on the designated label field for this object, or a generic label constructed based on the object type and invid if no label field is designated.

We don't synchronize getLabel(), as it is very, very frequently called from all over, and we don't want to chance deadlock. getField() and getValueString() are both synchronized on subcomponents of DBObject, so this method should be adequately safe as written.

Specified by:
getLabel in interface db_object
See Also:
db_object

getLabelField

public arlut.csd.ganymede.db_field getLabelField()

Get access to the field that serves as this object's label

Not all objects use simple field values as their labels. If an object has a calculated label, this method will return null.

Specified by:
getLabelField in interface db_object

getLabelFieldID

public short getLabelFieldID()

Get access to the field id for the field that serves as this object's label, if any.

Not all objects use simple field values as their labels. If an object has a calculated label, this method will return -1.

Specified by:
getLabelFieldID in interface db_object

isEmbedded

public boolean isEmbedded()
Returns true if this object is an embedded type.

Specified by:
isEmbedded in interface db_object
See Also:
db_object

getTypeDesc

public java.lang.String getTypeDesc()
Returns the string of the object's type


emit

void emit(java.io.DataOutput out)
    throws java.io.IOException

The emit() method is part of the process of dumping the DBStore to disk. emit() dumps an object in its entirety to the given out stream.

Parameters:
out - A DBJournal or DBStore writing stream.
java.io.IOException

receive

void receive(java.io.DataInput in,
             boolean journalProcessing)
       throws java.io.IOException

The receive() method is part of the process of loading the DBStore from disk. receive() reads an object from the given in stream and instantiates it into the DBStore.

This method is synchronized, but there are a lot of other methods in DBObject which are not synchronized and which could cause problems if they are run concurrently with receive. All the ones that play in the fieldAry array. This is only workable because receive is not called on an object after it has been loaded into the database.

java.io.IOException

emitXML

public void emitXML(arlut.csd.ganymede.XMLDumpContext xmlOut)
             throws java.io.IOException

This method is used when this object is being dumped. It is mated with receiveXML().

java.io.IOException

createShadow

arlut.csd.ganymede.DBEditObject createShadow(arlut.csd.ganymede.DBEditSet editset)

Check this object out from the datastore for editing. This method is intended to be called by the editDBObject method in DBSession.. createShadow should not be called on an arbitrary viewed object in other contexts.. probably should do something to guarantee this?

If this object is being edited, we say that it has a shadow object; a session gets a copy of this object.. the copy is actually a DBEditObject, which has the intelligence to allow the client to modify the (copies of the) data fields.

note: this is only used for editing pre-existing objects.. the code for creating new objects is in DBSession.. this method might be better incorporated into DBSession as well.

Parameters:
editset - The transaction to own this shadow.

clearShadow

boolean clearShadow(arlut.csd.ganymede.DBEditSet editset)

This method is the complement to createShadow, and is used during editset release.

Parameters:
editset - The transaction owning this object's shadow.
See Also:
DBEditSet.release()

getFieldInfoVector

public java.util.Vector getFieldInfoVector()

Get read-only Vector of DBFieldInfo objects for the custom DBFields contained in this object, in display order.

Specified by:
getFieldInfoVector in interface db_object
See Also:
db_object

getFieldVect

public final java.util.Vector getFieldVect()

This method provides a Vector of DBFields contained in this object in a fashion that does not contribute to fieldAry threadlock.


saveField

public final void saveField(arlut.csd.ganymede.DBField field)

This method places a DBField into a slot in this object's fieldAry DBField array. As a (probably reckless) speed optimization, this method makes no checks to ensure that another DBField with the same field id has not previously been stored, so it should only be used when the DBObject's fieldAry is in a known state. Otherwise, clearField() should be called before calling saveField(), so that duplicate field id's are not accidentally introduced into the DBObject's fieldAry.

saveField() uses a hashing algorithm to try and speed up field save and retrieving, but we are optimizing for low memory usage rather than O(1) saving and retrieving. Hash collisions are saved directly in the fieldAry, meaning that any hash collisions increase the likelihood of further hash collisions, but we don't need an extra 'next' pointer in the DBField class, saving us 4 bytes of memory for every field of every object in the database.

.


replaceField

public final void replaceField(arlut.csd.ganymede.DBField field)

This method replaces a DBField with a given field id in this object's fieldAry DBField array with a new DBField sharing the same id. If this DBObject does not contain a field with the same id as the field argument for this method, no action will be taken and an IllegalArgumentException will be thrown.

replaceField() uses a hashing algorithm to try and speed up field save and retrieving, but we are optimizing for low memory usage rather than O(1) saving and retrieving. Hash collisions are saved directly in the fieldAry, meaning that any hash collisions increase the likelihood of further hash collisions, but we don't need an extra 'next' pointer in the DBField class, saving us 4 bytes of memory for every field of every object in the database.

.


clearField

public final void clearField(short id)

This method removes a DBField that has the a field id matching the argument from this object's fieldAry. This method will never fail.. if there is no field matching the given field id, the method will return without changing the fieldAry.

clearField() uses a hashing algorithm to try and speed up field save and retrieving, but we are optimizing for low memory usage rather than O(1) saving and retrieving. Hash collisions are saved directly in the fieldAry, meaning that any hash collisions increase the likelihood of further hash collisions, but we don't need an extra 'next' pointer in the DBField class, saving us 4 bytes of memory for every field of every object in the database.

.


retrieveField

public final arlut.csd.ganymede.DBField retrieveField(short id)

This method retrieves a DBField from this object's fieldAry DBField array. retrieveField() uses a hashing algorithm to try and speed up field retrieving, but we are optimizing for low memory usage rather than O(1) operations.


findField

public final short findField(short id)

This method finds the index for the given field id in this object's fieldAry and permCacheAry tables.

Returns:
-1 if we couldn't find a field with the given id

clearFieldPerm

public final void clearFieldPerm(short id)

This method clears any cached PermEntry value for the given field id.

.


getField

public final arlut.csd.ganymede.db_field getField(short id)

Get access to a field from this object. This method is exported to clients over RMI.

Specified by:
getField in interface db_object
Parameters:
id - The field code for the desired field of this object.
See Also:
db_object

getField

public final arlut.csd.ganymede.db_field getField(java.lang.String fieldname)

Get read-only access to a field from this object, by name.

Specified by:
getField in interface db_object
Parameters:
fieldname - The fieldname for the desired field of this object
See Also:
db_object

getFieldName

public final java.lang.String getFieldName(short id)

Returns the name of a field from this object.

Specified by:
getFieldName in interface db_object
Parameters:
id - The field code for the desired field of this object.

getFieldId

public final short getFieldId(java.lang.String fieldname)

This method returns the short field id code for the named field, if the field is present in this object, or -1 if the field could not be found.

Specified by:
getFieldId in interface db_object

listFields

public arlut.csd.ganymede.db_field[] listFields()

Get complete list of DBFields contained in this object. The list returned will appear in unsorted order.

Specified by:
listFields in interface db_object
See Also:
db_object

canInactivate

public boolean canInactivate()

Returns true if inactivate() is a valid operation on checked-out objects of this type.

Specified by:
canInactivate in interface db_object
See Also:
db_object

isInactivated

public boolean isInactivated()

Returns true if this object has been inactivated and is pending deletion.

Specified by:
isInactivated in interface db_object
See Also:
db_object

isValid

public boolean isValid()

Returns true if this object has all its required fields defined

This method can be overridden in DBEditObject subclasses to do a more refined validity check if desired.

Specified by:
isValid in interface db_object
See Also:
db_object

checkRequiredFields

public final java.util.Vector checkRequiredFields()

This method scans through all fields defined in the DBObjectBase for this object type and determines if all required fields have been filled in. If everything is ok, this method will return null. If any required fields are found not to have been filled out, this method returns a vector of field names that need to be filled out.

This method is used by the transaction commit logic to ensure a consistent transaction. If server-local code has called GanymedeSession.enableOversight(false) this method will not be called at transaction commit time.


getRemovalDate

public java.util.Date getRemovalDate()

Returns the date that this object is to go through final removal if it has been inactivated.

Specified by:
getRemovalDate in interface db_object
See Also:
db_object

willExpire

public boolean willExpire()

Returns true if this object has an expiration date set.

Specified by:
willExpire in interface db_object
See Also:
db_object

willBeRemoved

public boolean willBeRemoved()

Returns true if this object has a removal date set.

See Also:
db_object

getExpirationDate

public java.util.Date getExpirationDate()

Returns the date that this object is to be automatically inactivated if it has an expiration date set.

Specified by:
getExpirationDate in interface db_object
See Also:
db_object

hasEmailTarget

public final boolean hasEmailTarget()

Returns true if this object has an 'in-care-of' email address that should be notified when this object is changed.


getEmailTargets

public final java.util.Vector getEmailTargets()

Returns a vector of email addresses that can be used to send 'in-care-of' email for this object.


setFieldValue

public arlut.csd.ganymede.ReturnVal setFieldValue(short fieldID,
                                                  java.lang.Object value)

Shortcut method to set a field's value. Using this method saves a roundtrip to the server, which is particularly useful in database loading.

Specified by:
setFieldValue in interface db_object
See Also:
db_object

getFieldValue

public java.lang.Object getFieldValue(short fieldID)

Shortcut method to get a field's value. Using this method saves a roundtrip to the server, which is particularly useful in database loading.

Specified by:
getFieldValue in interface db_object
See Also:
db_object

getFieldValueLocal

public java.lang.Object getFieldValueLocal(short fieldID)

Shortcut method to get a field's value. Used only on the server, as permissions are not checked.


isSet

public boolean isSet(short fieldID)

This method is for use on the server, so that custom code can call a simple method to test to see if a boolean field is defined and has a true value.

An exception will be thrown if the field is not a boolean.


getFieldValues

public java.util.Vector getFieldValues(short fieldID)

Shortcut method to set a field's value. Using this method saves a roundtrip to the server, which is particularly useful in database loading.

Specified by:
getFieldValues in interface db_object
See Also:
db_object

getFieldValuesLocal

public java.util.Vector getFieldValuesLocal(short fieldID)

Shortcut method to set a field's value. This is a server-side method, but it can be a quick way to get a vector of elements.

Warning! The Vector returned by getFieldValuesLocal() is not a clone, but is direct access to the vector held in the DBField. Clone the vector you get back if you need to do anything with it other than read it.


getFieldVector

public java.util.Vector getFieldVector(boolean customOnly)

Get a display-order sorted list of DBFields contained in this object.

This is a server-side only operation.. permissions are not checked.


lookupLabel

public java.lang.String lookupLabel(arlut.csd.ganymede.DBObject object)

This method is used to provide a hook to allow different objects to generate different labels for a given object based on their perspective. This is used to sort of hackishly simulate a relational-type capability for the purposes of viewing backlinks.

See the automounter map and NFS volume DBEditObject subclasses for how this is to be used, if you have them.


updateBaseRefs

void updateBaseRefs(arlut.csd.ganymede.DBObjectBase newBase)

This method is used to correct this object's base pointers when the base changes. This happens when the schema is edited.. this method is called on all objects under a DBObjectBase to make the object point to the new version of the DBObjectBase. This method also takes care of cleaning out any fields that have become undefined due to a change in the schema for the field, as in a change from a vector to a scalar field, or vice-versa.


getContainingLabel

public java.lang.String getContainingLabel()

This method is a convenience for server-side code. If this object is an embedded object, this method will return the label of the containing object. If this object is not embedded, or the containing object's label cannot be determined, null will be returned.


getASymmetricTargets

public java.util.Vector getASymmetricTargets()

This method returns a Vector of Invids for objects that are pointed to from this object by way of non-symmetric links. These are Invids that may need to be marked as non-deletable if this object is checked out by a DBEditSet.


getBackLinks

public java.util.Vector getBackLinks()

This method returns a Vector of Invids that point to this object via asymmetric link fields.


setBackPointers

void setBackPointers()

This method is called to register all asymmetric pointers in this object with the DBStore's backPointers hash structure.

Typically this will be done when an object is first loaded from the database, at a time when the DBStore backPointers hash structure has no entries for this object at all.

During the commit process of a normal transaction, the syncObjBackPointers() method in the DBEditSet class handles these updates.


unsetBackPointers

void unsetBackPointers()

This method is called to unregister all asymmetric pointers in this object from the DBStore's backPointers hash structure.

Typically this will be done when an object is being deleted from the database in response to a journal entry, or if the object is being replaced with an updated version from the journal.

During the commit process of a normal transaction, the syncObjBackPointers() method in the DBEditSet class handles these updates.


print

public void print(java.io.PrintStream out)

Generate a complete printed representation of the object, suitable for printing to a debug or log stream.


print

public void print(java.io.PrintWriter out)

Generate a complete printed representation of the object, suitable for printing to a debug or log stream.


getPrintString

public java.lang.String getPrintString()

This server-side method returns a summary description of this object, including a listing of all non-null fields and their contents.

This method calls appendObjectInfo to do most of its work.


getSummaryDescription

public java.lang.StringBuffer getSummaryDescription()

This method is used to provide a summary description of this object, including a listing of all non-null fields and their contents. This method is remotely callable by the client, and so will only reveal fields that the user has permission to view. This method returns a StringBuffer to work around problems with serializing large strings in early versions of the JDK.

This method calls appendObjectInfo to do most of its work.

Specified by:
getSummaryDescription in interface db_object

appendObjectInfo

private void appendObjectInfo(java.lang.StringBuffer buffer,
                              java.lang.String prefix,
                              boolean local)

This method is used to concatenate a textual description of this object to the passed-in StringBuffer. This description is relatively free-form, and is intended to be used for human consumption and not for programmatic operations.

This method is called by getSummaryDescription.

Parameters:
buffer - The StringBuffer to append this object's description to
prefix - Used for recursive calls on embedded objects, this prefix will be inserted at the beginning of each line of text concatenated to buffer by this method.
local - If false, read permissions will be checked for each field before adding it to the buffer.