Examples of AnalyticsView


Examples of com.opengamma.web.analytics.AnalyticsView

  @Path("{viewId}/{gridType}/data")
  @Produces(RestUtils.TEXT_CSV)
  public ViewportResults getViewportResultAsCsv(@PathParam("viewId") String viewId,
                                                @PathParam("gridType") String gridTypeStr,
                                                @Context HttpServletResponse response) {
    AnalyticsView view = _viewManager.getView(viewId);
    AnalyticsView.GridType gridType = gridType(gridTypeStr);
    ViewportResults result = view.getAllGridData(gridType, TypeFormatter.Format.CELL);
    Instant valuationTime;
    if (result.getValuationTime() != null) {
      valuationTime = result.getValuationTime();
    } else {
      valuationTime = OpenGammaClock.getInstance().instant();
    }
    LocalDateTime time = LocalDateTime.ofInstant(valuationTime, OpenGammaClock.getZone());

    String filename = String.format("%s-%s-%s.csv",
                                    view.getViewDefinitionId(),
                                    gridType.name().toLowerCase(),
                                    time.toString(CSV_TIME_FORMAT));
    response.addHeader("content-disposition", "attachment; filename=\"" + filename + "\"");
    return view.getAllGridData(gridType, TypeFormatter.Format.CELL);
  }
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.