Skip to main content
This page provides a description of how we can add a new column calculator. It features an example in which we populate a new field to SaCvaVegaRiskWeight store. The techniques employed are generic examples that can be extended, adapted and repeated for any use case that we need. In all cases, we make minimal changes to the Reference Implementation.

Step 1 - define datastore field via the customizations config

The first thing we want to do is to add a field that we will populate with our column calculator. Datastore field additions are made in the addModifications() method of DatastoreCustomisationsConfig at cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/DatastoreCustomisationsConfig.java. This class lives in your project’s cvarc-application module and is intended to be edited directly. See more customizations achievable with Datastore Helper.

Step 2 - define the column calculator class

Create your column calculator class in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/extensions/. The calculator must implement IColumnCalculator<ILineReader> (from com.activeviam.source.common.api). The CRIF as-of-date calculator (com.activeviam.cvarc.common.source.CrifAsofDateColumnCalculator in cvarc-common-lib) is the canonical reference implementation.
A calculator can also derive its value from other columns on the current row using context.getValue("columnName"). The example below populates the Math field from RiskWeight and ParameterC:

Step 3 - attach the calculator to a topic

The DLC framework attaches calculators to topics through a topic’s ChannelDescription. To attach a calculator without re-listing the topic’s column set, extend the relevant *SourceDescription class, override the topic bean, and use .toBuilder() to start from the parent’s CsvTopicDescription and add the calculator inline. Example — attaching both calculators to cvaDeltaTopic. The same pattern applies to any topic that has an attached channel; chain a .customField(...) call per calculator.
The super.cvaDeltaTopic(...) call inherits the parent’s parser and column list; .toBuilder() produces a mutable copy you can extend; each .customField(AnonymousCustomFieldDescription.of(...)) call registers a calculator inline against the channel.
The CRIF example in SharedSourceDescription.crifBaseTopic(...) (cvarc-starter/src/main/java/com/activeviam/cvarc/starter/cfg/impl/dlc/SharedSourceDescription.java) shows the same library APIs used to register a column calculator from scratch (without .toBuilder()).

Step 4 - wire the extension into ApplicationConfig

Add ExtendedSASourceDescription to the @Import list of ApplicationConfig in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/ApplicationConfig.java. The @Primary annotation on the extension class makes Spring prefer your overridden topic bean over the parent’s.