Package com.opengamma.engine.target

Examples of com.opengamma.engine.target.ComputationTargetType


                                ResultsCache cache,
                                Class<?> columnType,
                                Object inlineKey) {
    PortfolioGridRow row = _rows.get(rowIndex);
    ComputationTargetReference target = row.getTarget();
    ComputationTargetType targetType = target.getType();
    // TODO do I need to use the target type to figure out the row type? can I just have different row types?
    if (targetType.isTargetType(ComputationTargetType.POSITION)) {
      RowTarget rowTarget;
      UniqueId securityId = row.getSecurityId();
      ResultsCache.Result securityResult = cache.getEntity(securityId.getObjectId());
      Security security = (Security) securityResult.getValue();
      if (isOtc(security)) {
        // TODO different type for OTC positions with no trades? they are effecively the same but the client
        // needs to know when a position has no trades because it will be a different endpoint to trigger editing
        // OTC trades and positions are shown as a single row as there's always one trade per position
        rowTarget = new OtcTradeTarget(row.getName(), row.getNodeId(), row.getPositionId(), row.getTradeId());
      } else {
        // Positions in fungible trades can contain multiple trades so the position has its own row and child rows
        // for each of its trades
        rowTarget = new PositionTarget(row.getName(), row.getNodeId(), row.getPositionId());
      }
      // TODO check the cache items for the position, security, underlying to find out whether they've been updated
      return ResultsCell.forStaticValue(rowTarget, columnType, format);
    } else if (targetType.isTargetType(ComputationTargetType.PORTFOLIO_NODE)) {
      return ResultsCell.forStaticValue(new NodeTarget(row.getName(), row.getNodeId()), columnType, format);
    } else if (targetType.isTargetType(ComputationTargetType.TRADE)) {
      // only fungible trades have their own row, OTC trades are shown on the same row as their parent position
      FungibleTradeTarget tradeTarget =
          new FungibleTradeTarget(row.getName(), row.getNodeId(), row.getPositionId(), row.getTradeId());
      // TODO check cache item for trade to see if it's been updated
      return ResultsCell.forStaticValue(tradeTarget, columnType, format);
View Full Code Here


    // ComputationTargetReferenceVisitor

    @Override
    public ComputationTargetReference visitComputationTargetRequirement(final ComputationTargetRequirement requirement) {
      final ComputationTargetType leafType = getLeafType(requirement.getType());
      if (leafType != null) {
        return MemoryUtils.instance(new ComputationTargetRequirement(leafType, requirement.getIdentifiers()));
      } else {
        return requirement;
      }
View Full Code Here

    }

    @Override
    public ComputationTargetReference visitComputationTargetSpecification(final ComputationTargetSpecification specification) {
      if ((specification.getUniqueId() != null) && specification.getUniqueId().isLatest()) {
        final ComputationTargetType leafType = getLeafType(specification.getType());
        if (leafType != null) {
          return MemoryUtils.instance(new ComputationTargetSpecification(leafType, specification.getUniqueId()));
        } else {
          return specification;
        }
View Full Code Here

  // DependencyNodeFilter

  @Override
  public boolean accept(final DependencyNode node) {
    final ComputationTargetType nodeType = node.getComputationTarget().getType();
    if (nodeType.isTargetType(ComputationTargetType.PORTFOLIO_NODE)) {
      return !_badNodes.contains(node.getComputationTarget().getUniqueId());
    }
    return !nodeType.isTargetType(ComputationTargetType.PORTFOLIO);
  }
View Full Code Here

   */
  @Deprecated
  private ValueRequirement plat2286Translate(final ValueRequirement valueRequirement) {
    if (valueRequirement.getTargetReference() instanceof ComputationTargetSpecification) {
      final ComputationTargetSpecification targetSpec = valueRequirement.getTargetReference().getSpecification();
      final ComputationTargetType type;
      if (targetSpec.getUniqueId() == null) {
        return valueRequirement;
      }
      if (Currency.OBJECT_SCHEME.equals(targetSpec.getUniqueId().getScheme())) {
        type = ComputationTargetType.CURRENCY;
View Full Code Here

   * @return true if the output value should be included in the results
   */
  public boolean shouldOutputResult(ValueSpecification outputSpecification, DependencyGraph dependencyGraph) {
    ArgumentChecker.notNull(outputSpecification, "outputSpecification");
    ArgumentChecker.notNull(dependencyGraph, "dependencyGraph");
    ComputationTargetType targetType = outputSpecification.getTargetSpecification().getType();
    return getOutputMode(targetType).shouldOutputResult(outputSpecification, dependencyGraph);
  }
View Full Code Here

   *
   * @param dependencyNode  the dependency node, not null
   * @return true if any outputs are produces that should be included in the results
   */
  public boolean shouldOutputFromNode(DependencyNode dependencyNode) {
    ComputationTargetType targetType = dependencyNode.getComputationTarget().getType();
    return getOutputMode(targetType).shouldOutputFromNode(dependencyNode);
  }
View Full Code Here

    }

  };

  public static ComputationTargetReference buildObjectImpl(final FudgeDeserializer deserializer, final FudgeMsg message) {
    ComputationTargetType type = ComputationTargetTypeFudgeBuilder.buildObjectImpl(message);
    final List<ComputationTargetType> types = type.accept(s_getNestedType, null);
    if (types == null) {
      if (message.getByName(IDENTIFIER_FIELD_NAME) == null) {
        return ComputationTargetSpecification.NULL;
      } else {
        return new ComputationTargetRequirement(type, ExternalIdBundle.EMPTY);
View Full Code Here

  }

  @Override
  public boolean canApplyTo(FunctionCompilationContext context, ComputationTarget target) {
    FunctionSignature signature = getFunctionSignature();
    ComputationTargetType ctt = signature.getComputationTargetType();
    Class ctc = signature.getComputationTargetClass();
    if (ctt != null && !target.getType().equals(ctt)) {
      return false;
    }
    if (ctc != null && !ctc.isAssignableFrom(target.getValue().getClass())) {
View Full Code Here

   * Adds a single rule to the resolver. Rules must be added before calling {@link #compileRules} to pre-process them into the data structures used for resolution.
   *
   * @param resolutionRule the rule to add, not null
   */
  public void addRule(ResolutionRule resolutionRule) {
    final ComputationTargetType type = resolutionRule.getParameterizedFunction().getFunction().getTargetType();
    type.accept(s_createChainedRuleBundle, this);
    final Iterable<Collection<ResolutionRule>> rules = _type2Rules.getDirect(type);
    assert rules != null; // s_createChainedRuleBundle should have done this
    final ChainedRuleBundle bundle;
    if (rules instanceof ChainedRuleBundle) {
      bundle = (ChainedRuleBundle) rules;
View Full Code Here

TOP

Related Classes of com.opengamma.engine.target.ComputationTargetType

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.