Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.Professorship


        if (person != null) {
            Optional<Professorship> professorshipOpt =
                    person.getProfessorshipsSet().stream()
                            .filter(professorship -> professorship.getExecutionCourse().equals(executionCourse)).findFirst();
            if (professorshipOpt.isPresent()) {
                Professorship prof = professorshipOpt.get();
                if (!prof.getPermissions().getGroups()) {
                    throw new RuntimeException("Professor is not authorized to manage the student groups");
                } else {
                    return prof;
                }
            }
View Full Code Here


        final DateTime summaryDateTime = summary.getSummaryDateTime();
        return summaryDateTime.toString("yyyy-MM-dd HH:mm");
    }

    private String getTeacherName(final Summary summary) {
        final Professorship professorship = summary.getProfessorship();
        if (professorship != null) {
            return professorship.getPerson().getName();
        }
        final Teacher teacher = summary.getTeacher();
        if (teacher != null) {
            return teacher.getPerson().getName();
        }
View Full Code Here

        }
        return summary.getTeacherName();
    }

    private String getTeacherId(Summary summary) {
        final Professorship professorship = summary.getProfessorship();
        if (professorship != null) {
            return professorship.getPerson().getUsername();
        }
        final Teacher teacher = summary.getTeacher();
        if (teacher != null) {
            return teacher.getPerson().getUsername();
        }
View Full Code Here

public class RemoveProfessorshipWithPerson extends AbstractModifyProfessorshipWithPerson {
    @Atomic
    public static Boolean run(Person person, ExecutionCourse executionCourse) throws NotAuthorizedException {
        AbstractModifyProfessorshipWithPerson.run(person);

        Professorship professorshipToDelete = person.getProfessorshipByExecutionCourse(executionCourse);

        Collection shiftProfessorshipList = professorshipToDelete.getAssociatedShiftProfessorshipSet();

        boolean hasCredits = false;

        if (!shiftProfessorshipList.isEmpty()) {
            hasCredits = CollectionUtils.exists(shiftProfessorshipList, new Predicate() {

                @Override
                public boolean evaluate(Object arg0) {
                    ShiftProfessorship shiftProfessorship = (ShiftProfessorship) arg0;
                    return shiftProfessorship.getPercentage() != null && shiftProfessorship.getPercentage() != 0;
                }
            });
        }

        if (!hasCredits) {
            professorshipToDelete.delete();
        } else {
            if (hasCredits) {
                throw new DomainException("error.remove.professorship");
            }
        }
View Full Code Here

                && (responsibleFors.size() >= MAX_RESPONSIBLEFOR_BY_EXECUTION_COURSE)) {
            List infoResponsibleFors = (List) CollectionUtils.collect(responsibleFors, new Transformer() {

                @Override
                public Object transform(Object input) {
                    Professorship responsibleFor = (Professorship) input;
                    InfoProfessorship infoResponsibleFor = InfoProfessorship.newInfoFromDomain(responsibleFor);
                    return infoResponsibleFor;
                }
            });
View Full Code Here

            super();
        }

        @Override
        public Object transform(Object input) {
            Professorship professorship = (Professorship) input;
            InfoProfessorship infoProfessorShip = InfoProfessorship.newInfoFromDomain(professorship);

            final DetailedProfessorship detailedProfessorship = new DetailedProfessorship();

            ExecutionCourse executionCourse = professorship.getExecutionCourse();
            List executionCourseCurricularCoursesList = getInfoCurricularCourses(detailedProfessorship, executionCourse);

            detailedProfessorship.setResponsibleFor(professorship.getResponsibleFor());

            detailedProfessorship.setInfoProfessorship(infoProfessorShip);
            detailedProfessorship.setExecutionCourseCurricularCoursesList(executionCourseCurricularCoursesList);

            return detailedProfessorship;
View Full Code Here

        for (final Summary summary : getExecutionCourse().getAssociatedSummariesSet()) {
            final Shift shift = summary.getShift();
            if (getShift() == null || getShift() == shift) {
                if (getShiftType() == null || getShiftType() == summary.getSummaryType()) {
                    final Professorship professorship = summary.getProfessorship();
                    if (getProfessorship() == null && showOtherProfessors == null) {
                        summaries.add(summary);
                    } else if (professorship == null && showOtherProfessors != null && showOtherProfessors.booleanValue()) {
                        summaries.add(summary);
                    } else if (showOtherProfessors == null
View Full Code Here

    public static Boolean run(Person person, ExecutionCourse executionCourse) throws NotAuthorizedException {
        try {

            final Person loggedPerson = AccessControl.getPerson();

            Professorship selectedProfessorship = null;
            selectedProfessorship = person.getProfessorshipByExecutionCourse(executionCourse);

            if ((loggedPerson == null) || (selectedProfessorship == null) || !loggedPerson.hasRole(RoleType.TEACHER)
                    || isSamePersonAsBeingRemoved(loggedPerson, selectedProfessorship.getPerson())
                    || selectedProfessorship.getResponsibleFor()) {
                throw new NotAuthorizedException();
            }
        } catch (RuntimeException e) {
            throw new NotAuthorizedException();
        }

        Professorship professorshipToDelete = person.getProfessorshipByExecutionCourse(executionCourse);

        Collection shiftProfessorshipList = professorshipToDelete.getAssociatedShiftProfessorshipSet();

        boolean hasCredits = false;

        if (!shiftProfessorshipList.isEmpty()) {
            hasCredits = CollectionUtils.exists(shiftProfessorshipList, new Predicate() {
View Full Code Here

        if (Strings.isNullOrEmpty(executionCourseID)) {
            executionCourseID = request.getParameter("objectCode");
        }

        if (executionCourseID != null && executionCourseID.length() > 0) {
            final Professorship professorship = findProfessorship(request, executionCourseID);
            request.setAttribute("professorship", professorship);
            request.setAttribute("executionCourse", professorship.getExecutionCourse());
            request.setAttribute("executionCourseID", executionCourseID);
        }
    }
View Full Code Here

        return forward(request, "/teacher/viewProfessorshipProperties.jsp");
    }

    public ActionForward removeTeacher(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        Professorship professorship = getDomainObject(request, "teacherOID");
        try {
            DeleteProfessorshipWithPerson.run(professorship.getPerson(), getExecutionCourse(request));
        } catch (NotAuthorizedException e) {
            final ActionMessages actionErrors = new ActionErrors();
            actionErrors.add("error", new ActionMessage("label.not.authorized.action"));
            saveErrors(request, actionErrors);
        } catch (DomainException domainException) {
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.