Class SymbolRegistryEnrichmentUtil

java.lang.Object
com.bluebell.greenhouse.platform.util.registry.SymbolRegistryEnrichmentUtil

public final class SymbolRegistryEnrichmentUtil extends Object
Utility methods shared by symbol registry enrichment flows.
Version:
2.0.2
Author:
Stephen Prizio
  • Field Details

    • UNKNOWN_EXCHANGE_MIC

      public static final String UNKNOWN_EXCHANGE_MIC
      Exchange MIC used for symbols whose real exchange is unknown.
      See Also:
  • Method Details

    • requiresRequestedAttributePopulation

      public static boolean requiresRequestedAttributePopulation(SymbolRegistryEntry symbolEntry, Set<SymbolRegistryAttribute> requestedAttributes)
      Returns true when one of the requested attributes is blank or missing.
      Parameters:
      symbolEntry - symbol entry
      requestedAttributes - requested attributes
      Returns:
      boolean
    • computeNeedsReview

      public static boolean computeNeedsReview(SymbolRegistryEntry symbolEntry, Set<SymbolRegistryAttribute> requestedAttributes, Boolean responseNeedsReview, List<String> issues)
      Computes the final needs-review state for a symbol.
      Parameters:
      symbolEntry - symbol entry
      requestedAttributes - requested attributes
      responseNeedsReview - response needs-review flag
      issues - issues collection
      Returns:
      boolean
    • applyStringField

      public static SymbolRegistryEnrichmentUtil.FieldUpdate<String> applyStringField(String existingValue, String rawValue, boolean overwrite, boolean forceUppercase)
      Applies a string field when allowed by overwrite settings.
      Parameters:
      existingValue - existing value
      rawValue - raw value
      overwrite - overwrite flag
      forceUppercase - true when the value should be uppercased
      Returns:
      SymbolRegistryEnrichmentUtil.FieldUpdate
    • applyExchangeMicField

      public static SymbolRegistryEnrichmentUtil.FieldUpdate<String> applyExchangeMicField(String existingValue, String rawValue, boolean overwrite)
      Applies an exchange MIC when the existing value is blank or unresolved, or overwrite is enabled.
      Parameters:
      existingValue - existing exchange MIC
      rawValue - raw exchange MIC
      overwrite - overwrite flag
      Returns:
      SymbolRegistryEnrichmentUtil.FieldUpdate
    • setDoubleField

      public static SymbolRegistryEnrichmentUtil.FieldUpdate<Double> setDoubleField(Double existingValue, double value)
      Sets a double field when the value changed.
      Parameters:
      existingValue - existing value
      value - value
      Returns:
      SymbolRegistryEnrichmentUtil.FieldUpdate
    • setNullField

      public static SymbolRegistryEnrichmentUtil.FieldUpdate<Double> setNullField(Double existingValue)
      Sets a null field when the value changed.
      Parameters:
      existingValue - existing value
      Returns:
      SymbolRegistryEnrichmentUtil.FieldUpdate
    • setStringArrayField

      public static SymbolRegistryEnrichmentUtil.FieldUpdate<List<String>> setStringArrayField(List<String> existingValues, List<String> values)
      Sets a string array field when the value changed.
      Parameters:
      existingValues - existing values
      values - values
      Returns:
      SymbolRegistryEnrichmentUtil.FieldUpdate
    • isValidHttpUrl

      public static boolean isValidHttpUrl(String value)
      Returns true when the given string is a valid http or https URL.
      Parameters:
      value - url string
      Returns:
      boolean
    • sanitizeSourceUrls

      public static List<String> sanitizeSourceUrls(List<String> sourceUrls, List<String> issues)
      Normalizes source URLs to valid literal URLs only.
      Parameters:
      sourceUrls - source URLs from enrichment
      issues - issues collection
      Returns:
      normalized valid source URLs
    • normalizeTextValue

      public static String normalizeTextValue(Object value)
      Normalizes text values from either JSON nodes or raw strings.
      Parameters:
      value - raw value
      Returns:
      normalized text
    • normalizeExchangeMic

      public static String normalizeExchangeMic(Object value)
      Normalizes an exchange MIC value, treating unresolved sentinel values as missing.
      Parameters:
      value - raw exchange value
      Returns:
      normalized exchange MIC
    • buildUpdatedSymbolEntry

      public static SymbolRegistryEntry buildUpdatedSymbolEntry(SymbolRegistryEntry symbolEntry, String description, String exchange, String website, List<String> sourceUrls, Double confidence, boolean needsReview)
      Builds a new SymbolRegistryEntry from an existing entry with updated values.
      Parameters:
      symbolEntry - source symbol entry
      description - description
      exchange - exchange
      website - website
      sourceUrls - source URLs
      confidence - confidence
      needsReview - needs review
      Returns:
      SymbolRegistryEntry