* @param dataField the data field, not null
* @param result the result map of identifiers, updated if already in database, not null
* @return the missing identifiers, not null
*/
protected Set<ExternalId> findTimeSeries(final Set<ExternalId> externalIds, final String dataProvider, final String dataField, final Map<ExternalId, UniqueId> result) {
HistoricalTimeSeriesInfoSearchRequest searchRequest = new HistoricalTimeSeriesInfoSearchRequest();
searchRequest.addExternalIds(externalIds);
searchRequest.setDataField(dataField);
if (dataProvider == null) {
searchRequest.setDataProvider(BloombergConstants.DEFAULT_DATA_PROVIDER);
} else {
searchRequest.setDataProvider(dataProvider);
}
searchRequest.setDataSource(BLOOMBERG_DATA_SOURCE_NAME);
HistoricalTimeSeriesInfoSearchResult searchResult = _htsMaster.search(searchRequest);
Set<ExternalId> missing = new HashSet<ExternalId>(externalIds);
for (HistoricalTimeSeriesInfoDocument doc : searchResult.getDocuments()) {
Set<ExternalId> intersection = Sets.intersection(doc.getInfo().getExternalIdBundle().toBundle().getExternalIds(), externalIds).immutableCopy();