Package com.google.gdata.data.docs

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


      throw new DocumentListException("null title or type");
    }

    DocumentListEntry newEntry = null;
    if (type.equals("document")) {
      newEntry = new DocumentEntry();
    } else if (type.equals("presentation")) {
      newEntry = new PresentationEntry();
    } else if (type.equals("spreadsheet")) {
      newEntry = new SpreadsheetEntry();
    } else if (type.equals("folder")) {
View Full Code Here


    File file = new File(filepath);
    String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName())
    .getMimeType();

    DocumentEntry newDocument = new DocumentEntry();
    newDocument.setFile(file, mimeType);
    newDocument.setTitle(new PlainTextConstruct(title));

    return service
    .insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED), newDocument);
  }
View Full Code Here

   * @throws DocumentServiceException
   */
  @Override
  public DocumentServiceEntry createDocument(String title, String contents) throws DocumentServiceException {
    DocsService svc = getDocsService();
    DocumentEntry newDocument = new DocumentEntry();
    newDocument.setTitle(new PlainTextConstruct(title));
    DocumentEntry entry;
    try {
      MediaByteArraySource source = new MediaByteArraySource(contents.getBytes("UTF8"), "text/plain");
      newDocument.setMediaSource(source);
      entry = svc.insert(new URL(DOCS_SCOPE + "default/private/full"), newDocument);
    } catch (Exception e) {
View Full Code Here

            return documentFile;
        }

        private UploadUpdateStatus uploadFile(final String path, final String documentTitle, final String mimeType, final boolean convert) throws IOException, MalformedURLException, ServiceException {
            if (convert) {
              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 {
View Full Code Here

  }

  public DocumentListEntry createDocumentFile(String type, String title, String folder) throws IOException, ServiceException {
    DocumentListEntry newEntry = null;
    if (type.equals("document")) {
      newEntry = new DocumentEntry();
    } else if (type.equals("presentation")) {
      newEntry = new PresentationEntry();
    } else if (type.equals("spreadsheet")) {
      newEntry = new com.google.gdata.data.docs.SpreadsheetEntry();
    }
View Full Code Here

      throw new DocumentListException("null title or type");
    }

    DocumentListEntry newEntry = null;
    if (type.equals("document")) {
      newEntry = new DocumentEntry();
    } else if (type.equals("presentation")) {
      newEntry = new PresentationEntry();
    } else if (type.equals("spreadsheet")) {
      newEntry = new SpreadsheetEntry();
    } else if (type.equals("folder")) {
View Full Code Here

    File file = new File(filepath);
    String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName())
        .getMimeType();

    DocumentEntry newDocument = new DocumentEntry();
    newDocument.setFile(file, mimeType);
    newDocument.setTitle(new PlainTextConstruct(title));

    return service
        .insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED), newDocument);
  }
View Full Code Here

  }
 
  public DocumentListEntry createNewDocument(String title, String content) throws ServiceException {
    try {
      URL feedUrl = new URL("https://docs.google.com/feeds/default/private/full/");
      DocumentListEntry newEntry = new DocumentEntry();
      newEntry.setTitle(new PlainTextConstruct(title));
      newEntry = client().insert(feedUrl, newEntry);
     
      newEntry.setMediaSource(new MediaByteArraySource(content.getBytes(), "text/html"));
      newEntry = newEntry.updateMedia(true);
      return newEntry;
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
View Full Code Here

      throw new DocumentListException("null title or type");
    }

    DocumentListEntry newEntry = null;
    if (type.equals("document")) {
      newEntry = new DocumentEntry();
    } else if (type.equals("presentation")) {
      newEntry = new PresentationEntry();
    } else if (type.equals("spreadsheet")) {
      newEntry = new SpreadsheetEntry();
    } else if (type.equals("folder")) {
View Full Code Here

      throw new DocumentListException("null passed in for required parameters");
    }

    File file = new File(filepath);

    DocumentEntry newDocument = new DocumentEntry();
   
    newDocument.setFile(file, getMimeType(file));
   
    newDocument.setTitle(new PlainTextConstruct(title));
    newDocument.setHidden(hidden);

    String url = URL_DEFAULT + URL_DOCLIST_FEED;
    if (!convert) {
      url += "?convert=false";
    }
View Full Code Here

TOP

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

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.