Package edu.ie3.datamodel.io.source.sql
Class SqlTimeSeriesSource<V extends Value>
java.lang.Object
edu.ie3.datamodel.io.source.sql.SqlDataSource<TimeBasedValue<V>>
edu.ie3.datamodel.io.source.sql.SqlTimeSeriesSource<V>
- All Implemented Interfaces:
DataSource
,TimeSeriesSource<V>
public class SqlTimeSeriesSource<V extends Value>
extends SqlDataSource<TimeBasedValue<V>>
implements TimeSeriesSource<V>
-
Field Summary
Fields inherited from class edu.ie3.datamodel.io.source.sql.SqlDataSource
log
-
Constructor Summary
ConstructorDescriptionSqlTimeSeriesSource
(SqlConnector connector, String schemaName, DatabaseNamingStrategy namingStrategy, UUID timeSeriesUuid, Class<V> valueClass, TimeBasedSimpleValueFactory<V> factory) Initializes a new SqlTimeSeriesSource -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<TimeBasedValue<V>>
createEntity
(Map<String, String> fieldToValues) Build aTimeBasedValue
of typeV
, whereas the underlyingValue
does not need any additional information.static SqlTimeSeriesSource<? extends Value>
createSource
(SqlConnector connector, String schemaName, DatabaseNamingStrategy namingStrategy, IndividualTimeSeriesMetaInformation metaInformation, String timePattern) Factory method to build a source from given meta informationObtain the full time seriesgetTimeSeries
(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval) Get the time series for the given time interval.getValue
(ZonedDateTime time) Get the time series value for a specific timeMethods inherited from class edu.ie3.datamodel.io.source.sql.SqlDataSource
createBaseQueryString, executeQuery, getDbColumnName, getDbTables
-
Constructor Details
-
SqlTimeSeriesSource
public SqlTimeSeriesSource(SqlConnector connector, String schemaName, DatabaseNamingStrategy namingStrategy, UUID timeSeriesUuid, Class<V> valueClass, TimeBasedSimpleValueFactory<V> factory) Initializes a new SqlTimeSeriesSource- Parameters:
connector
- the connector needed for database connectionschemaName
- the database schema to usenamingStrategy
- the naming strategy for database entitiestimeSeriesUuid
- the uuid of the time seriesvalueClass
- the class of returned time series valuesfactory
- a factory that parses the input data
-
-
Method Details
-
createSource
public static SqlTimeSeriesSource<? extends Value> createSource(SqlConnector connector, String schemaName, DatabaseNamingStrategy namingStrategy, IndividualTimeSeriesMetaInformation metaInformation, String timePattern) throws SourceException Factory method to build a source from given meta information- Parameters:
connector
- the connector needed for database connectionschemaName
- the database schema to usenamingStrategy
- the database entity naming strategy to usemetaInformation
- the time series meta informationtimePattern
- the pattern of time values- Returns:
- a SqlTimeSeriesSource for given time series table
- Throws:
SourceException
- if the column scheme is not supported
-
getTimeSeries
Description copied from interface:TimeSeriesSource
Obtain the full time series- Specified by:
getTimeSeries
in interfaceTimeSeriesSource<V extends Value>
- Returns:
- the time series
-
getTimeSeries
public IndividualTimeSeries<V> getTimeSeries(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval) Description copied from interface:TimeSeriesSource
Get the time series for the given time interval. If the interval is bigger than the time series itself, only the parts of the time series within the interval are handed back.- Specified by:
getTimeSeries
in interfaceTimeSeriesSource<V extends Value>
- Parameters:
timeInterval
- Desired time interval to cover- Returns:
- The parts of of interest of the time series
-
getValue
Description copied from interface:TimeSeriesSource
Get the time series value for a specific time- Specified by:
getValue
in interfaceTimeSeriesSource<V extends Value>
- Parameters:
time
- The queried time- Returns:
- Option on a value for that time
-
createEntity
Build aTimeBasedValue
of typeV
, whereas the underlyingValue
does not need any additional information.- Specified by:
createEntity
in classSqlDataSource<TimeBasedValue<V extends Value>>
- Parameters:
fieldToValues
- Mapping from field id to values- Returns:
- Optional simple time based value
-