MarketDataSnapshotSearchRequest snapshotSearchRequest = new MarketDataSnapshotSearchRequest();
snapshotSearchRequest.setIncludeData(false);
Map<String, Map<String, String>> snapshotsByBasisView = new HashMap<String, Map<String, String>>();
for (MarketDataSnapshotDocument doc : MarketDataSnapshotSearchIterator.iterable(_snapshotMaster, snapshotSearchRequest)) {
ManageableMarketDataSnapshot snapshot = doc.getSnapshot();
if (snapshot.getUniqueId() == null) {
s_logger.warn("Ignoring snapshot with null unique identifier {}", snapshot.getName());
continue;
}
if (StringUtils.isBlank(snapshot.getName())) {
s_logger.warn("Ignoring snapshot {} with no name", snapshot.getUniqueId());
continue;
}
if (s_guidPattern.matcher(snapshot.getName()).find()) {
s_logger.debug("Ignoring snapshot which appears to have an auto-generated name: {}", snapshot.getName());
continue;
}
String basisViewName = snapshot.getBasisViewName() != null ? snapshot.getBasisViewName() : "unknown";
Map<String, String> snapshotsForBasisView = snapshotsByBasisView.get(basisViewName);
if (snapshotsForBasisView == null) {
snapshotsForBasisView = new HashMap<String, String>();
snapshotsByBasisView.put(basisViewName, snapshotsForBasisView);
}
snapshotsForBasisView.put(snapshot.getUniqueId().getObjectId().toString(), snapshot.getName());
}
return snapshotsByBasisView;
}