Package com.google.gdata.wireformats

Examples of com.google.gdata.wireformats.XmlWireFormatProperties


    registry.build(Entry.KEY, RSS).setName(ITEM);

    registry.build(Entry.KEY, Entry.ETAG, RSS)
        .setVisible(false);

    XmlWireFormatProperties properties = new XmlWireFormatProperties();
    properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
      @Override
      protected List<Attribute> getAttributes(Element e,
          ElementMetadata<?, ?> metadata) {
        List<Attribute> attrs = super.getAttributes(e, metadata);
        if (attrs == null) {
          attrs = Lists.newArrayListWithExpectedSize(1);
        }
        attrs.add(new Attribute("isPermaLink", "false"));
        return attrs;
      }
    });
    registry.build(Entry.KEY, Entry.ID, RSS)
        .setName(GUID)
        .setProperties(properties);

    registry.build(Entry.KEY, Entry.TITLE, RSS)
        .setName(TITLE);

    registry.build(Entry.KEY, Entry.PUBLISHED, RSS)
        .setName(PUB_DATE)
        .setVirtualValue(new VirtualValue() {
          public Object generate(Element element,
              ElementMetadata<?, ?> metadata) {
            DateTime date = element.getTextValue(Entry.PUBLISHED);
            return date == null ? "" : date.toStringRfc822();
          }

          public void parse(Element element, ElementMetadata<?, ?> metadata,
              Object value) throws ParseException {
            DateTime parsed = DateTime.parseRfc822(value.toString());
            element.setTextValue(parsed);
          }
        });

    XmlWireFormatProperties personProperties = new XmlWireFormatProperties();
    personProperties.setElementGenerator(
        new XmlGenerator.XmlElementGenerator() {
      @Override
      public boolean startElement(XmlWriter xw, Element parent, Element e,
          ElementMetadata<?, ?> metadata) throws IOException {
        if (!(e instanceof Person)) {
View Full Code Here


    registry.build(Entry.KEY, Entry.RIGHTS, RSS).setVisible(false);
  }

  private static void addEntryOutOfLineContentTransforms(
      MetadataRegistry registry) {
    XmlWireFormatProperties properties = new XmlWireFormatProperties();
    properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
      @Override
      public boolean startElement(XmlWriter xw, Element parent, Element e,
          ElementMetadata<?, ?> metadata) throws IOException {
        if (!(e instanceof OutOfLineContent)) {
          return super.startElement(xw, parent, e, metadata);
View Full Code Here

  private static void addFeedTransforms(final MetadataRegistry registry) {
    registry.build(Feed.KEY, Entry.ETAG, RSS)
        .setVisible(false);

    XmlWireFormatProperties properties = new XmlWireFormatProperties();
    properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
      @Override
      public boolean startElement(XmlWriter xw, Element parent, Element e,
          ElementMetadata<?, ?> metadata) throws IOException {

        Collection<XmlNamespace> namespaces =
View Full Code Here

          }
        });
  }

  private static void addLinkTransforms(MetadataRegistry registry) {
    XmlWireFormatProperties properties = new XmlWireFormatProperties();
    properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
      @Override
      public boolean startElement(XmlWriter xw, Element parent, Element e,
          ElementMetadata<?, ?> metadata) throws IOException {
        if (!(e instanceof Link)) {
          return super.startElement(xw, parent, e, metadata);
View Full Code Here

  private static void addSourceTransforms(MetadataRegistry registry) {
    registry.build(Source.CONSTRUCT, Source.TITLE, RSS).setName(TITLE);

    registry.build(Source.CONSTRUCT, Source.SUBTITLE, RSS).setName(DESCRIPTION);

    XmlWireFormatProperties properties = new XmlWireFormatProperties();
    properties.setElementGenerator(new XmlGenerator.XmlElementGenerator() {
      @Override
      public boolean startElement(XmlWriter xw, Element parent, Element e,
          ElementMetadata<?, ?> metadata) throws IOException {
        boolean isIcon = e.getElementId().equals(Source.ICON.getId());
        boolean isLogo = e.getElementId().equals(Source.LOGO.getId());
View Full Code Here

TOP

Related Classes of com.google.gdata.wireformats.XmlWireFormatProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.