Class DataNeedsConfigService

java.lang.Object
energy.eddie.dataneeds.services.DataNeedsConfigService
All Implemented Interfaces:
DataNeedsService

@Service @ConditionalOnProperty(value="eddie.data-needs-config.data-need-source", havingValue="CONFIG") public class DataNeedsConfigService extends Object implements DataNeedsService
DataNeedService that reads data needs from a JSON file. It only stores the data needs in memory.
  • Constructor Details

  • Method Details

    • getDataNeedIdsAndNames

      public List<DataNeedsNameAndIdProjection> getDataNeedIdsAndNames()
      Description copied from interface: DataNeedsService
      Returns a list of all data needs with only their name and ID.
      Specified by:
      getDataNeedIdsAndNames in interface DataNeedsService
    • findById

      public Optional<DataNeed> findById(String id)
      Description copied from interface: DataNeedsService
      Fetches the data need with the passed ID from the underlying persistence layer.
      Specified by:
      findById in interface DataNeedsService
      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

      public DataNeed getById(String id)
      Description copied from interface: DataNeedsService
      Gets a data need by its id. If it cannot be found throws EntityNotFoundException. Should only be used when sure that the data need exists
      Specified by:
      getById in interface DataNeedsService
      Parameters:
      id - The ID of the data need to get.
      Returns:
      the data need