Package com.opengamma.master.portfolio

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


  @PUT
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  @Produces(MediaType.APPLICATION_JSON)
  public Response putJSON(@FormParam("name") String name) {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest() == false) {
      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
    name = StringUtils.trimToNull(name);
    updatePortfolioNode(name, doc);
    return Response.ok().build();
View Full Code Here


  //-------------------------------------------------------------------------
  @DELETE
  @Produces(MediaType.TEXT_HTML)
  public Response deleteHTML() {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest() == false) {
      Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
   
    if (data().getParentNode() == null) {
      throw new IllegalArgumentException("Root node cannot be deleted");
View Full Code Here

  }

  @DELETE
  @Produces(MediaType.APPLICATION_JSON)
  public Response deleteJSON() {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest()) {
      if (data().getParentNode() == null) {
        throw new IllegalArgumentException("Root node cannot be deleted");
      }
      if (data().getParentNode().removeNode(data().getNode().getUniqueId()) == false) {
        throw new DataNotFoundException("PortfolioNode not found: " + data().getNode().getUniqueId());
View Full Code Here

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

    FlexiBean out = createPortfolioData();
    return Response.ok(getFreemarker().build(JSON_DIR + "portfolio.ftl", out)).build();
  }

  private FlexiBean createPortfolioData() {
    PortfolioDocument doc = data().getPortfolio();
    PositionSearchRequest positionSearch = new PositionSearchRequest();
    positionSearch.setPositionObjectIds(doc.getPortfolio().getRootNode().getPositionIds());
    PositionSearchResult positionsResult = data().getPositionMaster().search(positionSearch);
    resolveSecurities(positionsResult.getPositions());
       
    FlexiBean out = createRootData();
    out.put("positionsResult", positionsResult);
View Full Code Here

  //-------------------------------------------------------------------------
  @PUT
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  @Produces(MediaType.TEXT_HTML)
  public Response putHTML(@FormParam("name") String name, @FormParam("hidden") Boolean isHidden) {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest() == false) {
      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
   
    name = StringUtils.trimToNull(name);
    DocumentVisibility visibility = BooleanUtils.isTrue(isHidden) ? DocumentVisibility.HIDDEN : DocumentVisibility.VISIBLE;
View Full Code Here

  @PUT
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  @Produces(MediaType.APPLICATION_JSON)
  public Response putJSON(@FormParam("name") String name, @FormParam("hidden") Boolean isHidden) {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest() == false) {
      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
    name = StringUtils.trimToNull(name);
    DocumentVisibility visibility = BooleanUtils.isTrue(isHidden) ? DocumentVisibility.HIDDEN : DocumentVisibility.VISIBLE;
    updatePortfolio(name, visibility, doc);
View Full Code Here

  //-------------------------------------------------------------------------
  @DELETE
  @Produces(MediaType.TEXT_HTML)
  public Response deleteHTML() {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest() == false) {
      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
   
    data().getPortfolioMaster().remove(doc.getUniqueId());
    URI uri = WebPortfolioResource.uri(data());
    return Response.seeOther(uri).build();
  }
View Full Code Here

  }

  @DELETE
  @Produces(MediaType.APPLICATION_JSON)
  public Response deleteJSON() {
    PortfolioDocument doc = data().getPortfolio();
    if (doc.isLatest()) {
      data().getPortfolioMaster().remove(doc.getUniqueId());
   
    return Response.ok().build();
  }
View Full Code Here

   * 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("childNodes", doc.getPortfolio().getRootNode().getChildNodes());
    out.put("deleted", !doc.isLatest());
    out.put("rootNode", doc.getPortfolio().getRootNode());
    return out;
  }
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.