Class WeatherReport

java.lang.Object
fr.utc.miage.sporttrack.entity.activity.WeatherReport

@Entity public class WeatherReport extends Object
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
    Constructor
    Description
    No-argument constructor required by JPA.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the activity to which this weather report is linked.
    Returns the city name associated with this weather report.
    Returns the country associated with this weather report.
    int
    Returns the unique identifier of this weather report.
    double
    Returns 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.
    boolean
    Determines whether the weather conditions are cloudy or foggy.
    boolean
    Determines whether the weather conditions are rainy or snowy.
    boolean
    Determines whether the weather conditions are sunny.
    void
    Sets the activity to which this weather report is linked.
    void
    Sets the city name associated with this weather report.
    void
    setCountry(String country)
    Sets the country associated with this weather report.
    void
    setId(int id)
    Sets the unique identifier of this weather report.
    void
    setPrecipitationSum(double precipitationSum)
    Sets the total precipitation sum.
    void
    setWeatherCode(Integer weatherCode)
    Sets the WMO weather code for this report.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public String getCity()
      Returns the city name associated with this weather report.
      Returns:
      the city name
    • setCity

      public void setCity(String city)
      Sets the city name associated with this weather report.
      Parameters:
      city - the city name to assign
    • getCountry

      public String getCountry()
      Returns the country associated with this weather report.
      Returns:
      the country code or name
    • setCountry

      public void setCountry(String country)
      Sets the country associated with this weather report.
      Parameters:
      country - the country code or name to assign
    • getWeatherCode

      public Integer getWeatherCode()
      Returns the WMO weather code for this report.
      Returns:
      the weather code, or null if unavailable
    • setWeatherCode

      public void setWeatherCode(Integer weatherCode)
      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

      public Activity getActivity()
      Returns the activity to which this weather report is linked.
      Returns:
      the associated Activity
    • setActivity

      public void setActivity(Activity activity)
      Sets the activity to which this weather report is linked.
      Parameters:
      activity - the Activity to 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:
      true if conditions are sunny, false otherwise
    • 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:
      true if conditions indicate rain or snow, false otherwise
    • isCloudyWeather

      public boolean isCloudyWeather()
      Determines whether the weather conditions are cloudy or foggy.
      Returns:
      true if conditions are cloudy, false otherwise
    • getWeatherLabel

      public String getWeatherLabel()
      Returns a French-language label describing the current weather conditions.
      Returns:
      "Pluie" for rain, "Nuageux" for cloudy, or "Ensoleillé" for sunny
    • getWeatherIconClass

      public String 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"