Class StravaAdapter
java.lang.Object
yearreview.app.data.sources.fitness.adapters.FitnessAdapter
yearreview.app.data.sources.fitness.adapters.StravaAdapter
An adapter to input the data that can be exported from Strava here.
- Author:
- ColdStone37
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final List<Map<String,ActivityType>> List of Maps for all languages to convert the names of activities to theActivityTypes.private final StringRelative path where to load the data from.private final intIndex of the language of the data.Map to convert the shorthand of the language to the index.private static final DateTimeFormatter[]Array of DateTimeFormatters for all languages.private static final LoggerFields inherited from class yearreview.app.data.sources.fitness.adapters.FitnessAdapter
database -
Constructor Summary
ConstructorsConstructorDescriptionStravaAdapter(FitnessDatabase database, XmlNode config) Constructs a StravaAdapter from a FitnessDatabase and configuration -
Method Summary
Modifier and TypeMethodDescriptionvoidLoad the Activities from Strava by parsing the activities.csv-file inside the export-folder.private voidparseCSVLine(List<String> line, Instant start, Instant end) Parses a line of the CSV representing a single ActivityMethods inherited from class yearreview.app.data.sources.fitness.adapters.FitnessAdapter
getAdapter
-
Field Details
-
dataPath
Relative path where to load the data from. -
language
private final int languageIndex of the language of the data. (currently only supports german) -
logger
-
languageNameToIdMapMap
Map to convert the shorthand of the language to the index. -
languageToDateformat
Array of DateTimeFormatters for all languages. -
activityStringToType
List of Maps for all languages to convert the names of activities to theActivityTypes.
-
-
Constructor Details
-
StravaAdapter
Constructs a StravaAdapter from a FitnessDatabase and configuration- Parameters:
database- database to insert the activities intoconfig- configuration
-
-
Method Details
-
loadData
Load the Activities from Strava by parsing the activities.csv-file inside the export-folder.- Specified by:
loadDatain classFitnessAdapter- Parameters:
start- start time of data to loadend- end time of data to load- Throws:
IOException- if theCSVReadercannot read the file
-
parseCSVLine
Parses a line of the CSV representing a single Activity- Parameters:
line- line to parsestart- start time of Activities to considerend- end time of Activities to consider
-