Adding Custom Measure Configuration

Overview

This section explains how to customize the cube’s measures configuration by implementing the IMeasureBuilder interface and importing the Spring Bean into the project.

IMeasureBuilder interface

This interface contains a single method, copperMeasures(), which, when implemented, will contain all new copper measures that will be added to the cube’s configuration.

/**
 * <b>IMeasureBuilder</b>
 *
 * <p>Interface to define copper measures.
 *
 * @author ActiveViam
 */
public interface IMeasureBuilder {
  void copperMeasures(ICopperContext context);
}

CustomMeasureBuilder class

To add new measures to the cube configuration, define a Spring Configuration class, which implements the IMeasureBuilder interface. Within the copperMeasures(ICopperContext context) method, add the new copper measures.

See example below:

@Configuration
public class CustomMeasureBuilder implements IMeasureBuilder {

  @Override
  public void copperMeasures(ICopperContext context) {
      Copper.count().withAlias("NEW COUNT").publish(context);
  }

}

All measures defined in copperMeasures() are added to the cube’s configuration along with the default measures.

Import the Spring Bean

Once the bean is created, import it into the project. See Importing Spring Beans into the Project on how to do this. Once done, Spring will use the custom bean when configuring the cube’s measures.