Class ServicesDAO

java.lang.Object
br.com.pethub.dao.ServicesDAO

public class ServicesDAO extends Object
This class is responsible for managing the data access for the Services in the application. It provides methods to add, edit, delete services, list services, search services by name, add, edit, delete schedules, check schedule conflict, delete schedule by pet id, and delete service schedules by service id.
  • Constructor Details

    • ServicesDAO

      public ServicesDAO()
      The constructor method of the ServicesDAO class.
  • Method Details

    • addServices

      public void addServices(Services obj)
      This method is used to add a service to the database.
      Parameters:
      obj - The service to be added.
    • editServices

      public void editServices(Services obj)
      This method is used to edit a service in the database.
      Parameters:
      obj - The service with the updated details.
    • deleteServices

      public void deleteServices(Services obj)
      This method is used to delete a service from the database.
      Parameters:
      obj - The service to be deleted.
    • listServices

      public List<Services> listServices()
      This method is used to retrieve a list of all services from the database.
      Returns:
      A list of all services.
    • searchServicesByName

      public List<Services> searchServicesByName(String name)
      This method is used to search for services by name.
      Parameters:
      name - The name of the service to search for.
      Returns:
      A list of services that match the provided name.
    • listSchedules

      public List<Schedule> listSchedules()
      This method is used to retrieve a list of all schedules from the database.
      Returns:
      A list of all schedules.
    • listSchedules

      public List<Schedule> listSchedules(LocalDate date_start, LocalDate date_end)
      This method is used to retrieve a list of schedules within a date range from the database.
      Parameters:
      date_start - The start date of the range.
      date_end - The end date of the range.
      Returns:
      A list of schedules within the date range.
    • listSchedulesForToday

      public List<Schedule> listSchedulesForToday()
      This method is used to retrieve a list of schedules for today from the database.
      Returns:
      A list of schedules for today.
    • getServicesByName

      public Services getServicesByName(String name)
      This method is used to retrieve a list of services for a specific name from the database.
      Parameters:
      name - The name of the service to retrieve.
      Returns:
      The service that matches the provided name, or null if no match is found.
    • addSchedule

      public void addSchedule(Schedule obj)
      This method is used to add a schedule to the database.
      Parameters:
      obj - The schedule to be added.
    • editSchedule

      public void editSchedule(Schedule obj)
      This method is used to edit a schedule in the database.
      Parameters:
      obj - The schedule with the updated details.
    • deleteSchedule

      public void deleteSchedule(Schedule obj)
      This method is used to delete a schedule from the database.
      Parameters:
      obj - The schedule to be deleted.
    • checkScheduleConflict

      public boolean checkScheduleConflict(Schedule obj)
      This method is used to check if a schedule conflicts with an existing one.
      Parameters:
      obj - The schedule to check for conflicts.
      Returns:
      true if there is a conflict, false otherwise.
    • deleteScheduleByPetId

      public void deleteScheduleByPetId(int petId)
      This method is used to delete a schedule by pet id.
      Parameters:
      petId - The id of the pet to delete the schedule for.
    • deleteServiceSchedulesByServiceId

      public void deleteServiceSchedulesByServiceId(int serviceId)
      This method is used to delete service schedules by service id.
      Parameters:
      serviceId - The id of the service to delete the schedules for.