Package energy.eddie.dataneeds.services
Interface DataNeedsService
- All Known Implementing Classes:
DataNeedsConfigService,DataNeedsDbService
public interface DataNeedsService
Service interface for retrieving data needs. Depending on the configuration, different data sources (e.g. JSON file
or database) will be used.
-
Method Summary
Modifier and TypeMethodDescriptionFetches the data need with the passed ID from the underlying persistence layer.Gets a data need by its id.Returns a list of all data needs with only their name and ID.
-
Method Details
-
getDataNeedIdsAndNames
List<DataNeedsNameAndIdProjection> getDataNeedIdsAndNames()Returns a list of all data needs with only their name and ID. -
findById
Fetches the data need with the passed ID from the underlying persistence layer.- Parameters:
id- The ID of the data need to get.- Returns:
- The data need or an empty Optional if there is no data need with the given ID.
-
getById
Gets a data need by its id. If it cannot be found throwsEntityNotFoundException. Should only be used when sure that the data need exists- Parameters:
id- The ID of the data need to get.- Returns:
- the data need
- Throws:
jakarta.persistence.EntityNotFoundException- if the entity cannot be found
-