final Teacher teacher = id.getPerson().getTeacher(); if (teacher == null) { return false; } final ExecutionCourse executionCourse = RootDomainObject.getInstance().readExecutionCourseByOID( executionCourseID); if (executionCourse == null) { return false; }  for (final Professorship professorship : executionCourse.getProfessorships()) { if (professorship.getTeacher() == teacher) { return true; } } return false;
    private boolean lecturesExecutionCourse(IUserView id, Object[] arguments) {        Integer executionCourseID;        if (arguments == null) {            return false;        } else if (arguments[0] instanceof InfoExecutionCourse) {            executionCourseID = ((InfoExecutionCourse) arguments[0]).getIdInternal();        } else if (arguments[0] instanceof Integer) {            executionCourseID = (Integer) arguments[0];        } else {            return false;        }        try {            final Teacher teacher = Teacher.readTeacherByUsername(id.getUtilizador());            if (teacher == null) {                return false;            }            final ExecutionCourse executionCourse = (ExecutionCourse) persistentObject.readByOID(                    ExecutionCourse.class, executionCourseID);            if (executionCourse == null) {                return false;            }            for (final Professorship professorship : executionCourse.getProfessorships()) {                if (professorship.getTeacher() == teacher) {                    return true;                }            }            return false;        } catch (ExcepcaoPersistencia e) {            return false;        }    }