Package com.opengamma.master.portfolio

Examples of com.opengamma.master.portfolio.PortfolioDocument$Meta


   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    PortfolioDocument doc = data().getPortfolio();
    out.put("portfolioDoc", doc);
    out.put("portfolio", doc.getPortfolio());
    out.put("deleted", !doc.isLatest());
    return out;
  }
View Full Code Here


  //-------------------------------------------------------------------------
  @Path("{versionId}")
  public WebPortfolioVersionResource findVersion(@PathParam("versionId") String idStr) {
    data().setUriVersionId(idStr);
    PortfolioDocument doc = data().getPortfolio();
    UniqueId combined = doc.getUniqueId().withVersion(idStr);
    if (doc.getUniqueId().equals(combined) == false) {
      PortfolioDocument versioned = data().getPortfolioMaster().get(combined);
      data().setVersioned(versioned);
    } else {
      data().setVersioned(doc);
    }
    return new WebPortfolioVersionResource(this);
View Full Code Here

  //-------------------------------------------------------------------------
  @Path("{nodeId}")
  public WebPortfolioNodeResource findNode(@PathParam("nodeId") String idStr) {
    data().setUriNodeId(idStr);
    UniqueId oid = UniqueId.parse(idStr);
    PortfolioDocument portfolioDoc = data().getVersioned();
    Stack<ManageablePortfolioNode> nodes = portfolioDoc.getPortfolio().getRootNode().findNodeStackByObjectId(oid);
    if (nodes.isEmpty()) {
      throw new DataNotFoundException("PortfolioNode not found: " + idStr);
    }
    data().setNode(nodes.pop());
    if (nodes.size() > 0) {
View Full Code Here

  //-------------------------------------------------------------------------
  @Path("{nodeId}")
  public WebPortfolioNodeResource findNode(@PathParam("nodeId") String idStr) {
    data().setUriNodeId(idStr);
    UniqueId oid = UniqueId.parse(idStr);
    PortfolioDocument portfolioDoc = data().getPortfolio();
    Stack<ManageablePortfolioNode> nodes = portfolioDoc.getPortfolio().getRootNode().findNodeStackByObjectId(oid);
    if (nodes.isEmpty()) {
      throw new DataNotFoundException("PortfolioNode not found: " + idStr);
    }
    data().setNode(nodes.pop());
    if (nodes.size() > 0) {
View Full Code Here

    final PositionMaster positionMaster = getToolContext().getPositionMaster();
    final SecurityMaster securityMaster = getToolContext().getSecurityMaster();

    final ManageablePortfolioNode rootNode = new ManageablePortfolioNode(portfolioName);
    final ManageablePortfolio portfolio = new ManageablePortfolio(portfolioName, rootNode);
    final PortfolioDocument portfolioDoc = new PortfolioDocument();
    portfolioDoc.setPortfolio(portfolio);

    for (final FXOptionSecurity fxOption : fxOptions) {
      final SecurityDocument fxOptionToAddDoc = new SecurityDocument();
      fxOptionToAddDoc.setSecurity(fxOption);
      securityMaster.add(fxOptionToAddDoc);
View Full Code Here

  //-------------------------------------------------------------------------
  @Test
  public void testGetPortfolio() {
    final ManageablePortfolio target = new ManageablePortfolio("Portfolio");
    final PortfolioDocument result = new PortfolioDocument(target);
    when(_underlying.get(OID, VersionCorrection.LATEST)).thenReturn(result);
   
    Response test = _resource.get(null, null);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

  }

  @Test
  public void testUpdatePortfolio() {
    final ManageablePortfolio target = new ManageablePortfolio("Portfolio");
    final PortfolioDocument request = new PortfolioDocument(target);
    request.setUniqueId(OID.atVersion("1"));
   
    final PortfolioDocument result = new PortfolioDocument(target);
    result.setUniqueId(OID.atVersion("1"));
    when(_underlying.update(same(request))).thenReturn(result);
   
    Response test = _resource.update(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

  @Test
  public void testAddPortfolio() {
    final ManageablePortfolio target = new ManageablePortfolio("Portfolio A");
    target.getRootNode().setName("RootNode");
    target.getRootNode().addChildNode(new ManageablePortfolioNode("Child"));
    final PortfolioDocument request = new PortfolioDocument(target);
   
    final PortfolioDocument result = new PortfolioDocument(target);
    result.setUniqueId(UID);
    when(_underlying.add(same(request))).thenReturn(result);
   
    Response test = _resource.add(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

  @BeforeMethod
  public void setUp() {
    _emptyMaster = new InMemoryPortfolioMaster();
    _populatedMaster = new InMemoryPortfolioMaster();
   
    _prt1 = _populatedMaster.add(new PortfolioDocument(generatePortfolio("Port1")));
    _prt2 = _populatedMaster.add(new PortfolioDocument(generatePortfolio("Port2")));
    _prt3 = _populatedMaster.add(new PortfolioDocument(generatePortfolio("Port3")));
  }
View Full Code Here

 
  //-------------------------------------------------------------------------
  @Test
  public void test_defaultSupplier() {
    InMemoryPortfolioMaster master = new InMemoryPortfolioMaster();
    PortfolioDocument added = master.add(new PortfolioDocument(generatePortfolio()));
    assertEquals("MemPrt", added.getUniqueId().getScheme());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.portfolio.PortfolioDocument$Meta

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.