public interface OpenJPAStateManager extends StateManager, FieldManager
StoreManager
.
The fetchXXXField
and storeXXXField
methods can be used to get and set fields of the managed persistent object.
Most back-end code, however, should use the similar
fetchXXX
and storeXXX
methods in place of
the field methods. These methods function just like the field methods, but
also pass the value through the externalizer and factory the field may have.Modifier and Type | Field and Description |
---|---|
static int |
SET_ATTACH
The field is being attached by a detached state manager; the value is
from the detached instance.
|
static int |
SET_REMOTE
The remote broker framework is setting the field on the server.
|
static int |
SET_USER
A user is setting the field.
|
Modifier and Type | Method and Description |
---|---|
boolean |
assignObjectId(boolean flush)
Ask the store manager to assign a permanent oid to this new instance.
|
boolean |
beforeRefresh(boolean refreshAll)
Prepare the instance for refresh
|
void |
dirty(int field)
Mark the given field as dirty.
|
Object |
fetch(int field)
Return the externalized value of the field with the given index as an
object.
|
boolean |
fetchBoolean(int field)
Return the external value of the given field.
|
byte |
fetchByte(int field)
Return the external value of the given field.
|
char |
fetchChar(int field)
Return the external value of the given field.
|
double |
fetchDouble(int field)
Return the external value of the given field.
|
Object |
fetchField(int field,
boolean transitions)
Return the value of the field with the given index as an object.
|
float |
fetchFloat(int field)
Return the external value of the given field.
|
Object |
fetchInitialField(int field)
Return the value of the field at the specified index as of the
beginning of the transaction.
|
int |
fetchInt(int field)
Return the external value of the given field.
|
long |
fetchLong(int field)
Return the external value of the given field.
|
Object |
fetchObject(int field)
Return the external value of the given field.
|
Object |
fetchObjectField(int field)
Fetch an object field by index.
|
short |
fetchShort(int field)
Return the external value of the given field.
|
String |
fetchString(int field)
Return the external value of the given field.
|
StoreContext |
getContext()
Return the managing context.
|
BitSet |
getDirty()
Return a read-only mask of the indexes of all dirty fields.
|
BitSet |
getFlushed()
Return a read-only mask of the indexes of all fields that have been
flushed since they were last changed.
|
Object |
getId()
Return the identifier for this state manager.
|
Object |
getImplData()
An object that concrete back ends can associate with each instance.
|
Object |
getImplData(int field)
Field-level impl data.
|
Object |
getIntermediate(int field)
Use intermediate field data to store intermediate information that
might be available before the field is fully loaded.
|
BitSet |
getLoaded()
Return a read-only mask of the indexes of all loaded fields.
|
Object |
getLock()
The lock object set for this instance.
|
Object |
getManagedInstance()
Return the managed instance.
|
ClassMetaData |
getMetaData()
Get the metadata for this instance.
|
Object |
getObjectId()
Return the instance's object id.
|
OpenJPAStateManager |
getOwner()
Return the owning state if this is an embedded instance.
|
int |
getOwnerIndex()
Return the owning value's field index
|
PCState |
getPCState()
Return the state that this object is in.
|
PersistenceCapable |
getPersistenceCapable()
Return the
PersistenceCapable instance that provides access to
the instance managed by this state manager. |
BitSet |
getUnloaded(FetchConfiguration fetch)
Return a mutable mask of the unloaded fields that need loading based
on the given fetch configuration.
|
Object |
getVersion()
Return the current version indicator for this instance.
|
void |
initialize(Class forType,
PCState state)
Initialize the state manager with a new instance of the given
persistence capable type and the proper lifecycle state.
|
boolean |
isDefaultValue(int field)
Return true if the given field has a default value.
|
boolean |
isDelayed(int field)
Some field types (collection proxies) support delayed loading.
|
boolean |
isEmbedded()
Return true if this instance has an owner, meaning it is an embedded
value.
|
boolean |
isFlushed()
Return whether this object has been flushed to the datastore in this
transaction.
|
boolean |
isFlushedDirty()
Return whether this object has been flushed, then dirtied again.
|
boolean |
isImplDataCacheable()
Whether the instance-level impl data can be shared among instances
in different contexts if L2 caching is enabled.
|
boolean |
isImplDataCacheable(int field)
Whether the field's impl data is loaded and can be shared among
instances in different contexts if L2 caching is enabled.
|
boolean |
isProvisional()
Return whether this object is provisionally persistent.
|
boolean |
isVersionCheckRequired()
Returns true if this state needs to issue a version check at flush time.
|
boolean |
isVersionUpdateRequired()
Returns true if this state needs to issue a version update, possibly
as a result of being locked.
|
void |
load(FetchConfiguration fetch)
Load fetch group fields.
|
void |
loadDelayedField(int field)
If a field was marked delayed in a previous load operation this method can be
used to load the field.
|
Object |
newFieldProxy(int field)
Create a new hollow proxy instance for the given field.
|
Object |
newProxy(int field)
Create a new hollow proxy instance for the given field.
|
void |
removed(int field,
Object removed,
boolean key)
Notification that an element has been removed from the given field.
|
void |
setDelayed(int field,
boolean delay)
Some field types (collection proxies) support delayed loading.
|
Object |
setImplData(int field,
Object data)
Field-level impl data.
|
Object |
setImplData(Object data,
boolean cacheable)
An object that concrete back ends can associate with each instance.
|
void |
setIntermediate(int field,
Object value)
Use intermediate field data to store intermediate information that
might be available before the field is fully loaded.
|
void |
setLock(Object lock)
The lock object set for this instance.
|
void |
setNextVersion(Object version)
Set the next version indicator in the datastore pending a successful
flush.
|
void |
setObjectId(Object oid)
Set the object id for the managed instance.
|
void |
setRemote(int field,
Object value)
Set the given field to the given value.
|
void |
setVersion(Object version)
Set the version indicator for this instance, as loaded from the
data store.
|
void |
store(int field,
Object value)
Set the value of the field with the given index as from the external
object value.
|
void |
storeBoolean(int field,
boolean externalVal)
Set the given external value back into the given field.
|
void |
storeByte(int field,
byte externalVal)
Set the given external value back into the given field.
|
void |
storeChar(int field,
char externalVal)
Set the given external value back into the given field.
|
void |
storeDouble(int field,
double externalVal)
Set the given external value back into the given field.
|
void |
storeField(int field,
Object value)
Set the value of the field with the given index as an object.
|
void |
storeFloat(int field,
float externalVal)
Set the given external value back into the given field.
|
void |
storeInt(int field,
int externalVal)
Set the given external value back into the given field.
|
void |
storeLong(int field,
long externalVal)
Set the given external value back into the given field.
|
void |
storeObject(int field,
Object externalVal)
Set the given external value back into the given field.
|
void |
storeShort(int field,
short externalVal)
Set the given external value back into the given field.
|
void |
storeString(int field,
String externalVal)
Set the given external value back into the given field.
|
accessingField, dirty, fetchObjectId, getGenericContext, getPCPrimaryKey, isDeleted, isDetached, isDirty, isNew, isPersistent, isTransactional, providedBooleanField, providedByteField, providedCharField, providedDoubleField, providedFloatField, providedIntField, providedLongField, providedObjectField, providedShortField, providedStringField, proxyDetachedDeserialized, replaceBooleanField, replaceByteField, replaceCharField, replaceDoubleField, replaceFloatField, replaceIntField, replaceLongField, replaceObjectField, replaceShortField, replaceStateManager, replaceStringField, serializing, settingBooleanField, settingByteField, settingCharField, settingDoubleField, settingFloatField, settingIntField, settingLongField, settingObjectField, settingShortField, settingStringField, writeDetached
storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchShortField, fetchStringField
static final int SET_USER
static final int SET_REMOTE
static final int SET_ATTACH
void initialize(Class forType, PCState state)
forType
- the type for which to create a new instancestate
- the initial state to which to set the instancevoid load(FetchConfiguration fetch)
Object getManagedInstance()
PersistenceCapable getPersistenceCapable()
PersistenceCapable
instance that provides access to
the instance managed by this state manager. May be a proxy around
the actual managed instance.ClassMetaData getMetaData()
OpenJPAStateManager getOwner()
int getOwnerIndex()
boolean isEmbedded()
boolean isFlushed()
boolean isFlushedDirty()
boolean isProvisional()
BitSet getLoaded()
BitSet getDirty()
BitSet getFlushed()
BitSet getUnloaded(FetchConfiguration fetch)
Object newProxy(int field)
Proxy
. In all other cases,
this method delegates to the system
ProxyManager
with 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. Calling storeField(int, java.lang.Object)
or store(int, java.lang.Object)
will set the proxy's owner automatically.Object newFieldProxy(int field)
newProxy(int)
in that it returns a proxy for the
field's declared type, not its externalized type.newProxy(int)
boolean isDefaultValue(int field)
StoreContext getContext()
PCState getPCState()
Object getId()
getObjectId()
.Object getObjectId()
void setObjectId(Object oid)
storeXXXField
methods will automatically change the oid.boolean assignObjectId(boolean flush)
flush
- if true, flush if necessary to get a permanent oid; if
false, the oid may be left unassignedObject getLock()
void setLock(Object lock)
Object getVersion()
getVersion
in interface StateManager
void setVersion(Object version)
StoreManager
when
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.void setNextVersion(Object version)
StoreManager
uses this method during flush.boolean isVersionUpdateRequired()
boolean isVersionCheckRequired()
Object getImplData()
Object setImplData(Object data, boolean cacheable)
cacheable
- whether the impl data can be shared among instances
in different contexts if L2 caching is enabledboolean isImplDataCacheable()
Object getImplData(int field)
Object setImplData(int field, Object data)
FieldMetaData.usesImplData()
.boolean isImplDataCacheable(int field)
Object getIntermediate(int field)
void setIntermediate(int field, Object value)
boolean fetchBoolean(int field)
byte fetchByte(int field)
char fetchChar(int field)
double fetchDouble(int field)
float fetchFloat(int field)
int fetchInt(int field)
long fetchLong(int field)
Object fetchObject(int field)
short fetchShort(int field)
String fetchString(int field)
Object fetch(int field)
fetchField(int, boolean)
.Object fetchField(int field, boolean transitions)
transitions
- if true, this method will cause state transitions
to occur as if the field were accessed normallyObject fetchInitialField(int field)
void storeBoolean(int field, boolean externalVal)
void storeByte(int field, byte externalVal)
void storeChar(int field, char externalVal)
void storeDouble(int field, double externalVal)
void storeFloat(int field, float externalVal)
void storeInt(int field, int externalVal)
void storeLong(int field, long externalVal)
void storeObject(int field, Object externalVal)
void storeShort(int field, short externalVal)
void storeString(int field, String externalVal)
void store(int field, Object value)
storeField(int, java.lang.Object)
.void storeField(int field, Object value)
void dirty(int field)
void removed(int field, Object removed, boolean key)
boolean beforeRefresh(boolean refreshAll)
refreshAll
- true if this instance is one of a collection of
objects being refreshedBroker.refresh(java.lang.Object, org.apache.openjpa.kernel.OpCallbacks)
void setRemote(int field, Object value)
boolean isDelayed(int field)
void setDelayed(int field, boolean delay)
void loadDelayedField(int field)
Object fetchObjectField(int field)
fetchObjectField
in interface FieldSupplier
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.