public class StateManagerImpl extends AbstractStateManager<Persistable> implements StateManager
Modifier and Type | Field and Description |
---|---|
protected Persistable |
savedImage
Image of the Persistable 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, lock, lockMode, myEC, myFP, myID, myInternalID, myLC, myPC, 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 |
---|
StateManagerImpl(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(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.
|
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.
|
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 this ObjectProvider from the ExecutionContext and PC 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 |
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(Persistable pc,
int fieldNumber,
boolean currentValue)
Return the value for the field.
|
byte |
getByteField(Persistable pc,
int fieldNumber,
byte currentValue)
Return the value for the field.
|
char |
getCharField(Persistable pc,
int fieldNumber,
char currentValue)
Return the value for the field.
|
double |
getDoubleField(Persistable pc,
int fieldNumber,
double currentValue)
Return the value for the field.
|
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.
|
float |
getFloatField(Persistable pc,
int fieldNumber,
float currentValue)
Return the value for the field.
|
int |
getIntField(Persistable pc,
int fieldNumber,
int currentValue)
Return the value for the field.
|
long |
getLongField(Persistable pc,
int fieldNumber,
long currentValue)
Return the value for the field.
|
Persistable |
getObject()
Accessor for the Persistent Capable object.
|
Object |
getObjectField(Persistable pc,
int fieldNumber,
Object currentValue)
Return the value for the field.
|
Object |
getObjectId(Persistable pc)
Return the object representing the JDO identity of the calling instance.
|
short |
getShortField(Persistable pc,
int fieldNumber,
short currentValue)
Return the value for the field.
|
String |
getStringField(Persistable pc,
int fieldNumber,
String currentValue)
Return the value for the field.
|
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 |
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.
|
boolean |
isDeleted()
Tests whether this object has been deleted.
|
boolean |
isDeleted(Persistable pc)
Tests whether this object has been deleted.
|
boolean |
isDirty(Persistable pc)
Tests whether this object is dirty.
|
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.
|
boolean |
isNew(Persistable pc)
Tests whether this object has been newly made persistent.
|
boolean |
isPersistent(Persistable pc)
Tests whether this object is persistent.
|
boolean |
isTransactional(Persistable 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 |
loadUnloadedRelationFields()
Loads (from the database) all unloaded fields that store relations.
|
void |
makeDirty(int fieldNumber)
Marks the given field dirty.
|
void |
makeDirty(Persistable pc,
String fieldName)
Mark the associated Persistable 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.
|
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(Persistable 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.
|
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 |
refreshFieldsInFetchPlan()
Refreshes from the database all fields in fetch plan.
|
void |
refreshLoadedFields()
Refreshes from the database all fields currently loaded.
|
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).
|
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).
|
byte |
replacingFlags(Persistable pc)
The StateManager uses this method to supply the value of jdoFlags to the
associated Persistable instance.
|
StateManager |
replacingStateManager(Persistable pc,
StateManager sm)
Replace the current value of jdoStateManager.
|
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 |
saveFields()
Method to save all fields of the object so we can potentially restore them later.
|
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 |
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 |
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 |
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.
|
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.
|
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 persistence capable instance exists in the datastore.
|
areFieldsLoaded, becomingDeleted, clearDirtyFlags, clearDirtyFlags, clearFieldsByNumbers, containsAssociatedValue, evict, getAllFieldsLoaded, getAssociatedValue, getCallbackHandler, getClassMetaData, getDirtyFieldNames, getDirtyFieldNumbers, getDirtyFields, getExecutionContext, getFieldNumbersOfLoadedOrDirtyFields, getInternalObjectId, getLifecycleState, getLoadedFieldNames, getLoadedFieldNumbers, getLoadedFields, getLockMode, getObjectAsPrintable, getObjectValueGenerator, getReferencedPC, getStoreManager, 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, providedBooleanField, providedByteField, providedCharField, providedDoubleField, providedFloatField, providedIntField, providedLongField, providedObjectField, providedShortField, providedStringField, refresh, registerTransactional, removeAssociatedValue, replacingBooleanField, replacingByteField, replacingCharField, replacingDoubleField, replacingFloatField, replacingIntField, replacingLongField, replacingObjectField, replacingShortField, replacingStringField, 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
providedBooleanField, providedByteField, providedCharField, providedDoubleField, providedFloatField, providedIntField, providedLongField, providedObjectField, providedShortField, providedStringField, replacingBooleanField, replacingByteField, replacingCharField, replacingDoubleField, replacingFloatField, replacingIntField, replacingLongField, replacingObjectField, replacingShortField, replacingStringField
protected Persistable savedImage
public StateManagerImpl(ExecutionContext ec, AbstractClassMetaData cmd)
ec
- ExecutionContextcmd
- the metadata for the class.public void connect(ExecutionContext ec, AbstractClassMetaData cmd)
AbstractStateManager
connect
in interface ObjectProvider<Persistable>
connect
in class AbstractStateManager<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 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 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 Persistable getObject()
getObject
in interface ObjectProvider<Persistable>
getObject
in class AbstractStateManager<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 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 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 Persistable.
replacingStateManager
in interface StateManager
pc
- the calling Persistable instancesm
- the proposed new value for the jdoStateManagerpublic 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)
Transient nontransactional instances return false (JDO spec).
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 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>
provideFields
in class AbstractStateManager<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 beind updatedcurrentState
- The current state valuespublic boolean getBooleanField(Persistable pc, int fieldNumber, boolean currentValue)
StateManager
getBooleanField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic byte getByteField(Persistable pc, int fieldNumber, byte currentValue)
StateManager
getByteField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic char getCharField(Persistable pc, int fieldNumber, char currentValue)
StateManager
getCharField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic double getDoubleField(Persistable pc, int fieldNumber, double currentValue)
StateManager
getDoubleField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic float getFloatField(Persistable pc, int fieldNumber, float currentValue)
StateManager
getFloatField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic int getIntField(Persistable pc, int fieldNumber, int currentValue)
StateManager
getIntField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic long getLongField(Persistable pc, int fieldNumber, long currentValue)
StateManager
getLongField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic short getShortField(Persistable pc, int fieldNumber, short currentValue)
StateManager
getShortField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic String getStringField(Persistable pc, int fieldNumber, String currentValue)
StateManager
getStringField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic Object getObjectField(Persistable pc, int fieldNumber, Object currentValue)
StateManager
getObjectField
in interface StateManager
pc
- the calling Persistable
instancefieldNumber
- the field numbercurrentValue
- the current value of the fieldpublic void checkInheritance(FieldValues fv)
checkInheritance
in interface ObjectProvider<Persistable>
fv
- the initial field values of the object.public void loadFieldValues(FieldValues fv)
loadFieldValues
in interface ObjectProvider<Persistable>
fv
- Field Values to load (including any fetch plan to use when loading)public 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 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>
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>
replaceFields
in class AbstractStateManager<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 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 void deletePersistent()
deletePersistent
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()
postStateChange
in class AbstractStateManager<Persistable>
public void preSerialize(Persistable pc)
preSerialize
in interface StateManager
pc
- the calling Persistable instancepublic void flush()
flush
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 copyFieldsFromObject(Object obj, int[] fieldNumbers)
copyFieldsFromObject
in interface ObjectProvider<Persistable>
obj
- The object that we should copy fields fromfieldNumbers
- Numbers of fields to copyCopyright © 2017. All rights reserved.