Examples of ViewTargetResultModel


Examples of com.opengamma.engine.view.ViewTargetResultModel

    for (ComputationTargetSpecification target : result.getAllTargets()) {
      final int[] rowIds = getGridStructure().getRowIds(target);
      if (rowIds == null) {
        continue;
      }
      ViewTargetResultModel resultModel = result.getTargetResult(target);
      for (int rowId : rowIds) {
        String[] values = new String[columnCount];
        supplementCsvRowData(rowId, target, values);
        rows[rowId] = values;
        for (String calcConfigName : resultModel.getCalculationConfigurationNames()) {
          for (ComputedValue value : resultModel.getAllValues(calcConfigName)) {
            Object originalValue = value.getValue();
            if (originalValue == null) {
              continue;
            }
            ValueSpecification specification = value.getSpecification();
View Full Code Here

Examples of com.opengamma.engine.view.ViewTargetResultModel

      ComputationTargetSpecification nodeSpec = null;
      // [PLAT-2286] This is a hack to almost support trivial nesting, e.g. for the PositionWeight function. Recognition of complex target types needs doing properly.
      final ComputationTargetSpecification[] targets = getPortfolioGrid().getGridStructure().getTargets();
      for (int i = 0; i < targets.length; i++) {
        final ComputationTargetSpecification target = targets[i];
        ViewTargetResultModel targetResult = resultModel.getTargetResult(target);
        if (target.getType().isTargetType(ComputationTargetType.PORTFOLIO_NODE)) {
          nodeSpec = target;
        } else if ((nodeSpec != null) && target.getType().isTargetType(ComputationTargetType.POSITION)) {
          final ViewTargetResultModel scopedResult = resultModel.getTargetResult(nodeSpec.containing(ComputationTargetType.POSITION, target.getUniqueId()));
          if (scopedResult != null) {
            if (targetResult != null) {
              final Map<String, Collection<ComputedValueResult>> newResult = new HashMap<String, Collection<ComputedValueResult>>();
              for (final String calcConfig : targetResult.getCalculationConfigurationNames()) {
                newResult.put(calcConfig, new ArrayList<ComputedValueResult>(targetResult.getAllValues(calcConfig)));
              }
              for (final String calcConfig : scopedResult.getCalculationConfigurationNames()) {
                final Collection<ComputedValueResult> scopedValues = scopedResult.getAllValues(calcConfig);
                Collection<ComputedValueResult> values = newResult.get(calcConfig);
                if (values == null) {
                  values = new ArrayList<ComputedValueResult>(scopedValues.size());
                  newResult.put(calcConfig, values);
                }
                for (final ComputedValueResult value : scopedValues) {
                  values.add(new ComputedValueResult(new ValueSpecification(value.getSpecification().getValueName(), target, value.getSpecification().getProperties()), value.getValue(), value
                      .getAggregatedExecutionLog()));
                }
              }
              targetResult = new ViewTargetResultModel() {

                @Override
                public Collection<String> getCalculationConfigurationNames() {
                  return newResult.keySet();
                }
View Full Code Here

Examples of com.opengamma.engine.view.ViewTargetResultModel

    recalcThread.join();
    resultListener.assertCycleCompleted(TIMEOUT);

    final Map<String, Object> resultValues = new HashMap<String, Object>();
    final ViewComputationResultModel result = client.getLatestResult();
    final ViewTargetResultModel targetResult = result.getTargetResult(ViewProcessorTestEnvironment.getPrimitiveTarget());
    for (final ComputedValue computedValue : targetResult.getAllValues(ViewProcessorTestEnvironment.TEST_CALC_CONFIG_NAME)) {
      resultValues.put(computedValue.getSpecification().getValueName(), computedValue.getValue());
    }

    assertEquals(123d, resultValues.get(ViewProcessorTestEnvironment.getPrimitive1().getValueName()));
    assertEquals(456d, resultValues.get(ViewProcessorTestEnvironment.getPrimitive2().getValueName()));
View Full Code Here

Examples of com.opengamma.engine.view.ViewTargetResultModel

    resultListener.assertCycleCompleted(TIMEOUT);
    resultListener.assertProcessCompleted(TIMEOUT);

    final Map<String, Object> resultValues = new HashMap<String, Object>();
    final ViewComputationResultModel result = client.getLatestResult();
    final ViewTargetResultModel targetResult = result.getTargetResult(ViewProcessorTestEnvironment.getPrimitiveTarget());
    for (final ComputedValue computedValue : targetResult.getAllValues(ViewProcessorTestEnvironment.TEST_CALC_CONFIG_NAME)) {
      resultValues.put(computedValue.getSpecification().getValueName(), computedValue.getValue());
    }
    assertEquals(MissingInput.MISSING_MARKET_DATA, resultValues.get(ViewProcessorTestEnvironment.getPrimitive1().getValueName()));
    assertEquals(MissingInput.MISSING_MARKET_DATA, resultValues.get(ViewProcessorTestEnvironment.getPrimitive2().getValueName()));
  }
View Full Code Here

Examples of com.opengamma.engine.view.ViewTargetResultModel

    }
  }
 
  private Map<String, Object> extractResults(ViewComputationResultModel result) {
    Map<String, Object> resultValues = new HashMap<String, Object>();
    ViewTargetResultModel targetResult = result.getTargetResult(ViewProcessorTestEnvironment.getPrimitiveTarget());
    for (final ComputedValue computedValue : targetResult.getAllValues(ViewProcessorTestEnvironment.TEST_CALC_CONFIG_NAME)) {
      resultValues.put(computedValue.getSpecification().getValueName(), computedValue.getValue());
    }
    return resultValues;
  }
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.