public void jsonWrite(ObjectWriter writer) throws IOException, JsonException { DataPointDao dataPointDao = new DataPointDao(); DataPointVO dp = dataPointDao.getDataPoint(dataPointId); String xid; if (dp == null) xid = null; else xid = dp.getXid(); writer.writeEntry("dataPointId", xid); }
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 }); }
public static void jsonWriteVarContext(ObjectWriter writer, List<IntStringPair> context) throws IOException, JsonException { DataPointDao dataPointDao = new DataPointDao(); JsonArray pointList = new JsonArray(); for (IntStringPair p : context) { DataPointVO dp = dataPointDao.getDataPoint(p.getKey()); if (dp != null) { JsonObject point = new JsonObject(); pointList.add(point); point.put("varName", new JsonString(p.getValue())); point.put("dataPointXid", new JsonString(dp.getXid())); } } writer.writeEntry("context", pointList); }