Projects >> OpenLegislation >>04cff1665e09d563009a8843e88711ae7d09a2f3

Chunk
Conflicting content
import gov.nysenate.openleg.processors.BillProcessor;
import gov.nysenate.openleg.processors.CalendarProcessor;
import gov.nysenate.openleg.processors.TranscriptProcessor;
<<<<<<< HEAD
=======
import gov.nysenate.openleg.util.Change;
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
import gov.nysenate.openleg.util.ChangeLogger;
import gov.nysenate.openleg.util.Storage;
import gov.nysenate.openleg.util.Storage.Status;
Solution content
import gov.nysenate.openleg.processors.BillProcessor;
import gov.nysenate.openleg.processors.CalendarProcessor;
import gov.nysenate.openleg.processors.TranscriptProcessor;
import gov.nysenate.openleg.util.Change;
import gov.nysenate.openleg.util.ChangeLogger;
import gov.nysenate.openleg.util.Storage;
File
Environment.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    @JsonIgnore
    public String getKey()
    {
<<<<<<< HEAD
        return Bill.getKey(this.getSenateBillNo());
    }

    @JsonIgnore
    public static String getKey(String billNo)
    {
        Matcher keyMatcher = keyPattern.matcher(billNo);
=======
        Matcher keyMatcher = keyPattern.matcher(this.getSenateBillNo());
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        if (keyMatcher.find()) {
            return keyMatcher.group(2)+"/bill/"+keyMatcher.group(0);
        }
Solution content
    @JsonIgnore
    public String getKey()
    {
        return Bill.getKey(this.getSenateBillNo());
    }

    @JsonIgnore
    public static String getKey(String billNo)
    {
        Matcher keyMatcher = keyPattern.matcher(billNo);
        if (keyMatcher.find()) {
            return keyMatcher.group(2)+"/bill/"+keyMatcher.group(0);
        }
File
Bill.java
Developer's decision
Version 1
Kind of conflict
Annotation
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
            return keyMatcher.group(2)+"/bill/"+keyMatcher.group(0);
        }
        else {
<<<<<<< HEAD
            System.out.println("COULD NOT PARSE senateBillNo: "+billNo);
=======
            System.out.println("COULD NOT PARSE senateBillNo: "+this.getSenateBillNo());
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
            return null;
        }
    }
Solution content
            return keyMatcher.group(2)+"/bill/"+keyMatcher.group(0);
        }
        else {
            System.out.println("COULD NOT PARSE senateBillNo: "+billNo);
            return null;
        }
    }
File
Bill.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
                    agenda.setModified(modifiedDate.getTime());
                    String key = agenda.getYear()+"/agenda/"+agenda.getId();
                    storage.set(key, agenda);
<<<<<<< HEAD
                    ChangeLogger.record(key, storage);
=======
                    ChangeLogger.record(key, storage, modifiedDate);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
Solution content
                    agenda.setModified(modifiedDate.getTime());
                    String key = agenda.getYear()+"/agenda/"+agenda.getId();
                    storage.set(key, agenda);
                    ChangeLogger.record(key, storage, modifiedDate);

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                            // This might be a false positive change
                            meeting.setModified(addendum.getPublicationDateTime().getTime());
                            storage.set(key, meeting);
<<<<<<< HEAD
                            ChangeLogger.record(key, storage);
=======
                            ChangeLogger.record(key, storage, modifiedDate);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                        }
                    }
                }
Solution content
                            // This might be a false positive change
                            meeting.setModified(addendum.getPublicationDateTime().getTime());
                            storage.set(key, meeting);
                            ChangeLogger.record(key, storage, modifiedDate);
                        }
                    }
                }
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                    agenda.setModified(modifiedDate.getTime());
                    String key = agenda.getYear()+"/agenda/"+agenda.getId();
                    storage.set(key, agenda);
<<<<<<< HEAD
                    ChangeLogger.record(key, storage);
=======
                    ChangeLogger.record(key, storage, modifiedDate);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
Solution content
                    agenda.setModified(modifiedDate.getTime());
                    String key = agenda.getYear()+"/agenda/"+agenda.getId();
                    storage.set(key, agenda);
                    ChangeLogger.record(key, storage, modifiedDate);

                    for (Addendum addendum : agenda.getAddendums()) {
                        for (Meeting meeting : addendum.getMeetings()) {
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                            key = calendar.get(GregorianCalendar.YEAR)+"/meeting/"+meeting.getId();
                            logger.info(key);
                            storage.set(key, meeting);
<<<<<<< HEAD
                            ChangeLogger.record(key, storage);
=======
                            ChangeLogger.record(key, storage, modifiedDate);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                        }
                    }
                }
Solution content
                    }
                }
                            key = calendar.get(GregorianCalendar.YEAR)+"/meeting/"+meeting.getId();
                            logger.info(key);
                            storage.set(key, meeting);
                            ChangeLogger.record(key, storage, modifiedDate);
                        }
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            // Make sure the bill gets updated on disc
            String key = String.valueOf(bill.getYear())+"/bill/"+bill.getSenateBillNo();
            storage.set(key, bill);
<<<<<<< HEAD
            ChangeLogger.record(key, storage);
=======
            ChangeLogger.record(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        }

        return bill;
Solution content
            // Make sure the bill gets updated on disc
            String key = String.valueOf(bill.getYear())+"/bill/"+bill.getSenateBillNo();
            storage.set(key, bill);
            ChangeLogger.record(key, storage, date);
        }

        return bill;
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
        return bill;
    }

<<<<<<< HEAD
    public Agenda handleXMLSenagendavote(Storage storage, XMLSenagendavote xmlAgendaVote) throws IOException {
=======
    public Agenda handleXMLSenagendavote(Storage storage, XMLSenagendavote xmlAgendaVote, Date date) {
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        // TODO: It doesn't look like we parse any action here. Should we?

        // Sometimes these come up blank on bad feeds or something
Solution content
        return bill;
    }

    public Agenda handleXMLSenagendavote(Storage storage, XMLSenagendavote xmlAgendaVote, Date date) throws IOException {
        // TODO: It doesn't look like we parse any action here. Should we?

        // Sometimes these come up blank on bad feeds or something
File
AgendaProcessor.java
Developer's decision
Manual
Kind of conflict
Method signature
Chunk
Conflicting content
        return agendaVote;
    }

<<<<<<< HEAD
    public Agenda handleXMLSenagenda(Storage storage, XMLSenagenda xmlAgenda) throws IOException {
=======
    public Agenda handleXMLSenagenda(Storage storage, XMLSenagenda xmlAgenda, Date date) {
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        // Sometimes these come up blank on bad feeds or something
        // TODO: Look into this with better documentation
        if (xmlAgenda.getYear().isEmpty())
Solution content
        return agendaVote;
    }

    public Agenda handleXMLSenagenda(Storage storage, XMLSenagenda xmlAgenda, Date date) throws IOException {
        // Sometimes these come up blank on bad feeds or something
        // TODO: Look into this with better documentation
        if (xmlAgenda.getYear().isEmpty())
File
AgendaProcessor.java
Developer's decision
Manual
Kind of conflict
Method signature
Chunk
Conflicting content
        if (agenda != null && action.equalsIgnoreCase("remove")) {
            logger.info("removing agenda: " + agenda.getId());
            storage.del(key);
<<<<<<< HEAD
            ChangeLogger.delete(key, storage);
=======
            ChangeLogger.delete(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672

            for (Addendum addendum : agenda.getAddendums()) {
                for (Meeting meeting : addendum.getMeetings()) {
Solution content
        if (agenda != null && action.equalsIgnoreCase("remove")) {
            logger.info("removing agenda: " + agenda.getId());
            storage.del(key);
            ChangeLogger.delete(key, storage, date);

            for (Addendum addendum : agenda.getAddendums()) {
                for (Meeting meeting : addendum.getMeetings()) {
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                for (Meeting meeting : addendum.getMeetings()) {
                    key = meeting.getYear()+"/meeting/"+meeting.getId();
                    storage.del(key);
<<<<<<< HEAD
                    ChangeLogger.delete(key, storage);
=======
                    ChangeLogger.delete(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                }
            }
Solution content
                for (Meeting meeting : addendum.getMeetings()) {
                    key = meeting.getYear()+"/meeting/"+meeting.getId();
                    storage.del(key);
                    ChangeLogger.delete(key, storage, date);
                }
            }
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
        return agenda;
    }

<<<<<<< HEAD
    public Addendum parseAddendum(Storage storage, String keyId, XMLAddendum xmlAddendum, Agenda agenda, boolean isVote) throws IOException {
=======
    public Addendum parseAddendum(Storage storage, String keyId, XMLAddendum xmlAddendum, Agenda agenda, boolean isVote, Date date) {
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        // TODO: Are addendums resent whole each time?
        // TODO: What are addendums?
Solution content
        return agenda;
    }

    public Addendum parseAddendum(Storage storage, String keyId, XMLAddendum xmlAddendum, Agenda agenda, boolean isVote, Date date) throws IOException {
        // TODO: Are addendums resent whole each time?
        // TODO: What are addendums?
File
AgendaProcessor.java
Developer's decision
Manual
Kind of conflict
Method signature
Chunk
Conflicting content
                        // Delete the meeting and save the agenda
                        String key = meeting.getYear()+"/meeting/"+meeting.getId();
                        storage.del(key);
<<<<<<< HEAD
                        ChangeLogger.delete(key, storage);
=======
                        ChangeLogger.delete(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672

                        agenda.removeCommitteeMeeting(meeting);
                        key = agenda.getYear()+"/agenda/"+agenda.getId();
Solution content
                        // Delete the meeting and save the agenda
                        String key = meeting.getYear()+"/meeting/"+meeting.getId();
                        storage.del(key);
                        ChangeLogger.delete(key, storage, date);

                        agenda.removeCommitteeMeeting(meeting);
                        key = agenda.getYear()+"/agenda/"+agenda.getId();
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                        agenda.removeCommitteeMeeting(meeting);
                        key = agenda.getYear()+"/agenda/"+agenda.getId();
                        storage.set(key, agenda);
<<<<<<< HEAD
                        ChangeLogger.record(key, storage);
=======
                        ChangeLogger.record(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                    }

                    if (action.equals("remove")) {
Solution content
                        agenda.removeCommitteeMeeting(meeting);
                        key = agenda.getYear()+"/agenda/"+agenda.getId();
                        storage.set(key, agenda);
                        ChangeLogger.record(key, storage, date);
                    }

                    if (action.equals("remove")) {
File
AgendaProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                    logger.info("SAVING: "+bill.getSenateBillNo());
                    bill.addSobiReference(sobiFile.getName());
                    bill.setModified(date.getTime());
<<<<<<< HEAD
                    saveBill(bill, storage);
                    ChangeLogger.record(bill.getKey(), storage);
=======
                    String key = bill.getKey();
                    saveBill(bill, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                }
            }
            catch (ParseError e) {
Solution content
                    logger.info("SAVING: "+bill.getSenateBillNo());
                    bill.addSobiReference(sobiFile.getName());
                    bill.setModified(date.getTime());
                    saveBill(bill, storage, date);

                }
            }
            catch (ParseError e) {
File
BillProcessor.java
Developer's decision
Combination
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
            bill = (Bill)storage.restore(billKey, Bill.class);

            if (block.getAmendment().isEmpty()) {
<<<<<<< HEAD
                if (bill == null) {
                    // New base bill. Easy.
                    return new Bill(billKey, block.getYear());
=======
                // We need to create an original bill, this is easy!
                return new Bill(billKey, block.getYear());
            }
            else {
                // We need to create an amendment, this is trickier
                Bill amendment = new Bill(billKey, block.getYear());

                // All new amendments are based on the original bill
                String baseKey = block.getPrintNo()+"-"+block.getYear();
                Bill baseBill = storage.getBill(baseKey);

                if (baseBill == null) {
                    // Amendments should always have original bills already made, make it happen
                    logger.error("Bill Amendment filed without initial bill at "+block.getLocation()+" - "+block.getHeader());
                    baseBill = new Bill(baseKey, block.getYear());
                    storage.saveBill(baseBill);
                    ChangeLogger.record(baseBill.getKey(), storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                }
                else {
                    // Bringing back deleted base bill, also easy.
Solution content
            bill = (Bill)storage.restore(billKey, Bill.class);

            if (block.getAmendment().isEmpty()) {
                if (bill == null) {
                    // New base bill. Easy.
                    return new Bill(billKey, block.getYear());
                }
                else {
                    // Bringing back deleted base bill, also easy.
File
BillProcessor.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
                ChangeLogger.record(baseBill.getKey(), storage);
            }

<<<<<<< HEAD
            // Pull sponsor information up from the base bill
            bill.setSponsor(baseBill.getSponsor());
            bill.setCoSponsors(baseBill.getCoSponsors());
            bill.setMultiSponsors(baseBill.getMultiSponsors());

            // Pull up the list of existing versions and add yourself
            bill.addAmendment(baseKey);
            bill.addAmendments(baseBill.getAmendments());

            // Broadcast yourself to all other versions and deactivate them
            Bill activeBill = null;
            for (String versionKey : bill.getAmendments()) {
                Bill billVersion = storage.getBill(versionKey);
                if (billVersion == null) {
                    throw new ParseError("Recorded bill version not found in storage: "+versionKey);
                }
                else {
                    billVersion.addAmendment(billKey);
                    if(billVersion.isActive()) {
                        activeBill = billVersion;
                        billVersion.setActive(false);
=======
                // Broadcast yourself to all other versions and deactivate them
                Bill activeBill = null;
                for (String versionKey : amendment.getAmendments()) {
                    Bill billVersion = storage.getBill(versionKey);
                    if (billVersion == null) {
                        throw new ParseError("Recorded bill version not found in storage: "+versionKey);
                    }
                    else {
                        billVersion.addAmendment(billKey);
                        if(billVersion.isActive()) {
                            activeBill = billVersion;
                            billVersion.setActive(false);
                        }
                        storage.saveBill(billVersion);
                        ChangeLogger.record(billVersion.getKey(), storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                    }
                    storage.saveBill(billVersion);
                    ChangeLogger.record(billVersion.getKey(), storage);
Solution content
                else {
                }
            }

            // Pull sponsor information up from the base bill
            bill.setSponsor(baseBill.getSponsor());
            bill.setCoSponsors(baseBill.getCoSponsors());
            bill.setMultiSponsors(baseBill.getMultiSponsors());

            // Pull up the list of existing versions and add yourself
            bill.addAmendment(baseKey);
            bill.addAmendments(baseBill.getAmendments());

            // Broadcast yourself to all other versions and deactivate them
            Bill activeBill = null;
            for (String versionKey : bill.getAmendments()) {
                Bill billVersion = storage.getBill(versionKey);
                if (billVersion == null) {
                    throw new ParseError("Recorded bill version not found in storage: "+versionKey);
                    billVersion.addAmendment(billKey);
                    if(billVersion.isActive()) {
                        activeBill = billVersion;
                        billVersion.setActive(false);
                    }
                    storage.saveBill(billVersion);
File
BillProcessor.java
Developer's decision
Version 1
Kind of conflict
Comment
For statement
If statement
Method invocation
Throw statement
Variable
Chunk
Conflicting content
                bill.setLaw(activeBill.getLaw());

                // Activate yourself
<<<<<<< HEAD
                bill.setActive(true);
                storage.saveBill(bill);
                ChangeLogger.record(bill.getKey(), storage);
=======
                amendment.setActive(true);
                storage.saveBill(amendment);
                ChangeLogger.record(amendment.getKey(), storage, date);
                return amendment;
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
            }

            return bill;
Solution content
                bill.setLaw(activeBill.getLaw());

                // Activate yourself
                bill.setActive(true);
                storage.saveBill(bill);
                ChangeLogger.record(bill.getKey(), storage, date);
            }

            return bill;
File
BillProcessor.java
Developer's decision
Manual
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
<<<<<<< HEAD
            storage.saveBill(billVersion);
            billVersion.setMultiSponsors(bill.getMultiSponsors());
            billVersion.setSummary(bill.getSummary());
            ChangeLogger.record(billVersion.getKey(), storage);
        }
        if (bill.isUniBill()) {
            // logger.error("UNIBILL: "+bill.getSenateBillNo()+", "+bill.getSameAs());
            Bill uniBill = storage.getBill(bill.getSameAs());
            if (uniBill != null) {
                String billText = bill.getFulltext();
                String uniBillText = uniBill.getFulltext();

                if (billText.isEmpty()) {
                    logger.info(bill.getSenateBillNo()+" is empty");
                    if (!uniBillText.isEmpty()) {
                        // if we are empty then we must need their text
                        logger.info("taking text from "+bill.getSameAs());
                        bill.setFulltext(uniBillText);
                    }
                    else {
                        logger.info("but there is no text to grab from "+bill.getSameAs());
                    }
                }
                else if (!billText.equals(uniBillText)) {
                    logger.info("My text has been updated, sharing with "+bill.getSameAs());
                    // If we differ, then we must have just changed, share the text
                    uniBill.setFulltext(bill.getFulltext());
                }
                else {
                    logger.info("we have the same text");
                }

                storage.saveBill(uniBill);
            }
        }
        storage.saveBill(bill);
        ChangeLogger.record(bill.getKey(), storage);
=======
            ChangeLogger.record(billVersion.getKey(), storage, date);
        }
        storage.saveBill(bill);
        ChangeLogger.record(bill.getKey(), storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
    }

    /**
Solution content
            billVersion.setMultiSponsors(bill.getMultiSponsors());
            billVersion.setSummary(bill.getSummary());
            storage.saveBill(billVersion);
            ChangeLogger.record(billVersion.getKey(), storage, date);
        }
        if (bill.isUniBill()) {
            // logger.error("UNIBILL: "+bill.getSenateBillNo()+", "+bill.getSameAs());
            Bill uniBill = storage.getBill(bill.getSameAs());
            if (uniBill != null) {
                String billText = bill.getFulltext();
                String uniBillText = uniBill.getFulltext();

                if (billText.isEmpty()) {
                    logger.info(bill.getSenateBillNo()+" is empty");
                    if (!uniBillText.isEmpty()) {
                        // if we are empty then we must need their text
                        logger.info("taking text from "+bill.getSameAs());
                        bill.setFulltext(uniBillText);
                    }
                    else {
                        logger.info("but there is no text to grab from "+bill.getSameAs());
                    }
                }
                else if (!billText.equals(uniBillText)) {
                    logger.info("My text has been updated, sharing with "+bill.getSameAs());
                    // If we differ, then we must have just changed, share the text
                    uniBill.setFulltext(bill.getFulltext());
                }
                else {
                    logger.info("we have the same text");
                }

                storage.saveBill(uniBill);
            }
        }
        storage.saveBill(bill);
        ChangeLogger.record(bill.getKey(), storage, date);
    }

    /**
File
BillProcessor.java
Developer's decision
Combination
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
     * @param storage
     * @throws ParseError
     */
<<<<<<< HEAD
    public void deleteBill(SOBIBlock block, Storage storage) throws ParseError, IOException
=======
    public void deleteBill(SOBIBlock block, Storage storage, Date date) throws ParseError
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
    {
        String billKey = block.getPrintNo()+block.getAmendment()+"-"+block.getYear();
        Bill bill = storage.getBill(billKey);
Solution content
     * @param storage
     * @throws ParseError
     */
    public void deleteBill(SOBIBlock block, Storage storage, Date date) throws ParseError, IOException
    {
        String billKey = block.getPrintNo()+block.getAmendment()+"-"+block.getYear();
        Bill bill = storage.getBill(billKey);
File
BillProcessor.java
Developer's decision
Manual
Kind of conflict
Method signature
Chunk
Conflicting content
                        billVersion.setActive(true);
                    }
                    storage.saveBill(billVersion);
<<<<<<< HEAD
                    ChangeLogger.record(billVersion.getKey(), storage);
=======
                    ChangeLogger.record(billVersion.getKey(), storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
                }
            }
            String key = bill.getYear()+"/bill/"+billKey;
Solution content
                        billVersion.setActive(true);
                    }
                    storage.saveBill(billVersion);
                    ChangeLogger.record(billVersion.getKey(), storage, date);
                }
            }
            String key = bill.getYear()+"/bill/"+billKey;
File
BillProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            }
            String key = bill.getYear()+"/bill/"+billKey;
            storage.del(key);
<<<<<<< HEAD
            ChangeLogger.delete(key, storage);
=======
            ChangeLogger.delete(key, storage, date);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        }
    }
Solution content
            }
            String key = bill.getYear()+"/bill/"+billKey;
            storage.del(key);
            ChangeLogger.delete(key, storage, date);
        }
    }
File
BillProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            calendar.setModified(modifiedDate.getTime());
            String key = String.valueOf(calendar.getYear())+"/calendar/"+calendar.getId();
            storage.set(key, calendar);
<<<<<<< HEAD
            ChangeLogger.record(key, storage);
=======
            ChangeLogger.record(key, storage, modifiedDate);
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
            removeObject = null;
        }
    }
Solution content
            calendar.setModified(modifiedDate.getTime());
            String key = String.valueOf(calendar.getYear())+"/calendar/"+calendar.getId();
            storage.set(key, calendar);
            ChangeLogger.record(key, storage, modifiedDate);
            removeObject = null;
        }
    }
File
CalendarProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
        // Make an entry in the change log
        ChangeLogger.setContext(file, transcript.getTimeStamp());
<<<<<<< HEAD
        ChangeLogger.record(key, storage);
=======
        ChangeLogger.record(key, storage, transcript.getTimeStamp());
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
    }
}
Solution content
        // Make an entry in the change log
        ChangeLogger.setContext(file, transcript.getTimeStamp());
        ChangeLogger.record(key, storage, transcript.getTimeStamp());
    }
}
File
TranscriptProcessor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
import gov.nysenate.openleg.processors.BillProcessor;
import gov.nysenate.openleg.processors.CalendarProcessor;
import gov.nysenate.openleg.processors.TranscriptProcessor;
<<<<<<< HEAD
=======
import gov.nysenate.openleg.util.Change;
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
import gov.nysenate.openleg.util.ChangeLogger;
import gov.nysenate.openleg.util.Storage;
import gov.nysenate.openleg.util.Timer;
Solution content
import gov.nysenate.openleg.processors.BillProcessor;
import gov.nysenate.openleg.processors.CalendarProcessor;
import gov.nysenate.openleg.processors.TranscriptProcessor;
import gov.nysenate.openleg.util.Change;
import gov.nysenate.openleg.util.ChangeLogger;
import gov.nysenate.openleg.util.Storage;
import gov.nysenate.openleg.util.Timer;
File
Ingest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
        // Dump out the change log
        StringBuffer out = new StringBuffer();
<<<<<<< HEAD
        for (Entry entry : ChangeLogger.getChangeLog().entrySet()) {
            out.append(entry.getKey()+"\t"+entry.getValue()+"\n");
=======
        SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date;
        for (Entry entry : ChangeLogger.getChangeLog().entrySet()) {
            date = entry.getValue().getDate();
            if (date != null) {
                out.append(entry.getKey()+"\t"+entry.getValue().getStatus()+"\t"+sdf.format(date).toString()+"\n");
            } else {
                // TODO temporary solution.
                // If no date information available, set date to current time.
                out.append(entry.getKey()+"\t"+entry.getValue().getStatus()+"\t"+sdf.format(new Date()).toString() +"\n");
            }
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
        }

        if (opts.hasOption("change-file")) {
Solution content
        // Dump out the change log
        Date date;
        StringBuffer out = new StringBuffer();
        SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (Entry entry : ChangeLogger.getChangeLog().entrySet()) {
            date = entry.getValue().getDate();
            out.append(entry.getKey()+"\t"+entry.getValue().getStatus()+"\t"+sdf.format(date).toString()+"\n");
        }

        if (opts.hasOption("change-file")) {
File
Ingest.java
Developer's decision
Manual
Kind of conflict
For statement
If statement
Method invocation
Variable
Chunk
Conflicting content
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
<<<<<<< HEAD
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
=======
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
Solution content
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
File
Storage.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    public Boolean del(String key) throws IOException {
        // Deletions are always automatically flushed
        logger.debug("Deleting key: "+key);
<<<<<<< HEAD

        // Instead, move to storage/unpublished
        if (flushKey(key)) {
            FileUtils.moveFileToDirectory(storageFile(key), new File(storage, "unpublished"), true);
        }
        memory.remove(key);
        dirty.remove(key);
        return true;
=======
        memory.remove(key);
        dirty.remove(key);
        return storageFile(key).delete();
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
    }

    public boolean flushKey(String key)
Solution content
        }
    public Boolean del(String key) throws IOException {
        // Deletions are always automatically flushed
        logger.debug("Deleting key: "+key);

        // Instead, move to storage/unpublished
        if (flushKey(key)) {
            FileUtils.moveFileToDirectory(storageFile(key), new File(storage, "unpublished"), true);
        memory.remove(key);
        dirty.remove(key);
        return true;
    }

    public boolean flushKey(String key)
File
Storage.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Return statement
Chunk
Conflicting content
    public File storageFile(String key) {
        return new File(storage, key+".json");
<<<<<<< HEAD
    }

    /*
     * A - Assembly Bill
     * S - Senate Bill
     * L - Joint Resolution
     * E - Assembly Resolution
     * R - Senate Resolution
     * J - "Legislative Resolution" - how is that different than a joint resolution? "Honoring..."?
     * K - "Legislative Resolution" - proclamations of special days, weeks?
     */
    Pattern keyPattern = Pattern.compile("([ASLREJK][0-9]{1,5}[A-Z]?)-([0-9]{4})");

    public Bill getBill(String billNo)
    {
        String key = Bill.getKey(billNo);
        if (key != null) {
            return (Bill)this.get(key, Bill.class);
        }
        else {
            logger.error("Invalid bill key: "+key, new IllegalArgumentException(key));
            return null;
        }
    }

    public void saveBill(Bill bill)
    {
        String key = bill.getKey();
        if (key != null) {
            this.set(key, bill);
        }
        else {
            logger.error("Invalid bill key: "+bill.getSenateBillNo());
        }
    }

    public ObjectMapper mapper = new ObjectMapper();

    public ArrayNode listToArrayNode(List list) {
        return arrayToArrayNode(list.toArray());
    }

    public ArrayNode arrayToArrayNode(Object[] list) {
        ArrayNode arrayNode = mapper.createArrayNode();
        for (Object item : list) {
            arrayNode.add(item.toString());
        }
        return arrayNode;
    }

    public ObjectNode personToObjectNode(Person person) {
        if (person == null) {
            return null;
        }

        ObjectNode node = mapper.createObjectNode();
        node.put("position", person.getPosition());
        node.put("fullname", person.getFullname());
        node.put("id", person.getId());
        node.put("branch", person.getBranch());
        node.put("contactInfo", person.getContactInfo());
        node.put("guid", person.getGuid());
        return node;
    }

    public Person jsonNodeToPerson(JsonNode node) {
        if (node.isNull()) {
            return null;
        }
        logger.debug(node.toString());
        Person person = new Person();
        person.setId(node.get("id").asText());
        person.setFullname(node.get("fullname").asText());
        person.setPosition(node.get("position").asText());
        person.setBranch(node.get("branch").asText());
        person.setContactInfo(node.get("contactInfo").asText());
        person.setGuid(node.get("guid").asText());
        return person;
    }

    public ObjectNode actionToObjectNode(Action action) {
        ObjectNode node = mapper.createObjectNode();
        node.put("id", action.getId());
        node.put("active", action.getActive());
        node.put("bill", (action.getBill() != null) ? action.getBill().getSenateBillNo() : "");
        node.put("date", action.getDate().getTime());
        node.put("modified", action.getModified());
        node.put("sobiReferenceList", arrayToArrayNode(action.getSobiReferenceList().toArray()));
        node.put("text", action.getText());
        node.put("year", action.getYear());
        return node;
    }

    public Action jsonNodeToAction(JsonNode node) {
        Action action = new Action();
        action.setId(node.get("id").asText());
        action.setActive(node.get("active").asBoolean());
        action.setDate(new Date(node.get("date").asLong()));
        action.setModified(node.get("modified").asLong());
        action.setSobiReferenceList(new HashSet(jsonNodeToListString(node.get("sobiReferenceList"))));
        action.setText(node.get("text").asText());
        action.setYear(node.get("year").asInt());
        return action;
    }

    public ObjectNode voteToObjectNode(Vote vote) {
        ObjectNode node = mapper.createObjectNode();
        node.put("id", vote.getId());
        node.put("active", vote.getActive());
        node.put("modified", vote.getModified());
        node.put("sobiReferenceList", arrayToArrayNode(vote.getSobiReferenceList().toArray()));
        node.put("date", vote.getVoteDate().getTime());
        node.put("voteType", vote.getVoteType());
        logger.debug("READING VOTE DESCRIPTION: "+vote.getDescription());
        node.put("description", vote.getDescription());
        node.put("ayes", listToArrayNode(vote.getAyes()));
        node.put("ayeswr", listToArrayNode(vote.getAyeswr()));
        node.put("nays", listToArrayNode(vote.getNays()));
        node.put("abstains", listToArrayNode(vote.getAbstains()));
        node.put("absent", listToArrayNode(vote.getAbsent()));
        node.put("excused", listToArrayNode(vote.getExcused()));
        node.put("bill", (vote.getBill() != null) ? vote.getBill().getSenateBillNo() : "");
        node.put("year", vote.getYear());
        return node;
    }

    public Vote jsonNodeToVote(JsonNode node) {
        Vote vote = new Vote();
        vote.setId(node.get("id").asText());
        vote.setAbsent(jsonNodeToListString(node.get("absent")));
        vote.setAyes(jsonNodeToListString(node.get("ayes")));
        vote.setAyeswr(jsonNodeToListString(node.get("ayeswr")));
        vote.setNays(jsonNodeToListString(node.get("nays")));
        vote.setExcused(jsonNodeToListString(node.get("excused")));
        vote.setAbstains(jsonNodeToListString(node.get("abstains")));
        vote.setVoteDate(new Date(node.get("date").asLong()));
        vote.setModified(node.get("modified").asLong());
        vote.setActive(node.get("active").asBoolean());
        logger.debug("READING VOTE DESCRIPTION: "+node.get("description").asText());
        vote.setDescription(node.get("description").asText());
        vote.setVoteType(node.get("voteType").asInt());
        vote.setYear(node.get("year").asInt());
        return vote;
    }

    public List jsonNodeToListString(JsonNode array) {
        List list = new ArrayList();
        Iterator iter = array.getElements();
        while(iter.hasNext()) {
            list.add(iter.next().asText());
        }
        return list;
=======
>>>>>>> 186ac541d9481486cd63bbf6a8eef01bf6902672
    }

    public Bill readBill(File file) throws JsonProcessingException, IOException
Solution content
    public File storageFile(String key) {
        return new File(storage, key+".json");
    }

    /*
     * A - Assembly Bill
     * S - Senate Bill
     * L - Joint Resolution
     * E - Assembly Resolution
     * R - Senate Resolution
     * J - "Legislative Resolution" - how is that different than a joint resolution? "Honoring..."?
     * K - "Legislative Resolution" - proclamations of special days, weeks?
     */
    Pattern keyPattern = Pattern.compile("([ASLREJK][0-9]{1,5}[A-Z]?)-([0-9]{4})");

    public Bill getBill(String billNo)
    {
        String key = Bill.getKey(billNo);
        if (key != null) {
            return (Bill)this.get(key, Bill.class);
        }
        else {
            logger.error("Invalid bill key: "+key, new IllegalArgumentException(key));
            return null;
        }
    }

    public void saveBill(Bill bill)
    {
        String key = bill.getKey();
        if (key != null) {
            this.set(key, bill);
        }
        else {
            logger.error("Invalid bill key: "+bill.getSenateBillNo());
        }
    }

    public ObjectMapper mapper = new ObjectMapper();

    public ArrayNode listToArrayNode(List list) {
        return arrayToArrayNode(list.toArray());
    }

    public ArrayNode arrayToArrayNode(Object[] list) {
        ArrayNode arrayNode = mapper.createArrayNode();
        for (Object item : list) {
            arrayNode.add(item.toString());
        }
        return arrayNode;
    }

    public ObjectNode personToObjectNode(Person person) {
        if (person == null) {
            return null;
        }

        ObjectNode node = mapper.createObjectNode();
        node.put("position", person.getPosition());
        node.put("fullname", person.getFullname());
        node.put("id", person.getId());
        node.put("branch", person.getBranch());
        node.put("contactInfo", person.getContactInfo());
        node.put("guid", person.getGuid());
        return node;
    }

    public Person jsonNodeToPerson(JsonNode node) {
        if (node.isNull()) {
            return null;
        }
        logger.debug(node.toString());
        Person person = new Person();
        person.setId(node.get("id").asText());
        person.setFullname(node.get("fullname").asText());
        person.setPosition(node.get("position").asText());
        person.setBranch(node.get("branch").asText());
        person.setContactInfo(node.get("contactInfo").asText());
        person.setGuid(node.get("guid").asText());
        return person;
    }

    public ObjectNode actionToObjectNode(Action action) {
        ObjectNode node = mapper.createObjectNode();
        node.put("id", action.getId());
        node.put("active", action.getActive());
        node.put("bill", (action.getBill() != null) ? action.getBill().getSenateBillNo() : "");
        node.put("date", action.getDate().getTime());
        node.put("modified", action.getModified());
        node.put("sobiReferenceList", arrayToArrayNode(action.getSobiReferenceList().toArray()));
        node.put("text", action.getText());
        node.put("year", action.getYear());
        return node;
    }

    public Action jsonNodeToAction(JsonNode node) {
        Action action = new Action();
        action.setId(node.get("id").asText());
        action.setActive(node.get("active").asBoolean());
        action.setDate(new Date(node.get("date").asLong()));
        action.setModified(node.get("modified").asLong());
        action.setSobiReferenceList(new HashSet(jsonNodeToListString(node.get("sobiReferenceList"))));
        action.setText(node.get("text").asText());
        action.setYear(node.get("year").asInt());
        return action;
    }

    public ObjectNode voteToObjectNode(Vote vote) {
        ObjectNode node = mapper.createObjectNode();
        node.put("id", vote.getId());
        node.put("active", vote.getActive());
        node.put("modified", vote.getModified());
        node.put("sobiReferenceList", arrayToArrayNode(vote.getSobiReferenceList().toArray()));
        node.put("date", vote.getVoteDate().getTime());
        node.put("voteType", vote.getVoteType());
        logger.debug("READING VOTE DESCRIPTION: "+vote.getDescription());
        node.put("description", vote.getDescription());
        node.put("ayes", listToArrayNode(vote.getAyes()));
        node.put("ayeswr", listToArrayNode(vote.getAyeswr()));
        node.put("nays", listToArrayNode(vote.getNays()));
        node.put("abstains", listToArrayNode(vote.getAbstains()));
        node.put("absent", listToArrayNode(vote.getAbsent()));
        node.put("excused", listToArrayNode(vote.getExcused()));
        node.put("bill", (vote.getBill() != null) ? vote.getBill().getSenateBillNo() : "");
        node.put("year", vote.getYear());
        return node;
    }

    public Vote jsonNodeToVote(JsonNode node) {
        Vote vote = new Vote();
        vote.setId(node.get("id").asText());
        vote.setAbsent(jsonNodeToListString(node.get("absent")));
        vote.setAyes(jsonNodeToListString(node.get("ayes")));
        vote.setAyeswr(jsonNodeToListString(node.get("ayeswr")));
        vote.setNays(jsonNodeToListString(node.get("nays")));
        vote.setExcused(jsonNodeToListString(node.get("excused")));
        vote.setAbstains(jsonNodeToListString(node.get("abstains")));
        vote.setVoteDate(new Date(node.get("date").asLong()));
        vote.setModified(node.get("modified").asLong());
        vote.setActive(node.get("active").asBoolean());
        logger.debug("READING VOTE DESCRIPTION: "+node.get("description").asText());
        vote.setDescription(node.get("description").asText());
        vote.setVoteType(node.get("voteType").asInt());
        vote.setYear(node.get("year").asInt());
        return vote;
    }

    public List jsonNodeToListString(JsonNode array) {
        List list = new ArrayList();
        Iterator iter = array.getElements();
        while(iter.hasNext()) {
            list.add(iter.next().asText());
        }
        return list;
    }

    public Bill readBill(File file) throws JsonProcessingException, IOException
File
Storage.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Method declaration
Method invocation
Method signature
Return statement
Variable
While statement