Examples of MarketDataSnapshotHistoryResult


Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    return doGetByOidInstants(objectId, versionCorrection, new MarketDataSnapshotDocumentExtractor(true), "MarketDataSnapshot");
  }

  //-------------------------------------------------------------------------
  public MarketDataSnapshotHistoryResult history(final MarketDataSnapshotHistoryRequest request) {
    return doHistory(request, new MarketDataSnapshotHistoryResult(), new MarketDataSnapshotDocumentExtractor(request.isIncludeData()));
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    }
    if (searchResult.getDocuments().size() == 0) {
      return Collections.emptyList();
    }
    ObjectId objectId = searchResult.getFirstDocument().getObjectId();
    MarketDataSnapshotHistoryResult historyResult = _snapshotMaster.history(new MarketDataSnapshotHistoryRequest(objectId));
    List<VersionInfo> results = new ArrayList<>();
    for (MarketDataSnapshotDocument doc : historyResult.getDocuments()) {
      results.add(new VersionInfo(doc.getVersionFromInstant(), doc.getCorrectionFromInstant(), doc.getVersionToInstant(), doc.getCorrectionToInstant(), doc.getUniqueId()));
    }
    return results;
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("{snapshotId}")
  public String getMarketDataSnapshotHistory(@PathParam("snapshotId") String snapshotId) {
    ObjectId id = ObjectId.parse(snapshotId);
    MarketDataSnapshotHistoryResult result = _snapshotMaster.history(new MarketDataSnapshotHistoryRequest(id));
    List<MarketDataSnapshotDocument> documents = result.getDocuments();
    List<Map<String, Object>> json = Lists.newArrayListWithCapacity(documents.size());
    for (MarketDataSnapshotDocument document : documents) {
      Map<String, Object> map = Maps.newHashMapWithExpectedSize(5);
      map.put("uniqueId", document.getUniqueId());
      map.put("versionFrom", document.getVersionFromInstant());
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    String snapshotIdString = (String) data.get("snapshotId");
    UniqueId snapshotId = UniqueId.parse(snapshotIdString);

    MarketDataSnapshotHistoryRequest snapshotHistoryRequest = new MarketDataSnapshotHistoryRequest(snapshotId.getObjectId(), null, Instant.now());
    snapshotHistoryRequest.setIncludeData(false);
    MarketDataSnapshotHistoryResult snapshotSearchResult = _snapshotMaster.history(snapshotHistoryRequest);

    String[][] versions = new String[snapshotSearchResult.getDocuments().size()][2];
    int i = 0;
    for (MarketDataSnapshotDocument doc : snapshotSearchResult.getDocuments()) {
      ZonedDateTime snapshotDateTime = ZonedDateTime.ofInstant(doc.getVersionFromInstant(), ZoneOffset.UTC);
      versions[i][0] = doc.getUniqueId().toString();
      versions[i][1] = snapshotDateTime.toString(s_snapshotDateTimeFormatter);
      i++;
    }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getObjectId(), "request.objectId");
    validateObjectId(request.getObjectId());
    final MarketDataSnapshotDocument doc = _store.get(request.getObjectId());
    final List<MarketDataSnapshotDocument> list = (doc != null) ? Collections.singletonList(doc) : Collections.<MarketDataSnapshotDocument>emptyList();
    final MarketDataSnapshotHistoryResult result = new MarketDataSnapshotHistoryResult();
    result.setPaging(Paging.of(request.getPagingRequest(), list));
    result.getDocuments().addAll(list);
    return result;
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    // Create the history search cache and register a marketDataSnapshot master searcher
    _historySearchCache = new EHCachingSearchCache(name + "MarketDataSnapshotHistory", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        MarketDataSnapshotHistoryResult result = ((MarketDataSnapshotMaster) getUnderlying()).history((MarketDataSnapshotHistoryRequest)
            EHCachingSearchCache.withPagingRequest(request, pagingRequest));

        // Cache the result documents
        EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());

        // Return the list of result UniqueIds
        return new ObjectsPair<>(result.getPaging().getTotalItems(),
                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Prime document search cache
    MarketDataSnapshotSearchRequest defaultSearch = new MarketDataSnapshotSearchRequest();
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

    List<MarketDataSnapshotDocument> documents = new ArrayList<>();
    for (UniqueId uniqueId : pair.getSecond()) {
      documents.add(get(uniqueId));
    }

    MarketDataSnapshotHistoryResult result = new MarketDataSnapshotHistoryResult(documents);
    result.setPaging(Paging.of(request.getPagingRequest(), pair.getFirst()));
    return result;
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

        throw new IllegalArgumentException("Document objectId " + request.getObjectId() + " does not match URI " + getUrlId());
      }
    } else {
      request.setObjectId(getUrlId());
    }
    MarketDataSnapshotHistoryResult result = getMaster().history(request);
    return responseOkFudge(result);
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

  }

  public void test_history_emptyMaster() {
    MarketDataSnapshotHistoryRequest request = new MarketDataSnapshotHistoryRequest();
    request.setObjectId(_doc1.getUniqueId().getObjectId());
    MarketDataSnapshotHistoryResult result = _testEmpty.history(request);
    assertEquals(0, result.getPaging().getTotalItems());
    assertEquals(0, result.getDocuments().size());
  }
View Full Code Here

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotHistoryResult

  }

  public void test_history_populatedMaster() {
    MarketDataSnapshotHistoryRequest request = new MarketDataSnapshotHistoryRequest();
    request.setObjectId(_doc1.getUniqueId().getObjectId());
    MarketDataSnapshotHistoryResult result = _testPopulated.history(request);
    assertEquals(1, result.getPaging().getTotalItems());
    assertEquals(1, result.getDocuments().size());
  }
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.