Class HierEnumConversionData
java.lang.Object
com.onenetwork.platform.common.uom.HierEnumConversionData
public class HierEnumConversionData
extends java.lang.Object
Data class for conversion of UOM defined in HierEnumConversionDef.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EMPTY_SCOPE_KEY
-
Constructor Summary
Constructors Constructor Description HierEnumConversionData(HierEnumConversionConfig hierEnumConfig, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Double>>> conversionData, PlatformUserContext context)
-
Method Summary
Modifier and Type Method Description java.lang.Double
getConversionFactor(java.lang.String valueUOM, java.lang.String targetUOM, java.util.List<Scope> scopes)
Method to calculate the conversion factor for the provided scopes between the source and target UOMs without hitting the DB.HierEnumConversionConfig
getHierEnumConfig()
static java.lang.String
getKey(java.util.List<Scope> scopes)
Utility method to create an in-memory key for the provided scopesPlatformUserContext
getPlatformUserContext()
-
Field Details
-
EMPTY_SCOPE_KEY
public static final java.lang.String EMPTY_SCOPE_KEY- See Also:
- Constant Field Values
-
-
Constructor Details
-
HierEnumConversionData
public HierEnumConversionData(HierEnumConversionConfig hierEnumConfig, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Double>>> conversionData, PlatformUserContext context)
-
-
Method Details
-
getConversionFactor
public java.lang.Double getConversionFactor(java.lang.String valueUOM, java.lang.String targetUOM, java.util.List<Scope> scopes)Method to calculate the conversion factor for the provided scopes between the source and target UOMs without hitting the DB. Returns NULL if no conversion factor is found- Parameters:
valueUOM
- uom in which value is specifiedtargetUOM
- uom in which value needs to be convertedscopes
- list of scopes(maximum 6). The value conversion will be performed with the exact matching scope in the list. Please referScope
- Returns:
- the conversion factor
-
getKey
Utility method to create an in-memory key for the provided scopes -
getHierEnumConfig
- Returns:
- the hierEnumConfig
-
getPlatformUserContext
- Returns:
- the platformUserContext
-