Interface StudentService

All Known Implementing Classes:
StudentServiceImpl

public interface StudentService
An interface which contains essential methods for manipulating student information.
  • Method Details

    • getAllStudents

      org.springframework.data.domain.Page<StudentDto> getAllStudents(Integer page, Integer size)
      Retrieves all the students from the database.
      Parameters:
      page - The page number.
      size - The number of elements in a single page.
      Returns:
      All the students stored in a Page.
    • createStudent

      StudentDto createStudent(StudentDto studentDto, String username, String roles)
      Validates and then persists a student in the database.
      Parameters:
      studentDto - The student itself.
      username - The username of the user who created the student.
      roles - The concatenated String roles of the user who created the student.
      Returns:
      The newly modified student.
    • getStudentById

      StudentDto getStudentById(Long id)
      Retrieves a student from the database using its ID.
      Parameters:
      id - The identifier of the student we want to retrieve.
      Returns:
      The found student.
    • modifyStudentById

      StudentDto modifyStudentById(StudentDto studentDto, Long userId)
      Modifies the student given its id.
      Parameters:
      studentDto - The student itself.
      userId - The id of the student we want to modify.
      Returns:
      The newly modified student.
    • deleteStudentById

      StudentDto deleteStudentById(Long id)
      Deletes a student by its ID.
      Parameters:
      id - The identifier used for deleting a student.
      Returns:
      The recently deleted student's DTO.
    • setValidity

      String setValidity(Long studentId, boolean valid)
      Sets the validity of a student.
      Parameters:
      studentId - The id of the student.
      valid - true if the passport is valid, false otherwise.
      Returns:
      A String containing a feedback of the operation.
    • validPassportNumber

      boolean validPassportNumber(String passportNumber)
      Checks if the passport number is valid or not.
      Parameters:
      passportNumber - The passport number to check.
      Returns:
      true if the passport number is valid, false otherwise.
    • getStudentByUsername

      Optional<StudentDto> getStudentByUsername(String username)
      Retrieves a student by its username.
      Parameters:
      username - The username of the student.
      Returns:
      The student's DTO.
    • getStudentByFirstAndLastName

      Optional<StudentDto> getStudentByFirstAndLastName(String firstName, String lastName)
      Retrieves a student by its first and last name.
      Parameters:
      firstName - The first name of the student.
      lastName - The last name of the student.
      Returns:
      The student's DTO.