Package com.google.gdata.client.docs

Examples of com.google.gdata.client.docs.DocsService


  }

  public static void deleteSpreadsheet(String authSubToken, SpreadsheetEntry testSpreadsheet) {
    try {
      final String createdEntiry = testSpreadsheet.getTitle().getPlainText();
      DocsService client = new DocsService("yourCo-yourAppName-v1");
      client.setAuthSubToken(authSubToken);
      URL feedUri = new URL("https://docs.google.com/feeds/default/private/full/");
      DocumentListFeed feed = client.getFeed(feedUri, DocumentListFeed.class);
      for (DocumentListEntry entry : feed.getEntries()) {
        final String searchedEntiryTitle = entry.getTitle().getPlainText();
        if (createdEntiry.equals(searchedEntiryTitle)) {
          entry.delete();
          System.out.println("deleted file:" + searchedEntiryTitle);
View Full Code Here


  }

  void deleteSpreadsheet(SpreadsheetEntry testSpreadsheet) {
    try {
      final String createdEntiry = testSpreadsheet.getTitle().getPlainText();
      DocsService client = new DocsService("yourCo-yourAppName-v1");
      client.setAuthSubToken(authSubToken);
      URL feedUri = new URL("https://docs.google.com/feeds/default/private/full/");
      DocumentListFeed feed = client.getFeed(feedUri, DocumentListFeed.class);
      for (DocumentListEntry entry : feed.getEntries()) {
        final String searchedEntiryTitle = entry.getTitle().getPlainText();
        if (createdEntiry.equals(searchedEntiryTitle)) {
          entry.delete();
          System.out.println("deleted file:" + searchedEntiryTitle);
View Full Code Here

        }
       
  public void login(Creditionals creditionals) throws AuthenticationException {
            if (!creditionals.equals(this.creditionals) || !isLogedIn) {
                Configuration.log("Try to create DocsService");
    service = new DocsService(APP_NAME);
                spreadsheetService = new SpreadsheetService(APP_NAME);
                Configuration.log("DocsService created");
                try {
                    Configuration.log("Try to login");
                    service.setUserCredentials(creditionals.getUserName(),creditionals.getPassword());
View Full Code Here

    private DocsService service;

    protected GoogleDocsService(String userToken) throws AuthenticationException {
        super();
        service = new DocsService(applicationName);
        service.setUserToken(userToken);
    }
View Full Code Here

        service.setUserToken(userToken);
    }

    protected GoogleDocsService(String username, String password) throws AuthenticationException {
        super();
        service = new DocsService(applicationName);
        service.setUserCredentials(username, password);
    }
View Full Code Here

  private DocsService documentsService;
  private SpreadsheetService spreadsheetService;
  private PicasawebService photoService;

  public GDataDocumentsProxy() {
    this.documentsService = new DocsService("Avicena-v1");
    this.photoService = new PicasawebService("Avicena-v1");
    this.spreadsheetService = new SpreadsheetService("Avicena-v1");
  }
View Full Code Here

  public void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String sessionToken = null;

    // Initialize a client to talk to Google Data API services.
    DocsService client = new DocsService("google-feedfetcher-v1");

    // If a user is currently signed in to the application, attempt to retrieve
    // a previously stored session token associated with that account from App
    // Engine's datastore.
    if (userService.isUserLoggedIn()) {
      User user = userService.getCurrentUser();
      sessionToken = TokenStore.getToken(user.getEmail());
    }

    // If sessionToken is null, check for a single-use token in the query
    // string; if found, exchange this token for a session token using the
    // client library.
    if (sessionToken == null) {
      try {
        // Find the AuthSub token and upgrade it to a session token.
        String authToken = AuthSubUtil.getTokenFromReply(
            request.getQueryString());

        // Upgrade the single-use token to a multi-use session token.
        sessionToken = AuthSubUtil.exchangeForSessionToken(authToken, null);
      } catch (AuthenticationException e) {
        //...
      } catch (GeneralSecurityException e) {
        //...
      } catch (NullPointerException e) {
        // Ignore
      }
    }

    if (sessionToken != null) {
      // If there is a current user, store the token in the datastore and
      // associate it with the current user's email address.
      if (userService.isUserLoggedIn()) {
        User user = userService.getCurrentUser();
        TokenStore.addToken(user.getEmail(), sessionToken);
      }

      // Set the session token as a field of the Service object. Since a new
      // Service object is created with each get call, we don't need to
      // worry about the anonymous token being used by other users.
      client.setAuthSubToken(sessionToken);

      // Fetch and write feed data to response
      String feedUrl = request.getParameter("feedUrl");
      if (feedUrl == null) {
        feedUrl = "https://docs.google.com/feeds/default/private/full";
View Full Code Here

        }
        return factory;
    }
   
    static public DocsService getDocsService(String token) {
        DocsService service = new DocsService(SERVICE_APP_NAME);
        if (token != null) {
            service.setAuthSubToken(token);
        }
        return service;
    }
View Full Code Here

   
    static private String uploadSpreadsheet(
            final Project project, final Engine engine, final Properties params,
            String token, String name, List<Exception> exceptions) {
       
        DocsService docsService = GDataExtension.getDocsService(token);
        final SpreadsheetService spreadsheetService = GDataExtension.getSpreadsheetService(token);
       
        try {
            SpreadsheetEntry spreadsheetEntry = new SpreadsheetEntry();
            spreadsheetEntry.setTitle(new PlainTextConstruct(name));
           
            final SpreadsheetEntry spreadsheetEntry2 = docsService.insert(
                new URL("https://docs.google.com/feeds/default/private/full/"), spreadsheetEntry);
           
            int[] size = CustomizableTabularExporterUtilities.countColumnsRows(
                    project, engine, params);
           
View Full Code Here

  public GbSpreadsheetService(String authSubToken) {
    this.authSubToken = authSubToken;
    ss = new SpreadsheetService("dstools");
    ss.setAuthSubToken(this.authSubToken);
    cs = new DocsService("dstools");
    cs.setAuthSubToken(this.authSubToken);
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.client.docs.DocsService

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.