@@ -0,0 +1,1832 @@
+package at.ac.tuwien.inso.controller.student;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.Model;%0Aimport org.springframework.web.bind.annotation.GetMapping;%0Aimport org.springframework.web.bind.annotation.ModelAttribute;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestParam;%0A%0Aimport java.security.Principal;%0Aimport java.util.List;%0A%0Aimport at.ac.tuwien.inso.entity.Course;%0Aimport at.ac.tuwien.inso.entity.Student;%0Aimport at.ac.tuwien.inso.service.CourseService;%0Aimport at.ac.tuwien.inso.service.StudentService;%0Aimport at.ac.tuwien.inso.service.SubjectService;%0Aimport at.ac.tuwien.inso.service.course_recommendation.RecommendationService;%0A%0A@Controller%0A@RequestMapping(%22/student/courses/semester/subject%22)%0Apublic class StudentCoursesForSemesterAndSubjectController %7B%0A%0A    private static final Logger log = LoggerFactory.getLogger(StudentCoursesForSemesterAndSubjectController.class);%0A%0A    @Autowired%0A    private CourseService courseService;%0A%0A    @Autowired%0A    private SubjectService subjectService;%0A%0A    @GetMapping%0A    public String courses(@RequestParam Long subjectId, Model model) %7B%0A%0A        log.info(%22getting courses for subject %22 + subjectId);%0A%0A        List%3CCourse%3E courses = courseService.findCoursesForSubjectAndCurrentSemester(subjectService.findOne(subjectId));%0A%0A        if (courses.size() == 1) %7B%0A            log.info(%22Subject only has one course this semester. Redirecting to course%22);%0A            return %22redirect:/student/courses/%22 + courses.get(0).getId();%0A        %7D%0A%0A        model.addAttribute(%22coursesForSemesterAndSubject%22, courses);%0A        return %22/student/courses-for-subject%22;%0A    %7D%0A%0A%0A%7D%0A

Add controller for courses of a subject in the current semester