Package com.rometools.rome.feed.atom

Examples of com.rometools.rome.feed.atom.Content


            // see http://diveintomark.org/archives/2004/05/28/howto-atom-id#other
            entry.setId(String.format("tag:springsource.org,%s", vet.getId()));
            entry.setTitle(String.format("Vet: %s %s", vet.getFirstName(), vet.getLastName()));
            //entry.setUpdated(visit.getDate().toDate());

            Content summary = new Content();
            summary.setValue(vet.getSpecialties().toString());
            entry.setSummary(summary);

            entries.add(entry);
        }
        response.setContentType("blabla");
View Full Code Here


      List<Entry> entries = new ArrayList<Entry>();
      for (Iterator iterator = model.keySet().iterator(); iterator.hasNext();) {
        String name = (String) iterator.next();
        Entry entry = new Entry();
        entry.setTitle(name);
        Content content = new Content();
        content.setValue((String) model.get(name));
        entry.setSummary(content);
        entries.add(entry);
      }
      return entries;
    }
View Full Code Here

            syndFeed.setImage(image);
        }

        syndFeed.setUri(aFeed.getId());

        final Content aTitle = aFeed.getTitleEx();
        if (aTitle != null) {
            final SyndContent c = new SyndContentImpl();
            c.setType(aTitle.getType());
            c.setValue(aTitle.getValue());
            syndFeed.setTitleEx(c);
        }

        final Content aSubtitle = aFeed.getSubtitle();
        if (aSubtitle != null) {
            final SyndContent c = new SyndContentImpl();
            c.setType(aSubtitle.getType());
            c.setValue(aSubtitle.getValue());
            syndFeed.setDescriptionEx(c);
        }

        // use first alternate links as THE link
        final List<Link> alternateLinks = aFeed.getAlternateLinks();
View Full Code Here

        parent.addContent(eEntry);
    }

    protected void populateFeedHeader(final Feed feed, final Element eFeed) throws FeedException {

        final Content titleEx = feed.getTitleEx();
        if (titleEx != null) {
            final Element titleElement = new Element("title", getFeedNamespace());
            fillContentElement(titleElement, titleEx);
            eFeed.addContent(titleElement);
        }

        List<Link> links = feed.getAlternateLinks();
        for (final Link link : links) {
            eFeed.addContent(generateLinkElement(link));
        }

        links = feed.getOtherLinks();
        for (final Link link : links) {
            eFeed.addContent(generateLinkElement(link));
        }

        final List<SyndPerson> authors = feed.getAuthors();
        if (Lists.isNotEmpty(authors)) {
            final Element authorElement = new Element("author", getFeedNamespace());
            fillPersonElement(authorElement, authors.get(0));
            eFeed.addContent(authorElement);
        }

        final List<SyndPerson> contributors = feed.getContributors();
        for (final SyndPerson contributor : contributors) {
            final Element contributorElement = new Element("contributor", getFeedNamespace());
            fillPersonElement(contributorElement, contributor);
            eFeed.addContent(contributorElement);
        }

        final Content tagline = feed.getTagline();
        if (tagline != null) {
            final Element taglineElement = new Element("tagline", getFeedNamespace());
            fillContentElement(taglineElement, tagline);
            eFeed.addContent(taglineElement);
        }

        final String id = feed.getId();
        if (id != null) {
            eFeed.addContent(generateSimpleElement("id", id));
        }

        final Generator generator = feed.getGenerator();
        if (generator != null) {
            eFeed.addContent(generateGeneratorElement(generator));
        }

        final String copyright = feed.getCopyright();
        if (copyright != null) {
            eFeed.addContent(generateSimpleElement("copyright", copyright));
        }

        final Content info = feed.getInfo();
        if (info != null) {
            final Element infoElement = new Element("info", getFeedNamespace());
            fillContentElement(infoElement, info);
            eFeed.addContent(infoElement);
        }
View Full Code Here

    }

    protected void populateEntry(final Entry entry, final Element eEntry) throws FeedException {

        final Content titleEx = entry.getTitleEx();
        if (titleEx != null) {
            final Element titleElement = new Element("title", getFeedNamespace());
            fillContentElement(titleElement, titleEx);
            eEntry.addContent(titleElement);
        }

        final List<Link> alternateLinks = entry.getAlternateLinks();
        for (final Link link : alternateLinks) {
            eEntry.addContent(generateLinkElement(link));
        }

        final List<Link> otherLinks = entry.getOtherLinks();
        for (final Link link : otherLinks) {
            eEntry.addContent(generateLinkElement(link));
        }

        final List<SyndPerson> authors = entry.getAuthors();
        if (Lists.isNotEmpty(authors)) {
            final Element authorElement = new Element("author", getFeedNamespace());
            fillPersonElement(authorElement, authors.get(0));
            eEntry.addContent(authorElement);
        }

        final List<SyndPerson> contributors = entry.getContributors();
        for (final SyndPerson contributor : contributors) {
            final Element contributorElement = new Element("contributor", getFeedNamespace());
            fillPersonElement(contributorElement, contributor);
            eEntry.addContent(contributorElement);
        }

        final String id = entry.getId();
        if (id != null) {
            eEntry.addContent(generateSimpleElement("id", id));
        }

        final Date modified = entry.getModified();
        if (modified != null) {
            final Element modifiedElement = new Element("modified", getFeedNamespace());
            modifiedElement.addContent(DateParser.formatW3CDateTime(modified, Locale.US));
            eEntry.addContent(modifiedElement);
        }

        final Date issued = entry.getIssued();
        if (issued != null) {
            final Element issuedElement = new Element("issued", getFeedNamespace());
            issuedElement.addContent(DateParser.formatW3CDateTime(issued, Locale.US));
            eEntry.addContent(issuedElement);
        }

        final Date created = entry.getCreated();
        if (created != null) {
            final Element createdElement = new Element("created", getFeedNamespace());
            createdElement.addContent(DateParser.formatW3CDateTime(created, Locale.US));
            eEntry.addContent(createdElement);
        }

        final Content summary = entry.getSummary();
        if (summary != null) {
            final Element summaryElement = new Element("summary", getFeedNamespace());
            fillContentElement(summaryElement, summary);
            eEntry.addContent(summaryElement);
        }
View Full Code Here

        if (Lists.isNotEmpty(otherLinks)) {
            syndLinks.addAll(createSyndLinks(otherLinks));
        }
        syndFeed.setLinks(syndLinks);

        final Content tagline = aFeed.getTagline();
        if (tagline != null) {
            syndFeed.setDescription(tagline.getValue());
        }

        final List<Entry> aEntries = aFeed.getEntries();
        if (Lists.isNotEmpty(aEntries)) {
            syndFeed.setEntries(createSyndEntries(aEntries, syndFeed.isPreservingWireFeed()));
View Full Code Here

        } else {
            final String link = syndEntry.getLink();
            syndEntry.setUri(link);
        }

        Content summary = entry.getSummary();
        if (summary == null) {
            final List<Content> contents = entry.getContents();
            if (Lists.isNotEmpty(contents)) {
                summary = contents.get(0);
            }
        } else {
            final SyndContent sContent = new SyndContentImpl();
            sContent.setType(summary.getType());
            sContent.setValue(summary.getValue());
            syndEntry.setDescription(sContent);
        }

        final List<Content> contents = entry.getContents();
        if (Lists.isNotEmpty(contents)) {
View Full Code Here

        aFeed.setId(syndFeed.getUri());

        final SyndContent sTitle = syndFeed.getTitleEx();
        if (sTitle != null) {

            final Content title = new Content();
            final String type = sTitle.getType();
            if (type != null) {
                title.setType(type);
            }

            final String mode = sTitle.getMode();
            if (mode != null) {
                title.setMode(mode);
            }

            title.setValue(sTitle.getValue());
            aFeed.setTitleEx(title);
        }

        // separate SyndEntry's links collection into alternate and other links
        final List<Link> alternateLinks = new ArrayList<Link>();
        final List<Link> otherLinks = new ArrayList<Link>();

        final List<SyndLink> slinks = syndFeed.getLinks();
        if (slinks != null) {
            for (final SyndLink syndLink2 : slinks) {
                final SyndLink syndLink = syndLink2;
                final Link link = createAtomLink(syndLink);
                final String rel = link.getRel();
                if (Strings.isBlank(rel) || "alternate".equals(rel)) {
                    alternateLinks.add(link);
                } else {
                    otherLinks.add(link);
                }
            }
        }
        // no alternate link? then use THE link if there is one
        final String sLink = syndFeed.getLink();
        if (alternateLinks.isEmpty() && sLink != null) {
            final Link link = new Link();
            link.setRel("alternate");
            link.setHref(sLink);
            alternateLinks.add(link);
        }

        if (!alternateLinks.isEmpty()) {
            aFeed.setAlternateLinks(alternateLinks);
        }
        if (!otherLinks.isEmpty()) {
            aFeed.setOtherLinks(otherLinks);
        }

        final String sDesc = syndFeed.getDescription();
        if (sDesc != null) {
            final Content tagline = new Content();
            tagline.setValue(sDesc);
            aFeed.setTagline(tagline);
        }

        aFeed.setLanguage(syndFeed.getLanguage());
View Full Code Here

        aEntry.setId(sEntry.getUri());

        final SyndContent sTitle = sEntry.getTitleEx();
        if (sTitle != null) {
            final Content title = new Content();
            final String type = sTitle.getType();
            if (type != null) {
                title.setType(type);
            }

            final String mode = sTitle.getMode();
            if (mode != null) {
                title.setMode(mode);
            }

            title.setValue(sTitle.getValue());
            aEntry.setTitleEx(title);
        }

        // separate SyndEntry's links collection into alternate and other links
        final List<Link> alternateLinks = new ArrayList<Link>();
        final List<Link> otherLinks = new ArrayList<Link>();
        final List<SyndLink> syndLinks = sEntry.getLinks();

        if (syndLinks != null) {
            for (final SyndLink syndLink : syndLinks) {
                final Link link = createAtomLink(syndLink);
                final String rel = link.getRel();
                if (Strings.isBlank(rel) || "alternate".equals(rel)) {
                    alternateLinks.add(link);
                } else {
                    otherLinks.add(link);
                }
            }
        }
        // no alternate link? then use THE link if there is one
        final String sLink = sEntry.getLink();
        if (alternateLinks.isEmpty() && sLink != null) {
            final Link link = new Link();
            link.setRel("alternate");
            link.setHref(sLink);
            alternateLinks.add(link);
        }

        final List<SyndEnclosure> sEnclosures = sEntry.getEnclosures();
        if (sEnclosures != null) {
            for (final SyndEnclosure syndEnclosure : sEnclosures) {
                final Link link = createAtomEnclosure(syndEnclosure);
                otherLinks.add(link);
            }
        }

        if (!alternateLinks.isEmpty()) {
            aEntry.setAlternateLinks(alternateLinks);
        }
        if (!otherLinks.isEmpty()) {
            aEntry.setOtherLinks(otherLinks);
        }

        final SyndContent sContent = sEntry.getDescription();
        if (sContent != null) {
            final Content content = new Content();
            content.setType(sContent.getType());
            content.setValue(sContent.getValue());
            content.setMode(Content.ESCAPED);
            aEntry.setSummary(content);
        }

        final List<SyndContent> contents = sEntry.getContents();
        if (!contents.isEmpty()) {
            final List<Content> aContents = new ArrayList<Content>();
            for (final SyndContent syndContent : contents) {
                final Content content = new Content();
                content.setType(syndContent.getType());
                content.setValue(syndContent.getValue());
                content.setMode(syndContent.getMode());
                aContents.add(content);
            }
            aEntry.setContents(aContents);
        }
View Full Code Here

        final List<Element> foreignMarkup = entry.getForeignMarkup();
        if (!foreignMarkup.isEmpty()) {
            syndEntry.setForeignMarkup(foreignMarkup);
        }

        final Content eTitle = entry.getTitleEx();
        if (eTitle != null) {
            syndEntry.setTitleEx(createSyndContent(eTitle));
        }

        final Content summary = entry.getSummary();
        if (summary != null) {
            syndEntry.setDescription(createSyndContent(summary));
        }

        final List<Content> contents = entry.getContents();
View Full Code Here

TOP

Related Classes of com.rometools.rome.feed.atom.Content

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.