Package com.opengamma.engine

Examples of com.opengamma.engine.ComputationTargetSpecification


    return results;
  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    String curveName = null;
    String curveCurrencyName = null;
    String curveCalculationConfigName = null;
    for (final Map.Entry<ValueSpecification, ValueRequirement> entry : inputs.entrySet()) {
      if (entry.getKey().getValueName().equals(YCNS_REQUIREMENT)) {
View Full Code Here


      final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String curveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    final String curveCurrency = desiredValue.getConstraint(ValuePropertyNames.CURVE_CURRENCY);
    final String curveCalculationConfig = desiredValue.getConstraint(ValuePropertyNames.CURVE_CALCULATION_CONFIG);
    final ComputationTargetSpecification specification = target.toSpecification();
    final Object value = inputs.getValue(new ValueRequirement(YCNS_REQUIREMENT, specification));
    if (!(value instanceof LabelledMatrix1D)) {
      throw new OpenGammaRuntimeException("Yield Curve Node Sensitivities result was not of type LabelledMatrix1D");
    }
    final DoubleLabelledMatrix1D ycns = (DoubleLabelledMatrix1D) value;
View Full Code Here

   *  given computation target
   */
  public ViewResultEntry getData(ComputationTargetSpecification spec) {
    ViewResultEntry result = null;
    for (ViewResultEntry item : _data) {
      ComputationTargetSpecification match = item.getComputedValue().getSpecification().getTargetSpecification();
      if (spec.equals(match)) {
        if (result != null) {
          throw new IllegalArgumentException("More than 1 entry in batch DB for " + spec);
        }
        result = item;
View Full Code Here

    @Override
    public MultiCurveCalculationConfig buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final String calculationConfigName = message.getString(CONFIG_NAME_FIELD);
      final String calculationMethod = message.getString(CALCULATION_METHOD_FIELD);
      final List<FudgeField> yieldCurveNamesFields = message.getAllByName(YIELD_CURVE_NAMES_FIELD);
      ComputationTargetSpecification target;
      try {
        target = (ComputationTargetSpecification) deserializer.fieldValueToObject(ComputationTargetReference.class, message.getByName(TARGET_FIELD));
      } catch (RuntimeException e) {
        // [PLAT-2286] Legacy support for UniqueIdentifiable member of the configuration
        final UniqueIdentifiable targetObject = deserializer.fieldValueToObject(UniqueIdentifiable.class, message.getByName(ID_FIELD));
View Full Code Here

  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target) {
    final String valueRequirementName = getValueRequirementName();
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    final CurrencyMatrix matrix = (CurrencyMatrix) target.getValue();
    final Collection<Currency> sourceCurrencies = matrix.getSourceCurrencies();
    final Collection<Currency> targetCurrencies = matrix.getTargetCurrencies();
    final Set<ValueSpecification> results = Sets.<ValueSpecification>newHashSetWithExpectedSize(sourceCurrencies.size() * targetCurrencies.size());
    final ValueProperties.Builder properties = createValueProperties();
View Full Code Here

  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final String valueRequirementName = getValueRequirementName();
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    final CurrencyMatrix matrix = (CurrencyMatrix) target.getValue();
    final DetermineResults resultBuilder = new DetermineResults(matrix);
    for (ValueRequirement input : inputs.values()) {
      final Currency sourceCurrency = Currency.of(input.getConstraint(SOURCE_CURRENCY_TAG));
      final Currency targetCurrency = Currency.of(input.getConstraint(TARGET_CURRENCY_TAG));
View Full Code Here

    return new ValueSpecification(ValueRequirementNames.HISTORICAL_TIME_SERIES_LATEST, targetSpec, properties);
  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target) {
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    final ValueProperties properties = createValueProperties().withAny(CURRENCY_MATRIX_NAME_PROPERTY).get();
    return ImmutableSet.of(createSpotRateResult(targetSpec, properties), createHistoricalTimeSeriesResult(targetSpec, properties), createTimeSeriesLatestResult(targetSpec, properties));
  }
View Full Code Here

     * @deprecated shouldn't be relying on this, a configuration database upgrade script to apply the transformation would be better
     */
    @Deprecated
    private static ValueRequirement plat3044Translate(final ValueRequirement valueRequirement) {
      if (valueRequirement.getTargetReference() instanceof ComputationTargetSpecification) {
        final ComputationTargetSpecification spec = valueRequirement.getTargetReference().getSpecification();
        if (spec.getType().equals(ComputationTargetType.PRIMITIVE)) {
          final UniqueId uid = spec.getUniqueId();
          if (ExternalSchemes.BLOOMBERG_TICKER.getName().equals(uid.getScheme())) {
            return new ValueRequirement(valueRequirement.getValueName(), new ComputationTargetRequirement(spec.getType(), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, uid.getValue())),
                valueRequirement.getConstraints());
          }
        }
      }
      return valueRequirement;
View Full Code Here

      return null;
    }
    if ((id instanceof UniqueIdentifiable) && type.isCompatible((UniqueIdentifiable) id)) {
      return (T) id;
    }
    ComputationTargetSpecification spec;
    if (id instanceof UniqueId) {
      spec = new ComputationTargetSpecification(type, (UniqueId) id);
    } else {
      ComputationTargetRequirement req;
      if (id instanceof ExternalId) {
        req = new ComputationTargetRequirement(type, (ExternalId) id);
      } else if (id instanceof ExternalIdBundle) {
View Full Code Here

   */
  @Test
  public void formatHistoryForValueNameWithUnknownType() {
    ResultsFormatter formatter = new ResultsFormatter();
    UniqueId uid = UniqueId.of("scheme", "value");
    ComputationTargetSpecification spec = new ComputationTargetSpecification(ComputationTargetType.POSITION, uid);
    ValueProperties props = ValueProperties.builder().with(ValuePropertyNames.FUNCTION, "fn").get();
    // if this works without an exception then the bug is fixed
    formatter.format(123d, new ValueSpecification("unknown value name", spec, props), TypeFormatter.Format.HISTORY, null);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.ComputationTargetSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.