* @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(true));
googleData.setAccountListError(analyticsWrapper.getAccountListError());
googleData.setSegmentList(analyticsWrapper.getSegmentList());
// Get Google Analytics profile data.
googleData.setTableId(analyticsWrapper.getTableId());
googleData.setProfileName(analyticsWrapper.getProfileName());
googleData.setDataList(analyticsWrapper.getDataList());
googleData.setDataListError(analyticsWrapper.getDataListError());
googleData.setProfileName(analyticsWrapper.getProfileName());
googleData.setEndDate(analyticsWrapper.getEndDate());
googleData.setStartDate(analyticsWrapper.getStartDate());
googleData.setSegment(analyticsWrapper.getSegment());
googleData.setSegmentName(analyticsWrapper.getSegmentName());
googleData.setQueryURL(analyticsWrapper.getQueryURL());
// Get authorization data.
googleData.setTokenValid(analyticsWrapper.isTokenValid());
String authorizationUrl = analyticsWrapper.isTokenValid()
? AuthorizationServlet.REVOKE_TOKEN_HANDLER
: AuthorizationServlet.AUTHORIZATION_HANDLER;
googleData.setAuthorizationUrl(authorizationUrl);
return googleData;
}