Commit cabb31c9 authored by Karakas's avatar Karakas
Browse files

Merge branch 'devbackend' into 'master'

Merge Maximus

See merge request !4
parents 888289d4 249ac5e3
This diff is collapsed.
import React from "react";
import Navbar4 from "../components/navbar4";
import Footer15 from "../components/footer15";
import Navbar4 from "../components/homepage/navbar4";
import Footer15 from "../components/homepage/footer15";
import Features_about1 from "../components/homepage/features_about1";
import Features_about2 from "../components/homepage/features_about2";
import "./home.css";
const About = (props) => {
......@@ -12,7 +14,12 @@ const About = (props) => {
<div className="home-navbar1">
<Navbar4 rootClassName="navbar4-root-class-name"></Navbar4>
</div>
<div className="home-features5">
<Features_about1></Features_about1>
</div>
<div className="home-features6">
<Features_about2></Features_about2>
</div>
<div className="home-footer11">
<Footer15></Footer15>
</div>
......
import React from "react";
import Navbar4 from "../components/navbar4";
import Footer15 from "../components/footer15";
import Navbar4 from "../components/homepage/navbar4";
import Footer15 from "../components/homepage/footer15";
import Currentdata from "../components/weather/currentData";
import "./home.css";
import "./data.css";
const Data = (props) => {
function getData() {
const city = document.getElementById("city").value;
const region = document.getElementById("region").value;
const country = document.getElementById("country").value;
const latitude = document.getElementById("latitude").value;
const longitude = document.getElementById("longitude").value;
const temperature = document.getElementById("temperature").checked;
const isDay = document.getElementById("isDay").checked;
const condition = document.getElementById("condition").checked;
const pressure = document.getElementById("pressure").checked;
const precipitation = document.getElementById("precipitation").checked;
const humidity = document.getElementById("humidity").checked;
const cloud = document.getElementById("cloud").checked;
const feelslikeTemp = document.getElementById("feelslikeTemp").checked;
const visibility = document.getElementById("visibility").checked;
const uv = document.getElementById("uv").checked;
const gust = document.getElementById("gust").checked;
const airquality = boolToWord(
document.getElementById("airquality").checked
);
const unitTemperature = document.getElementById("unitTemperature").value;
const unitWindSpeed = document.getElementById("unitWindSpeed").value;
const unitPressure = document.getElementById("unitPressure").value;
const unitPrecipitation =
document.getElementById("unitPrecipitation").value;
const output = document.getElementById("output").value;
const format = document.getElementById("format").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/current.${format}?key=${apiKey}&q=${city}&aqi=${airquality}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
document.getElementById("apiUrloutput").value = apiUrl;
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function searchAPI() {
const cityInput = document.getElementById("city").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/search.json?key=${apiKey}&q=${cityInput}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function boolToWord(bool) {
return bool ? "yes" : "no";
}
return (
<div className="home-container">
return(
<div>
<div className="home-navbar1">
<Navbar4 rootClassName="navbar4-root-class-name"></Navbar4>
</div>
<div>
<div className="thq-grid-5">
<div class="filter">
<label for="city">City:</label>
<input type="text" id="city" placeholder="City" />
<br />
<label for="city">Region:</label>
<input type="text" id="region" placeholder="Region" />
<br />
<label>Country:</label>
<input type="text" id="country" placeholder="Country" />
<br />
<label>Latitude:</label>
<input type="text" id="latitude" placeholder="Latitude" />
<label>Longitude:</label>
<input type="text" id="longitude" placeholder="Longitude" />
<br />
<div className="Currentdata">
<Currentdata></Currentdata>
</div>
<div>
<input
type="checkbox"
id="temperature"
className="checkBoxFilter"
/>
<label> Temprature</label>
<br />
<input type="checkbox" id="isDay" className="checkBoxFilter" />
<label> Is it day?</label>
<br />
<input type="checkbox" id="condition" className="checkBoxFilter" />
<label> Condition</label>
<br />
<input type="checkbox" id="pressure" className="checkBoxFilter" />
<label> Pressure</label>
<br />
<input
type="checkbox"
id="precipitation"
className="checkBoxFilter"
/>
<label> Precipitation</label>
<br />
<input type="checkbox" id="humidity" className="checkBoxFilter" />
<label> Humidity</label>
<br />
<input type="checkbox" id="cloud" className="checkBoxFilter" />
<label> Cloud</label>
<br />
<input
type="checkbox"
id="feelslikeTemp"
className="checkBoxFilter"
/>
<label> Feelslike Temp.</label>
<br />
<input type="checkbox" id="visibility" className="checkBoxFilter" />
<label> Visibility</label>
<br />
<input type="checkbox" id="uv" className="checkBoxFilter" />
<label> UV-Index</label>
<br />
<input type="checkbox" id="gust" className="checkBoxFilter" />
<label> Gust</label>
<br />
<input type="checkbox" id="airquality" className="checkBoxFilter" />
<label> Airquality</label>
<br />
</div>
<div class="filter">
<label>Temperature Unit:</label>
<select id="unitTemperature">
<option value="temp_c">Celsius</option>
<option value="temp_f">Fahrenheit</option>
</select>
<label>Wind speed Unit:</label>
<select id="unitWindSpeed">
<option value="wind_kph">km/h</option>
<option value="wind_mph">Mph</option>
</select>
<label>Pressure Unit:</label>
<select id="unitPressure">
<option value="pressure_mb">Millibar</option>
<option value="pressure_in">Inch</option>
</select>
<label>Precipitation Unit:</label>
<select id="unitPrecipitation">
<option value="precip_mm">Millimeter</option>
<option value="precip_in">Inch</option>
</select>
</div>
<div class="filter">
<label>Output:</label>
<select id="output">
<option value="local">Local</option>
<option value="database">API</option>
</select>
<br />
<label>Data format:</label>
<select id="format">
<option value="json">JSON</option>
<option value="csv">CSV</option>
<option value="xml">XML</option>
</select>
<br />
<button className="APIButton" onClick={searchAPI}>City api</button>
</div>
</div>
<div>
<button className="thq-button-filled" onClick={getData}>
Generate
</button>
</div>
<div class="output">
<h2>Output:</h2>
<br />
<pre id="weatherData"></pre>
</div>
</div>
<div id="apiUrl">
<label>API URL:</label>
<br />
<input className="input" type="text" id="apiUrloutput" readOnly />
</div>
<div className="home-footer11">
<Footer15></Footer15>
</div>
</div>
</div>
);
};
......
import React from "react";
import Navbar4 from "../components/navbar4";
import Footer15 from "../components/footer15";
import Navbar4 from "../components/homepage/navbar4";
import Footer15 from "../components/homepage/footer15";
import HistoricalWeatherData from "../components/weather/historicalWeatherData";
import "./home.css";
import "./data.css";
const Historicalweather = (props) => {
function getData() {
const city = document.getElementById("city").value;
const region = document.getElementById("region").value;
const country = document.getElementById("country").value;
const latitude = document.getElementById("latitude").value;
const longitude = document.getElementById("longitude").value;
const temperature = document.getElementById("temperature").checked;
const isDay = document.getElementById("isDay").checked;
const condition = document.getElementById("condition").checked;
const pressure = document.getElementById("pressure").checked;
const precipitation = document.getElementById("precipitation").checked;
const humidity = document.getElementById("humidity").checked;
const cloud = document.getElementById("cloud").checked;
const feelslikeTemp = document.getElementById("feelslikeTemp").checked;
const visibility = document.getElementById("visibility").checked;
const uv = document.getElementById("uv").checked;
const gust = document.getElementById("gust").checked;
const airquality = boolToWord(
document.getElementById("airquality").checked
);
const unitTemperature = document.getElementById("unitTemperature").value;
const unitWindSpeed = document.getElementById("unitWindSpeed").value;
const unitPressure = document.getElementById("unitPressure").value;
const unitPrecipitation =
document.getElementById("unitPrecipitation").value;
const output = document.getElementById("output").value;
const format = document.getElementById("format").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/current.${format}?key=${apiKey}&q=${city}&aqi=${airquality}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
document.getElementById("apiUrloutput").value = apiUrl;
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function searchAPI() {
const cityInput = document.getElementById("city").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/search.json?key=${apiKey}&q=${cityInput}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function boolToWord(bool) {
return bool ? "yes" : "no";
}
return (
<div className="home-container">
return(
<div>
<div className="home-navbar1">
<Navbar4 rootClassName="navbar4-root-class-name"></Navbar4>
</div>
<div>
<div className="thq-grid-5">
<div class="filter">
<label for="city">City:</label>
<input type="text" id="city" placeholder="City" />
<br />
<label for="city">Region:</label>
<input type="text" id="region" placeholder="Region" />
<br />
<label>Country:</label>
<input type="text" id="country" placeholder="Country" />
<br />
<label>Latitude:</label>
<input type="text" id="latitude" placeholder="Latitude" />
<label>Longitude:</label>
<input type="text" id="longitude" placeholder="Longitude" />
<br />
<div className="HistoricalWeatherData">
<HistoricalWeatherData></HistoricalWeatherData>
</div>
<div>
<input
type="checkbox"
id="temperature"
className="checkBoxFilter"
/>
<label> Temprature</label>
<br />
<input type="checkbox" id="isDay" className="checkBoxFilter" />
<label> Is it day?</label>
<br />
<input type="checkbox" id="condition" className="checkBoxFilter" />
<label> Condition</label>
<br />
<input type="checkbox" id="pressure" className="checkBoxFilter" />
<label> Pressure</label>
<br />
<input
type="checkbox"
id="precipitation"
className="checkBoxFilter"
/>
<label> Precipitation</label>
<br />
<input type="checkbox" id="humidity" className="checkBoxFilter" />
<label> Humidity</label>
<br />
<input type="checkbox" id="cloud" className="checkBoxFilter" />
<label> Cloud</label>
<br />
<input
type="checkbox"
id="feelslikeTemp"
className="checkBoxFilter"
/>
<label> Feelslike Temp.</label>
<br />
<input type="checkbox" id="visibility" className="checkBoxFilter" />
<label> Visibility</label>
<br />
<input type="checkbox" id="uv" className="checkBoxFilter" />
<label> UV-Index</label>
<br />
<input type="checkbox" id="gust" className="checkBoxFilter" />
<label> Gust</label>
<br />
<input type="checkbox" id="airquality" className="checkBoxFilter" />
<label> Airquality</label>
<br />
</div>
<div class="filter">
<label>Temperature Unit:</label>
<select id="unitTemperature">
<option value="temp_c">Celsius</option>
<option value="temp_f">Fahrenheit</option>
</select>
<label>Wind speed Unit:</label>
<select id="unitWindSpeed">
<option value="wind_kph">km/h</option>
<option value="wind_mph">Mph</option>
</select>
<label>Pressure Unit:</label>
<select id="unitPressure">
<option value="pressure_mb">Millibar</option>
<option value="pressure_in">Inch</option>
</select>
<label>Precipitation Unit:</label>
<select id="unitPrecipitation">
<option value="precip_mm">Millimeter</option>
<option value="precip_in">Inch</option>
</select>
</div>
<div class="filter">
<label>Output:</label>
<select id="output">
<option value="local">Local</option>
<option value="database">API</option>
</select>
<br />
<label>Data format:</label>
<select id="format">
<option value="json">JSON</option>
<option value="csv">CSV</option>
<option value="xml">XML</option>
</select>
<br />
<button className="APIButton" onClick={searchAPI}>City api</button>
</div>
</div>
<div>
<button className="thq-button-filled" onClick={getData}>
Generate
</button>
</div>
<div class="output">
<h2>Output:</h2>
<br />
<pre id="weatherData"></pre>
</div>
</div>
<div id="apiUrl">
<label>API URL:</label>
<br />
<input className="input" type="text" id="apiUrloutput" readOnly />
</div>
<div className="home-footer11">
<Footer15></Footer15>
</div>
</div>
</div>
);
};
......
......@@ -2,16 +2,16 @@ import React from "react";
import { Helmet } from "react-helmet";
import Navbar4 from "../components/navbar4";
import Hero3 from "../components/hero3";
import Logos1 from "../components/logos1";
import Gallery1 from "../components/gallery1";
import Features17 from "../components/features17";
import Features18 from "../components/features18";
import Features171 from "../components/features171";
import CTA1 from "../components/cta1";
import Contact4 from "../components/contact4";
import Footer15 from "../components/footer15";
import Navbar4 from "../components/homepage/navbar4";
import Hero3 from "../components/homepage/hero3";
import Logos1 from "../components/homepage/logos1";
import Gallery1 from "../components/homepage/gallery1";
import Features17 from "../components/homepage/features17";
import Features18 from "../components/homepage/features18";
import Features171 from "../components/homepage/features171";
import CTA1 from "../components/homepage/cta1";
import Contact4 from "../components/homepage/contact4";
import Footer15 from "../components/homepage/footer15";
import "./home.css";
const Home = (props) => {
......
import React from "react";
import Navbar4 from "../components/navbar4";
import Footer15 from "../components/footer15";
import Navbar4 from "../components/homepage/navbar4";
import Footer15 from "../components/homepage/footer15";
import WeatherForecastData from "../components/weather/weatherForecastData";
import "./home.css";
import "./data.css";
const Weatherforecast = (props) => {
function getData() {
const city = document.getElementById("city").value;
const region = document.getElementById("region").value;
const country = document.getElementById("country").value;
const latitude = document.getElementById("latitude").value;
const longitude = document.getElementById("longitude").value;
const temperature = document.getElementById("temperature").checked;
const isDay = document.getElementById("isDay").checked;
const condition = document.getElementById("condition").checked;
const pressure = document.getElementById("pressure").checked;
const precipitation = document.getElementById("precipitation").checked;
const humidity = document.getElementById("humidity").checked;
const cloud = document.getElementById("cloud").checked;
const feelslikeTemp = document.getElementById("feelslikeTemp").checked;
const visibility = document.getElementById("visibility").checked;
const uv = document.getElementById("uv").checked;
const gust = document.getElementById("gust").checked;
const airquality = boolToWord(
document.getElementById("airquality").checked
);
const unitTemperature = document.getElementById("unitTemperature").value;
const unitWindSpeed = document.getElementById("unitWindSpeed").value;
const unitPressure = document.getElementById("unitPressure").value;
const unitPrecipitation =
document.getElementById("unitPrecipitation").value;
const output = document.getElementById("output").value;
const format = document.getElementById("format").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/current.${format}?key=${apiKey}&q=${city}&aqi=${airquality}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
document.getElementById("apiUrloutput").value = apiUrl;
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function searchAPI() {
const cityInput = document.getElementById("city").value;
const apiKey = "1244099aeaee4b179e6111803241304";
const apiUrl = `https://api.weatherapi.com/v1/search.json?key=${apiKey}&q=${cityInput}`;
fetch(apiUrl)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
// Wetterdaten anzeigen
document.getElementById("weatherData").innerText = JSON.stringify(
data,
null,
2
);
})
.catch((error) => {
console.error("There was a problem with the fetch operation:", error);
});
}
function boolToWord(bool) {
return bool ? "yes" : "no";
}
return (
<div className="home-container">
return(
<div>
<div className="home-navbar1">
<Navbar4 rootClassName="navbar4-root-class-name"></Navbar4>
</div>
<div>
<div className="thq-grid-5">
<div class="filter">
<label for="city">City:</label>
<input type="text" id="city" placeholder="City" />
<br />
<label for="city">Region:</label>
<input type="text" id="region" placeholder="Region" />
<br />
<label>Country:</label>
<input type="text" id="country" placeholder="Country" />
<br />
<label>Latitude:</label>
<input type="text" id="latitude" placeholder="Latitude" />
<label>Longitude:</label>
<input type="text" id="longitude" placeholder="Longitude" />
<br />
</div>
<div>
<input
type="checkbox"
id="temperature"
className="checkBoxFilter"
/>
<label> Temprature</label>
<br />
<input type="checkbox" id="isDay" className="checkBoxFilter" />
<label> Is it day?</label>
<br />
<input type="checkbox" id="condition" className="checkBoxFilter" />
<label> Condition</label>
<br />
<input type="checkbox" id="pressure" className="checkBoxFilter" />
<label> Pressure</label>
<br />
<input
type="checkbox"
id="precipitation"
className="checkBoxFilter"
/>
<label> Precipitation</label>
<br />
<input type="checkbox" id="humidity" className="checkBoxFilter" />
<label> Humidity</label>
<br />
<input type="checkbox" id="cloud" className="checkBoxFilter" />
<label> Cloud</label>
<br />
<input
type="checkbox"
id="feelslikeTemp"
className="checkBoxFilter"
/>
<label> Feelslike Temp.</label>
<br />
<input type="checkbox" id="visibility" className="checkBoxFilter" />
<label> Visibility</label>
<br />
<input type="checkbox" id="uv" className="checkBoxFilter" />
<label> UV-Index</label>
<br />
<input type="checkbox" id="gust" className="checkBoxFilter" />
<label> Gust</label>
<br />
<input type="checkbox" id="airquality" className="checkBoxFilter" />
<label> Airquality</label>
<br />
</div>
<div class="filter">
<label>Temperature Unit:</label>
<select id="unitTemperature">
<option value="temp_c">Celsius</option>
<option value="temp_f">Fahrenheit</option>
</select>
<label>Wind speed Unit:</label>
<select id="unitWindSpeed">
<option value="wind_kph">km/h</option>
<option value="wind_mph">Mph</option>
</select>
<label>Pressure Unit:</label>
<select id="unitPressure">
<option value="pressure_mb">Millibar</option>
<option value="pressure_in">Inch</option>
</select>
<label>Precipitation Unit:</label>
<select id="unitPrecipitation">
<option value="precip_mm">Millimeter</option>
<option value="precip_in">Inch</option>
</select>
<div className="WeatherForecastData">
<WeatherForecastData></WeatherForecastData>
</div>
<div class="filter">
<label>Output:</label>
<select id="output">
<option value="local">Local</option>
<option value="database">API</option>
</select>
<br />
<label>Data format:</label>
<select id="format">
<option value="json">JSON</option>
<option value="csv">CSV</option>
<option value="xml">XML</option>
</select>
<br />
<button className="APIButton" onClick={searchAPI}>City api</button>
</div>
</div>
<div>
<button className="thq-button-filled" onClick={getData}>
Generate
</button>
</div>
<div class="output">
<h2>Output:</h2>
<br />
<pre id="weatherData"></pre>
</div>
</div>
<div id="apiUrl">
<label>API URL:</label>
<br />
<input className="input" type="text" id="apiUrloutput" readOnly />
</div>
<div className="home-footer11">
<Footer15></Footer15>
</div>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-spring</artifactId>
<packaging>jar</packaging>
<name>swagger-spring</name>
<version>1.0.0</version>
<properties>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springdoc-version>1.7.0</springdoc-version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
<version>2.1.16.RELEASE</version>
</parent>
<groupId>com.SWP.SS24</groupId>
<artifactId>Wetterdaten.sammeln</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Wetterdaten.sammeln</name>
<description>Wetterdaten aus dem Netz sammeln und speichern.</description>
<properties>
<java.version>21</java.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!--SpringFox dependencies -->
<!-- SpringDoc dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-version}</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.6.4</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
</dependencies>
</project>
package com.SWP.SS24.Wetterdaten_sammeln;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package com.SWP.SS24.Wetterdaten_sammeln.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class historicData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
}
package io.swagger;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.FieldPosition;
import java.util.Date;
@SuppressWarnings("deprecation")
public class RFC3339DateFormat extends ISO8601DateFormat {
private static final long serialVersionUID = 1L;
// Same as ISO8601DateFormat but serializing milliseconds.
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
}
}
\ No newline at end of file
package io.swagger;
import io.swagger.configuration.LocalDateConverter;
import io.swagger.configuration.LocalDateTimeConverter;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@SuppressWarnings("deprecation")
@SpringBootApplication
@ComponentScan(basePackages = { "io.swagger", "io.swagger.api", "io.swagger.configuration" })
public class Swagger2SpringBoot implements CommandLineRunner {
@Override
public void run(String... arg0) throws Exception {
if (arg0.length > 0 && arg0[0].equals("exitcode")) {
throw new ExitException();
}
}
public static void main(String[] args) throws Exception {
new SpringApplication(Swagger2SpringBoot.class).run(args);
}
@Configuration
static class CustomDateConfig extends WebMvcConfigurerAdapter {
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new LocalDateConverter("yyyy-MM-dd"));
registry.addConverter(new LocalDateTimeConverter("yyyy-MM-dd'T'HH:mm:ss.SSS"));
}
}
class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
@Override
public int getExitCode() {
return 10;
}
}
}
package io.swagger.api;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
public class ApiException extends Exception {
@SuppressWarnings("unused")
private int code;
public ApiException(int code, String msg) {
super(msg);
this.code = code;
}
}
package io.swagger.api;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
public class ApiOriginFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
res.addHeader("Access-Control-Allow-Origin", "*");
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}
package io.swagger.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
@javax.xml.bind.annotation.XmlRootElement
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
public static final int INFO = 3;
public static final int OK = 4;
public static final int TOO_BUSY = 5;
int code;
String type;
String message;
public ApiResponseMessage(){}
public ApiResponseMessage(int code, String message){
this.code = code;
switch(code){
case ERROR:
setType("error");
break;
case WARNING:
setType("warning");
break;
case INFO:
setType("info");
break;
case OK:
setType("ok");
break;
case TOO_BUSY:
setType("too busy");
break;
default:
setType("unknown");
break;
}
this.message = message;
}
@XmlTransient
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package io.swagger.api;
import org.springframework.web.client.RestTemplate;
import org.springframework.http.ResponseEntity;
public class ApiService {
private final RestTemplate restTemplate;
public ApiService(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
public String getDataFromFirstApi(String apiUrl) {
ResponseEntity<String> response = restTemplate.getForEntity(apiUrl, String.class);
return response.getBody();
}
}
package io.swagger.api;
import io.swagger.model.Model200;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.*;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
@Validated
public interface CurrentweatherApi {
@Operation(summary = "Call current weather data for one location", description = "Get the current weather info", tags = {
"Current Weather Data" })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful response", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Model200.class))),
@ApiResponse(responseCode = "404", description = "Not found response", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) })
@RequestMapping(value = "/currentweather", produces = { "application/json",
"text/plain" }, method = RequestMethod.GET)
ResponseEntity<Model200> currentWeatherData(
@NotNull @Parameter(in = ParameterIn.QUERY, description = "For the query value, type the city name and optionally the country code divided by comma; use ISO 3166 country codes.", required = true, schema = @Schema()) @Valid @RequestParam(value = "q", required = true) String q,
@Parameter(in = ParameterIn.QUERY, description = "filter parameter", schema = @Schema()) @Valid @RequestParam(value = "filter", required = false) String filter);
}
package io.swagger.api;
import io.swagger.model.Model200;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
@RestController
public class CurrentweatherApiController implements CurrentweatherApi {
private static final Logger log = LoggerFactory.getLogger(CurrentweatherApiController.class);
private final ObjectMapper objectMapper;
@SuppressWarnings("unused")
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public CurrentweatherApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<Model200> currentWeatherData(
@NotNull @Parameter(in = ParameterIn.QUERY, description = "For the query value, type the city name and optionally the country code divided by comma; use ISO 3166 country codes.", required = true, schema = @Schema()) @Valid @RequestParam(value = "q", required = true) String q,
@Parameter(in = ParameterIn.QUERY, description = "filter parameter", schema = @Schema()) @Valid @RequestParam(value = "filter", required = false) String filter) {
try {
String datafree = "{}";
RestTemplate restTemplate = new RestTemplate();
ApiService apiService = new ApiService(restTemplate);
String data = apiService.getDataFromFirstApi(
"https://api.weatherapi.com/v1/current.json?key=1244099aeaee4b179e6111803241304&q=" + q
+ "&aqi=yes");
ResponseEntity<Model200> response = new ResponseEntity<Model200>(objectMapper.readValue(
data, Model200.class), HttpStatus.ACCEPTED);
ResponseEntity<Model200> response2 = new ResponseEntity<Model200>(objectMapper.readValue(
datafree, Model200.class), HttpStatus.ACCEPTED);
String[] filterlist = filter.split(",");
for (String filterindex : filterlist) {
switch (filterindex) {
case "last_updated_epoch":
response2.getBody().getCurrent()
.setLastUpdatedEpoch(response.getBody().getCurrent().getLastUpdatedEpoch());
break;
case "last_updated":
response2.getBody().getCurrent()
.setLastUpdated(response.getBody().getCurrent().getLastUpdated());
break;
case "temp_c":
response2.getBody().getCurrent().setTempC(response.getBody().getCurrent().getTempC());
break;
case "temp_f":
response2.getBody().getCurrent().setTempF(response.getBody().getCurrent().getTempF());
break;
case "id_day":
response2.getBody().getCurrent().setIdDay(response.getBody().getCurrent().getIdDay());
break;
case "condition":
response2.getBody().getCurrent().setCondition(response.getBody().getCurrent().getCondition());
break;
case "wind_mph":
response2.getBody().getCurrent().setWindMph(response.getBody().getCurrent().getWindMph());
break;
case "wind_kph":
response2.getBody().getCurrent().setWindKph(response.getBody().getCurrent().getWindKph());
break;
case "wind_degree":
response2.getBody().getCurrent().setWindDegree(response.getBody().getCurrent().getWindDegree());
break;
case "wind_dir":
response2.getBody().getCurrent().setWindDir(response.getBody().getCurrent().getWindDir());
break;
case "pressure_mb":
response2.getBody().getCurrent().setPressureMb(response.getBody().getCurrent().getPressureMb());
break;
case "pressure_in":
response2.getBody().getCurrent().setPressureIn(response.getBody().getCurrent().getPressureIn());
break;
case "precip_mm":
response2.getBody().getCurrent().setPrecipMm(response.getBody().getCurrent().getPrecipMm());
break;
case "precip_in":
response2.getBody().getCurrent().setPrecipIn(response.getBody().getCurrent().getPrecipIn());
break;
case "humidity":
response2.getBody().getCurrent().setHumidity(response.getBody().getCurrent().getHumidity());
break;
case "cloud":
response2.getBody().getCurrent().setCloud(response.getBody().getCurrent().getCloud());
break;
case "feelslike_c":
response2.getBody().getCurrent().setFeelslikeC(response.getBody().getCurrent().getFeelslikeC());
break;
case "feelslike_f":
response2.getBody().getCurrent().setFeelslikeF(response.getBody().getCurrent().getFeelslikeF());
break;
case "windchill_c":
response2.getBody().getCurrent().setWindchillC(response.getBody().getCurrent().getWindchillC());
break;
case "windchill_f":
response2.getBody().getCurrent().setWindchillF(response.getBody().getCurrent().getWindchillF());
break;
case "heatindex_c":
response2.getBody().getCurrent().setHeatindexC(response.getBody().getCurrent().getHeatindexC());
break;
case "heatindex_f":
response2.getBody().getCurrent().setHeatindexF(response.getBody().getCurrent().getHeatindexF());
break;
case "dewpoint_c":
response2.getBody().getCurrent().setDewpointC(response.getBody().getCurrent().getDewpointC());
break;
case "dewpoint_f":
response2.getBody().getCurrent().setDewpointF(response.getBody().getCurrent().getDewpointF());
break;
case "vis_km":
response2.getBody().getCurrent().setVisKm(response.getBody().getCurrent().getVisKm());
break;
case "vis_miles":
response2.getBody().getCurrent().setVisMiles(response.getBody().getCurrent().getVisMiles());
break;
case "uv":
response2.getBody().getCurrent().setUv(response.getBody().getCurrent().getUv());
break;
case "gust_mph":
response2.getBody().getCurrent().setGustMph(response.getBody().getCurrent().getGustMph());
break;
case "gust_kph":
response2.getBody().getCurrent().setGustKph(response.getBody().getCurrent().getGustKph());
break;
case "air_quality":
response2.getBody().getCurrent().setAirQuality(response.getBody().getCurrent().getAirQuality());
break;
case "name":
response2.getBody().getLocation().setName(response.getBody().getLocation().getName());
break;
case "region":
response2.getBody().getLocation().setRegion(response.getBody().getLocation().getRegion());
break;
case "country":
response2.getBody().getLocation().setCountry(response.getBody().getLocation().getCountry());
break;
case "lon":
response2.getBody().getLocation().setLon(response.getBody().getLocation().getLon());
break;
case "lat":
response2.getBody().getLocation().setLat(response.getBody().getLocation().getLat());
break;
case "tz_id":
response2.getBody().getLocation().setTzId(response.getBody().getLocation().getTzId());
break;
case "localtime_epoch":
response2.getBody().getLocation()
.setLocaltimeEpoch(response.getBody().getLocation().getLocaltimeEpoch());
break;
case "localtime":
response2.getBody().getLocation().setLocaltime(response.getBody().getLocation().getLocaltime());
break;
case "co":
response2.getBody().getCurrent().getAirQuality()
.setCo(response.getBody().getCurrent().getAirQuality().getCo());
break;
case "no2":
response2.getBody().getCurrent().getAirQuality()
.setNo2(response.getBody().getCurrent().getAirQuality().getNo2());
break;
case "o3":
response2.getBody().getCurrent().getAirQuality()
.setO3(response.getBody().getCurrent().getAirQuality().getO3());
break;
case "so2":
response2.getBody().getCurrent().getAirQuality()
.setSo2(response.getBody().getCurrent().getAirQuality().getSo2());
break;
case "pm2_5":
response2.getBody().getCurrent().getAirQuality()
.setPm25(response.getBody().getCurrent().getAirQuality().getPm25());
break;
case "pm10":
response2.getBody().getCurrent().getAirQuality()
.setPm10(response.getBody().getCurrent().getAirQuality().getPm10());
break;
case "us-epa-index":
response2.getBody().getCurrent().getAirQuality()
.setUsEpaIndex(response.getBody().getCurrent().getAirQuality().getUsEpaIndex());
break;
case "gb-defra-index":
response2.getBody().getCurrent().getAirQuality()
.setGbDefraIndex(response.getBody().getCurrent().getAirQuality().getGbDefraIndex());
break;
case "text":
response2.getBody().getCurrent().getCondition()
.setText(response.getBody().getCurrent().getCondition().getText());
break;
case "icon":
response2.getBody().getCurrent().getCondition()
.setIcon(response.getBody().getCurrent().getCondition().getIcon());
break;
case "code":
response2.getBody().getCurrent().getCondition()
.setCode(response.getBody().getCurrent().getCondition().getCode());
break;
default:
break;
}
}
return response2;
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<Model200>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
package io.swagger.api;
import io.swagger.model.Model200;
import io.swagger.model.Modelforecast;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.*;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
@Validated
public interface ForecastweatherApi {
@Operation(summary = "Call forecast weather data for one location", description = "Get the forecast weather info", tags = {
"Forecast Weather Data" })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful response", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Model200.class))),
@ApiResponse(responseCode = "404", description = "Not found response", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) })
@RequestMapping(value = "/forecastweather", produces = { "application/json",
"text/plain" }, method = RequestMethod.GET)
ResponseEntity<Modelforecast> forecastWeatherData(
@NotNull @Parameter(in = ParameterIn.QUERY, description = "For the query value, type the city name and optionally the country code divided by comma; use ISO 3166 country codes.", required = true, schema = @Schema()) @Valid @RequestParam(value = "q", required = true) String q,
@Parameter(in = ParameterIn.QUERY, description = "forcast days", required = true, schema = @Schema()) @Valid @RequestParam(value = "days", required = true) int days,
@Parameter(in = ParameterIn.QUERY, description = "show alerts", required = true, schema = @Schema()) @Valid @RequestParam(value = "alerts", required = true) String alerts,
@Parameter(in = ParameterIn.QUERY, description = "filter parameter", required = false, schema = @Schema()) @Valid @RequestParam(value = "filter", required = false) String filter);
}
This diff is collapsed.
package io.swagger.api;
import io.swagger.model.InlineResponse200;
import io.swagger.model.Model200;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.*;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-06-04T09:41:03.559554872Z[GMT]")
@Validated
public interface HistoricalweatherApi {
@Operation(summary = "Call Historical weather data for one location", description = "Get the historical weather info", tags = {
"Historical Weather Data" })
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful response", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Model200.class))),
@ApiResponse(responseCode = "404", description = "Not found response", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) })
@RequestMapping(value = "/historicalweather", produces = { "application/json",
"text/plain" }, method = RequestMethod.GET)
ResponseEntity<InlineResponse200> historicalWeatherData(
@NotNull @Parameter(in = ParameterIn.QUERY, description = "Latitude of the location", required = true, schema = @Schema()) @Valid @RequestParam(value = "latitude", required = true) Float latitude,
@NotNull @Parameter(in = ParameterIn.QUERY, description = "Longitude of the location", required = true, schema = @Schema()) @Valid @RequestParam(value = "longitude", required = true) Float longitude,
@NotNull @Parameter(in = ParameterIn.QUERY, description = "The time interval to get weather data. A day must be specified as an ISO8601 date (e.g. 2022-12-31).", required = true, schema = @Schema()) @Valid @RequestParam(value = "start_date", required = true) String start_date,
@NotNull @Parameter(in = ParameterIn.QUERY, description = "The time interval to get weather data. A day must be specified as an ISO8601 date (e.g. 2022-12-31).", required = true, schema = @Schema()) @Valid @RequestParam(value = "end_date", required = true) String end_date,
@Parameter(in = ParameterIn.QUERY, description = "If fahrenheit is set, all temperature values are converted to Fahrenheit.", required = true, schema = @Schema()) @Valid @RequestParam(value = "temperature_unit", required = true) String temperature_unit,
@Parameter(in = ParameterIn.QUERY, description = "Other wind speed speed units: ms, mph and kn", required = true, schema = @Schema()) @Valid @RequestParam(value = "wind_speed_unit", required = true) String wind_speed_unit,
@Parameter(in = ParameterIn.QUERY, description = "Other precipitation amount units: inch", required = true, schema = @Schema()) @Valid @RequestParam(value = "precipitation_unit", required = true) String precipitation_unit,
@Parameter(in = ParameterIn.QUERY, description = "If timezone is set, all timestamps are returned as local-time and data is returned starting at 00:00 local-time. Any time zone name from the time zone database is supported If auto is set as a time zone, the coordinates will be automatically resolved to the local time zone. For multiple coordinates, a comma separated list of timezones can be specified.", required = false, schema = @Schema()) @Valid @RequestParam(value = "timezone", required = false) String timezone,
@Parameter(in = ParameterIn.QUERY, description = "filter parameter hourly", required = false, schema = @Schema()) @Valid @RequestParam(value = "filterHourly", required = false) String filterHourly,
@Parameter(in = ParameterIn.QUERY, description = "filter parameter daily", required = false, schema = @Schema()) @Valid @RequestParam(value = "filterDaily", required = false) String filterDaily);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment