*/
public Section parseSection (Storage storage, Supplemental supplemental, XMLSection xmlSection) {
String sectionId = supplemental.getId() + "-sect-" + xmlSection.getName();
// Create a new section
Section section = new Section();
section.setId(sectionId);
section.setCd(xmlSection.getCd());
section.setName(xmlSection.getName());
section.setType(xmlSection.getType());
section.setSupplemental(supplemental);
// New section entry list!
List<CalendarEntry> calendarEntries = section.getCalendarEntries();
// Loop through the entries
for(XMLCalno xmlCalno:xmlSection.getCalnos().getCalno()) {
CalendarEntry cEntry = null;
try {
// Add each entry with a parent reference
cEntry = parseCalno(storage, section.getId(), xmlCalno, supplemental.getCalendar().getSession());
cEntry.setSection(section);
// But don't add things twice
if (!calendarEntries.contains(cEntry))
calendarEntries.add(cEntry);
}
catch (Exception e) {
if (cEntry != null)
logger.error("Error adding CalenderEntry: " + cEntry.getOid(), e);
else {
logger.error("Error adding CalenderEntry: ", e);
}
}
}
// Save our entry list
section.setCalendarEntries(calendarEntries);
return section;
}