Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updates to core billbuzz service

  • Loading branch information...
commit 2a23b2b9d8251084c5b038d44f90ccab77e758a6 1 parent 9e0c033
Jared Williams authored
View
13 BillBuzz/src/gov/nysenate/billbuzz/BillBuzz.java
@@ -30,15 +30,14 @@
public class BillBuzz {
private static Logger logger = Logger.getLogger(BillBuzz.class);
- private static String _billRegExp = "[BJRbjr][\\d]*[a-zA-Z]*";
-
- private static final String SMTP_HOST_NAME = Resource.get("hostname");
+ private static String _billRegExp = "[BJRbjr][\\d]*[a-zA-Z]*\\-\\d{4}";
+ private static final String SMTP_HOST_NAME = "webmail.senate.state.ny.us";
- private static final String SMTP_PORT = Resource.get("port");
+ private static final String SMTP_PORT = "587";
private static final String SMTP_ACCOUNT_USER = Resource.get("user");
private static final String SMTP_ACCOUNT_PASS = Resource.get("pass");
-
+
Map<String,gov.nysenate.billbuzz.persist.Senator> _sep;
@@ -98,7 +97,7 @@ public void sendToSubscribers(Map<String,Senator> m) throws Exception {
}
}
- SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d 'at' HH:mm");
+ SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d");
if(!senators.isEmpty() || (u.getOtherData() && !_otherThreads.isEmpty())) {
sendMail(email,"BillBuzz for " + sdf.format(new Date()),generateHTMLSubscriptionMessage(senators,name,u.getOtherData()),
@@ -447,7 +446,7 @@ public String generateHTMLSubscriptionMessage(List<Senator> senators, String nam
}
}
- if(otherThreadsTog) {
+ if(otherThreadsTog && _otherThreads != null && !_otherThreads.isEmpty()) {
message += "<h3><b>Other Legislation</b></h3>";
for(ThreadDescription td:_otherThreads) {
BillInfo b = td.getBill();
View
4 BillBuzz/src/gov/nysenate/billbuzz/Disqus.java
@@ -28,11 +28,11 @@
* |--->etc...
*/
public class Disqus {
+ private static String _dateDivide = "[\\-T:]";
private static String _website = Resource.get("website");
private static String _api = Resource.get("api");
private static String _key = Resource.get("key");
-
- private static String _dateDivide = "[\\-T:]";
+
public Disqus() {
}
View
2  BillBuzz/src/gov/nysenate/billbuzz/Main.java
@@ -25,7 +25,7 @@ else if(args[0].compareTo("-d") == 0) {
else {
System.out.println("Invalid paramters, correct usage is: BillBuzz or BillBuzz -m \"YYYY-MM-DD\"");
}
- //new BillBuzz("2010-12-01T00:00");
+// new BillBuzz("2011-08-01T17:30");
}
}
View
9 BillBuzz/src/gov/nysenate/billbuzz/OpenLegXML.java
@@ -14,7 +14,7 @@
public class OpenLegXML
{
//base url for xml interface
- private static String _openLegURL = "http://open.nysenate.gov/legislation/api/1.0/XML/bill/";
+ private static String _openLegURL = "http://open.nysenate.gov/legislation/api/1.0/xml/bill/";
public OpenLegXML() {
@@ -25,7 +25,12 @@ public OpenLegXML() {
* @returns the billid from the url
*/
public static String getBillFromURL(String url) {
- return url.split("/bill/")[1];
+ try {
+ return url.split("/bill/")[1];
+ }
+ catch (Exception e) {
+ return "";
+ }
}
View
11 BillBuzz/src/gov/nysenate/billbuzz/ThreadMod.java
@@ -107,6 +107,17 @@ public ThreadMod() {
_uC.add(c);
}
}
+
+ String bill = OpenLegXML.getBillFromURL(td.getURL());
+ if(bill.equals(""))
+ continue;
+ else {
+ if(bill.indexOf("-") == -1) {
+ td.setURL(td.getURL() + "-2009");
+ }
+
+ }
+
//if a new thread has been created then there are accepted comments
if(newtd != null) {
newtd.setComments(newclst);
Please sign in to comment.
Something went wrong with that request. Please try again.