public boolean preloadProfiles() { YAnalyzer yAnalyzer = new YAnalyzer(); List<Integer> admissionNoList = new ArrayList<>(); admissionNoList = yAnalyzer.getNeighbours(); this.matchingStudentProfiles = new ListDataModel(analyticsService.getStudentByAdmissionNumber(admissionNoList)); // this.matchingStudentGeneralExamProfiles = new // ListDataModel(analyticsService.getStudentGeneralExamProfileByStudentList(matchingStudentProfiles)); // matchingStudentProfile.setAlSubjects(new // ListDataModel<ClassroomSubject>(analyticsService.getALSubjects(this.getStudent()))); List<SubjectResult> subjectResultListAL = null; List<SubjectResult> subjectResultListOL = null; List<MatchingStudentProfile> matchingStudentProfileClass = new ArrayList<>(); List<MatchingStudentProfile> matchingStudentProfileClassArts = new ArrayList<>(); List<MatchingStudentProfile> matchingStudentProfileClassCommerce = new ArrayList<>(); List<MatchingStudentProfile> matchingStudentProfileClassMaths = new ArrayList<>(); List<MatchingStudentProfile> matchingStudentProfileClassScience = new ArrayList<>(); List<ClassroomSubject> classroomALSubjectList = new ArrayList<>(); List<ClassroomSubject> classroomOLSubjectList = new ArrayList<>(); Student student = new Student(); MatchingStudentProfile matchingStudentProfile; Iterator<Student> matchingStudentProfileIterator = this.matchingStudentProfiles.iterator(); while (matchingStudentProfileIterator.hasNext()) { subjectResultListAL = new ArrayList<>(); subjectResultListOL = new ArrayList<>(); student = matchingStudentProfileIterator.next(); // student=analyticsService.getStudent(); matchingStudentProfile = new MatchingStudentProfile(student); int islarank = analyticsService.getStudentIslandRank(student); double zsocre = analyticsService.getStudentzScore(student); matchingStudentProfile.setIslandRank(islarank); matchingStudentProfile.setzScore(zsocre); classroomALSubjectList = analyticsService.getALSubjects(student); if (classroomALSubjectList != null) { Iterator<ClassroomSubject> classroomALSubjectIterator = classroomALSubjectList.iterator(); while (classroomALSubjectIterator.hasNext()) { ClassroomSubject classroomALSubject = classroomALSubjectIterator.next(); String result = analyticsService.getALSubjectsResult(student, classroomALSubject); SubjectResult subjectResult = new SubjectResult(classroomALSubject, result); subjectResultListAL.add(subjectResult); } classroomOLSubjectList = analyticsService.getOLSubjects(student); if (classroomOLSubjectList != null) { Iterator<ClassroomSubject> classroomOLSubjectIterator = classroomOLSubjectList.iterator(); while (classroomOLSubjectIterator.hasNext()) { ClassroomSubject classroomOLSubject = classroomOLSubjectIterator.next(); String result = analyticsService.getOLSubjectsResult(student, classroomOLSubject); SubjectResult subjectResult = new SubjectResult(classroomOLSubject, result); subjectResultListOL.add(subjectResult); } } matchingStudentProfile.setAlSubjects(new ListDataModel<SubjectResult>(subjectResultListAL)); matchingStudentProfile.setOlSubjects(new ListDataModel<SubjectResult>(subjectResultListOL)); matchingStudentProfileClass.add(matchingStudentProfile); /*check stream*/ String stream = analyticsService.checkStream(student); if (stream.contentEquals("Arts")) { matchingStudentProfileClassArts.add(matchingStudentProfile); } else if (stream.contentEquals("Commerce")) { matchingStudentProfileClassCommerce.add(matchingStudentProfile); } else if (stream.contentEquals("Physical Science")) { matchingStudentProfileClassMaths.add(matchingStudentProfile); } else if (stream.contentEquals("Biological Science")) { matchingStudentProfileClassScience.add(matchingStudentProfile); } } } matchingProfilesWithSubRes = new ListDataModel<MatchingStudentProfile>(matchingStudentProfileClass); matchingStudentProfileArts = new ListDataModel<MatchingStudentProfile>(matchingStudentProfileClassArts); matchingStudentProfileCommerce = new ListDataModel<MatchingStudentProfile>(matchingStudentProfileClassCommerce); matchingStudentProfileMaths = new ListDataModel<MatchingStudentProfile>(matchingStudentProfileClassMaths); matchingStudentProfileScience = new ListDataModel<MatchingStudentProfile>(matchingStudentProfileClassScience); if (analyticsController.getProfileStream().contentEquals("Arts")) { this.currentStream = "Arts"; matchingStudentProfileStream = matchingStudentProfileArts; } else if (analyticsController.getProfileStream().contentEquals("Commerce")) { this.currentStream = "Commerce"; matchingStudentProfileStream = matchingStudentProfileCommerce; } else if (analyticsController.getProfileStream().contentEquals("Maths")) { this.currentStream = "Physical Science"; matchingStudentProfileStream = matchingStudentProfileMaths; } else if (analyticsController.getProfileStream().contentEquals("Science")) { this.currentStream = "Biological Science"; matchingStudentProfileStream = matchingStudentProfileScience; } return true; }