Package io.openems.shared.influxdb.proxy
Class QueryProxy
java.lang.Object
io.openems.shared.influxdb.proxy.QueryProxy
- Direct Known Subclasses:
FluxProxy
,InfluxQlProxy
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
final QueryProxy.RandomLimit
protected final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected abstract String
buildFetchAvailableSinceQuery
(String bucket) protected abstract String
buildFetchFirstValueBefore
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels) protected abstract String
buildHistoricDataQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) protected abstract String
buildHistoricEnergyPerPeriodQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) protected abstract String
buildHistoricEnergyPerPeriodQuerySingleValueInDay
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) protected abstract String
buildHistoricEnergyQuery
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) protected abstract String
buildHistoricEnergyQuerySingleValueInDay
(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) static QueryProxy
Builds aFluxProxy
.static QueryProxy
from
(QueryLanguageConfig config, String tag) Builds aQueryProxy
from aQueryLanguageConfig
.static QueryProxy
Builds aInfluxQlProxy
.boolean
queryAvailableSince
(InfluxConnector.InfluxConnection influxConnection, String bucket) Queries the available since fields from the database.abstract SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryFirstValueBefore
(String bucket, InfluxConnector.InfluxConnection influxConnection, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels) Queries the first values before the given date.abstract SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricData
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) abstract SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergy
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) abstract SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricEnergyPerPeriod
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) abstract SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergySingleValueInDay
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) Queries the historic energy values with a measurement which only has one value saved per day.abstract SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryRawHistoricEnergyPerPeriodSingleValueInDay
(InfluxConnector.InfluxConnection influxConnection, String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries the raw historic values without calculating the difference between two values also includes the first value before the time range to help calculating the differences.
-
Field Details
-
CHANNEL_TAG
- See Also:
-
AVAILABLE_SINCE_MEASUREMENT
- See Also:
-
AVAILABLE_SINCE_COLUMN_NAME
- See Also:
-
tag
-
queryLimit
-
-
Constructor Details
-
QueryProxy
-
-
Method Details
-
flux
Builds aFluxProxy
.- Parameters:
tag
- the InfluxDB tag- Returns:
- a FluxProxy
-
influxQl
Builds aInfluxQlProxy
.- Parameters:
tag
- the InfluxDB tag- Returns:
- a InfluxQlProxy
-
isLimitReached
public boolean isLimitReached() -
assertQueryLimit
- Throws:
OpenemsException
-
buildHistoricDataQuery
protected abstract String buildHistoricDataQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Throws:
OpenemsException
-
buildHistoricEnergyQuery
protected abstract String buildHistoricEnergyQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsException - Throws:
OpenemsException
-
buildHistoricEnergyQuerySingleValueInDay
protected abstract String buildHistoricEnergyQuerySingleValueInDay(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsException - Throws:
OpenemsException
-
buildHistoricEnergyPerPeriodQuery
protected abstract String buildHistoricEnergyPerPeriodQuery(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Throws:
OpenemsException
-
buildHistoricEnergyPerPeriodQuerySingleValueInDay
protected abstract String buildHistoricEnergyPerPeriodQuerySingleValueInDay(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsException - Throws:
OpenemsException
-
buildFetchAvailableSinceQuery
-
buildFetchFirstValueBefore
protected abstract String buildFetchFirstValueBefore(String bucket, String measurement, Optional<Integer> influxEdgeId, ZonedDateTime date, Set<ChannelAddress> channels)