Class SymbolRegistryEnrichmentUtil
java.lang.Object
com.bluebell.greenhouse.platform.util.registry.SymbolRegistryEnrichmentUtil
Utility methods shared by symbol registry enrichment flows.
- Version:
- 2.0.2
- Author:
- Stephen Prizio
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordField update result. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringExchange MIC used for symbols whose real exchange is unknown. -
Method Summary
Modifier and TypeMethodDescriptionapplyExchangeMicField(String existingValue, String rawValue, boolean overwrite) Applies an exchange MIC when the existing value is blank or unresolved, or overwrite is enabled.applyStringField(String existingValue, String rawValue, boolean overwrite, boolean forceUppercase) Applies a string field when allowed by overwrite settings.static SymbolRegistryEntrybuildUpdatedSymbolEntry(SymbolRegistryEntry symbolEntry, String description, String exchange, String website, List<String> sourceUrls, Double confidence, boolean needsReview) Builds a newSymbolRegistryEntryfrom an existing entry with updated values.static booleancomputeNeedsReview(SymbolRegistryEntry symbolEntry, Set<SymbolRegistryAttribute> requestedAttributes, Boolean responseNeedsReview, List<String> issues) Computes the final needs-review state for a symbol.static booleanisValidHttpUrl(String value) Returns true when the given string is a valid http or https URL.static StringnormalizeExchangeMic(Object value) Normalizes an exchange MIC value, treating unresolved sentinel values as missing.static StringnormalizeTextValue(Object value) Normalizes text values from either JSON nodes or raw strings.static booleanrequiresRequestedAttributePopulation(SymbolRegistryEntry symbolEntry, Set<SymbolRegistryAttribute> requestedAttributes) Returns true when one of the requested attributes is blank or missing.sanitizeSourceUrls(List<String> sourceUrls, List<String> issues) Normalizes source URLs to valid literal URLs only.setDoubleField(Double existingValue, double value) Sets a double field when the value changed.setNullField(Double existingValue) Sets a null field when the value changed.setStringArrayField(List<String> existingValues, List<String> values) Sets a string array field when the value changed.
-
Field Details
-
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 entryrequestedAttributes- 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 entryrequestedAttributes- requested attributesresponseNeedsReview- response needs-review flagissues- 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 valuerawValue- raw valueoverwrite- overwrite flagforceUppercase- 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 MICrawValue- raw exchange MICoverwrite- 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 valuevalue- value- Returns:
SymbolRegistryEnrichmentUtil.FieldUpdate
-
setNullField
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 valuesvalues- values- Returns:
SymbolRegistryEnrichmentUtil.FieldUpdate
-
isValidHttpUrl
Returns true when the given string is a valid http or https URL.- Parameters:
value- url string- Returns:
- boolean
-
sanitizeSourceUrls
-
normalizeTextValue
-
normalizeExchangeMic
-
buildUpdatedSymbolEntry
public static SymbolRegistryEntry buildUpdatedSymbolEntry(SymbolRegistryEntry symbolEntry, String description, String exchange, String website, List<String> sourceUrls, Double confidence, boolean needsReview) Builds a newSymbolRegistryEntryfrom an existing entry with updated values.- Parameters:
symbolEntry- source symbol entrydescription- descriptionexchange- exchangewebsite- websitesourceUrls- source URLsconfidence- confidenceneedsReview- needs review- Returns:
SymbolRegistryEntry
-