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


Java OutOfLineContent類代碼示例

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


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

示例1: getOutOfLineContentElement

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
/**
 * Creates a new hAtom "entry-content entry-title" anchor, containing the 
 * given entry's out of line content link in the href attribute, and title as
 * its text.
 */
static XmlElement getOutOfLineContentElement(BaseContentEntry<?> entry) {
  checkNotNull(entry);
  XmlElement element = new XmlElement("a");
  element.setAttribute("class", "entry-content entry-title");
  String title = entry.getTitle().getPlainText();
  String href;
  if (getType(entry) == ATTACHMENT) {
    href = title;  
  } else if (getType(entry) == WEB_ATTACHMENT) {
    href = ((OutOfLineContent) entry.getContent()).getUri();
  } else {
    LOGGER.log(Level.WARNING, "Only attachments have out of line content!");
    href = "";
  }
  element.setAttribute("href", href);
  element.addText(title);
  return element;
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:24,代碼來源:RendererUtils.java

示例2: insertSite

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
/**
 * Adds a new site for the given user.
 *
 * @param myService authenticated WebmasterTools Service object
 * @param siteUrl URL of site to add to account
 * @return a SitesEntry with the newly-created site
 * @throws ServiceException if the service is unable to handle the request.
 * @throws IOException if there was an error communicating with the server.
 */
public static SitesEntry insertSite(WebmasterToolsService myService, 
    String siteUrl) throws IOException, ServiceException {
  SitesEntry entry = new SitesEntry();
  OutOfLineContent content = new OutOfLineContent();
  content.setUri(siteUrl);
  entry.setContent(content);
  System.out.println("Site: " + siteUrl + " now being added.");
  return myService.insert(getSitesFeedUrl(), entry);
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:19,代碼來源:WebmasterToolsClient.java

示例3: downloadAttachment

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
/**
 * Downloads an attachment.
 *
 * @param entry The attachment (entry) to download.
 * @param entryId The content entry id of the attachment (e.g. 1234567890)
 * @throws ServiceException
 * @throws IOException
 */
public void downloadAttachment(String entryId, String directory)
    throws IOException, ServiceException {
  AttachmentEntry attachment = service.getEntry(
      new URL(getContentFeedUrl() + entryId), AttachmentEntry.class);
  String url = ((OutOfLineContent) attachment.getContent()).getUri();
  ///*MediaSource mediaSource = service.getMedia((MediaContent) entry.getContent());*/
  downloadFile(url, directory + attachment.getTitle().getPlainText());
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:17,代碼來源:SitesHelper.java

示例4: getWorksheetFeedUrlString

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
/**
 * Gets the URL for this spreadseet's worksheets feed as a string.
 *
 * <p>This checks for version compatibility also.
 *
 * and call that from here, just like in WorksheetEntry.
 *
 * @return a string representing the URL for the worksheets feed
 */
private String getWorksheetFeedUrlString() {
  Version spreadsheetVersion = state.service.getProtocolVersion();

  if (spreadsheetVersion.isCompatible(SpreadsheetService.Versions.V1)) {
    Link feedLink = this.getLink(Namespaces.WORKSHEETS_LINK_REL,
                                 Link.Type.ATOM);
    return feedLink.getHref();
  } else { // must be SpreadsheetService.Versions.V2; only 2 versions for now
    return ((OutOfLineContent)(this.getContent())).getUri();
  }
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:21,代碼來源:SpreadsheetEntry.java

示例5: getTitleElement

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
/**
 * Creates a new hAtom "entry-title" element for the given entry.
 */
static XmlElement getTitleElement(BaseContentEntry<?> entry) {
  checkNotNull(entry);
  String title = entry.getTitle().getPlainText();
  if (getType(entry) == ATTACHMENT) {
    return getHyperLink(title, title).setAttribute("class", "entry-title");
  } else if (getType(entry) == WEB_ATTACHMENT) {
    String href = ((OutOfLineContent) entry.getContent()).getUri();
    return getHyperLink(href, title).setAttribute("class", "entry-title");
  }
  return new XmlElement("span").setAttribute("class", "entry-title")
      .addText(title);
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:16,代碼來源:RendererUtils.java

示例6: importPage

import com.google.gdata.data.OutOfLineContent; //導入依賴的package包/類
@Override
public BasePageEntry<?> importPage(File directory, boolean importRevisions, 
    List<BasePageEntry<?>> ancestors, URL feedUrl, URL siteUrl, 
    SitesService sitesService) {
  checkNotNull(directory);
  File file = new File(directory, "index.html");
  if (!file.isFile()) {
    LOGGER.log(Level.WARNING, "No valid file in directory: " + directory);
    return null;
  }
  List<BaseContentEntry<?>> entries = pageParser.parsePage(file);
  BasePageEntry<?> page = getFirstPageEntry(entries);
  if (page == null) {
    LOGGER.log(Level.WARNING, "No valid page entry!");
    return null;
  }
  
  page.setPageName(new PageName(directory.getName()));
  linkConverter.convertLinks(page, ancestors, siteUrl, false);
  if (!ancestors.isEmpty()) {
    EntryUtils.setParent(page, ancestors.get(ancestors.size() - 1));
  }
  BasePageEntry<?> returnedEntry = null;
  if (importRevisions && new File(directory, "_revisions").isDirectory()) {
    returnedEntry = revisionsImporter.importRevisions(
        directory, ancestors, feedUrl, siteUrl, sitesService);
  }
  if (returnedEntry == null) {
    returnedEntry = (BasePageEntry<?>) entryUploader.uploadEntry(
        page, ancestors, feedUrl, sitesService);
  } else {
    returnedEntry = (BasePageEntry<?>) entryUpdater.updateEntry(
        returnedEntry, page, sitesService);
  }
  
  List<BasePageEntry<?>> newAncestors = Lists.newLinkedList(ancestors);
  newAncestors.add(returnedEntry);
  for (BaseContentEntry<?> child : getNonPageEntries(entries)) {
    if (getType(child) == ATTACHMENT) {
      if (child.getContent() != null) {
        String src = ((OutOfLineContent) child.getContent()).getUri();
        File attachmentFile = new File(directory, src);
        MediaSource mediaSource = new MediaFileSource(attachmentFile, 
            "application/octet-stream");
        child.setContent((Content) null);
        child.setMediaSource(mediaSource);
      } else {
        System.out.println(child.getTitle().getPlainText());
      }
    }
    EntryUtils.setParent(child, returnedEntry);
    entryUploader.uploadEntry(child, newAncestors, feedUrl, sitesService);
  }
  return returnedEntry;
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:56,代碼來源:PageImporterImpl.java


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