Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.Professorship


        Person person = Person.readPersonByUsername(request.getParameter("teacherId"));

        if (person != null) {
            try {
                if (person.getTeacher().hasTeacherAuthorization()) {
                    Professorship professorship = Professorship.create(false, getExecutionCourse(request), person, 0.0);
                    request.setAttribute("teacherOID", professorship.getExternalId());
                } else {
                    final ActionMessages actionErrors = new ActionErrors();
                    actionErrors.add("error", new ActionMessage("label.invalid.teacher.without.auth"));
                    saveErrors(request, actionErrors);
                    return prepareAssociateTeacher(mapping, form, request, response);
View Full Code Here


        }

        String teacherId = request.getParameter("teacherId_");

        Teacher loggedTeacher;
        Professorship loggedProfessorship;
        if (!StringUtils.isEmpty(teacherId)) {
            loggedTeacher = Teacher.readByIstId(teacherId);
            loggedProfessorship = loggedTeacher.getProfessorshipByExecutionCourse(executionCourse);
        } else {
            loggedProfessorship = AccessControl.getPerson().getProfessorshipByExecutionCourse(executionCourse);
        }

        if (loggedProfessorship == null) {
            throw new FenixActionException("error.summariesManagement.empty.loggedProfessorship");
        }

        request.setAttribute("loggedTeacherProfessorship", loggedProfessorship);
        request.setAttribute("loggedIsResponsible", loggedProfessorship.isResponsibleFor());
        request.setAttribute("executionCourse", executionCourse);
        request.setAttribute("executionCourseID", executionCourse.getExternalId());
        request.setAttribute("professorship", loggedProfessorship);

        ActionForward forward = super.execute(mapping, actionForm, request, response);
View Full Code Here

        }

        RenderUtils.invalidateViewState();
        DynaActionForm dynaActionForm = (DynaActionForm) form;

        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());

        SummariesManagementBean newBean =
                new SummariesManagementBean(SummariesManagementBean.SummaryType.NORMAL_SUMMARY, executionCourse,
                        loggedProfessorship, null);
        newBean.setSummaryText(bean.getSummaryText());
View Full Code Here

    }

    public ActionForward prepareEditSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {

        Professorship teacherLogged = ((Professorship) request.getAttribute("loggedTeacherProfessorship"));
        DynaActionForm dynaActionForm = (DynaActionForm) form;
        Summary summary = getSummaryFromParameter(request);

        SummaryType summaryType;
        if (summary.isExtraSummary()) {
View Full Code Here

    public ActionForward deleteSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {

        Summary summary = getSummaryFromParameter(request);
        Professorship professorshipLogged = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");

        try {
            DeleteSummary.runDeleteSummary(executionCourse, summary, professorshipLogged);
        } catch (DomainException e) {
View Full Code Here

    public ActionForward prepareShowSummaries(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {

        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        Professorship professorshipLogged = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        Set<Summary> teacherSummaries = new TreeSet<Summary>(Summary.COMPARATOR_BY_DATE_AND_HOUR);
        teacherSummaries.addAll(professorshipLogged.getAssociatedSummariesSet());

        readAndSaveNextPossibleSummaryLessonsAndDates(request, executionCourse);
        request.setAttribute("showSummariesBean", new ShowSummariesBean(new SummaryTeacherBean(professorshipLogged),
                executionCourse, ListSummaryType.ALL_CONTENT, professorshipLogged));
        if (professorshipLogged.getTeacher() != null) {
            request.setAttribute("teacherId", professorshipLogged.getTeacher().getPerson().getUsername());
        }
        request.setAttribute("summaries", teacherSummaries);
        return mapping.findForward("prepareShowSummaries");
    }
View Full Code Here

        ExecutionCourse executionCourse = bean.getExecutionCourse();
        ShiftType shiftType = bean.getShiftType();
        Shift shift = bean.getShift();

        SummaryTeacherBean summaryTeacher = bean.getSummaryTeacher();
        Professorship teacher = (summaryTeacher != null) ? summaryTeacher.getProfessorship() : null;
        Boolean otherTeachers = (summaryTeacher != null) ? summaryTeacher.getOthers() : null;
        SummariesOrder summariesOrder = bean.getSummariesOrder();

        Set<Summary> summariesToShow =
                summariesOrder == null || summariesOrder.equals(SummariesOrder.DECREASING) ? new TreeSet<Summary>(
View Full Code Here

    }

    public ActionForward prepareCreateComplexSummaryInSummariesCalendarMode(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws FenixActionException {

        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        NextPossibleSummaryLessonsAndDatesBean nextSummaryDateBean = getNextSummaryDateBeanFromParameter(request);

        if (!executionCourse.getLessons().contains(nextSummaryDateBean.getLesson())) {
            throw new FenixActionException();
        }

        DynaActionForm dynaActionForm = (DynaActionForm) form;

        List<NextPossibleSummaryLessonsAndDatesBean> nextPossibleLessonsDates =
                new ArrayList<NextPossibleSummaryLessonsAndDatesBean>();
        nextPossibleLessonsDates.add(nextSummaryDateBean);
        SummariesManagementBean bean =
                new SummariesManagementBean(SummariesManagementBean.SummaryType.NORMAL_SUMMARY, executionCourse,
                        loggedProfessorship, nextPossibleLessonsDates);

        Shift shift = nextSummaryDateBean.getLesson().getShift();
        if (shift.getCourseLoadsSet().size() != 1) {
            request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
        } else {
            nextSummaryDateBean.setLessonType(shift.getCourseLoadsSet().iterator().next().getType());
            bean.setLessonType(nextSummaryDateBean.getLessonType());
        }

        request.setAttribute("summariesManagementBean", bean);
        dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());
        return mapping.findForward("prepareInsertComplexSummary");
    }
View Full Code Here

    }

    public ActionForward prepareCreateComplexSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {

        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        DynaActionForm dynaActionForm = (DynaActionForm) form;
        String[] selectedLessons = request.getParameterValues("selectedLessonAndDate");

        if (selectedLessons == null || selectedLessons.length == 0) {
            return goToInsertComplexSummaryAgain(request, mapping, response, form);
        } else if (selectedLessons != null && selectedLessons.length != 0) {

            boolean uniqueType = true;
            ShiftType shiftType = null;
            List<NextPossibleSummaryLessonsAndDatesBean> nextPossibleLessonsDates =
                    new ArrayList<NextPossibleSummaryLessonsAndDatesBean>();

            for (String lessonRepresentation : selectedLessons) {

                NextPossibleSummaryLessonsAndDatesBean nextLesson =
                        NextPossibleSummaryLessonsAndDatesBean.getNewInstance(lessonRepresentation);
                if (nextLesson.getLesson().getShift().getCourseLoadsSet().size() == 1) {
                    nextLesson.setLessonType(nextLesson.getLesson().getShift().getCourseLoadsSet().iterator().next().getType());
                }

                nextPossibleLessonsDates.add(nextLesson);

                ShiftType lessonType = null;
                if (nextLesson.getLesson().getShift().getCourseLoadsSet().size() == 1) {
                    lessonType = nextLesson.getLesson().getShift().getCourseLoadsSet().iterator().next().getType();
                    if (shiftType == null) {
                        shiftType = lessonType;
                    } else if (!shiftType.equals(lessonType)) {
                        request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
                        uniqueType = false;
                    }
                } else {
                    request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
                    uniqueType = false;
                }
            }

            SummariesManagementBean bean =
                    new SummariesManagementBean(SummariesManagementBean.SummaryType.NORMAL_SUMMARY, executionCourse,
                            loggedProfessorship, nextPossibleLessonsDates);
            bean.setTaught(true);

            if (uniqueType) {
                bean.setLessonType(shiftType);
            }

            request.setAttribute("summariesManagementBean", bean);
            dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());
            return mapping.findForward("prepareInsertComplexSummary");
        }

        return prepareShowSummaries(mapping, form, request, response);
    }
View Full Code Here

        }
    }

    private void buildSummariesManagementBean(ActionForm form, HttpServletRequest request, SummaryType summaryType) {
        DynaActionForm dynaActionForm = (DynaActionForm) form;
        Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
        ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
        dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());
        request.setAttribute("summariesManagementBean", new SummariesManagementBean(summaryType, executionCourse,
                loggedProfessorship, null));
    }
View Full Code Here

TOP

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

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.