Class DataNeedCalculationServiceImpl
java.lang.Object
energy.eddie.regionconnector.shared.services.data.needs.DataNeedCalculationServiceImpl
- All Implemented Interfaces:
DataNeedCalculationService<DataNeed>
public class DataNeedCalculationServiceImpl
extends Object
implements DataNeedCalculationService<DataNeed>
Implementation of the
DataNeedCalculationService that can be customized to fit the requirements of the region connector.-
Constructor Summary
ConstructorsConstructorDescriptionDataNeedCalculationServiceImpl(DataNeedsService dataNeedsService, RegionConnectorMetadata regionConnectorMetadata, DataNeedRuleSet dataNeedRuleSet) DataNeedCalculationServiceImpl(DataNeedsService dataNeedsService, RegionConnectorMetadata regionConnectorMetadata, PermissionTimeframeStrategy strategy, EnergyDataTimeframeStrategy energyDataTimeframeStrategy, DataNeedRuleSet dataNeedRuleSet) Constructs an instance with customPermissionTimeframeStrategyandEnergyDataTimeframeStrategy. -
Method Summary
Modifier and TypeMethodDescriptionCalculates relevant information for a data needcalculate(DataNeed dataNeed, ZonedDateTime referenceDateTime) Calculates relevant information for a data need, using the reference datetimeCalculate relevant information for a given data need IDcalculate(String dataNeedId, ZonedDateTime referenceDateTime) Calculates relevant information for given data need ID, using the reference datetimecalculateAll(Set<String> dataNeedIds) Calculates the relevant information for multiple given data need IDs.calculateAll(Set<String> dataNeedIds, ZonedDateTime referenceDateTime) Calculates the relevant information for multiple given data need IDs, using the reference datetime.The id of the region-connector that provides the implementation of this service.
-
Constructor Details
-
DataNeedCalculationServiceImpl
public DataNeedCalculationServiceImpl(DataNeedsService dataNeedsService, RegionConnectorMetadata regionConnectorMetadata, DataNeedRuleSet dataNeedRuleSet) UsesPermissionEndIsEnergyDataEndStrategyfor thePermissionTimeframeStrategyandDefaultEnergyDataTimeframeStrategyfor theEnergyDataTimeframeStrategy. These are used to calculate the start and end of a permission request and the start and end of the metered data, if needed.- Parameters:
dataNeedsService- service to get the data needregionConnectorMetadata- metadata of the region connector
-
-
Method Details
-
calculate
Description copied from interface:DataNeedCalculationServiceCalculates relevant information for a data need- Specified by:
calculatein interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeed- the data need- Returns:
- the calculation results for the data need
-
calculate
Description copied from interface:DataNeedCalculationServiceCalculates relevant information for a data need, using the reference datetime- Specified by:
calculatein interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeed- the data needreferenceDateTime- the reference datetime the calculations are based on- Returns:
- the calculation results for the data need
-
calculate
Description copied from interface:DataNeedCalculationServiceCalculate relevant information for a given data need ID- Specified by:
calculatein interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeedId- the ID of the data need- Returns:
- the calculation results for the data need
-
calculate
Description copied from interface:DataNeedCalculationServiceCalculates relevant information for given data need ID, using the reference datetime- Specified by:
calculatein interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeedId- the ID of the data needreferenceDateTime- the reference datetime the calculations are based on- Returns:
- the calculation results for the data need
-
calculateAll
Description copied from interface:DataNeedCalculationServiceCalculates the relevant information for multiple given data need IDs.- Specified by:
calculateAllin interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeedIds- the ID of the data needs- Returns:
- a Map of the calculations, where the key is the data need ID and the value the calculation result.
-
calculateAll
public MultipleDataNeedCalculationResult calculateAll(Set<String> dataNeedIds, ZonedDateTime referenceDateTime) Description copied from interface:DataNeedCalculationServiceCalculates the relevant information for multiple given data need IDs, using the reference datetime.- Specified by:
calculateAllin interfaceDataNeedCalculationService<DataNeed>- Parameters:
dataNeedIds- the ID of the data needsreferenceDateTime- the reference datetime the calculations are based on- Returns:
- a Map of the calculations, where the key is the data need ID and the value the calculation result.
-
regionConnectorId
Description copied from interface:DataNeedCalculationServiceThe id of the region-connector that provides the implementation of this service.- Specified by:
regionConnectorIdin interfaceDataNeedCalculationService<DataNeed>- Returns:
- region-connector id
-