Class TeacherServiceImpl

java.lang.Object
it.astromark.user.teacher.service.TeacherServiceImpl
All Implemented Interfaces:
CrudService<Teacher,TeacherRequest,SchoolUserDetailed,UUID>, TeacherService

@Service public class TeacherServiceImpl extends Object implements TeacherService
  • Constructor Details

  • Method Details

    • create

      @PreAuthorize("hasRole(\'SECRETARY\')") public SchoolUserDetailed create(TeacherRequest teacherRequest)
      Description copied from interface: CrudService
      Creates a new resource.
      Specified by:
      create in interface CrudService<Teacher,TeacherRequest,SchoolUserDetailed,UUID>
      Parameters:
      teacherRequest - the resource object to be created
      Returns:
      an `RS` object representing the created resource Pre-condition: The `r` must not be null and must contain valid data for creation. Post-condition: A new resource is created and returned as an `RS` object.
    • getSchoolClasses

      @PreAuthorize("hasRole(\'TEACHER\')") @Transactional public List<SchoolClassResponse> getSchoolClasses()
      Description copied from interface: TeacherService
      Retrieves a list of school classes associated with the logged-in teacher.
      Specified by:
      getSchoolClasses in interface TeacherService
      Returns:
      a list of `SchoolClassResponse` objects representing the school classes Pre-condition: The logged-in teacher must exist and be associated with school classes. Post-condition: Returns a list of school classes associated with the teacher.
    • getTeaching

      public List<String> getTeaching()
      Description copied from interface: TeacherService
      Retrieves a list of teaching subjects associated with the logged-in teacher.
      Specified by:
      getTeaching in interface TeacherService
      Returns:
      a list of strings representing the subjects taught by the teacher Pre-condition: The logged-in teacher must exist. Post-condition: Returns a list of subjects associated with the teacher.
    • getTeachers

      public List<TeacherResponse> getTeachers()
      Description copied from interface: TeacherService
      Retrieves a list of all teachers in the system.
      Specified by:
      getTeachers in interface TeacherService
      Returns:
      a list of `TeacherResponse` objects representing all teachers Pre-condition: None. Post-condition: Returns a list of all teachers in the system.
    • getTeacherTeaching

      @Transactional public TeacherDetailsResponse getTeacherTeaching(@NotEmpty @NotEmpty String teacheruuid)
      Description copied from interface: TeacherService
      Retrieves detailed teaching information for a specific teacher.
      Specified by:
      getTeacherTeaching in interface TeacherService
      Parameters:
      teacheruuid - the UUID of the teacher as a string
      Returns:
      a `TeacherDetailsResponse` object containing detailed information about the teacher's teachings Pre-condition: The `teacheruuid` must not be null and must correspond to an existing teacher. Post-condition: Returns detailed teaching information for the specified teacher.
    • update

      public SchoolUserDetailed update(UUID uuid, TeacherRequest teacherRequest)
      Description copied from interface: CrudService
      Updates an existing resource by its ID.
      Specified by:
      update in interface CrudService<Teacher,TeacherRequest,SchoolUserDetailed,UUID>
      Parameters:
      uuid - the ID of the resource to be updated
      teacherRequest - the updated resource data
      Returns:
      an `RS` object representing the updated resource Pre-condition: The `id` must not be null and must refer to an existing resource. The `r` must not be null and must contain valid data for updating. Post-condition: The resource is updated and returned as an `RS` object.
    • delete

      public boolean delete(UUID uuid)
      Description copied from interface: CrudService
      Deletes a resource by its ID.
      Specified by:
      delete in interface CrudService<Teacher,TeacherRequest,SchoolUserDetailed,UUID>
      Parameters:
      uuid - the ID of the resource to be deleted
      Returns:
      true if the resource was successfully deleted, false otherwise Pre-condition: The `id` must not be null and must refer to an existing resource. Post-condition: The resource is deleted if it exists, and the method returns true.
    • getById

      public Teacher getById(UUID uuid)
      Description copied from interface: CrudService
      Retrieves a resource by its ID.
      Specified by:
      getById in interface CrudService<Teacher,TeacherRequest,SchoolUserDetailed,UUID>
      Parameters:
      uuid - the ID of the resource
      Returns:
      a `T` object representing the resource, or null if not found Pre-condition: The `id` must not be null and must refer to an existing resource. Post-condition: Returns the resource as a `T` object if it exists, otherwise null.