return Collections.emptySet();
}
protected UniqueId storeViewDefinition(final FunctionExecutionContext executionContext, final UniqueId targetId, final ViewDefinition viewDefinition) {
final String name = targetId.toString(); // Use the tempTarget identifier as a name to reuse an existing config item
final ConfigMaster master = OpenGammaExecutionContext.getConfigMaster(executionContext);
if (master == null) {
throw new IllegalStateException("Execution context does not contain a " + OpenGammaExecutionContext.CONFIG_MASTER_NAME);
}
final ConfigSearchRequest<ViewDefinition> request = new ConfigSearchRequest<ViewDefinition>(ViewDefinition.class);
request.setName(name);
final ConfigSearchResult<ViewDefinition> result = master.search(request);
if (result.getDocuments() != null) {
for (final ConfigDocument document : result.getDocuments()) {
if (viewDefinition.equals(document.getValue().getValue())) {
// Found a matching one
s_logger.debug("Using previous view definition {}", document.getUniqueId());
return document.getUniqueId();
} else {
// Found a dead one; either our temp target unique identifiers are not unique (different repositories MUST have different schemes) or the identifier
// sequence has been restarted/repeated and is colliding with old or dead configuration documents.
s_logger.info("Deleting expired view definition {}", document.getUniqueId());
master.removeVersion(document.getUniqueId());
}
}
}
final ConfigItem<ViewDefinition> item = ConfigItem.of(viewDefinition);
item.setName(name);
final UniqueId uid = master.add(new ConfigDocument(item)).getUniqueId();
s_logger.info("Created new view definition {} for {}", uid, name);
return uid;
}