Search in sources :

Example 1 with ImageValueBean

use of com.serotonin.m2m2.vo.bean.ImageValueBean in project ma-core-public by infiniteautomation.

the class DataPointDetailsDwr method getFlipbookData.

@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;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) DataPointVO(com.serotonin.m2m2.vo.DataPointVO) PointValueFacade(com.serotonin.m2m2.rt.dataImage.PointValueFacade) AnnotatedPointValueTime(com.serotonin.m2m2.rt.dataImage.AnnotatedPointValueTime) RenderedPointValueTime(com.serotonin.m2m2.web.dwr.beans.RenderedPointValueTime) PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime) ArrayList(java.util.ArrayList) ProcessResult(com.serotonin.m2m2.i18n.ProcessResult) ImageValueBean(com.serotonin.m2m2.vo.bean.ImageValueBean) ImageValue(com.serotonin.m2m2.rt.dataImage.types.ImageValue) DwrPermission(com.serotonin.m2m2.web.dwr.util.DwrPermission)

Aggregations

ProcessResult (com.serotonin.m2m2.i18n.ProcessResult)1 AnnotatedPointValueTime (com.serotonin.m2m2.rt.dataImage.AnnotatedPointValueTime)1 PointValueFacade (com.serotonin.m2m2.rt.dataImage.PointValueFacade)1 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)1 ImageValue (com.serotonin.m2m2.rt.dataImage.types.ImageValue)1 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)1 ImageValueBean (com.serotonin.m2m2.vo.bean.ImageValueBean)1 RenderedPointValueTime (com.serotonin.m2m2.web.dwr.beans.RenderedPointValueTime)1 DwrPermission (com.serotonin.m2m2.web.dwr.util.DwrPermission)1 ArrayList (java.util.ArrayList)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1