Package gov.nysenate.openleg.model

Examples of gov.nysenate.openleg.model.Agenda


        }

        ChangeLogger.setContext(file, modifiedDate);
        for(Object next : senateData.getSenagendaOrSenagendavote()) {
            if (next instanceof XMLSenagenda) {
                Agenda agenda = handleXMLSenagenda(storage,(XMLSenagenda)next);

                if (agenda != null) {
                    agenda.addDataSource(file.getName());
                    agenda.setModifiedDate(modifiedDate);
                    if (agenda.getPublishDate() == null) {
                        agenda.setPublishDate(modifiedDate);
                    }
                    storage.set(agenda);
                    ChangeLogger.record(storage.key(agenda), storage);

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
                            // TODO: We don't actually know if the meeting was modified or not
                            // This might be a false positive change
                            meeting.setModifiedDate(addendum.getPublishDate());
                            storage.set(meeting);
                            ChangeLogger.record(storage.key(meeting), storage);
                        }
                    }
                }

            } else if (next instanceof XMLSenagendavote) {
                Agenda agenda = handleXMLSenagendavote(storage, (XMLSenagendavote)next);

                if (agenda != null) {
                    agenda.addDataSource(file.getName());
                    agenda.setModifiedDate(modifiedDate);
                    if (agenda.getPublishDate() == null) {
                        agenda.setPublishDate(modifiedDate);
                    }
                    storage.set(agenda);
                    ChangeLogger.record(storage.key(agenda), storage);

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
                            storage.set(meeting);
                            ChangeLogger.record(storage.key(meeting), storage);
                        }
                    }
View Full Code Here


        // Sometimes these come up blank on bad feeds or something
        // TODO: Look into this with better documentation
        if (xmlAgendaVote.getYear().isEmpty())
            return null;

        Agenda agendaVote = new Agenda(
            Integer.parseInt(xmlAgendaVote.getSessyr()),
            Integer.parseInt(xmlAgendaVote.getYear()),
            Integer.parseInt(xmlAgendaVote.getNo())
        );
        String key = storage.key(agendaVote);

        // Load the old agenda vote or create a new one
        if (storage.get(key, Agenda.class) != null) {
            agendaVote = (Agenda)storage.get(key, Agenda.class);
        }

        // Add all the addendums to the agenda
        List<Addendum> listAddendums = agendaVote.getAddendums();
        for(Object next : xmlAgendaVote.getContent()) {

            if (next instanceof XMLAddendum) {
                XMLAddendum xmlAddendum = (XMLAddendum) next;
                Addendum addendum = parseAddendum(storage, xmlAddendum, agendaVote, true);
View Full Code Here

        // 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!
View Full Code Here

    }

    public Agenda readAgenda(Reader reader) throws JsonProcessingException, IOException
    {
        JsonNode node = objectMapper.readTree(reader);
        Agenda agenda = new Agenda(node.get("session").asInt(), node.get("year").asInt(), node.get("number").asInt());
        agenda.setAddendums((List<Addendum>)makeList(Addendum.class, node.get("addendums")));
        for (Addendum addendum : agenda.getAddendums()) {
            addendum.setAgenda(agenda);
        }

        agenda.setActive(node.get("active").asBoolean());
        agenda.setModifiedDate(makeDate(node.get("modified")));
        agenda.setPublishDate(makeDate(node.get("published")));
        agenda.setDataSources(new HashSet<String>((HashSet<String>)makeSet(String.class, node.get("dataSources"))));
        return agenda;
    }
View Full Code Here

TOP

Related Classes of gov.nysenate.openleg.model.Agenda

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.