package net.sourceforge.fenixedu.presentationTier.Action.vigilancy; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.ExecutionCourse; import net.sourceforge.fenixedu.domain.WrittenEvaluation; import net.sourceforge.fenixedu.domain.space.AllocatableSpace; import net.sourceforge.fenixedu.domain.vigilancy.VigilantWrapper; import net.sourceforge.fenixedu.domain.vigilancy.strategies.UnavailableInformation; import pt.ist.fenixWebFramework.renderers.utils.RenderUtils; public class ConvokeBean extends VigilantGroupBean implements Serializable { private String emailMessage = ""; private List> vigilantsSugestion; private DomainReference writtenEvaluation; private DomainReference selectedExecutionCourse; private List> unavailableVigilants; private List> selectedTeachers; private List> teachersForAGivenCourse; private List> selectedUnavailableVigilants; private List unavailableInformation; public List getUnavailableInformation() { return unavailableInformation; } public void setUnavailableInformation(List unavailableInformation) { this.unavailableInformation = unavailableInformation; } ConvokeBean() { this.vigilantsSugestion = new ArrayList>(); this.unavailableVigilants = new ArrayList>(); this.selectedUnavailableVigilants = new ArrayList>(); this.selectedTeachers = new ArrayList>(); this.teachersForAGivenCourse = new ArrayList>(); setWrittenEvaluation(null); setSelectedExecutionCourse(null); } public ExecutionCourse getSelectedExecutionCourse() { return selectedExecutionCourse.getObject(); } public void setSelectedExecutionCourse(ExecutionCourse course) { selectedExecutionCourse = new DomainReference(course); } public WrittenEvaluation getWrittenEvaluation() { return (this.writtenEvaluation == null) ? null : this.writtenEvaluation.getObject(); } public void setWrittenEvaluation(WrittenEvaluation writtenEvaluation) { this.writtenEvaluation = (writtenEvaluation != null) ? new DomainReference(writtenEvaluation) : null; } public List getVigilantsSugestion() { List vigilants = new ArrayList(); for (DomainReference vigilant : this.vigilantsSugestion) { if (vigilant != null) vigilants.add(vigilant.getObject()); } return vigilants; } public void setVigilantsSugestion(List vigilantsList) { this.vigilantsSugestion = new ArrayList>(); for (VigilantWrapper vigilant : vigilantsList) { if (vigilant != null) { this.vigilantsSugestion.add(new DomainReference(vigilant)); } } } public List getSelectedTeachers() { List vigilants = new ArrayList(); for (DomainReference vigilant : this.selectedTeachers) { if (vigilant != null) vigilants.add(vigilant.getObject()); } return vigilants; } public void setSelectedTeachers(List vigilantsList) { this.selectedTeachers = new ArrayList>(); for (VigilantWrapper vigilant : vigilantsList) { if (vigilant != null) { this.selectedTeachers.add(new DomainReference(vigilant)); } } } public List getTeachersForAGivenCourse() { List vigilants = new ArrayList(); for (DomainReference vigilant : this.teachersForAGivenCourse) { if (vigilant != null) vigilants.add(vigilant.getObject()); } return vigilants; } public void setTeachersForAGivenCourse(List vigilantsList) { this.teachersForAGivenCourse = new ArrayList>(); for (VigilantWrapper vigilant : vigilantsList) { if (vigilant != null) { this.teachersForAGivenCourse.add(new DomainReference(vigilant)); } } } public String getEmailMessage() { return emailMessage; } public void setEmailMessage(String emailMessage) { this.emailMessage = emailMessage; } public List getUnavailableVigilants() { List vigilants = new ArrayList(); for (DomainReference vigilant : this.unavailableVigilants) { if (vigilant != null) vigilants.add(vigilant.getObject()); } return vigilants; } public void setUnavailableVigilants(List vigilantList) { this.unavailableVigilants = new ArrayList>(); for (VigilantWrapper vigilant : vigilantList) { if (vigilant != null) { this.unavailableVigilants.add(new DomainReference(vigilant)); } } } public List getSelectedUnavailableVigilants() { List vigilants = new ArrayList(); for (DomainReference vigilant : this.selectedUnavailableVigilants) { if (vigilant != null) vigilants.add(vigilant.getObject()); } return vigilants; } public void setSelectedUnavailableVigilants(List vigilantList) { this.selectedUnavailableVigilants = new ArrayList>(); for (VigilantWrapper vigilant : vigilantList) { if (vigilant != null) { this.selectedUnavailableVigilants.add(new DomainReference(vigilant)); } } } public String getVigilantsAsString() { String vigilants = ""; for (Object object : this.getVigilants()) { VigilantWrapper vigilant = (VigilantWrapper) object; vigilants += vigilant.getPerson().getName() + " (" + vigilant.getPerson().getUsername() + ") " + "-" + vigilant.getPerson().getEmail() + "\n"; } return vigilants; } public String getTeachersAsString() { String teachers = ""; for (Object object : this.getTeachersForAGivenCourse()) { VigilantWrapper vigilant = (VigilantWrapper) object; teachers += vigilant.getPerson().getName() + " (" + vigilant.getPerson().getUsername() + ") " + "-" + vigilant.getPerson().getEmail() + "\n"; } return teachers; } public String getRoomsAsString() { String rooms = ""; for (AllocatableSpace room : this.getWrittenEvaluation().getAssociatedRooms()) { rooms += room.getName() + "-" + RenderUtils.getResourceString("VIGILANCY_RESOURCES", "label.vigilancy.capacity") + ":" + room.getCapacidadeExame() + "\n"; } return rooms; } }