Skip to content

Instantly share code, notes, and snippets.

View abhishek-sisodiya's full-sized avatar
🙃

Abhishek Sisodiya abhishek-sisodiya

🙃
View GitHub Profile
package com.org.project.theWeatherMan.controller;
/**
* This controller class handle request and response for Weather.
*
* @author abhishek.sisodiya
* @since 01/07/2019.
*/
@RestApiController("/getweather")
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());
package com.org.project.theWeatherMan.controller;
/**
* This controller class handle request/response for summary provider.
*
* @author abhishek.sisodiya
* @since 03/07/2019.
*/
@RestController
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) {
package com.org.project.theWeatherMan.controller;
/**
* This controller class handle request/response for login and register.
*
* @author abhishek.sisodiya
* @since 03/07/2019.
*/
@RestController
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
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
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) {
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)
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