public static void setValue( final UnstructuredMarketDataSnapshot snapshot, final String valueName, final UniqueId identifier, final Double overrideValue, final Double marketValue) { if ((overrideValue != null) || (marketValue != null)) { final Map<String, ValueSnapshot> values = getValueMap(snapshot, identifier, true); final ValueSnapshot value = values.get(valueName); if (value != null) { if (marketValue != null) { values.put(valueName, new ValueSnapshot(marketValue, overrideValue)); } else { value.setOverrideValue(overrideValue); } } else { values.put(valueName, new ValueSnapshot(marketValue, overrideValue)); } } else { final Map<String, ValueSnapshot> values = getValueMap(snapshot, identifier, false); if (values != null) { values.remove(valueName); } } }
public static List<Double> getValue( final UnstructuredMarketDataSnapshot snapshot, final String valueName, final UniqueId identifier) { final Map<MarketDataValueSpecification, Map<String, ValueSnapshot>> globalValues = snapshot.getValues(); Map<String, ValueSnapshot> values = globalValues.get( new MarketDataValueSpecification(MarketDataValueType.SECURITY, identifier)); if (values != null) { final ValueSnapshot value = values.get(valueName); if (value != null) { return Arrays.asList(value.getOverrideValue(), value.getMarketValue()); } } values = globalValues.get( new MarketDataValueSpecification(MarketDataValueType.PRIMITIVE, identifier)); if (values != null) { final ValueSnapshot value = values.get(valueName); if (value != null) { return Arrays.asList(value.getOverrideValue(), value.getMarketValue()); } } return null; }