Class AbstractPersistentObjectRemoteDelegateImpl<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>>
java.lang.Object
org.tentackle.dbms.trip.RemoteDbDelegateImpl<P>
org.tentackle.dbms.trip.AbstractDbObjectRemoteDelegateImpl<P>
org.tentackle.persist.trip.AbstractPersistentObjectRemoteDelegateImpl<T,P>
- Type Parameters:
T- thePersistentDomainObjectclassP- theAbstractPersistentObjectclass (persistence implementation)
- All Implemented Interfaces:
AbstractDbObjectRemoteDelegate<P>, RemoteDbDelegate, AbstractPersistentObjectRemoteDelegate<T,P>, org.tentackle.trip.Remote
- Direct Known Subclasses:
NumberPoolRemoteDelegateImpl, NumberRangeRemoteDelegateImpl, SecurityRemoteDelegateImpl
public class AbstractPersistentObjectRemoteDelegateImpl<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>>
extends AbstractDbObjectRemoteDelegateImpl<P>
implements AbstractPersistentObjectRemoteDelegate<T,P>
Implementation of the remote delegate for
Executes the persistence methods on the server. The low-level methods inherited from the database layer are disabled to protect against malicious clients.
AbstractPersistentObject.Executes the persistence methods on the server. The low-level methods inherited from the database layer are disabled to protect against malicious clients.
- Author:
- harald
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TPDO with a default domain context associated with the delegate's session.The PDO interface class.Fields inherited from class AbstractDbObjectRemoteDelegateImpl
dbObject -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPersistentObjectRemoteDelegateImpl(RemoteDbSessionImpl serverSession, Class<P> persistenceClass, Class<T> pdoClass) Creates a delegate for the given TRIP session. -
Method Summary
Modifier and TypeMethodDescriptioncreateRemoteResultSetCursorDelegate(org.tentackle.misc.ScrollableResource<T> cursor) Creates and exports a remote cursor delegate for a local cursor.longdeleteImpl(T obj) Deletes a PDO.deleteObject(P obj) voiddeletePlain(long id, long serial) voiddummyUpdate(P obj) protected PgetPersistenceDelegate(T pDo) Gets the persistence delegate from a PDO.voidinsertObject(P obj) voidinsertPlain(P obj) booleanisReferenced(long id) booleanisReferenced(DomainContext context, long id) Checks whether a PDO is referenced by other PDOs.protected TnewInstance(DomainContext context) Creates a new PDO instance of the required class for methods that return a new object.protected TnewInstance(DomainContext context, long id) Selects by ID into a new instance.persistImpl(T obj) Persists a PDO.persistObject(P obj) longSaves a PDO.saveObject(P obj) select(DomainContext context, long id, boolean forUpdate, boolean tokenLocked) Selects a PDO by its ID.selectAll(DomainContext context) Selects all PDOs.selectAllAsCursor(DomainContext context) Selects all PDOs as a cursor.selectAllForCache(DomainContext context) Selects all PDOs via the server's cache, if any.List<org.tentackle.misc.IdSerialTuple> selectAllWithExpiredTableSerials(DomainContext context, long oldSerial) Selects all PDOs with a table serial greater than the given serial.selectAllWithExpiredTableSerials(DomainContext context, long oldSerial, long maxSerial) Selects all PDOs with a table serial within a given range.selectAny(DomainContext context, Collection<Long> ids) Selects all PDOs with the given IDs.selectAnyForCache(DomainContext context, Collection<Long> ids) Selects all PDOs with the given IDs via the server's cache, if any.selectByNormText(DomainContext context, String normText) Selects all PDOs matching a normtext.selectByNormTextAsCursor(DomainContext context, String normText) Selects all PDOs matching a normtext as a cursor.selectForCache(DomainContext context, long id) Selects a PDO via the server's cache, if any.selectLatest(DomainContext context, long greaterId, int limit) Selects the latest PDOs.selectObject(long id) selectObjectForUpdate(long id) selectTokenLocked(DomainContext context, long id) Selects a PDO by its ID and requests a token lock.protected voidsetDomainContext(DomainContext context) Sets the domain context in the default object.transferTokenLock(T pdo, long userId) Transfers a token lock to another user.voidupdateAndSetSerial(long id, long serial) updateObject(P obj) voidupdatePlain(P obj) voidupdateSerial(long id, long serial) voidupdateSerialAndTableSerial(long id, long serial, long tableSerial) updateTokenLock(DomainContext context, long id, org.tentackle.common.Timestamp tokenExpiry, long userId, org.tentackle.common.Timestamp curTime) Requests or releases a token lock.voidupdateTokenLockOnly(DomainContext context, long id, long editedBy, org.tentackle.common.Timestamp editedSince, org.tentackle.common.Timestamp editedExpiry) Updates the token lock columns only.Methods inherited from class AbstractDbObjectRemoteDelegateImpl
countModification, getExpiredTableSerials, newInstance, obtainReservedId, selectExpiredTableSerials, selectExpiredTableSerials, selectMaxId, selectMaxTableSerial, selectObjectsWithExpiredTableSerials, selectSerial, validateMethods inherited from class RemoteDbDelegateImpl
getServerSession, getServicedClass, getSession, toString
-
Field Details
-
pdoClass
The PDO interface class. -
pdo
PDO with a default domain context associated with the delegate's session.
-
-
Constructor Details
-
AbstractPersistentObjectRemoteDelegateImpl
public AbstractPersistentObjectRemoteDelegateImpl(RemoteDbSessionImpl serverSession, Class<P> persistenceClass, Class<T> pdoClass) Creates a delegate for the given TRIP session.- Parameters:
serverSession- the TRIP sessionpersistenceClass- the subclass of AbstractPersistentObjectpdoClass- the PDO class (interface)
-
-
Method Details
-
initialize
public void initialize()- Overrides:
initializein classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
newInstance
Creates a new PDO instance of the required class for methods that return a new object.- Parameters:
context- the domain context- Returns:
- the new pdo
-
newInstance
Selects by ID into a new instance.- Parameters:
context- the domain contextid- the ID- Returns:
- the PDO, never null
- Throws:
org.tentackle.session.NotFoundException- if no such PDO in database
-
getPersistenceDelegate
-
setDomainContext
Sets the domain context in the default object.- Parameters:
context- the domain context
-
selectObject
- Specified by:
selectObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
selectObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
selectObjectForUpdate
- Specified by:
selectObjectForUpdatein interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
selectObjectForUpdatein classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
selectAllObjects
- Specified by:
selectAllObjectsin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
selectAllObjectsin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
dummyUpdate
- Specified by:
dummyUpdatein interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
dummyUpdatein classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
updateSerial
public void updateSerial(long id, long serial) - Specified by:
updateSerialin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
updateSerialin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
updateAndSetSerial
public void updateAndSetSerial(long id, long serial) - Specified by:
updateAndSetSerialin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
updateAndSetSerialin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
updateSerialAndTableSerial
public void updateSerialAndTableSerial(long id, long serial, long tableSerial) - Specified by:
updateSerialAndTableSerialin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
updateSerialAndTableSerialin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
updatePlain
- Specified by:
updatePlainin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
updatePlainin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
deletePlain
public void deletePlain(long id, long serial) - Specified by:
deletePlainin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
deletePlainin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
insertPlain
- Specified by:
insertPlainin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
insertPlainin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
updateObject
- Specified by:
updateObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
updateObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
insertObject
- Specified by:
insertObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
insertObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
deleteObject
- Specified by:
deleteObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
deleteObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
persistObject
- Specified by:
persistObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
persistObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
saveObject
- Specified by:
saveObjectin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
saveObjectin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
isReferenced
public boolean isReferenced(long id) - Specified by:
isReferencedin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
isReferencedin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
selectAllIdSerial
- Specified by:
selectAllIdSerialin interfaceAbstractDbObjectRemoteDelegate<T extends PersistentDomainObject<T>>- Overrides:
selectAllIdSerialin classAbstractDbObjectRemoteDelegateImpl<P extends AbstractPersistentObject<T,P>>
-
persistImpl
Description copied from interface:AbstractPersistentObjectRemoteDelegatePersists a PDO.- Specified by:
persistImplin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
obj- the PDO- Returns:
- the persisted PDO
- See Also:
-
saveImpl
Description copied from interface:AbstractPersistentObjectRemoteDelegateSaves a PDO.- Specified by:
saveImplin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
obj- the PDO- Returns:
- the table serial
- See Also:
-
deleteImpl
Description copied from interface:AbstractPersistentObjectRemoteDelegateDeletes a PDO.- Specified by:
deleteImplin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
obj- the PDO- Returns:
- the table serial
- See Also:
-
selectAll
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs.- Specified by:
selectAllin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain context- Returns:
- the PDOs
- See Also:
-
selectAny
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs with the given IDs.- Specified by:
selectAnyin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextids- the object IDs- Returns:
- the PDOs
- See Also:
-
select
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects a PDO by its ID.- Specified by:
selectin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object IDforUpdate- true if select FOR UPDATEtokenLocked- true if request a token lock as well- Returns:
- the PDO, null if no such PDO
- See Also:
-
selectTokenLocked
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects a PDO by its ID and requests a token lock.- Specified by:
selectTokenLockedin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object ID- Returns:
- the PDO, null if no such PDO
- See Also:
-
selectByNormText
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs matching a normtext.- Specified by:
selectByNormTextin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextnormText- the normtext to search for- Returns:
- the PDOs
- See Also:
-
selectByNormTextAsCursor
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs matching a normtext as a cursor.- Specified by:
selectByNormTextAsCursorin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextnormText- the normtext to search for- Returns:
- the remote cursor
- See Also:
-
selectLatest
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects the latest PDOs.- Specified by:
selectLatestin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextgreaterId- the ID the PDOs must be greater thanlimit- the maximum number of PDOs- Returns:
- the PDOs
- See Also:
-
selectAllForCache
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs via the server's cache, if any.- Specified by:
selectAllForCachein interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain context- Returns:
- the PDOs
- See Also:
-
selectAnyForCache
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs with the given IDs via the server's cache, if any.- Specified by:
selectAnyForCachein interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextids- the object IDs- Returns:
- the PDOs
- See Also:
-
selectForCache
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects a PDO via the server's cache, if any.- Specified by:
selectForCachein interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object ID- Returns:
- the PDO, null if no such PDO
- See Also:
-
selectAllAsCursor
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs as a cursor.- Specified by:
selectAllAsCursorin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain context- Returns:
- the remote cursor
- See Also:
-
selectAllWithExpiredTableSerials
Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs with a table serial greater than the given serial.- Specified by:
selectAllWithExpiredTableSerialsin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextoldSerial- the last known table serial- Returns:
- the PDOs
- See Also:
-
selectAllWithExpiredTableSerials
public List<T> selectAllWithExpiredTableSerials(DomainContext context, long oldSerial, long maxSerial) Description copied from interface:AbstractPersistentObjectRemoteDelegateSelects all PDOs with a table serial within a given range.- Specified by:
selectAllWithExpiredTableSerialsin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextoldSerial- the last known table serial (exclusive)maxSerial- the maximum table serial (inclusive)- Returns:
- the PDOs
- See Also:
-
isReferenced
Description copied from interface:AbstractPersistentObjectRemoteDelegateChecks whether a PDO is referenced by other PDOs.- Specified by:
isReferencedin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object ID- Returns:
- true if the PDO exists and is referenced
- See Also:
-
updateTokenLock
public TokenLockInfo updateTokenLock(DomainContext context, long id, org.tentackle.common.Timestamp tokenExpiry, long userId, org.tentackle.common.Timestamp curTime) Description copied from interface:AbstractPersistentObjectRemoteDelegateRequests or releases a token lock.- Specified by:
updateTokenLockin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object IDtokenExpiry- the time when the token will expire, null to release the lockuserId- the user ID of the current usercurTime- the current time- Returns:
- the token lock attributes after the update
- See Also:
-
transferTokenLock
Description copied from interface:AbstractPersistentObjectRemoteDelegateTransfers a token lock to another user.- Specified by:
transferTokenLockin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
pdo- the PDOuserId- the user ID of the new token holder, 0 to clear the token- Returns:
- the PDO with the updated token lock attributes
- See Also:
-
updateTokenLockOnly
public void updateTokenLockOnly(DomainContext context, long id, long editedBy, org.tentackle.common.Timestamp editedSince, org.tentackle.common.Timestamp editedExpiry) Description copied from interface:AbstractPersistentObjectRemoteDelegateUpdates the token lock columns only.- Specified by:
updateTokenLockOnlyin interfaceAbstractPersistentObjectRemoteDelegate<T extends PersistentDomainObject<T>, P extends AbstractPersistentObject<T,P>> - Parameters:
context- the domain contextid- the object IDeditedBy- the user ID of the token holder, 0 if unlockededitedSince- the time when editing startededitedExpiry- the time when the token will expire- See Also:
-
createRemoteResultSetCursorDelegate
public RemoteResultSetCursor<T> createRemoteResultSetCursorDelegate(org.tentackle.misc.ScrollableResource<T> cursor) Creates and exports a remote cursor delegate for a local cursor.- Parameters:
cursor- the local cursor- Returns:
- the remote cursor delegate
-