Skip to main content
In this guide, we show the steps required to take full advantage of Atoti Server Extension to define and use your own measures and post-processors.

Prerequisites

This guide assumes you have already created a Maven project with atoti-server-extension-parent as described in the Atoti Server Extension reference.

1. Add atoti-server-extension-parent to your pom.xml

For a correct use of Atoti Server Extension, you need to add the atoti-server-extension-parent as a parent in the pom.xml file of your server extension project.
You can use {@mavenVersion: -} to specify the version of Atoti Server Extension you want to use.

2. Create a basic custom measure and register it

In this section, we show you how to create a custom measure and register it in the Atoti application. The steps are the same for every custom measure not requiring an underlying post-processor.

2.1 Create an argument class for your measure

Create a class that implements the empty interface com.activeviam.atoti.application.api.measures.IMeasureDefinition, this class should contain the arguments needed to compute the measure and optionally, the measure’s plugin key.
Arguments can be of any Java primitive type, or any types of identifier defined in Atoti (e.g. com.activeviam.activepivot.core.intf.api.cube.metadata.LevelIdentifier, com.activeviam.activepivot.core.intf.api.cube.metadata.HierarchyIdentifier, etc.).
The arguments passed to the custom measures inside a IMeasureDefinition from Python are of the following types:
  • Any Java primitive type (e.g. int, double, boolean, etc.)
  • LevelIdentifier
  • HierarchyIdentifier
  • StoreField
  • Measure name as a String
  • Column name as a String
  • Dimension name as a String
  • Any array/tuple and map of the above types

2.2 Create your measure’s registration class

Once an argument class is defined, you are now able to create a com.activeviam.atoti.server.common.api.plugins.MeasureRegistration object specific to your measure, that will then be used to register the measure in the Atoti application.
You can also specify a formatter when creating your custom measure formula by overriding IFormulaFactory.computeFormatter()

2.3 Register your measure in the Atoti application

Once the measure registration class is ready, you can register your measure in the Atoti application using the com.activeviam.atoti.server.common.api.plugins.IPluginSetup bean.
You can do this in a Spring configuration class by defining a bean that returns a com.activeviam.atoti.server.common.api.plugins.PluginMeasureRegistrations object.
If you need to register multiple measures, they can all be added to the PluginMeasureRegistrations object returned by the contributeMeasures() method of the IPluginSetup bean.Example:
Once this is done, the measure is available on the start of your application. To know how to use it with Atoti Python SDK, head to the Atoti Python SDK documentation.
Don’t forget to import your measures configuration class (the class containing the @Bean method from step 2.3) in your @AutoConfiguration class using the @Import annotation. See section 4 for details.

3. Create a custom measure relying on a custom post-processor

In this section, we show you how to create a custom measure whose calculations rely on a custom post-processor.

3.1 Create a custom post-processor

You can create a custom post-processor by extending any class which already extends AAdvancedPostProcessor.
For example:

3.2 Create a custom measure relying on the created post-processor

Once the post-processor is created, you can create a measure that relies on it by using very similar code to the one used in the Basic Custom Measure section:
  • You need to create an argument class that implementing IMeasureDefinition.
  • You need to create a MeasureRegistration object specifying the new post-processor that will be used to register the measure in the Atoti application, for example:

3.3 Register the post-processor

One the post-processor and the measure are created, you need to manually register the created post-processor in the Atoti application registry:

3.4 Register the measure

Finally, you can register the measure in the Atoti application using the IPluginSetup bean as shown in the Basic Custom Measure section. The post-processor must also be registered in the PluginMeasureRegistrations bean definition.

4. Import your measures configuration in your project’s AutoConfiguration

Once you have created your measures configuration class (e.g., ServerExtensionMeasuresConfig), you must import it in your extension’s @AutoConfiguration class to make it available to the Atoti application see.
Without this import, Spring Boot will not register your measures even if they are correctly configured. Once this is done, the measure will be available on the start of your application, to know how to use it with Atoti Python SDK, head to the Atoti Python SDK plugin_measure documentation.