javax.jdo
Interface StateManager


public interface StateManager

Version:
0.9
Author:
clr

Method Summary
 boolean getBooleanField(java.lang.Object pc, int field, boolean currentValue)
          Return the value for the field.
 byte getByteField(java.lang.Object pc, int field, byte currentValue)
          Return the value for the field.
 char getCharField(java.lang.Object pc, int field, char currentValue)
          Return the value for the field.
 double getDoubleField(java.lang.Object pc, int field, double currentValue)
          Return the value for the field.
 float getFloatField(java.lang.Object pc, int field, float currentValue)
          Return the value for the field.
 int getIntField(java.lang.Object pc, int field, int currentValue)
          Return the value for the field.
 long getLongField(java.lang.Object pc, int field, long currentValue)
          Return the value for the field.
 java.lang.Object getObjectField(java.lang.Object pc, int field, java.lang.Object currentValue)
          Return the value for the field.
 java.lang.Object getObjectId(java.lang.Object pc)
          Return the object representing the JDO identity of the calling instance.
 PersistenceManager getPersistenceManager(java.lang.Object pc)
          Return the PersistenceManager that owns this instance.
 short getShortField(java.lang.Object pc, int field, short currentValue)
          Return the value for the field.
 java.lang.String getStringField(java.lang.Object pc, int field, java.lang.String currentValue)
          Return the value for the field.
 java.lang.Object getTransactionalObjectId(java.lang.Object pc)
          Return the object representing the JDO identity of the calling instance.
 boolean isDeleted(java.lang.Object pc)
          Tests whether this object has been deleted.
 boolean isDirty(java.lang.Object pc)
          Tests whether this object is dirty.
 boolean isLoaded(java.lang.Object pc, int field)
          Return true if the field is cached in the calling instance.
 boolean isNew(java.lang.Object pc)
          Tests whether this object has been newly made persistent.
 boolean isPersistent(java.lang.Object pc)
          Tests whether this object is persistent.
 boolean isTransactional(java.lang.Object pc)
          Tests whether this object is transactional.
 void makeDirty(java.lang.Object pc, java.lang.String fieldName)
          Mark the associated PersistenceCapable field dirty.
 void preSerialize(java.lang.Object pc)
          Guarantee that the serializable transactional and persistent fields are loaded into the instance.
 void providedBooleanField(java.lang.Object pc, int field, boolean currentValue)
          The value of the field requested to be provided to the StateManager
 void providedByteField(java.lang.Object pc, int field, byte currentValue)
          The value of the field requested to be provided to the StateManager
 void providedCharField(java.lang.Object pc, int field, char currentValue)
          The value of the field requested to be provided to the StateManager
 void providedDoubleField(java.lang.Object pc, int field, double currentValue)
          The value of the field requested to be provided to the StateManager
 void providedFloatField(java.lang.Object pc, int field, float currentValue)
          The value of the field requested to be provided to the StateManager
 void providedIntField(java.lang.Object pc, int field, int currentValue)
          The value of the field requested to be provided to the StateManager
 void providedLongField(java.lang.Object pc, int field, long currentValue)
          The value of the field requested to be provided to the StateManager
 void providedObjectField(java.lang.Object pc, int field, java.lang.Object currentValue)
          The value of the field requested to be provided to the StateManager
 void providedShortField(java.lang.Object pc, int field, short currentValue)
          The value of the field requested to be provided to the StateManager
 void providedStringField(java.lang.Object pc, int field, java.lang.String currentValue)
          The value of the field requested to be provided to the StateManager
 boolean replacingBooleanField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 byte replacingByteField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 char replacingCharField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 double replacingDoubleField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 byte replacingFlags(java.lang.Object pc)
          The owning StateManager uses this method to supply the value of the flags to the PersistenceCapable instance.
 float replacingFloatField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 int replacingIntField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 long replacingLongField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 java.lang.Object replacingObjectField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 short replacingShortField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 StateManager replacingStateManager(java.lang.Object pc, StateManager sm)
          Replace the current value of jdoStateManager.
 java.lang.String replacingStringField(java.lang.Object pc, int field)
          The replacing value of the field in the calling instance
 boolean setBooleanField(java.lang.Object pc, int field, boolean currentValue, boolean newValue)
          Mark the field as modified by the user, and return the new value for the field.
 byte setByteField(java.lang.Object pc, int field, byte currentValue, byte newValue)
          Mark the field as modified by the user, and return the new value for the field.
 char setCharField(java.lang.Object pc, int field, char currentValue, char newValue)
          Mark the field as modified by the user, and return the new value for the field.
 double setDoubleField(java.lang.Object pc, int field, double currentValue, double newValue)
          Mark the field as modified by the user, and return the new value for the field.
 float setFloatField(java.lang.Object pc, int field, float currentValue, float newValue)
          Mark the field as modified by the user, and return the new value for the field.
 int setIntField(java.lang.Object pc, int field, int currentValue, int newValue)
          Mark the field as modified by the user, and return the new value for the field.
 long setLongField(java.lang.Object pc, int field, long currentValue, long newValue)
          Mark the field as modified by the user, and return the new value for the field.
 java.lang.Object setObjectField(java.lang.Object pc, int field, java.lang.Object currentValue, java.lang.Object newValue)
          Mark the field as modified by the user, and return the new value for the field.
 short setShortField(java.lang.Object pc, int field, short currentValue, short newValue)
          Mark the field as modified by the user, and return the new value for the field.
 java.lang.String setStringField(java.lang.Object pc, int field, java.lang.String currentValue, java.lang.String newValue)
          Mark the field as modified by the user, and return the new value for the field.
 

Method Detail

replacingFlags

public byte replacingFlags(java.lang.Object pc)
The owning StateManager uses this method to supply the value of the flags to the PersistenceCapable instance.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
the value of jdoFlags to be stored in the PersistenceCapable instance

replacingStateManager

public StateManager replacingStateManager(java.lang.Object pc,
                                          StateManager sm)
Replace the current value of jdoStateManager.

This method is called by the PersistenceCapable whenever jdoReplaceStateManager is called and there is already an owning StateManager. This is a security precaution to ensure that the owning StateManager is the only source of any change to its reference in the PersistenceCapable.

Parameters:
pc - the calling PersistenceCapable instance
sm - the proposed new value for the jdoStateManager
Returns:
the new value for the jdoStateManager

isDirty

public boolean isDirty(java.lang.Object pc)
Tests whether this object is dirty. Instances that have been modified, deleted, or newly made persistent in the current transaction return true.

Transient nontransactional instances return false.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance has been modified in the current transaction.
See Also:
PersistenceCapable.jdoMakeDirty(String fieldName)

isTransactional

public boolean isTransactional(java.lang.Object pc)
Tests whether this object is transactional. Instances that respect transaction boundaries return true. These instances include transient instances made transactional as a result of being the target of a makeTransactional method call; newly made persistent or deleted persistent instances; persistent instances read in data store transactions; and persistent instances modified in optimistic transactions.

Transient nontransactional instances return false.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance is transactional.

isPersistent

public boolean isPersistent(java.lang.Object pc)
Tests whether this object is persistent. Instances whose state is stored in the data store return true.

Transient instances return false.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance is persistent.
See Also:
PersistenceManager.makePersistent(Object pc)

isNew

public boolean isNew(java.lang.Object pc)
Tests whether this object has been newly made persistent. Instances that have been made persistent in the current transaction return true.

Transient instances return false.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance was made persistent in the current transaction.
See Also:
PersistenceManager.makePersistent(Object pc)

isDeleted

public boolean isDeleted(java.lang.Object pc)
Tests whether this object has been deleted. Instances that have been deleted in the current transaction return true.

Transient instances return false.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
true if this instance was deleted in the current transaction.
See Also:
PersistenceManager.deletePersistent(Object pc)

getPersistenceManager

public PersistenceManager getPersistenceManager(java.lang.Object pc)
Return the PersistenceManager that owns this instance.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
the PersistenceManager that owns this instance

makeDirty

public void makeDirty(java.lang.Object pc,
                      java.lang.String fieldName)
Mark the associated PersistenceCapable field dirty.

The StateManager will make a copy of the field so it can be restored if needed later, and then mark the field as modified in the current transaction.

Parameters:
pc - the calling PersistenceCapable instance
fieldName - the name of the field

getObjectId

public java.lang.Object getObjectId(java.lang.Object pc)
Return the object representing the JDO identity of the calling instance. If the JDO identity is being changed in the current transaction, this method returns the identity as of the beginning of the transaction.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the JDO identity of the calling instance

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(java.lang.Object pc)
Return the object representing the JDO identity of the calling instance. If the JDO identity is being changed in the current transaction, this method returns the current identity as changed in the transaction.

Parameters:
pc - the calling PersistenceCapable instance
Returns:
the object representing the JDO identity of the calling instance

isLoaded

public boolean isLoaded(java.lang.Object pc,
                        int field)
Return true if the field is cached in the calling instance.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
whether the field is cached in the calling instance

preSerialize

public void preSerialize(java.lang.Object pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance. This method is called by the generated jdoPreSerialize method prior to serialization of the instance.

Parameters:
pc - the calling PersistenceCapable instance

getBooleanField

public boolean getBooleanField(java.lang.Object pc,
                               int field,
                               boolean currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getCharField

public char getCharField(java.lang.Object pc,
                         int field,
                         char currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getByteField

public byte getByteField(java.lang.Object pc,
                         int field,
                         byte currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getShortField

public short getShortField(java.lang.Object pc,
                           int field,
                           short currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getIntField

public int getIntField(java.lang.Object pc,
                       int field,
                       int currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getLongField

public long getLongField(java.lang.Object pc,
                         int field,
                         long currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getFloatField

public float getFloatField(java.lang.Object pc,
                           int field,
                           float currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getDoubleField

public double getDoubleField(java.lang.Object pc,
                             int field,
                             double currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getStringField

public java.lang.String getStringField(java.lang.Object pc,
                                       int field,
                                       java.lang.String currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

getObjectField

public java.lang.Object getObjectField(java.lang.Object pc,
                                       int field,
                                       java.lang.Object currentValue)
Return the value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
Returns:
the new value for the field

setBooleanField

public boolean setBooleanField(java.lang.Object pc,
                               int field,
                               boolean currentValue,
                               boolean newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setCharField

public char setCharField(java.lang.Object pc,
                         int field,
                         char currentValue,
                         char newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setByteField

public byte setByteField(java.lang.Object pc,
                         int field,
                         byte currentValue,
                         byte newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setShortField

public short setShortField(java.lang.Object pc,
                           int field,
                           short currentValue,
                           short newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setIntField

public int setIntField(java.lang.Object pc,
                       int field,
                       int currentValue,
                       int newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setLongField

public long setLongField(java.lang.Object pc,
                         int field,
                         long currentValue,
                         long newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setFloatField

public float setFloatField(java.lang.Object pc,
                           int field,
                           float currentValue,
                           float newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setDoubleField

public double setDoubleField(java.lang.Object pc,
                             int field,
                             double currentValue,
                             double newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setStringField

public java.lang.String setStringField(java.lang.Object pc,
                                       int field,
                                       java.lang.String currentValue,
                                       java.lang.String newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

setObjectField

public java.lang.Object setObjectField(java.lang.Object pc,
                                       int field,
                                       java.lang.Object currentValue,
                                       java.lang.Object newValue)
Mark the field as modified by the user, and return the new value for the field.

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field
newValue - the proposed new value of the field
Returns:
the new value for the field

providedBooleanField

public void providedBooleanField(java.lang.Object pc,
                                 int field,
                                 boolean currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedCharField

public void providedCharField(java.lang.Object pc,
                              int field,
                              char currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedByteField

public void providedByteField(java.lang.Object pc,
                              int field,
                              byte currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedShortField

public void providedShortField(java.lang.Object pc,
                               int field,
                               short currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedIntField

public void providedIntField(java.lang.Object pc,
                             int field,
                             int currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedLongField

public void providedLongField(java.lang.Object pc,
                              int field,
                              long currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedFloatField

public void providedFloatField(java.lang.Object pc,
                               int field,
                               float currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedDoubleField

public void providedDoubleField(java.lang.Object pc,
                                int field,
                                double currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedStringField

public void providedStringField(java.lang.Object pc,
                                int field,
                                java.lang.String currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

providedObjectField

public void providedObjectField(java.lang.Object pc,
                                int field,
                                java.lang.Object currentValue)
The value of the field requested to be provided to the StateManager

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
currentValue - the current value of the field

replacingBooleanField

public boolean replacingBooleanField(java.lang.Object pc,
                                     int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingCharField

public char replacingCharField(java.lang.Object pc,
                               int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingByteField

public byte replacingByteField(java.lang.Object pc,
                               int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingShortField

public short replacingShortField(java.lang.Object pc,
                                 int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingIntField

public int replacingIntField(java.lang.Object pc,
                             int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingLongField

public long replacingLongField(java.lang.Object pc,
                               int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingFloatField

public float replacingFloatField(java.lang.Object pc,
                                 int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingDoubleField

public double replacingDoubleField(java.lang.Object pc,
                                   int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingStringField

public java.lang.String replacingStringField(java.lang.Object pc,
                                             int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field

replacingObjectField

public java.lang.Object replacingObjectField(java.lang.Object pc,
                                             int field)
The replacing value of the field in the calling instance

Parameters:
pc - the calling PersistenceCapable instance
field - the field number
Returns:
the new value for the field


Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04