Search in sources :

Example 1 with Person

use of com.google.gdata.data.Person in project OpenRefine by OpenRefine.

the class GDataImportingController method listSpreadsheets.

private void listSpreadsheets(DocsService service, JSONWriter writer) throws IOException, ServiceException, JSONException {
    URL metafeedUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
    SpreadsheetFeed feed = service.getFeed(metafeedUrl, SpreadsheetFeed.class);
    for (SpreadsheetEntry entry : feed.getEntries()) {
        writer.object();
        writer.key("docId");
        writer.value(entry.getId());
        writer.key("docLink");
        writer.value(entry.getHtmlLink().getHref());
        writer.key("docSelfLink");
        writer.value(entry.getSelfLink().getHref());
        writer.key("title");
        writer.value(entry.getTitle().getPlainText());
        writer.key("type");
        writer.value("spreadsheet");
        DateTime updated = entry.getUpdated();
        if (updated != null) {
            writer.key("updated");
            writer.value(updated.toStringRfc822());
        }
        writer.key("authors");
        writer.array();
        for (Person person : entry.getAuthors()) {
            writer.value(person.getName());
        }
        writer.endArray();
        writer.endObject();
    }
}
Also used : SpreadsheetFeed(com.google.gdata.data.spreadsheet.SpreadsheetFeed) SpreadsheetEntry(com.google.gdata.data.spreadsheet.SpreadsheetEntry) Person(com.google.gdata.data.Person) URL(java.net.URL) DateTime(com.google.gdata.data.DateTime)

Aggregations

DateTime (com.google.gdata.data.DateTime)1 Person (com.google.gdata.data.Person)1 SpreadsheetEntry (com.google.gdata.data.spreadsheet.SpreadsheetEntry)1 SpreadsheetFeed (com.google.gdata.data.spreadsheet.SpreadsheetFeed)1 URL (java.net.URL)1