return null;
} else if (result.isIdentifierError()) {
s_logger.info("Failed to retrieve reference data for {}: {}", request, result.getErrors());
return null;
}
FudgeMsg resultFields = result.getFieldValues();
final String prefix = "LiveData" + SEPARATOR + "Bloomberg" + SEPARATOR;
final String suffix = request.getNormalizationRule().getJmsTopicSuffix();
final String bbgUniqueId = request.getMarketDataUniqueId().getValue();
final String defaultTopicName = prefix + bbgUniqueId + suffix;
String bbgSecurityType = resultFields.getString(BloombergConstants.FIELD_SECURITY_TYPE);
if (bbgSecurityType == null) {
return defaultTopicName;
} else if (BBG_VALID_EQUITY_TYPES.contains(bbgSecurityType)) {
String bbgExchange = resultFields.getString(BloombergConstants.FIELD_PRIMARY_EXCHANGE_NAME);
String bbgTicker = resultFields.getString(BloombergConstants.FIELD_TICKER);
if (bbgExchange == null || bbgTicker == null) {
return defaultTopicName;
}
return prefix + "Equity" + SEPARATOR + bbgExchange + SEPARATOR + bbgTicker + suffix;
} else if (bbgSecurityType.equals(BloombergConstants.BLOOMBERG_US_DOMESTIC_BOND_SECURITY_TYPE)) {
String issuer = resultFields.getString(BloombergConstants.FIELD_ISSUER);
String cusip = resultFields.getString(BloombergConstants.FIELD_ID_CUSIP);
if (issuer == null || cusip == null) {
return defaultTopicName;
}
return prefix + "Bond" + SEPARATOR + issuer + SEPARATOR + cusip + suffix;
} else if (bbgSecurityType.equals(BloombergConstants.BLOOMBERG_GLOBAL_BOND_SECURITY_TYPE)) {
String issuer = resultFields.getString(BloombergConstants.FIELD_ISSUER);
String isin = resultFields.getString(BloombergConstants.FIELD_ID_ISIN);
if (issuer == null || isin == null) {
return defaultTopicName;
}
return prefix + "Bond" + SEPARATOR + issuer + SEPARATOR + isin + suffix;
} else if (bbgSecurityType.equals(BloombergConstants.BLOOMBERG_EQUITY_OPTION_SECURITY_TYPE)) {
String underlyingTicker = resultFields.getString(BloombergConstants.FIELD_OPT_UNDL_TICKER);
String ticker = resultFields.getString(BloombergConstants.FIELD_TICKER);
if (underlyingTicker == null || ticker == null) {
return defaultTopicName;
}