当前位置: 首页>>代码示例>>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;未经允许,请勿转载。