public class JDOStateManager extends AbstractStateManager implements javax.jdo.spi.StateManager, ObjectProvider
Modifier and Type | Field and Description |
---|---|
protected javax.jdo.spi.PersistenceCapable |
myPC
The PersistenceCapable instance managed by this StateManager
|
protected javax.jdo.spi.PersistenceCapable |
savedImage
Image of the PersistenceCapable instance when the instance is enlisted in the transaction.
|
activity, cmd, currFM, dirty, dirtyFields, FLAG_ATTACHING, FLAG_BECOMING_DELETED, FLAG_CHANGING_STATE, FLAG_DETACHING, FLAG_DISCONNECTING, FLAG_FLUSHED_NEW, FLAG_FLUSHING, FLAG_LOADINGFPFIELDS, FLAG_MAKING_TRANSIENT, FLAG_NEED_INHERITANCE_VALIDATION, FLAG_POSTINSERT_UPDATE, FLAG_POSTLOAD_PENDING, FLAG_RESETTING_DETACHED_STATE, FLAG_RETRIEVING_DETACHED_STATE, FLAG_STORING_PC, FLAG_UPDATING_EMBEDDING_FIELDS_WITH_OWNER, flags, HOLLOWFIELDMANAGER, loadedFields, LOCALISER, lock, lockMode, myEC, myFP, myID, myInternalID, myLC, myVersion, objectType, objectValGenerators, persistenceFlags, restoreValues, savedFlags, savedLoadedFields, transactionalVersion
EMBEDDED_COLLECTION_ELEMENT_PC, EMBEDDED_MAP_KEY_PC, EMBEDDED_MAP_VALUE_PC, EMBEDDED_PC, ORIGINAL_FIELD_VALUE_KEY_PREFIX, PC
Constructor and Description |
---|
JDOStateManager(ExecutionContext ec,
AbstractClassMetaData cmd)
Constructor for object of specified type managed by the provided ExecutionContext.
|
Modifier and Type | Method and Description |
---|---|
void |
attach(boolean embedded)
Method to attach the object managed by this StateManager.
|
void |
attach(Object trans)
Method to attach the provided transient into the managed instance.
|
Object |
attachCopy(Object obj,
boolean embedded)
Method to attach a copy of the detached persistable instance and return the (attached) copy.
|
void |
changeActivityState(ActivityState state)
Update the acitvity state.
|
void |
checkInheritance(FieldValues fv)
Deprecated.
Dont use this, to be removed
|
void |
clearFields()
Method to clear all fields of the object.
|
void |
clearLoadedFlags()
Method to clear all loaded flags on the object.
|
void |
clearNonPrimaryKeyFields()
Method to clear all fields that are not part of the primary key of the object.
|
void |
clearSavedFields()
Method to clear all saved fields on the object.
|
void |
connect(ExecutionContext ec,
AbstractClassMetaData cmd)
Method to (re)connect the provider to the specified ExecutionContext and object type.
|
void |
copyFieldsFromObject(Object obj,
int[] fieldNumbers)
Convenience method to update our object with the field values from the passed object.
|
void |
deletePersistent()
Method to delete the object from persistence.
|
void |
detach(FetchPlanState state)
Method to detach this object.
|
Object |
detachCopy(FetchPlanState state)
Method to make detached copy of this instance
If the object is detachable then the copy will be migrated to DETACHED state, otherwise will migrate
the copy to TRANSIENT.
|
void |
disconnect()
Disconnect the provider from the ExecutionContext and PC object.
|
protected boolean |
disconnectClone(javax.jdo.spi.PersistenceCapable pc)
Method to disconnect any cloned persistence capable objects from their StateManager.
|
void |
dump(PrintWriter out)
Utility to dump the contents of the StateManager.
|
void |
enlistInTransaction()
Method to enlist the managed object in the current transaction.
|
void |
evictFromTransaction()
Method to evict the managed object from the current transaction.
|
void |
flush()
Flushes any outstanding changes to the object to the datastore.
|
boolean |
getBooleanField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
boolean currentValue) |
byte |
getByteField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
byte currentValue) |
char |
getCharField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
char currentValue) |
double |
getDoubleField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
double currentValue) |
ObjectProvider[] |
getEmbeddedOwners()
Accessor for the owning ObjectProviders for the managed object when stored embedded.
|
Object |
getExternalObjectId()
Return an object identity that can be used by the user for the managed object.
|
protected Object |
getExternalObjectId(Object obj)
Return an object id that the user can use.
|
float |
getFloatField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
float currentValue) |
int |
getIntField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
int currentValue) |
long |
getLongField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
long currentValue) |
Object |
getObject()
Accessor for the Persistent Capable object.
|
Object |
getObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object currentValue) |
Object |
getObjectId(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance.
|
javax.jdo.PersistenceManager |
getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
Accessor for the PersistenceManager that owns this instance.
|
Object |
getReferencedPC()
Accessor for the referenced PC object when we are attaching or detaching.
|
short |
getShortField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
short currentValue) |
String |
getStringField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
String currentValue) |
Object |
getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance.
|
Object |
getTransactionalVersion()
Return the transactional version of the managed object.
|
Object |
getVersion()
Method to return the current version of the managed object.
|
Object |
getVersion(javax.jdo.spi.PersistenceCapable pc)
Return the object representing the version of the calling instance.
|
void |
initialiseForCachedPC(CachedPC cachedPC,
Object id)
Initialise the ObjectProvider, assigning the specified id to the object.
|
void |
initialiseForDetached(Object pc,
Object id,
Object version)
Initialises the StateManager to manage a PersistenceCapable object in detached state.
|
void |
initialiseForEmbedded(Object pc,
boolean copyPc)
Initialises a state manager to manage a PersistenceCapable instance that will be EMBEDDED/SERIALISED
into another PersistenceCapable object.
|
void |
initialiseForHollow(Object id,
FieldValues fv,
Class pcClass)
Initialises a state manager to manage a hollow instance having the given object ID and the given
(optional) field values.
|
void |
initialiseForHollowAppId(FieldValues fv,
Class pcClass)
Deprecated.
Remove use of this and use initialiseForHollow
|
void |
initialiseForHollowPreConstructed(Object id,
Object pc)
Initialises a state manager to manage the given hollow instance having the given object ID.
|
void |
initialiseForPersistentClean(Object id,
Object pc)
Initialises a state manager to manage the passed persistent instance having the given object ID.
|
void |
initialiseForPersistentNew(Object pc,
FieldValues preInsertChanges)
Initialises a state manager to manage a transient instance that is becoming newly persistent.
|
void |
initialiseForPNewToBeDeleted(Object pc)
Initialises the StateManager to manage a PersistenceCapable object that is not persistent but is
about to be deleted.
|
void |
initialiseForTransactionalTransient(Object pc)
Initialises a state manager to manage a Transactional Transient instance.
|
boolean |
isDeleted(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been deleted.
|
boolean |
isDirty(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is dirty.
|
boolean |
isLoaded(int fieldNumber)
Returns the loaded setting for the field of the managed object.
|
boolean |
isLoaded(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber)
Return true if the field is cached in the calling instance.
|
boolean |
isNew(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object has been newly made persistent.
|
boolean |
isPersistent(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is persistent.
|
boolean |
isTransactional(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is transactional.
|
void |
loadField(int fieldNumber)
Convenience method to load the specified field if not loaded.
|
void |
loadFieldValues(FieldValues fv)
Convenience method to load the passed field values.
|
protected void |
loadSpecifiedFields(int[] fieldNumbers)
Fetch the specified fields from the database.
|
void |
loadUnloadedFields()
Fetch from the database all fields that are not currently loaded regardless of whether
they are in the current fetch group or not.
|
void |
loadUnloadedFieldsInFetchPlan()
Fetchs from the database all fields that are not currently loaded and that are in the current
fetch group.
|
protected void |
loadUnloadedFieldsInFetchPlanAndVersion()
Fetchs from the database all fields in current fetch plan that are not currently loaded as well as
the version.
|
void |
loadUnloadedFieldsOfClassInFetchPlan(FetchPlan fetchPlan)
Fetchs from the database all fields in the actual fetch plan.
|
void |
makeDirty(int fieldNumber)
Marks the given field dirty.
|
void |
makeDirty(javax.jdo.spi.PersistenceCapable pc,
String fieldName)
Mark the associated PersistenceCapable field dirty.
|
void |
makePersistent()
Method to make the object persistent.
|
void |
makeTransactional()
Method to change the object state to transactional.
|
void |
makeTransient(FetchPlanState state)
Method to change the object state to transient.
|
void |
nullifyFields()
Nullify fields with reference to PersistenceCapable or SCO instances
|
protected static Object |
peekField(Object obj,
String fieldName)
Utility to take a peek at a field in the persistable object.
|
protected void |
postStateChange()
Method called after a change in state.
|
protected void |
postWriteField(boolean wasDirty)
Method called after the write of a field.
|
void |
preSerialize(javax.jdo.spi.PersistenceCapable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance.
|
protected boolean |
preWriteField(int fieldNumber)
Method called before a write of the specified field.
|
void |
providedBooleanField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
boolean currentValue)
This method is called from the associated persistable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedByteField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
byte currentValue)
This method is called from the associated persistable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedCharField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
char currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedDoubleField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
double currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedFloatField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
float currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedIntField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
int currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedLongField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
long currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object currentValue)
This method is called from the associated persistable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedShortField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
short currentValue)
This method is called from the associated PersistenceCapable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
void |
providedStringField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
String currentValue)
This method is called from the associated persistable when its
PersistenceCapable.jdoProvideFields() method is invoked.
|
Object |
provideField(int fieldNumber)
Method to return the current value of a particular field.
|
protected Object |
provideField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber)
Method to retrieve the value of a field from the PC object.
|
void |
provideFields(int[] fieldNumbers,
FieldManager fm)
Called from the StoreManager after StoreManager.update() is called to obtain updated values
from the PersistenceCapable associated with this StateManager.
|
void |
refreshFieldsInFetchPlan()
Refreshes from the database all fields in fetch plan.
|
void |
refreshLoadedFields()
Refreshes from the database all fields currently loaded.
|
void |
registerTransactional()
Registers the pc class in the cache
|
void |
replaceAllLoadedSCOFieldsWithValues()
Method to replace all loaded SCO fields that have wrappers with their value.
|
void |
replaceAllLoadedSCOFieldsWithWrappers()
Method to replace all loaded SCO fields with wrappers.
|
void |
replaceField(int fieldNumber,
Object value)
Method to change the value of a particular field and not mark it dirty.
|
protected void |
replaceField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object value)
Method to change the value of a field in the PC object.
|
protected void |
replaceField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object value,
boolean makeDirty)
Method to change the value of a field in the PC object.
|
void |
replaceFieldMakeDirty(int fieldNumber,
Object value)
Method to change the value of a particular field and mark it dirty.
|
void |
replaceFields(int[] fieldNumbers,
FieldManager fm)
Called from the StoreManager to refresh data in the PersistenceCapable
object associated with this StateManager.
|
void |
replaceFields(int[] fieldNumbers,
FieldManager fm,
boolean replaceWhenDirty)
Called from the StoreManager to refresh data in the PersistenceCapable
object associated with this StateManager.
|
void |
replaceFieldValue(int fieldNumber,
Object newValue)
Convenience method to change the value of a field that is assumed loaded.
|
void |
replaceManagedPC(Object pc)
Method that replaces the PC managed by this StateManager to be the supplied object.
|
void |
replaceNonLoadedFields(int[] fieldNumbers,
FieldManager fm)
Called from the StoreManager to refresh data in the PersistenceCapable
object associated with this StateManager.
|
protected void |
replaceStateManager(javax.jdo.spi.PersistenceCapable pc,
javax.jdo.spi.StateManager sm)
Utility to update the passed object with the passed StateManager (can be null).
|
boolean |
replacingBooleanField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber)
This method is invoked by the PersistenceCapable object's
jdoReplaceField() method to refresh the value of a boolean field.
|
byte |
replacingByteField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the PersistenceCapable object's
jdoReplaceField() method to refresh the value of a byte field.
|
char |
replacingCharField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the PersistenceCapable object's
jdoReplaceField() method to refresh the value of a char field.
|
Object[] |
replacingDetachedState(javax.jdo.spi.Detachable pc,
Object[] currentState)
Method to update the "detached state" in the detached object to obtain the "detached state"
from the detached object, or to reset it (to null).
|
double |
replacingDoubleField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the PersistenceCapable object's
jdoReplaceField() method to refresh the value of a double field.
|
byte |
replacingFlags(javax.jdo.spi.PersistenceCapable pc)
The StateManager uses this method to supply the value of jdoFlags to the
associated PersistenceCapable instance.
|
float |
replacingFloatField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the PersistenceCapable object's
jdoReplaceField() method to refresh the value of a float field.
|
int |
replacingIntField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the persistable object's
jdoReplaceField() method to refresh the value of a int field.
|
long |
replacingLongField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the persistable object's
jdoReplaceField() method to refresh the value of a long field.
|
Object |
replacingObjectField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the persistable object's
jdoReplaceField() method to refresh the value of an Object field.
|
short |
replacingShortField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the persistable object's
jdoReplaceField() method to refresh the value of a short field.
|
javax.jdo.spi.StateManager |
replacingStateManager(javax.jdo.spi.PersistenceCapable pc,
javax.jdo.spi.StateManager sm)
Replace the current value of jdoStateManager.
|
String |
replacingStringField(javax.jdo.spi.PersistenceCapable obj,
int fieldNumber)
This method is invoked by the persistable object's
jdoReplaceField() method to refresh the value of a String field.
|
void |
resetDetachState()
Convenience method to reset the detached state in the current object.
|
void |
restoreFields()
Method to restore all fields of the object.
|
void |
retrieveDetachState(ObjectProvider op)
Convenience method to retrieve the detach state from the passed ObjectProvider's object.
|
void |
runReachability(Set reachables)
Method to mark an object for reachability.
|
void |
saveFields()
Method to save all fields of the object so we can potentially restore them later.
|
void |
setBooleanField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
boolean currentValue,
boolean newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setByteField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
byte currentValue,
byte newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setCharField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
char currentValue,
char newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setDoubleField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
double currentValue,
double newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setFloatField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
float currentValue,
float newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setIntField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
int currentValue,
int newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setLongField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
long currentValue,
long newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setObjectField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object currentValue,
Object newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setPostStoreNewObjectId(Object id)
If the id is obtained after inserting the object into the database, set
new a new id for persistent classes (for example, increment).
|
void |
setShortField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
short currentValue,
short newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
void |
setStringField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
String currentValue,
String newValue)
This method is called by the associated PersistenceCapable when the
corresponding mutator method (setXXX()) is called on the PersistenceCapable.
|
Object |
unwrapSCOField(int fieldNumber,
Object value,
boolean replaceFieldIfChanged)
Method to unwrap a SCO field (if it is wrapped currently).
|
protected void |
updateField(javax.jdo.spi.PersistenceCapable pc,
int fieldNumber,
Object value)
Convenience method to perform the update of a field value when a setter is invoked.
|
void |
updateFieldAfterInsert(Object pc,
int fieldNumber)
Marks the given field dirty for issuing an update after the insert.
|
void |
validate()
Validates whether the persistence capable instance exists in the datastore.
|
Object |
wrapSCOField(int fieldNumber,
Object value,
boolean forInsert,
boolean forUpdate,
boolean replaceFieldIfChanged)
Method to create a new SCO wrapper for the specified field.
|
areFieldsLoaded, becomingDeleted, clearDirtyFlags, clearDirtyFlags, clearFieldsByNumbers, containsAssociatedValue, evict, getAllFieldsLoaded, getAssociatedValue, getCallbackHandler, getClassMetaData, getDirtyFieldNames, getDirtyFieldNumbers, getDirtyFields, getExecutionContext, getFieldNumbersOfLoadedOrDirtyFields, getInternalObjectId, getLifecycleState, getLoadedFieldNames, getLoadedFieldNumbers, getLoadedFields, getLockMode, getObjectAsPrintable, getObjectValueGenerator, getTransactionalVersion, internalDeletePersistent, isAttaching, isChangingState, isDeleting, isDetaching, isDisconnecting, isEmbedded, isFieldLoaded, isFlushedNew, isFlushedToDatastore, isFlushing, isInserting, isMakingTransient, isPostLoadPending, isResettingDetachedState, isRestoreValues, isRetrievingDetachedState, isStoringPC, isWaitingToBeFlushedToDatastore, loadFieldFromDatastore, loadFieldsFromDatastore, loadFieldsFromLevel2Cache, loadFieldsInFetchPlan, locate, lock, makeNontransactional, makePersistentTransactionalTransient, markAsFlushed, markForInheritanceValidation, markPKFieldsAsLoaded, postCommit, preBegin, preRollback, preStateChange, refresh, removeAssociatedValue, retrieve, setAssociatedValue, setFlushedNew, setFlushing, setPcObjectType, setStoringPC, setTransactionalVersion, setVersion, toString, transitionReadField, transitionWriteField, unloadField, unloadNonFetchPlanFields, unlock, unsetStoringPC, updateLevel2CacheForFields
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
becomingDeleted, evict, getAllFieldsLoaded, getAssociatedValue, getClassMetaData, getDirtyFieldNames, getDirtyFieldNumbers, getDirtyFields, getExecutionContext, getInternalObjectId, getLifecycleState, getLoadedFieldNames, getLoadedFieldNumbers, getLoadedFields, getLockMode, getObjectAsPrintable, isDeleting, isEmbedded, isFieldLoaded, isFlushedNew, isFlushedToDatastore, isInserting, isRestoreValues, isWaitingToBeFlushedToDatastore, loadFieldFromDatastore, loadFieldsInFetchPlan, locate, lock, makeNontransactional, makePersistentTransactionalTransient, markAsFlushed, markForInheritanceValidation, postCommit, preBegin, preRollback, refresh, removeAssociatedValue, retrieve, setAssociatedValue, setFlushedNew, setFlushing, setPcObjectType, setStoringPC, setTransactionalVersion, setVersion, unloadField, unloadNonFetchPlanFields, unlock, unsetStoringPC
protected javax.jdo.spi.PersistenceCapable myPC
protected javax.jdo.spi.PersistenceCapable savedImage
public JDOStateManager(ExecutionContext ec, AbstractClassMetaData cmd)
ec
- ExecutionContextcmd
- the metadata for the class.public void connect(ExecutionContext ec, AbstractClassMetaData cmd)
AbstractStateManager
connect
in interface ObjectProvider
connect
in class AbstractStateManager
public void disconnect()
disconnect
in interface ObjectProvider
public void initialiseForHollow(Object id, FieldValues fv, Class pcClass)
initialiseForHollow
in interface ObjectProvider
id
- the JDO identity of the object.fv
- the initial field values of the object (optional)pcClass
- Class of the object that this will manage the state forpublic void initialiseForHollowAppId(FieldValues fv, Class pcClass)
initialiseForHollowAppId
in interface ObjectProvider
fv
- the initial field values of the object.pcClass
- Class of the object that this will manage the state forpublic void initialiseForHollowPreConstructed(Object id, Object pc)
initialiseForHollow(java.lang.Object, org.datanucleus.store.FieldValues, java.lang.Class)
method, this method does not create a new instance and instead
takes a pre-constructed instance (such as from an ODBMS).initialiseForHollowPreConstructed
in interface ObjectProvider
id
- the identity of the object.pc
- the object to be managed.public void initialiseForPersistentClean(Object id, Object pc)
initialiseForPersistentClean
in interface ObjectProvider
id
- the identity of the object.pc
- The object to be managedpublic void initialiseForEmbedded(Object pc, boolean copyPc)
initialiseForEmbedded
in interface ObjectProvider
pc
- The PersistenceCapable to manage (see copyPc also)copyPc
- Whether the SM should manage a copy of the passed PC or that onepublic void initialiseForPersistentNew(Object pc, FieldValues preInsertChanges)
This constructor is used for assigning state managers to existing instances that are transitioning to a persistent state.
initialiseForPersistentNew
in interface ObjectProvider
pc
- the instance being make persistent.preInsertChanges
- Any changes to make before insertingpublic void initialiseForTransactionalTransient(Object pc)
This constructor is used for assigning state managers to Transient instances that are transitioning to a transient clean state.
initialiseForTransactionalTransient
in interface ObjectProvider
pc
- the instance being make persistent.public void initialiseForDetached(Object pc, Object id, Object version)
initialiseForDetached
in interface ObjectProvider
pc
- the detach object.id
- the identity of the object.version
- the detached versionpublic void initialiseForPNewToBeDeleted(Object pc)
initialiseForPNewToBeDeleted
in interface ObjectProvider
pc
- the object to deletepublic void initialiseForCachedPC(CachedPC cachedPC, Object id)
initialiseForCachedPC
in interface ObjectProvider
cachedPC
- The cached PC objectid
- Id to assign to the PersistenceCapable objectpublic Object getObject()
getObject
in interface ObjectProvider
getObject
in class AbstractStateManager
public void saveFields()
saveFields
in interface ObjectProvider
public void clearSavedFields()
clearSavedFields
in interface ObjectProvider
public void restoreFields()
restoreFields
in interface ObjectProvider
public void enlistInTransaction()
enlistInTransaction
in interface ObjectProvider
public void evictFromTransaction()
evictFromTransaction
in interface ObjectProvider
protected void replaceStateManager(javax.jdo.spi.PersistenceCapable pc, javax.jdo.spi.StateManager sm)
pc
- The object to updatesm
- The new state managerpublic javax.jdo.spi.StateManager replacingStateManager(javax.jdo.spi.PersistenceCapable pc, javax.jdo.spi.StateManager sm)
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.
replacingStateManager
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancesm
- the proposed new value for the jdoStateManagerpublic void replaceManagedPC(Object pc)
replaceManagedPC
in interface ObjectProvider
pc
- The PersistenceCapable to usepublic javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.spi.PersistenceCapable pc)
getPersistenceManager
in interface javax.jdo.spi.StateManager
pc
- The PersistenceCapable instancepublic boolean isDirty(javax.jdo.spi.PersistenceCapable pc)
Transient nontransactional instances return false (JDO spec).
isDirty
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancePersistenceCapable.jdoMakeDirty(String fieldName)
public boolean isTransactional(javax.jdo.spi.PersistenceCapable pc)
Transient nontransactional instances return false.
isTransactional
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancepublic boolean isPersistent(javax.jdo.spi.PersistenceCapable pc)
isPersistent
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancepublic boolean isNew(javax.jdo.spi.PersistenceCapable pc)
Transient instances return false.
isNew
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancepublic boolean isDeleted(javax.jdo.spi.PersistenceCapable pc)
Transient instances return false.
isDeleted
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancepublic Object getVersion(javax.jdo.spi.PersistenceCapable pc)
getVersion
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancepublic Object getVersion()
getVersion
in interface ObjectProvider
public Object getTransactionalVersion()
getTransactionalVersion
in interface ObjectProvider
public void clearFields()
clearFields
in interface ObjectProvider
public void clearNonPrimaryKeyFields()
clearNonPrimaryKeyFields
in interface ObjectProvider
public void clearLoadedFlags()
clearLoadedFlags
in interface ObjectProvider
public byte replacingFlags(javax.jdo.spi.PersistenceCapable pc)
replacingFlags
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancepublic void providedBooleanField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, boolean currentValue)
providedBooleanField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedByteField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, byte currentValue)
providedByteField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedCharField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, char currentValue)
providedCharField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedDoubleField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, double currentValue)
providedDoubleField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedFloatField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, float currentValue)
providedFloatField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedIntField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, int currentValue)
providedIntField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedLongField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, long currentValue)
providedLongField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedShortField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, short currentValue)
providedShortField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedStringField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, String currentValue)
providedStringField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedObjectField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object currentValue)
providedObjectField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic Object provideField(int fieldNumber)
provideField
in interface ObjectProvider
fieldNumber
- Number of fieldprotected Object provideField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber)
pc
- The PC objectfieldNumber
- Number of fieldpublic void provideFields(int[] fieldNumbers, FieldManager fm)
provideFields
in interface ObjectProvider
provideFields
in class AbstractStateManager
fieldNumbers
- An array of field numbers to be updated by the Storefm
- The updated values are stored in this object. This object is only valid
for the duration of this call.public void setBooleanField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, boolean currentValue, boolean newValue)
setBooleanField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setByteField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, byte currentValue, byte newValue)
setByteField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setCharField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, char currentValue, char newValue)
setCharField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setDoubleField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, double currentValue, double newValue)
setDoubleField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setFloatField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, float currentValue, float newValue)
setFloatField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setIntField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, int currentValue, int newValue)
setIntField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setLongField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, long currentValue, long newValue)
setLongField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setShortField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, short currentValue, short newValue)
setShortField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setStringField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, String currentValue, String newValue)
setStringField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setObjectField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object currentValue, Object newValue)
setObjectField
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldprotected void updateField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object value)
pc
- The PC objectfieldNumber
- The field numbervalue
- The new valuepublic boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber)
replacingBooleanField
in interface javax.jdo.spi.StateManager
pc
- the calling persistable instancefieldNumber
- the field numberpublic byte replacingByteField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingByteField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic char replacingCharField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingCharField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic double replacingDoubleField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingDoubleField
in interface javax.jdo.spi.StateManager
obj
- the calling PersistenceCapable instancefieldNumber
- the field numberpublic float replacingFloatField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingFloatField
in interface javax.jdo.spi.StateManager
obj
- the calling PersistenceCapable instancefieldNumber
- the field numberpublic int replacingIntField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingIntField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic long replacingLongField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingLongField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic short replacingShortField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingShortField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic String replacingStringField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingStringField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic Object replacingObjectField(javax.jdo.spi.PersistenceCapable obj, int fieldNumber)
replacingObjectField
in interface javax.jdo.spi.StateManager
obj
- the calling persistable instancefieldNumber
- the field numberprotected void replaceField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object value)
pc
- The PC objectfieldNumber
- Number of fieldvalue
- The new value of the fieldprotected boolean disconnectClone(javax.jdo.spi.PersistenceCapable pc)
pc
- The PersistenceCapable objectpublic void retrieveDetachState(ObjectProvider op)
retrieveDetachState
in interface ObjectProvider
op
- ObjectProviderpublic void resetDetachState()
resetDetachState
in interface ObjectProvider
public Object[] replacingDetachedState(javax.jdo.spi.Detachable pc, Object[] currentState)
replacingDetachedState
in interface javax.jdo.spi.StateManager
pc
- The PersistenceCapable beind updatedcurrentState
- The current state valuespublic boolean getBooleanField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, boolean currentValue)
getBooleanField
in interface javax.jdo.spi.StateManager
public byte getByteField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, byte currentValue)
getByteField
in interface javax.jdo.spi.StateManager
public char getCharField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, char currentValue)
getCharField
in interface javax.jdo.spi.StateManager
public double getDoubleField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, double currentValue)
getDoubleField
in interface javax.jdo.spi.StateManager
public float getFloatField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, float currentValue)
getFloatField
in interface javax.jdo.spi.StateManager
public int getIntField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, int currentValue)
getIntField
in interface javax.jdo.spi.StateManager
public long getLongField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, long currentValue)
getLongField
in interface javax.jdo.spi.StateManager
public short getShortField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, short currentValue)
getShortField
in interface javax.jdo.spi.StateManager
public String getStringField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, String currentValue)
getStringField
in interface javax.jdo.spi.StateManager
public Object getObjectField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object currentValue)
getObjectField
in interface javax.jdo.spi.StateManager
public void checkInheritance(FieldValues fv)
checkInheritance
in interface ObjectProvider
fv
- the initial field values of the object.public void loadFieldValues(FieldValues fv)
loadFieldValues
in interface ObjectProvider
fv
- Field Values to load (including any fetch plan to use when loading)public void copyFieldsFromObject(Object obj, int[] fieldNumbers)
copyFieldsFromObject
in interface ObjectProvider
obj
- The object that we should copy fields fromfieldNumbers
- Numbers of fields to copypublic void makeDirty(int fieldNumber)
makeDirty
in interface ObjectProvider
fieldNumber
- The no of field to mark as dirty.public void makeDirty(javax.jdo.spi.PersistenceCapable pc, String fieldName)
makeDirty
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldName
- the name of the fieldpublic Object getObjectId(javax.jdo.spi.PersistenceCapable pc)
getObjectId
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancepublic Object getTransactionalObjectId(javax.jdo.spi.PersistenceCapable pc)
getTransactionalObjectId
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancepublic void setPostStoreNewObjectId(Object id)
setPostStoreNewObjectId
in interface ObjectProvider
id
- the id received from the datastoreprotected Object getExternalObjectId(Object obj)
obj
- the PersistenceCapable objectpublic Object getExternalObjectId()
getExternalObjectId
in interface ObjectProvider
protected void loadSpecifiedFields(int[] fieldNumbers)
fieldNumbers
- the numbers of the field(s) to fetch.public void loadField(int fieldNumber)
loadField
in interface ObjectProvider
fieldNumber
- Absolute field numberpublic void loadUnloadedFields()
loadUnloadedFields
in interface ObjectProvider
public void loadUnloadedFieldsInFetchPlan()
loadUnloadedFieldsInFetchPlan
in interface ObjectProvider
protected void loadUnloadedFieldsInFetchPlanAndVersion()
public void loadUnloadedFieldsOfClassInFetchPlan(FetchPlan fetchPlan)
loadUnloadedFieldsOfClassInFetchPlan
in interface ObjectProvider
fetchPlan
- The FetchPlanpublic void refreshFieldsInFetchPlan()
refreshFieldsInFetchPlan
in interface ObjectProvider
public void refreshLoadedFields()
refreshLoadedFields
in interface ObjectProvider
public boolean isLoaded(int fieldNumber)
isLoaded
in interface ObjectProvider
fieldNumber
- the absolute field numberpublic boolean isLoaded(javax.jdo.spi.PersistenceCapable pc, int fieldNumber)
isLoaded
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancefieldNumber
- the absolute field numberpublic void replaceFieldValue(int fieldNumber, Object newValue)
replaceFieldValue
in interface ObjectProvider
fieldNumber
- Number of fieldnewValue
- The new valuepublic void replaceField(int fieldNumber, Object value)
replaceField
in interface ObjectProvider
fieldNumber
- Number of fieldvalue
- New valuepublic void replaceFieldMakeDirty(int fieldNumber, Object value)
replaceFieldMakeDirty
in interface ObjectProvider
fieldNumber
- Number of fieldvalue
- New valueprotected void replaceField(javax.jdo.spi.PersistenceCapable pc, int fieldNumber, Object value, boolean makeDirty)
pc
- The PC objectfieldNumber
- Number of fieldvalue
- The new value of the fieldmakeDirty
- Whether to make the field dirty while replacing its value (in embedded owners)public void replaceFields(int[] fieldNumbers, FieldManager fm, boolean replaceWhenDirty)
replaceFields
in interface ObjectProvider
fieldNumbers
- An array of field numbers to be refreshed by the Storefm
- The updated values are stored in this object. This object is only valid
for the duration of this call.replaceWhenDirty
- Whether to replace the fields when they are dirty herepublic void replaceFields(int[] fieldNumbers, FieldManager fm)
replaceFields
in interface ObjectProvider
replaceFields
in class AbstractStateManager
fieldNumbers
- An array of field numbers to be refreshed by the Storefm
- The updated values are stored in this object. This object is only valid
for the duration of this call.public void replaceNonLoadedFields(int[] fieldNumbers, FieldManager fm)
replaceNonLoadedFields
in interface ObjectProvider
fieldNumbers
- An array of field numbers to be refreshed by the Storefm
- The updated values are stored in this object. This object is only valid
for the duration of this call.public void replaceAllLoadedSCOFieldsWithWrappers()
replaceAllLoadedSCOFieldsWithWrappers
in interface ObjectProvider
public void replaceAllLoadedSCOFieldsWithValues()
replaceAllLoadedSCOFieldsWithValues
in interface ObjectProvider
public Object unwrapSCOField(int fieldNumber, Object value, boolean replaceFieldIfChanged)
unwrapSCOField
in interface ObjectProvider
fieldNumber
- The field numbervalue
- The value for the fieldreplaceFieldIfChanged
- Whether to replace the field value in the object if unwrapping the valuepublic Object wrapSCOField(int fieldNumber, Object value, boolean forInsert, boolean forUpdate, boolean replaceFieldIfChanged)
wrapSCOField
in interface ObjectProvider
fieldNumber
- The field numbervalue
- The value to initialise the wrapper with (if any)forInsert
- Whether the creation of any wrapper should insert this value into the datastoreforUpdate
- Whether the creation of any wrapper should update the datastore with this valuereplaceFieldIfChanged
- Whether to replace the field in the object if wrapping the valuepublic void runReachability(Set reachables)
runReachability
in interface ObjectProvider
reachables
- List of object ids currently logged as reachablepublic void makePersistent()
makePersistent
in interface ObjectProvider
public void makeTransactional()
makeTransactional
in interface ObjectProvider
public void makeTransient(FetchPlanState state)
makeTransient
in interface ObjectProvider
state
- Object containing the state of any fetchplan processingpublic void detach(FetchPlanState state)
detach
in interface ObjectProvider
state
- State for the detachment processpublic Object detachCopy(FetchPlanState state)
detachCopy
in interface ObjectProvider
state
- State for the detachment processpublic Object getReferencedPC()
getReferencedPC
in interface ObjectProvider
public void attach(Object trans)
ObjectProvider
attach
in interface ObjectProvider
trans
- Transient objectpublic void attach(boolean embedded)
attach
in interface ObjectProvider
embedded
- Whether it is embeddedpublic Object attachCopy(Object obj, boolean embedded)
attachCopy
in interface ObjectProvider
obj
- the detached persistable instance to be attachedembedded
- Whether the object is stored embedded/serialised in another objectpublic void deletePersistent()
deletePersistent
in interface ObjectProvider
public void nullifyFields()
nullifyFields
in interface ObjectProvider
public void validate()
validate
in interface ObjectProvider
protected boolean preWriteField(int fieldNumber)
fieldNumber
- The field to writeprotected void postWriteField(boolean wasDirty)
wasDirty
- whether before writing this field the pc was dirtyprotected void postStateChange()
postStateChange
in class AbstractStateManager
public void preSerialize(javax.jdo.spi.PersistenceCapable pc)
preSerialize
in interface javax.jdo.spi.StateManager
pc
- the calling PersistenceCapable instancepublic void flush()
flush
in interface ObjectProvider
public void registerTransactional()
registerTransactional
in interface ObjectProvider
public void dump(PrintWriter out)
out
- PrintWriter to dump toprotected static Object peekField(Object obj, String fieldName)
obj
- The persistable objectfieldName
- The field to peek atpublic ObjectProvider[] getEmbeddedOwners()
getEmbeddedOwners
in interface ObjectProvider
public void changeActivityState(ActivityState state)
ObjectProvider
changeActivityState
in interface ObjectProvider
state
- the activity statepublic void updateFieldAfterInsert(Object pc, int fieldNumber)
ObjectProvider
updateFieldAfterInsert
in interface ObjectProvider
pc
- The Persistable objectfieldNumber
- The no of field to mark as dirty.Copyright © 2021. All rights reserved.