Class StravaAdapter

java.lang.Object
yearreview.app.data.sources.fitness.adapters.FitnessAdapter
yearreview.app.data.sources.fitness.adapters.StravaAdapter

public class StravaAdapter extends FitnessAdapter
An adapter to input the data that can be exported from Strava here.
Author:
ColdStone37
  • Field Details

    • dataPath

      private final String dataPath
      Relative path where to load the data from.
    • language

      private final int language
      Index of the language of the data. (currently only supports german)
    • logger

      private static final Logger logger
    • languageNameToIdMapMap

      private static final Map<String,Integer> languageNameToIdMapMap
      Map to convert the shorthand of the language to the index.
    • languageToDateformat

      private static final DateTimeFormatter[] languageToDateformat
      Array of DateTimeFormatters for all languages.
    • activityStringToType

      private static final List<Map<String,ActivityType>> activityStringToType
      List of Maps for all languages to convert the names of activities to the ActivityTypes.
  • Constructor Details

    • StravaAdapter

      public StravaAdapter(FitnessDatabase database, XmlNode config)
      Constructs a StravaAdapter from a FitnessDatabase and configuration
      Parameters:
      database - database to insert the activities into
      config - configuration
  • Method Details

    • loadData

      public void loadData(Instant start, Instant end) throws IOException
      Load the Activities from Strava by parsing the activities.csv-file inside the export-folder.
      Specified by:
      loadData in class FitnessAdapter
      Parameters:
      start - start time of data to load
      end - end time of data to load
      Throws:
      IOException - if the CSVReader cannot read the file
    • parseCSVLine

      private void parseCSVLine(List<String> line, Instant start, Instant end)
      Parses a line of the CSV representing a single Activity
      Parameters:
      line - line to parse
      start - start time of Activities to consider
      end - end time of Activities to consider