LOGGER.debug("Grading all sections for Instructor "
+ selectedInstructor.getLastName() + ", "
+ selectedInstructor.getFirstName());
// Pull the Instructor from the Data Source to be able to grab Sections
InstructorDAO instructorDAO = new InstructorDAO(emf.createEntityManager());
Instructor instructor = instructorDAO.find(selectedInstructor.getId());
for (Section sectionIter : instructor.getSections())
{
sectionReport = new SectionReport(course.getName(),
instructor, sectionIter.getName(),
selectedAssignment.getAssignment());
try
{
outputFile = new File(path + File.separator
+ sectionIter.getName() + File.separator
+ sectionIter.getName() + dateStampString + ".html");
LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
outputFile.createNewFile();
} catch (IOException ex)
{
LOGGER.error("IOException caught: "
+ ex.getLocalizedMessage());
}
/**
* If a section is selected and there are multiple versions,
* pull the right one for the gevent variable...can we
* search the list and return the right one?
*/
if (multVersions)
{
/**
* If there are multiple versions of the GradedEvent,
* pull only the one for this section
*/
gevent = RageLib.getGradedEventFromSectionName(gevents,
sectionIter.getName());
}
// No else needed since if there are no multiple versions,
// gevent is already set above
for (Student studentIter : sectionIter.getStudents())
{
// StudentReport studentReport = new StudentReport(studentIter);
StudentReport studentReport = new StudentReport(studentIter,
sectionIter);
String newPath = new String();
newPath = path.concat(File.separator);
newPath = newPath.concat(sectionIter.getName());
newPath = newPath.concat(File.separator);
newPath = newPath.concat(studentIter.getWebID());
LOGGER.debug("Path to grade: " + newPath);
statusMessageLabel.setText("Grading: " + studentIter.getLastName()
+ ", " + studentIter.getFirstName());
LOGGER.info("Grading: " + studentIter.getLastName()
+ ", " + studentIter.getFirstName());
File directory = new File(newPath);
launcher.directory(directory);
Runnable r = new GraderThread(node, launcher, directory,
gevent, studentReport, type);
grader_thread = new Thread(r);
grader_thread.start();
while (grader_thread.isAlive())
{
}
sectionReport.addStudentReport(studentReport);
}
sectionReport.sortStudentReports();
RageLib.printSectionReport(outputFile, sectionReport);
}
// Close the connection to the Data Source
instructorDAO.closeConnection();
} /**
* Grade all students in a single section
*/
else if ((cboStudent.getSelectedIndex() == 0)
&& (cboSection.getSelectedIndex() > 0))