Interface IAppDAO

All Known Implementing Classes:
SqliteDAO

public interface IAppDAO
Interface defining the Data Access Object (DAO) contract for the application. Provides abstract methods for CRUD (Create, Read, Update, Delete) operations on User and CrimeRecord entities within the persistent data store.
  • Method Details

    • validateUser

      User validateUser(String username, String password)
      Validates a user's credentials against the data store. Typically used during the login process to verify identity.
      Parameters:
      username - The unique username to validate.
      password - The password provided for validation.
      Returns:
      A User object if credentials are correct; null if validation fails.
    • addUser

      boolean addUser(User user)
      Persists a new user in the data store.
      Parameters:
      user - The User object containing the account details to be saved.
      Returns:
      true if the user was successfully added; false if the username is taken or an error occurred.
    • updateUser

      boolean updateUser(User user)
      Updates an existing user's information in the data store.
      Parameters:
      user - The User object containing the updated profile data.
      Returns:
      true if the update was successful; false otherwise.
    • addCrime

      boolean addCrime(CrimeRecord crime)
      Records a new crime incident in the data store.
      Parameters:
      crime - The CrimeRecord object containing the incident details.
      Returns:
      true if the record was successfully created; false if an error occurred.
    • updateCrime

      boolean updateCrime(CrimeRecord crime)
      Updates the details of an existing crime record.
      Parameters:
      crime - The CrimeRecord object containing the updated incident data.
      Returns:
      true if the record was found and updated successfully; false otherwise.
    • deleteCrime

      boolean deleteCrime(int id)
      Removes a crime record from the data store based on its unique identifier.
      Parameters:
      id - The unique primary key of the crime record to be removed.
      Returns:
      true if the record was deleted; false if the ID was not found or an error occurred.
    • getCrimeById

      CrimeRecord getCrimeById(int id)
      Retrieves a specific crime record by its unique identifier.
      Parameters:
      id - The unique primary key of the desired crime.
      Returns:
      The CrimeRecord matching the ID, or null if no such record exists.
    • getCrimesByUser

      List<CrimeRecord> getCrimesByUser(String username)
      Retrieves all crime incidents reported by a specific user.
      Parameters:
      username - The username of the reporter to filter by.
      Returns:
      A List of CrimeRecord objects; returns an empty list if the user has no reports.
    • getAllCrimes

      List<CrimeRecord> getAllCrimes()
      Retrieves every crime record currently stored in the system.
      Returns:
      A List containing all CrimeRecord objects in the data store.