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.SpecialSituationCode; import net.sourceforge.fenixedu.domain.student.Registration; import com.linkare.commons.metainfo.Linkare; @Linkare(author = "Paulo Zenida") public class SpecialSituationEnrolmentBean implements Serializable { private Integer studentNumber; private DomainReference student; private DomainReference executionYear; private Collection specialSituationToEnrol; private Collection specialSituationAlreadyEnroled; private DomainReference specialSituationCode; public ExecutionYear getExecutionYear() { return (this.executionYear != null) ? executionYear.getObject() : null; } public void setExecutionYear(ExecutionYear executionYear) { this.executionYear = new DomainReference(executionYear); } public Collection getSpecialSituationAlreadyEnroled() { return specialSituationAlreadyEnroled; } public void setSpecialSituationAlreadyEnroled(Collection specialSituationAlreadyEnroled) { this.specialSituationAlreadyEnroled = specialSituationAlreadyEnroled; } public Collection getSpecialSituationToEnrol() { return specialSituationToEnrol; } public void setSpecialSituationToEnrol(Collection specialSituationToEnrol) { this.specialSituationToEnrol = specialSituationToEnrol; } 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 getSpecialSituationToEnrolSubmited() { return getSubmited(this.getSpecialSituationToEnrol()); } public Collection getSpecialSituationAlreadyEnroledSubmited() { return getSubmited(this.getSpecialSituationAlreadyEnroled()); } public SpecialSituationCode getSpecialSituationCode() { return (this.specialSituationCode != null) ? specialSituationCode.getObject() : null; } public void setSpecialSituationCode(SpecialSituationCode specialSituationCode) { this.specialSituationCode = new DomainReference(specialSituationCode); } private Collection getSubmited(Collection specialSituationToEnrolBean) { Set enrolments = new HashSet(); for (SpecialSituationToEnrolBean bean : specialSituationToEnrolBean) { if (bean.isToSubmit()) { enrolments.add(bean.getEnrolment()); } } return enrolments; } }