Class StateManagerFactoryImpl

    • Field Detail

      • STATE_MANAGER_CTR_ARG_CLASSES

        public static final Class[] STATE_MANAGER_CTR_ARG_CLASSES
    • Method Detail

      • newForHollow

        public <T> DNStateManager<T> newForHollow​(ExecutionContext ec,
                                                  Class<T> pcClass,
                                                  Object id)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a hollow instance having the given object ID. This constructor is used for creating new instances of existing persistent objects.
        Specified by:
        newForHollow in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - the ExecutionContext
        pcClass - the class of the new instance to be created.
        id - the identity of the object.
        Returns:
        StateManager
      • newForHollow

        public <T> DNStateManager<T> newForHollow​(ExecutionContext ec,
                                                  Class<T> pcClass,
                                                  Object id,
                                                  FieldValues fv)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a recently populated hollow instance having the given object ID and the given field values. This constructor is used for creating new instances of persistent objects obtained e.g. via a Query or backed by a view.
        Specified by:
        newForHollow in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pcClass - the class of the new instance to be created.
        id - the identity of the object.
        fv - the initial field values of the object.
        Returns:
        StateManager
      • newForHollowPreConstructed

        public <T> DNStateManager<T> newForHollowPreConstructed​(ExecutionContext ec,
                                                                Object id,
                                                                T pc)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a hollow instance having the given object ID. The instance is already supplied.
        Specified by:
        newForHollowPreConstructed in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        id - the identity of the object.
        pc - The object that is hollow that we are going to manage
        Returns:
        StateManager
      • newForHollowPopulatedAppId

        @Deprecated
        public <T> DNStateManager<T> newForHollowPopulatedAppId​(ExecutionContext ec,
                                                                Class<T> pcClass,
                                                                FieldValues fv)
        Deprecated.
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a hollow (or pclean) instance having the given FieldValues. This constructor is used for creating new instances of existing persistent objects using application identity.
        Specified by:
        newForHollowPopulatedAppId in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pcClass - the class of the new instance to be created.
        fv - the initial field values of the object.
        Returns:
        StateManager
      • newForPersistentClean

        public <T> DNStateManager<T> newForPersistentClean​(ExecutionContext ec,
                                                           Object id,
                                                           T pc)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage the specified persistent instance having the given object ID.
        Specified by:
        newForPersistentClean in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - the execution context controlling this state manager.
        id - the identity of the object.
        pc - The object that is persistent that we are going to manage
        Returns:
        StateManager
      • newForEmbedded

        public <T> DNStateManager<T> newForEmbedded​(ExecutionContext ec,
                                                    T pc,
                                                    boolean copyPc,
                                                    DNStateManager ownerSM,
                                                    int ownerMemberNumber,
                                                    PersistableObjectType objectType)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a persistable instance that will be EMBEDDED/SERIALISED into another persistable object. The instance will not be assigned an identity in the process since it is a SCO.
        Specified by:
        newForEmbedded in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - The persistable to manage (see copyPc also)
        copyPc - Whether the SM should manage a copy of the passed PC or that one
        ownerSM - Owner StateManager
        ownerMemberNumber - Member number in owner object where this is stored
        objectType - Component within the member where this is stored
        Returns:
        StateManager
      • newForEmbedded

        public DNStateManager newForEmbedded​(ExecutionContext ec,
                                             AbstractClassMetaData cmd,
                                             DNStateManager ownerSM,
                                             int ownerMemberNumber,
                                             PersistableObjectType objectType)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager for an object of the specified type, creating the PC object to hold the values where this object will be EMBEDDED/SERIALISED into another persistable object. The instance will not be assigned an identity in the process since it is a SCO.
        Specified by:
        newForEmbedded in interface StateManagerFactory
        Parameters:
        ec - ExecutionContext
        cmd - Meta-data for the class that this is an instance of.
        ownerSM - Owner StateManager
        ownerMemberNumber - Member number in owner object where this is stored
        objectType - Component within the member where this is stored
        Returns:
        StateManager
      • newForPersistentNew

        public <T> DNStateManager<T> newForPersistentNew​(ExecutionContext ec,
                                                         T pc,
                                                         FieldValues preInsertChanges)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a transient instance that is becoming newly persistent. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store. This constructor is used for assigning state managers to existing instances that are transitioning to a persistent state.
        Specified by:
        newForPersistentNew in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        preInsertChanges - Any changes to make before inserting
        Returns:
        StateManager
      • newForTransactionalTransient

        public <T> DNStateManager<T> newForTransactionalTransient​(ExecutionContext ec,
                                                                  T pc)
        Description copied from interface: StateManagerFactory
        Constructs a StateManager to manage a transactional-transient instance. A new object ID for the instance is obtained from the store manager and the object is inserted in the data store. This constructor is used for assigning state managers to transient instances that are transitioning to a transient clean state.
        Specified by:
        newForTransactionalTransient in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the instance being make persistent.
        Returns:
        StateManager
      • newForDetached

        public <T> DNStateManager<T> newForDetached​(ExecutionContext ec,
                                                    T pc,
                                                    Object id,
                                                    Object version)
        Description copied from interface: StateManagerFactory
        Constructor for creating StateManager instances to manage persistable objects in detached state.
        Specified by:
        newForDetached in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        pc - the detached object
        id - the identity of the object.
        version - the detached version
        Returns:
        StateManager
      • newForPNewToBeDeleted

        public <T> DNStateManager<T> newForPNewToBeDeleted​(ExecutionContext ec,
                                                           T pc)
        Description copied from interface: StateManagerFactory
        Constructor for creating StateManager instances to manage persistable objects that are not persistent yet are about to be deleted. Consequently the initial lifecycle state will be P_NEW, but will soon move to P_NEW_DELETED.
        Specified by:
        newForPNewToBeDeleted in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - Execution Context
        pc - the object being deleted from persistence
        Returns:
        StateManager
      • newForCachedPC

        public <T> DNStateManager<T> newForCachedPC​(ExecutionContext ec,
                                                    Object id,
                                                    CachedPC cachedPC)
        Description copied from interface: StateManagerFactory
        Constructor to create a StateManager for an object taken from the L2 cache with the specified id. Makes a copy of the cached object, assigns a StateManager to it, and copies across the fields that were loaded when cached.
        Specified by:
        newForCachedPC in interface StateManagerFactory
        Type Parameters:
        T - Type of the persistable class
        Parameters:
        ec - ExecutionContext
        id - Id to assign to the persistable object
        cachedPC - CachedPC object from the L2 cache
        Returns:
        StateManager