Permalink
Browse files

Add higher level storage functions for bills.

  • Loading branch information...
1 parent 6265f61 commit 7e57b724d28f58bc7c0eb015822334c1f2d842a6 @GraylinKim GraylinKim committed Apr 11, 2013
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/main/java/gov/nysenate/openleg/util/Storage.java
View
15 src/main/java/gov/nysenate/openleg/util/Storage.java
@@ -1,5 +1,7 @@
package gov.nysenate.openleg.util;
+import gov.nysenate.openleg.model.Bill;
+
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -186,4 +188,17 @@ public void clearLog() {
private File storageFile(String key) {
return new File(storage, key+".json");
}
+
+ public Bill getBill(String billKey)
+ {
+ String[] keyParts = billKey.split("-");
+ return (Bill)this.get(keyParts[1]+"/bill/"+billKey, Bill.class);
+ }
+
+ public void saveBill(Bill bill)
+ {
+ String billKey = bill.getSenateBillNo();
+ String[] keyParts = billKey.split("-");
+ this.set(keyParts[1]+"/bill/"+billKey, bill);
+ }
}

0 comments on commit 7e57b72

Please sign in to comment.