package at.ac.tuwien.inso.entity;

import static java.util.Arrays.asList;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

@Entity
public class Student extends UisUser {

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
    private List<StudyPlanRegistration> studyplans = new ArrayList<>();

    protected Student() {
    }

    public Student(String identificationNumber, String name, String email) {
        this(identificationNumber, name, email, null);
    }

    public Student(String identificationNumber, String name, String email, UserAccount account) {
        super(identificationNumber, name, email, account);
    }

    @Override
    protected void adjustRole(UserAccount account) {
        account.setRole(Role.STUDENT);
    }

    public List<StudyPlanRegistration> getStudyplans() {
        return studyplans;
    }

    public Student addStudyplans(StudyPlanRegistration... studyplans) {
        this.studyplans.addAll(asList(studyplans));
        return this;
    }
}

@@ -413,16 +413,144 @@
 t%3C%3E();%0A%0A
+    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)%0A    private List%3CCourse%3E dismissedCourses = new ArrayList%3C%3E();%0A%0A
     prot
@@ -1231,11 +1231,383 @@
 s;%0A    %7D
+%0A%0A    public List%3CCourse%3E getDismissedCourses() %7B%0A        return dismissedCourses;%0A    %7D%0A%0A    public void setDismissedCourses(List%3CCourse%3E dismissedCourses) %7B%0A        this.dismissedCourses = dismissedCourses;%0A    %7D%0A%0A    public Student addDismissedCourse(Course... dismissedCourse) %7B%0A        this.dismissedCourses.addAll(asList(dismissedCourse));%0A        return this;%0A    %7D
 %0A%7D%0A

Add dismissed courses to student entity to persist feedback