Package com.google.gdata.data

Examples of com.google.gdata.data.PlainTextConstruct


        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


        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");
View Full Code Here

        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);
View Full Code Here

                    // Create the feed
                    feed = new com.google.gdata.data.Feed();

                    // Set the feed title
                    if (title != null) {
                        feed.setTitle(new PlainTextConstruct(title));
                    } else {
                        feed.setTitle(new PlainTextConstruct("Feed title"));
                    }

                    // Add entries to the feed
                    ArrayList<com.google.gdata.data.Entry> entries = new ArrayList<com.google.gdata.data.Entry>();
                    for (Entry<Object, Object> entry : collection) {
View Full Code Here

            com.google.gdata.data.Entry feedEntry = new com.google.gdata.data.Entry();
            if (key != null) {
                feedEntry.setId(key.toString());
            }
            feedEntry.setTitle(new PlainTextConstruct(item.getTitle()));
            feedEntry.setContent(new PlainTextConstruct(item.getContents()));

            String href = item.getLink();
            if (href == null && key != null) {
                href = key.toString();
            }

            if (href != null) {
                feedEntry.addHtmlLink(href, "", "");
            }
            String related = item.getRelated();
            if (related != null) {
                feedEntry.addHtmlLink(related, "", "related");
            }
            String alternate = item.getAlternate();
            if (alternate != null) {
                feedEntry.addHtmlLink(alternate, "", "alternate");
            }

            Date date = item.getDate();
            if (date != null) {
                DateTime datetime = new DateTime(date);
                feedEntry.setUpdated(datetime);
            }
            return feedEntry;

        } else if (data != null) {

            com.google.gdata.data.Entry feedEntry = new com.google.gdata.data.Entry();
            feedEntry.setId(key.toString());
            feedEntry.setTitle(new PlainTextConstruct("item"));

            // Convert the item to XML
            String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();

            // Might be wrong because the example uses XML datatype, I am using
            // plainText here
            feedEntry.setContent(new PlainTextConstruct(value));

            feedEntry.addHtmlLink(key.toString(), "", "");
            return feedEntry;

        } else {
View Full Code Here

      album.setAccess(GphotoAccess.Value.PRIVATE);
    } else {
      album.setAccess(GphotoAccess.Value.PUBLIC);
    }

    album.setTitle(new PlainTextConstruct(title));
    album.setDescription(new PlainTextConstruct(description));

    try {
      AlbumEntry albumEntry = service.insert(new URL(USER_FEED_URL), album);
      String albumUrl = albumEntry.getFeedLink().getHref();
      LOG.info(String.format("Created %s Picasa album: %s",
View Full Code Here

    return null;
  }

  public String createPlaylist(String title, String description) throws ServiceException {
    PlaylistLinkEntry newEntry = new PlaylistLinkEntry();
    newEntry.setTitle(new PlainTextConstruct(title));
    newEntry.setSummary(new PlainTextConstruct(description));

    try {
      PlaylistLinkEntry createdEntry;
     
      try {
        createdEntry = service.insert(new URL(PLAYLIST_FEED_URL), newEntry);
      } catch(InvalidEntryException e) {
        // If the first attempt to create the playlist fails with this exception,
        // it's most likely due to a duplicate playlist title.
        // So let's make the title unique and try again.
        String newTitle = title + " - " + DateTime.now().toUiString();
        log.info(String.format("Playlist with title '%s' already exists. Attempting to create " +
            "playlist with title '%s'.", title, newTitle));

        newEntry.setTitle(new PlainTextConstruct(newTitle));
       
        createdEntry = service.insert(new URL(PLAYLIST_FEED_URL), newEntry);
      }
     
      String id = createdEntry.getPlaylistId();
View Full Code Here

      throws IOException, ServiceException  {
    String fileMimeType = mediaTypes.getContentType(file);
   
    AttachmentEntry newAttachment = new AttachmentEntry();
    newAttachment.setMediaSource(new MediaFileSource(file, fileMimeType));
    newAttachment.setTitle(new PlainTextConstruct(file.getName()));
    newAttachment.setSummary(new PlainTextConstruct(description));
    newAttachment.addLink(SitesLink.Rel.PARENT, Link.Type.ATOM, parentLink);
   
    return service.insert(new URL(getContentFeedUrl()), newAttachment);
  }
View Full Code Here

    return insertedAlbumEntry;
  }
 
  public AlbumEntry createAlbum(String blogTitle) {
    AlbumEntry myAlbum = new AlbumEntry();
    myAlbum.setTitle(new PlainTextConstruct(blogTitle));
    AlbumEntry insertedAlbumEntry = this.insert(myAlbum);
    return insertedAlbumEntry;
  }
View Full Code Here

      String blogID,
      String title,
      String content) {
    // Create the entry to insert
    Entry myEntry = new Entry();
    myEntry.setTitle(new PlainTextConstruct(title));
    myEntry.setContent(new PlainTextConstruct(content));
   
    // Ask the service to insert the new entry
    URL postUrl = null;
    try {
      postUrl = new URL("http://www.blogger.com/feeds/" + blogID + "/posts/default");
View Full Code Here

TOP

Related Classes of com.google.gdata.data.PlainTextConstruct

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.