Class StateManagerImpl

  • All Implemented Interfaces:
    java.io.Serializable, FieldConsumer, FieldManager, FieldSupplier, StateManager, OpenJPAStateManager

    public class StateManagerImpl
    extends java.lang.Object
    implements OpenJPAStateManager, java.io.Serializable
    Implementation of the OpenJPAStateManager interface for use with this runtime. Each state manager manages the state of a single persistence capable instance. The state manager is also responsible for all communications about the instance to the StoreManager. The state manager uses the State pattern in both its interaction with the governed instance and its interaction with the broker. In its interactions with the persistence capable instance, it uses the FieldManager interface. Similarly, when interacting with the broker, it uses the PCState singleton that represents the current lifecycle state of the instance.
    Author:
    Abe White
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accessingField​(int field)
      Field access callback.
      boolean assignObjectId​(boolean flush)
      Ask the store manager to assign a permanent oid to this new instance.
      protected void beforeAccessField​(int field)
      Load the given field before access.
      boolean beforeRefresh​(boolean refreshAll)
      Prepare the instance for refresh
      void dirty​(int field)
      Mark the given field as dirty.
      void dirty​(java.lang.String field)
      Make named field dirty.
      void dirtyCheck()
      Checks whether or not _pc is dirty.
      java.lang.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.
      boolean fetchBooleanField​(int field)
      Return the value of the given field.
      byte fetchByte​(int field)
      Return the external value of the given field.
      byte fetchByteField​(int field)
      Return the value of the given field.
      char fetchChar​(int field)
      Return the external value of the given field.
      char fetchCharField​(int field)
      Return the value of the given field.
      double fetchDouble​(int field)
      Return the external value of the given field.
      double fetchDoubleField​(int field)
      Return the value of the given field.
      java.lang.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.
      float fetchFloatField​(int field)
      Return the value of the given field.
      java.lang.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.
      int fetchIntField​(int field)
      Return the value of the given field.
      long fetchLong​(int field)
      Return the external value of the given field.
      long fetchLongField​(int field)
      Return the value of the given field.
      java.lang.Object fetchObject​(int field)
      Return the external value of the given field.
      java.lang.Object fetchObjectField​(int field)
      Fetch an object field by index.
      java.lang.Object fetchObjectId()
      Return the object id, assigning it if necessary.
      short fetchShort​(int field)
      Return the external value of the given field.
      short fetchShortField​(int field)
      Return the value of the given field.
      java.lang.String fetchString​(int field)
      Return the external value of the given field.
      java.lang.String fetchStringField​(int field)
      Return the value of the given field.
      StoreContext getContext()
      Return the managing context.
      boolean getDereferencedEmbedDependent()  
      java.util.BitSet getDirty()
      Return a read-only mask of the indexes of all dirty fields.
      protected java.lang.Object getExtraFieldData​(int field, boolean isLoaded)
      Return the data from the proper index of the extra field data array.
      java.util.BitSet getFlushed()
      Return a read-only mask of the indexes of all fields that have been flushed since they were last changed.
      java.lang.Object getGenericContext()
      Persistence context.
      java.lang.Object getId()
      Return the identifier for this state manager.
      java.lang.Object getImplData()
      An object that concrete back ends can associate with each instance.
      java.lang.Object getImplData​(int field)
      Field-level impl data.
      java.lang.Object getIntermediate​(int field)
      Use intermediate field data to store intermediate information that might be available before the field is fully loaded.
      java.util.BitSet getLoaded()
      Return a read-only mask of the indexes of all loaded fields.
      java.lang.Object getLock()
      The lock object set for this instance.
      java.lang.Object getManagedInstance()
      Return the managed instance.
      java.util.List<FieldMetaData> getMappedByIdFields()  
      ClassMetaData getMetaData()
      Get the metadata for this instance.
      java.lang.Object getObjectId()
      Return the instance's object id.
      StateManagerImpl getObjectIdOwner()  
      OpenJPAStateManager getOwner()
      Return the owning state if this is an embedded instance.
      int getOwnerIndex()
      Return the owning value's field index
      java.lang.Object getPCPrimaryKey​(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.
      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.
      SaveFieldManager getSaveFieldManager()  
      java.util.BitSet getUnloaded​(FetchConfiguration fetch)
      Return a mutable mask of the unloaded fields that need loading based on the given fetch configuration.
      java.lang.Object getVersion()
      Return the current version indicator for this instance.
      void initialize​(java.lang.Class cls, PCState state)
      Initialize the state manager with a new instance of the given persistence capable type and the proper lifecycle state.
      protected void initialize​(PersistenceCapable pc, PCState state)
      Initialize with the given instance and 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 isDeleted()
      Whether the instance is deleted in this transaction.
      boolean isDetached()
      Whether the instance is detached (i.e. this manager is a detached state manager)
      boolean isDirty()
      Whether the instance has been modified in this transaction.
      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 isIntercepting()
      Whether or not data access in this instance is intercepted.
      boolean isNew()
      Whether the instance is newly-persisted in this transaction.
      boolean isPendingTransactional()  
      boolean isPersistent()
      Whether the instance is persistent.
      boolean isProvisional()
      Return whether this object is provisionally persistent.
      boolean isTransactional()
      Whether the instance is transactional.
      boolean isVersionCheckRequired()
      Returns whether this instance needs a version check.
      boolean isVersionUpdateRequired()
      Returns whether this instance needs a version update.
      void load​(FetchConfiguration fetch)
      Load fetch group fields.
      protected boolean load​(FetchConfiguration fetch, int loadMode, java.util.BitSet exclude, java.lang.Object sdata, boolean forWrite)
      Load the state of this instance based on the given fetch configuration and load mode.
      void loadDelayedField​(int field)
      Loads a delayed access field.
      protected void loadField​(int field, int lockLevel, boolean forWrite, boolean fgs)
      Load the given field's fetch group; the field itself may already be loaded if it is being set by the user.
      protected void lock()
      Lock the state manager if the multithreaded option is set.
      java.lang.Object newFieldProxy​(int field)
      Create a new hollow proxy instance for the given field.
      java.lang.Object newProxy​(int field)
      Create a new hollow proxy instance for the given field.
      void providedBooleanField​(PersistenceCapable pc, int field, boolean curVal)
      Provide state callback.
      void providedByteField​(PersistenceCapable pc, int field, byte curVal)
      Provide state callback.
      void providedCharField​(PersistenceCapable pc, int field, char curVal)
      Provide state callback.
      void providedDoubleField​(PersistenceCapable pc, int field, double curVal)
      Provide state callback.
      void providedFloatField​(PersistenceCapable pc, int field, float curVal)
      Provide state callback.
      void providedIntField​(PersistenceCapable pc, int field, int curVal)
      Provide state callback.
      void providedLongField​(PersistenceCapable pc, int field, long curVal)
      Provide state callback.
      void providedObjectField​(PersistenceCapable pc, int field, java.lang.Object curVal)
      Provide state callback.
      void providedShortField​(PersistenceCapable pc, int field, short curVal)
      Provide state callback.
      void providedStringField​(PersistenceCapable pc, int field, java.lang.String curVal)
      Provide state callback.
      void proxyDetachedDeserialized​(int idx)
      Proxy the given detached field after deserialization.
      void removed​(int field, java.lang.Object removed, boolean key)
      Notification that an element has been removed from the given field.
      boolean replaceBooleanField​(PersistenceCapable pc, int field)
      Replace state callback.
      byte replaceByteField​(PersistenceCapable pc, int field)
      Replace state callback.
      char replaceCharField​(PersistenceCapable pc, int field)
      Replace state callback.
      double replaceDoubleField​(PersistenceCapable pc, int field)
      Replace state callback.
      byte replaceFlags()  
      float replaceFloatField​(PersistenceCapable pc, int field)
      Replace state callback.
      int replaceIntField​(PersistenceCapable pc, int field)
      Replace state callback.
      long replaceLongField​(PersistenceCapable pc, int field)
      Replace state callback.
      java.lang.Object replaceObjectField​(PersistenceCapable pc, int field)
      Replace state callback.
      short replaceShortField​(PersistenceCapable pc, int field)
      Replace state callback.
      StateManager replaceStateManager​(StateManager sm)
      Change state manager.
      java.lang.String replaceStringField​(PersistenceCapable pc, int field)
      Replace state callback.
      boolean requiresFetch​(FieldMetaData fmd)  
      static java.sql.Timestamp roundTimestamp​(java.sql.Timestamp val, int datePrecision)  
      boolean serializing()
      Callback to prepare instance for serialization.
      void setBroker​(BrokerImpl ctx)  
      void setDelayed​(int field, boolean delay)
      Some field types (collection proxies) support delayed loading.
      java.lang.Object setImplData​(int field, java.lang.Object data)
      Field-level impl data.
      java.lang.Object setImplData​(java.lang.Object data, boolean cacheable)
      An object that concrete back ends can associate with each instance.
      void setIntermediate​(int field, java.lang.Object data)
      Use intermediate field data to store intermediate information that might be available before the field is fully loaded.
      void setLock​(java.lang.Object lock)
      The lock object set for this instance.
      void setNextVersion​(java.lang.Object version)
      Set the next version indicator in the datastore pending a successful flush.
      void setObjectId​(java.lang.Object oid)
      Set the object id for the managed instance.
      void setOwner​(java.lang.Object oid)  
      void setPc​(PersistenceCapable pc)  
      void setPostLoadCallback​(boolean enabled)
      Set to false to prevent the postLoad method from sending lifecycle callback events.
      void setRemote​(int field, java.lang.Object value)
      Set the given field to the given value.
      void settingBooleanField​(PersistenceCapable pc, int field, boolean curVal, boolean newVal, int set)
      Setting state callback.
      void settingByteField​(PersistenceCapable pc, int field, byte curVal, byte newVal, int set)
      Setting state callback.
      void settingCharField​(PersistenceCapable pc, int field, char curVal, char newVal, int set)
      Setting state callback.
      void settingDoubleField​(PersistenceCapable pc, int field, double curVal, double newVal, int set)
      Setting state callback.
      void settingFloatField​(PersistenceCapable pc, int field, float curVal, float newVal, int set)
      Setting state callback.
      void settingIntField​(PersistenceCapable pc, int field, int curVal, int newVal, int set)
      Setting state callback.
      void settingLongField​(PersistenceCapable pc, int field, long curVal, long newVal, int set)
      Setting state callback.
      void settingObjectField​(PersistenceCapable pc, int field, java.lang.Object curVal, java.lang.Object newVal, int set)
      Setting state callback.
      void settingShortField​(PersistenceCapable pc, int field, short curVal, short newVal, int set)
      Setting state callback.
      void settingStringField​(PersistenceCapable pc, int field, java.lang.String curVal, java.lang.String newVal, int set)
      Setting state callback.
      void setVersion​(java.lang.Object version)
      Set the version indicator for this instance, as loaded from the data store.
      void store​(int field, java.lang.Object val)
      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 storeBooleanField​(int field, boolean curVal)
      Set the value of the given field.
      void storeByte​(int field, byte externalVal)
      Set the given external value back into the given field.
      void storeByteField​(int field, byte curVal)
      Set the value of the given field.
      void storeChar​(int field, char externalVal)
      Set the given external value back into the given field.
      void storeCharField​(int field, char curVal)
      Set the value of the given field.
      void storeDouble​(int field, double externalVal)
      Set the given external value back into the given field.
      void storeDoubleField​(int field, double curVal)
      Set the value of the given field.
      void storeField​(int field, java.lang.Object val)
      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 storeFloatField​(int field, float curVal)
      Set the value of the given field.
      void storeInt​(int field, int externalVal)
      Set the given external value back into the given field.
      void storeIntField​(int field, int curVal)
      Set the value of the given field.
      void storeLong​(int field, long externalVal)
      Set the given external value back into the given field.
      void storeLongField​(int field, long curVal)
      Set the value of the given field.
      void storeObject​(int field, java.lang.Object externalVal)
      Set the given external value back into the given field.
      void storeObjectField​(int field, java.lang.Object curVal)
      Set the value of the given field.
      void storeShort​(int field, short externalVal)
      Set the given external value back into the given field.
      void storeShortField​(int field, short curVal)
      Set the value of the given field.
      void storeString​(int field, java.lang.String externalVal)
      Set the given external value back into the given field.
      void storeStringField​(int field, java.lang.String curVal)
      Set the value of the given field.
      java.lang.String toString()  
      protected java.lang.RuntimeException translate​(java.lang.RuntimeException re)
      Translate the given exception based on the broker's implicit behavior.
      protected void unlock()
      Unlock the state manager.
      boolean writeDetached​(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, wait, wait, wait
    • Field Detail

      • _loaded

        protected java.util.BitSet _loaded
      • _version

        protected java.lang.Object _version
      • _loadVersion

        protected java.lang.Object _loadVersion
      • _fieldImpl

        protected java.lang.Object[] _fieldImpl
    • Constructor Detail

      • StateManagerImpl

        protected StateManagerImpl​(java.lang.Object id,
                                   ClassMetaData meta,
                                   BrokerImpl broker)
        Constructor; supply id, type metadata, and owning persistence manager.
      • StateManagerImpl

        public StateManagerImpl​(StateManagerImpl sm)
        Create a new StateManager instance based on the StateManager provided. A new PersistenceCapable instance will be created and associated with the new StateManager. All fields will be copied into the ne PC instance as well as the dirty, loaded, and flushed bitsets.
        Parameters:
        sm - A statemanager instance which will effectively be cloned.
      • StateManagerImpl

        public StateManagerImpl​(StateManagerImpl sm,
                                PCState newState)
        Create a new StateManager instance, optionally overriding the state (FLUSHED, DELETED, etc) of the underlying PersistenceCapable instance).
        Parameters:
        sm - A statemanager instance which will effectively be cloned.
        newState - The new state of the underlying persistence capable object.
    • Method Detail

      • initialize

        public void initialize​(java.lang.Class cls,
                               PCState state)
        Description copied from interface: OpenJPAStateManager
        Initialize 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:
        initialize in interface OpenJPAStateManager
        Parameters:
        cls - the type for which to create a new instance
        state - the initial state to which to set the instance
      • initialize

        protected void initialize​(PersistenceCapable pc,
                                  PCState state)
        Initialize with the given instance and state.
      • isIntercepting

        public boolean isIntercepting()
        Whether or not data access in this instance is intercepted. This differs from ClassMetaData.isIntercepting() in that it checks for property access + subclassing in addition to the redefinition / enhancement checks.
        Since:
        1.0.0
      • load

        protected boolean load​(FetchConfiguration fetch,
                               int loadMode,
                               java.util.BitSet exclude,
                               java.lang.Object sdata,
                               boolean forWrite)
        Load the state of this instance based on the given fetch configuration and load mode. Return true if any data was loaded, false otherwise.
      • setOwner

        public void setOwner​(java.lang.Object oid)
      • isFlushed

        public boolean isFlushed()
        Description copied from interface: OpenJPAStateManager
        Return whether this object has been flushed to the datastore in this transaction.
        Specified by:
        isFlushed in interface OpenJPAStateManager
      • getUnloaded

        public java.util.BitSet getUnloaded​(FetchConfiguration fetch)
        Description copied from interface: OpenJPAStateManager
        Return 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:
        getUnloaded in interface OpenJPAStateManager
      • getId

        public java.lang.Object getId()
        Description copied from interface: OpenJPAStateManager
        Return 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 as OpenJPAStateManager.getObjectId().
        Specified by:
        getId in interface OpenJPAStateManager
      • getObjectId

        public java.lang.Object getObjectId()
        Description copied from interface: OpenJPAStateManager
        Return 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:
        getObjectId in interface OpenJPAStateManager
      • setObjectId

        public void setObjectId​(java.lang.Object oid)
        Description copied from interface: OpenJPAStateManager
        Set 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 the storeXXXField methods will automatically change the oid.
        Specified by:
        setObjectId in interface OpenJPAStateManager
      • assignObjectId

        public boolean assignObjectId​(boolean flush)
        Description copied from interface: OpenJPAStateManager
        Ask the store manager to assign a permanent oid to this new instance.
        Specified by:
        assignObjectId in interface OpenJPAStateManager
        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: OpenJPAStateManager
        The lock object set for this instance. This object is generally managed by the system lock manager.
        Specified by:
        getLock in interface OpenJPAStateManager
      • setLock

        public void setLock​(java.lang.Object lock)
        Description copied from interface: OpenJPAStateManager
        The lock object set for this instance. This object is generally managed by the system lock manager.
        Specified by:
        setLock in interface OpenJPAStateManager
      • setVersion

        public void setVersion​(java.lang.Object version)
        Description copied from interface: OpenJPAStateManager
        Set the version indicator for this instance, as loaded from the data store. This method is used by the 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.
        Specified by:
        setVersion in interface OpenJPAStateManager
      • roundTimestamp

        public static java.sql.Timestamp roundTimestamp​(java.sql.Timestamp val,
                                                        int datePrecision)
      • getImplData

        public java.lang.Object getImplData()
        Description copied from interface: OpenJPAStateManager
        An 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:
        getImplData in interface OpenJPAStateManager
      • setImplData

        public java.lang.Object setImplData​(java.lang.Object data,
                                            boolean cacheable)
        Description copied from interface: OpenJPAStateManager
        An 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:
        setImplData in interface OpenJPAStateManager
        cacheable - 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: OpenJPAStateManager
        Whether the instance-level impl data can be shared among instances in different contexts if L2 caching is enabled.
        Specified by:
        isImplDataCacheable in interface OpenJPAStateManager
      • getImplData

        public java.lang.Object getImplData​(int field)
        Description copied from interface: OpenJPAStateManager
        Field-level impl data. Field-level data only applies to loaded fields, and is cleared when the field is cleared.
        Specified by:
        getImplData in interface OpenJPAStateManager
      • setImplData

        public java.lang.Object setImplData​(int field,
                                            java.lang.Object data)
        Description copied from interface: OpenJPAStateManager
        Field-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 to FieldMetaData.usesImplData().
        Specified by:
        setImplData in interface OpenJPAStateManager
        Returns:
        the previous impl data value, if any
      • isImplDataCacheable

        public boolean isImplDataCacheable​(int field)
        Description copied from interface: OpenJPAStateManager
        Whether the field's impl data is loaded and can be shared among instances in different contexts if L2 caching is enabled.
        Specified by:
        isImplDataCacheable in interface OpenJPAStateManager
      • getIntermediate

        public java.lang.Object getIntermediate​(int field)
        Description copied from interface: OpenJPAStateManager
        Use 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:
        getIntermediate in interface OpenJPAStateManager
      • setIntermediate

        public void setIntermediate​(int field,
                                    java.lang.Object data)
        Description copied from interface: OpenJPAStateManager
        Use 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:
        setIntermediate in interface OpenJPAStateManager
      • getExtraFieldData

        protected java.lang.Object getExtraFieldData​(int field,
                                                     boolean isLoaded)
        Return the data from the proper index of the extra field data array.
      • fetchField

        public java.lang.Object fetchField​(int field,
                                           boolean transitions)
        Description copied from interface: OpenJPAStateManager
        Return the value of the field with the given index as an object.
        Specified by:
        fetchField in interface OpenJPAStateManager
        transitions - if true, this method will cause state transitions to occur as if the field were accessed normally
      • storeField

        public void storeField​(int field,
                               java.lang.Object val)
        Description copied from interface: OpenJPAStateManager
        Set the value of the field with the given index as an object.
        Specified by:
        storeField in interface OpenJPAStateManager
      • dirtyCheck

        public void dirtyCheck()

        Checks whether or not _pc is dirty. In the cases where field tracking is not happening (see below), this method will do a state comparison to find whether _pc is dirty, and will update this instance with this information. In the cases where field tracking is happening, this method is a no-op.

        Fields are tracked for all classes that are run through the OpenJPA enhancer prior to or during deployment, and all classes (enhanced or unenhanced) in a Java 6 environment or newer.

        In a Java 5 VM or older:
        - instances of unenhanced classes that use property access and obey the property access limitations are tracked when the instances are loaded from the database by OpenJPA, and are not tracked when the instances are created by application code.
        - instances of unenhanced classes that use field access are never tracked.

        Since:
        1.0.0
      • fetchInitialField

        public java.lang.Object fetchInitialField​(int field)
        Description copied from interface: OpenJPAStateManager
        Return the value of the field at the specified index as of the beginning of the transaction.
        Specified by:
        fetchInitialField in interface OpenJPAStateManager
      • setRemote

        public void setRemote​(int field,
                              java.lang.Object value)
        Description copied from interface: OpenJPAStateManager
        Set 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:
        setRemote in interface OpenJPAStateManager
      • getDereferencedEmbedDependent

        public boolean getDereferencedEmbedDependent()
      • serializing

        public boolean serializing()
        Description copied from interface: StateManager
        Callback to prepare instance for serialization.
        Specified by:
        serializing in interface StateManager
        Returns:
        whether or not unloaded fields should be closed.
      • writeDetached

        public boolean writeDetached​(java.io.ObjectOutput out)
                              throws java.io.IOException
        Description copied from interface: StateManager
        Write detached state object and detached state manager to the given stream.
        Specified by:
        writeDetached in interface StateManager
        Returns:
        true if managed fields also written to stream
        Throws:
        java.io.IOException
      • proxyDetachedDeserialized

        public void proxyDetachedDeserialized​(int idx)
        Description copied from interface: StateManager
        Proxy the given detached field after deserialization.
        Specified by:
        proxyDetachedDeserialized in interface StateManager
      • isTransactional

        public boolean isTransactional()
        Description copied from interface: StateManager
        Whether the instance is transactional.
        Specified by:
        isTransactional in interface StateManager
      • isPendingTransactional

        public boolean isPendingTransactional()
      • isPersistent

        public boolean isPersistent()
        Description copied from interface: StateManager
        Whether the instance is persistent.
        Specified by:
        isPersistent in interface StateManager
      • isNew

        public boolean isNew()
        Description copied from interface: StateManager
        Whether the instance is newly-persisted in this transaction.
        Specified by:
        isNew in interface StateManager
      • isDeleted

        public boolean isDeleted()
        Description copied from interface: StateManager
        Whether the instance is deleted in this transaction.
        Specified by:
        isDeleted in interface StateManager
      • isDirty

        public boolean isDirty()
        Description copied from interface: StateManager
        Whether the instance has been modified in this transaction.
        Specified by:
        isDirty in interface StateManager
      • isDetached

        public boolean isDetached()
        Description copied from interface: StateManager
        Whether the instance is detached (i.e. this manager is a detached state manager)
        Specified by:
        isDetached in interface StateManager
      • fetchObjectId

        public java.lang.Object fetchObjectId()
        Description copied from interface: StateManager
        Return the object id, assigning it if necessary.
        Specified by:
        fetchObjectId in interface StateManager
      • getPCPrimaryKey

        public java.lang.Object getPCPrimaryKey​(java.lang.Object oid,
                                                int field)
        Description copied from interface: StateManager
        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.
        Specified by:
        getPCPrimaryKey in interface StateManager
      • replaceFlags

        public byte replaceFlags()
      • isDelayed

        public boolean isDelayed​(int field)
        Description copied from interface: OpenJPAStateManager
        Some 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:
        isDelayed in interface OpenJPAStateManager
        Returns:
        true if the field is setup for delayed access
      • setDelayed

        public void setDelayed​(int field,
                               boolean delay)
        Description copied from interface: OpenJPAStateManager
        Some 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:
        setDelayed in interface OpenJPAStateManager
      • beforeAccessField

        protected void beforeAccessField​(int field)
        Load the given field before access.
      • dirty

        public void dirty​(java.lang.String field)
        Description copied from interface: StateManager
        Make named field dirty.
        Specified by:
        dirty in interface StateManager
      • removed

        public void removed​(int field,
                            java.lang.Object removed,
                            boolean key)
        Description copied from interface: OpenJPAStateManager
        Notification that an element has been removed from the given field.
        Specified by:
        removed in interface OpenJPAStateManager
      • fetchBooleanField

        public boolean fetchBooleanField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchBooleanField in interface FieldSupplier
      • fetchByteField

        public byte fetchByteField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchByteField in interface FieldSupplier
      • fetchCharField

        public char fetchCharField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchCharField in interface FieldSupplier
      • fetchDoubleField

        public double fetchDoubleField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchDoubleField in interface FieldSupplier
      • fetchFloatField

        public float fetchFloatField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchFloatField in interface FieldSupplier
      • fetchIntField

        public int fetchIntField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchIntField in interface FieldSupplier
      • fetchLongField

        public long fetchLongField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchLongField in interface FieldSupplier
      • fetchShortField

        public short fetchShortField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchShortField in interface FieldSupplier
      • fetchStringField

        public java.lang.String fetchStringField​(int field)
        Description copied from interface: FieldSupplier
        Return the value of the given field.
        Specified by:
        fetchStringField in interface FieldSupplier
      • storeBoolean

        public void storeBoolean​(int field,
                                 boolean externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeBoolean in interface OpenJPAStateManager
      • storeBooleanField

        public void storeBooleanField​(int field,
                                      boolean curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeBooleanField in interface FieldConsumer
      • storeByte

        public void storeByte​(int field,
                              byte externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeByte in interface OpenJPAStateManager
      • storeByteField

        public void storeByteField​(int field,
                                   byte curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeByteField in interface FieldConsumer
      • storeChar

        public void storeChar​(int field,
                              char externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeChar in interface OpenJPAStateManager
      • storeCharField

        public void storeCharField​(int field,
                                   char curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeCharField in interface FieldConsumer
      • storeDouble

        public void storeDouble​(int field,
                                double externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeDouble in interface OpenJPAStateManager
      • storeDoubleField

        public void storeDoubleField​(int field,
                                     double curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeDoubleField in interface FieldConsumer
      • storeFloat

        public void storeFloat​(int field,
                               float externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeFloat in interface OpenJPAStateManager
      • storeFloatField

        public void storeFloatField​(int field,
                                    float curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeFloatField in interface FieldConsumer
      • storeInt

        public void storeInt​(int field,
                             int externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeInt in interface OpenJPAStateManager
      • storeIntField

        public void storeIntField​(int field,
                                  int curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeIntField in interface FieldConsumer
      • storeLong

        public void storeLong​(int field,
                              long externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeLong in interface OpenJPAStateManager
      • storeLongField

        public void storeLongField​(int field,
                                   long curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeLongField in interface FieldConsumer
      • storeObject

        public void storeObject​(int field,
                                java.lang.Object externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeObject in interface OpenJPAStateManager
      • storeObjectField

        public void storeObjectField​(int field,
                                     java.lang.Object curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeObjectField in interface FieldConsumer
      • storeShort

        public void storeShort​(int field,
                               short externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeShort in interface OpenJPAStateManager
      • storeShortField

        public void storeShortField​(int field,
                                    short curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeShortField in interface FieldConsumer
      • storeString

        public void storeString​(int field,
                                java.lang.String externalVal)
        Description copied from interface: OpenJPAStateManager
        Set the given external value back into the given field.
        Specified by:
        storeString in interface OpenJPAStateManager
      • storeStringField

        public void storeStringField​(int field,
                                     java.lang.String curVal)
        Description copied from interface: FieldConsumer
        Set the value of the given field.
        Specified by:
        storeStringField in interface FieldConsumer
      • loadField

        protected void loadField​(int field,
                                 int lockLevel,
                                 boolean forWrite,
                                 boolean fgs)
        Load the given field's fetch group; the field itself may already be loaded if it is being set by the user.
      • setPostLoadCallback

        public void setPostLoadCallback​(boolean enabled)
        Set to false to prevent the postLoad method from sending lifecycle callback events.
      • translate

        protected java.lang.RuntimeException translate​(java.lang.RuntimeException re)
        Translate the given exception based on the broker's implicit behavior. Translation only occurs if the exception is initiated by a user action on an instance, and therefore will not be caught and translated by the broker.
      • lock

        protected void lock()
        Lock the state manager if the multithreaded option is set.
      • unlock

        protected void unlock()
        Unlock the state manager.
      • getMappedByIdFields

        public java.util.List<FieldMetaData> getMappedByIdFields()
      • requiresFetch

        public boolean requiresFetch​(FieldMetaData fmd)
      • setBroker

        public void setBroker​(BrokerImpl ctx)
      • getFlushed

        public java.util.BitSet getFlushed()
        Description copied from interface: OpenJPAStateManager
        Return a read-only mask of the indexes of all fields that have been flushed since they were last changed.
        Specified by:
        getFlushed in interface OpenJPAStateManager
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object