r6997 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl web/servlets
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6997 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl web/servlets
- Date: Sun, 9 Dec 2007 22:54:11 -0600 (CST)
Author: marinaz
Date: 2007-12-09 22:54:11 -0600 (Sun, 09 Dec 2007)
New Revision: 6997
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
Log:
Set "love" sentiment on accounts only after we were
able to verify them by getting a feed for them or a
response from web services.
Add small fixes and debug output in FacebookServlet.
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2007-12-09 16:36:09 UTC (rev 6996)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2007-12-10 04:54:11 UTC (rev 6997)
@@ -1512,8 +1512,6 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
-
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
Feed feed;
try {
@@ -1525,6 +1523,8 @@
external.setFeed(feed);
feed.getAccounts().add(external);
+
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
}
public void doSetNetflixAccount(XmlBuilder xml, UserViewpoint viewpoint, String urlOrIdStr) throws XmlMethodException, RetryException {
@@ -1546,8 +1546,6 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
-
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
Feed feed;
try {
@@ -1559,6 +1557,8 @@
external.setFeed(feed);
feed.getAccounts().add(external);
+
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
}
private ExternalAccountType parseExternalAccountType(String type) throws XmlMethodException {
@@ -1743,7 +1743,6 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
Feed feed;
try {
@@ -1756,6 +1755,8 @@
external.setFeed(feed);
feed.getAccounts().add(external);
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
+
xml.appendTextNode("username", external.getHandle());
}
@@ -1827,12 +1828,12 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
Feed feed;
try {
feed = feedSystem.scrapeFeedFromUrl(new URL("http://digg.com/users/" + StringUtils.urlEncode(external.getHandle()) + "/history/diggs.rss"));
} catch (MalformedURLException e) {
+ logger.debug("Error message when retreaving Digg feed {}", e.getMessage());
throw new XmlMethodException(XmlMethodErrorCode.INVALID_URL, e.getMessage());
}
EJBUtil.forceInitialization(feed.getAccounts());
@@ -1840,6 +1841,8 @@
external.setFeed(feed);
feed.getAccounts().add(external);
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
+
xml.appendTextNode("username", external.getHandle());
}
@@ -1865,7 +1868,6 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
external.setFeeds(new HashSet<Feed>());
@@ -1895,6 +1897,8 @@
external.addFeed(dislikedFeed);
dislikedFeed.getAccounts().add(external);
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
+
xml.appendTextNode("username", external.getHandle());
// we should really always either find or not find both feeds
@@ -1951,7 +1955,6 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
try {
@SuppressWarnings("unused") Feed feed = feedSystem.scrapeFeedFromUrl(new URL("http://picasaweb.google.com/" + StringUtils.urlEncode(external.getHandle())));
@@ -1968,6 +1971,8 @@
feed.getAccounts().add(external);
*/
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
+
xml.appendTextNode("username", external.getHandle());
}
@@ -1991,14 +1996,17 @@
} catch (ValidationException e) {
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
-
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
// check how many reviews they have and warn them there will be no updates if there are too many
AmazonWebServices ws = new AmazonWebServices(REQUEST_TIMEOUT, config);
int reviewCount = ws.getReviewsCount(amazonUserId);
int reviewCountWeCanGet = AmazonWebServices.MAX_AMAZON_REVIEW_PAGES_RETURNED * AmazonWebServices.AMAZON_REVIEWS_PER_PAGE;
+ // TODO: Set this only if Amazon web services request confirmed that the account exists.
+ // Right now, we just provide links to a non-existing account and review pages if the id entered conforms
+ // to the expected format of an Amazon user id.
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
+
if (reviewCount >= reviewCountWeCanGet) {
xml.appendTextNode("message", "You currently have " + reviewCount + " reviews on Amazon. " +
"We will not be able to get updates about your reviews, because for now "+
@@ -2118,8 +2126,6 @@
throw new XmlMethodException(XmlMethodErrorCode.PARSE_ERROR, e.getMessage());
}
- externalAccountSystem.setSentiment(external, Sentiment.LOVE);
-
Feed feed;
try {
feed = feedSystem.scrapeFeedFromUrl(new URL("http://www.google.com/reader/public/atom/user/" +
@@ -2131,6 +2137,8 @@
external.setFeed(feed);
feed.getAccounts().add(external);
+
+ externalAccountSystem.setSentiment(external, Sentiment.LOVE);
}
private StatisticsService getStatisticsService() throws XmlMethodException {
Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java 2007-12-09 16:36:09 UTC (rev 6996)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java 2007-12-10 04:54:11 UTC (rev 6997)
@@ -186,6 +186,7 @@
}
} catch (XmlMethodException e) {
logger.error("Error updating external account for " + entry.getKey() + " with value " + entryValue, e);
+ logger.debug("e.getMessage is {}", e.getMessage());
accountsSetFailed.put(entry.getKey(), e.getMessage());
} catch (ParserConfigurationException e) {
logger.error("Error updating external account for " + entry.getKey() + " with value " + entryValue, e);
@@ -249,7 +250,7 @@
singularOrPlural = " accounts were";
else
singularOrPlural = " account was";
- xml.appendTextNode("li", accountsRemovedBuilder.substring(0, accountsRemovedBuilder.length()-2) + singularOrPlural + " accounts were removed successfully.");
+ xml.appendTextNode("li", accountsRemovedBuilder.substring(0, accountsRemovedBuilder.length()-2) + singularOrPlural + " removed successfully.");
}
xml.closeElement();
xml.closeElement();
@@ -272,10 +273,11 @@
singularOrPlural = " Accounts Were";
xml.openElement("fb:error");
- xml.appendTextNode("fb:message", "There Following" + singularOrPlural + " Not Set");
- xml.openElement("ul");
+ xml.appendTextNode("fb:message", "The Following" + singularOrPlural + " Not Set");
+ xml.openElement("ul");
for (Map.Entry<ExternalAccountType, String> entry : accountsSetFailed.entrySet()) {
- xml.appendTextNode("li", entry.getKey().getName() + ": " + entry.getValue());
+ logger.debug("key {} value {}", entry.getKey().getSiteName(), entry.getValue());
+ xml.appendTextNode("li", entry.getKey().getSiteName() + ": " + entry.getValue());
}
xml.closeElement();
xml.closeElement();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]