java.lang.Object
org.tentackle.dbms.ModificationTally
Counter to track modifications for a class/table.
The ModificationTracker maintains a list of ModificationTally-objects, one for each tracked name.
The ModificationTracker maintains a list of ModificationTally-objects, one for each tracked name.
- Author:
- harald
-
Constructor Summary
ConstructorDescriptionModificationTally
(DbModificationTracker tracker, String trackedName) Creates a modification counter for a given tracked name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds this counter to the modification table.void
countPending
(Session session) Adds a pending count.Gets the modification PO.long
getId()
Gets the ID of the counter.long
Gets the latest serial updated by this counter.long
Get the current modification count by tablename.long
Gets the pending count.void
Performs the physical pending count if pending count > 0.void
setLastSerial
(long lastSerial) Sets the last serial.
-
Constructor Details
-
ModificationTally
Creates a modification counter for a given tracked name.- Parameters:
tracker
- the modification trackertrackedName
- the tracked name
-
-
Method Details
-
getDbModification
Gets the modification PO.- Returns:
- the modification PO
-
getId
public long getId()Gets the ID of the counter.- Returns:
- the unique id
-
countPending
Adds a pending count.- Parameters:
session
- the session persisting the modification, null if thread-local session
-
getPendingCount
public long getPendingCount()Gets the pending count.- Returns:
- the pending count, 0 if none
-
setLastSerial
public void setLastSerial(long lastSerial) Sets the last serial.- Parameters:
lastSerial
- the serial
-
getLatestSerial
public long getLatestSerial()Gets the latest serial updated by this counter.- Returns:
- the latest serial from last update plus pending count
-
performPendingCount
public void performPendingCount()Performs the physical pending count if pending count > 0. -
addToModificationTable
public void addToModificationTable()Adds this counter to the modification table. -
getModificationCount
public long getModificationCount()Get the current modification count by tablename.- Returns:
- the modification count
-