Examples of ViewCalculationResultModel


Examples of com.opengamma.engine.view.ViewCalculationResultModel

    if (run.getSnapshotMode().equals(SnapshotMode.WRITE_THROUGH)) {
      addComputedValuesToMarketDataInTransaction(run.getMarketData().getObjectId(), resultModel.getAllMarketData());
    }

    for (String calcConfigName : resultModel.getCalculationConfigurationNames()) {
      ViewCalculationResultModel viewCalculationResultModel = resultModel.getCalculationResult(calcConfigName);
     
      final Set<ComputationTargetSpecification> successfulTargets = newHashSet();
      final Set<ComputationTargetSpecification> failedTargets = newHashSet();

      List<SqlParameterSource> targetProperties = newArrayList();
      List<SqlParameterSource> successes = newArrayList();
      List<SqlParameterSource> failures = newArrayList();
      List<SqlParameterSource> failureReasons = newArrayList();

      Instant evalInstant = Instant.now();

      long calcConfId = _calculationConfigurations.get(calcConfigName);

      for (final ComputationTargetSpecification targetSpec : viewCalculationResultModel.getAllTargets()) {
        final long computationTargetId = _computationTargets.get(targetSpec);
        boolean specFailures = false;
        for (final ComputedValueResult computedValue : viewCalculationResultModel.getAllValues(targetSpec)) {
          ResultConverter<Object> resultConverter  = null;
          if (!(computedValue.getValue() instanceof MissingValue)) {
            try {
              resultConverter = (ResultConverter<Object>) _resultConverterCache.getConverter(computedValue.getValue());
            } catch (IllegalArgumentException e) {
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    assertEquals(Duration.ofMillis(100), model.getCalculationDuration());
   
    model.addValue("configName1", COMPUTED_VALUE_RESULT);
    assertEquals(Sets.newHashSet(SPEC), Sets.newHashSet(model.getAllTargets()));
   
    ViewCalculationResultModel calcResult = model.getCalculationResult("configName1");
    assertNotNull(calcResult);
   
    Map<Pair<String, ValueProperties>, ComputedValueResult> targetResults = calcResult.getValues(SPEC);
    assertEquals(1, targetResults.size());
    assertEquals("DATA", targetResults.keySet().iterator().next().getFirst());
    assertEquals(COMPUTED_VALUE_RESULT, targetResults.values().iterator().next());
  }
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

      }
    }
  }
 
  private void processStatusResult(ViewComputationResultModel fullResult, PerViewStatusResult statusResult) {
    ViewCalculationResultModel calculationResult = fullResult.getCalculationResult(DEFAULT_CALC_CONFIG);
    Collection<ComputationTargetSpecification> allTargets = calculationResult.getAllTargets();
    for (ComputationTargetSpecification targetSpec : allTargets) {
      ComputationTargetType targetType = targetSpec.getSpecification().getType();
      if (isValidTargetType(targetType)) {
        Map<Pair<String, ValueProperties>, ComputedValueResult> values = calculationResult.getValues(targetSpec);
        for (Map.Entry<Pair<String, ValueProperties>, ComputedValueResult> valueEntry : values.entrySet()) {
          String valueName = valueEntry.getKey().getFirst();
          String currency = getCurrency(targetSpec.getUniqueId(), targetType);
          s_logger.debug("{} currency returned for id:{} targetType:{}", currency, targetSpec.getUniqueId(), targetType);
          if (currency != null) {
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    }
    if (result == null) {
      throw new OpenGammaRuntimeException("Cash flow view failed to run");
    }
    final PortfolioPaymentDiary paymentDiary = new PortfolioPaymentDiary();
    final ViewCalculationResultModel calcResults = result.getCalculationResult(CALC_CONFIG_NAME);
    if (calcResults == null) {
      throw new OpenGammaRuntimeException("No payments were calculated");
    }
    for (final ComputationTargetSpecification targetSpec : calcResults.getAllTargets()) {
      if (!targetSpec.getType().isTargetType(ComputationTargetType.POSITION)) {
        continue;
      }
      final UniqueId positionId = targetSpec.getUniqueId();
      final Position position = getPositionSource().getPosition(positionId);
      position.getSecurityLink().resolve(getSecuritySource());
      for (final ComputedValueResult targetResult : calcResults.getValues(targetSpec).values()) {
        final String valueName = targetResult.getSpecification().getValueName();
        final PaymentType paymentType = getPaymentType(valueName);
        final PaymentDirection direction = getPaymentDirection(valueName);
        switch (paymentType) {
          case FIXED:
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    if (_resultModel == null || calcConfigName == null || requirementName == null) {
      s_logger.warn("Unhandled column {}", column);
      return UNAVAILABLE_VALUE;
    }

    ViewCalculationResultModel calcResultModel = _resultModel.getCalculationResult(calcConfigName);
    Map<Pair<String, ValueProperties>, ComputedValueResult> values = calcResultModel.getValues(targetSpec);
    if (values == null) {
      s_logger.debug("No values available for {}", targetSpec);
      return UNAVAILABLE_VALUE;
    }
    // TODO 2011-06-15 -- support value name AND value properties so that the required value can be looked up directly
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

      if (!mapNames.containsKey(target)) {
        mapNames.put(target, new HashMap<Pair<String, ValueProperties>, ComputedValueResult>());
      }
      mapNames.get(target).put(Pair.of(value.getSpecification().getValueName(), value.getSpecification().getProperties()), value);
    }
    return new ViewCalculationResultModel() {
     
      @Override
      public Collection<ComputationTargetSpecification> getAllTargets() {
        return mapNames.keySet();
      }
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    if (previousResult != null) {
      deltaModel.setPreviousCalculationTime(previousResult.getCalculationTime());
    }
    for (String calcConfigName : result.getCalculationConfigurationNames()) {
      final DeltaDefinition deltaDefinition = viewDefinition.getCalculationConfiguration(calcConfigName).getDeltaDefinition();
      final ViewCalculationResultModel resultCalcModel = result.getCalculationResult(calcConfigName);
      final ViewCalculationResultModel previousCalcModel = previousResult != null ? previousResult.getCalculationResult(calcConfigName) : null;
      for (ComputationTargetSpecification targetSpec : resultCalcModel.getAllTargets()) {
        computeDeltaModel(deltaDefinition, deltaModel, targetSpec, calcConfigName, previousCalcModel, resultCalcModel);
      }
    }
    return deltaModel;
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    destination.setViewCycleId(source.getViewCycleId());
    destination.setViewProcessId(source.getViewProcessId());
   
    for (ComputationTargetSpecification targetSpec : source.getAllTargets()) {
      for (String calcConfigName : source.getCalculationConfigurationNames()) {
        ViewCalculationResultModel resultCalcModel = source.getCalculationResult(calcConfigName);
        Collection<ComputedValueResult> resultValues = resultCalcModel.getAllValues(targetSpec);
        if (resultValues == null) {
          continue;
        }
        for (ComputedValueResult result : resultValues) {
          destination.addValue(calcConfigName, result);
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

    setViewCycleExecutionOptions(delta.getViewCycleExecutionOptions());
    setCalculationTime(delta.getCalculationTime());
    setCalculationDuration(delta.getCalculationDuration());
    setVersionCorrection(delta.getVersionCorrection());
    for (String calculationConfiguration : delta.getCalculationConfigurationNames()) {
      final ViewCalculationResultModel deltaConfigResults = delta.getCalculationResult(calculationConfiguration);
      ViewCalculationResultModelImpl calcConfigResults = _resultsByConfiguration.get(calculationConfiguration);
      if (calcConfigResults == null) {
        calcConfigResults = new ViewCalculationResultModelImpl();
        _resultsByConfiguration.put(calculationConfiguration, calcConfigResults);
      }
      for (ComputationTargetSpecification target : deltaConfigResults.getAllTargets()) {
        for (ComputedValueResult value : deltaConfigResults.getAllValues(target)) {
          calcConfigResults.addValue(target, value);
          ViewTargetResultModelImpl targetResults = _resultsByTarget.get(target);
          if (targetResults == null) {
            targetResults = new ViewTargetResultModelImpl();
            _resultsByTarget.put(target, targetResults);
View Full Code Here

Examples of com.opengamma.engine.view.ViewCalculationResultModel

          keys.add(key);
        } else {
          configurationMap.put(key, values.remove());
        }
      } else if (field.getOrdinal() == 2) {
        final ViewCalculationResultModel value = deserializer.fieldValueToObject(ViewCalculationResultModel.class, field);
        if (keys.isEmpty()) {
          values.add(value);
        } else {
          configurationMap.put(keys.remove(), value);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.