Interface SubjectRepository

All Known Implementing Classes:
SubjectRepositoryImpl

public interface SubjectRepository
Repository interface for managing Subject entities. Defines methods for CRUD operations and querying subjects.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes a subject by its unique identifier.
    boolean
    Checks whether a subject with the same name that belongs to certain organization already exists.
    findAll(int pageNumber, int pageSize)
    Retrieves a paginated list of subjects.
    Retrieves a subject by its unique identifier
    save(Subject subject)
    Saves a new subject or updates an existing one.
    void
    update(Subject subject)
    Updates an existing subject.
  • Method Details

    • save

      Subject save(Subject subject)
      Saves a new subject or updates an existing one.
      Parameters:
      subject - the subject to save
      Returns:
      the saved Subject entity
    • findById

      Optional<Subject> findById(Long id)
      Retrieves a subject by its unique identifier
      Parameters:
      id - the unique identifier of the subject
      Returns:
      an Optional containing the subject if found, otherwise empty
    • existsByNameAndOrganizationId

      boolean existsByNameAndOrganizationId(Subject subject)
      Checks whether a subject with the same name that belongs to certain organization already exists.
      Parameters:
      subject - the subject to check
      Returns:
      true if a subject with the same name exists, otherwise false
    • findAll

      Page<Subject> findAll(int pageNumber, int pageSize)
      Retrieves a paginated list of subjects.
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of subjects per page
      Returns:
      a Page containing the requested subjects
    • update

      void update(Subject subject)
      Updates an existing subject.
      Parameters:
      subject - the subject entity with updated information
    • delete

      void delete(Long id)
      Deletes a subject by its unique identifier.
      Parameters:
      id - the unique identifier of the subject to delete