Package com.opengamma.id

Examples of com.opengamma.id.VersionCorrection


    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getPagingRequest(), "request.pagingRequest");
    ArgumentChecker.notNull(request.getVersionCorrection(), "request.versionCorrection");
    s_logger.debug("search {}", request);
   
    final VersionCorrection vc = request.getVersionCorrection().withLatestFixed(now());
    final MarketDataSnapshotSearchResult result = new MarketDataSnapshotSearchResult(vc);
   
    final List<ObjectId> snapshotIds = request.getSnapshotIds();
    if (snapshotIds != null && snapshotIds.size() == 0) {
      result.setPaging(Paging.of(request.getPagingRequest(), 0));
      return result;
    }
   
    final DbMapSqlParameterSource args = new DbMapSqlParameterSource();
    args.addTimestamp("version_as_of_instant", vc.getVersionAsOf());
    args.addTimestamp("corrected_to_instant", vc.getCorrectedTo());
    args.addValueNullIgnored("name", getDialect().sqlWildcardAdjustValue(request.getName()));
    args.addValue("details", request.isIncludeData());
    if (snapshotIds != null) {
      StringBuilder buf = new StringBuilder(snapshotIds.size() * 10);
      for (ObjectId snapshotId : snapshotIds) {
View Full Code Here


    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getPagingRequest(), "request.pagingRequest");
    ArgumentChecker.notNull(request.getVersionCorrection(), "request.versionCorrection");
    s_logger.debug("search {}", request);

    final VersionCorrection vc = request.getVersionCorrection().withLatestFixed(now());
    final PortfolioSearchResult result = new PortfolioSearchResult(vc);

    final List<ObjectId> portfolioObjectIds = request.getPortfolioObjectIds();
    final List<ObjectId> nodeObjectIds = request.getNodeObjectIds();
    if ((portfolioObjectIds != null && portfolioObjectIds.size() == 0) ||
        (nodeObjectIds != null && nodeObjectIds.size() == 0)) {
      result.setPaging(Paging.of(request.getPagingRequest(), 0));
      return result;
    }

    final DbMapSqlParameterSource args = new DbMapSqlParameterSource()
        .addTimestamp("version_as_of_instant", vc.getVersionAsOf())
        .addTimestamp("corrected_to_instant", vc.getCorrectedTo())
        .addValueNullIgnored("name", getDialect().sqlWildcardAdjustValue(request.getName()));
    if (request.getDepth() >= 0) {
      args.addValue("depth", request.getDepth());
    }
    if (portfolioObjectIds != null) {
View Full Code Here

  }

  @GET
  @Path("currencyMatricesByName/{versionCorrection}/{name}")
  public Response getMatrixByName(@PathParam("name") String name, @PathParam("versionCorrection") String versionCorrectionStr) {
    final VersionCorrection versionCorrection = VersionCorrection.parse(versionCorrectionStr);
    CurrencyMatrix result = getCurrencyMatrixSource().getCurrencyMatrix(name, versionCorrection);
    return responseOkFudge(result);
  }
View Full Code Here

  @GET
  @Path("currencyMatrices/{objectId}/{versionCorrection}")
  public Response getMatrixByObjectIdentifier(@PathParam("objectId") String objectIdStr, @PathParam("versionCorrection") String versionCorrectionStr) {
    final ObjectId objectId = ObjectId.parse(objectIdStr);
    final VersionCorrection versionCorrection = VersionCorrection.parse(versionCorrectionStr);
    final CurrencyMatrix result = getCurrencyMatrixSource().get(objectId, versionCorrection);
    return responseOkFudge(result);
  }
View Full Code Here

    return new DependencyGraphTraceProviderResource(_provider, _fudgeContext, properties);
  }

  @Path("resolutionTime/{resolutionTime}")
  public DependencyGraphTraceProviderResource setResolutionTime(@PathParam("resolutionTime") final String resolutionTime) {
    VersionCorrection parsedResolutionTime = VersionCorrection.parse(resolutionTime);
    DependencyGraphTraceBuilderProperties properties = _properties.resolutionTime(parsedResolutionTime);
    return new DependencyGraphTraceProviderResource(_provider, _fudgeContext, properties);
  }
View Full Code Here

    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getPagingRequest(), "request.pagingRequest");
    ArgumentChecker.notNull(request.getVersionCorrection(), "request.versionCorrection");
    s_logger.debug("search {}", request);
   
    final VersionCorrection vc = request.getVersionCorrection().withLatestFixed(now());
    final OrganizationSearchResult result = new OrganizationSearchResult(vc);
   

    final List<ObjectId> organizationObjectIds = request.getOrganizationObjectIds();
    if (organizationObjectIds != null && organizationObjectIds.size() == 0) {
      result.setPaging(Paging.of(request.getPagingRequest(), 0));
      return result;
    }
   
    final DbMapSqlParameterSource args = new DbMapSqlParameterSource()
        .addTimestamp("version_as_of_instant", vc.getVersionAsOf())
        .addTimestamp("corrected_to_instant", vc.getCorrectedTo())
        .addValueNullIgnored("obligor_short_name", getDialect().sqlWildcardAdjustValue(request.getObligorShortName()))
        .addValueNullIgnored("obligor_red_code", getDialect().sqlWildcardAdjustValue(request.getObligorREDCode()))
        .addValueNullIgnored("obligor_ticker", getDialect().sqlWildcardAdjustValue(request.getObligorTicker()));
    args.addValue("paging_offset", request.getPagingRequest().getFirstItem());
    args.addValue("paging_fetch", request.getPagingRequest().getPagingSize());
View Full Code Here

    List<MarketDataSpecification> marketData = properties.getMarketData();
    if (marketData != null) {
      uri = DependencyGraphTraceProviderResource.uriMarketData(uri, marketData);
    }

    VersionCorrection resolutionTime = properties.getResolutionTime();
    uri = DependencyGraphTraceProviderResource.uriResolutionTime(uri, resolutionTime);

    Instant valuationTime = properties.getValuationTime();
    if (valuationTime != null) {
      uri = DependencyGraphTraceProviderResource.uriValuationTime(uri, valuationTime);
View Full Code Here

    } else {
      paramValues = null;
    }
    String simulationScript = getCommandLine().getOptionValue(SIMULATION_SCRIPT_OPTION);
    Simulation simulation = SimulationUtils.createSimulationFromDsl(simulationScript, paramValues);
    VersionCorrection viewDefVersionCorrection = VersionCorrection.LATEST;
    Collection<ConfigItem<ViewDefinition>> viewDefs =
        configSource.get(ViewDefinition.class, viewDefName, viewDefVersionCorrection);
    if (viewDefs.isEmpty()) {
      throw new IllegalStateException("View definition " + viewDefName + " not found");
    }
View Full Code Here

  public void testGetVersionCorrection() {
    final ComputationTargetResolver.AtVersionCorrection underlying = Mockito.mock(ComputationTargetResolver.AtVersionCorrection.class);
    final ConcurrentMap<ComputationTargetReference, UniqueId> resolutions = new ConcurrentHashMap<ComputationTargetReference, UniqueId>();
    final Set<UniqueId> expiredResolutions = new HashSet<UniqueId>();
    final ComputationTargetResolver.AtVersionCorrection resolver = TargetResolutionLogger.of(underlying, resolutions, expiredResolutions);
    final VersionCorrection vc = VersionCorrection.of(Instant.now(), Instant.now());
    Mockito.when(underlying.getVersionCorrection()).thenReturn(vc);
    assertSame(resolver.getVersionCorrection(), vc);
  }
View Full Code Here

    final EHCachingPositionSource cache = new EHCachingPositionSource(Mockito.mock(PositionSource.class), _cacheManager);
    try {
      // Add two unrelated portfolios; both to be added and returned
      final PortfolioNode root1 = createPortfolioA1();
      final PortfolioNode root2 = createPortfolioB();
      final VersionCorrection vc = VersionCorrection.of(Instant.now(), Instant.now());
      assertSame(cache.addToFrontCache(root1, vc), root1);
      assertSame(cache.addToFrontCache(root2, vc), root2);
    } finally {
      cache.shutdown();
    }
View Full Code Here

TOP

Related Classes of com.opengamma.id.VersionCorrection

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.