Module org.tentackle.persistence
Package org.tentackle.persist
Class AbstractPersistentOperation<T extends 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:
Serializable,DomainContextDependable,DomainContextProvider,OperationMethodCacheProvider<T>,OperationProvider<T>,PersistenceDelegate<T>,PersistentOperation<T>,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 Operation<T>,P extends AbstractPersistentOperation<T,P>> extends AbstractDbOperation<P> implements PersistenceDelegate<T>, PersistentOperation<T>, org.tentackle.reflect.EffectiveClassProvider<T>, 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, 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.DomainContextcreateValidContext()voiddetermineContextId()DomainContextgetBaseContext()PersistentOperationClassVariables<T,P>getClassVariables()longgetContextId()DomainContextgetDomainContext()Gets the database context.DomainDelegate<T>getDomainDelegate()Class<T>getEffectiveClass()List<Class<? super T>>getEffectiveSuperClasses()TgetOperation()OperationMethodCache<T>getOperationMethodCache()booleanisDomainContextImmutable()Returns whether the domain context is immutable.Tme()voidsetDomainContext(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
-
Methods inherited from interface org.tentackle.pdo.DomainContextProvider
on, op
-
Methods inherited from interface org.tentackle.pdo.OperationProvider
op
-
-
-
-
Constructor Detail
-
AbstractPersistentOperation
public AbstractPersistentOperation(T operation, 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 DomainDelegate<T> getDomainDelegate()
- Specified by:
getDomainDelegatein interfacePersistenceDelegate<T extends Operation<T>>
-
getClassVariables
public PersistentOperationClassVariables<T,P> getClassVariables()
In fact,
PersistentOperationClassVariablesis an extension ofDbOperationClassVariables. So this fullfills the requirements for AbstractDbObject- Overrides:
getClassVariablesin classAbstractDbOperation<P extends AbstractPersistentOperation<T,P>>
-
getOperationMethodCache
public OperationMethodCache<T> getOperationMethodCache()
- Specified by:
getOperationMethodCachein interfaceOperationMethodCacheProvider<T extends Operation<T>>
-
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 classAbstractDbOperation<P extends AbstractPersistentOperation<T,P>>
-
setDomainContext
public void setDomainContext(DomainContext context)
Sets the database context.- Specified by:
setDomainContextin interfaceDomainContextDependable- Parameters:
context- the domain context
-
getDomainContext
public DomainContext getDomainContext()
Gets the database context.- Specified by:
getDomainContextin interfaceDomainContextProvider- Returns:
- the domain context
-
getOperation
public T getOperation()
- Specified by:
getOperationin interfaceOperationProvider<T extends 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:
determineContextIdin interfaceDomainContextDependable
-
getContextId
public long getContextId()
The default implementation returns -1.
- Specified by:
getContextIdin interfaceDomainContextDependable
-
getBaseContext
public DomainContext getBaseContext()
The default implementation returns the PDO's DomainContext.
- Specified by:
getBaseContextin interfaceDomainContextDependable
-
createValidContext
public DomainContext createValidContext()
The default implementation just returns a new
DomainContext.- Specified by:
createValidContextin interfaceDomainContextDependable
-
isDomainContextImmutable
public boolean isDomainContextImmutable()
Returns whether the domain context is immutable.- Specified by:
isDomainContextImmutablein interfaceDomainContextDependable- Returns:
- true if context cannot be changed
-
setDomainContextImmutable
public void setDomainContextImmutable(boolean contextImmutable)
Sets the immutable flag of the domain context.- Specified by:
setDomainContextImmutablein interfaceDomainContextDependable- Parameters:
contextImmutable- true if context cannot be changed
-
assertDomainContextMutable
protected void assertDomainContextMutable()
Asserts that the domain context is mutable.
-
-