Class ParentHierarchyListener<PCN extends ParentChildNode<PCN>,​HB extends HierarchyBuilder<HB>>

  • All Implemented Interfaces:
    com.qfs.store.selection.ISelectionListener
    Direct Known Subclasses:
    BookHierarchyListener, CounterpartyHierarchyListener, LegalEntityHierarchyListener

    public abstract class ParentHierarchyListener<PCN extends ParentChildNode<PCN>,​HB extends HierarchyBuilder<HB>>
    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 Detail

      • LOGGER

        protected static Logger LOGGER
      • parentChildStoreName

        protected final String parentChildStoreName
      • hierarchyStoreName

        protected final String hierarchyStoreName
      • parentChildFields

        protected final String[] parentChildFields
    • Constructor Detail

      • ParentHierarchyListener

        public ParentHierarchyListener​(String parentChildStoreName,
                                       String hierarchyStoreName,
                                       String[] parentChildFields)
    • 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 interface com.qfs.store.selection.ISelectionListener
      • transactionCommitted

        public void transactionCommitted​(com.qfs.store.IDatastoreVersion version)
        Specified by:
        transactionCommitted in interface com.qfs.store.selection.ISelectionListener
      • transactionRolledBack

        public void transactionRolledBack()
        Specified by:
        transactionRolledBack in interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 PCN buildNode​(com.qfs.store.record.IRecordReader record)
      • buildLevels

        protected abstract void buildLevels​(PCN node,
                                            LocalDate asOfDate,
                                            List<Object[]> allTuples)
      • buildLevelsRecursively

        protected void buildLevelsRecursively​(PCN node,
                                              HB tupleBuilder,
                                              List<Object[]> allTuples)