/** * resets samplecounter, latestsampletimelist and the * filtertriggered-variables. this method will be called after each * aggregation-value-update was published * * @param identityId The identity Id. * @return true if it was successful, false if identity not found */ public Boolean resetAggregationSampleHelperVariables(Long identityId) { if (!this.existsIdentity(identityId)) { return false; } AggregationDefinitionDetails definition = this.getAggregationDefinition(identityId); final int paramSetSize = definition.getParameterSets().size(); //reset the latest sample-time and the sample-counter if (paramSetSize != 0) { latestSampleTimeList.get(identityId).clear(); sampleCountList.get(identityId).clear(); } //init the latest sample-time and the sample-counter for (int j = 0; j < paramSetSize; j++) { latestSampleTimeList.get(identityId).add(j, null); sampleCountList.get(identityId).add(j, 0); } this.setFilterTriggered(identityId, false); // Reset the filter state return true; }
/** * resets periodicAggregationValuesLast, periodicAggregationValuesCurrent, * sampleCounter, latestSampleTimeList and the filterTriggered-variables. * this method will be called after an aggregation-definition was updated. * * @param identityId The identity Id. */ public void populateAggregationValues(final Long identityId) { AggregationSetValueList aggregationSetValueListLast = new AggregationSetValueList(); AggregationSetValueList aggregationSetValueListCurrent = new AggregationSetValueList(); AggregationDefinitionDetails definition = this.getAggregationDefinition(identityId); final int paramSetSize = definition.getParameterSets().size(); //reset the latest sample-time and the sample-counter if (paramSetSize != 0) { latestSampleTimeList.get(identityId).clear(); sampleCountList.get(identityId).clear(); } //init the latest sample-time and the sample-counter, filtertriggered and latest and current aggregation-values for (int j = 0; j < paramSetSize; j++) { latestSampleTimeList.get(identityId).add(j, null); aggregationSetValueListLast.add(j, new AggregationSetValue()); aggregationSetValueListCurrent.add(j, new AggregationSetValue()); sampleCountList.get(identityId).add(j, 0); } periodicAggregationValuesLast.get(identityId).setParameterSetValues(aggregationSetValueListLast); periodicAggregationValuesCurrent.get(identityId).setParameterSetValues(aggregationSetValueListCurrent); this.setFilterTriggered(identityId, false); // Reset the filter state }