ConstantHierarchy

The ConstantHierarchy is used to create a multi-level analysis hierarchy filled with constant member paths defined during setup.

import com.activeviam.accelerator.common.hierarchy.ConstantHierarchy;

// ....
hierarchyBuilder.toDimension("A dimension",
        ConstantHierarchy
                .hierarchy("Const")
                    .slicing()
                    .withLevel("Level1")
                        .withType(Types.TYPE_OBJECT)
                        .withComparator(ReverseCustomComparator.PLUGIN_KEY)
                    .withLevel("Level2")
                        .withType(Types.TYPE_STRING)
                .withLevelPath(LocalDate.of(2024,2,1), "A")
                .withLevelPath(LocalDate.of(2024,2,1), "B")
                .withLevelPath(LocalDate.of(2024,2,2), "C")
                .withLevelPath(LocalDate.of(2024,2,2), "D")
                .withLevelPath(LocalDate.of(2024,2,3)))); // Level 2 is empty and will be filled with "_DATAMEMBER_"

Here are the methods exposed to set up the hierarchy:

Method Parameters Mandatory Usage
slicing The top level is slicing, there is no AllMember level.
withVisible Boolean Sets the visible flag to the hierarchy.
hidden Hides the hierarchy, equivalent to withVisible(false).
withLevel String Creates a level.
withType int The Copper type of the level (mandatory for Copper usage), for instance withType(Types.TYPE_STRING).
withComparator IComparator Sets the level comparator directly from a comparator object instance (the running hierarchy will create its own instance).
withComparator IComparatorDescription Sets the level comparator from a comparator description.
withComparator String Sets the level comparator from a comparator plugin key.