IStudentCurricularPlan activeStudentCurricularPlan = persistentStudentCurricularPlan.readActiveStudentCurricularPlan( studentCurricularPlan.getStudent().getNumber(), TipoCurso.LICENCIATURA_OBJ);  if (!coordinator .getExecutionDegree() .getCurricularPlan() .getIdInternal() .equals(activeStudentCurricularPlan.getDegreeCurricularPlan().getIdInternal()))
List activeStudentCurricularPlans = persistentStudentCurricularPlan.readAllActiveStudentCurricularPlan( studentCurricularPlan.getStudent().getNumber()); System.out.println("activeStudentCurricularPlans.size= " + activeStudentCurricularPlans.size()); boolean hasAnActiveCurricularPlanThatCoincidesWithTheCoordinatorsCurricularPlan = false; for (int i = 0; i < activeStudentCurricularPlans.size(); i++) { IStudentCurricularPlan activeStudentCurricularPlan = (IStudentCurricularPlan) activeStudentCurricularPlans.get(i); if (coordinator .getExecutionDegree() .getCurricularPlan() .getIdInternal() .equals( activeStudentCurricularPlan .getDegreeCurricularPlan() .getIdInternal())) { hasAnActiveCurricularPlanThatCoincidesWithTheCoordinatorsCurricularPlan = true; } } if (!hasAnActiveCurricularPlanThatCoincidesWithTheCoordinatorsCurricularPlan)
	private String hasProvilege(IUserView id, Object[] arguments)	{		List roles = getRoleList((List) id.getRoles());		CollectionUtils.intersection(roles, getNeededRoles());		Integer studentCurricularPlanID = (Integer) arguments[1];		IStudentCurricularPlan studentCurricularPlan = null;		// Read The DegreeCurricularPlan		try		{			IStudentCurricularPlanPersistente persistentStudentCurricularPlan =				SuportePersistenteOJB.getInstance().getIStudentCurricularPlanPersistente();			studentCurricularPlan =				readStudentCurricularPlan(studentCurricularPlanID, persistentStudentCurricularPlan);		}		catch (Exception e)		{			return "noAuthorization";		}		if (studentCurricularPlan == null || studentCurricularPlan.getStudent() == null)		{			return "noAuthorization";		}		List roleTemp = new ArrayList();		roleTemp.add(RoleType.MASTER_DEGREE_ADMINISTRATIVE_OFFICE);		if (CollectionUtils.containsAny(roles, roleTemp))		{			if (!studentCurricularPlan				.getDegreeCurricularPlan()				.getDegree()				.getTipoCurso()				.equals(TipoCurso.MESTRADO_OBJ))			{				return "noAuthorization";			}			return null;		}		if (arguments[0] != null)		{			roleTemp = new ArrayList();			roleTemp.add(RoleType.COORDINATOR);			if (CollectionUtils.containsAny(roles, roleTemp))			{				try				{					ISuportePersistente sp = SuportePersistenteOJB.getInstance();					ICursoExecucaoPersistente persistentExecutionDegree =						sp.getICursoExecucaoPersistente();					ICursoExecucao executionDegree = new CursoExecucao();					executionDegree.setIdInternal((Integer) arguments[0]);					executionDegree =						(ICursoExecucao) persistentExecutionDegree.readByOId(executionDegree, false);					if (executionDegree == null)					{						return "noAuthorization";					}					IPersistentCoordinator persistentCoordinator = sp.getIPersistentCoordinator();					List coordinatorsList =						persistentCoordinator.readCoordinatorsByExecutionDegree(executionDegree);					if (coordinatorsList == null)					{						return "noAuthorization";					}					final String username = id.getUtilizador();					ICoordinator coordinator =						(ICoordinator) CollectionUtils.find(coordinatorsList, new Predicate()					{						public boolean evaluate(Object input)						{							ICoordinator coordinatorTemp = (ICoordinator) input;							if (username.equals(coordinatorTemp.getTeacher().getPerson().getUsername()))							{								return true;							}							return false;						}					});					if (coordinator == null)					{						return "noAuthorization";					}					if (!coordinator						.getExecutionDegree()						.getCurricularPlan()						.getDegree()						.getIdInternal()						.equals(							studentCurricularPlan								.getDegreeCurricularPlan()								.getDegree()								.getIdInternal()))					{						return "noAuthorization";					}					IStudentCurricularPlanPersistente persistentStudentCurricularPlan =						sp.getIStudentCurricularPlanPersistente();					IStudentCurricularPlan activeStudentCurricularPlan =						persistentStudentCurricularPlan.readActiveStudentCurricularPlan(							studentCurricularPlan.getStudent().getNumber(),							TipoCurso.LICENCIATURA_OBJ);					if (!coordinator						.getExecutionDegree()						.getCurricularPlan()						.getIdInternal()						.equals(activeStudentCurricularPlan.getDegreeCurricularPlan().getIdInternal()))					{						return "noAuthorization";					}				}				catch (Exception e)				{					return "noAuthorization";				}				return null;			}		}		roleTemp = new ArrayList();		roleTemp.add(RoleType.STUDENT);		if (CollectionUtils.containsAny(roles, roleTemp))		{			try			{				if (!id					.getUtilizador()					.equals(studentCurricularPlan.getStudent().getPerson().getUsername()))				{					return "noAuthorization";				}			}			catch (Exception e)			{				return "noAuthorization";			}			return null;		}		roleTemp = new ArrayList();		roleTemp.add(RoleType.TEACHER);		if (CollectionUtils.containsAny(roles, roleTemp))		{			try			{				ITeacher teacher =					SuportePersistenteOJB.getInstance().getIPersistentTeacher().readTeacherByUsername(						id.getUtilizador());				if (teacher == null)				{					return "noAuthorization";				}				if (!verifyStudentTutor(teacher, studentCurricularPlan.getStudent()))				{					return new String(						"error.enrollment.notStudentTutor+"							+ studentCurricularPlan.getStudent().getNumber().toString());				}			}			catch (Exception e)			{				return "noAuthorization";			}			return null;		}		roleTemp = new ArrayList();		roleTemp.add(RoleType.DEGREE_ADMINISTRATIVE_OFFICE);		roleTemp.add(RoleType.DEGREE_ADMINISTRATIVE_OFFICE_SUPER_USER);		if (CollectionUtils.containsAny(roles, roleTemp))		{			if (!studentCurricularPlan				.getDegreeCurricularPlan()				.getDegree()				.getTipoCurso()				.equals(TipoCurso.LICENCIATURA_OBJ))			{				return "noAuthorization";			}			return null;		}		return "noAuthorization";	}