Package org.apache.openjpa.kernel
Class DetachedValueStateManager
- java.lang.Object
-
- org.apache.openjpa.kernel.DetachedValueStateManager
-
- All Implemented Interfaces:
FieldConsumer,FieldManager,FieldSupplier,StateManager,OpenJPAStateManager
public class DetachedValueStateManager extends java.lang.Object implements OpenJPAStateManager
Implementation ofOpenJPAStateManagerdesigned to retrieve values from a detached instance, including when managed by aDetachedStateManager.
-
-
Field Summary
Fields Modifier and Type Field Description protected doubledblvalprotected intfieldprotected longlongvalprotected java.lang.Objectobjval-
Fields inherited from interface org.apache.openjpa.kernel.OpenJPAStateManager
SET_ATTACH, SET_REMOTE, SET_USER
-
-
Constructor Summary
Constructors Constructor Description DetachedValueStateManager(java.lang.Object pc, StoreContext ctx)DetachedValueStateManager(PersistenceCapable pc, ClassMetaData meta, StoreContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccessingField(int idx)Field access callback.booleanassignObjectId(boolean flush)Ask the store manager to assign a permanent oid to this new instance.booleanbeforeRefresh(boolean refreshAll)Prepare the instance for refreshvoidclear()Clear any held state.voiddirty(int field)Mark the given field as dirty.voiddirty(java.lang.String field)Make named field dirty.java.lang.Objectfetch(int field)Return the externalized value of the field with the given index as an object.booleanfetchBoolean(int field)Return the external value of the given field.booleanfetchBooleanField(int field)Return the value of the given field.bytefetchByte(int field)Return the external value of the given field.bytefetchByteField(int field)Return the value of the given field.charfetchChar(int field)Return the external value of the given field.charfetchCharField(int field)Return the value of the given field.doublefetchDouble(int field)Return the external value of the given field.doublefetchDoubleField(int field)Return the value of the given field.java.lang.ObjectfetchField(int field, boolean transitions)Return the value of the field with the given index as an object.floatfetchFloat(int field)Return the external value of the given field.floatfetchFloatField(int field)Return the value of the given field.java.lang.ObjectfetchFromDetachedSM(DetachedStateManager sm, int field)java.lang.ObjectfetchInitialField(int field)Return the value of the field at the specified index as of the beginning of the transaction.intfetchInt(int field)Return the external value of the given field.intfetchIntField(int field)Return the value of the given field.longfetchLong(int field)Return the external value of the given field.longfetchLongField(int field)Return the value of the given field.java.lang.ObjectfetchObject(int field)Return the external value of the given field.java.lang.ObjectfetchObjectField(int field)Return the value of the given field.java.lang.ObjectfetchObjectId()Return the object id, assigning it if necessary.shortfetchShort(int field)Return the external value of the given field.shortfetchShortField(int field)Return the value of the given field.java.lang.StringfetchString(int field)Return the external value of the given field.java.lang.StringfetchStringField(int field)Return the value of the given field.StoreContextgetContext()Return the managing context.java.util.BitSetgetDirty()Return a read-only mask of the indexes of all dirty fields.java.util.BitSetgetFlushed()Return a read-only mask of the indexes of all fields that have been flushed since they were last changed.java.lang.ObjectgetGenericContext()Persistence context.java.lang.ObjectgetId()Return the identifier for this state manager.java.lang.ObjectgetImplData()An object that concrete back ends can associate with each instance.java.lang.ObjectgetImplData(int field)Field-level impl data.java.lang.ObjectgetIntermediate(int field)Use intermediate field data to store intermediate information that might be available before the field is fully loaded.java.util.BitSetgetLoaded()Return a read-only mask of the indexes of all loaded fields.java.lang.ObjectgetLock()The lock object set for this instance.java.lang.ObjectgetManagedInstance()Return the managed instance.ClassMetaDatagetMetaData()Get the metadata for this instance.java.lang.ObjectgetObjectId()Return the instance's object id.OpenJPAStateManagergetOwner()Return the owning state if this is an embedded instance.intgetOwnerIndex()Return the owning value's field indexjava.lang.ObjectgetPCPrimaryKey(java.lang.Object oid, int field)Return the persistence-capable primary key object by extracting the identity value of the related instance stored in the given field from the given object id.PCStategetPCState()Return the state that this object is in.PersistenceCapablegetPersistenceCapable()Return thePersistenceCapableinstance that provides access to the instance managed by this state manager.java.util.BitSetgetUnloaded(FetchConfiguration fetch)Return a mutable mask of the unloaded fields that need loading based on the given fetch configuration.java.lang.ObjectgetVersion()Return the current version indicator for this instance.voidinitialize(java.lang.Class forType, PCState state)Initialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state.booleanisDefaultValue(int field)Return true if the given field has a default value.booleanisDelayed(int field)Some field types (collection proxies) support delayed loading.booleanisDeleted()Whether the instance is deleted in this transaction.booleanisDetached()Whether the instance is detached (i.e. this manager is a detached state manager)booleanisDirty()Whether the instance has been modified in this transaction.booleanisEmbedded()Return true if this instance has an owner, meaning it is an embedded value.booleanisFlushed()Return whether this object has been flushed to the datastore in this transaction.booleanisFlushedDirty()Return whether this object has been flushed, then dirtied again.booleanisImplDataCacheable()Whether the instance-level impl data can be shared among instances in different contexts if L2 caching is enabled.booleanisImplDataCacheable(int field)Whether the field's impl data is loaded and can be shared among instances in different contexts if L2 caching is enabled.booleanisNew()Whether the instance is newly-persisted in this transaction.booleanisPersistent()Whether the instance is persistent.booleanisProvisional()Return whether this object is provisionally persistent.booleanisTransactional()Whether the instance is transactional.booleanisVersionCheckRequired()Returns true if this state needs to issue a version check at flush time.booleanisVersionUpdateRequired()Returns true if this state needs to issue a version update, possibly as a result of being locked.voidload(FetchConfiguration fetch)Load fetch group fields.voidloadDelayedField(int field)If a field was marked delayed in a previous load operation this method can be used to load the field.java.lang.ObjectnewFieldProxy(int field)Create a new hollow proxy instance for the given field.java.lang.ObjectnewProxy(int field)Create a new hollow proxy instance for the given field.voidprovidedBooleanField(PersistenceCapable pc, int idx, boolean cur)Provide state callback.voidprovidedByteField(PersistenceCapable pc, int idx, byte cur)Provide state callback.voidprovidedCharField(PersistenceCapable pc, int idx, char cur)Provide state callback.voidprovidedDoubleField(PersistenceCapable pc, int idx, double cur)Provide state callback.voidprovidedFloatField(PersistenceCapable pc, int idx, float cur)Provide state callback.voidprovidedIntField(PersistenceCapable pc, int idx, int cur)Provide state callback.voidprovidedLongField(PersistenceCapable pc, int idx, long cur)Provide state callback.voidprovidedObjectField(PersistenceCapable pc, int idx, java.lang.Object cur)Provide state callback.voidprovidedShortField(PersistenceCapable pc, int idx, short cur)Provide state callback.voidprovidedStringField(PersistenceCapable pc, int idx, java.lang.String cur)Provide state callback.voidproxyDetachedDeserialized(int idx)Proxy the given detached field after deserialization.voidremoved(int field, java.lang.Object removed, boolean key)Notification that an element has been removed from the given field.booleanreplaceBooleanField(PersistenceCapable pc, int idx)Replace state callback.bytereplaceByteField(PersistenceCapable pc, int idx)Replace state callback.charreplaceCharField(PersistenceCapable pc, int idx)Replace state callback.doublereplaceDoubleField(PersistenceCapable pc, int idx)Replace state callback.floatreplaceFloatField(PersistenceCapable pc, int idx)Replace state callback.intreplaceIntField(PersistenceCapable pc, int idx)Replace state callback.longreplaceLongField(PersistenceCapable pc, int idx)Replace state callback.java.lang.ObjectreplaceObjectField(PersistenceCapable pc, int idx)Replace state callback.shortreplaceShortField(PersistenceCapable pc, int idx)Replace state callback.StateManagerreplaceStateManager(StateManager sm)Change state manager.java.lang.StringreplaceStringField(PersistenceCapable pc, int idx)Replace state callback.booleanserializing()Callback to prepare instance for serialization.voidsetDelayed(int field, boolean delay)Some field types (collection proxies) support delayed loading.java.lang.ObjectsetImplData(int field, java.lang.Object data)Field-level impl data.java.lang.ObjectsetImplData(java.lang.Object data, boolean cacheable)An object that concrete back ends can associate with each instance.voidsetIntermediate(int field, java.lang.Object value)Use intermediate field data to store intermediate information that might be available before the field is fully loaded.voidsetLock(java.lang.Object lock)The lock object set for this instance.voidsetNextVersion(java.lang.Object version)Set the next version indicator in the datastore pending a successful flush.voidsetObjectId(java.lang.Object oid)Set the object id for the managed instance.voidsetRemote(int field, java.lang.Object value)Set the given field to the given value.voidsettingBooleanField(PersistenceCapable pc, int idx, boolean cur, boolean next, int set)Setting state callback.voidsettingByteField(PersistenceCapable pc, int idx, byte cur, byte next, int set)Setting state callback.voidsettingCharField(PersistenceCapable pc, int idx, char cur, char next, int set)Setting state callback.voidsettingDoubleField(PersistenceCapable pc, int idx, double cur, double next, int set)Setting state callback.voidsettingFloatField(PersistenceCapable pc, int idx, float cur, float next, int set)Setting state callback.voidsettingIntField(PersistenceCapable pc, int idx, int cur, int next, int set)Setting state callback.voidsettingLongField(PersistenceCapable pc, int idx, long cur, long next, int set)Setting state callback.voidsettingObjectField(PersistenceCapable pc, int idx, java.lang.Object cur, java.lang.Object next, int set)Setting state callback.voidsettingShortField(PersistenceCapable pc, int idx, short cur, short next, int set)Setting state callback.voidsettingStringField(PersistenceCapable pc, int idx, java.lang.String cur, java.lang.String next, int set)Setting state callback.voidsetVersion(java.lang.Object version)Set the version indicator for this instance, as loaded from the data store.voidstore(int field, java.lang.Object value)Set the value of the field with the given index as from the external object value.voidstoreBoolean(int field, boolean externalVal)Set the given external value back into the given field.voidstoreBooleanField(int field, boolean curVal)Set the value of the given field.voidstoreByte(int field, byte externalVal)Set the given external value back into the given field.voidstoreByteField(int field, byte curVal)Set the value of the given field.voidstoreChar(int field, char externalVal)Set the given external value back into the given field.voidstoreCharField(int field, char curVal)Set the value of the given field.voidstoreDouble(int field, double externalVal)Set the given external value back into the given field.voidstoreDoubleField(int field, double curVal)Set the value of the given field.voidstoreField(int field, java.lang.Object value)Set the value of the field with the given index as an object.voidstoreFloat(int field, float externalVal)Set the given external value back into the given field.voidstoreFloatField(int field, float curVal)Set the value of the given field.voidstoreInt(int field, int externalVal)Set the given external value back into the given field.voidstoreIntField(int field, int curVal)Set the value of the given field.voidstoreLong(int field, long externalVal)Set the given external value back into the given field.voidstoreLongField(int field, long curVal)Set the value of the given field.voidstoreObject(int field, java.lang.Object externalVal)Set the given external value back into the given field.voidstoreObjectField(int field, java.lang.Object curVal)Set the value of the given field.voidstoreShort(int field, short externalVal)Set the given external value back into the given field.voidstoreShortField(int field, short curVal)Set the value of the given field.voidstoreString(int field, java.lang.String externalVal)Set the given external value back into the given field.voidstoreStringField(int field, java.lang.String curVal)Set the value of the given field.booleanwriteDetached(java.io.ObjectOutput out)Write detached state object and detached state manager to the given stream.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.openjpa.enhance.FieldConsumer
storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
-
Methods inherited from interface org.apache.openjpa.enhance.FieldSupplier
fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchShortField, fetchStringField
-
Methods inherited from interface org.apache.openjpa.kernel.OpenJPAStateManager
fetchObjectField
-
-
-
-
Constructor Detail
-
DetachedValueStateManager
public DetachedValueStateManager(java.lang.Object pc, StoreContext ctx)
-
DetachedValueStateManager
public DetachedValueStateManager(PersistenceCapable pc, ClassMetaData meta, StoreContext ctx)
-
-
Method Detail
-
initialize
public void initialize(java.lang.Class forType, PCState state)Description copied from interface:OpenJPAStateManagerInitialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state. Invoking this method may change the object id and metadata for the state manager, as the concrete type specified in the parameter may be a subclass of the expected type.- Specified by:
initializein interfaceOpenJPAStateManager- Parameters:
forType- the type for which to create a new instancestate- the initial state to which to set the instance
-
load
public void load(FetchConfiguration fetch)
Description copied from interface:OpenJPAStateManagerLoad fetch group fields.- Specified by:
loadin interfaceOpenJPAStateManager
-
getManagedInstance
public java.lang.Object getManagedInstance()
Description copied from interface:OpenJPAStateManagerReturn the managed instance.- Specified by:
getManagedInstancein interfaceOpenJPAStateManager
-
getPersistenceCapable
public PersistenceCapable getPersistenceCapable()
Description copied from interface:OpenJPAStateManagerReturn thePersistenceCapableinstance that provides access to the instance managed by this state manager. May be a proxy around the actual managed instance.- Specified by:
getPersistenceCapablein interfaceOpenJPAStateManager
-
getMetaData
public ClassMetaData getMetaData()
Description copied from interface:OpenJPAStateManagerGet the metadata for this instance.- Specified by:
getMetaDatain interfaceOpenJPAStateManager
-
getOwner
public OpenJPAStateManager getOwner()
Description copied from interface:OpenJPAStateManagerReturn the owning state if this is an embedded instance.- Specified by:
getOwnerin interfaceOpenJPAStateManager
-
getOwnerIndex
public int getOwnerIndex()
Description copied from interface:OpenJPAStateManagerReturn the owning value's field index- Specified by:
getOwnerIndexin interfaceOpenJPAStateManager
-
isEmbedded
public boolean isEmbedded()
Description copied from interface:OpenJPAStateManagerReturn true if this instance has an owner, meaning it is an embedded value.- Specified by:
isEmbeddedin interfaceOpenJPAStateManager
-
isFlushed
public boolean isFlushed()
Description copied from interface:OpenJPAStateManagerReturn whether this object has been flushed to the datastore in this transaction.- Specified by:
isFlushedin interfaceOpenJPAStateManager
-
isFlushedDirty
public boolean isFlushedDirty()
Description copied from interface:OpenJPAStateManagerReturn whether this object has been flushed, then dirtied again.- Specified by:
isFlushedDirtyin interfaceOpenJPAStateManager
-
isProvisional
public boolean isProvisional()
Description copied from interface:OpenJPAStateManagerReturn whether this object is provisionally persistent.- Specified by:
isProvisionalin interfaceOpenJPAStateManager
-
getLoaded
public java.util.BitSet getLoaded()
Description copied from interface:OpenJPAStateManagerReturn a read-only mask of the indexes of all loaded fields.- Specified by:
getLoadedin interfaceOpenJPAStateManager
-
getDirty
public java.util.BitSet getDirty()
Description copied from interface:OpenJPAStateManagerReturn a read-only mask of the indexes of all dirty fields.- Specified by:
getDirtyin interfaceOpenJPAStateManager
-
getFlushed
public java.util.BitSet getFlushed()
Description copied from interface:OpenJPAStateManagerReturn a read-only mask of the indexes of all fields that have been flushed since they were last changed.- Specified by:
getFlushedin interfaceOpenJPAStateManager
-
getUnloaded
public java.util.BitSet getUnloaded(FetchConfiguration fetch)
Description copied from interface:OpenJPAStateManagerReturn a mutable mask of the unloaded fields that need loading based on the given fetch configuration. Pass in null to retrieve all unloaded fields.- Specified by:
getUnloadedin interfaceOpenJPAStateManager
-
newProxy
public java.lang.Object newProxy(int field)
Description copied from interface:OpenJPAStateManagerCreate a new hollow proxy instance for the given field. In cases where the field externalizes to an SCO but is declared something else, the returned object may not implementProxy. In all other cases, this method delegates to the systemProxyManagerwith the correct field information. The returned proxy's owner is unset so that modifications to the proxy will not be tracked while its state is initialized. CallingOpenJPAStateManager.storeField(int, java.lang.Object)orOpenJPAStateManager.store(int, java.lang.Object)will set the proxy's owner automatically.- Specified by:
newProxyin interfaceOpenJPAStateManager
-
newFieldProxy
public java.lang.Object newFieldProxy(int field)
Description copied from interface:OpenJPAStateManagerCreate a new hollow proxy instance for the given field. This method differs fromOpenJPAStateManager.newProxy(int)in that it returns a proxy for the field's declared type, not its externalized type.- Specified by:
newFieldProxyin interfaceOpenJPAStateManager- See Also:
OpenJPAStateManager.newProxy(int)
-
isDefaultValue
public boolean isDefaultValue(int field)
Description copied from interface:OpenJPAStateManagerReturn true if the given field has a default value.- Specified by:
isDefaultValuein interfaceOpenJPAStateManager
-
getContext
public StoreContext getContext()
Description copied from interface:OpenJPAStateManagerReturn the managing context.- Specified by:
getContextin interfaceOpenJPAStateManager
-
getPCState
public PCState getPCState()
Description copied from interface:OpenJPAStateManagerReturn the state that this object is in.- Specified by:
getPCStatein interfaceOpenJPAStateManager
-
getId
public java.lang.Object getId()
Description copied from interface:OpenJPAStateManagerReturn the identifier for this state manager. This may return a temporary identifier for new unflushed instances that have not been assigned an object id, or for non-persistent or embedded instances. For all other instances this method is the same asOpenJPAStateManager.getObjectId().- Specified by:
getIdin interfaceOpenJPAStateManager
-
getObjectId
public java.lang.Object getObjectId()
Description copied from interface:OpenJPAStateManagerReturn the instance's object id. This method will return null if no oid has been assigned. Oids are assigned to newly-persisted instances when the user first asks for it, or on flush.- Specified by:
getObjectIdin interfaceOpenJPAStateManager
-
setObjectId
public void setObjectId(java.lang.Object oid)
Description copied from interface:OpenJPAStateManagerSet the object id for the managed instance. Some back ends may not be able to assign a permanent oid until flush. Do not call this method on application identity instances; changing the primary key fields of application identity objects through thestoreXXXFieldmethods will automatically change the oid.- Specified by:
setObjectIdin interfaceOpenJPAStateManager
-
assignObjectId
public boolean assignObjectId(boolean flush)
Description copied from interface:OpenJPAStateManagerAsk the store manager to assign a permanent oid to this new instance.- Specified by:
assignObjectIdin interfaceOpenJPAStateManager- Parameters:
flush- if true, flush if necessary to get a permanent oid; if false, the oid may be left unassigned- Returns:
- true if an oid assigned, false otherwise
-
getLock
public java.lang.Object getLock()
Description copied from interface:OpenJPAStateManagerThe lock object set for this instance. This object is generally managed by the system lock manager.- Specified by:
getLockin interfaceOpenJPAStateManager
-
setLock
public void setLock(java.lang.Object lock)
Description copied from interface:OpenJPAStateManagerThe lock object set for this instance. This object is generally managed by the system lock manager.- Specified by:
setLockin interfaceOpenJPAStateManager
-
getVersion
public java.lang.Object getVersion()
Description copied from interface:OpenJPAStateManagerReturn the current version indicator for this instance.- Specified by:
getVersionin interfaceOpenJPAStateManager- Specified by:
getVersionin interfaceStateManager
-
setVersion
public void setVersion(java.lang.Object version)
Description copied from interface:OpenJPAStateManagerSet the version indicator for this instance, as loaded from the data store. This method is used by theStoreManagerwhen loading instance data. On rollback, the version will be rolled back to this value. Version objects should be serializable and should not require vendor-specific classes, because they are transferred to detached objects.- Specified by:
setVersionin interfaceOpenJPAStateManager
-
setNextVersion
public void setNextVersion(java.lang.Object version)
Description copied from interface:OpenJPAStateManagerSet the next version indicator in the datastore pending a successful flush. TheStoreManageruses this method during flush.- Specified by:
setNextVersionin interfaceOpenJPAStateManager
-
isVersionUpdateRequired
public boolean isVersionUpdateRequired()
Description copied from interface:OpenJPAStateManagerReturns true if this state needs to issue a version update, possibly as a result of being locked.- Specified by:
isVersionUpdateRequiredin interfaceOpenJPAStateManager
-
isVersionCheckRequired
public boolean isVersionCheckRequired()
Description copied from interface:OpenJPAStateManagerReturns true if this state needs to issue a version check at flush time.- Specified by:
isVersionCheckRequiredin interfaceOpenJPAStateManager
-
getImplData
public java.lang.Object getImplData()
Description copied from interface:OpenJPAStateManagerAn object that concrete back ends can associate with each instance. This object is not used or modified in any way by the generic persistence layer.- Specified by:
getImplDatain interfaceOpenJPAStateManager
-
setImplData
public java.lang.Object setImplData(java.lang.Object data, boolean cacheable)Description copied from interface:OpenJPAStateManagerAn object that concrete back ends can associate with each instance. This object is not used or modified in any way by the generic persistence layer.- Specified by:
setImplDatain interfaceOpenJPAStateManagercacheable- whether the impl data can be shared among instances in different contexts if L2 caching is enabled- Returns:
- the previous impl data value, if any
-
isImplDataCacheable
public boolean isImplDataCacheable()
Description copied from interface:OpenJPAStateManagerWhether the instance-level impl data can be shared among instances in different contexts if L2 caching is enabled.- Specified by:
isImplDataCacheablein interfaceOpenJPAStateManager
-
getImplData
public java.lang.Object getImplData(int field)
Description copied from interface:OpenJPAStateManagerField-level impl data. Field-level data only applies to loaded fields, and is cleared when the field is cleared.- Specified by:
getImplDatain interfaceOpenJPAStateManager
-
setImplData
public java.lang.Object setImplData(int field, java.lang.Object data)Description copied from interface:OpenJPAStateManagerField-level impl data. Field-level data only applies to loaded fields, and is cleared when the field is cleared. Whether the data is cached across instances depends on the corresponding field metadata's response toFieldMetaData.usesImplData().- Specified by:
setImplDatain interfaceOpenJPAStateManager- Returns:
- the previous impl data value, if any
-
isImplDataCacheable
public boolean isImplDataCacheable(int field)
Description copied from interface:OpenJPAStateManagerWhether the field's impl data is loaded and can be shared among instances in different contexts if L2 caching is enabled.- Specified by:
isImplDataCacheablein interfaceOpenJPAStateManager
-
getIntermediate
public java.lang.Object getIntermediate(int field)
Description copied from interface:OpenJPAStateManagerUse intermediate field data to store intermediate information that might be available before the field is fully loaded. The system will automatically clear this data when the field gets loaded. This data should be cacheable; the datastore cache will attempt to cache it if the field value is not available.- Specified by:
getIntermediatein interfaceOpenJPAStateManager
-
setIntermediate
public void setIntermediate(int field, java.lang.Object value)Description copied from interface:OpenJPAStateManagerUse intermediate field data to store intermediate information that might be available before the field is fully loaded. The system will automatically clear this data when the field gets loaded. This data should be cacheable; the datastore cache will attempt to cache it if the field value is not available.- Specified by:
setIntermediatein interfaceOpenJPAStateManager
-
fetchBoolean
public boolean fetchBoolean(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchBooleanin interfaceOpenJPAStateManager
-
fetchByte
public byte fetchByte(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchBytein interfaceOpenJPAStateManager
-
fetchChar
public char fetchChar(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchCharin interfaceOpenJPAStateManager
-
fetchDouble
public double fetchDouble(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchDoublein interfaceOpenJPAStateManager
-
fetchFloat
public float fetchFloat(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchFloatin interfaceOpenJPAStateManager
-
fetchInt
public int fetchInt(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchIntin interfaceOpenJPAStateManager
-
fetchLong
public long fetchLong(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchLongin interfaceOpenJPAStateManager
-
fetchObject
public java.lang.Object fetchObject(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchObjectin interfaceOpenJPAStateManager
-
fetchShort
public short fetchShort(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchShortin interfaceOpenJPAStateManager
-
fetchString
public java.lang.String fetchString(int field)
Description copied from interface:OpenJPAStateManagerReturn the external value of the given field.- Specified by:
fetchStringin interfaceOpenJPAStateManager
-
fetchFromDetachedSM
public java.lang.Object fetchFromDetachedSM(DetachedStateManager sm, int field)
-
fetch
public java.lang.Object fetch(int field)
Description copied from interface:OpenJPAStateManagerReturn the externalized value of the field with the given index as an object. If there is no externalizer, this is equivalent toOpenJPAStateManager.fetchField(int, boolean).- Specified by:
fetchin interfaceOpenJPAStateManager
-
fetchField
public java.lang.Object fetchField(int field, boolean transitions)Description copied from interface:OpenJPAStateManagerReturn the value of the field with the given index as an object.- Specified by:
fetchFieldin interfaceOpenJPAStateManagertransitions- if true, this method will cause state transitions to occur as if the field were accessed normally
-
fetchInitialField
public java.lang.Object fetchInitialField(int field)
Description copied from interface:OpenJPAStateManagerReturn the value of the field at the specified index as of the beginning of the transaction.- Specified by:
fetchInitialFieldin interfaceOpenJPAStateManager
-
storeBoolean
public void storeBoolean(int field, boolean externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeBooleanin interfaceOpenJPAStateManager
-
storeByte
public void storeByte(int field, byte externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeBytein interfaceOpenJPAStateManager
-
storeChar
public void storeChar(int field, char externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeCharin interfaceOpenJPAStateManager
-
storeDouble
public void storeDouble(int field, double externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeDoublein interfaceOpenJPAStateManager
-
storeFloat
public void storeFloat(int field, float externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeFloatin interfaceOpenJPAStateManager
-
storeInt
public void storeInt(int field, int externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeIntin interfaceOpenJPAStateManager
-
storeLong
public void storeLong(int field, long externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeLongin interfaceOpenJPAStateManager
-
storeObject
public void storeObject(int field, java.lang.Object externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeObjectin interfaceOpenJPAStateManager
-
storeShort
public void storeShort(int field, short externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeShortin interfaceOpenJPAStateManager
-
storeString
public void storeString(int field, java.lang.String externalVal)Description copied from interface:OpenJPAStateManagerSet the given external value back into the given field.- Specified by:
storeStringin interfaceOpenJPAStateManager
-
store
public void store(int field, java.lang.Object value)Description copied from interface:OpenJPAStateManagerSet the value of the field with the given index as from the external object value. If there is no externalizer, this is equivalent toOpenJPAStateManager.storeField(int, java.lang.Object).- Specified by:
storein interfaceOpenJPAStateManager
-
storeField
public void storeField(int field, java.lang.Object value)Description copied from interface:OpenJPAStateManagerSet the value of the field with the given index as an object.- Specified by:
storeFieldin interfaceOpenJPAStateManager
-
dirty
public void dirty(int field)
Description copied from interface:OpenJPAStateManagerMark the given field as dirty.- Specified by:
dirtyin interfaceOpenJPAStateManager
-
removed
public void removed(int field, java.lang.Object removed, boolean key)Description copied from interface:OpenJPAStateManagerNotification that an element has been removed from the given field.- Specified by:
removedin interfaceOpenJPAStateManager
-
beforeRefresh
public boolean beforeRefresh(boolean refreshAll)
Description copied from interface:OpenJPAStateManagerPrepare the instance for refresh- Specified by:
beforeRefreshin interfaceOpenJPAStateManager- Parameters:
refreshAll- true if this instance is one of a collection of objects being refreshed- Returns:
- true if the object needs a refresh, false otherwise
- See Also:
Broker.refresh(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
-
setRemote
public void setRemote(int field, java.lang.Object value)Description copied from interface:OpenJPAStateManagerSet the given field to the given value. Make the field dirty as if user code set it. Do not delete dependent objects in the field's current value. This method is invoked by the remote package to synch a server-side state manager with remote changes. We do not need to delete dependent instances because they will have been deleted when the field changed on the client side, and those client-side deletes will be transmitted independently.- Specified by:
setRemotein interfaceOpenJPAStateManager
-
getGenericContext
public java.lang.Object getGenericContext()
Description copied from interface:StateManagerPersistence context.- Specified by:
getGenericContextin interfaceStateManager
-
getPCPrimaryKey
public java.lang.Object getPCPrimaryKey(java.lang.Object oid, int field)Description copied from interface:StateManagerReturn the persistence-capable primary key object by extracting the identity value of the related instance stored in the given field from the given object id.- Specified by:
getPCPrimaryKeyin interfaceStateManager
-
replaceStateManager
public StateManager replaceStateManager(StateManager sm)
Description copied from interface:StateManagerChange state manager.- Specified by:
replaceStateManagerin interfaceStateManager
-
isDirty
public boolean isDirty()
Description copied from interface:StateManagerWhether the instance has been modified in this transaction.- Specified by:
isDirtyin interfaceStateManager
-
isTransactional
public boolean isTransactional()
Description copied from interface:StateManagerWhether the instance is transactional.- Specified by:
isTransactionalin interfaceStateManager
-
isPersistent
public boolean isPersistent()
Description copied from interface:StateManagerWhether the instance is persistent.- Specified by:
isPersistentin interfaceStateManager
-
isNew
public boolean isNew()
Description copied from interface:StateManagerWhether the instance is newly-persisted in this transaction.- Specified by:
isNewin interfaceStateManager
-
isDeleted
public boolean isDeleted()
Description copied from interface:StateManagerWhether the instance is deleted in this transaction.- Specified by:
isDeletedin interfaceStateManager
-
isDetached
public boolean isDetached()
Description copied from interface:StateManagerWhether the instance is detached (i.e. this manager is a detached state manager)- Specified by:
isDetachedin interfaceStateManager
-
dirty
public void dirty(java.lang.String field)
Description copied from interface:StateManagerMake named field dirty.- Specified by:
dirtyin interfaceStateManager
-
fetchObjectId
public java.lang.Object fetchObjectId()
Description copied from interface:StateManagerReturn the object id, assigning it if necessary.- Specified by:
fetchObjectIdin interfaceStateManager
-
serializing
public boolean serializing()
Description copied from interface:StateManagerCallback to prepare instance for serialization.- Specified by:
serializingin interfaceStateManager- Returns:
- true to null detached state after serialize
-
writeDetached
public boolean writeDetached(java.io.ObjectOutput out)
Description copied from interface:StateManagerWrite detached state object and detached state manager to the given stream.- Specified by:
writeDetachedin interfaceStateManager- Returns:
- true if managed fields also written to stream
-
proxyDetachedDeserialized
public void proxyDetachedDeserialized(int idx)
Description copied from interface:StateManagerProxy the given detached field after deserialization.- Specified by:
proxyDetachedDeserializedin interfaceStateManager
-
accessingField
public void accessingField(int idx)
Description copied from interface:StateManagerField access callback.- Specified by:
accessingFieldin interfaceStateManager
-
providedBooleanField
public void providedBooleanField(PersistenceCapable pc, int idx, boolean cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedBooleanFieldin interfaceStateManager
-
providedCharField
public void providedCharField(PersistenceCapable pc, int idx, char cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedCharFieldin interfaceStateManager
-
providedByteField
public void providedByteField(PersistenceCapable pc, int idx, byte cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedByteFieldin interfaceStateManager
-
providedShortField
public void providedShortField(PersistenceCapable pc, int idx, short cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedShortFieldin interfaceStateManager
-
providedIntField
public void providedIntField(PersistenceCapable pc, int idx, int cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedIntFieldin interfaceStateManager
-
providedLongField
public void providedLongField(PersistenceCapable pc, int idx, long cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedLongFieldin interfaceStateManager
-
providedFloatField
public void providedFloatField(PersistenceCapable pc, int idx, float cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedFloatFieldin interfaceStateManager
-
providedDoubleField
public void providedDoubleField(PersistenceCapable pc, int idx, double cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedDoubleFieldin interfaceStateManager
-
providedStringField
public void providedStringField(PersistenceCapable pc, int idx, java.lang.String cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedStringFieldin interfaceStateManager
-
providedObjectField
public void providedObjectField(PersistenceCapable pc, int idx, java.lang.Object cur)
Description copied from interface:StateManagerProvide state callback.- Specified by:
providedObjectFieldin interfaceStateManager
-
settingBooleanField
public void settingBooleanField(PersistenceCapable pc, int idx, boolean cur, boolean next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingBooleanFieldin interfaceStateManager
-
settingCharField
public void settingCharField(PersistenceCapable pc, int idx, char cur, char next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingCharFieldin interfaceStateManager
-
settingByteField
public void settingByteField(PersistenceCapable pc, int idx, byte cur, byte next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingByteFieldin interfaceStateManager
-
settingShortField
public void settingShortField(PersistenceCapable pc, int idx, short cur, short next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingShortFieldin interfaceStateManager
-
settingIntField
public void settingIntField(PersistenceCapable pc, int idx, int cur, int next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingIntFieldin interfaceStateManager
-
settingLongField
public void settingLongField(PersistenceCapable pc, int idx, long cur, long next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingLongFieldin interfaceStateManager
-
settingFloatField
public void settingFloatField(PersistenceCapable pc, int idx, float cur, float next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingFloatFieldin interfaceStateManager
-
settingDoubleField
public void settingDoubleField(PersistenceCapable pc, int idx, double cur, double next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingDoubleFieldin interfaceStateManager
-
settingStringField
public void settingStringField(PersistenceCapable pc, int idx, java.lang.String cur, java.lang.String next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingStringFieldin interfaceStateManager
-
settingObjectField
public void settingObjectField(PersistenceCapable pc, int idx, java.lang.Object cur, java.lang.Object next, int set)
Description copied from interface:StateManagerSetting state callback.- Specified by:
settingObjectFieldin interfaceStateManager
-
replaceBooleanField
public boolean replaceBooleanField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceBooleanFieldin interfaceStateManager
-
replaceCharField
public char replaceCharField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceCharFieldin interfaceStateManager
-
replaceByteField
public byte replaceByteField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceByteFieldin interfaceStateManager
-
replaceShortField
public short replaceShortField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceShortFieldin interfaceStateManager
-
replaceIntField
public int replaceIntField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceIntFieldin interfaceStateManager
-
replaceLongField
public long replaceLongField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceLongFieldin interfaceStateManager
-
replaceFloatField
public float replaceFloatField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceFloatFieldin interfaceStateManager
-
replaceDoubleField
public double replaceDoubleField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceDoubleFieldin interfaceStateManager
-
replaceStringField
public java.lang.String replaceStringField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceStringFieldin interfaceStateManager
-
replaceObjectField
public java.lang.Object replaceObjectField(PersistenceCapable pc, int idx)
Description copied from interface:StateManagerReplace state callback.- Specified by:
replaceObjectFieldin interfaceStateManager
-
isDelayed
public boolean isDelayed(int field)
Description copied from interface:OpenJPAStateManagerSome field types (collection proxies) support delayed loading. Delayed loading is a step beyond lazy loading. Delayed load allows an instance of a field to be returned without actually loading it.- Specified by:
isDelayedin interfaceOpenJPAStateManager- Returns:
- true if the field is setup for delayed access
-
setDelayed
public void setDelayed(int field, boolean delay)Description copied from interface:OpenJPAStateManagerSome field types (collection proxies) support delayed loading. Delayed loading is a step beyond lazy loading. Delayed load allows an instance of a field to be returned without actually loading it.- Specified by:
setDelayedin interfaceOpenJPAStateManager
-
loadDelayedField
public void loadDelayedField(int field)
Description copied from interface:OpenJPAStateManagerIf a field was marked delayed in a previous load operation this method can be used to load the field.- Specified by:
loadDelayedFieldin interfaceOpenJPAStateManager
-
fetchBooleanField
public boolean fetchBooleanField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchBooleanFieldin interfaceFieldSupplier
-
fetchByteField
public byte fetchByteField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchByteFieldin interfaceFieldSupplier
-
fetchCharField
public char fetchCharField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchCharFieldin interfaceFieldSupplier
-
fetchDoubleField
public double fetchDoubleField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchDoubleFieldin interfaceFieldSupplier
-
fetchFloatField
public float fetchFloatField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchFloatFieldin interfaceFieldSupplier
-
fetchIntField
public int fetchIntField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchIntFieldin interfaceFieldSupplier
-
fetchLongField
public long fetchLongField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchLongFieldin interfaceFieldSupplier
-
fetchObjectField
public java.lang.Object fetchObjectField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchObjectFieldin interfaceFieldSupplier
-
fetchShortField
public short fetchShortField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchShortFieldin interfaceFieldSupplier
-
fetchStringField
public java.lang.String fetchStringField(int field)
Description copied from interface:FieldSupplierReturn the value of the given field.- Specified by:
fetchStringFieldin interfaceFieldSupplier
-
storeBooleanField
public void storeBooleanField(int field, boolean curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeBooleanFieldin interfaceFieldConsumer
-
storeByteField
public void storeByteField(int field, byte curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeByteFieldin interfaceFieldConsumer
-
storeCharField
public void storeCharField(int field, char curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeCharFieldin interfaceFieldConsumer
-
storeDoubleField
public void storeDoubleField(int field, double curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeDoubleFieldin interfaceFieldConsumer
-
storeFloatField
public void storeFloatField(int field, float curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeFloatFieldin interfaceFieldConsumer
-
storeIntField
public void storeIntField(int field, int curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeIntFieldin interfaceFieldConsumer
-
storeLongField
public void storeLongField(int field, long curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeLongFieldin interfaceFieldConsumer
-
storeObjectField
public void storeObjectField(int field, java.lang.Object curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeObjectFieldin interfaceFieldConsumer
-
storeShortField
public void storeShortField(int field, short curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeShortFieldin interfaceFieldConsumer
-
storeStringField
public void storeStringField(int field, java.lang.String curVal)Description copied from interface:FieldConsumerSet the value of the given field.- Specified by:
storeStringFieldin interfaceFieldConsumer
-
clear
public void clear()
Clear any held state. Fields are also cleared automatically when fetched.
-
-