Package com.opengamma.master.portfolio

Examples of com.opengamma.master.portfolio.PortfolioHistoryResult


  @Test
  public void test_history_versionsTo_preFirst() {
    UniqueId oid = UniqueId.of("DbPrt", "201");
    PortfolioHistoryRequest request = new PortfolioHistoryRequest(oid);
    request.setVersionsToInstant(_version1Instant.minusSeconds(5));
    PortfolioHistoryResult test = _prtMaster.history(request);
   
    assertEquals(0, test.getPaging().getTotalItems());
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here


  @Test
  public void test_history_versionsTo_firstToSecond() {
    UniqueId oid = UniqueId.of("DbPrt", "201");
    PortfolioHistoryRequest request = new PortfolioHistoryRequest(oid);
    request.setVersionsToInstant(_version1Instant.plusSeconds(5));
    PortfolioHistoryResult test = _prtMaster.history(request);
   
    assertEquals(1, test.getPaging().getTotalItems());
   
    assertEquals(1, test.getDocuments().size());
    assert201(test.getDocuments().get(0));
  }
View Full Code Here

  @Test
  public void test_history_versionsTo_postSecond() {
    UniqueId oid = UniqueId.of("DbPrt", "201");
    PortfolioHistoryRequest request = new PortfolioHistoryRequest(oid);
    request.setVersionsToInstant(_version2Instant.plusSeconds(5));
    PortfolioHistoryResult test = _prtMaster.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

        newer.getPortfolio().getRootNode().getUniqueId().toLatest());
    assertEquals(false, old.getPortfolio().getRootNode().getUniqueId().getVersion().equals(
        newer.getPortfolio().getRootNode().getUniqueId().getVersion()));
   
    PortfolioHistoryRequest search = new PortfolioHistoryRequest(base.getUniqueId(), _version1Instant.plusSeconds(5), null);
    PortfolioHistoryResult searchResult = _prtMaster.history(search);
    assertEquals(2, searchResult.getDocuments().size());
    assertEquals(corrected.getUniqueId(), searchResult.getDocuments().get(0).getUniqueId());
    assertEquals(oldPortfolioId, searchResult.getDocuments().get(1).getUniqueId());
  }
View Full Code Here

    assertEquals(false, old.getPortfolio().getRootNode().getUniqueId().getVersion().equals(
        newer.getPortfolio().getRootNode().getUniqueId().getVersion()));
    assertEquals(newAttr, newer.getPortfolio().getAttributes());
   
    PortfolioHistoryRequest search = new PortfolioHistoryRequest(base.getUniqueId(), null, now);
    PortfolioHistoryResult searchResult = _prtMaster.history(search);
    assertEquals(2, searchResult.getDocuments().size());
    assertEquals(updated.getUniqueId(), searchResult.getDocuments().get(0).getUniqueId());
    assertEquals(oldPortfolioId, searchResult.getDocuments().get(1).getUniqueId());
   
    assertEquals(newAttr, searchResult.getDocuments().get(0).getPortfolio().getAttributes());
    assertEquals(oldAttr, searchResult.getDocuments().get(1).getPortfolio().getAttributes());
  }
View Full Code Here

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

      data().setPortfolio(doc);
      data().setNode(doc.getPortfolio().getRootNode());
    } catch (DataNotFoundException ex) {
      PortfolioHistoryRequest historyRequest = new PortfolioHistoryRequest(oid);
      historyRequest.setPagingRequest(PagingRequest.ONE);
      PortfolioHistoryResult historyResult = data().getPortfolioMaster().history(historyRequest);
      if (historyResult.getDocuments().size() == 0) {
        return null;
      }
      data().setPortfolio(historyResult.getFirstDocument());
      data().setNode(historyResult.getFirstDocument().getPortfolio().getRootNode());
    }
    return new WebPortfolioResource(this);
  }
View Full Code Here

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

TOP

Related Classes of com.opengamma.master.portfolio.PortfolioHistoryResult

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.