Пример #1
0
  /**
   * Checks if person belongs to deparment on a specified execution year. The unit path format
   * should be: IST.<DepartmentAcronym>
   *
   * <p>Accepted roles: STUDENT, TEACHER and EMPLOYEE
   *
   * @param person
   * @param groupCheckQuery
   * @return
   * @throws ExcepcaoPersistencia
   * @throws FenixServiceException
   */
  private static Boolean checkDepartmentGroup(Person person, GroupCheckQuery groupCheckQuery)
      throws NonExistingServiceException {

    final String[] unitAcronyms = groupCheckQuery.unitFullPath.split("\\.");
    if (!groupCheckQuery.roleType.equals("TEACHER")
        && !groupCheckQuery.roleType.equals("STUDENT")
        && !groupCheckQuery.roleType.equals("EMPLOYEE")) {
      throw new NonExistingServiceException();
    }

    if (groupCheckQuery.roleType.equals("TEACHER")) {
      return TeacherGroup.get(getDepartment(unitAcronyms), getExecutionYear(groupCheckQuery.year))
          .isMember(person.getUser());
    } else if (groupCheckQuery.roleType.equals("EMPLOYEE")) {
      if (person != null && person.getEmployee() != null) {
        final Department lastDepartmentWorkingPlace =
            person
                .getEmployee()
                .getLastDepartmentWorkingPlace(
                    getExecutionYear(groupCheckQuery.year).getBeginDateYearMonthDay(),
                    getExecutionYear(groupCheckQuery.year).getEndDateYearMonthDay());
        return (lastDepartmentWorkingPlace != null
            && lastDepartmentWorkingPlace.equals(getDepartment(unitAcronyms)));
      }
      return false;
    } else {
      if (person != null && person.getStudent() != null) {
        for (final Registration registration : person.getStudent().getRegistrationsSet()) {
          for (final Enrolment enrolment :
              registration
                  .getLastStudentCurricularPlan()
                  .getEnrolmentsByExecutionYear(getExecutionYear(groupCheckQuery.year))) {
            if (enrolment.getCurricularCourse().getCompetenceCourse() != null) {
              final CompetenceCourse competenceCourse =
                  enrolment.getCurricularCourse().getCompetenceCourse();
              if (competenceCourse.getDepartmentsSet().contains(getDepartment(unitAcronyms))) {
                return true;
              }

              if (competenceCourse.hasDepartmentUnit()
                  && competenceCourse.getDepartmentUnit().getDepartment()
                      == getDepartment(unitAcronyms)) {
                return true;
              }
            }
          }
        }
      }
      return false;
    }
  }
Пример #2
0
 @Override
 public void setValue(
     org.fenixedu.academic.domain.Department o1,
     org.fenixedu.academic.domain.organizationalStructure.DepartmentUnit o2) {
   ((Department_Base.DO_State) o1.get$obj$state(true)).departmentUnit = o2;
 }
Пример #3
0
 @Override
 public void setValue(
     org.fenixedu.academic.domain.Department o1,
     org.fenixedu.bennu.core.domain.groups.PersistentGroup o2) {
   ((Department_Base.DO_State) o1.get$obj$state(true)).membersGroup = o2;
 }
Пример #4
0
 @Override
 public org.fenixedu.academic.domain.organizationalStructure.DepartmentUnit getValue(
     org.fenixedu.academic.domain.Department o1) {
   return ((Department_Base.DO_State) o1.get$obj$state(false)).departmentUnit;
 }
Пример #5
0
 @Override
 public void setValue(
     org.fenixedu.academic.domain.Department o1,
     org.fenixedu.academic.domain.messaging.DepartmentForum o2) {
   ((Department_Base.DO_State) o1.get$obj$state(true)).forum = o2;
 }
Пример #6
0
 @Override
 public org.fenixedu.academic.domain.messaging.DepartmentForum getValue(
     org.fenixedu.academic.domain.Department o1) {
   return ((Department_Base.DO_State) o1.get$obj$state(false)).forum;
 }
Пример #7
0
 @Override
 public org.fenixedu.bennu.core.domain.groups.PersistentGroup getValue(
     org.fenixedu.academic.domain.Department o1) {
   return ((Department_Base.DO_State) o1.get$obj$state(false)).membersGroup;
 }
Пример #8
0
 @Override
 public void setValue(
     org.fenixedu.academic.domain.Department o1,
     org.fenixedu.bennu.core.domain.Bennu o2) {
   ((Department_Base.DO_State) o1.get$obj$state(true)).rootDomainObject = o2;
 }
Пример #9
0
 @Override
 public org.fenixedu.bennu.core.domain.Bennu getValue(
     org.fenixedu.academic.domain.Department o1) {
   return ((Department_Base.DO_State) o1.get$obj$state(false)).rootDomainObject;
 }