package net.sourceforge.fenixedu.dataTransferObject.administrativeOffice.studentEnrolment; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import net.sourceforge.fenixedu.dataTransferObject.student.IStudentCurricularPlanBean; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.ExecutionSemester; import net.sourceforge.fenixedu.domain.ExecutionYear; import net.sourceforge.fenixedu.domain.StudentCurricularPlan; import net.sourceforge.fenixedu.domain.enrolment.DegreeModuleToEnrol; import net.sourceforge.fenixedu.domain.studentCurriculum.CurriculumModule; public class StudentEnrolmentBean implements Serializable, IStudentCurricularPlanBean { private DomainReference studentCurricularPlan; private DomainReference executionSemester; private List> curriculumModules; private List degreeModulesToEnrol; private CurriculumModuleBean curriculumModuleBean; private boolean canEnrolWithoutRules = false; private boolean canMoveCurriculumLinesWithoutRules = false; public StudentCurricularPlan getStudentCurricularPlan() { return (this.studentCurricularPlan == null) ? null : this.studentCurricularPlan.getObject(); } public void setStudentCurricularPlan(StudentCurricularPlan studentCurricularPlan) { this.studentCurricularPlan = (studentCurricularPlan != null) ? new DomainReference( studentCurricularPlan) : null; } public ExecutionSemester getExecutionPeriod() { return (this.executionSemester == null) ? null : this.executionSemester.getObject(); } public void setExecutionPeriod(ExecutionSemester executionSemester) { this.executionSemester = (executionSemester != null) ? new DomainReference(executionSemester) : null; } public List getCurriculumModules() { if (this.curriculumModules == null) { return new ArrayList(); } List result = new ArrayList(); for (DomainReference curriculumModule : this.curriculumModules) { result.add(curriculumModule.getObject()); } return result; } public void setCurriculumModules(List curriculumModules) { if (curriculumModules == null) { this.curriculumModules = null; } else { this.curriculumModules = new ArrayList>(); for (CurriculumModule curriculumModule : curriculumModules) { this.curriculumModules.add(new DomainReference(curriculumModule)); } } } public List getDegreeModulesToEnrol() { return degreeModulesToEnrol; } public void setDegreeModulesToEnrol(List degreeModulesToEnrol) { this.degreeModulesToEnrol = degreeModulesToEnrol; } public CurriculumModuleBean getCurriculumModuleBean() { return curriculumModuleBean; } public void setCurriculumModuleBean(CurriculumModuleBean curriculumModuleBean) { this.curriculumModuleBean = curriculumModuleBean; } public Set getInitialCurriculumModules() { return getInitialCurriculumModules(getCurriculumModuleBean()); } private Set getInitialCurriculumModules(CurriculumModuleBean curriculumModuleBean) { Set result = new HashSet(); if (curriculumModuleBean.getCurricularCoursesEnroled().isEmpty() && curriculumModuleBean.getGroupsEnroled().isEmpty()) { result.add(curriculumModuleBean.getCurriculumModule()); } for (CurriculumModuleBean moduleBean : curriculumModuleBean.getCurricularCoursesEnroled()) { result.add(moduleBean.getCurriculumModule()); } for (CurriculumModuleBean moduleBean : curriculumModuleBean.getGroupsEnroled()) { result.addAll(getInitialCurriculumModules(moduleBean)); } return result; } public ExecutionYear getExecutionYear() { return getExecutionPeriod().getExecutionYear(); } public boolean getCanEnrolWithoutRules() { return canEnrolWithoutRules; } public void canEnrolWithoutRules(boolean value) { canEnrolWithoutRules = value; } public boolean getCanMoveCurriculumLinesWithoutRules() { return canMoveCurriculumLinesWithoutRules; } public void canMoveCurriculumLinesWithoutRules(boolean value) { canMoveCurriculumLinesWithoutRules = value; } }