Module org.tentackle.persistence
Package org.tentackle.persist
Class AbstractPersistentOperation<T extends org.tentackle.pdo.Operation<T>,P extends AbstractPersistentOperation<T,P>>
- java.lang.Object
-
- org.tentackle.dbms.AbstractDbOperation<P>
-
- org.tentackle.persist.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>AAbstractPersistentOperationprovides methods that are not part ofPersistentOperations and is associated to aDomainContext. Complex transactions are usuallyAbstractPersistentOperations.AbstractPersistentOperations are remote capabable.- Author:
- harald
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPersistentOperation()Creates an operation object without a database context.AbstractPersistentOperation(T operation)Creates an operation object without a database context.AbstractPersistentOperation(T operation, org.tentackle.pdo.DomainContext context)Creates an operation object.AbstractPersistentOperation(T operation, org.tentackle.session.Session session)Creates an operation object without a domain context for a given connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertDomainContextMutable()Asserts that the domain context is mutable.org.tentackle.pdo.DomainContextcreateValidContext()voiddetermineContextId()org.tentackle.pdo.DomainContextgetBaseContext()PersistentOperationClassVariables<T,P>getClassVariables()longgetContextId()org.tentackle.pdo.DomainContextgetDomainContext()Gets the database context.org.tentackle.pdo.DomainDelegate<T>getDomainDelegate()java.lang.Class<T>getEffectiveClass()java.util.List<java.lang.Class<? super T>>getEffectiveSuperClasses()TgetOperation()org.tentackle.pdo.OperationMethodCache<T>getOperationMethodCache()booleanisDomainContextImmutable()Returns whether the domain context is immutable.Tme()voidsetDomainContext(org.tentackle.pdo.DomainContext context)Sets the database context.voidsetDomainContextImmutable(boolean contextImmutable)Sets the immutable flag of the domain context.voidsetOperation(T operation)Sets the operation.voidsetSession(org.tentackle.session.Session session)-
Methods inherited from class org.tentackle.dbms.AbstractDbOperation
getRemoteDelegate, getSession, getSessionHolder, isSessionImmutable, setSessionHolder, setSessionImmutable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
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 forcontext- 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 forsession- the session (must be an instance ofSession).
-
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()
-
getEffectiveClass
public java.lang.Class<T> getEffectiveClass()
-
getEffectiveSuperClasses
public java.util.List<java.lang.Class<? super T>> getEffectiveSuperClasses()
-
getClassVariables
public PersistentOperationClassVariables<T,P> getClassVariables()
In fact,
PersistentOperationClassVariablesis an extension ofDbOperationClassVariables. So this fullfills the requirements for AbstractDbObject- Overrides:
getClassVariablesin classorg.tentackle.dbms.AbstractDbOperation<P extends AbstractPersistentOperation<T,P>>
-
getOperationMethodCache
public org.tentackle.pdo.OperationMethodCache<T> getOperationMethodCache()
-
setSession
public void setSession(org.tentackle.session.Session session)
Overridden to set the Db in DomainContext as well.
- Specified by:
setSessionin interfaceorg.tentackle.session.SessionDependable- Overrides:
setSessionin classorg.tentackle.dbms.AbstractDbOperation<P extends AbstractPersistentOperation<T,P>>
-
setDomainContext
public void setDomainContext(org.tentackle.pdo.DomainContext context)
Sets the database context.- Specified by:
setDomainContextin interfaceorg.tentackle.pdo.DomainContextDependable- Parameters:
context- the domain context
-
getDomainContext
public org.tentackle.pdo.DomainContext getDomainContext()
Gets the database context.- Specified by:
getDomainContextin interfaceorg.tentackle.pdo.DomainContextProvider- Returns:
- the domain context
-
me
public T me()
-
getOperation
public T getOperation()
-
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:
determineContextIdin interfaceorg.tentackle.pdo.DomainContextDependable
-
getContextId
public long getContextId()
The default implementation returns -1.
- Specified by:
getContextIdin interfaceorg.tentackle.pdo.DomainContextDependable
-
getBaseContext
public org.tentackle.pdo.DomainContext getBaseContext()
The default implementation returns the PDO's DomainContext.
- Specified by:
getBaseContextin interfaceorg.tentackle.pdo.DomainContextDependable
-
createValidContext
public org.tentackle.pdo.DomainContext createValidContext()
The default implementation just returns a new
DomainContext.- Specified by:
createValidContextin interfaceorg.tentackle.pdo.DomainContextDependable
-
isDomainContextImmutable
public boolean isDomainContextImmutable()
Returns whether the domain context is immutable.- Specified by:
isDomainContextImmutablein interfaceorg.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:
setDomainContextImmutablein interfaceorg.tentackle.pdo.DomainContextDependable- Parameters:
contextImmutable- true if context cannot be changed
-
assertDomainContextMutable
protected void assertDomainContextMutable()
Asserts that the domain context is mutable.
-
-