示例#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
          });
  }
示例#2
0
  public static String contextToString(List<IntStringPair> context) {
    DataPointDao dataPointDao = new DataPointDao();
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (IntStringPair ivp : context) {
      DataPointVO dp = dataPointDao.getDataPoint(ivp.getKey());
      if (first) first = false;
      else sb.append(", ");

      if (dp == null) sb.append("?=");
      else sb.append(dp.getName()).append("=");
      sb.append(ivp.getValue());
    }
    return sb.toString();
  }
示例#3
0
 @Override
 public String toString() {
   return "DataPointRT(id=" + getId() + ", name=" + vo.getName() + ")";
 }