Package sample.data

Examples of sample.data.GoogleData


    /*
    GoogleDataManager googleDataManager = GoogleDataManagerFactory.getOauthManager(
        APPLICATION_NAME,
        request.getParameter("ids"));
    */
    GoogleData googleData = googleDataManager.getGoogleData();

    // First, users must login to use the application.
    nextUrl = LOGIN_VIEW_URL;
    if (googleData.isLoggedIn()) {

      // Second, users must authorize this application to access their Google Analytics account.
      nextUrl = AUTHORIZATION_VIEW_URL;
      if (googleData.isTokenValid()) {

        // Third, users can see results.
        nextUrl = RESULTS_VIEW_URL;
      }
    }
View Full Code Here


        // The user is starting the AuthSub authorization process.
        nextUrl = authManager.getAuthorizationRedirectUrl(request.getRequestURL());
      }
    }

    GoogleData googleData = authManager.getGoogleData();

    if (googleData.getAuthorizationErrorMessage() != null) {
      // Forward users to the authorization page.
      request.setAttribute("googleData", googleData);
      ServletContext sc = getServletContext();
      RequestDispatcher dispatcher = sc.getRequestDispatcher(MainServlet.AUTHORIZATION_VIEW_URL);
      dispatcher.forward(request, response);
View Full Code Here

   * any errors that occurred.
   * @param tokenValid if the authorization token was valid.
   * @return the authentication and authorization data.
   */
  public GoogleData getGoogleData() {
    GoogleData googleData = new GoogleData();

    // Set the authentication data.
    googleData.setIsLoggedIn(userService.isUserLoggedIn());
    String authenticationUrl = userService.isUserLoggedIn()
        ? userService.createLogoutURL(HOME_URL)
        : userService.createLoginURL(HOME_URL);
    googleData.setAuthenticationUrl(authenticationUrl);

    // Set the authorization data.
    googleData.setAuthorizationUrl(AuthorizationServlet.AUTHORIZATION_HANDLER);
    googleData.setAuthorizationErrorMessage(authService.getAuthServiceError());

    return googleData;
  }
View Full Code Here

   * @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;
  }
View Full Code Here

TOP

Related Classes of sample.data.GoogleData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.