Location
-
Source:
CalculationLogic/ID_Lib_Manager/elements/ConfigManager.groovy
Purpose
ConfigManager provides a centralized access layer for model-specific and dashboard-related configuration values.
It is designed as:
-
A lightweight, stateless facade exposed as a
Mapof callable closures. -
A cache-aware accessor layer wrapping model/configuration lookups.
-
A shared dependency consumed by dashboard modules through
out.ConfigManageror direct library call.
Access Pattern
Primary entrypoint:
Map configManager = libs.ID_Lib_Manager.ConfigManager.getInstance()
getInstance() returns a map exposing callable functions such as:
configManager.getModelName()
configManager.getCurrencyCode()
configManager.getHealthScoreDefinition()
Internal Design
1. Facade Map
getInstance() builds a map whose keys are public API method names and values are closures delegating to protected methods.
2. Caching
All protected getters use:
getOrSet(String key, Closure closure, List additionalParameters = [])
which delegates to:
libs.SharedLib.CacheUtils.getOrSet(key, additionalParameters, closure)
This avoids repeated expensive lookups (Model Object query calls, configuration reads) during script execution.
3. Model-Centric Resolution
Most methods resolve the active model via getModelName() and then retrieve model-scoped configuration from ConfigurationUtils or processing constants.
Public API (via getInstance())
Model Identity
-
getModelName()-
Returns selected Insights model unique name.
-
Source:
libs.ID_Lib_Model.ModelSelectorUtils.getModelForInsightsDashboards().
-
-
getModelTypedId()-
Returns MO typedId for the active model.
-
Lookup:
api.find("MO", ..., Filter.equal("uniqueName", modelName)).
-
-
getModelId()-
Returns MO numeric id for the active model.
-
Lookup:
api.find("MO", ..., ["id"], Filter.equal("uniqueName", modelName)).
-
Processing Table Configurations
-
getAggregatedTransactionsTableConfig()-
Returns
ConstConfig.AGGREGATED_TRANSACTIONS_TABLE_CONFIG.
-
-
getCustomerRollingPeriodTableConfig()-
Returns
ConstConfig.CUSTOMER_ROLLING_PERIOD_TABLE_CONFIG.
-
-
getCustomerProductRollingPeriodTableConfig()-
Returns
ConstConfig.CUSTOMER_PRODUCT_ROLLING_PERIOD_TABLE_CONFIG.
-
-
getCrossSellRollingPeriodTableConfig()-
Returns
ConstConfig.CROSS_SELL_ROLLING_PERIOD_TABLE_CONFIG.
-
Hierarchy Metadata
-
getProductHierarchyFieldNameToLabelMapping()-
Returns map: product hierarchy
fieldName -> label.
-
-
getCustomerHierarchyFieldNameToLabelMapping()-
Returns map: customer hierarchy
fieldName -> label.
-
-
getProductHierarchyFieldNames()-
Returns product hierarchy field names list.
-
-
getCustomerHierarchyFieldNames()-
Returns customer hierarchy field names list.
-
Scoring and Thresholds
-
getRevenueShare()-
Returns configured revenue share (
BigDecimal) for health score logic.
-
-
getHealthScoreDefinition()-
Returns health score definition structure from model configuration.
-
-
getTrendsThresholds()-
Returns trend threshold values used for directional classification.
-
-
getHealthScoreBucketTiers()-
Returns health score bucket tier labels from configuration utils.
-
Ranking and Dashboard Settings
-
getProductRanks()-
Returns
[1..N]whereN = getNumberOfProductRanks(modelName).
-
-
getCustomerRanks()-
Returns
[1..N]whereN = getNumberOfCustomerRanks(modelName).
-
-
getWaterfallConfiguration()-
Returns
waterfallInputMatrixfrom processing model configuration provider.
-
Currency
-
getCurrencySymbol()-
Returns base currency symbol for active model.
-
-
getCurrencyCode()-
Returns base currency code for active model.
-
Dependencies
ConfigManager depends on the following libraries/services:
-
libs.SharedLib.CacheUtilsfor memoization. -
libs.ID_Lib_Model.ModelSelectorUtilsfor active model selection. -
libs.ID_Lib_Model.ConfigurationUtilsfor model configuration access. -
libs.ID_Lib_Processing.ConstConfigfor static processing table configuration. -
libs.ID_Lib_Processing.ModelConfigurationProviderUtilsfor waterfall configuration. -
api.find(...)+Filter.equal(...)for MO lookup.
Typical Consumers
Many dashboard modules expose a local wrapper ConfigManager.groovy containing:
return libs.ID_Lib_Manager.ConfigManager.getInstance()
and then read values through out.ConfigManager:
Map configManager = out.ConfigManager
String modelName = configManager.getModelName()
List hierarchy = configManager.getProductHierarchyFieldNames()
Notes and Caveats
-
Caching keys are method-specific; callers do not pass
additionalParameterscurrently. -
Returned data types are not strongly enforced by interfaces, so consumers should treat outputs as trusted runtime structures.
-
If model selection changes within an execution context, previously cached values may still be reused by key.
Extension Guidelines
When adding a new configuration getter:
-
Add closure exposure in
getInstance()map. -
Implement protected method using
getOrSet("uniqueKey") { ... }. -
Keep retrieval model-aware via
getModelName()if model-scoped. -
Return stable data shapes expected by dashboard formulas.
-
Prefer reusing
ConfigurationUtils/provider libs over duplicating retrieval logic.
Quick Validation Checklist
After modifying ConfigManager:
-
Verify all existing keys in
getInstance()still resolve. -
Verify dependent dashboards can still call
out.ConfigManager.<method>(). -
Spot-check cached methods for correct return type and null safety.
-
Validate Model Object lookup assumptions (
uniqueNameuniqueness).