bug fix where aggr was crashing when no user whas assigned to a sensor

Former-commit-id: f5d59c67752f24f9834e457211e4c155d3dc4b5b
This commit is contained in:
Ziver Koc 2016-01-29 09:41:14 +01:00
parent 3e9d255532
commit 51b549528c

View file

@ -43,6 +43,7 @@ public class SensorDataCleanupDaemon implements HalDaemon {
public void cleanupSensor(Sensor sensor) { public void cleanupSensor(Sensor sensor) {
//if(sensor instanceof PowerConsumptionSensorData){ //if(sensor instanceof PowerConsumptionSensorData){
//logger.fine("The sensor is of type: " + sensor.getDeviceData().getClass().getName()); // this will instantiate the external sensor data //logger.fine("The sensor is of type: " + sensor.getDeviceData().getClass().getName()); // this will instantiate the external sensor data
if (sensor.getUser() != null) {
if (sensor.getUser().isExternal()) { if (sensor.getUser().isExternal()) {
cleanupExternalSensorData(sensor.getId(), TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.DAY_IN_MS); cleanupExternalSensorData(sensor.getId(), TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.DAY_IN_MS);
cleanupExternalSensorData(sensor.getId(), TimeUtility.HOUR_IN_MS, TimeUtility.WEEK_IN_MS); cleanupExternalSensorData(sensor.getId(), TimeUtility.HOUR_IN_MS, TimeUtility.WEEK_IN_MS);
@ -50,6 +51,7 @@ public class SensorDataCleanupDaemon implements HalDaemon {
cleanupInternalSensorData(sensor.getId(), TimeUtility.HOUR_IN_MS, TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.DAY_IN_MS); cleanupInternalSensorData(sensor.getId(), TimeUtility.HOUR_IN_MS, TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.DAY_IN_MS);
cleanupInternalSensorData(sensor.getId(), TimeUtility.DAY_IN_MS, TimeUtility.HOUR_IN_MS, TimeUtility.WEEK_IN_MS); cleanupInternalSensorData(sensor.getId(), TimeUtility.DAY_IN_MS, TimeUtility.HOUR_IN_MS, TimeUtility.WEEK_IN_MS);
} }
}
//}else{ //}else{
// logger.fine("The sensor type is not supported by the cleanup deamon. Ignoring"); // logger.fine("The sensor type is not supported by the cleanup deamon. Ignoring");
//} //}