Class PetsDAO

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

public class PetsDAO extends Object
This class is responsible for managing the data access for the Pets in the application. It provides methods to add, edit, delete, list, and search pets in the database. It also provides methods to get pets by customer, get pet by name, delete pets by customer id, and generate an animal report.
  • Constructor Details

    • PetsDAO

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

    • addPets

      public void addPets(Pets obj)
      This method is used to add a new pet to the database.
      Parameters:
      obj - The pet to be added.
    • editPets

      public void editPets(Pets obj)
      This method is used to edit the details of an existing pet in the database.
      Parameters:
      obj - The pet with the updated details.
    • deletePets

      public void deletePets(Pets obj)
      This method is used to delete a pet from the database.
      Parameters:
      obj - The pet to be deleted.
    • listPets

      public List<Pets> listPets()
      This method is used to retrieve a list of all pets from the database.
      Returns:
      A list of all pets.
    • searchPets

      public List<Pets> searchPets(String name)
      This method is used to search for pets by name.
      Parameters:
      name - The name of the pet to search for.
      Returns:
      A list of pets that match the provided name.
    • getPetsByCustomer

      public List<Pets> getPetsByCustomer(Customers customer)
      This method is used to get pets by customer.
      Parameters:
      customer - The customer to get pets for.
      Returns:
      A list of pets that belong to the provided customer.
    • getPetByName

      public Pets getPetByName(String name)
      This method is used to get a pet by name.
      Parameters:
      name - The name of the pet to get.
      Returns:
      The pet that matches the provided name, or null if no match is found.
    • deletePetsByCustomerId

      public void deletePetsByCustomerId(int customerId)
      This method is used to delete pets by customer id.
      Parameters:
      customerId - The id of the customer to delete pets for.
    • animalReport

      public void animalReport(int petId)
      This method is used to generate an animal report for a pet.
      Parameters:
      petId - The id of the pet to generate a report for.