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>
A
AbstractPersistentOperation provides methods that are not part of PersistentOperations
and is associated to a DomainContext. Complex transactions are usually
AbstractPersistentOperations. AbstractPersistentOperations are remote capable.- Author:
- harald
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 session.
Notice: the application must set the domain context. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAsserts that the domain context is mutable.<X extends PersistentDomainObject<X>>
voidconfigureRemoteObject(DomainContext context, X pdo) Configures a within an operation remotely retrieved PDO.<X extends PersistentDomainObject<X>>
voidconfigureRemoteObjects(DomainContext context, Collection<X> pdos) Configures a within an operation remotely retrieved collection of PDOs.voidlongGets the database context.booleanReturns whether the domain context is immutable.me()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, setSessionImmutableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.pdo.DomainContextProvider
on, on, op, opMethods inherited from interface org.tentackle.pdo.OperationProvider
opMethods inherited from interface org.tentackle.session.SessionDependable
isSessionImmutable, setSessionImmutableMethods inherited from interface org.tentackle.session.SessionProvider
getSession
-
Constructor Details
-
AbstractPersistentOperation
Creates an operation object.- Parameters:
operation- the operation object this is a delegate forcontext- the database context
-
AbstractPersistentOperation
Creates an operation object without a domain context for a given session.
Notice: the application must set the domain context.- Parameters:
operation- the operation object this is a delegate forsession- the session (must be an instance ofDb).
-
AbstractPersistentOperation
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 Details
-
getDomainDelegate
- Specified by:
getDomainDelegatein interfacePersistenceDelegate<T extends Operation<T>>
-
getEffectiveClass
-
getEffectiveSuperClasses
-
getClassVariables
In fact,
PersistentOperationClassVariablesis an extension ofDbOperationClassVariables. So this fulfills the requirements for AbstractDbObject- Overrides:
getClassVariablesin classAbstractDbOperation<P extends AbstractPersistentOperation<T,P>>
-
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
Sets the database context.- Specified by:
setDomainContextin interfaceDomainContextDependable- Parameters:
context- the domain context
-
getDomainContext
Gets the database context.- Specified by:
getDomainContextin interfaceDomainContextProvider- Returns:
- the domain context
-
me
- Specified by:
mein interfaceProxyDelegate<T extends Operation<T>>
-
getOperation
- Specified by:
getOperationin interfaceOperationProvider<T extends Operation<T>>
-
setOperation
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
The default implementation returns the PDO's DomainContext.
- Specified by:
getBaseContextin interfaceDomainContextDependable
-
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
-
configureRemoteObject
public <X extends PersistentDomainObject<X>> void configureRemoteObject(DomainContext context, X pdo) Configures a within an operation remotely retrieved PDO.- Parameters:
context- the local domain contextpdo- the PDO
-
configureRemoteObjects
public <X extends PersistentDomainObject<X>> void configureRemoteObjects(DomainContext context, Collection<X> pdos) Configures a within an operation remotely retrieved collection of PDOs.- Parameters:
context- the local domain contextpdos- the PDOs to configure
-
assertDomainContextMutable
protected void assertDomainContextMutable()Asserts that the domain context is mutable.
-