public class StateManagerImpl extends Object implements ObjectProvider<Persistable>
Modifier and Type | Field and Description |
---|---|
protected ActivityState |
activity
state for transitions of activities.
|
protected AbstractClassMetaData |
cmd
the metadata for the class.
|
protected FieldManager |
currFM
Current FieldManager.
|
protected boolean |
dirty
Indicator for whether the persistable instance is dirty.
|
protected boolean[] |
dirtyFields
indicators for which fields are currently dirty in the persistable instance.
|
protected static int |
FLAG_ATTACHING
Flag for
flags whether we are in the process of attaching the object. |
protected static int |
FLAG_BECOMING_DELETED |
protected static int |
FLAG_CHANGING_STATE |
protected static int |
FLAG_DETACHING
Flag for
flags whether we are in the process of detaching the object. |
protected static int |
FLAG_DISCONNECTING
Flag for
flags whether we are in the process of disconnecting the object. |
protected static int |
FLAG_FLUSHED_NEW
if the persistable object is new and was flushed to the datastore.
|
protected static int |
FLAG_FLUSHING
Flag for
flags whether we are in the process of flushing changes to the object. |
protected static int |
FLAG_LOADINGFPFIELDS |
protected static int |
FLAG_MAKING_TRANSIENT
Flag for
flags whether we are in the process of making transient the object. |
protected static int |
FLAG_NEED_INHERITANCE_VALIDATION
Whether the managed object needs the inheritance level validating before loading fields.
|
protected static int |
FLAG_POSTINSERT_UPDATE |
protected static int |
FLAG_POSTLOAD_PENDING |
protected static int |
FLAG_RESETTING_DETACHED_STATE
Flag for
flags whether we are resetting the detached state. |
protected static int |
FLAG_RESTORE_VALUES
Whether to restore values at StateManager.
|
protected static int |
FLAG_RETRIEVING_DETACHED_STATE
Flag for
flags whether we are retrieving detached state from the detached object. |
protected static int |
FLAG_STORING_PC
Flag to signify that we are currently storing the persistable object, so we don't detach it on serialisation.
|
protected static int |
FLAG_UPDATING_EMBEDDING_FIELDS_WITH_OWNER
Flag whether this SM is updating the ownership of its embedded/serialised field(s).
|
protected static int |
FLAG_VALIDATING
Whether we are currently validating the object in the datastore.
|
protected int |
flags
Bit-packed flags for operational settings (packed into "int" for memory benefit).
|
protected static SingleTypeFieldManager |
HOLLOWFIELDMANAGER |
protected boolean[] |
loadedFields
indicators for which fields are currently loaded in the persistable instance.
|
protected Lock |
lock
Lock object to synchronise execution when reading/writing fields.
|
protected ExecutionContext |
myEC
The ExecutionContext for this StateManager
|
protected FetchPlanForClass |
myFP
Fetch plan for the class of the managed object.
|
protected Object |
myID
The object identity in the datastore
|
protected Object |
myInternalID
The object identity in the JVM.
|
protected LifeCycleState |
myLC
The actual LifeCycleState for the persistable instance
|
protected Persistable |
myPC
The persistable instance managed by this ObjectProvider.
|
protected Object |
myVersion
Optimistic version, when starting any transaction.
|
protected short |
objectType
The type of the managed object (0 = PC, 1 = embedded PC, 2 = embedded element, 3 = embedded key, 4 = embedded value.
|
protected byte |
persistenceFlags
Flags for state stored with the object.
|
protected Persistable |
savedImage
Image of the Persistable instance when the instance is enlisted in the transaction.
|
protected boolean[] |
savedLoadedFields
Loaded fields of the persistable instance when the instance is enlisted in the transaction.
|
protected byte |
savedPersistenceFlags
Flags of the persistable instance when the instance is enlisted in the transaction.
|
protected Object |
transactionalVersion
Optimistic version, after insert/update but not yet committed (i.e incremented).
|
EMBEDDED_COLLECTION_ELEMENT_PC, EMBEDDED_MAP_KEY_PC, EMBEDDED_MAP_VALUE_PC, EMBEDDED_PC, ORIGINAL_FIELD_VALUE_KEY_PREFIX, PC
Constructor and Description |
---|
StateManagerImpl(ExecutionContext ec,
AbstractClassMetaData cmd)
Constructor for object of specified type managed by the provided ExecutionContext.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
areFieldsLoaded(int[] fieldNumbers)
Accessor for whether all of the specified field numbers are loaded.
|
void |
attach(boolean embedded)
Method to attach the object managed by this StateManager.
|
void |
attach(Persistable detachedPC)
Method to attach the provided detached object into the managed instance.
|
Persistable |
attachCopy(Persistable detachedPC,
boolean embedded)
Method to attach a copy of the detached persistable instance and return the (attached) copy.
|
boolean |
becomingDeleted()
Whether this object is moving to a deleted state.
|
void |
changeActivityState(ActivityState state)
Update the acitvity state.
|
void |
checkInheritance(FieldValues fv)
Deprecated.
Dont use this, to be removed
|
protected void |
clearDirtyFlags()
Method to clear all dirty flags on the object.
|
protected void |
clearDirtyFlags(int[] fieldNumbers)
Method to clear all dirty flags on the object.
|
void |
clearFields()
Method to clear all fields of the object.
|
protected void |
clearFieldsByNumbers(int[] fieldNumbers) |
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 this provider to the specified ExecutionContext and object type.
|
boolean |
containsAssociatedValue(Object key) |
void |
deletePersistent()
Method to delete the object from persistence.
|
void |
detach(FetchPlanState state)
Method to detach this object.
|
Persistable |
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 from the ExecutionContext and persistable object.
|
protected boolean |
disconnectClone(Persistable 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 |
evict()
Method to change the object state to evicted.
|
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 |
getAllFieldsLoaded()
Returns whether all fields are loaded.
|
Object |
getAssociatedValue(Object key)
Accessor for an associated value stored with this object.
|
protected CallbackHandler |
getCallbackHandler() |
AbstractClassMetaData |
getClassMetaData()
Accessor for the ClassMetaData for this object.
|
String[] |
getDirtyFieldNames()
Convenience accessor for the names of the fields that are dirty.
|
int[] |
getDirtyFieldNumbers()
Accessor for the field numbers of all dirty fields.
|
boolean[] |
getDirtyFields()
Creates a copy of the
dirtyFields bitmap. |
ExecutionContext |
getExecutionContext() |
ExecutionContextReference |
getExecutionContext(Persistable pc)
Accessor for the ExecutionContext that owns this instance.
|
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.
|
protected int[] |
getFieldNumbersOfLoadedOrDirtyFields(boolean[] loadedFields,
boolean[] dirtyFields)
Convenience accessor to return the field numbers for the input loaded and dirty field arrays.
|
Object |
getInternalObjectId()
Accessor for the internal object id of the object we are managing.
|
LifeCycleState |
getLifecycleState()
Accessor for the LifeCycleState
|
String[] |
getLoadedFieldNames()
Convenience accessor for the names of the fields that are loaded.
|
int[] |
getLoadedFieldNumbers()
Accessor for the field numbers of all loaded fields in this managed instance.
|
boolean[] |
getLoadedFields()
Accessor for the fields
|
Persistable |
getObject()
The object being persisted, or a virtual object containing properties to be persisted
For persistence of (depends on the API/language):
- Java objects, the object returned is the actual Java object being persisted
- JSON objects, the object returned is an instance of org.json.JSONObject
- XML objects, the object returned is an instance of org.w3c.dom.Node
Warning: to obtain the type being persisted use getClassMetaData(), otherwise the store
will not be able objects from any language
|
String |
getObjectAsPrintable()
Returns a printable form of the managed object.
|
Object |
getObjectId(Persistable pc)
Return the object representing the JDO identity of the calling instance.
|
Persistable |
getReferencedPC()
Accessor for the referenced PC object when we are attaching or detaching.
|
StoreManager |
getStoreManager() |
Object |
getTransactionalObjectId(Persistable pc)
Return the object representing the JDO identity of the calling instance.
|
Object |
getTransactionalVersion()
Return the transactional version of the managed object.
|
Object |
getTransactionalVersion(Object pc)
Return the object representing the transactional version of the calling instance.
|
Object |
getVersion()
Method to return the current version of the managed object.
|
Object |
getVersion(Persistable pc)
Return the object representing the version of the calling instance.
|
void |
initialiseForCachedPC(CachedPC<Persistable> cachedPC,
Object id)
Initialise the ObjectProvider, assigning the specified id to the object.
|
void |
initialiseForDetached(Persistable pc,
Object id,
Object version)
Initialises the StateManager to manage a Persistable object in detached state.
|
void |
initialiseForEmbedded(Persistable pc,
boolean copyPc)
Initialises a state manager to manage a Persistable instance that will be EMBEDDED/SERIALISED into another Persistable 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,
Persistable pc)
Initialises a state manager to manage the given hollow instance having the given object ID.
|
void |
initialiseForPersistentClean(Object id,
Persistable pc)
Initialises a state manager to manage the passed persistent instance having the given object ID.
|
void |
initialiseForPersistentNew(Persistable pc,
FieldValues preInsertChanges)
Initialises a state manager to manage a transient instance that is becoming newly persistent.
|
void |
initialiseForPNewToBeDeleted(Persistable pc)
Initialises the StateManager to manage a Persistable object that is not persistent but is about to be deleted.
|
void |
initialiseForTransactionalTransient(Persistable pc)
Initialises a state manager to manage a Transactional Transient instance.
|
protected void |
internalDeletePersistent()
Method to delete the object from the datastore.
|
boolean |
isAttaching() |
protected boolean |
isChangingState() |
boolean |
isDeleted()
Tests whether this object has been deleted.
|
boolean |
isDeleted(Persistable pc)
Tests whether this object has been deleted.
|
boolean |
isDeleting()
Tests whether this object is in the process of being deleted.
|
boolean |
isDetaching()
Tests whether this object is in the process of being detached.
|
boolean |
isDirty(Persistable pc)
Tests whether this object is dirty.
|
boolean |
isEmbedded()
Convenience accessor for whether this StateManager manages an embedded/serialised object.
|
boolean |
isFieldLoaded(int fieldNumber)
Accessor for whether a field is currently loaded.
|
boolean |
isFlushedNew()
Whether this record has been flushed to the datastore in this transaction (i.e called persist() and is in
the datastore now).
|
boolean |
isFlushedToDatastore()
Accessor for whether all changes have been written to the datastore.
|
protected boolean |
isFlushing() |
boolean |
isInserting()
Tests whether this object is being inserted.
|
boolean |
isLoaded(int fieldNumber)
Returns the loaded setting for the field of the managed object.
|
boolean |
isLoaded(Persistable pc,
int fieldNumber)
Return true if the field is cached in the calling instance; in this implementation we always return true.
|
boolean |
isNew(Persistable pc)
Tests whether this object has been newly made persistent.
|
boolean |
isPersistent(Persistable pc)
Tests whether this object is persistent.
|
protected boolean |
isPostLoadPending() |
boolean |
isRestoreValues()
Accessor for whether we are in the process of restoring the values.
|
protected boolean |
isStoringPC() |
boolean |
isTransactional(Persistable pc)
Tests whether this object is transactional.
|
boolean |
isVersionLoaded()
Method to return if the version is loaded.
|
boolean |
isWaitingToBeFlushedToDatastore()
Accessor for whether the instance is newly persistent yet hasnt yet been flushed to the datastore.
|
void |
loadField(int fieldNumber)
Convenience method to load the specified field if not loaded.
|
void |
loadFieldFromDatastore(int fieldNumber)
Convenience method to load a field from the datastore.
|
protected void |
loadFieldsFromDatastore(int[] fieldNumbers)
Convenience method to load fields from the datastore.
|
protected int[] |
loadFieldsFromLevel2Cache(int[] fieldNumbers)
Convenience method to retrieve field values from an L2 cached object if they are loaded in that object.
|
void |
loadFieldsInFetchPlan(FetchPlanState state)
Method to load all unloaded fields in the FetchPlan.
|
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 currently unloaded fields in the actual fetch plan.
|
void |
loadUnloadedRelationFields()
Loads (from the database) all unloaded fields that store relations.
|
void |
locate()
Locate the object in the datastore.
|
void |
makeDirty(int fieldNumber)
Marks the given field dirty.
|
void |
makeDirty(Persistable pc,
String fieldName)
Mark the associated persistable field dirty.
|
void |
makeNontransactional()
Method to change the object state to nontransactional.
|
void |
makePersistent()
Method to make the object persistent.
|
void |
makePersistentTransactionalTransient()
Makes Transactional Transient instances persistent.
|
void |
makeTransactional()
Method to change the object state to transactional.
|
void |
makeTransient(FetchPlanState state)
Method to change the object state to transient.
|
void |
markAsFlushed()
Method to notify the object provider that the object has now been flushed to the datastore.
|
void |
markFieldsAsLoaded(int[] fieldNumbers)
Convenience method to mark all fields as "loaded".
|
void |
markForInheritanceValidation()
Mark the state manager as needing to validate the inheritance of the managed object existence
before loading fields.
|
protected void |
markPKFieldsAsLoaded()
Convenience method to mark PK fields as loaded (if using app id).
|
protected static Object |
peekField(Object obj,
String fieldName)
Utility to take a peek at a field in the persistable object.
|
void |
postCommit(Transaction tx)
This method is invoked just after a commit is performed in a Transaction involving the persistable object managed by this StateManager
|
protected void |
postStateChange()
Method called after a change in state.
|
protected void |
postWriteField(boolean wasDirty)
Method called after the write of a field.
|
void |
preBegin(Transaction tx)
Method invoked just before a transaction starts for the ExecutionContext managing us.
|
void |
preRollback(Transaction tx)
This method is invoked just before a rollback is performed in a Transaction involving the persistable object managed by this StateManager.
|
void |
preSerialize(Persistable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance.
|
protected void |
preStateChange()
Method called before a change in state.
|
protected boolean |
preWriteField(int fieldNumber)
Method called before a write of the specified field.
|
void |
providedBooleanField(Persistable ignored,
int fieldNumber,
boolean currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedByteField(Persistable ignored,
int fieldNumber,
byte currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedCharField(Persistable ignored,
int fieldNumber,
char currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedDoubleField(Persistable ignored,
int fieldNumber,
double currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedFloatField(Persistable ignored,
int fieldNumber,
float currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedIntField(Persistable ignored,
int fieldNumber,
int currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedLongField(Persistable ignored,
int fieldNumber,
long currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedObjectField(Persistable ignored,
int fieldNumber,
Object currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedShortField(Persistable ignored,
int fieldNumber,
short currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
void |
providedStringField(Persistable ignored,
int fieldNumber,
String currentValue)
This method is called from the associated persistable when its dnProvideFields() method is invoked.
|
Object |
provideField(int fieldNumber)
Method to return the current value of a particular field.
|
protected Object |
provideField(Persistable 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 Persistable associated with this StateManager.
|
void |
refresh()
Method to refresh the object.
|
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 |
removeAssociatedValue(Object key)
Method to remove the associated value with the specified key (if it exists).
|
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(Persistable pc,
int fieldNumber,
Object value)
Method to change the value of a field in the PC object.
|
protected void |
replaceField(Persistable 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 Persistable object associated with this StateManager.
|
void |
replaceFields(int[] fieldNumbers,
FieldManager fm,
boolean replaceWhenDirty)
Called from the StoreManager to refresh data in the Persistable 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(Persistable 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 Persistable object associated with this StateManager.
|
protected void |
replaceStateManager(Persistable pc,
StateManager sm)
Utility to update the passed object with the passed StateManager (can be null).
|
boolean |
replacingBooleanField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a boolean field.
|
byte |
replacingByteField(Persistable obj,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a byte field.
|
char |
replacingCharField(Persistable obj,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a char field.
|
Object[] |
replacingDetachedState(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(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a double field.
|
byte |
replacingFlags(Persistable pc)
The StateManager uses this method to supply the value of dnFlags to the associated persistable instance.
|
float |
replacingFloatField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a float field.
|
int |
replacingIntField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a int field.
|
long |
replacingLongField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a long field.
|
Object |
replacingObjectField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of an Object field.
|
short |
replacingShortField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() method to refresh the value of a short field.
|
StateManager |
replacingStateManager(Persistable pc,
StateManager sm)
Replace the current value of StateManager in the Persistable object.
|
String |
replacingStringField(Persistable ignored,
int fieldNumber)
This method is invoked by the persistable object's dnReplaceField() 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 |
retrieve(boolean fgOnly)
Method to retrieve the object.
|
void |
retrieveDetachState(ObjectProvider op)
Convenience method to retrieve the detach state from the passed ObjectProvider's object.
|
void |
saveFields()
Method to save all fields of the object, for use in any rollback.
|
void |
setAssociatedValue(Object key,
Object value)
Method to set an associated value stored with this object.
|
void |
setBooleanField(Persistable pc,
int fieldNumber,
boolean currentValue,
boolean newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setByteField(Persistable pc,
int fieldNumber,
byte currentValue,
byte newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setCharField(Persistable pc,
int fieldNumber,
char currentValue,
char newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setDoubleField(Persistable pc,
int fieldNumber,
double currentValue,
double newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setFloatField(Persistable pc,
int fieldNumber,
float currentValue,
float newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setFlushedNew(boolean flag) |
void |
setFlushing(boolean flushing) |
void |
setIntField(Persistable pc,
int fieldNumber,
int currentValue,
int newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setLongField(Persistable pc,
int fieldNumber,
long currentValue,
long newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setObjectField(Persistable pc,
int fieldNumber,
Object currentValue,
Object newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setPcObjectType(short objType)
Method to set this StateManager as managing an embedded/serialised object.
|
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(Persistable pc,
int fieldNumber,
short currentValue,
short newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setStoringPC()
Method to set the storing PC flag.
|
void |
setStringField(Persistable pc,
int fieldNumber,
String currentValue,
String newValue)
This method is called by the associated Persistable when the corresponding mutator method (setXXX()) is called on the Persistable.
|
void |
setTransactionalVersion(Object version)
Sets the value for the version column in a transaction not yet committed
|
void |
setVersion(Object version)
Sets the value for the version column in the datastore
|
String |
toString() |
protected void |
transitionReadField(boolean isLoaded)
Method to change the object state to read-field.
|
protected void |
transitionWriteField()
Method to change the object state to write-field.
|
void |
unloadField(String fieldName)
Convenience method to unload a field/property.
|
void |
unloadNonFetchPlanFields()
Method that will unload all fields that are not in the FetchPlan.
|
void |
unsetStoringPC()
Method to unset the storing PC flag.
|
protected void |
updateField(Persistable 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.
|
protected void |
updateLevel2CacheForFields(int[] fieldNumbers)
Convenience method to update a Level2 cached version of this object if cacheable
and has not been modified during this transaction.
|
void |
updateOwnerFieldInEmbeddedField(int fieldNumber,
Object value)
Method to update the "owner-field" in an embedded object with the owner object.
|
void |
validate()
Validates whether the persistable instance exists in the datastore.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBooleanField, getByteField, getCharField, getDoubleField, getFloatField, getIntField, getLongField, getObjectField, getShortField, getStringField
protected static final SingleTypeFieldManager HOLLOWFIELDMANAGER
protected static final int FLAG_VALIDATING
protected static final int FLAG_RESTORE_VALUES
protected static final int FLAG_STORING_PC
protected static final int FLAG_NEED_INHERITANCE_VALIDATION
protected static final int FLAG_POSTINSERT_UPDATE
protected static final int FLAG_LOADINGFPFIELDS
protected static final int FLAG_POSTLOAD_PENDING
protected static final int FLAG_CHANGING_STATE
protected static final int FLAG_FLUSHED_NEW
protected static final int FLAG_BECOMING_DELETED
protected static final int FLAG_UPDATING_EMBEDDING_FIELDS_WITH_OWNER
protected static final int FLAG_RETRIEVING_DETACHED_STATE
flags
whether we are retrieving detached state from the detached object.protected static final int FLAG_RESETTING_DETACHED_STATE
flags
whether we are resetting the detached state.protected static final int FLAG_ATTACHING
flags
whether we are in the process of attaching the object.protected static final int FLAG_DETACHING
flags
whether we are in the process of detaching the object.protected static final int FLAG_MAKING_TRANSIENT
flags
whether we are in the process of making transient the object.protected static final int FLAG_FLUSHING
flags
whether we are in the process of flushing changes to the object.protected static final int FLAG_DISCONNECTING
flags
whether we are in the process of disconnecting the object.protected Persistable myPC
protected int flags
protected ExecutionContext myEC
protected AbstractClassMetaData cmd
protected Object myInternalID
protected Object myID
protected LifeCycleState myLC
protected Object myVersion
protected Object transactionalVersion
protected byte persistenceFlags
protected FetchPlanForClass myFP
protected boolean dirty
protected boolean[] dirtyFields
protected boolean[] loadedFields
protected Lock lock
protected ActivityState activity
protected FieldManager currFM
protected short objectType
protected byte savedPersistenceFlags
protected boolean[] savedLoadedFields
protected Persistable savedImage
public StateManagerImpl(ExecutionContext ec, AbstractClassMetaData cmd)
ec
- ExecutionContextcmd
- the metadata for the class.public void connect(ExecutionContext ec, AbstractClassMetaData cmd)
ObjectProvider
connect
in interface ObjectProvider<Persistable>
ec
- ExecutionContext to connect tocmd
- Metadata for this classpublic void disconnect()
disconnect
in interface ObjectProvider<Persistable>
public void initialiseForHollow(Object id, FieldValues fv, Class pcClass)
initialiseForHollow
in interface ObjectProvider<Persistable>
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 initialiseForHollowPreConstructed(Object id, Persistable 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<Persistable>
id
- the identity of the object.pc
- the object to be managed.public void initialiseForPersistentClean(Object id, Persistable pc)
initialiseForPersistentClean
in interface ObjectProvider<Persistable>
id
- the identity of the object.pc
- The object to be managedpublic void initialiseForEmbedded(Persistable pc, boolean copyPc)
initialiseForEmbedded
in interface ObjectProvider<Persistable>
pc
- The Persistable to manage (see copyPc also)copyPc
- Whether the SM should manage a copy of the passed PC or that onepublic void initialiseForPersistentNew(Persistable 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<Persistable>
pc
- the instance being make persistent.preInsertChanges
- Any changes to make before insertingpublic void initialiseForTransactionalTransient(Persistable pc)
This constructor is used for assigning state managers to Transient instances that are transitioning to a transient clean state.
initialiseForTransactionalTransient
in interface ObjectProvider<Persistable>
pc
- the instance being make persistent.public void initialiseForDetached(Persistable pc, Object id, Object version)
initialiseForDetached
in interface ObjectProvider<Persistable>
pc
- the detach object.id
- the identity of the object.version
- the detached versionpublic void initialiseForPNewToBeDeleted(Persistable pc)
initialiseForPNewToBeDeleted
in interface ObjectProvider<Persistable>
pc
- the object to deletepublic void initialiseForCachedPC(CachedPC<Persistable> cachedPC, Object id)
initialiseForCachedPC
in interface ObjectProvider<Persistable>
cachedPC
- The cached PC objectid
- Id to assign to the Persistable objectpublic AbstractClassMetaData getClassMetaData()
ObjectProvider
getClassMetaData
in interface ObjectProvider<Persistable>
public ExecutionContext getExecutionContext()
getExecutionContext
in interface ObjectProvider<Persistable>
public StoreManager getStoreManager()
getStoreManager
in interface ObjectProvider<Persistable>
public LifeCycleState getLifecycleState()
ObjectProvider
getLifecycleState
in interface ObjectProvider<Persistable>
protected CallbackHandler getCallbackHandler()
public Persistable getObject()
ObjectProvider
getObject
in interface ObjectProvider<Persistable>
public String getObjectAsPrintable()
ObjectProvider
getObjectAsPrintable
in interface ObjectProvider<Persistable>
public boolean isWaitingToBeFlushedToDatastore()
isWaitingToBeFlushedToDatastore
in interface ObjectProvider<Persistable>
public boolean isRestoreValues()
isRestoreValues
in interface ObjectProvider<Persistable>
protected boolean isChangingState()
public boolean isInserting()
ObjectProvider
isInserting
in interface ObjectProvider<Persistable>
public boolean isDeleting()
ObjectProvider
isDeleting
in interface ObjectProvider<Persistable>
public void markForInheritanceValidation()
ObjectProvider
markForInheritanceValidation
in interface ObjectProvider<Persistable>
public void setTransactionalVersion(Object version)
setTransactionalVersion
in interface ObjectProvider<Persistable>
version
- The versionpublic Object getTransactionalVersion(Object pc)
pc
- the calling persistable instancepublic void setVersion(Object version)
setVersion
in interface ObjectProvider<Persistable>
version
- The versionpublic void setFlushedNew(boolean flag)
setFlushedNew
in interface ObjectProvider<Persistable>
public boolean isFlushedNew()
ObjectProvider
isFlushedNew
in interface ObjectProvider<Persistable>
public boolean isFlushedToDatastore()
ObjectProvider
isFlushedToDatastore
in interface ObjectProvider<Persistable>
public void setFlushing(boolean flushing)
setFlushing
in interface ObjectProvider<Persistable>
protected boolean isFlushing()
public void markAsFlushed()
ObjectProvider
markAsFlushed
in interface ObjectProvider<Persistable>
protected void preStateChange()
public void refresh()
refresh
in interface ObjectProvider<Persistable>
public void retrieve(boolean fgOnly)
retrieve
in interface ObjectProvider<Persistable>
fgOnly
- Only load the current fetch group fieldspublic void makePersistentTransactionalTransient()
makePersistentTransactionalTransient
in interface ObjectProvider<Persistable>
public void makeNontransactional()
makeNontransactional
in interface ObjectProvider<Persistable>
protected void transitionReadField(boolean isLoaded)
isLoaded
- if the field was previously loadedprotected void transitionWriteField()
public void evict()
evict
in interface ObjectProvider<Persistable>
public void preBegin(Transaction tx)
preBegin
in interface ObjectProvider<Persistable>
tx
- The transactionpublic void postCommit(Transaction tx)
postCommit
in interface ObjectProvider<Persistable>
tx
- The transactionpublic void preRollback(Transaction tx)
preRollback
in interface ObjectProvider<Persistable>
tx
- The transactionprotected void internalDeletePersistent()
public void locate()
locate
in interface ObjectProvider<Persistable>
NucleusObjectNotFoundException
- if the object doesnt exist.public Persistable getReferencedPC()
getReferencedPC
in interface ObjectProvider<Persistable>
protected boolean areFieldsLoaded(int[] fieldNumbers)
fieldNumbers
- The field numbers to checkpublic void unloadNonFetchPlanFields()
unloadNonFetchPlanFields
in interface ObjectProvider<Persistable>
public void markFieldsAsLoaded(int[] fieldNumbers)
ObjectProvider
markFieldsAsLoaded
in interface ObjectProvider<Persistable>
fieldNumbers
- The field numbers to mark as loadedprotected void markPKFieldsAsLoaded()
protected void updateLevel2CacheForFields(int[] fieldNumbers)
fieldNumbers
- Numbers of fields to update in L2 cached objectprotected int[] loadFieldsFromLevel2Cache(int[] fieldNumbers)
fieldNumbers
- Numbers of fields to load from the L2 cachepublic void loadFieldsInFetchPlan(FetchPlanState state)
loadFieldsInFetchPlan
in interface ObjectProvider<Persistable>
state
- The FetchPlan statepublic void loadFieldFromDatastore(int fieldNumber)
loadFieldFromDatastore
in interface ObjectProvider<Persistable>
fieldNumber
- The field number. If fieldNumber is -1 then this means call loadFieldsFromDatastore(null);protected void loadFieldsFromDatastore(int[] fieldNumbers)
fieldNumbers
- The field numbers.protected int[] getFieldNumbersOfLoadedOrDirtyFields(boolean[] loadedFields, boolean[] dirtyFields)
loadedFields
- Fields that were detached with the objectdirtyFields
- Fields that have been modified while detachedpublic boolean[] getDirtyFields()
dirtyFields
bitmap.getDirtyFields
in interface ObjectProvider<Persistable>
dirtyFields
bitmap.public int[] getDirtyFieldNumbers()
getDirtyFieldNumbers
in interface ObjectProvider<Persistable>
public boolean[] getLoadedFields()
getLoadedFields
in interface ObjectProvider<Persistable>
public int[] getLoadedFieldNumbers()
getLoadedFieldNumbers
in interface ObjectProvider<Persistable>
public boolean getAllFieldsLoaded()
getAllFieldsLoaded
in interface ObjectProvider<Persistable>
public String[] getDirtyFieldNames()
getDirtyFieldNames
in interface ObjectProvider<Persistable>
public String[] getLoadedFieldNames()
getLoadedFieldNames
in interface ObjectProvider<Persistable>
public boolean isFieldLoaded(int fieldNumber)
isFieldLoaded
in interface ObjectProvider<Persistable>
fieldNumber
- The (absolute) field numberprotected void clearFieldsByNumbers(int[] fieldNumbers)
protected void clearDirtyFlags()
protected void clearDirtyFlags(int[] fieldNumbers)
fieldNumbers
- the fields to clearpublic void unloadField(String fieldName)
unloadField
in interface ObjectProvider<Persistable>
fieldName
- Name of the field/propertyNucleusUserException
- if the object managed by this StateManager is embeddedpublic boolean isEmbedded()
isEmbedded
in interface ObjectProvider<Persistable>
public void setPcObjectType(short objType)
setPcObjectType
in interface ObjectProvider<Persistable>
objType
- The type of object being managedpublic void providedBooleanField(Persistable ignored, int fieldNumber, boolean currentValue)
providedBooleanField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedByteField(Persistable ignored, int fieldNumber, byte currentValue)
providedByteField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedCharField(Persistable ignored, int fieldNumber, char currentValue)
providedCharField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedDoubleField(Persistable ignored, int fieldNumber, double currentValue)
providedDoubleField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedFloatField(Persistable ignored, int fieldNumber, float currentValue)
providedFloatField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedIntField(Persistable ignored, int fieldNumber, int currentValue)
providedIntField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedLongField(Persistable ignored, int fieldNumber, long currentValue)
providedLongField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedShortField(Persistable ignored, int fieldNumber, short currentValue)
providedShortField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedStringField(Persistable ignored, int fieldNumber, String currentValue)
providedStringField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void providedObjectField(Persistable ignored, int fieldNumber, Object currentValue)
providedObjectField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic boolean replacingBooleanField(Persistable ignored, int fieldNumber)
replacingBooleanField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic byte replacingByteField(Persistable obj, int fieldNumber)
replacingByteField
in interface StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic char replacingCharField(Persistable obj, int fieldNumber)
replacingCharField
in interface StateManager
obj
- the calling persistable instancefieldNumber
- the field numberpublic double replacingDoubleField(Persistable ignored, int fieldNumber)
replacingDoubleField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic float replacingFloatField(Persistable ignored, int fieldNumber)
replacingFloatField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic int replacingIntField(Persistable ignored, int fieldNumber)
replacingIntField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic long replacingLongField(Persistable ignored, int fieldNumber)
replacingLongField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic short replacingShortField(Persistable ignored, int fieldNumber)
replacingShortField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic String replacingStringField(Persistable ignored, int fieldNumber)
replacingStringField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic Object replacingObjectField(Persistable ignored, int fieldNumber)
replacingObjectField
in interface StateManager
ignored
- the calling persistable instancefieldNumber
- the field numberpublic void registerTransactional()
registerTransactional
in interface ObjectProvider<Persistable>
public void setAssociatedValue(Object key, Object value)
setAssociatedValue
in interface ObjectProvider<Persistable>
key
- Key for the valuevalue
- The associated valuepublic Object getAssociatedValue(Object key)
getAssociatedValue
in interface ObjectProvider<Persistable>
key
- Key for the valuepublic void removeAssociatedValue(Object key)
ObjectProvider
removeAssociatedValue
in interface ObjectProvider<Persistable>
key
- The keypublic boolean containsAssociatedValue(Object key)
public void enlistInTransaction()
enlistInTransaction
in interface ObjectProvider<Persistable>
public void evictFromTransaction()
evictFromTransaction
in interface ObjectProvider<Persistable>
protected void replaceStateManager(Persistable pc, StateManager sm)
pc
- The object to updatesm
- The new state managerpublic StateManager replacingStateManager(Persistable pc, StateManager sm)
This method is called by the Persistable whenever dnReplaceStateManager 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 Persistable.
replacingStateManager
in interface StateManager
pc
- the calling Persistable instancesm
- the proposed new value for the StateManagerpublic void replaceManagedPC(Persistable pc)
replaceManagedPC
in interface ObjectProvider<Persistable>
pc
- The persistable to usepublic ExecutionContextReference getExecutionContext(Persistable pc)
getExecutionContext
in interface StateManager
pc
- The Persistable instancepublic boolean isDirty(Persistable pc)
isDirty
in interface StateManager
pc
- the calling persistable instancePersistable.dnMakeDirty(String fieldName)
public boolean isTransactional(Persistable pc)
Transient nontransactional instances return false.
isTransactional
in interface StateManager
pc
- the calling persistable instancepublic boolean isPersistent(Persistable pc)
isPersistent
in interface StateManager
pc
- the calling persistable instancepublic boolean isNew(Persistable pc)
Transient instances return false.
isNew
in interface StateManager
pc
- the calling persistable instancepublic boolean isDeleted()
ObjectProvider
isDeleted
in interface ObjectProvider<Persistable>
public boolean isDeleted(Persistable pc)
Transient instances return false.
isDeleted
in interface StateManager
pc
- the calling persistable instancepublic Object getVersion(Persistable pc)
getVersion
in interface StateManager
pc
- the calling persistable instancepublic boolean isVersionLoaded()
isVersionLoaded
in interface ObjectProvider<Persistable>
public Object getVersion()
getVersion
in interface ObjectProvider<Persistable>
public Object getTransactionalVersion()
getTransactionalVersion
in interface ObjectProvider<Persistable>
public void clearFields()
clearFields
in interface ObjectProvider<Persistable>
public void clearNonPrimaryKeyFields()
clearNonPrimaryKeyFields
in interface ObjectProvider<Persistable>
public void clearLoadedFlags()
clearLoadedFlags
in interface ObjectProvider<Persistable>
public byte replacingFlags(Persistable pc)
replacingFlags
in interface StateManager
pc
- the calling Persistable instancepublic Object provideField(int fieldNumber)
provideField
in interface ObjectProvider<Persistable>
fieldNumber
- Number of fieldprotected Object provideField(Persistable pc, int fieldNumber)
pc
- The PC objectfieldNumber
- Number of fieldpublic void provideFields(int[] fieldNumbers, FieldManager fm)
provideFields
in interface ObjectProvider<Persistable>
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(Persistable pc, int fieldNumber, boolean currentValue, boolean newValue)
setBooleanField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setByteField(Persistable pc, int fieldNumber, byte currentValue, byte newValue)
setByteField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setCharField(Persistable pc, int fieldNumber, char currentValue, char newValue)
setCharField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setDoubleField(Persistable pc, int fieldNumber, double currentValue, double newValue)
setDoubleField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setFloatField(Persistable pc, int fieldNumber, float currentValue, float newValue)
setFloatField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setIntField(Persistable pc, int fieldNumber, int currentValue, int newValue)
setIntField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setLongField(Persistable pc, int fieldNumber, long currentValue, long newValue)
setLongField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setShortField(Persistable pc, int fieldNumber, short currentValue, short newValue)
setShortField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setStringField(Persistable pc, int fieldNumber, String currentValue, String newValue)
setStringField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldpublic void setObjectField(Persistable pc, int fieldNumber, Object currentValue, Object newValue)
setObjectField
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldnewValue
- the new value for the fieldprotected void updateField(Persistable pc, int fieldNumber, Object value)
pc
- The PC objectfieldNumber
- The field numbervalue
- The new valueprotected void replaceField(Persistable pc, int fieldNumber, Object value)
pc
- The PC objectfieldNumber
- Number of fieldvalue
- The new value of the fieldprotected boolean disconnectClone(Persistable pc)
pc
- The Persistable objectpublic void retrieveDetachState(ObjectProvider op)
retrieveDetachState
in interface ObjectProvider<Persistable>
op
- ObjectProviderpublic void resetDetachState()
resetDetachState
in interface ObjectProvider<Persistable>
public Object[] replacingDetachedState(Detachable pc, Object[] currentState)
replacingDetachedState
in interface StateManager
pc
- The Persistable being updatedcurrentState
- The current state valuespublic void makeDirty(int fieldNumber)
makeDirty
in interface ObjectProvider<Persistable>
fieldNumber
- The no of field to mark as dirty.public void makeDirty(Persistable pc, String fieldName)
makeDirty
in interface StateManager
pc
- the calling persistable instancefieldName
- the name of the fieldpublic Object getInternalObjectId()
getInternalObjectId
in interface ObjectProvider<Persistable>
public Object getObjectId(Persistable pc)
getObjectId
in interface StateManager
pc
- the calling Persistable instancepublic Object getTransactionalObjectId(Persistable pc)
getTransactionalObjectId
in interface StateManager
pc
- the calling Persistable instancepublic void setPostStoreNewObjectId(Object id)
setPostStoreNewObjectId
in interface ObjectProvider<Persistable>
id
- the id received from the datastoreprotected Object getExternalObjectId(Object obj)
obj
- the Persistable objectpublic Object getExternalObjectId()
getExternalObjectId
in interface ObjectProvider<Persistable>
public void loadFieldValues(FieldValues fv)
loadFieldValues
in interface ObjectProvider<Persistable>
fv
- Field Values to load (including any fetch plan to use when loading)protected void loadSpecifiedFields(int[] fieldNumbers)
fieldNumbers
- the numbers of the field(s) to fetch.public void loadField(int fieldNumber)
loadField
in interface ObjectProvider<Persistable>
fieldNumber
- Absolute field numberpublic void loadUnloadedRelationFields()
ObjectProvider
loadUnloadedRelationFields
in interface ObjectProvider<Persistable>
public void loadUnloadedFields()
loadUnloadedFields
in interface ObjectProvider<Persistable>
public void loadUnloadedFieldsInFetchPlan()
loadUnloadedFieldsInFetchPlan
in interface ObjectProvider<Persistable>
protected void loadUnloadedFieldsInFetchPlanAndVersion()
public void loadUnloadedFieldsOfClassInFetchPlan(FetchPlan fetchPlan)
loadUnloadedFieldsOfClassInFetchPlan
in interface ObjectProvider<Persistable>
fetchPlan
- The FetchPlanpublic void refreshFieldsInFetchPlan()
refreshFieldsInFetchPlan
in interface ObjectProvider<Persistable>
public void refreshLoadedFields()
refreshLoadedFields
in interface ObjectProvider<Persistable>
public boolean isLoaded(int fieldNumber)
isLoaded
in interface ObjectProvider<Persistable>
fieldNumber
- the absolute field numberpublic boolean isLoaded(Persistable pc, int fieldNumber)
isLoaded
in interface StateManager
pc
- the calling Persistable instancefieldNumber
- the absolute field numberpublic void replaceFieldValue(int fieldNumber, Object newValue)
replaceFieldValue
in interface ObjectProvider<Persistable>
fieldNumber
- Number of fieldnewValue
- The new valuepublic void replaceField(int fieldNumber, Object value)
replaceField
in interface ObjectProvider<Persistable>
fieldNumber
- Number of fieldvalue
- New valuepublic void replaceFieldMakeDirty(int fieldNumber, Object value)
replaceFieldMakeDirty
in interface ObjectProvider<Persistable>
fieldNumber
- Number of fieldvalue
- New valueprotected void replaceField(Persistable 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<Persistable>
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<Persistable>
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<Persistable>
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<Persistable>
public void replaceAllLoadedSCOFieldsWithValues()
replaceAllLoadedSCOFieldsWithValues
in interface ObjectProvider<Persistable>
public void updateOwnerFieldInEmbeddedField(int fieldNumber, Object value)
updateOwnerFieldInEmbeddedField
in interface ObjectProvider<Persistable>
fieldNumber
- The field numbervalue
- The value to initialise the wrapper with (if any)public void makePersistent()
makePersistent
in interface ObjectProvider<Persistable>
public void makeTransactional()
makeTransactional
in interface ObjectProvider<Persistable>
public void makeTransient(FetchPlanState state)
makeTransient
in interface ObjectProvider<Persistable>
state
- Object containing the state of any fetchplan processingpublic void detach(FetchPlanState state)
detach
in interface ObjectProvider<Persistable>
state
- State for the detachment processpublic Persistable detachCopy(FetchPlanState state)
detachCopy
in interface ObjectProvider<Persistable>
state
- State for the detachment processpublic boolean isDetaching()
ObjectProvider
isDetaching
in interface ObjectProvider<Persistable>
public void attach(Persistable detachedPC)
ObjectProvider
attach
in interface ObjectProvider<Persistable>
detachedPC
- Detached objectpublic void attach(boolean embedded)
attach
in interface ObjectProvider<Persistable>
embedded
- Whether it is embeddedpublic Persistable attachCopy(Persistable detachedPC, boolean embedded)
attachCopy
in interface ObjectProvider<Persistable>
detachedPC
- the detached persistable instance to be attachedembedded
- Whether the object is stored embedded/serialised in another objectpublic boolean isAttaching()
public void deletePersistent()
deletePersistent
in interface ObjectProvider<Persistable>
public boolean becomingDeleted()
ObjectProvider
becomingDeleted
in interface ObjectProvider<Persistable>
public void validate()
validate
in interface ObjectProvider<Persistable>
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()
protected boolean isPostLoadPending()
public void preSerialize(Persistable pc)
preSerialize
in interface StateManager
pc
- the calling Persistable instancepublic void setStoringPC()
ObjectProvider
setStoringPC
in interface ObjectProvider<Persistable>
public void unsetStoringPC()
ObjectProvider
unsetStoringPC
in interface ObjectProvider<Persistable>
protected boolean isStoringPC()
public void flush()
flush
in interface ObjectProvider<Persistable>
public void saveFields()
saveFields
in interface ObjectProvider<Persistable>
public void clearSavedFields()
clearSavedFields
in interface ObjectProvider<Persistable>
public void restoreFields()
restoreFields
in interface ObjectProvider<Persistable>
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 void changeActivityState(ActivityState state)
ObjectProvider
changeActivityState
in interface ObjectProvider<Persistable>
state
- the activity statepublic void updateFieldAfterInsert(Object pc, int fieldNumber)
ObjectProvider
updateFieldAfterInsert
in interface ObjectProvider<Persistable>
pc
- The Persistable objectfieldNumber
- The no of field to mark as dirty.public void initialiseForHollowAppId(FieldValues fv, Class pcClass)
initialiseForHollowAppId
in interface ObjectProvider<Persistable>
fv
- the initial field values of the object.pcClass
- Class of the object that this will manage the state forpublic void checkInheritance(FieldValues fv)
checkInheritance
in interface ObjectProvider<Persistable>
fv
- the initial field values of the object.Copyright © 2019. All rights reserved.