Add some doc on functions
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/8f5675a5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/8f5675a5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/8f5675a5 Branch: refs/heads/master Commit: 8f5675a5acdf2f681054f99095aaad18d2553c71 Parents: 0abd143 Author: dinesh1996 <Dragonball21> Authored: Wed Aug 23 22:49:15 2017 +0200 Committer: dinesh1996 <Dragonball21> Committed: Wed Aug 23 22:49:15 2017 +0200 ---------------------------------------------------------------------- .../unomi/weatherupdate/actions/WeatherUpdateAction.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8f5675a5/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java ---------------------------------------------------------------------- diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java index 40031ab..96dc3a7 100644 --- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java +++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java @@ -86,7 +86,6 @@ public class WeatherUpdateAction implements ActionExecutor { JsonNode currentWeatherData = getWeather(location); - if (currentWeatherData.has(STATUS_CODE) && currentWeatherData.get(STATUS_CODE).asText().equals("200")) { updateSessionWithWeatherData(currentWeatherData,session); return EventService.SESSION_UPDATED; @@ -99,6 +98,11 @@ public class WeatherUpdateAction implements ActionExecutor { return EventService.NO_CHANGE; } + /** + * Do the API call + * @param location + * @return the response + */ private JsonNode getWeather(Map<String, Double> location) { //Call to OpenWeatherMap HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes + @@ -130,6 +134,11 @@ public class WeatherUpdateAction implements ActionExecutor { return currentWeatherData; } + /** + * Update the session info with the weather infos + * @param currentWeatherData the response from the API + * @param session + */ private void updateSessionWithWeatherData(JsonNode currentWeatherData, Session session) { String temperature = extractTemperature(currentWeatherData); String weatherLike = extractWeatherLike(currentWeatherData);