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


Java OtherContent类代码示例

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


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

示例1: createPhoto

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
private void createPhoto(AlbumEntry albumEntry) throws Exception {
  PhotoEntry photo = new PhotoEntry();

  String title = getString("Title");
  photo.setTitle(new PlainTextConstruct(title));
  String description = getString("Description");
  photo.setDescription(new PlainTextConstruct(description));
  photo.setTimestamp(new Date());

  OtherContent content = new OtherContent();


  File file = null;
  while (file == null || !file.canRead()) {
    file = new File(getString("Photo location"));
  }
  content.setBytes(getBytes(file));
  content.setMimeType(new ContentType("image/jpeg"));
  photo.setContent(content);

  insert(albumEntry, photo);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:23,代码来源:PicasawebCommandLine.java

示例2: fillBean

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Sets properties on the JavaBean by extracting them from a GData
 * {@code OtherContent} description of the payload
 * @param content a GData {@code  OtherContent} representation of the payload
 * @param bean a JavaBean to set the properties on
 * @param id optional id of entity
 */
public void fillBean(OtherContent content, Object bean, String id)
    throws SAXException, IOException, ParserConfigurationException,
        IllegalArgumentException, IntrospectionException,
        IllegalAccessException, InvocationTargetException, ParseException {
  String xmlText = getXmlFromContent(content);
  xmlText = fixEscaping(xmlText);
  Map<String, Object> properties = xmlUtil.convertXmlToProperties(xmlText);
  if (properties == null) {
    properties = new HashMap<String, Object>();
  }
  if (id != null) {
    properties.put(ID, id);
    properties.put(NAME, id);
  }
  beanUtil.convertPropertiesToBean(properties, bean);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:24,代码来源:ContentUtil.java

示例3: Recipe

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Creates a recipe out of a GoogleBaseEntry.
 * 
 * @param entry an entry that represents a recipe
 */
public Recipe(GoogleBaseEntry entry) {
  id = extractIdFromUrl(entry.getId());
  title = entry.getTitle().getPlainText();
  url = entry.getHtmlLink().getHref();
  String description = null;
  if (entry.getContent() != null) {
    Content content = entry.getContent();
    if (content instanceof TextContent) {
      description = ((TextContent)content).getContent().getPlainText();
    } else if (content instanceof OtherContent) {
      description = ((OtherContent)content).getText();
    }
  }
  this.description = description;
  mainIngredient = new HashSet<String>(entry.getGoogleBaseAttributes().
      getTextAttributeValues(MAIN_INGREDIENT_ATTRIBUTE));
  cuisine = new HashSet<String>(entry.getGoogleBaseAttributes().
      getTextAttributeValues(CUISINE_ATTRIBUTE));
  cookingTime = entry.getGoogleBaseAttributes().
      getIntUnitAttribute(COOKING_TIME_ATTRIBUTE);
  postedOn = entry.getPublished();

  // if an entry has no author specified, will set it to empty string
  List<Person> authors = entry.getAuthors();
  postedBy = (authors.isEmpty() ? AUTHOR_UNKNOWN : authors.get(0).getName());
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:32,代码来源:Recipe.java

示例4: getKml

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * @return the content of the feature in KML format as an XmlBlob.
 */
public XmlBlob getKml() {
  Content content = getContent();
  if (null == content || !(content instanceof OtherContent)) {
    return null;
  }
  return ((OtherContent) getContent()).getXml();
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:11,代码来源:FeatureEntry.java

示例5: getEntryFromMap

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Returns a gdata entry object populated with contents generated from a
 * "typeless" map.
 * 
 * @param entryMap the "typeless" map to convert.
 * @return a populated gdata entry object.
 */
private FeedServerEntry getEntryFromMap(Map<String, Object> entryMap) {
  // XMLutil expects entries in map form of string -> object. For repeatable
  // elements
  // the object is really an "object[]" but for single elements its a
  // "String".
  // This loop prepares this very hacky map representation from the passed in
  // more sane
  // typed implementation.
  OtherContent content = contentUtil.createXmlContent(xmlUtil.convertPropertiesToXml(entryMap));
  FeedServerEntry entry = new FeedServerEntry(content);
  return entry;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:20,代码来源:TypelessFeedServerClient.java

示例6: createXmlContent

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Converts XML text to a GData {@code  OtherContent} description of the
 * payload
 * @param xmlSource XML source of the payload
 * @return A GData {@code OtherContent} representation of the payload
 */
public OtherContent createXmlContent(String xmlSource) {
  OtherContent xmlContent = new OtherContent();
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlSource);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(APPLICATION_XML);
  return xmlContent;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:15,代码来源:ContentUtil.java

示例7: FeedServerClientTestUtil

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Populates bean with static info to match XML. The XML and the bean should
 * be interchangable using utilities provided by FeedServerClient.
 */
public FeedServerClientTestUtil() {
  // Setup sample bean.
  sampleVehicleBean = new VehicleBean();
  sampleVehicleBean.setName(NAME);
  sampleVehicleBean.setOwner(OWNER);
  sampleVehicleBean.setPrice(PRICE);
  sampleVehicleBean.setPropertyName(PROPERTY_NAMES);
  sampleVehicleBean.setPropertyValue(PROPERTY_VALUES);

  // Setup sample map.
  sampleVehicleMap = new HashMap<String, Object>();
  sampleVehicleMap.put("name", NAME);
  sampleVehicleMap.put("owner", OWNER);
  sampleVehicleMap.put("price", PRICE);
  sampleVehicleMap.put("propertyName", PROPERTY_NAMES);
  sampleVehicleMap.put("propertyValue", PROPERTY_VALUES);

  // Create populated gdata entry.
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(ENTRY_XML);
  OtherContent xmlContent = new OtherContent();
  xmlContent.setXml(xmlBlob);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(ContentUtil.APPLICATION_XML);
  vehicleEntry = new FeedServerEntry();
  vehicleEntry.setXmlBlob(xmlBlob);
  vehicleEntry.setContent(xmlContent);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:33,代码来源:FeedServerClientTestUtil.java

示例8: setKml

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Sets the KML content of the feature as an XmlBlob.  Unless
 * overridden by setKmlDefault, the default namespace of the entry
 * is kml, so the KML placemarks don't need any namespace prefix.
 *
 * @param kml A string representing a KML placemark.
 */
public void setKml(XmlBlob kml) {
  OtherContent content = new OtherContent();
  content.setXml(kml);
  content.setMimeType(KML_CONTENT);
  setContent(content);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:14,代码来源:FeatureEntry.java

示例9: FeedServerEntry

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Creates entry from provided populated content.
 * 
 * @param content populated content.
 */
public FeedServerEntry(OtherContent content) {
  this.setContent(content);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:9,代码来源:FeedServerEntry.java

示例10: getXmlFromContent

import com.google.gdata.data.OtherContent; //导入依赖的package包/类
/**
 * Gets an XML description of the payload from a GData {@code  OtherContent}
 * @param content a GData {@code  OtherContent} representation of the payload
 * @return An XML string describing the payload
 */
public String getXmlFromContent(OtherContent content) {
  XmlBlob xmlBlob = content.getXml();
  return xmlBlob.getBlob();
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:10,代码来源:ContentUtil.java


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