Class WeatherReport
java.lang.Object
fr.utc.miage.sporttrack.entity.activity.WeatherReport
JPA entity representing the weather conditions associated with a given
Activity within the SportTrack application.
The report captures the city, country, WMO weather code, and total precipitation. Convenience methods are provided to classify the weather as sunny, rainy, or cloudy and to obtain a display label and icon class for the user interface.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the activity to which this weather report is linked.getCity()Returns the city name associated with this weather report.Returns the country associated with this weather report.intgetId()Returns the unique identifier of this weather report.doubleReturns the total precipitation sum.Returns the WMO weather code for this report.Returns a Bootstrap Icons CSS class name suitable for rendering a weather icon in the user interface.Returns a French-language label describing the current weather conditions.booleanDetermines whether the weather conditions are cloudy or foggy.booleanisRainy()Determines whether the weather conditions are rainy or snowy.booleanisSunny()Determines whether the weather conditions are sunny.voidsetActivity(Activity activity) Sets the activity to which this weather report is linked.voidSets the city name associated with this weather report.voidsetCountry(String country) Sets the country associated with this weather report.voidsetId(int id) Sets the unique identifier of this weather report.voidsetPrecipitationSum(double precipitationSum) Sets the total precipitation sum.voidsetWeatherCode(Integer weatherCode) Sets the WMO weather code for this report.
-
Constructor Details
-
WeatherReport
public WeatherReport()No-argument constructor required by JPA.
-
-
Method Details
-
getId
public int getId()Returns the unique identifier of this weather report.- Returns:
- the database identifier
-
setId
public void setId(int id) Sets the unique identifier of this weather report.- Parameters:
id- the database identifier to assign
-
getCity
Returns the city name associated with this weather report.- Returns:
- the city name
-
setCity
Sets the city name associated with this weather report.- Parameters:
city- the city name to assign
-
getCountry
Returns the country associated with this weather report.- Returns:
- the country code or name
-
setCountry
Sets the country associated with this weather report.- Parameters:
country- the country code or name to assign
-
getWeatherCode
Returns the WMO weather code for this report.- Returns:
- the weather code, or
nullif unavailable
-
setWeatherCode
Sets the WMO weather code for this report.- Parameters:
weatherCode- the weather code to assign
-
getPrecipitationSum
public double getPrecipitationSum()Returns the total precipitation sum.- Returns:
- the precipitation in millimetres
-
setPrecipitationSum
public void setPrecipitationSum(double precipitationSum) Sets the total precipitation sum.- Parameters:
precipitationSum- the precipitation in millimetres to assign
-
getActivity
Returns the activity to which this weather report is linked.- Returns:
- the associated
Activity
-
setActivity
Sets the activity to which this weather report is linked.- Parameters:
activity- theActivityto associate
-
isSunny
public boolean isSunny()Determines whether the weather conditions are sunny. Falls back to a precipitation-based check when the weather code is unavailable.- Returns:
trueif conditions are sunny,falseotherwise
-
isRainy
public boolean isRainy()Determines whether the weather conditions are rainy or snowy. Falls back to a precipitation-based check when the weather code is unavailable.- Returns:
trueif conditions indicate rain or snow,falseotherwise
-
isCloudyWeather
public boolean isCloudyWeather()Determines whether the weather conditions are cloudy or foggy.- Returns:
trueif conditions are cloudy,falseotherwise
-
getWeatherLabel
Returns a French-language label describing the current weather conditions.- Returns:
- "Pluie" for rain, "Nuageux" for cloudy, or "Ensoleillé" for sunny
-
getWeatherIconClass
Returns a Bootstrap Icons CSS class name suitable for rendering a weather icon in the user interface.- Returns:
- the icon CSS class: "bi-cloud-rain-fill", "bi-cloud-fill", or "bi-sun-fill"
-