Package com.serotonin.m2m2.vo.export

Examples of com.serotonin.m2m2.vo.export.ExportDataValue


    }

    @DwrPermission(user = true)
    public ReportVO createReportFromWatchlist(String name, int[] dataPointIds) {
        ReportVO report = new ReportVO();
        User user = Common.getUser();

        report.setName(new TranslatableMessage("common.copyPrefix", name).translate(getTranslations()));
        report.setXid(Common.generateXid("REP_"));
        DataPointDao dataPointDao = new DataPointDao();
        for (int id : dataPointIds) {
View Full Code Here


public class ReportLaunchServlet extends BaseInfoServlet{
  private static final long serialVersionUID = -1;
 
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) {
    User user = Common.getUser(request);
    if(user != null) {
      ReportDao dao = new ReportDao();
      ReportVO report = null;
      int id = getIntRequestParameter(request, "reportId", -1);
      if(id != -1)
        report = dao.getReport(id);
      String xid = request.getParameter("reportXid");
      if(xid != null)
        report = dao.getReport(xid);
      if(report != null && (user.getId() == report.getUserId() || user.isAdmin())) {
        ReportJob.scheduleReportJob(report);
        try {
          response.getWriter().write("Report " + report.getName() + " scheduled");
        } catch(Exception e) {
          response.setStatus(500);
View Full Code Here

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        // The only place that should be calling this servlet is the report chart, generated by a Freemarker
        // template. The ReportChartCreator that controlled the generation put the generated image content into the
        // user object, so all i need to do is write that content to the response object.
        User user = Common.getUser(request);
        if (user != null) {
            @SuppressWarnings("unchecked")
            Map<String, byte[]> imageData = (Map<String, byte[]>) user.getAttribute(IMAGE_DATA_KEY);
            if (imageData != null) {
                String path = request.getPathInfo();

                // Path will be of the format "/<chartName>", so we need to ignore the first character.
                byte[] data = imageData.get(path.substring(1));
View Full Code Here

    private int inactiveSecond;
    @JsonProperty
    private String inactiveCron;

    public EventTypeVO getEventType() {
        return new EventTypeVO(ScheduledEventType.TYPE_NAME, null, id, 0, getDescription(), alarmLevel);
    }
View Full Code Here

import com.serotonin.util.SerializationHelper;

public class SquwkSenderVO extends PublisherVO<SquwkPointVO> {
    @Override
    protected void getEventTypesImpl(List<EventTypeVO> eventTypes) {
        eventTypes.add(new EventTypeVO(EventType.EventTypeNames.PUBLISHER, null, getId(),
                SquwkSenderRT.REQUEST_EXCEPTION_EVENT, new TranslatableMessage("event.pb.squwk.request"),
                AlarmLevels.URGENT));
        eventTypes.add(new EventTypeVO(EventType.EventTypeNames.PUBLISHER, null, getId(),
                SquwkSenderRT.SERVICE_EXCEPTION_EVENT, new TranslatableMessage("event.pb.squwk.service"),
                AlarmLevels.URGENT));
    }
View Full Code Here

              reportDao.reportInstanceDataSQL(instanceId, creator);
            else
              reportDao.reportInstanceDataNoSQL(instanceId, creator);
        }
        else if (content == CONTENT_EVENTS)
            new EventCsvStreamer(response.getWriter(), reportDao.getReportInstanceEvents(instanceId), translations);
        else if (content == CONTENT_COMMENTS)
            new UserCommentCsvStreamer(response.getWriter(), reportDao.getReportInstanceUserComments(instanceId),
                    translations);
    }
View Full Code Here

        exportFile = handler.exportFile;

        if (createExportFile && events != null) {
            try {
                eventFile = File.createTempFile("tempEventCSV", ".csv");
                new EventCsvStreamer(new PrintWriter(new FileWriter(eventFile)), events, translations);
            }
            catch (IOException e) {
                LOG.error("Failed to create temp event file", e);
            }
        }
View Full Code Here

        // Stream the content.
        response.setContentType("text/csv");

        Translations translations = Common.getTranslations();
        if (content == CONTENT_REPORT) {
            ExportCsvStreamer creator = new ExportCsvStreamer(response.getWriter(), translations);
            if(Common.databaseProxy.getNoSQLProxy() == null)
              reportDao.reportInstanceDataSQL(instanceId, creator);
            else
              reportDao.reportInstanceDataNoSQL(instanceId, creator);
        }
View Full Code Here

                        rp.setPlotType(rs.getInt(++i));
                        return rp;
                    }
                });

        final ExportDataValue edv = new ExportDataValue();
        for (final ExportPointInfo point : pointInfos) {
            handler.startPoint(point);

            edv.setReportPointId(point.getReportPointId());
            final int dataType = point.getDataType();
            ejt.query(REPORT_INSTANCE_DATA_SELECT + "where rd.reportInstancePointId=? order by rd.ts",
                    new Object[] { point.getReportPointId() }, new RowCallbackHandler() {
                        @Override
                        public void processRow(ResultSet rs) throws SQLException {
                            switch (dataType) {
                            case (DataTypes.NUMERIC):
                                edv.setValue(new NumericValue(rs.getDouble(1)));
                                break;
                            case (DataTypes.BINARY):
                                edv.setValue(new BinaryValue(rs.getDouble(1) == 1));
                                break;
                            case (DataTypes.MULTISTATE):
                                edv.setValue(new MultistateValue(rs.getInt(1)));
                                break;
                            case (DataTypes.ALPHANUMERIC):
                                edv.setValue(new AlphanumericValue(rs.getString(2)));
                                if (rs.wasNull())
                                    edv.setValue(new AlphanumericValue(rs.getString(3)));
                                break;
                            case (DataTypes.IMAGE):
                                edv.setValue(new ImageValue(Integer.parseInt(rs.getString(2)), rs.getInt(1)));
                                break;
                            default:
                                edv.setValue(null);
                            }

                            edv.setTime(rs.getLong(4));
                            edv.setAnnotation(BaseDao.readTranslatableMessage(rs, 5));
                            handler.pointData(edv);
                        }
                    });
        }
        handler.done();
View Full Code Here

                        rp.setPlotType(rs.getInt(++i));
                        return rp;
                    }
                });

        final ExportDataValue edv = new ExportDataValue();
        for (final ExportPointInfo point : pointInfos) {
            handler.startPoint(point);

            edv.setReportPointId(point.getReportPointId());
            final NoSQLDao dao = Common.databaseProxy.getNoSQLProxy().createNoSQLDao(ReportPointValueTimeSerializer.get(), "reports");
            final String pointStore = instanceId + "_" + point.getReportPointId();
            dao.getData(pointStore, 0, Long.MAX_VALUE, -1, false, new NoSQLQueryCallback(){

        @Override
        public void entry(String storeName, long timestamp, ITime entry) {
          PointValueTime pvt = (PointValueTime) entry;
          edv.setValue(pvt.getValue());
          edv.setTime(pvt.getTime());
         
          if(pvt instanceof AnnotatedPointValueTime)
            edv.setAnnotation(((AnnotatedPointValueTime)pvt).getSourceMessage());
         
          handler.pointData(edv);
        }
             
            });
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.vo.export.ExportDataValue

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.