package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.StudyPlan;
import at.ac.tuwien.inso.repository.StudyPlanRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudyPlanService {

    @Autowired
    private StudyPlanRepository studyPlanRepository;

    public Iterable<StudyPlan> getAllStudyPlans() {
        return studyPlanRepository.findAll();
    }
}

@@ -101,19 +101,180 @@
 nso.
-repository.
+entity.Subject;%0Aimport at.ac.tuwien.inso.entity.SubjectForStudyPlan;%0Aimport at.ac.tuwien.inso.repository.StudyPlanRepository;%0Aimport at.ac.tuwien.inso.repository.SubjectFor
 Stud
@@ -512,16 +512,105 @@
 itory;%0A%0A
+    @Autowired%0A    private SubjectForStudyPlanRepository subjectForStudyPlanRepository;%0A%0A
     publ
@@ -704,11 +704,305 @@
 );%0A    %7D
+%0A%0A    public StudyPlan getStudyPlanById(Long id) %7B%0A        return studyPlanRepository.findStudyPlanById(id);%0A    %7D%0A%0A    public Iterable%3CSubjectForStudyPlan%3E getSubjectsForStudyPlan(Long id) %7B%0A        return subjectForStudyPlanRepository.findByStudyPlanIdOrderBySemesterRecommendation(id);%0A    %7D
 %0A%7D%0A

use methods for querying study plans and subjects (of a study plan) in service