package net.sourceforge.fenixedu.dataTransferObject.degreeAdministrativeOffice.enrolment; import java.io.Serializable; import java.util.Collection; import java.util.HashSet; import java.util.Set; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.Enrolment; import net.sourceforge.fenixedu.domain.ExecutionYear; import net.sourceforge.fenixedu.domain.SpecialSeasonCode; import net.sourceforge.fenixedu.domain.student.Registration; public class SpecialSeasonEnrolmentBean implements Serializable { private Integer studentNumber; private DomainReference student; private DomainReference executionYear; private Collection specialSeasonToEnrol; private Collection specialSeasonAlreadyEnroled; private DomainReference specialSeasonCode; public ExecutionYear getExecutionYear() { return (this.executionYear != null) ? executionYear.getObject() : null; } public void setExecutionYear(ExecutionYear executionYear) { this.executionYear = new DomainReference(executionYear); } public Collection getSpecialSeasonAlreadyEnroled() { return specialSeasonAlreadyEnroled; } public void setSpecialSeasonAlreadyEnroled(Collection specialSeasonAlreadyEnroled) { this.specialSeasonAlreadyEnroled = specialSeasonAlreadyEnroled; } public Collection getSpecialSeasonToEnrol() { return specialSeasonToEnrol; } public void setSpecialSeasonToEnrol(Collection specialSeasonToEnrol) { this.specialSeasonToEnrol = specialSeasonToEnrol; } public Registration getStudent() { return (this.student != null) ? student.getObject() : null; } public void setStudent(Registration registration) { this.student = new DomainReference(registration); } public Integer getStudentNumber() { return studentNumber; } public void setStudentNumber(Integer studentNumber) { this.studentNumber = studentNumber; } public Collection getSpecialSeasonToEnrolSubmited() { return getSubmited(this.getSpecialSeasonToEnrol()); } public Collection getSpecialSeasonAlreadyEnroledSubmited() { return getSubmited(this.getSpecialSeasonAlreadyEnroled()); } public SpecialSeasonCode getSpecialSeasonCode() { return (this.specialSeasonCode != null) ? specialSeasonCode.getObject() : null; } public void setSpecialSeasonCode(SpecialSeasonCode specialSeasonCode) { this.specialSeasonCode = new DomainReference(specialSeasonCode); } private Collection getSubmited(Collection specialSeasonToEnrolBean) { Set enrolments = new HashSet(); for (SpecialSeasonToEnrolBean bean : specialSeasonToEnrolBean) { if (bean.isToSubmit()) { enrolments.add(bean.getEnrolment()); } } return enrolments; } }