@startuml

skinparam titleBorderRoundCorner 10
skinparam titleBorderThickness 3
skinparam titleBorderColor indianred
skinparam titleBackgroundColor ivory
skinparam FontName quicksand

skinparam actor {
  BorderColor indianred
  }

skinparam sequence {
  LifeLineBackgroundColor indianred
  ParticipantBackgroundColor ivory
}

skinparam roundcorner 10

skinparam component {
  arrowThickness 1
  ArrowFontName Verdana
  ArrowColor indianred
  ArrowFontColor darkslategrey
}

title US020 \n  As an Administrator I want to import geographic area sensor readings into the application from a either a CSV, JSON or XML file. \n Data outside the valid sensor operation period should not be imported but registered in the application log.


actor Administrator
Administrator -> GASettingsUI: Import data from .csv/.json/.xml file
activate GASettingsUI
GASettingsUI -> GASettingsUI: US20()
GASettingsUI -> InputHelperUI: String filePath = getInputJsonXmlCsv();
ref over InputHelperUI
Get Valid
Input Path
end ref


alt if CSV file
GASettingsUI -> "<<ReadingsReader>>": readFile(filePath)
activate "<<ReadingsReader>>"
ref over "<<ReadingsReader>>"
Read readings from
CSV file reading
end ref


"<<ReadingsReader>>" -> GASettingsUI: List<ReadingDTO>
else else if JSON file
GASettingsUI -> "<<ReadingsReader>>": readFile(filePath)
ref over "<<ReadingsReader>>"
Read readings from
JSON file reading
end ref
"<<ReadingsReader>>" -> GASettingsUI: List<ReadingDTO>
else else if XML file
GASettingsUI -> "<<ReadingsReader>>": readFile(filePath)
ref over "<<ReadingsReader>>"
Read readings from
XML file reading
end ref
"<<ReadingsReader>>" -> GASettingsUI: List<ReadingDTO>
deactivate "<<ReadingsReader>>"
end

GASettingsUI -> ReadingsController: addReadingsToGeographicAreaSensors(List<ReadingDTO>, LogPath, GeographicAreaService)
ref over ReadingsController
Add Readings to
Geographic Area Sensors
end ref
ReadingsController -> GASettingsUI: int added Readings
GASettingsUI -> Administrator: display message
deactivate GASettingsUI

@enduml