Class ParentHierarchyListener<P extends ParentChildNode<P>,H extends HierarchyBuilder<H>>
- java.lang.Object
-
- com.activeviam.risk.ref.parentchild.listeners.ParentHierarchyListener<P,H>
-
- All Implemented Interfaces:
com.qfs.store.selection.ISelectionListener
- Direct Known Subclasses:
BookHierarchyListener
,CounterpartyHierarchyListener
,LegalEntityHierarchyListener
public abstract class ParentHierarchyListener<P extends ParentChildNode<P>,H extends HierarchyBuilder<H>> extends Object implements com.qfs.store.selection.ISelectionListener
Listen for changes to a ParentChild store and builds up a corresponding Hierarchy store. Uses a recursive approach to generate the levels for each node in the hierarchy store. First a tuple builder for the specific node type is made for the top most node and level 1 is set to the topmost node. Then for each node that is iterated through that nodes parent clones the tuple builder of its parent and sets a the current nodes level on the cloned tuple builder. Once done there will be a tuple builder for ever node with the correct ancestors for the level parts of the tuple. ex: for a tree that contains a root node with two direct children nodes. | level 1 | level 2 | level 3 | ..other node columns | Node 1 | N/A | N/A | ..some data for node 1 | Node 1 | Node 2 | N/A | ..some data for node 2 | Node 1 | Node 3 | N/A | ..some data for node 3 With 3 tuple builders used to make these rows. Two of the tuple builders were cloned from the root nodes tuple builder.- Author:
- ActiveViam
-
-
Field Summary
Fields Modifier and Type Field Description protected String
hierarchyStoreName
protected static Logger
LOGGER
protected String[]
parentChildFields
protected String
parentChildStoreName
-
Constructor Summary
Constructors Constructor Description ParentHierarchyListener(String parentChildStoreName, String hierarchyStoreName, String[] parentChildFields)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
buildLevels(P node, LocalDate asOfDate, List<Object[]> allTuples)
protected void
buildLevelsRecursively(P node, H tupleBuilder, List<Object[]> allTuples)
abstract P
buildNode(com.qfs.store.record.IRecordReader record)
protected Future<?>
getLatestTask()
void
partitionDropped(int partitionId, List<int[]> dropConditionsFields, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
LocalDate
readDate(com.qfs.store.record.IRecordReader record)
void
readDates(com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
void
recordsAdded(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
void
recordsDeleted(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
void
recordsUpdated(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> oldValues, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> newValues)
void
register(com.qfs.store.IDatastore datastore)
void
transactionCommitted(com.qfs.store.IDatastoreVersion version)
void
transactionRolledBack()
void
transactionStarted(com.qfs.store.IDatastoreVersion version, com.qfs.store.transaction.ITransactionInformation info)
-
-
-
Method Detail
-
register
public void register(com.qfs.store.IDatastore datastore)
-
transactionStarted
public void transactionStarted(com.qfs.store.IDatastoreVersion version, com.qfs.store.transaction.ITransactionInformation info)
- Specified by:
transactionStarted
in interfacecom.qfs.store.selection.ISelectionListener
-
transactionCommitted
public void transactionCommitted(com.qfs.store.IDatastoreVersion version)
- Specified by:
transactionCommitted
in interfacecom.qfs.store.selection.ISelectionListener
-
transactionRolledBack
public void transactionRolledBack()
- Specified by:
transactionRolledBack
in interfacecom.qfs.store.selection.ISelectionListener
-
recordsAdded
public void recordsAdded(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
- Specified by:
recordsAdded
in interfacecom.qfs.store.selection.ISelectionListener
-
recordsDeleted
public void recordsDeleted(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
- Specified by:
recordsDeleted
in interfacecom.qfs.store.selection.ISelectionListener
-
recordsUpdated
public void recordsUpdated(int partitionId, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> oldValues, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> newValues)
- Specified by:
recordsUpdated
in interfacecom.qfs.store.selection.ISelectionListener
-
partitionDropped
public void partitionDropped(int partitionId, List<int[]> dropConditionsFields, com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
- Specified by:
partitionDropped
in interfacecom.qfs.store.selection.ISelectionListener
-
readDates
public void readDates(com.qfs.store.record.IRecordBlock<com.qfs.store.record.IRecordReader> records)
-
readDate
public LocalDate readDate(com.qfs.store.record.IRecordReader record)
-
getLatestTask
protected Future<?> getLatestTask()
-
buildNode
public abstract P buildNode(com.qfs.store.record.IRecordReader record)
-
buildLevels
protected abstract void buildLevels(P node, LocalDate asOfDate, List<Object[]> allTuples)
-
-