// TODO: Look into this with better documentation
if (xmlAgenda.getYear().isEmpty())
return null;
logger.info("COMMITTEE AGENDA " + xmlAgenda.getNo() + " action=" + xmlAgenda.getAction());
Agenda agenda = new Agenda(
Integer.parseInt(xmlAgenda.getSessyr()),
Integer.parseInt(xmlAgenda.getYear()),
Integer.parseInt(xmlAgenda.getNo())
);
String key = storage.key(agenda);
String action = xmlAgenda.getAction();
if (agenda != null && action.equalsIgnoreCase("remove")) {
logger.info("removing agenda: " + agenda.getOid());
storage.del(key);
ChangeLogger.delete(key, storage);
for (Addendum addendum : agenda.getAddendums()) {
for (Meeting meeting : addendum.getMeetings()) {
key = storage.key(meeting);
storage.del(key);
ChangeLogger.delete(key, storage);
}
}
return null;
}
else if (storage.get(key, Agenda.class) != null) {
// Use an existing agenda if we can find one.
agenda = (Agenda)storage.get(key, Agenda.class);
}
// Build a list of addendums on the current list.
// TOOD: is this resent whole each time or not?
List<Addendum> listAddendums = agenda.getAddendums();
for(XMLAddendum xmlAddendum : xmlAgenda.getAddendum()) {
Addendum addendum = parseAddendum(storage, xmlAddendum, agenda, false);
addendum.setAgenda(agenda);
// Don't add duplicates!