public static InfoExternalExecutionCourseInfo newFromExecutionCourse( ExecutionCourse executionCourse) { InfoExternalExecutionCourseInfo info = new InfoExternalExecutionCourseInfo(); info.setName(executionCourse.getNome()); return info; }
public List<SelectItem> getExecutionCoursesLabels() { final List<SelectItem> result = new ArrayList(); for (final ExecutionCourse executionCourse : getExecutionCourses()) { result.add(new SelectItem(executionCourse.getExternalId(), executionCourse.getNome())); } Collections.sort(result, new BeanComparator("label")); return result; }
protected Boolean run( final String executionCourseCode, final String groupPropertiesCode, final String[] selected) throws FenixServiceException { if (selected == null) { return Boolean.TRUE; } final Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode); if (groupProperties == null) { throw new ExistingServiceException(); } final List<ExecutionCourse> executionCourses = groupProperties.getExecutionCourses(); StringBuilder sbStudentNumbers = new StringBuilder(""); sbStudentNumbers.setLength(0); // studentCodes list has +1 entry if "select all" was selected int totalStudentsProcessed = 0; for (final String number : selected) { if (number.equals("Todos os Alunos")) { } else { Registration registration = FenixFramework.getDomainObject(number); if (!studentHasSomeAttendsInGrouping(registration, groupProperties)) { final Attends attends = findAttends(registration, executionCourses); if (attends != null) { if (sbStudentNumbers.length() != 0) { sbStudentNumbers.append(", " + registration.getNumber().toString()); } else { sbStudentNumbers.append(registration.getNumber().toString()); } totalStudentsProcessed++; groupProperties.addAttends(attends); } } } } if (totalStudentsProcessed > 0) { List<ExecutionCourse> ecs = groupProperties.getExecutionCourses(); for (ExecutionCourse ec : ecs) { GroupsAndShiftsManagementLog.createLog( ec, Bundle.MESSAGING, "log.executionCourse.groupAndShifts.grouping.attends.added", Integer.toString(totalStudentsProcessed), sbStudentNumbers.toString(), groupProperties.getName(), ec.getNome(), ec.getDegreePresentationString()); } } return Boolean.TRUE; }
protected Boolean run( String executionCourseID, String studentGroupID, String groupPropertiesID, List studentUsernames) throws FenixServiceException { final StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupID); if (studentGroup == null) { throw new InvalidArgumentsServiceException(); } final Grouping grouping = studentGroup.getGrouping(); final IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance(); final IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(grouping); if (!strategy.checkStudentsUserNamesInGrouping(studentUsernames, grouping)) { throw new InvalidArgumentsServiceException(); } StringBuilder sbStudentNumbers = new StringBuilder(""); sbStudentNumbers.setLength(0); for (final String studentUsername : (List<String>) studentUsernames) { Attends attend = grouping.getStudentAttend(studentUsername); if (attend != null) { if (sbStudentNumbers.length() != 0) { sbStudentNumbers.append(", " + attend.getRegistration().getNumber().toString()); } else { sbStudentNumbers.append(attend.getRegistration().getNumber().toString()); } attend.removeStudentGroups(studentGroup); } } // no students means no log entry -- list may contain invalid values, so // its size cannot be used to test if (sbStudentNumbers.length() != 0) { List<ExecutionCourse> ecs = grouping.getExecutionCourses(); for (ExecutionCourse ec : ecs) { GroupsAndShiftsManagementLog.createLog( ec, "resources.MessagingResources", "log.executionCourse.groupAndShifts.grouping.group.element.removed", Integer.toString(studentUsernames.size()), sbStudentNumbers.toString(), studentGroup.getGroupNumber().toString(), grouping.getName(), ec.getNome(), ec.getDegreePresentationString()); } } return true; }
private static void informStudents( final StudentGroup studentGroup, final Registration registration, final Grouping grouping) { final StringBuilder executionCourseNames = new StringBuilder(); for (final ExecutionCourse executionCourse : grouping.getExecutionCourses()) { if (executionCourseNames.length() > 0) { executionCourseNames.append(", "); } executionCourseNames.append(executionCourse.getNome()); } }
protected Boolean run(String objectCode, String groupingCode) throws FenixServiceException { Grouping grouping = FenixFramework.getDomainObject(groupingCode); if (grouping == null) { throw new ExistingServiceException(); } List attendsElements = new ArrayList(); attendsElements.addAll(grouping.getAttends()); Iterator iterator = attendsElements.iterator(); StringBuilder sbStudentNumbers = new StringBuilder(""); sbStudentNumbers.setLength(0); while (iterator.hasNext()) { Attends attend = (Attends) iterator.next(); if (sbStudentNumbers.length() != 0) { sbStudentNumbers.append(", " + attend.getRegistration().getNumber().toString()); } else { sbStudentNumbers.append(attend.getRegistration().getNumber().toString()); } boolean found = false; Iterator iterStudentsGroups = grouping.getStudentGroupsSet().iterator(); while (iterStudentsGroups.hasNext() && !found) { StudentGroup studentGroup = (StudentGroup) iterStudentsGroups.next(); if (studentGroup != null) { studentGroup.removeAttends(attend); found = true; } } grouping.removeAttends(attend); } // no students means no log entry -- list may contain invalid values, so // its size cannot be used to test if (sbStudentNumbers.length() != 0) { List<ExecutionCourse> ecs = grouping.getExecutionCourses(); for (ExecutionCourse ec : ecs) { GroupsAndShiftsManagementLog.createLog( ec, "resources.MessagingResources", "log.executionCourse.groupAndShifts.grouping.memberSet.removed", Integer.toString(attendsElements.size()), sbStudentNumbers.toString(), grouping.getName(), ec.getNome(), ec.getDegreePresentationString()); } } return true; }
private String getArchiveName(ExecutionCourse executionCourse) { String year = executionCourse.getExecutionYear().getYear().replaceAll("/", "-"); return String.format("%s (%s)", executionCourse.getNome(), year); }