Package com.opengamma.id

Examples of com.opengamma.id.ExternalIdBundle


            } else {
              // Null - special case
              requirementTarget = targetSpec;
            }
          } else if (constraintValues.contains(TARGET_SPECIFICATION_EXTERNAL)) {
            final ExternalIdBundle identifiers;
            if (target.getValue() instanceof ExternalIdentifiable) {
              final ExternalId identifier = ((ExternalIdentifiable) target.getValue()).getExternalId();
              if (identifier == null) {
                identifiers = ExternalIdBundle.EMPTY;
              } else {
View Full Code Here


  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final TempTarget tempTargetObject = OpenGammaCompilationContext.getTempTargets(context).get(inputs.keySet().iterator().next().getTargetSpecification().getUniqueId());
    if (tempTargetObject instanceof HistoricalViewEvaluationTarget) {
      final HistoricalViewEvaluationTarget historicalTarget = (HistoricalViewEvaluationTarget) tempTargetObject;
      final ViewCalculationConfiguration calcConfig = historicalTarget.getViewDefinition().getCalculationConfiguration(context.getViewCalculationConfiguration().getName());
      final ExternalIdBundle targetEids;
      if (target.getValue() instanceof ExternalIdentifiable) {
        targetEids = ((ExternalIdentifiable) target.getValue()).getExternalId().toBundle();
      } else if (target.getValue() instanceof ExternalBundleIdentifiable) {
        targetEids = ((ExternalBundleIdentifiable) target.getValue()).getExternalIdBundle();
      } else {
        targetEids = null;
      }
      final ComputationTargetSpecification targetSpec = target.toSpecification();
      final ComputationTargetReference targetContextSpec = target.getContextSpecification();
      final ComputationTargetReferenceVisitor<Set<String>> getTargetType = new ComputationTargetReferenceVisitor<Set<String>>() {

        @Override
        public Set<String> visitComputationTargetRequirement(final ComputationTargetRequirement requirement) {
          if (target.getUniqueId() == null) {
            if (requirement.getIdentifiers().isEmpty()) {
              if (ObjectUtils.equals(requirement.getParent(), targetContextSpec)) {
                // Null target can be referenced by anything
                return ImmutableSet.of(TARGET_SPECIFICATION_OBJECT, TARGET_SPECIFICATION_UNIQUE, TARGET_SPECIFICATION_EXTERNAL);
              }
            }
          } else {
            if ((targetEids != null) && targetEids.equals(requirement.getIdentifiers())) {
              if (ObjectUtils.equals(requirement.getParent(), targetContextSpec)) {
                // Our target
                return Collections.singleton(TARGET_SPECIFICATION_EXTERNAL);
              }
            }
View Full Code Here

  }

  @Override
  public CommodityFutureOptionDefinition<?, ?> visitCommodityFutureOptionSecurity(final CommodityFutureOptionSecurity commodityOption) {
    ArgumentChecker.notNull(commodityOption, "security");
    final ExternalIdBundle underlyingBundle = ExternalIdBundle.of(commodityOption.getUnderlyingId());
    final CommodityFutureSecurity underlyingSecurity = (CommodityFutureSecurity) _securitySource.getSingle(underlyingBundle);
    if (underlyingSecurity == null) {
      throw new OpenGammaRuntimeException("No underlying future found with identifier " + commodityOption.getUnderlyingId());
    }
View Full Code Here

    _positions = positions;
    _securities = securities;
  }

  private ExternalIdBundle getBundle(final ManageableSecurity security) {
    final ExternalIdBundle bundle = security.getExternalIdBundle();
    final ExternalId identifier = bundle.getExternalId(_security);
    if (identifier != null) {
      return identifier.toBundle();
    } else {
      return bundle;
    }
View Full Code Here

  private BarrierType barrierType() {
    return select(BarrierType.values());
  }

  private BondFutureDeliverable bondFutureDeliverable() {
    final ExternalIdBundle identifiers;
    switch (select(2)) {
      case 0:
        identifiers = createCorporateBondSecurity().getExternalIdBundle();
        break;
      case 1:
View Full Code Here

  }
 
  public void getExternalIdBundle_UniqueId() {
    ExternalId djxTicker = ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "DJX Index");
    ExternalId djxBUID = ExternalId.of(ExternalSchemes.BLOOMBERG_BUID, "EI09JDX");
    ExternalIdBundle idBundle = ExternalIdBundle.of(djxTicker, djxBUID);
   
    when(_underlyingSource.getExternalIdBundle(UID)).thenReturn(idBundle);
   
    // Fetching same series twice should return same result
    ExternalIdBundle bundle1 = _cachingSource.getExternalIdBundle(UID);
    ExternalIdBundle bundle2 = _cachingSource.getExternalIdBundle(UID);
    assertEquals(idBundle, bundle1);
    assertEquals(idBundle, bundle2);
    assertEquals(bundle1, bundle2);
   
    // underlying source should only have been called once if cache worked as expected
View Full Code Here

  @Path("htsMeta/externalIdBundle/{htsId}")
  public Response getExternalIdBundle(
      @PathParam("htsId") String idStr,
      @QueryParam("version") String version) {
    final UniqueId uniqueId = ObjectId.parse(idStr).atVersion(version);
    final ExternalIdBundle idBundle = getHistoricalTimeSeriesSource().getExternalIdBundle(uniqueId);
    return responseOkFudge(idBundle);
  }
View Full Code Here

      @QueryParam("start") String startStr,
      @QueryParam("includeStart"boolean includeStart,
      @QueryParam("end") String endStr,
      @QueryParam("includeEnd") boolean includeEnd,
      @QueryParam("maxPoints") Integer maxPoints) {
    final ExternalIdBundle bundle = ExternalIdBundle.parse(idStrs);
    final LocalDate start = (startStr != null ? LocalDate.parse(startStr) : null);
    final LocalDate end = (endStr != null ? LocalDate.parse(endStr) : null);
    final HistoricalTimeSeries result;
    if (idValidityDateStr != null) {
      final LocalDate idValidityDate = ("ALL".equals(idValidityDateStr) ? null : LocalDate.parse(idValidityDateStr));
View Full Code Here

      @QueryParam("start") String startStr,
      @QueryParam("includeStart"boolean includeStart,
      @QueryParam("end") String endStr,
      @QueryParam("includeEnd") boolean includeEnd,
      @QueryParam("maxPoints") Integer maxPoints) {
    final ExternalIdBundle bundle = ExternalIdBundle.parse(idStrs);
    final LocalDate start = (startStr != null ? LocalDate.parse(startStr) : null);
    final LocalDate end = (endStr != null ? LocalDate.parse(endStr) : null);
    final HistoricalTimeSeries result;
    if (idValidityDateStr != null) {
      final LocalDate idValidityDate = ("ALL".equals(idValidityDateStr) ? null : LocalDate.parse(idValidityDateStr));
View Full Code Here

      String idScheme = tokens[i].trim();
      String idValue = tokens[++i].trim();
      ExternalId id = ExternalId.of(idScheme, idValue);
      securityIdentifiers.add(id);
    }
    ExternalIdBundle securityKey = ExternalIdBundle.of(securityIdentifiers);
    s_logger.debug("Loaded position: {} in {}", quantity, securityKey);
   
    return new SimplePosition(positionId, quantity, securityKey);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.id.ExternalIdBundle

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.