Package org.joda.beans.impl.flexi

Examples of org.joda.beans.impl.flexi.FlexiBean


  }

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public String getJSON() {
    FlexiBean out = createRootData();
    return getFreemarker().build(JSON_DIR + "position.ftl", out);
  }
View Full Code Here


  /**
   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    ConfigDocument doc = data().getConfig();
    out.put("configDoc", doc);
    out.put("config", doc.getConfig().getValue());
    out.put("configDescription", getConfigTypesProvider().getDescription(doc.getConfig().getType()));
    out.put("deleted", !doc.isLatest());
    return out;
  }
View Full Code Here

      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
    quantityStr = StringUtils.replace(StringUtils.trimToNull(quantityStr), ",", "");
    BigDecimal quantity = quantityStr != null && NumberUtils.isNumber(quantityStr) ? new BigDecimal(quantityStr) : null;
    if (quantity == null) {
      FlexiBean out = createRootData();
      if (quantityStr == null) {
        out.put("err_quantityMissing", true);
      } else {
        out.put("err_quantityNotNumeric", true);
      }
      String html = getFreemarker().build(HTML_DIR + "position-update.ftl", out);
      return Response.ok(html).build();
    }
    URI uri = updatePosition(doc, quantity, null);
View Full Code Here

  /**
   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    PositionDocument doc = data().getPosition();
   
    // REVIEW jonathan 2012-01-12 -- we are throwing away any adjuster that may be required, e.g. to apply
    // normalisation to the time-series. This reproduces the previous behaviour but probably indicates that the
    // time-series information is in the wrong place.
   
    ObjectId tsObjectId = null;
    Security security = doc.getPosition().getSecurityLink().resolveQuiet(data().getSecuritySource());
    if (security != null && !security.getExternalIdBundle().isEmpty()) {
      // Get the last price HTS for the security
      HistoricalTimeSeriesSource htsSource = data().getHistoricalTimeSeriesSource();
      HistoricalTimeSeries series = htsSource.getHistoricalTimeSeries(
          MarketDataRequirementNames.MARKET_VALUE, doc.getPosition().getSecurity().getExternalIdBundle(), null, null, false, null, false, 0);
      if (series != null) {
        tsObjectId = series.getUniqueId().getObjectId();
      }
    }
   
    out.put("positionDoc", doc);
    out.put("position", doc.getPosition());
    out.put("security", doc.getPosition().getSecurity());
    out.put("timeSeriesId", tsObjectId);
    out.put("deleted", !doc.isLatest());
    out.put("attributes", doc.getPosition().getAttributes());
    TradeAttributesModel tradeAttributesModel = getTradeAttributesModel();
    out.put("tradeAttrModel", tradeAttributesModel);
    return out;
  }
View Full Code Here

  /**
   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = getFreemarker().createRootData();
    out.put("homeUris", new WebHomeUris(data().getUriInfo()));
    out.put("uris", new WebExchangeUris(data()));
    return out;
  }
View Full Code Here

  @GET
  public String getHTML() {
    ExchangeHistoryRequest request = new ExchangeHistoryRequest(data().getExchange().getUniqueId());
    ExchangeHistoryResult result = data().getExchangeMaster().history(request);
   
    FlexiBean out = createRootData();
    out.put("versionsResult", result);
    out.put("versions", result.getExchanges());
    return getFreemarker().build(HTML_DIR + "exchangeversions.ftl", out);
  }
View Full Code Here

    PagingRequest pr = buildPagingRequest(pgIdx, pgNum, pgSze);
    ExchangeHistoryRequest request = new ExchangeHistoryRequest(data().getExchange().getUniqueId());
    request.setPagingRequest(pr);
    ExchangeHistoryResult result = data().getExchangeMaster().history(request);
   
    FlexiBean out = createRootData();
    out.put("versionsResult", result);
    out.put("versions", result.getExchanges());
    out.put("paging", new WebPaging(result.getPaging(), data().getUriInfo()));
    String json = getFreemarker().build(JSON_DIR + "exchangeversions.ftl", out);
    return Response.ok(json).build();
  }
View Full Code Here

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

  //-------------------------------------------------------------------------
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String getHTML() {
    FlexiBean out = createRootData();
    return getFreemarker().build(HTML_DIR + "exchange.ftl", out);
  }
View Full Code Here

    EntityTag etag = new EntityTag(data().getExchange().getUniqueId().toString());
    ResponseBuilder builder = request.evaluatePreconditions(etag);
    if (builder != null) {
      return builder.build();
    }
    FlexiBean out = createRootData();
    String json = getFreemarker().build(JSON_DIR + "exchange.ftl", out);
    return Response.ok(json).tag(etag).build();
  }
View Full Code Here

TOP

Related Classes of org.joda.beans.impl.flexi.FlexiBean

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.