コード例 #1
0
  @DwrPermission(user = true)
  public ProcessResult getHistoryTableData(int limit) {
    DataPointVO pointVO = Common.getUser().getEditPoint();
    PointValueFacade facade = new PointValueFacade(pointVO.getId());

    List<PointValueTime> rawData = facade.getLatestPointValues(limit);
    List<RenderedPointValueTime> renderedData =
        new ArrayList<RenderedPointValueTime>(rawData.size());

    for (PointValueTime pvt : rawData) {
      RenderedPointValueTime rpvt = new RenderedPointValueTime();
      rpvt.setValue(Functions.getHtmlText(pointVO, pvt));
      rpvt.setTime(Functions.getTime(pvt));
      if (pvt.isAnnotated()) {
        AnnotatedPointValueTime apvt = (AnnotatedPointValueTime) pvt;
        rpvt.setAnnotation(apvt.getAnnotation(getTranslations()));
      }
      renderedData.add(rpvt);
    }

    ProcessResult response = new ProcessResult();
    response.addData("history", renderedData);
    addAsof(response);
    return response;
  }
コード例 #2
0
  @DwrPermission(user = true)
  public ProcessResult getFlipbookData(int limit) {
    HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
    DataPointVO vo = Common.getUser(request).getEditPoint();
    PointValueFacade facade = new PointValueFacade(vo.getId());

    List<PointValueTime> values = facade.getLatestPointValues(limit);
    Collections.reverse(values);
    List<ImageValueBean> result = new ArrayList<ImageValueBean>();
    for (PointValueTime pvt : values) {
      ImageValue imageValue = (ImageValue) pvt.getValue();
      String uri =
          ImageValueServlet.servletPath
              + ImageValueServlet.historyPrefix
              + pvt.getTime()
              + "_"
              + vo.getId()
              + "."
              + imageValue.getTypeExtension();
      result.add(new ImageValueBean(Functions.getTime(pvt), uri));
    }

    ProcessResult response = new ProcessResult();
    response.addData("images", result);
    addAsof(response);
    return response;
  }