Examples of Grouping


Examples of org.fenixedu.academic.domain.Grouping

    }

    private static boolean checkEnrollStudentGroupShift(String studentGroupCode, String groupPropertiesCode, String username)
            throws FenixServiceException {
        boolean result = false;
        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode);
        if (groupProperties == null) {
            throw new ExistingServiceException();
        }

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

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

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

        result = strategy.checkNotEnroledInGroup(groupProperties, studentGroup, username);
        if (result) {
            throw new InvalidSituationServiceException();
        }

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

        return true;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

    }

    public String getGroupingID() {
        if (this.groupingID == null && getProject() != null) {
            Grouping grouping = getProject().getGrouping();

            this.groupingID = (grouping != null) ? grouping.getExternalId() : null;
        }
        return groupingID;
    }
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

    @Atomic
    public static InfoSiteStudentsAndGroups run(String groupPropertiesId, String shiftId) throws FenixServiceException {
        InfoSiteStudentsAndGroups infoSiteStudentsAndGroups = new InfoSiteStudentsAndGroups();

        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesId);
        infoSiteStudentsAndGroups.setInfoGrouping(InfoGrouping.newInfoFromDomain(groupProperties));
        Shift shift = FenixFramework.getDomainObject(shiftId);

        if (groupProperties == null) {
            throw new ExistingServiceException();
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

    @Atomic
    public static InfoSiteStudentsAndGroups run(String groupPropertiesId) throws FenixServiceException {
        InfoSiteStudentsAndGroups infoSiteStudentsAndGroups = new InfoSiteStudentsAndGroups();

        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesId);

        if (groupProperties == null) {
            throw new ExistingServiceException();
        }
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

    public static InfoSiteStudentsWithoutGroup run(final String groupPropertiesCode, final String username)
            throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);

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

        final Collection allStudentsGroups = grouping.getStudentGroupsSet();

        final Integer groupNumber = grouping.findMaxGroupNumber() + 1;

        infoSiteStudentsWithoutGroup.setGroupNumber(groupNumber);
        infoSiteStudentsWithoutGroup.setInfoGrouping(InfoGrouping.newInfoFromDomain(grouping));

        final Collection<Attends> attends = grouping.getAttendsSet();

        Registration userStudent = null;
        for (Object element : attends) {
            final Attends attend = (Attends) element;
            final Registration registration = attend.getRegistration();
            final Person person = registration.getPerson();
            if (person.getUser().getUsername().equals(username)) {
                userStudent = registration;
                break;
            }
        }
        final InfoStudent infoStudent = getInfoStudentFromStudent(userStudent);
        infoSiteStudentsWithoutGroup.setInfoUserStudent(infoStudent);

        if (grouping.getEnrolmentPolicy().equals(new EnrolmentGroupPolicyType(2))) {
            return infoSiteStudentsWithoutGroup;
        }

        final Set<Attends> attendsWithOutGroupsSet = new HashSet<Attends>(attends);
        for (final Iterator iterator = allStudentsGroups.iterator(); iterator.hasNext();) {
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

public class ReadExportGroupingsByGrouping {

    @Atomic
    public static List<InfoExportGrouping> run(String groupingOID) {
        final Grouping grouping = FenixFramework.getDomainObject(groupingOID);
        final Collection<ExportGrouping> exportGroupings = grouping.getExportGroupingsSet();

        final List<InfoExportGrouping> infoExportGroupings = new ArrayList<InfoExportGrouping>(exportGroupings.size());
        for (final ExportGrouping exportGrouping : exportGroupings) {
            final InfoExportGrouping infoExportGrouping = new InfoExportGrouping();
            infoExportGrouping.setExternalId(exportGrouping.getExternalId());
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

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

        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);
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

            throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);

        ServiceMonitoring.logService(EditGroupShift.class, studentGroupID, groupingID, newShiftID, username);

        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);
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

public class UnEnrollGroupShift {

    @Atomic
    public static Boolean run(String studentGroupCode, String groupPropertiesCode, String username) throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);
        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode);

        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);
View Full Code Here

Examples of org.fenixedu.academic.domain.Grouping

    @Atomic
    public static Integer run(String studentGroupCode, String groupPropertiesCode, String shiftCodeString, String username)
            throws FenixServiceException {
        check(RolePredicates.STUDENT_PREDICATE);
        Grouping groupProperties = FenixFramework.getDomainObject(groupPropertiesCode);

        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
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.