private ManageableUnstructuredMarketDataSnapshot getGlobalAndUnresolvedValues(final ExternalIdBundleResolver resolver, final ViewComputationResultModel results,
final Map<String, DependencyGraph> graphs) {
final ManageableUnstructuredMarketDataSnapshot snapshot = new ManageableUnstructuredMarketDataSnapshot();
for (final Entry<String, DependencyGraph> graphEntry : graphs.entrySet()) {
final DependencyGraph graph = graphEntry.getValue();
Set<ValueSpecification> resolvedValues = Sets.newHashSet();
for (ComputedValue computedValue : results.getAllMarketData()) {
resolvedValues.add(computedValue.getSpecification());
final DependencyNode nodeProducing = graph.getNodeProducing(computedValue.getSpecification());
if ((nodeProducing != null) && isTerminalUnstructuredOutput(nodeProducing, graph)) {
ExternalIdBundle identifiers = resolveExternalIdBundle(resolver, computedValue.getSpecification());
if (identifiers != null) {
snapshot.putValue(identifiers, computedValue.getSpecification().getValueName(), new ValueSnapshot(computedValue.getValue()));
}
}
}
//missing values go over the wire as nulls
SetView<ValueSpecification> missingValues = Sets.difference(graph.getAllRequiredMarketData(), resolvedValues);
for (ValueSpecification missingValue : missingValues) {
ExternalIdBundle missingExternalIdBundle = resolveExternalIdBundle(resolver, missingValue);
snapshot.putValue(missingExternalIdBundle, missingValue.getValueName(), null);
}
}