This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.port=${WEBSITES_PORT} | |
spring.redis.host=${REDIS_HOST} | |
spring.redis.port=${REDIS_PORT} | |
spring.redis.password=${REDIS_PASSWORD} | |
# Database Connection | |
jwt.secret=${JWT_SECRET} | |
spring.datasource.url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/weathermandb?useSSL=false&requireSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC | |
spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables: | |
dockerId: weatherman | |
pswd: | |
imageName: weathermanjava5639 | |
steps: | |
- script: | | |
docker build -t $(dockerId).azurecr.io/$(imageName) . | |
docker login -u $(dockerId) -p $(pswd) $(dockerId).azurecr.io | |
docker push $(dockerId).azurecr.io/$(imageName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (Object word : elements) { | |
if (Pattern.compile(Pattern.quote("rain"), Pattern.CASE_INSENSITIVE).matcher(word.toString()).find()) { | |
descVote.add("Rainy"); | |
iconVote.add("HeavyRain.png"); | |
} | |
} | |
MAX_DESC = maxVote(descVote); | |
MAX_ICON = maxVote(iconVote); | |
private String maxVote(List list) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.project.theWeatherMan.controller; | |
/** | |
* This controller class handle request/response for average of all providers. | |
* | |
* @author abhishek.sisodiya | |
* @since 03/07/2019. | |
*/ | |
@RestController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.project.theWeatherMan.service; | |
/** | |
* This service will be used to implement user vote for provider. | |
* | |
* @author abhishek.sisodiya | |
* @since 01/07/2019. | |
*/ | |
@Service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.project.theWeatherMan.controller; | |
/** | |
* This controller class handle request/response for login and register. | |
* | |
* @author abhishek.sisodiya | |
* @since 03/07/2019. | |
*/ | |
@RestController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int MAX_PROVIDER_ID = 0; | |
public Map<String, Object> summaryProvider() throws Exception { | |
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
String previousYear = dateFormat.format(getPreviousYear()); | |
String yesterday = dateFormat.format(yesterday()); | |
Map<String, Object> json = new HashMap<String, Object>(); | |
Map<String, Object> fromCache = cacheManager.get("summaryProvider", "FAV_PROVIDER_ID", Map.class); | |
if (fromCache != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.project.theWeatherMan.controller; | |
/** | |
* This controller class handle request/response for summary provider. | |
* | |
* @author abhishek.sisodiya | |
* @since 03/07/2019. | |
*/ | |
@RestController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, Object> cachedData = cacheManager.get(lat + longi, "darksky", Map.class); | |
if (cachedData != null) { | |
return cachedData; | |
} else { | |
Map<String, Object> json = new HashMap<String, Object>(); | |
RestTemplate restTemplate = new RestTemplate(); | |
String url = String.format("https://api.darksky.net/forecast/%s/%s,%s", darkskyKey, lat, longi); | |
try { | |
ResponseEntity<Object> response = restTemplate.getForEntity(url, Object.class); | |
json.put("darksky", response.getBody()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.project.theWeatherMan.controller; | |
/** | |
* This controller class handle request and response for Weather. | |
* | |
* @author abhishek.sisodiya | |
* @since 01/07/2019. | |
*/ | |
@RestApiController("/getweather") |