Examples of OrganizationHistoryResult


Examples of com.opengamma.master.orgs.OrganizationHistoryResult

  @Test
  public void test_history_versionsTo_preFirst() {
    ObjectId oid = ObjectId.of("DbOrg", "201");
    OrganizationHistoryRequest request = new OrganizationHistoryRequest(oid);
    request.setVersionsToInstant(_version1Instant.minusSeconds(5));
    OrganizationHistoryResult test = _orgMaster.history(request);

    assertEquals(0, test.getPaging().getTotalItems());

    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

  @Test
  public void test_history_versionsTo_firstToSecond() {
    ObjectId oid = ObjectId.of("DbOrg", "201");
    OrganizationHistoryRequest request = new OrganizationHistoryRequest(oid);
    request.setVersionsToInstant(_version1Instant.plusSeconds(5));
    OrganizationHistoryResult test = _orgMaster.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.orgs.OrganizationHistoryResult

  @Test
  public void test_history_versionsTo_postSecond() {
    ObjectId oid = ObjectId.of("DbOrg", "201");
    OrganizationHistoryRequest request = new OrganizationHistoryRequest(oid);
    request.setVersionsToInstant(_version2Instant.plusSeconds(5));
    OrganizationHistoryResult test = _orgMaster.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.orgs.OrganizationHistoryResult

    assertEquals(base.getCorrectionFromInstant(), old.getCorrectionFromInstant());
    assertEquals(now, old.getCorrectionToInstant())// old version ended
    assertEquals(base.getOrganization(), old.getOrganization());

    OrganizationHistoryRequest search = new OrganizationHistoryRequest(base.getUniqueId(), now, null);
    OrganizationHistoryResult searchResult = _orgMaster.history(search);
    assertEquals(2, searchResult.getDocuments().size());
  }
View Full Code Here

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

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

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

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

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

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

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

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

  //-------------------------------------------------------------------------
  @Produces(MediaType.TEXT_HTML)
  @GET
  public String getHTML() {
    OrganizationHistoryRequest request = new OrganizationHistoryRequest(data().getOrganization().getUniqueId());
    OrganizationHistoryResult result = data().getOrganizationMaster().history(request);
   
    FlexiBean out = createRootData();
    out.put("versionsResult", result);
    out.put("versions", result.getOrganizations());
    return getFreemarker().build(HTML_DIR + "organizationversions.ftl", out);
  }
View Full Code Here

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

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

Examples of com.opengamma.master.orgs.OrganizationHistoryResult

      OrganizationDocument doc = data().getOrganizationMaster().get(oid);
      data().setOrganization(doc);
    } catch (DataNotFoundException ex) {
      OrganizationHistoryRequest historyRequest = new OrganizationHistoryRequest(oid);
      historyRequest.setPagingRequest(PagingRequest.ONE);
      OrganizationHistoryResult historyResult = data().getOrganizationMaster().history(historyRequest);
      if (historyResult.getDocuments().size() == 0) {
        return null;
      }
      data().setOrganization(historyResult.getFirstDocument());
    }
    return new WebOrganizationResource(this);
  }
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.