當前位置: 首頁>>代碼示例>>Java>>正文


Java DocumentQuery類代碼示例

本文整理匯總了Java中com.google.gdata.client.DocumentQuery的典型用法代碼示例。如果您正苦於以下問題:Java DocumentQuery類的具體用法?Java DocumentQuery怎麽用?Java DocumentQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DocumentQuery類屬於com.google.gdata.client包,在下文中一共展示了DocumentQuery類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDocumentEntries

import com.google.gdata.client.DocumentQuery; //導入依賴的package包/類
/**
 * Get a List of SpreadsheetEntry from one folder with exact title. (folder and title can be null).
 * @param service
 * @param title
 * @param folder_id
 * @return
 * @throws MalformedURLException
 * @throws IOException
 * @throws ServiceException
 */
public List<DocumentListEntry> getDocumentEntries(DocsService service, String title, String folder_id) throws MalformedURLException, IOException, ServiceException
{   
    URL url = new URL("https://docs.google.com/feeds/default/private/full/" + (folder_id == null ? "" : "folder%3A" + folder_id + "/contents"));
    DocumentQuery query = new DocumentQuery(url);
    
    if(title != null)
    {
        query.setTitleQuery(title);        
        query.setTitleExact(true);
    }
    
    DocumentListFeed feed = service.getFeed(query, DocumentListFeed.class);
    
    return feed.getEntries();
}
 
開發者ID:eduardoguzman,項目名稱:sisob-data-extractor,代碼行數:26,代碼來源:Utils.java

示例2: exportURL

import com.google.gdata.client.DocumentQuery; //導入依賴的package包/類
private String exportURL(String title) throws IOException, ServiceException, MalformedURLException {
    DocumentQuery query = documentQuery(title);
    List<DocumentListEntry> entries = service.getFeed(query, DocumentListFeed.class).getEntries();
    if (entries.isEmpty()) {
        throw new GoogleDocumentNotFound(title);
    }
    return ((MediaContent) entries.get(0).getContent()).getUri() + "&exportFormat=odt";
}
 
開發者ID:vactowb,項目名稱:jbehave-core,代碼行數:9,代碼來源:LoadOdtFromGoogle.java

示例3: documentQuery

import com.google.gdata.client.DocumentQuery; //導入依賴的package包/類
DocumentQuery documentQuery(String title) throws MalformedURLException {
    DocumentQuery query = new DocumentQuery(new URL(feedURI));
    query.setTitleQuery(title);
    query.setTitleExact(true);
    query.setMaxResults(1);
    return query;
}
 
開發者ID:vactowb,項目名稱:jbehave-core,代碼行數:8,代碼來源:LoadOdtFromGoogle.java

示例4: shouldGetResourceFromDocsService

import com.google.gdata.client.DocumentQuery; //導入依賴的package包/類
@Test
public void shouldGetResourceFromDocsService() throws IOException, ServiceException {
    DocsService service = mock(DocsService.class);
    DocumentListFeed feed = mock(DocumentListFeed.class);
    DocumentListEntry entry = mock(DocumentListEntry.class);
    MediaSource mediaSource = mock(MediaSource.class);
    InputStream inputStream = mock(InputStream.class);
    final MediaContent content = mock(MediaContent.class);
    final DocumentQuery query = mock(DocumentQuery.class);
    when(service.getFeed(query, DocumentListFeed.class)).thenReturn(feed);
    when(service.getMedia(content)).thenReturn(mediaSource);
    when(feed.getEntries()).thenReturn(asList(entry));
    when(entry.getContent()).thenReturn(content);
    when(content.getUri()).thenReturn("http://docs.google.com");
    when(mediaSource.getInputStream()).thenReturn(inputStream);

    LoadOdtFromGoogle storyLoader = new LoadOdtFromGoogle("user", "password", "https://docs.google.com/feeds/default/private/full/", service){

        @Override
        DocumentQuery documentQuery(String title) throws MalformedURLException {
            return query;
        }

        @Override
        protected MediaContent mediaContent(String url) {
            return content;
        }
        
    };
    InputStream resourceStream = storyLoader.resourceAsStream("a_story");
    MatcherAssert.assertThat(resourceStream, Matchers.equalTo(inputStream));
}
 
開發者ID:vactowb,項目名稱:jbehave-core,代碼行數:33,代碼來源:GoogleOdtLoaderBehaviour.java


注:本文中的com.google.gdata.client.DocumentQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。