LOGGER.debug("Header information correct");
for (int i = 1; i < totalRows; i++)
{
LOGGER.debug("Parsing Instructor Row #" + i);
XSSFRow instructorRow = instructorSheet.getRow(i);
Instructor instructor = new Instructor();
instructor.setDomainAccount(instructorRow.getCell(0).getStringCellValue());
instructor.setWebID(instructorRow.getCell(0).getStringCellValue());
instructor.setPassword(instructorRow.getCell(1).getStringCellValue());
instructor.setFirstName(instructorRow.getCell(2).getStringCellValue());
instructor.setLastName(instructorRow.getCell(3).getStringCellValue());
/**
* The assumption is that all Course Sections will be
* identified prior to loading instructors.
*/
Section importedSection = new Section();
importedSection.setName(instructorRow.getCell(4).getStringCellValue());
importedSection.setCourse(course);
int sectionIndex = sections.indexOf(importedSection);
int instructorIndex = instructors.indexOf(instructor);
if (instructorIndex > -1)
{
LOGGER.debug("Instructor is in the system");
instructors.get(instructorIndex).addSection(sections.get(sectionIndex));
sections.get(sectionIndex).setInstructor(instructors.get(instructorIndex));
} else
{
LOGGER.debug("Instructor is not in system");
instructor.addSection(sections.get(sectionIndex));
instructors.add(instructor);
sections.get(sectionIndex).setInstructor(instructor);
}
LOGGER.debug(instructor.getFirstName() + " "
+ instructor.getLastName() + " teaches Section "
+ sections.get(sectionIndex) + " with Login "
+ instructor.getDomainAccount());
}
}
} catch (IllegalArgumentException ex)
{
LOGGER.error("Invalid Argument: " + ex.getLocalizedMessage());