Class Budget

java.lang.Object
no.idata1002.group19.domain.entity.Budget

@Entity public class Budget extends Object
Database entitytype representation of a budget.

Each user has a budget assigned to themselves, and the budget holds data regarding the period which the budget is supposed to be active, as well as a upper boundary for how much the user wants to spend. A budget has a one-to-many relationship with the transaction entity-type.

Since:
16.04.2023
Version:
17.04.2023
Author:
Group 19
  • Constructor Details

    • Budget

      public Budget(LocalDate startDate, LocalDate endDate, int boundary)
      Default constructor for budget
      Parameters:
      startDate - start date of the budget. Format (yyyy-MM-dd)
      endDate - end date of the budget. Format (yyyy-MM-dd)
      boundary - the upper bound of the budget spendings.
    • Budget

      public Budget()
      Empty constructor that is needed for JPA
  • Method Details

    • getBid

      public long getBid()
      Returns the id of budget.
      Returns:
      bid.
    • getStartDate

      public LocalDate getStartDate()
      Returns the start date of the budget
      Returns:
      startDate.
    • getEndDate

      public LocalDate getEndDate()
      Returns the end date of the budget.
      Returns:
      endDate.
    • setBid

      public void setBid(long bid)
      Sets the id of budget
      Parameters:
      bid - the bid that you want.
    • setStartDate

      public void setStartDate(LocalDate startDate)
      Sets the start date of the budget.
      Parameters:
      startDate - the start date you want. Format (yyyy-MM-dd).
    • setEndDate

      public void setEndDate(LocalDate endDate)
      Sets the end date of the budget.
      Parameters:
      endDate - the end date you want. Format (yyyy-MM-dd).
    • getBoundary

      public int getBoundary()
      Returns the boundary of the budget.
      Returns:
      boundary.
    • setBoundary

      public void setBoundary(int boundary)
      Sets boundary of the budget.
      Parameters:
      setBoundary - the end date you want. Format (yyyy-MM-dd).
    • isValid

      public boolean isValid()
      Checks whether the budget has a valid start and end date. A budget is considered valid if both start and end dates are not null.
      Returns:
      true if the budget is valid, false otherwise.