Skip to content

Commit

Permalink
MemoCheck should use the configured application environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
GraylinKim committed Apr 29, 2014
1 parent b92af82 commit 1df5041
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/gov/nysenate/openleg/scripts/MemoCheck.java
Expand Up @@ -3,6 +3,7 @@
import gov.nysenate.openleg.model.Bill;
import gov.nysenate.openleg.model.SOBIBlock;
import gov.nysenate.openleg.processors.BillProcessor;
import gov.nysenate.openleg.util.Application;
import gov.nysenate.openleg.util.Storage;

import java.io.File;
Expand Down Expand Up @@ -38,17 +39,15 @@ protected void execute(CommandLine opts) throws Exception
errors.put("mismatch", 0);
File blockFile = new File("/data/openleg/PALMER.SEN.ALL.MEMO2011.TXT");
BillProcessor bp = new BillProcessor();
File storageDir = new File("/data/openleg/2011_test/json/");
Storage storage = new Storage(storageDir);
Storage storage = Application.getStorage();
List<SOBIBlock> blocks = bp.getBlocks(blockFile);
for (SOBIBlock block : blocks) {
String billNo = block.getPrintNo()+block.getAmendment()+"-"+block.getYear();
Bill jsonBill = storage.getBill(block.getPrintNo()+block.getAmendment(), block.getYear());
Bill lbdcBill = new Bill(billNo, block.getYear());
bp.applyText(block.getData(), lbdcBill, new Date());

String jsonMemo = StringUtils.normalizeSpace(jsonBill.getMemo().replaceAll("[?�]","§").replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").trim()).toLowerCase();
String lbdcMemo = StringUtils.normalizeSpace(lbdcBill.getMemo().replaceAll("[?�]","§").replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").trim()).toLowerCase();
bp.applyText(new String(block.getData().getBytes(), "utf-8"), lbdcBill, new Date());
String jsonMemo = StringUtils.normalizeSpace(jsonBill.getMemo().replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").replaceAll("-", "").trim()).toLowerCase();
String lbdcMemo = StringUtils.normalizeSpace(lbdcBill.getMemo().replaceAll("�", "§").replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").replaceAll("-", "").trim()).toLowerCase();

if(jsonMemo.isEmpty()) {
logger.error(billNo+": MISSING");
Expand Down

0 comments on commit 1df5041

Please sign in to comment.