Skip to content
Snippets Groups Projects
Commit abfe2f39 authored by gwen-soleil's avatar gwen-soleil
Browse files

fix getValues for TTS

parent b21a49d0
No related branches found
No related tags found
No related merge requests found
......@@ -162,8 +162,9 @@ public class TimeseriesDatabase implements IDatabase {
@Override
public AttributeValues getValues(String attributeCompleteName, String startDateForApi, String endDateForApi, SamplingType sampling, short samplingValue) {
AttributeValues result = null;
if (configService.getAttributeConfig(attributeCompleteName).isPresent()) {
AttributeValues result;
final Optional<AttributeConfig> attributeConfig = configService.getAttributeConfig(attributeCompleteName);
if (attributeConfig.isPresent()) {
if (sampling.equals(SamplingType.ALL)) {
final AttributeValueSeries data = fetcherService.getBetween(attributeCompleteName, getTimestamp(startDateForApi), getTimestamp(endDateForApi), false);
LOGGER.debug("fetching {} values for {}", data.getAttributeValues().size(), attributeCompleteName);
......@@ -186,20 +187,17 @@ public class TimeseriesDatabase implements IDatabase {
}
samplingString = "'" + samplingString + "'";
AttributeValueSeries data;
final Optional<AttributeConfig> params = configService.getAttributeConfig(attributeCompleteName);
if (params.isPresent()) {
if (params.get().getType() == TangoConst.Tango_DEV_BOOLEAN) {
if (attributeConfig.get().getType() == TangoConst.Tango_DEV_BOOLEAN) {
data = fetcherService.getWithSampling(attributeCompleteName, samplingString, "bool_or", getTimestamp(startDateForApi), getTimestamp(endDateForApi));
LOGGER.debug("fetching {} sampled boolean with bool_or values for {}", data.getAttributeValues().size(), attributeCompleteName);
} else {
data = fetcherService.getWithSampling(attributeCompleteName, samplingString, "min", getTimestamp(startDateForApi), getTimestamp(endDateForApi));
LOGGER.debug("fetching {} sampled values for {}", data.getAttributeValues().size(), attributeCompleteName);
}
}else{
throw new UnsupportedOperationException(attributeCompleteName + " is not archived");
}
result = AttributeValueMapper.mapAttributeValues(attributeCompleteName, data, configService.getAttributeConfig(attributeCompleteName).get());
}
} else {
throw new UnsupportedOperationException(attributeCompleteName + " is not archived");
}
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment