Class AbstractPersistentOperation<T extends org.tentackle.pdo.Operation<T>,​P extends AbstractPersistentOperation<T,​P>>

  • Type Parameters:
    T - the PO class (interface)
    P - the operation implementation class
    All Implemented Interfaces:
    java.io.Serializable, org.tentackle.pdo.DomainContextDependable, org.tentackle.pdo.DomainContextProvider, org.tentackle.pdo.OperationMethodCacheProvider<T>, org.tentackle.pdo.OperationProvider<T>, org.tentackle.pdo.PersistenceDelegate<T>, org.tentackle.pdo.PersistentOperation<T>, org.tentackle.pdo.ProxyDelegate<T>, org.tentackle.reflect.EffectiveClassProvider<T>, org.tentackle.reflect.Interceptable, org.tentackle.session.SessionDependable, org.tentackle.session.SessionProvider

    public abstract class AbstractPersistentOperation<T extends org.tentackle.pdo.Operation<T>,​P extends AbstractPersistentOperation<T,​P>>
    extends org.tentackle.dbms.AbstractDbOperation<P>
    implements org.tentackle.pdo.PersistenceDelegate<T>, org.tentackle.pdo.PersistentOperation<T>, org.tentackle.reflect.EffectiveClassProvider<T>, org.tentackle.pdo.OperationMethodCacheProvider<T>
    A AbstractPersistentOperation provides methods that are not part of PersistentOperations and is associated to a DomainContext. Complex transactions are usually AbstractPersistentOperations. AbstractPersistentOperations are remote capabable.
    Author:
    harald
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractPersistentOperation

        public AbstractPersistentOperation​(T operation,
                                           org.tentackle.pdo.DomainContext context)
        Creates an operation object.
        Parameters:
        operation - the operation object this is a delegate for
        context - the database context
      • AbstractPersistentOperation

        public AbstractPersistentOperation​(T operation,
                                           org.tentackle.session.Session session)
        Creates an operation object without a domain context for a given connection.

        Note: the application must set the context.

        Parameters:
        operation - the operation object this is a delegate for
        session - the session (must be an instance of Session).
      • AbstractPersistentOperation

        public AbstractPersistentOperation​(T operation)
        Creates an operation object without a database context.

        Note: the application must set the context.

        Parameters:
        operation - the persistent operation object this is a delegate for
      • AbstractPersistentOperation

        public AbstractPersistentOperation()
        Creates an operation object without a database context.
    • Method Detail

      • getDomainDelegate

        public org.tentackle.pdo.DomainDelegate<T> getDomainDelegate()
        Specified by:
        getDomainDelegate in interface org.tentackle.pdo.PersistenceDelegate<T extends org.tentackle.pdo.Operation<T>>
      • getEffectiveClass

        public java.lang.Class<T> getEffectiveClass()
        Specified by:
        getEffectiveClass in interface org.tentackle.reflect.EffectiveClassProvider<T extends org.tentackle.pdo.Operation<T>>
      • getEffectiveSuperClasses

        public java.util.List<java.lang.Class<? super T>> getEffectiveSuperClasses()
        Specified by:
        getEffectiveSuperClasses in interface org.tentackle.reflect.EffectiveClassProvider<T extends org.tentackle.pdo.Operation<T>>
      • getOperationMethodCache

        public org.tentackle.pdo.OperationMethodCache<T> getOperationMethodCache()
        Specified by:
        getOperationMethodCache in interface org.tentackle.pdo.OperationMethodCacheProvider<T extends org.tentackle.pdo.Operation<T>>
      • setSession

        public void setSession​(org.tentackle.session.Session session)

        Overridden to set the Db in DomainContext as well.

        Specified by:
        setSession in interface org.tentackle.session.SessionDependable
        Overrides:
        setSession in class org.tentackle.dbms.AbstractDbOperation<P extends AbstractPersistentOperation<T,​P>>
      • setDomainContext

        public void setDomainContext​(org.tentackle.pdo.DomainContext context)
        Sets the database context.
        Specified by:
        setDomainContext in interface org.tentackle.pdo.DomainContextDependable
        Parameters:
        context - the domain context
      • getDomainContext

        public org.tentackle.pdo.DomainContext getDomainContext()
        Gets the database context.
        Specified by:
        getDomainContext in interface org.tentackle.pdo.DomainContextProvider
        Returns:
        the domain context
      • me

        public T me()
        Specified by:
        me in interface org.tentackle.pdo.ProxyDelegate<T extends org.tentackle.pdo.Operation<T>>
      • getOperation

        public T getOperation()
        Specified by:
        getOperation in interface org.tentackle.pdo.OperationProvider<T extends org.tentackle.pdo.Operation<T>>
      • setOperation

        public void setOperation​(T operation)
        Sets the operation.
        Parameters:
        operation - the operation
      • determineContextId

        public void determineContextId()

        The default implementation does nothing (object living in a context not depending on another object).

        Specified by:
        determineContextId in interface org.tentackle.pdo.DomainContextDependable
      • getContextId

        public long getContextId()

        The default implementation returns -1.

        Specified by:
        getContextId in interface org.tentackle.pdo.DomainContextDependable
      • getBaseContext

        public org.tentackle.pdo.DomainContext getBaseContext()

        The default implementation returns the PDO's DomainContext.

        Specified by:
        getBaseContext in interface org.tentackle.pdo.DomainContextDependable
      • createValidContext

        public org.tentackle.pdo.DomainContext createValidContext()

        The default implementation just returns a new DomainContext.

        Specified by:
        createValidContext in interface org.tentackle.pdo.DomainContextDependable
      • isDomainContextImmutable

        public boolean isDomainContextImmutable()
        Returns whether the domain context is immutable.
        Specified by:
        isDomainContextImmutable in interface org.tentackle.pdo.DomainContextDependable
        Returns:
        true if context cannot be changed
      • setDomainContextImmutable

        public void setDomainContextImmutable​(boolean contextImmutable)
        Sets the immutable flag of the domain context.
        Specified by:
        setDomainContextImmutable in interface org.tentackle.pdo.DomainContextDependable
        Parameters:
        contextImmutable - true if context cannot be changed
      • assertDomainContextMutable

        protected void assertDomainContextMutable()
        Asserts that the domain context is mutable.