Examples of StudentGroup


Examples of org.fenixedu.academic.domain.StudentGroup

    private static List getStudentGroupsByShiftAndGroupProperties(Grouping groupProperties, Shift shift) {
        List result = new ArrayList();
        List studentGroups = groupProperties.getStudentGroupsWithShift();
        Iterator iter = studentGroups.iterator();
        while (iter.hasNext()) {
            StudentGroup sg = (StudentGroup) iter.next();
            if (sg.getShift().equals(shift)) {
                result.add(sg);
            }
        }
        return result;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

        List studentGroups = getStudentGroupsWithoutShiftByGroupProperties(groupProperties);
        Iterator iterStudentGroups = studentGroups.iterator();
        while (iterStudentGroups.hasNext()) {

            Collection studentGroupAttendList;
            StudentGroup studentGroup = (StudentGroup) iterStudentGroups.next();

            studentGroupAttendList = studentGroup.getAttendsSet();

            Iterator iterStudentGroupAttendList = studentGroupAttendList.iterator();
            InfoSiteStudentInformation infoSiteStudentInformation = null;
            InfoSiteStudentAndGroup infoSiteStudentAndGroup = null;
            Attends attend = null;
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

            return infoSiteStudentsWithoutGroup;
        }

        final Set<Attends> attendsWithOutGroupsSet = new HashSet<Attends>(attends);
        for (final Iterator iterator = allStudentsGroups.iterator(); iterator.hasNext();) {
            final StudentGroup studentGroup = (StudentGroup) iterator.next();

            final Collection allStudentGroupsAttends = studentGroup.getAttendsSet();

            for (final Iterator iterator2 = allStudentGroupsAttends.iterator(); iterator2.hasNext();) {
                final Attends studentGroupAttend = (Attends) iterator2.next();
                attendsWithOutGroupsSet.remove(studentGroupAttend);
            }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode);
        if (groupProperties == null) {
            throw new ExistingServiceException();
        }

        StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupCode);
        if (studentGroup == null) {
            throw new InvalidArgumentsServiceException();
        }

        Shift shift = FenixFramework.getDomainObject(newShiftCode);
        if (groupProperties.getShiftType() == null || studentGroup.getShift() != null
                || (!shift.containsType(groupProperties.getShiftType()))) {
            throw new InvalidStudentNumberServiceException();
        }

        Registration registration = Registration.readByUsername(username);

        IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
        IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(groupProperties);

        if (!strategy.checkStudentInGrouping(groupProperties, username)) {
            throw new NotAuthorizedException();
        }

        if (!checkStudentInStudentGroup(registration, studentGroup)) {
            throw new InvalidSituationServiceException();
        }

        boolean result = strategy.checkNumberOfGroups(groupProperties, shift);
        if (!result) {
            throw new InvalidChangeServiceException();
        }
        studentGroup.setShift(shift);
        return true;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

        final Grouping grouping = FenixFramework.getDomainObject(groupingID);
        if (grouping == null) {
            throw new ExistingServiceException();
        }

        final StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupID);
        if (studentGroup == null) {
            throw new InvalidArgumentsServiceException();
        }

        final Shift shift = FenixFramework.getDomainObject(newShiftID);
        if (grouping.getShiftType() == null || !shift.containsType(grouping.getShiftType())) {
            throw new InvalidStudentNumberServiceException();
        }

        final Registration registration = Registration.readByUsername(username);

        IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
        IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(grouping);

        if (!strategy.checkStudentInGrouping(grouping, username)) {
            throw new NotAuthorizedException();
        }

        if (!checkStudentInStudentGroup(registration, studentGroup)) {
            throw new InvalidSituationServiceException();
        }

        boolean result = strategy.checkNumberOfGroups(grouping, shift);
        if (!result) {
            throw new InvalidChangeServiceException();
        }
        studentGroup.setShift(shift);

        informStudents(studentGroup, registration, grouping);

        return true;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

        if (groupProperties == null) {
            throw new ExistingServiceException();
        }

        StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupCode);

        if (studentGroup == null) {
            throw new InvalidArgumentsServiceException();
        }

        if (!(studentGroup.getShift() != null && groupProperties.getShiftType() == null) || studentGroup.getShift() == null) {
            throw new InvalidStudentNumberServiceException();
        }

        Registration registration = Registration.readByUsername(username);

        IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
        IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(groupProperties);

        if (!strategy.checkStudentInGrouping(groupProperties, username)) {
            throw new NotAuthorizedException();
        }

        if (!checkStudentInStudentGroup(registration, studentGroup)) {
            throw new InvalidSituationServiceException();
        }

        Shift shift = null;
        boolean result = strategy.checkNumberOfGroups(groupProperties, shift);
        if (!result) {
            throw new InvalidChangeServiceException();
        }
        studentGroup.setShift(shift);

        return true;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

        if (groupProperties == null) {
            throw new ExistingServiceException();
        }

        StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupCode);

        if (studentGroup == null) {
            throw new InvalidSituationServiceException();
        }

        if (studentGroup.getShift() != null && shiftCodeString == null) {
            throw new InvalidArgumentsServiceException();
        }

        if (studentGroup.getShift() == null) {
            if (shiftCodeString != null) {
                throw new InvalidArgumentsServiceException();
            }
        } else {
            if (!studentGroup.getShift().getExternalId().equals(shiftCodeString)) {
                throw new InvalidArgumentsServiceException();
            }
        }

        if (studentGroup.getShift() != null && groupProperties.getShiftType() != null) {
            return Integer.valueOf(1);
        }

        if (studentGroup.getShift() != null && groupProperties.getShiftType() == null) {
            return Integer.valueOf(2);
        }

        if (studentGroup.getShift() == null && groupProperties.getShiftType() != null) {
            return Integer.valueOf(3);
        }

        if (studentGroup.getShift() == null && groupProperties.getShiftType() == null) {
            return Integer.valueOf(4);
        }

        return Integer.valueOf(5);
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

                        attends.getRegistration().getLastRegistrationState(attends.getExecutionYear());
                row.createCell(registrationState == null ? "" : registrationState.getStateType().getDescription());
                row.createCell(attends.getRegistration().getStudent().getPerson().getFirstAndLastName());

                for (Grouping grouping : groupings) {
                    StudentGroup studentGroup = attends.getStudentGroupByGrouping(grouping);
                    if (studentGroup == null) {
                        row.createCell("N/A");
                    } else {
                        HtmlLink groupLink = new HtmlLink();
                        groupLink.setText(studentGroup.getGroupNumber().toString());
                        groupLink.setUrl(getGroupURL(studentGroup));
                        row.createCell().setBody(groupLink);
                    }
                }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

    public static Boolean run(String studentGroupCode, String username) throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);

        ServiceMonitoring.logService(GroupStudentEnrolment.class, studentGroupCode, username);

        final StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupCode);
        if (studentGroup == null) {
            throw new InvalidArgumentsServiceException();
        }
        final Registration registration = Registration.readByUsername(username);
        if (registration == null) {
            throw new InvalidArgumentsServiceException();
        }

        final Grouping grouping = studentGroup.getGrouping();
        final Attends studentAttend = grouping.getStudentAttend(registration);
        if (studentAttend == null) {
            throw new NotAuthorizedException();
        }
        if (studentGroup.getAttendsSet().contains(studentAttend)) {
            throw new InvalidSituationServiceException();
        }

        final IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
        final IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(grouping);

        boolean result = strategy.checkPossibleToEnrolInExistingGroup(grouping, studentGroup);
        if (!result) {
            throw new InvalidArgumentsServiceException();
        }

        checkIfStudentIsNotEnrolledInOtherGroups(grouping.getStudentGroupsSet(), studentGroup, studentAttend);

        studentGroup.addAttends(studentAttend);

        informStudents(studentGroup, registration, grouping);

        return Boolean.TRUE;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.StudentGroup

    public static Boolean run(String userName, String studentGroupCode) throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);

        ServiceMonitoring.logService(UnEnrollStudentInGroup.class, userName, studentGroupCode);

        StudentGroup studentGroup = FenixFramework.getDomainObject(studentGroupCode);
        if (studentGroup == null) {
            throw new InvalidSituationServiceException();
        }

        final List<String> emails = new ArrayList<String>();
        final Collection<Person> people = new ArrayList<Person>();
        for (final Attends attends : studentGroup.getAttendsSet()) {
            final Person person = attends.getRegistration().getPerson();
            people.add(person);
        }
        final Group fixedSetGroup = UserGroup.of(Person.convertToUsers(people));
        final Recipient recipient = new Recipient("", fixedSetGroup);
        final Collection<Recipient> recipients = new ArrayList<Recipient>();
        recipients.add(recipient);

        Registration registration = Registration.readByUsername(userName);

        Grouping groupProperties = studentGroup.getGrouping();

        Attends attend = groupProperties.getStudentAttend(registration);

        if (attend == null) {
            throw new NotAuthorizedException();
        }

        IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();

        IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(groupProperties);

        boolean resultEmpty = strategy.checkIfStudentGroupIsEmpty(attend, studentGroup);

        studentGroup.removeAttends(attend);

        if (resultEmpty) {
            studentGroup.delete();
            return Boolean.FALSE;
        }

        final StringBuilder executionCourseNames = new StringBuilder();
        for (final ExecutionCourse executionCourse : groupProperties.getExecutionCourses()) {
            if (executionCourseNames.length() > 0) {
                executionCourseNames.append(", ");
            }
            executionCourseNames.append(executionCourse.getNome());
        }

        final String message =
                messages.getMessage("message.body.grouping.change.unenrolment", registration.getNumber().toString(), studentGroup
                        .getGroupNumber().toString(), attend.getExecutionCourse().getNome());

        SystemSender systemSender = Bennu.getInstance().getSystemSender();
        new Message(systemSender, systemSender.getConcreteReplyTos(), recipients,
                messages.getMessage("message.subject.grouping.change"), message, "");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.