package net.sourceforge.fenixedu.dataTransferObject.administrativeOffice.notNeedToEnrol; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import net.sourceforge.fenixedu.dataTransferObject.PageContainerBean; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.Enrolment; import net.sourceforge.fenixedu.domain.student.Student; import net.sourceforge.fenixedu.domain.studentCurriculum.ExternalEnrolment; public class NotNeedToEnrolEnrolmentsBean extends PageContainerBean { private Integer number; private DomainReference student; private Collection aprovedEnrolments; private Collection externalEnrolments; public Integer getNumber() { return number; } public void setNumber(Integer number) { this.number = number; } public Student getStudent() { return (this.student != null) ? this.student.getObject() : null; } public void setStudent(Student student) { this.student = (student != null) ? new DomainReference(student) : null; } public void setAprovedEnrolments(Collection enrolments) { this.aprovedEnrolments = enrolments; } public Collection getAprovedEnrolments() { return aprovedEnrolments; } public void setExternalEnrolments(Collection enrolments) { this.externalEnrolments = enrolments; } public Collection getExternalEnrolments() { return externalEnrolments; } public Collection getSelectedAprovedEnrolments() { Collection selectedEnrolments = new ArrayList(); if (getAprovedEnrolments() != null) { for (SelectedAprovedEnrolment selectedAprovedEnrolment : getAprovedEnrolments()) { if (selectedAprovedEnrolment.getSelected()) { selectedEnrolments.add(selectedAprovedEnrolment.getAprovedEnrolment()); } } } return selectedEnrolments; } public Collection getSelectedExternalEnrolments() { Collection selectedEnrolments = new ArrayList(); if (getExternalEnrolments() != null) { for (SelectedExternalEnrolment selectedExternalEnrolment : getExternalEnrolments()) { if (selectedExternalEnrolment.getSelected()) { selectedEnrolments.add(selectedExternalEnrolment.getExternalEnrolment()); } } } return selectedEnrolments; } public static class SelectedAprovedEnrolment implements Serializable { private Boolean selected; private DomainReference aprovedEnrolment; public SelectedAprovedEnrolment(Enrolment enrolment, Boolean selected) { this.aprovedEnrolment = new DomainReference(enrolment); this.selected = selected; } public Enrolment getAprovedEnrolment() { return (this.aprovedEnrolment != null) ? this.aprovedEnrolment.getObject() : null; } public void setAprovedEnrolment(Enrolment aprovedEnrolment) { this.aprovedEnrolment = (aprovedEnrolment != null) ? new DomainReference(aprovedEnrolment) : null; } public Boolean getSelected() { return selected; } public void setSelected(Boolean selected) { this.selected = selected; } } public static class SelectedExternalEnrolment implements Serializable { private Boolean selected; private DomainReference externalEnrolment; public SelectedExternalEnrolment(ExternalEnrolment externalEnrolment, Boolean selected) { this.externalEnrolment = new DomainReference(externalEnrolment); this.selected = selected; } public ExternalEnrolment getExternalEnrolment() { return (this.externalEnrolment != null) ? this.externalEnrolment.getObject() : null; } public void setExternalEnrolment(ExternalEnrolment externalEnrolment) { this.externalEnrolment = (externalEnrolment != null) ? new DomainReference(externalEnrolment) : null; } public Boolean getSelected() { return selected; } public void setSelected(Boolean selected) { this.selected = selected; } } }