* @param userToken holds the authorized session token.
*/
public GoogleData getGoogleData() {
// Put the data from the API requests into a Google Data object.
GoogleData googleData = new GoogleData();
// Get authentication data.
String authenticationUrl = userService.isUserLoggedIn()
? userService.createLogoutURL(MainServlet.MAIN_URL)
: userService.createLoginURL(MainServlet.MAIN_URL);
googleData.setAuthenticationUrl(authenticationUrl);
googleData.setIsLoggedIn(userService.isUserLoggedIn());
// Get Google Analytics account data.
googleData.setAccountList(analyticsWrapper.getAccountList());
googleData.setAccountListError(analyticsWrapper.getAccountListError());
// Get Google Analytics profile data.
googleData.setTableId(analyticsWrapper.getTableId());
googleData.setDataList(analyticsWrapper.getDataList());
googleData.setDataListError(analyticsWrapper.getDataListError());
// Get authorization data.
googleData.setTokenValid(analyticsWrapper.isTokenValid());
String authorizationUrl = analyticsWrapper.isTokenValid()
? AuthorizationServlet.REVOKE_TOKEN_HANDLER
: AuthorizationServlet.AUTHORIZATION_HANDLER;
googleData.setAuthorizationUrl(authorizationUrl);
return googleData;
}