Example #1
0
  private void updatePoints() {
    // Get the points
    List<DataPointVO> dps =
        query(
            "select dp.id, dp.xid, dp.dataSourceId, dp.data, ds.name, " //
                + "ds.xid, ds.dataSourceType " //
                + "from dataPoints dp join dataSources ds on ds.id = dp.dataSourceId ",
            new DataPointRowMapper());

    // Resave
    for (DataPointVO dp : dps)
      ejt.update(
          "update dataPoints set xid=?, name=?, deviceName=?, enabled=?, loggingType=?, " //
              + "intervalLoggingPeriodType=?, intervalLoggingPeriod=?, intervalLoggingType=?, " //
              + "tolerance=?, purgeType=?, purgePeriod=?, defaultCacheSize=?, discardExtremeValues=?, " //
              + "engineeringUnits=?, data=? where id=?", //
          new Object[] {
            dp.getXid(),
            dp.getName(),
            dp.getDeviceName(),
            boolToChar(dp.isEnabled()),
            dp.getLoggingType(),
            dp.getIntervalLoggingPeriodType(),
            dp.getIntervalLoggingPeriod(),
            dp.getIntervalLoggingType(),
            dp.getTolerance(),
            dp.getPurgeType(),
            dp.getPurgePeriod(),
            dp.getDefaultCacheSize(),
            boolToChar(dp.isDiscardExtremeValues()),
            dp.getEngineeringUnits(),
            SerializationHelper.writeObject(dp),
            dp.getId()
          }, //
          new int[] {
            Types.VARCHAR,
            Types.VARCHAR,
            Types.VARCHAR,
            Types.CHAR,
            Types.INTEGER,
            Types.INTEGER,
            Types.INTEGER,
            Types.INTEGER,
            Types.DOUBLE,
            Types.INTEGER,
            Types.INTEGER,
            Types.INTEGER,
            Types.CHAR,
            Types.INTEGER,
            Types.BLOB,
            Types.INTEGER
          });
  }
Example #2
0
 public void _updateDataSource(DataSourceVO<?> vo) {
   ejt.update(
       "update dataSources set xid=?, name=?, dataSourceType=?, data=? where id=?",
       new Object[] {
         vo.getXid(),
         vo.getName(),
         vo.getDefinition().getDataSourceTypeName(),
         SerializationHelper.writeObject(vo),
         vo.getId()
       },
       new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BLOB, Types.INTEGER});
 }
Example #3
0
  private void insertDataSource(final DataSourceVO<?> vo) {
    vo.setId(
        doInsert(
            "insert into dataSources (xid, name, dataSourceType, data) values (?,?,?,?)",
            new Object[] {
              vo.getXid(),
              vo.getName(),
              vo.getDefinition().getDataSourceTypeName(),
              SerializationHelper.writeObject(vo)
            },
            new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BLOB}));

    AuditEventType.raiseAddedEvent(AuditEventType.TYPE_DATA_SOURCE, vo);
  }
Example #4
0
 public void savePersistentData(int id, Object data) {
   ejt.update(
       "update dataSources set rtdata=? where id=?",
       new Object[] {SerializationHelper.writeObject(data), id},
       new int[] {Types.BLOB, Types.INTEGER});
 }