InfoFrequenta infoFrequenta = Cloner .copyIFrequenta2InfoFrequenta(attendacy);
if (keys.contains(enrollments)) { enrollmentDistribution.put(enrollments, new Integer( ((Integer) enrollmentDistribution.get(enrollments)).intValue() + 1)); } else { keys.add(enrollments); enrollmentDistribution.put(enrollments, new Integer(1)); } InfoFrequenta infoFrequenta = Cloner.copyIFrequenta2InfoFrequenta(attendacy);
    public InfoAttendsSummary run(Integer executionCourseID, List infoStudents)            throws BDException    {        List attendacies = new LinkedList();        InfoAttendsSummary attendsSummary = new InfoAttendsSummary();        List keys = new ArrayList();        Map enrollmentDistribution = new HashMap();        try        {            ISuportePersistente persistenceSupport = SuportePersistenteOJB                    .getInstance();            IFrequentaPersistente persistentAttendacy = persistenceSupport                    .getIFrequentaPersistente();            IPersistentStudent persistentStudent = persistenceSupport                    .getIPersistentStudent();            IPersistentEnrolment persistentEnrolment = persistenceSupport                    .getIPersistentEnrolment();            List students = new LinkedList();            for (Iterator infoStudentsIterator = infoStudents.iterator(); infoStudentsIterator                    .hasNext(); )            {                InfoStudent infoStudent = (InfoStudent) infoStudentsIterator                        .next();                IStudent student = new Student(infoStudent.getIdInternal());                student = (IStudent) persistentStudent                        .readByOId(student, false);                if (student != null)                {                    students.add(student);                }            }            for (Iterator studentsIterator = students.iterator(); studentsIterator                    .hasNext(); )            {                IStudent student = (IStudent) studentsIterator.next();                IFrequenta attendacy = persistentAttendacy                        .readByAlunoIdAndDisciplinaExecucaoId(student                                .getIdInternal(), executionCourseID);                Integer enrollments = new Integer(0);                if (attendacy.getEnrolment() != null)                {                    List enrollmentList = persistentEnrolment                            .readEnrollmentsByStudentAndCurricularCourseNameAndCurricularCourseDegree(                                    attendacy.getEnrolment()                                            .getStudentCurricularPlan()                                            .getStudent(), attendacy                                            .getEnrolment()                                            .getCurricularCourse());                    enrollments = new Integer(enrollmentList.size());                    if (keys.contains(enrollments))                    {                        enrollmentDistribution.put(enrollments, new Integer(                                ((Integer) enrollmentDistribution                                        .get(enrollments)).intValue() + 1));                    }                    else                    {                        keys.add(enrollments);                        enrollmentDistribution.put(enrollments, new Integer(1));                    }                }                InfoFrequenta infoFrequenta = Cloner                        .copyIFrequenta2InfoFrequenta(attendacy);                InfoAttendWithEnrollment infoAttendWithEnrollment = new InfoAttendWithEnrollment();                infoAttendWithEnrollment.setAluno(infoFrequenta.getAluno());                infoAttendWithEnrollment.setDisciplinaExecucao(infoFrequenta                        .getDisciplinaExecucao());                infoAttendWithEnrollment.setIdInternal(infoFrequenta                        .getIdInternal());                infoAttendWithEnrollment.setEnrollments(enrollments);                infoAttendWithEnrollment.setInfoEnrolment(infoFrequenta                        .getInfoEnrolment());                attendacies.add(infoAttendWithEnrollment);            }            attendsSummary.setAttends(attendacies);            attendsSummary.setEnrollmentDistribution(enrollmentDistribution);            Collections.sort(keys);            attendsSummary.setNumberOfEnrollments(keys);                    }        catch (ExcepcaoPersistencia ex)        {            throw new BDException(                    "Got an error while trying to get info about a student's work group",                    ex);        }        return attendsSummary;    }