Package gov.nysenate.openleg.model

Examples of gov.nysenate.openleg.model.Bill


            }
        }
    }

    private ProblemBill getProblemBill(String rawBillNo, String formattedBillNo, String lbdcPageCount) {
        Bill luceneBill = SearchEngine.getInstance().getBill(formattedBillNo);

        if(luceneBill == null) {
            //TODO we don't have it
        }
        else {
            if(luceneBill.getFulltext() != null) {
                int pageNumber = getPageNumber(rawBillNo.replaceAll("^0*", ""), luceneBill.getFulltext());

                if(pageNumber != new Integer(lbdcPageCount)) {
                    ProblemBill problemBill = new ProblemBill(formattedBillNo, luceneBill.getModified());
                    problemBill.addNonMatchingField(new NonMatchingField(FieldName.FULLTEXT, pageNumber + "", lbdcPageCount + ""));
                    problemBill.setLastReported(time);
                    return problemBill;
                }
            }
View Full Code Here


                        else {
                            if(isPrimitive(obj)) {
                                root.addProperty(f.getName(), obj.toString());
                            }
                            else if(type.equals("Bill")) {
                                Bill bill = (Bill)obj;

                                if(!cachedSimpleBills.containsKey(bill.getBillId())) {
                                    cachedSimpleBills.put(bill.getBillId(), converter(obj,internal_bill_exclude()));
                                }

                                root.add(f.getName(), cachedSimpleBills.get(bill.getBillId()));
                            }
                            else if(type.equals("Date")) {
                                Date d = (Date)obj;
                                root.addProperty(f.getName(), (d != null) ? d.getTime() + "":"");
                            }
View Full Code Here

                resultNode.setAttribute("sponsor", vote.getBill().getSponsor().getFullname());
            }
            else if (result.getOtype().equals("bill")) {
                root.setName("docket");
                resultNode.setName("bill");
                Bill bill = (Bill)result.getObject();
                resultNode.setAttribute("billId", bill.getBillId());
                resultNode.setAttribute("senateId", bill.getBillId());
                resultNode.setAttribute("year", String.valueOf(bill.getYear()));
                resultNode.setAttribute("law", bill.getLaw());
                resultNode.setAttribute("lawSection", bill.getLawSection());
                resultNode.setAttribute("sponsor", bill.getSponsor().getFullname());
                resultNode.setAttribute("assemblySameAs", bill.getSameAs());
                resultNode.setAttribute("sameAs", bill.getSameAs());

                Element cosponsorsNode = new Element("cosponsors");
                for (Person cosponsor : bill.getCoSponsors()) {
                    Element cosponsorNode = new Element("cosponsor");
                    cosponsorNode.addContent(cosponsor.getFullname());
                }
                resultNode.addContent(cosponsorsNode);

                Element summaryNode = new Element("summary");
                summaryNode.addContent(bill.getSummary());
                resultNode.addContent(summaryNode);

                Element committeeNode = new Element("committee");
                committeeNode.addContent(bill.getCurrentCommittee());
                resultNode.addContent(committeeNode);
            }
            else if (result.getOtype().equals("meeting")) {
                Meeting meeting = (Meeting)result.getObject();
                resultNode.setAttribute("committee", meeting.getCommitteeName());
View Full Code Here

    public static void write(IBaseObject object, OutputStream out) throws IOException, COSVisitorException, AbstractApiRequest.ApiRequestException {
        if (!(object instanceof Bill)) {
            throw new AbstractApiRequest.ApiRequestException("Unable to convert " + object.getOtype() + "s to pdf.");
        }

        Bill bill = (Bill) object;
        PDDocument doc = new PDDocument();
        PDFont font = PDType1Font.COURIER;

        Float margin = billMargin;
        if (bill.isResolution()) {
            margin = resolutionMargin;
        }

        List<List<String>> pages = TextFormatter.pdfPrintablePages(bill);
        for (List<String> page : pages) {
View Full Code Here

      }

  @Test
     public void verifyWholeBill2011S1462() throws IOException
    {
    Bill theBill;
    File sobiDirectory = new File("/home/shweta/test/processed/2013/bills/");
      Storage storage = new Storage(env.getStorageDirectory());
      ArrayList<File> file = (ArrayList<File>) TestHelper.getFilesByNameCollection(sobiDirectory,"SOBI.D110110.T142112.TXT",
     "SOBI.D110107.T144910.TXT",   "SOBI.D110112.T175532.TXT", "SOBI.D110107.T150914.TXT", "SOBI.D110107.T141407.TXT");

      // Test for SOBI.D110107.T141407.TXT
      TestHelper.processFileC(env ,file.get(4));
      theBill=(Bill)storage.get("2011/bill/S1462-2011", Bill.class);
      assertNotNull("The title should not be null",theBill.getTitle());
    assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");

    //Test for SOBI.D110107.T144910.TXT
     TestHelper.processFileC(env ,file.get(1));
     theBill=(Bill)storage.get("2011/bill/S1462-2011", Bill.class);
     assertEquals(theBill.getSameAs(),"A1415");

    // No Test for SOBI.D110107.T150914.TXT,SOBI.D110110.T142112.TXT,SOBI.D110112.T175532.TXT(Memo)
    }
View Full Code Here

    }

  @Test
     public void verifyWholeBill2011S1462A() throws IOException  // Testing Amendment A of the bill 2011S1462
    {
    Bill theBill;
    File sobiDirectory = new File("/home/shweta/test/processed/2013/bills/");
      Storage storage = new Storage(env.getStorageDirectory());
      ArrayList<File> file = (ArrayList<File>) TestHelper.getFilesByNameCollection(sobiDirectory,"SOBI.D110110.T142112.TXT",
          "SOBI.D110613.T222123.TXT", "SOBI.D110614.T192241.TXT", "SOBI.D110210.T221519.TXT", "SOBI.D120130.T202912.TXT",
          "SOBI.D110209.T171647.TXT", "SOBI.D120126.T103841.TXT", "SOBI.D110614.T195743.TXT", "SOBI.D120104.T223233.TXT",
          "SOBI.D110215.T151615.TXT", "SOBI.D110209.T105617.TXT", "SOBI.D110209.T110618.TXT", "SOBI.D110614.T152729.TXT",
          "SOBI.D110210.T102843.TXT", "SOBI.D110112.T175532.TXT", "SOBI.D110107.T144910.TXT", "SOBI.D110614.T185240.TXT",
          "SOBI.D120125.T130337.TXT", "SOBI.D110209.T171147.TXT", "SOBI.D110107.T150914.TXT", "SOBI.D110209.T170214.TXT",
          "SOBI.D110107.T141407.TXT");



        // Test for SOBI.D110209.T105617.TXT
     TestHelper.processFileC(env ,file.get(10));
     theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
     assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
     assertNotNull("The title should not be null",theBill.getTitle());

      // Test for SOBI.D110209.T110618.TXT
      TestHelper.processFileC(env ,file.get(11));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
        assertNotNull("The title should not be null",theBill.getTitle());

        // Test for SOBI.D110215.T151615.TXT
        TestHelper.processFileC(env ,file.get(9));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
        assertNotNull("The title should not be null",theBill.getTitle());

        // Test for SOBI.D110613.T222123.TXT
        TestHelper.processFileC(env ,file.get(1));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
        assertNotNull("The title should not be null",theBill.getTitle());

        // Test for SOBI.D110614.T152729.TXT
        TestHelper.processFileC(env ,file.get(12));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
        assertNotNull("The title should not be null",theBill.getTitle());

        // Test for SOBI.D110209.T170214.TXT,
        TestHelper.processFileC(env ,file.get(20));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSponsor().getFullname(),"LAVALLE");
        assertNotNull("The title should not be null",theBill.getTitle());

        // Test for SOBI.D110209.T171147.TXT
        TestHelper.processFileC(env ,file.get(18));
        theBill=(Bill)storage.get("2011/bill/S1462A-2011", Bill.class);
        assertEquals(theBill.getSameAs(),"A1415A");

        // NO test for SOBI.D110210.T102843.TXT ,SOBI.D110210.T221519.TXT (Memo)


View Full Code Here

        actionStrings.add(new String[]{"01/23/12", "ADVANCED TO THIRD READING"});
        actionStrings.add(new String[]{"01/30/12", "PASSED SENATE"});
        actionStrings.add(new String[]{"01/30/12", "DELIVERED TO ASSEMBLY"});
        actionStrings.add(new String[]{"01/30/12", "referred to codes"});
        // TODO: Passed assembly??
        BillTests.testBillStatusActions(env, sobiDirectory, storage, billKey, initialSenateSobi, actionStrings, new Bill("S1618-2011", 2011));
    }
View Full Code Here

  public static void testVoteDate(Environment env, File sobiDirectory,
      Storage storage, String billKey, String voteSobi, String expectedVoteDate)
  {
    File[] voteSobiFile = TestHelper.getFilesByName(sobiDirectory, voteSobi);
    TestHelper.processFile(env, voteSobiFile);
    Bill bill = TestHelper.getBill(storage, billKey);
    Vote vote = bill.getVotes().get(0);
    Date voteDate = vote.getVoteDate();
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
    // Format the Date into a string and test.
    assertThat(dateFormat.format(voteDate), is(expectedVoteDate));
  }
View Full Code Here

  public static void testSenateVotes(Environment env, File sobiDirectory,
      Storage storage, String billKey, String voteSobi, Vote expected)
  {
    File[] voteSobiFile = TestHelper.getFilesByName(sobiDirectory, voteSobi);
    TestHelper.processFile(env, voteSobiFile);
    Bill bill = TestHelper.getBill(storage, billKey);
    Vote testVote = bill.getVotes().get(0);
    // Look into ListAssert.assertEquals if we don't care about the order of the lists.
    assertThat(testVote.getAyes(), is(expected.getAyes()));
    assertThat(testVote.getAyeswr(), is(expected.getAyeswr()));
    assertThat(testVote.getAbsent(), is(expected.getAbsent()));
    assertThat(testVote.getAbstains(), is(expected.getAbstains()));
View Full Code Here

  {
    File[] voteSobiFile = TestHelper.getFilesByName(sobiDirectory, committeeVoteSobi);
    TestHelper.processFile(env, voteSobiFile);
    Meeting meeting = TestHelper.getMeeting(storage, meetingKey);
    List<Bill> bills = meeting.getBills();
    Bill bill = TestHelper.getBillByName(bills, billName);
    Vote testVote = bill.getVotes().get(0);
    assertThat(testVote.getAyes(), is(expected.getAyes()));
    assertThat(testVote.getAyeswr(), is(expected.getAyeswr()));
    assertThat(testVote.getAbsent(), is(expected.getAbsent()));
    assertThat(testVote.getAbstains(), is(expected.getAbstains()));
    assertThat(testVote.getExcused(), is(expected.getExcused()));
View Full Code Here

TOP

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

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.