Interface UOMService

All Superinterfaces:
Service

public interface UOMService
extends Service
Provides APIs for the conversion of unit-of-measure values.
  • Method Details

    • convert

      double convert​(java.lang.String enumName, double value, java.lang.String valueUOM, java.lang.String targetUOM, PlatformUserContext context, Scope... scopes)
      For an enumeration type, converts the given value from a source unit of measure to a target unit of measure. Requires the population of EnumConversionDef before use.

      Optionally, a list of Scopes can be provided. When provided, a conversion factor will be looked up for each Scope until one is found - if no Scoped factor is found, an exception is thrown

      Parameters:
      enumName - enumeration Name
      value - current value of UOM
      valueUOM - uom in which value is specified
      targetUOM - uom in which value needs to be converted
      context - Please refer PlatformUserContext
      scopes - array of scopes. The value conversion will be performed with the first matching scope in the array. Please refer Scope
      Returns:
      converted value in targetUOM
    • convertHierEnum

      double convertHierEnum​(HierEnumConversionConfig hierEnumConversionConfig, double value, java.lang.String valueUOM, java.lang.String targetUOM, PlatformUserContext context, Scope... scopes)
      For an enumeration type, converts the given value from a source unit of measure to a target unit of measure. Requires the population of HierEnumConversionDef before use.

      Optionally, a list of Scopes(maximum 6) can be provided. When provided, a conversion factor will be looked up for the provided group of Scope - if no Scoped factor is found, an exception is thrown

      Parameters:
      hierEnumConversionConfig - HierEnumConversionConfig
      value - current value of UOM
      valueUOM - uom in which value is specified
      targetUOM - uom in which value needs to be converted
      context - Please refer PlatformUserContext
      scopes - array of scopes(maximum 6). The value conversion will be performed with the exact matching scope in the array. Please refer Scope
      Returns:
      converted value in targetUOM
    • fetchHierEnumConversionData

      HierEnumConversionData fetchHierEnumConversionData​(HierEnumConversionConfig hierEnumConversionConfig, PlatformUserContext context, java.util.List<java.util.List<Scope>> scopes)
      Return an in-memory cache of conversion data for the provided scopes. Should be called before invoking convertHierEnum(HierEnumConversionData, double, String, String, PlatformUserContext, List)
      Parameters:
      hierEnumConversionConfig - HierEnumConversionConfig
      context - Please refer PlatformUserContext
      scopes - list of scopes(maximum 6). The value conversion will be performed with the exact matching scope in the list. Please refer Scope
      Returns:
      HierEnumConversionData
    • convertHierEnum

      double convertHierEnum​(HierEnumConversionData conversionData, double value, java.lang.String valueUOM, java.lang.String targetUOM, PlatformUserContext context, java.util.List<java.util.List<Scope>> scopes)
      For an enumeration type, converts the given value from a source unit of measure to a target unit of measure. Requires the population of HierEnumConversionDef before use and call to #fetchHierEnumConversionData(HierEnumConversionConfig, PlatformUserContext, List) which cache the conversions for the provided scopes.

      A list of Scopes(maximum 6) should be provided. When provided, a conversion factor will be looked up for the provided group of Scope - if no Scoped factor is found, an exception is thrown

      Parameters:
      conversionData - HierEnumConversionData
      value - current value of UOM
      valueUOM - uom in which value is specified
      targetUOM - uom in which value needs to be converted
      context - Please refer PlatformUserContext
      scopes - list of scopes(maximum 6). The value conversion will be performed with the exact matching scope in the list. Please refer Scope
      Returns:
      converted value in targetUOM