Package org.fenixedu.academic.dto

Examples of org.fenixedu.academic.dto.InfoSiteShifts


            actionErrors2.add("error.noGroup", error2);
            saveErrors(request, actionErrors2);
            return mapping.findForward("viewShiftsAndGroups");
        }

        InfoSiteShifts infoSiteShifts = null;

        try {
            infoSiteShifts = ReadGroupingShifts.run(groupPropertiesCode, studentGroupCode);

        } catch (ExistingServiceException e) {
            ActionErrors actionErrors = new ActionErrors();
            ActionError error = null;
            error = new ActionError("error.noProject");
            actionErrors.add("error.noProject", error);
            saveErrors(request, actionErrors);
            return mapping.findForward("viewExecutionCourseProjects");
        } catch (InvalidSituationServiceException e) {
            ActionErrors actionErrors = new ActionErrors();
            ActionError error = null;
            error = new ActionError("error.noGroup");
            actionErrors.add("error.noGroup", error);
            saveErrors(request, actionErrors);
            return mapping.findForward("viewShiftsAndGroups");
        } catch (FenixServiceException e) {
            throw new FenixActionException(e);
        }

        List shifts = infoSiteShifts.getShifts();

        if (shifts.size() == 0) {
            ActionErrors actionErrors3 = new ActionErrors();
            ActionError error3 = null;
            // Create an ACTION_ERROR
            error3 = new ActionError("errors.editStudentGroupShift.allShiftsFull");
            actionErrors3.add("errors.editStudentGroupShift.allShiftsFull", error3);
            saveErrors(request, actionErrors3);
            request.setAttribute("groupPropertiesCode", groupPropertiesCode);
            return mapping.findForward("viewStudentGroupInformation");
        }

        ArrayList shiftsList = new ArrayList();
        InfoShift oldInfoShift = infoSiteShifts.getOldShift();
        if (shifts.size() != 0) {
            shiftsList.add(new LabelValueBean("(escolher)", ""));
            InfoShift infoShift;
            Iterator iter = shifts.iterator();
            String label, value;
View Full Code Here


            actionErrors2.add("error.noGroup", error2);
            saveErrors(request, actionErrors2);
            return mapping.findForward("viewShiftsAndGroups");
        }

        InfoSiteShifts infoSiteShifts = null;

        try {
            infoSiteShifts = ReadGroupingShifts.run(groupPropertiesCodeString, studentGroupCodeString);

        } catch (ExistingServiceException e) {
            ActionErrors actionErrors = new ActionErrors();
            ActionError error = null;
            error = new ActionError("error.noProject");
            actionErrors.add("error.noProject", error);
            saveErrors(request, actionErrors);
            return mapping.findForward("viewExecutionCourseProjects");
        } catch (InvalidSituationServiceException e) {
            ActionErrors actionErrors = new ActionErrors();
            ActionError error = null;
            error = new ActionError("error.noGroup");
            actionErrors.add("error.noGroup", error);
            saveErrors(request, actionErrors);
            return mapping.findForward("viewShiftsAndGroups");
        } catch (FenixServiceException e) {
            throw new FenixActionException(e);
        }

        List shifts = infoSiteShifts.getShifts();

        if (shifts.size() == 0) {
            ActionErrors actionErrors3 = new ActionErrors();
            ActionError error3 = null;
            // Create an ACTION_ERROR
            error3 = new ActionError("errors.enrollStudentGroupShift.allShiftsFull");
            actionErrors3.add("errors.enrollStudentGroupShift.allShiftsFull", error3);
            saveErrors(request, actionErrors3);
            request.setAttribute("groupPropertiesCode", groupPropertiesCodeString);
            return mapping.findForward("viewStudentGroupInformation");
        }

        ArrayList shiftsList = new ArrayList();
        InfoShift oldInfoShift = infoSiteShifts.getOldShift();
        if (shifts.size() != 0) {
            shiftsList.add(new LabelValueBean("(escolher)", ""));
            InfoShift infoShift;
            Iterator iter = shifts.iterator();
            String label, value;
View Full Code Here

    @Atomic
    public static InfoSiteShifts run(String groupingCode, String studentGroupCode) throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);

        InfoSiteShifts infoSiteShifts = new InfoSiteShifts();
        List infoShifts = new ArrayList();
        Grouping grouping = null;
        boolean result = false;

        StudentGroup studentGroup = null;
        grouping = FenixFramework.getDomainObject(groupingCode);
        if (grouping == null) {
            throw new ExistingServiceException();
        }
        if (studentGroupCode != null) {

            studentGroup = FenixFramework.getDomainObject(studentGroupCode);

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

            infoSiteShifts.setOldShift(InfoShift.newInfoFromDomain(studentGroup.getShift()));
        }

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

        if (strategy.checkHasShift(grouping)) {
            List executionCourses = new ArrayList();
            executionCourses = grouping.getExecutionCourses();

            Iterator iterExecutionCourses = executionCourses.iterator();
            List executionCourseShifts = new ArrayList();
            while (iterExecutionCourses.hasNext()) {
                ExecutionCourse executionCourse = (ExecutionCourse) iterExecutionCourses.next();

                Set<Shift> someShifts = executionCourse.getAssociatedShifts();

                executionCourseShifts.addAll(someShifts);
            }

            List shifts = strategy.checkShiftsType(grouping, executionCourseShifts);
            if (shifts == null || shifts.isEmpty()) {

            } else {

                for (int i = 0; i < shifts.size(); i++) {
                    Shift shift = (Shift) shifts.get(i);
                    result = strategy.checkNumberOfGroups(grouping, shift);

                    if (result) {
                        infoShifts.add(InfoShift.newInfoFromDomain(shift));
                    }
                }
            }
        }

        infoSiteShifts.setShifts(infoShifts);
        return infoSiteShifts;

    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.dto.InfoSiteShifts

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.