Package com.google.gdata.data

Examples of com.google.gdata.data.PlainTextConstruct


   
    public Feed getFeed() {
        System.out.println(">>> ResourceCollectionImpl.get collection");
       
        Feed feed = new Feed();
        feed.setTitle(new PlainTextConstruct("Feedtitle(LocalHostServlet)"));
        feed.setSubtitle(new PlainTextConstruct("Subtitle: This is a sample feed"));
        feed.setUpdated(DateTime.now());
        // FIXME: The following two lines of code need to be fixed
        // feed.addHtmlLink("", "", "");
        // feed.addHtmlLink("", "languageType", "self");
        ArrayList<Entry> entryList = new ArrayList<Entry>();
View Full Code Here


    @Test
    public void testClientPost() throws Exception {
        String blogEntryTitle = "titleByGoogleCalendarTestcase";
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
        newEntry.setContent(new PlainTextConstruct("contentByGoogleCalendarTestCase"));
        Entry postedEntry = testService.clientPost(newEntry);       
        assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
    }
View Full Code Here

        //because Google blogger service has limitation on new posts allowed everyday/every hour?
       
        System.out.println("testClientDelete");
        //We create a new post, and then delete it
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("calendarEntryShouldNotApear"));
        newEntry.setContent(new PlainTextConstruct("calendarByBloggerShouldNotAppear"));
        Entry postedEntry = testService.clientPost(newEntry);
        Thread.sleep(300);
       
        System.out.println("ID: " + postedEntry.getId());
       
View Full Code Here

    }

    @Test
    public void testClientPost() throws Exception {
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("NewEntry title by Post"));
        newEntry.setContent(new PlainTextConstruct("NewEntry Content by Post"));       
        Entry postedEntry = testService.clientPost(newEntry);       
        assertEquals("NewEntry title by Post", postedEntry.getTitle().getPlainText());
    }
View Full Code Here

        // We first create a new entry, then delete it

        // Post a new entry
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("NewEntry title to be deleted"));
        newEntry.setContent(new PlainTextConstruct("NewEntry Content to be delted"));
        Entry confirmedNewEntry = testService.clientPost(newEntry);

        Thread.sleep(300);
      
        Feed feed00 = testService.clientGetFeed();
View Full Code Here

        // Put a new entry to the provider
        System.out.println(">>> put id=" + entryID + " title=" + newTitle);
        Entry entry = resourceCollection.get(entryID);
       
        //change the title of this entry
        entry.setTitle(new PlainTextConstruct(newTitle));
        resourceCollection.put(entryID, entry);
        System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle());
        System.out.println("\n");
    }
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

      // publishing new event
      entry = new CalendarEventEntry();  
    }

    // set data on event
    entry.setTitle(new PlainTextConstruct(event.getTitle()));
    entry.setContent(new PlainTextConstruct(event.getDescription()));
    When when = new When();
    DateTime startDateTime = new DateTime(event.getStartDate());
    startDateTime.setDateOnly(true);

    // we must add 1 day to the event as the end-date is exclusive
View Full Code Here

    }

    // prepare an 'events and activities' item for publishing
    GoogleBaseAttributesExtension gbaseAttributes =
      entry.getGoogleBaseAttributes();
    entry.setTitle(new PlainTextConstruct(event.getTitle()));
    entry.setContent(new PlainTextConstruct(event.getDescription()));
    gbaseAttributes.setItemType("events and activities");

    // this sample currently only demonstrates publishing all-day events
    // an event in Google Base must have a start-time and end-time, so
    // this simulates that by adding 1 day to the end-date specified, if the
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.