Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.WrittenEvaluation


        for (final ExecutionSemester executionSemester : getExecutionYear().getExecutionPeriodsSet()) {
            for (final ExecutionCourse executionCourse : executionSemester.getAssociatedExecutionCoursesSet()) {
                for (final Evaluation evaluation : executionCourse.getAssociatedEvaluationsSet()) {
                    if (evaluation instanceof WrittenEvaluation) {
                        final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) evaluation;
                        final Row row = spreadsheet.addRow();
                        row.setCell(getExecutionYear().getYear());
                        row.setCell(executionSemester.getSemester());
                        row.setCell(executionCourse.getExternalId());
                        row.setCell(executionCourse.getName());
                        row.setCell(writtenEvaluation.getExternalId());
                        row.setCell(writtenEvaluation instanceof Exam ? "Exame" : "Teste");
                        row.setCell(writtenEvaluation.getDayDateYearMonthDay().toString("yyyy-MM-dd"));
                        row.setCell(writtenEvaluation.getBeginningDateTime().toString("HH:mm"));
                        row.setCell(writtenEvaluation.getEndDateTime().toString("HH:mm"));
                        final StringBuilder rooms = new StringBuilder();
                        int examVacancy = 0;
                        int normalVacancy = 0;
                        for (final WrittenEvaluationSpaceOccupation roomOccupation : writtenEvaluation
                                .getWrittenEvaluationSpaceOccupationsSet()) {
                            final Space room = roomOccupation.getRoom();
                            if (rooms.length() > 0) {
                                rooms.append(", ");
                            }
                            rooms.append(room.getName());
                            examVacancy += room.<Integer> getMetadata("examCapacity").orElse(0).intValue();
                            normalVacancy += room.getAllocatableCapacity().intValue();
                        }
                        row.setCell(rooms.toString());
                        row.setCell(examVacancy);
                        row.setCell(normalVacancy);

                        if (writtenEvaluation.getEnrollmentBeginDayDateYearMonthDay() == null) {
                            row.setCell(" ");
                        } else {
                            final int enrolmentCount = writtenEvaluation.getWrittenEvaluationEnrolmentsSet().size();
                            row.setCell(enrolmentCount);
                        }
                    }
                }
            }
View Full Code Here


public class EditWrittenEvaluationEnrolmentPeriod {

    protected void run(String executionCourseID, String writtenEvaluationID, Date beginDate, Date endDate, Date beginTime,
            Date endTime) throws FenixServiceException {
        final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) FenixFramework.getDomainObject(writtenEvaluationID);
        if (writtenEvaluation == null) {
            throw new FenixServiceException("error.noWrittenEvaluation");
        }
        writtenEvaluation.editEnrolmentPeriod(beginDate, endDate, beginTime, endTime);
    }
View Full Code Here

public class WrittenEvaluationRoomDistribution {

    protected void run(String executionCourseID, String evaluationID, List<String> roomIDs, Boolean sendSMS,
            Boolean distributeOnlyEnroledStudents) throws FenixServiceException {

        final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) FenixFramework.getDomainObject(evaluationID);
        if (writtenEvaluation == null) {
            throw new FenixServiceException("error.noWrittenEvaluation");
        }
        List<Registration> studentsToDistribute;
        if (distributeOnlyEnroledStudents) {
            studentsToDistribute = readEnroledStudentsInWrittenEvaluation(writtenEvaluation);
        } else {
            studentsToDistribute = readAllStudentsAttendingExecutionCourses(writtenEvaluation);
        }
        final List<Space> selectedRooms = readRooms(writtenEvaluation, roomIDs);
        if (!selectedRooms.containsAll(writtenEvaluation.getAssociatedRooms())) {
            // if the selected rooms are different of the evaluation rooms
            // then the user probably selected repeated rooms
            throw new FenixServiceException("error.repeated.rooms");
        }
        writtenEvaluation.distributeStudentsByRooms(studentsToDistribute, selectedRooms);
        if (sendSMS) {
            sendSMSToStudents(writtenEvaluation);
        }
    }
View Full Code Here

        Integer totalOfStudents = 0;
        final Set<WrittenEvaluation> writtenEvaluations = new HashSet<WrittenEvaluation>();
        for (final ExecutionCourse executionCourse : getExecutionCoursesActiveIn(day)) {
            for (final Evaluation evaluation : executionCourse.getAssociatedEvaluationsSet()) {
                if (evaluation instanceof WrittenEvaluation) {
                    final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) evaluation;
                    final LocalDate evaluationDate = writtenEvaluation.getDayDateYearMonthDay().toLocalDate();
                    if (evaluationDate != null && evaluationDate.equals(day) && isEvalBetweenDates(writtenEvaluation, begin, end)) {
                        if (!writtenEvaluations.contains(writtenEvaluation)) {
                            totalOfStudents += writtenEvaluation.getCountStudentsEnroledAttendingExecutionCourses();
                        }
                        writtenEvaluations.add(writtenEvaluation);
                    }
                }
            }
View Full Code Here

    public void execute(String writtenEvaluationId) throws NotAuthorizedException {
        final User userView = Authenticate.getUser();

        if (!userView.getPerson().hasRole(RoleType.RESOURCE_ALLOCATION_MANAGER)) {

            final WrittenEvaluation writtenEvaluation = readWrittenEvaluation(writtenEvaluationId);

            if (writtenEvaluation.getWrittenEvaluationSpaceOccupationsSet().size() > 0) {
                throw new NotAuthorizedException("written.evaluation.has.allocated.rooms");
            }
        }
    }
View Full Code Here

            @QueryParam("enrol") String enrol, @Context HttpServletResponse response, @Context HttpServletRequest request,
            @Context ServletContext context) {
        // JSONObject jsonResult = new JSONObject();
        validateEnrol(enrol);
        try {
            WrittenEvaluation eval = getDomainObject(oid, WrittenEvaluation.class);
            if (!StringUtils.isBlank(enrol)) {
                if (enrol.equalsIgnoreCase(ENROL)) {
                    EnrolStudentInWrittenEvaluation.runEnrolStudentInWrittenEvaluation(getPerson().getUsername(),
                            eval.getExternalId());
                } else if (enrol.equalsIgnoreCase(UNENROL)) {
                    UnEnrollStudentInWrittenEvaluation.runUnEnrollStudentInWrittenEvaluation(getPerson().getUsername(),
                            eval.getExternalId());
                }
            }
            return evaluations(response, request, context);

        } catch (Exception e) {
View Full Code Here

                    if (executionCourse.getExecutionPeriod() == executionSemester) {
                        for (final Evaluation evaluation : executionCourse.getAssociatedEvaluationsSet()) {

                            if (evaluation instanceof WrittenEvaluation) {
                                if (!(evaluation instanceof Exam) || ((Exam) evaluation).isExamsMapPublished()) {
                                    final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) evaluation;
                                    CalendarLink calendarLink =
                                            new CalendarLink(executionCourse, writtenEvaluation, I18N.getLocale());
                                    calendarLinks.add(calendarLink);
                                    calendarLink.setLinkParameters(constructLinkParameters(executionCourse));
                                }
View Full Code Here

        this.beginMinute = beginMinute;
    }

    public String getDescription() {
        if (this.description == null && this.getEvaluation() != null) {
            final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) getEvaluation();
            if (writtenEvaluation instanceof WrittenTest) {
                this.description = ((WrittenTest) writtenEvaluation).getDescription();
            }
        }
        return this.description;
View Full Code Here

    protected void run(String username, String writtenEvaluationOID) throws FenixServiceException {

        ServiceMonitoring.logService(this.getClass(), username, writtenEvaluationOID);

        final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) FenixFramework.getDomainObject(writtenEvaluationOID);
        final Person person = Person.readPersonByUsername(username);
        final Student student = person.getStudent();
        final Registration registration = findCorrectRegistration(student, writtenEvaluation.getAssociatedExecutionCoursesSet());
        if (writtenEvaluation == null || registration == null) {
            throw new InvalidArgumentsServiceException();
        }

        enrolmentAction(writtenEvaluation, registration);
View Full Code Here

            List<String> roomIDs, String writtenEvaluationOID, Season examSeason, String writtenTestDescription,
            GradeScale gradeScale) throws FenixServiceException {

        ExecutionCourse executionCourse = FenixFramework.getDomainObject(executionCourseID);

        final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) FenixFramework.getDomainObject(writtenEvaluationOID);
        if (writtenEvaluation == null) {
            throw new FenixServiceException("error.noWrittenEvaluation");
        }

        final List<ExecutionCourse> executionCoursesToAssociate = readExecutionCourses(executionCourseIDs);
        final List<DegreeModuleScope> degreeModuleScopeToAssociate = readCurricularCourseScopesAndContexts(degreeModuleScopeIDs);

        List<Space> roomsToAssociate = null;
        if (roomIDs != null) {
            roomsToAssociate = readRooms(roomIDs);
        }

        Signal.emit("academic.writtenevaluation.edited", new EditWrittenEvaluationEvent(writtenEvaluation, writtenEvaluationDate,
                writtenEvaluationStartTime));

        final List<Space> previousRooms = writtenEvaluation.getAssociatedRooms();

        if (examSeason != null) {
            ((Exam) writtenEvaluation).edit(writtenEvaluationDate, writtenEvaluationStartTime, writtenEvaluationEndTime,
                    executionCoursesToAssociate, degreeModuleScopeToAssociate, roomsToAssociate, gradeScale, examSeason);
        } else if (writtenTestDescription != null) {
View Full Code Here

TOP

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

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.