Package com.google.gdata.data.docs

Examples of com.google.gdata.data.docs.DocumentListEntry


  {
    DocsOpenDocDialog dialog = new DocsOpenDocDialog(window.getShell(), false);
   
    if (dialog.open() == Window.OK && dialog.getResultAsDocumentListEntry() != null)
    {
      DocumentListEntry document = dialog.getResultAsDocumentListEntry();
     
      DocsEditorInput editorInput = new DocsEditorInput(document);
     
      try
      {
        window.getActivePage().openEditor(editorInput, DocumentEditor.EDITOR_ID, true, IWorkbenchPage.MATCH_INPUT);
      }
      catch (PartInitException exception)
      {
        ErrorDialog.openError(window.getShell(),
          "Error Opening Document",
          "Unable to open " + document.getTitle().getPlainText() + ".\n"
            + exception.toString(),
          new Status(IStatus.ERROR, DocsPlugin.PLUGIN_ID, exception.getMessage(), exception));
       
        DocsPlugin.log(exception);
      }     
View Full Code Here


  {
    DocsEditorInput editorInput = (DocsEditorInput)getEditorInput();
   
    if (editorInput.getDocument() != null)
    {
      DocumentListEntry document = editorInput.getDocument();
     
      String href = document.getDocumentLink().getHref();
     
      if (!webBrowser.isDisposed())
        webBrowser.setURL(href);
    }
    else
View Full Code Here

    return new WorkbenchAdapter() {
      public ImageDescriptor getImageDescriptor(Object object) {
        return DocsPlugin.getImageDescriptor("icons/file_obj.gif");
      }
      public String getLabel(Object object) {
        DocumentListEntry document = (DocumentListEntry)object;
       
        return document.getTitle().getPlainText();
      }
    };
  }
View Full Code Here

        else if (columnIndex == 2)
          return spreadsheet.getUpdated().toUiString();
      }
      else if (element instanceof DocumentListEntry)
      {
        DocumentListEntry entry = (DocumentListEntry)element;
       
        if (columnIndex == 0)
          return entry.getTitle().getPlainText();
        else if (columnIndex == 1)
          return ((Person)entry.getAuthors().get(0)).getEmail();
        else if (columnIndex == 2)
          return entry.getUpdated().toUiString();
      }
     
      return element.toString();
    }
View Full Code Here

              DocumentEntry newDocument = new DocumentEntry();
              File documentFile = getFileForPath(path);
              newDocument.setFile(documentFile,mimeType);
              newDocument.setTitle(new PlainTextConstruct(documentTitle));
              URL documentListFeedUrl = new URL(DOCS_FEED);
              DocumentListEntry uploaded = service.insert(documentListFeedUrl,
                  newDocument);
              return new UploadUpdateStatus(true, uploaded.getDocumentLink().getHref());
            } else {
                performResumableUpload(path,"https://docs.google.com/feeds/upload/create-session/default/private/full?convert=false", mimeType, documentTitle);
//                performResumableUpload(path,"http://docs.google.com/feeds/upload/create-session/default/private/full?convert=false", mimeType, documentTitle);
                return new UploadUpdateStatus(true, null);
            }
View Full Code Here

     * @throws ServiceException in case of Google Data API errors
     */
    protected DocumentListEntry getDefaultTargetFolder() throws IOException, ServiceException {
        StopWatch watch = new StopWatch();
        watch.start();
        DocumentListEntry folder = null;
        DocumentListFeed feed = service.getFeed(new URL("https://docs.google.com/"
                + "feeds/default/private/full/folder%3Aroot/contents/-/folder?title=" + defaultTargetFolderName),
                DocumentListFeed.class);
        List<DocumentListEntry> entries = feed.getEntries();

        if (!entries.isEmpty()) {
            folder = entries.get(0);
        } else {
            DocumentListEntry newEntry = new FolderEntry();
            newEntry.setTitle(new PlainTextConstruct(defaultTargetFolderName));
            folder = service.insert(new URL("https://docs.google.com/feeds/default/private/full/"), newEntry);
        }

        watch.stop();
        logger.info("Getting target folder took " + watch.getTime() + " ms");
View Full Code Here

     */
    protected DocumentListEntry upload(File file, URL targetFolderUri) throws IOException, ServiceException {
        StopWatch watch = new StopWatch();
        watch.start();
        logger.info("Uploading content for: " + file.getName());
        DocumentListEntry newDocument = new DocumentListEntry();
        String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
        newDocument.setFile(file, mimeType);
        newDocument.setTitle(new PlainTextConstruct(file.getName()));

        DocumentListEntry uploadedFile = service.insert(targetFolderUri, newDocument);

        watch.stop();
        logger.info("File " + file + " uploaded in " + watch.getTime() + " ms");

        return uploadedFile;
View Full Code Here

            URL targetFolderUri) throws IOException, ServiceException {
        StopWatch watch = new StopWatch();
        watch.start();
        logger.info("Uploading content for: " + documentTitle);

        DocumentListEntry newDocument = new DocumentListEntry();
        newDocument.setTitle(new PlainTextConstruct(documentTitle));

        MediaContent content = new MediaContent();
        content.setMediaSource(new MediaStreamSource(fileStream, mimeType));
        content.setMimeType(new ContentType(mimeType));
        newDocument.setContent(content);

        DocumentListEntry uploadedFile = service.insert(targetFolderUri, newDocument);

        watch.stop();
        logger.info("File " + documentTitle + " uploaded in " + watch.getTime() + " ms");

        return uploadedFile;
View Full Code Here

                GoogleDocsService docsService = getDocsService(request, response);
                if (docsService == null) {
                    return null;
                }

                DocumentListEntry document = uploadFile(node, docsService, request, response);

                doAction(document, docsService, node, session, request, response);
            } else {
                response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Path should correspond to a file node");
            }
View Full Code Here

        this.docsServiceFactory = docsServiceFactory;
    }

    private DocumentListEntry uploadFile(JCRNodeWrapper node, GoogleDocsService docsService,
            HttpServletRequest request, HttpServletResponse response) throws IOException, ServiceException {
        DocumentListEntry document = null;
        InputStream is = null;
        String fileName = node.getName();
        try {
            is = node.getFileContent().downloadFile();
            document = docsService.upload(is, fileName, node.getFileContent().getContentType());
View Full Code Here

TOP

Related Classes of com.google.gdata.data.docs.DocumentListEntry

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.