Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.Attends


            HttpServletResponse response) throws Exception {
        final Registration registration = getAndSetRegistration(request);
        request.setAttribute("registration", registration);

        final String attendsIdString = request.getParameter("attendsId");
        final Attends attends = FenixFramework.getDomainObject(attendsIdString);

        if (attends != null) {
            attends.deleteShiftEnrolments();
        }

        return viewAttends(mapping, actionForm, request, response);
    }
View Full Code Here


        // if (selectedExecutionPeriod.isCurrent()) {
        // request.setAttribute("weeks", getWeeks(selectedExecutionPeriod));
        // }

        final Attends firstAttends = findFirstAttends(request, selectedExecutionPeriod);
        request.setAttribute("firstAttends", firstAttends);
        if (firstAttends != null) {
            final Interval executionPeriodInterval = firstAttends.getWeeklyWorkLoadInterval();
            final WeeklyWorkLoadView weeklyWorkLoadView = new WeeklyWorkLoadView(executionPeriodInterval);
            request.setAttribute("weeklyWorkLoadView", weeklyWorkLoadView);

            final Collection<Attends> attends = new ArrayList<Attends>();
            request.setAttribute("attends", attends);
View Full Code Here

        final ExecutionCourse executionCourse = shift.getExecutionCourse();

        for (final CurricularCourse curricularCourse : executionCourse.getAssociatedCurricularCoursesSet()) {
            final Enrolment enrolment = studentCurricularPlan.findEnrolmentFor(curricularCourse, semester);
            if (enrolment != null) {
                final Attends attends = enrolment.getAttendsFor(semester);
                if (attends != null && !attends.isFor(executionCourse)) {
                    attends.setDisciplinaExecucao(executionCourse);
                }
                break;
            }
        }
    }
View Full Code Here

        String writtenEvaluationId = writtenEvaluation.getExternalId();
        if (student != null) {
            Space assignedRoom = null;
            for (ExecutionCourse executionCourse : writtenEvaluation.getAssociatedExecutionCoursesSet()) {
                final Registration registration = executionCourse.getRegistration(student.getPerson());
                final Attends attendsByStudent = executionCourse.getAttendsByStudent(student);
                if (registration != null || attendsByStudent != null) {
                    courses.add(executionCourse);
                }
            }
View Full Code Here

            Collection attendsList = studentGroup.getAttendsSet();

            List<InfoSiteStudentInformation> studentGroupAttendInformationList = new ArrayList<InfoSiteStudentInformation>();
            Iterator iterAttendsList = attendsList.iterator();
            InfoSiteStudentInformation infoSiteStudentInformation = null;
            Attends attend = null;

            while (iterAttendsList.hasNext()) {
                infoSiteStudentInformation = new InfoSiteStudentInformation();

                attend = (Attends) iterAttendsList.next();

                infoSiteStudentInformation.setUsername(attend.getRegistration().getPerson().getUsername());
                infoSiteStudentInformation.setNumber(attend.getRegistration().getNumber());

                studentGroupAttendInformationList.add(infoSiteStudentInformation);

            }
View Full Code Here

        }
        if (result.equals(Integer.valueOf(-3))) {
            throw new NotAuthorizedException();
        }

        final Attends userAttend = grouping.getStudentAttend(userStudent);
        if (userAttend == null) {
            throw new InvalidStudentNumberServiceException();
        }
        if (strategy.checkAlreadyEnroled(grouping, studentUsername)) {
            throw new InvalidSituationServiceException();
        }

        StudentGroup newStudentGroup = grouping.readStudentGroupBy(groupNumber);
        if (newStudentGroup != null) {
            throw new FenixServiceException();
        }

        if (!strategy.checkStudentsUserNamesInGrouping(studentUsernames, grouping)) {
            throw new InvalidStudentNumberServiceException();
        }
        checkStudentUsernamesAlreadyEnroledInStudentGroup(strategy, studentUsernames, grouping);

        newStudentGroup = new StudentGroup(groupNumber, grouping, shift);
        for (final String studentUsernameIter : studentUsernames) {
            Attends attend = grouping.getStudentAttend(studentUsernameIter);
            attend.addStudentGroups(newStudentGroup);
        }
        userAttend.addStudentGroups(newStudentGroup);
        grouping.addStudentGroups(newStudentGroup);

        return true;
View Full Code Here

    }

    @Override
    public boolean checkAlreadyEnroled(Grouping grouping, String studentUsername) {

        final Attends studentAttend = grouping.getStudentAttend(studentUsername);

        if (studentAttend != null) {
            Collection<StudentGroup> groupingStudentGroups = grouping.getStudentGroupsSet();
            for (final StudentGroup studentGroup : groupingStudentGroups) {
                Collection<Attends> studentGroupAttends = studentGroup.getAttendsSet();
View Full Code Here

    }

    @Override
    public boolean checkNotEnroledInGroup(Grouping grouping, StudentGroup studentGroup, String studentUsername) {

        final Attends studentAttend = grouping.getStudentAttend(studentUsername);

        if (studentAttend != null) {
            Collection<Attends> studentGroupAttends = studentGroup.getAttendsSet();
            for (final Attends attend : studentGroupAttends) {
                if (attend == studentAttend) {
View Full Code Here

    }

    @Override
    public boolean checkStudentInGrouping(Grouping grouping, String username) {

        final Attends attend = grouping.getStudentAttend(username);
        return attend != null;
    }
View Full Code Here

    }

    private static void copyAttends(final ExecutionCourse executionCourseFrom, final ExecutionCourse executionCourseTo)
            throws FenixServiceException {
        for (Attends attends : executionCourseFrom.getAttendsSet()) {
            final Attends otherAttends = executionCourseTo.getAttendsByStudent(attends.getRegistration());
            if (otherAttends == null) {
                attends.setDisciplinaExecucao(executionCourseTo);
            } else {
                if (attends.getEnrolment() != null && otherAttends.getEnrolment() == null) {
                    otherAttends.setEnrolment(attends.getEnrolment());
                } else if (otherAttends.getEnrolment() != null && attends.getEnrolment() == null) {
                    // do nothing.
                } else if (otherAttends.getEnrolment() != null && attends.getEnrolment() != null) {
                    throw new FenixServiceException("Unable to merge execution courses. Registration "
                            + attends.getRegistration().getNumber() + " has an enrolment in both.");
                }
                for (Mark mark : attends.getAssociatedMarksSet()) {
                    otherAttends.addAssociatedMarks(mark);
                }
                for (StudentGroup group : attends.getAllStudentGroups()) {
                    otherAttends.addStudentGroups(group);
                }
                attends.delete();
            }
        }

        final Iterator<Attends> associatedAttendsFromDestination = executionCourseTo.getAttendsSet().iterator();
        final Map<String, Attends> alreadyAttendingDestination = new HashMap<String, Attends>();
        while (associatedAttendsFromDestination.hasNext()) {
            Attends attend = associatedAttendsFromDestination.next();
            Registration registration = attend.getRegistration();
            if (registration == null) {
                // !!! Yup it's true this actually happens!!!
                attend.delete();
            } else {
                Integer number = registration.getNumber();
                alreadyAttendingDestination.put(number.toString(), attend);
            }
        }
        final List<Attends> associatedAttendsFromSource = new ArrayList<Attends>();
        associatedAttendsFromSource.addAll(executionCourseFrom.getAttendsSet());
        for (final Attends attend : associatedAttendsFromSource) {
            if (!alreadyAttendingDestination.containsKey(attend.getRegistration().getNumber().toString())) {
                attend.setDisciplinaExecucao(executionCourseTo);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.Attends

Copyright © 2018 www.massapicom. 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.