Package org.fenixedu.academic.dto.enrollment.shift

Examples of org.fenixedu.academic.dto.enrollment.shift.ShiftEnrollmentErrorReport


        if (!StringUtils.isEmpty(request.getParameter("executionCourseID"))) {
            request.setAttribute("executionCourseID", request.getParameter("executionCourseID"));
        }

        try {
            ShiftEnrollmentErrorReport errorReport =
                    EnrollStudentInShifts.runEnrollStudentInShifts(getRegistration(request), shiftId);

            if (errorReport.getUnAvailableShifts().size() > 0) {
                for (final Shift shift : (List<Shift>) errorReport.getUnAvailableShifts()) {
                    if (shift.getLotacao().intValue() == 0) {
                        addActionMessage(request, "error.shift.enrollment.capacityLocked", shift.getNome());
                    } else if (shift.getLotacao().intValue() < 0) {
                        addActionMessage(request, "message.warning.student.enrolmentClasses.first.year.first.semester");
                    } else {
                        addActionMessage(request, "error.shift.enrollment.capacityExceded", shift.getNome());
                    }
                }
            }
            if (errorReport.getUnExistingShifts().size() > 0) {
                addActionMessage(request, "error.shift.enrollment.nonExistingShift");
            }
        } catch (StudentNotFoundServiceException e) {
            logger.error(e.getMessage(), e);
            addActionMessage(request, "error.shift.enrollment.nonExistingStudent");
View Full Code Here


    public ShiftEnrollmentErrorReport run(final Registration registration, final String shiftId) throws FenixServiceException {

        ServiceMonitoring.logService(this.getClass(), registration, shiftId);

        final ShiftEnrollmentErrorReport errorReport = new ShiftEnrollmentErrorReport();

        final Shift selectedShift = FenixFramework.getDomainObject(shiftId);

        if (selectedShift == null) {
            errorReport.getUnExistingShifts().add(shiftId);
            return errorReport;
        }

        if (registration == null || !selectedShift.getExecutionCourse().hasAttendsFor(registration.getStudent())) {
            throw new StudentNotFoundServiceException();
        }

        if (registration.getPayedTuition() == null || registration.getPayedTuition().equals(Boolean.FALSE)) {
            throw new FenixServiceException("error.exception.notAuthorized.student.warningTuition");
        }

        final Shift shiftFromStudent = findShiftOfSameTypeForSameExecutionCourse(registration, selectedShift);

        if (selectedShift != shiftFromStudent) {
            // Registration is not yet enroled, so let's reserve the shift...
            if (selectedShift.reserveForStudent(registration)) {
                if (shiftFromStudent != null) {
                    shiftFromStudent.removeStudents(registration);
                }
            } else {
                errorReport.getUnAvailableShifts().add(selectedShift);
            }
        }

        return errorReport;
    }
View Full Code Here

        if (!StringUtils.isEmpty(request.getParameter("executionCourseID"))) {
            request.setAttribute("executionCourseID", request.getParameter("executionCourseID"));
        }

        try {
            ShiftEnrollmentErrorReport errorReport =
                    EnrollStudentInShifts.runEnrollStudentInShifts(getRegistration(request), shiftId);

            if (errorReport.getUnAvailableShifts().size() > 0) {
                for (final Shift shift : (List<Shift>) errorReport.getUnAvailableShifts()) {
                    if (shift.getLotacao().intValue() == 0) {
                        addActionMessage(request, "error.shift.enrollment.capacityLocked", shift.getNome());
                    } else {
                        addActionMessage(request, "error.shift.enrollment.capacityExceded", shift.getNome());
                    }
                }
            }
            if (errorReport.getUnExistingShifts().size() > 0) {
                addActionMessage(request, "error.shift.enrollment.nonExistingShift");
            }
        } catch (StudentNotFoundServiceException e) {
            logger.error(e.getMessage(), e);
            addActionMessage(request, "error.shift.enrollment.nonExistingStudent");
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.dto.enrollment.shift.ShiftEnrollmentErrorReport

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.