예제 #1
0
  //
  //
  // Data points
  //
  public void saveDataPoint(DataPointVO point) {
    stopDataPoint(point.getId());

    // Since the point's data type may have changed, we must ensure that the other attrtibutes are
    // still ok with
    // it.
    int dataType = point.getPointLocator().getDataTypeId();

    // Chart renderer
    if (point.getChartRenderer() != null && !point.getChartRenderer().getDef().supports(dataType))
      // Return to a default renderer
      point.setChartRenderer(null);

    // Text renderer
    if (point.getTextRenderer() != null && !point.getTextRenderer().getDef().supports(dataType))
      // Return to a default renderer
      point.defaultTextRenderer();

    // Event detectors
    Iterator<PointEventDetectorVO> peds = point.getEventDetectors().iterator();
    while (peds.hasNext()) {
      PointEventDetectorVO ped = peds.next();
      if (!ped.getDef().supports(dataType))
        // Remove the detector.
        peds.remove();
    }

    new DataPointDao().saveDataPoint(point);

    if (point.isEnabled()) startDataPoint(point);
  }
예제 #2
0
  //
  //
  // Lifecycle
  //
  @Override
  public void initialize() {
    // Get the latest value for the point from the database.
    pointValue = valueCache.getLatestPointValue();

    // Set the tolerance origin if this is a numeric
    if (pointValue != null && pointValue.getValue() instanceof NumericValue)
      toleranceOrigin = pointValue.getDoubleValue();

    // Add point event listeners
    for (PointEventDetectorVO ped : vo.getEventDetectors()) {
      if (detectors == null) detectors = new ArrayList<PointEventDetectorRT>();

      PointEventDetectorRT pedRT = ped.createRuntime();
      detectors.add(pedRT);
      pedRT.initialize();
      Common.runtimeManager.addDataPointListener(vo.getId(), pedRT);
    }

    initializeIntervalLogging();
  }