r7057 - dumbhippo/trunk/server/src/com/dumbhippo/server/impl



Author: marinaz
Date: 2007-12-14 13:52:42 -0600 (Fri, 14 Dec 2007)
New Revision: 7057

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
Log:
Get Account explicitly, since it is lazily fetched.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-14 19:31:10 UTC (rev 7056)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java	2007-12-14 19:52:42 UTC (rev 7057)
@@ -268,9 +268,14 @@
 					}
 				}	
 			});
+			Account account = TxUtils.runInTransaction(new Callable<Account>() {
+				public Account call() {
+					    return accounts.lookupAccountByUser(user);
+				}	
+			});
 		    if (facebookAccount != null && facebookAccount.isApplicationEnabled()) {
 		        FacebookWebServices ws = new FacebookWebServices(REQUEST_TIMEOUT, config);
-			    ws.setProfileFbml(facebookAccount, createFbmlForUser(user));
+			    ws.setProfileFbml(facebookAccount, createFbmlForUser(account));
             }		    
 		} catch (Exception e) {
 			logger.error("Caught an exception when getting a FacebookAccount for {}: {}", user, e.getMessage());
@@ -585,7 +590,8 @@
         		                        event);
 	}
 	
-	private String createFbmlForUser(User user) {
+	private String createFbmlForUser(Account account) {
+		User user = account.getOwner();
 		StringBuilder fbmlSb = new StringBuilder("");
 		fbmlSb.append("<fb:visible-to-owner><fb:subtitle>" +
 		              "<a href='http://apps.facebook.com/mugshot'>Edit Accounts</a>" +
@@ -609,7 +615,7 @@
 		if (pageableMugshot.getResults().size() == 0) {
 			fbmlSb.append("<div>Once there are new updates, they will show up here.</div>");
 		}
-		if (user.getAccount().getHasAcceptedTerms()) {
+		if (account.getHasAcceptedTerms()) {
 		    fbmlSb.append("<a target='_blank' style='font-size: 12px; font-weight: bold; margin-top: 10px;' href='" + getAbsoluteUrl("/person?who=" + user.getId().toString()) + "'>" +
 				          "Visit my Mugshot Page</a>");
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]