String stringGrade = ie.getInfoEnrolmentEvaluation().getGrade();
if (ie.getInfoEnrolmentEvaluation()!=null) { stringGrade = ie.getInfoEnrolmentEvaluation().getGrade(); }else { stringGrade="NA"; }
	public ActionForward execute(		ActionMapping mapping,		ActionForm form,		HttpServletRequest request,		HttpServletResponse response)		throws FenixActionException	{		HttpSession session = this.getSession(request);		IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);		//		List candidacies = new LinkedList();		ActionForward destiny = null;		List candidaciesExtendedInfo = new LinkedList();		InfoClassification ic = null;		try		{			Object[] argsReadCandidacies = getReadCandidaciesArgs(request);			candidacies =				(List) ServiceManagerServiceFactory.executeService(					userView,					"Seminaries.ReadCandidacies",					argsReadCandidacies);			for (Iterator iterator = candidacies.iterator(); iterator.hasNext();)			{				InfoStudent student = null;				InfoCurricularCourse curricularCourse = null;				InfoTheme theme = null;				InfoModality modality = null;				InfoSeminary seminary = null;				InfoStudentCurricularPlan studentCurricularPlan = null;				List casesChoices = null;				List cases = new LinkedList();				InfoCandidacy candidacy = (InfoCandidacy) iterator.next();				Object[] argsReadStudent = { candidacy.getStudentIdInternal()};				Object[] argsReadCurricularCourse = { candidacy.getCurricularCourseIdInternal()};				Object[] argsReadTheme = { candidacy.getThemeIdInternal()};				Object[] argsReadModality = { candidacy.getModalityIdInternal()};				Object[] argsReadSeminary = { candidacy.getSeminaryIdInternal()};				student =					(InfoStudent) ServiceManagerServiceFactory.executeService(						userView,						"student.ReadStudentById",						argsReadStudent);				Object[] argsReadCurricularPlan = { student.getNumber(), student.getDegreeType()};				studentCurricularPlan =					(InfoStudentCurricularPlan) ServiceManagerServiceFactory.executeService(						userView,						"student.ReadActiveStudentCurricularPlanByNumberAndDegreeType",						argsReadCurricularPlan);				curricularCourse =					(InfoCurricularCourse) ((SiteView) ServiceManagerServiceFactory						.executeService(							userView,							"ReadCurricularCourseByOIdService",							argsReadCurricularCourse))						.getComponent();				theme =					(InfoTheme) ServiceManagerServiceFactory.executeService(						userView,						"Seminaries.GetThemeById",						argsReadTheme);				modality =					(InfoModality) ServiceManagerServiceFactory.executeService(						userView,						"Seminaries.GetModalityById",						argsReadModality);				seminary =					(InfoSeminary) ServiceManagerServiceFactory.executeService(						userView,						"Seminaries.GetSeminary",						argsReadSeminary);				//	motivation= candidacy.getMotivation();				casesChoices = candidacy.getCaseStudyChoices();				//				for (Iterator casesIterator = casesChoices.iterator(); casesIterator.hasNext();)				{					InfoCaseStudyChoice choice = (InfoCaseStudyChoice) casesIterator.next();					Object[] argsReadCaseStudy = { choice.getCaseStudyIdInternal()};					InfoCaseStudy infoCaseStudy =						(InfoCaseStudy) ServiceManagerServiceFactory.executeService(							userView,							"Seminaries.GetCaseStudyById",							argsReadCaseStudy);					cases.add(infoCaseStudy);				}				//				//				//				Object argsReadStudentCurricularPlans[] =					{ new UserView(student.getInfoPerson().getUsername(), new LinkedList())};				InfoStudentCurricularPlan selectedSCP = null;				List cps =					(ArrayList) ServiceManagerServiceFactory.executeService(						userView,						"ReadStudentCurricularPlansForSeminaries",						argsReadStudentCurricularPlans);				long startDate = Long.MAX_VALUE;				for (Iterator iter = cps.iterator(); iter.hasNext();)				{					InfoStudentCurricularPlan cp = (InfoStudentCurricularPlan) iter.next();					if (cp.getStartDate().getTime() < startDate)					{						startDate = cp.getStartDate().getTime();						selectedSCP = cp;					}				}				Object getCurriculumArgs[] = { null, selectedSCP.getIdInternal()};				List enrollments =					(ArrayList) ServiceManagerServiceFactory.executeService(						userView,						"ReadStudentCurriculum",						getCurriculumArgs);				//  				//				ic = new InfoClassification();				int i = 0;				float acc = 0;				float grade = 0;				for (Iterator iter = enrollments.iterator(); iter.hasNext();)				{					InfoEnrolment ie = (InfoEnrolment) iter.next();					String stringGrade = ie.getInfoEnrolmentEvaluation().getGrade();                    if (stringGrade != null && !stringGrade.equals("RE") && !stringGrade.equals("NA"))                    {                            Float gradeObject = new Float (stringGrade);                        grade = gradeObject.floatValue();                        acc += grade;                        i++;                    }				}				if (i != 0)				{					String value = new DecimalFormat("#0.0").format(acc/i);					ic.setAritmeticClassification(value);				}				ic.setCompletedCourses(new Integer(i).toString());				//				//				//				InfoCandidacyDetails infoCandidacyDetails = new InfoCandidacyDetails();				infoCandidacyDetails.setCases(cases);				infoCandidacyDetails.setIdInternal(candidacy.getIdInternal());				infoCandidacyDetails.setModality(modality);				infoCandidacyDetails.setSeminary(seminary);				infoCandidacyDetails.setStudent(student);				infoCandidacyDetails.setTheme(theme);				infoCandidacyDetails.setApproved(candidacy.getApproved());				infoCandidacyDetails.setInfoClassification(ic);				infoCandidacyDetails.setMotivation(candidacy.getMotivation());				infoCandidacyDetails.setCurricularCourse(curricularCourse);				candidaciesExtendedInfo.add(infoCandidacyDetails);			}		}		catch (Exception e)		{			e.printStackTrace();			throw new FenixActionException(e);		}		this.setAvaliableOptionsForInputQueries(request, userView);		request.setAttribute("candidacies", candidaciesExtendedInfo);		destiny = mapping.findForward("allCandidaciesGrid");		return destiny;	}