Examples of HolidayHistoryResult


Examples of com.opengamma.master.holiday.HolidayHistoryResult

  @Test
  public void test_history_versionsTo_firstToSecond() {
    ObjectId oid = ObjectId.of("DbHol", "201");
    HolidayHistoryRequest request = new HolidayHistoryRequest(oid);
    request.setVersionsToInstant(_version1Instant.plusSeconds(5));
    HolidayHistoryResult test = _holMaster.history(request);
   
    assertEquals(1, test.getPaging().getTotalItems());
   
    assertEquals(1, test.getDocuments().size());
    assert201(test.getDocuments().get(0));
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

  @Test
  public void test_history_versionsTo_postSecond() {
    ObjectId oid = ObjectId.of("DbHol", "201");
    HolidayHistoryRequest request = new HolidayHistoryRequest(oid);
    request.setVersionsToInstant(_version2Instant.plusSeconds(5));
    HolidayHistoryResult test = _holMaster.history(request);
   
    assertEquals(2, test.getPaging().getTotalItems());
   
    assertEquals(2, test.getDocuments().size());
    assert202(test.getDocuments().get(0));
    assert201(test.getDocuments().get(1));
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

    assertEquals(base.getCorrectionFromInstant(), old.getCorrectionFromInstant());
    assertEquals(base.getCorrectionToInstant(), old.getCorrectionToInstant());
    assertEquals(base.getHoliday(), old.getHoliday());
   
    HolidayHistoryRequest search = new HolidayHistoryRequest(base.getUniqueId(), null, now);
    HolidayHistoryResult searchResult = _holMaster.history(search);
    assertEquals(2, searchResult.getDocuments().size());
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

  }

  //-------------------------------------------------------------------------
  @Override
  public HolidayHistoryResult history(final HolidayHistoryRequest request) {
    return doHistory(request, new HolidayHistoryResult(), new HolidayDocumentExtractor());
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

      @QueryParam("pgNum") Integer pgNum,
      @QueryParam("pgSze") Integer pgSze) {
    PagingRequest pr = buildPagingRequest(pgIdx, pgNum, pgSze);
    HolidayHistoryRequest request = new HolidayHistoryRequest(data().getHoliday().getUniqueId());
    request.setPagingRequest(pr);
    HolidayHistoryResult result = data().getHolidayMaster().history(request);
   
    FlexiBean out = createRootData();
    out.put("versionsResult", result);
    out.put("versions", result.getHolidays());
    out.put("paging", new WebPaging(result.getPaging(), data().getUriInfo()));
    String json = getFreemarker().build(JSON_DIR + "holidayversions.ftl", out);
    return Response.ok(json).build();
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

      HolidayDocument doc = data().getHolidayMaster().get(oid);
      data().setHoliday(doc);
    } catch (DataNotFoundException ex) {
      HolidayHistoryRequest historyRequest = new HolidayHistoryRequest(oid);
      historyRequest.setPagingRequest(PagingRequest.ONE);
      HolidayHistoryResult historyResult = data().getHolidayMaster().history(historyRequest);
      if (historyResult.getDocuments().size() == 0) {
        return null;
      }
      data().setHoliday(historyResult.getFirstDocument());
    }
    return new WebHolidayResource(this);
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

  public Response history(@Context UriInfo uriInfo) {
    HolidayHistoryRequest request = RestUtils.decodeQueryParams(uriInfo, HolidayHistoryRequest.class);
    if (getUrlId().equals(request.getObjectId()) == false) {
      throw new IllegalArgumentException("Document objectId does not match URI");
    }
    HolidayHistoryResult result = getMaster().history(request);
    return responseOkFudge(result);
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

    // Create the history search cache and register a security master searcher
    _historySearchCache = new EHCachingSearchCache(name + "HolidayHistory", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        HolidayHistoryResult result = ((HolidayMaster) getUnderlying()).history((HolidayHistoryRequest)
            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 search cache
    HolidaySearchRequest defaultSearch = new HolidaySearchRequest();
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayHistoryResult

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

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

Examples of com.opengamma.master.holiday.HolidayHistoryResult

  @Override
  public HolidayHistoryResult history(final HolidayHistoryRequest request) {
    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getObjectId(), "request.objectId");

    final HolidayHistoryResult result = new HolidayHistoryResult();
    final HolidayDocument doc = get(request.getObjectId(), VersionCorrection.LATEST);
    if (doc != null) {
      result.getDocuments().add(doc);
    }
    result.setPaging(Paging.ofAll(result.getDocuments()));
    return result;
  }
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.