当前位置: 首页>>代码示例>>Java>>正文


Java BaseContentEntry.setContent方法代码示例

本文整理汇总了Java中com.google.gdata.data.sites.BaseContentEntry.setContent方法的典型用法代码示例。如果您正苦于以下问题:Java BaseContentEntry.setContent方法的具体用法?Java BaseContentEntry.setContent怎么用?Java BaseContentEntry.setContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gdata.data.sites.BaseContentEntry的用法示例。


在下文中一共展示了BaseContentEntry.setContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setContent

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
/**
 * Sets the content of the given entry to the given String.
 */
public static void setContent(BaseContentEntry<?> entry, String content) {
  XmlBlob blob = new XmlBlob();
  blob.setBlob(content);
  TextConstruct textConstruct = new XhtmlTextConstruct(blob);
  entry.setContent(textConstruct);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:10,代码来源:EntryUtils.java

示例2: setContentBlob

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
private void setContentBlob(BaseContentEntry<?> entry) {
  XmlBlob xml = new XmlBlob();
  xml.setBlob(String.format(
      "content for %s", entry.getCategories().iterator().next().getLabel()));
  entry.setContent(new XhtmlTextConstruct(xml));
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:7,代码来源:SitesHelper.java

示例3: importPage

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的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

示例4: parseElement

import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
/**
 * Parses the given element, populating the given entry with its data.
 */
private void parseElement(Element element, BaseContentEntry<?> entry) {
  NodeList nodeList = element.getChildNodes();
  for (int i = 0; i < nodeList.getLength(); i++) {
    Node node = nodeList.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      Element child = (Element) node;
      if (!hasClass(child, "hentry") && !child.getTagName().equals("q")
          && !child.getTagName().equals("blockquote")) {
        boolean parseDeeper = true;
        if (hasClass(child, "entry-title")) {
          entry.setTitle(titleParser.parseTitle(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-content")) {
          entry.setContent(contentParser.parseContent(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "updated")) {
          entry.setUpdated(updatedParser.parseUpdated(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "vcard")) {
          entry.getAuthors().add(authorParser.parseAuthor(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-summary")) {
          entry.setSummary(summaryParser.parseSummary(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:data")) {
          if (getType(entry) == LIST_PAGE) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListPageEntry) (BaseContentEntry) entry).setData(dataParser.parseData(child));
          }
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:field")) {
          if (getType(entry) == LIST_ITEM) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListItemEntry) (BaseContentEntry) entry).addField(fieldParser.parseField(child));
          }
          parseDeeper = false;
        }
        if (parseDeeper) {
          parseElement(child, entry);
        }
      }
    }
  }
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:56,代码来源:EntryParserImpl.java


注:本文中的com.google.gdata.data.sites.BaseContentEntry.setContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。