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 scopes
    PlatformUserContext getPlatformUserContext()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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 specified
      targetUOM - uom in which value needs to be converted
      scopes - list of scopes(maximum 6). The value conversion will be performed with the exact matching scope in the list. Please refer Scope
      Returns:
      the conversion factor
    • getKey

      public static java.lang.String getKey​(java.util.List<Scope> scopes)
      Utility method to create an in-memory key for the provided scopes
    • getHierEnumConfig

      public HierEnumConversionConfig getHierEnumConfig()
      Returns:
      the hierEnumConfig
    • getPlatformUserContext

      public PlatformUserContext getPlatformUserContext()
      Returns:
      the platformUserContext