Java Code Examples for com.rometools.rome.feed.atom.Link#setType()
The following examples show how to use
com.rometools.rome.feed.atom.Link#setType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtomLinkModuleImpl.java From rome with Apache License 2.0 | 6 votes |
@Override public Object clone() { final AtomLinkModuleImpl m = new AtomLinkModuleImpl(); List<Link> result = new LinkedList<Link>(); for(Link link : this.getLinks()) { Link l = new Link(); l.setHref(link.getHref()); l.setType(link.getType()); l.setRel(link.getRel()); l.setHreflang(link.getHreflang()); l.setTitle(link.getTitle()); l.setLength(link.getLength()); result.add(l); } links.subList(0, links.size()); m.setLinks(result); return m; }
Example 2
Source File: Atom03Parser.java From rome with Apache License 2.0 | 6 votes |
private Link parseLink(final Element eLink) { final Link link = new Link(); final String rel = getAttributeValue(eLink, "rel"); if (rel != null) { link.setRel(rel); } final String type = getAttributeValue(eLink, "type"); if (type != null) { link.setType(type); } final String href = getAttributeValue(eLink, "href"); if (href != null) { link.setHref(href); } return link; }
Example 3
Source File: HrmsAtomViewBuilder.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@Override protected List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest req, HttpServletResponse response) throws Exception { // get data model which is passed by the Spring container List<HrmsNews> news = (List<HrmsNews>) model.get("allNews"); List<Entry> entries = new ArrayList<Entry>(news.size()); for(HrmsNews topic : news ){ Entry entry = new Entry(); entry.setId(topic.getId()+""); entry.setTitle(topic.getDescription()); Content summary = new Content(); summary.setValue(topic.getSummary()); entry.setSummary(summary); Link link = new Link(); link.setType("text/html"); link.setHref(topic.getLink()); //because I have a different controller to show news at http://yourfanstasticsiteUrl.com/news/ID List arrLinks = new ArrayList(); arrLinks.add(link); entry.setAlternateLinks(arrLinks); entry.setUpdated(new Date()); entries.add(entry); } return entries; }
Example 4
Source File: AtomLinkModuleImpl.java From rome with Apache License 2.0 | 5 votes |
@Override public void copyFrom(CopyFrom obj) { AtomLinkModule other = (AtomLinkModule) obj; List<Link> links = other.getLinks(); for (Link link : links) { Link l = new Link(); l.setHref(link.getHref()); l.setType(link.getType()); l.setRel(link.getRel()); l.setHreflang(link.getHreflang()); l.setTitle(link.getTitle()); l.setLength(link.getLength()); this.links.add(l); } }
Example 5
Source File: AtomModuleParser.java From rome with Apache License 2.0 | 5 votes |
private Link parseLink(final Element eLink) { final Link link = new Link(); final String rel = getAttributeValue(eLink, AtomLinkAttribute.REL); if (rel != null) { link.setRel(rel); } final String type = getAttributeValue(eLink, AtomLinkAttribute.TYPE); if (type != null) { link.setType(type); } final String href = getAttributeValue(eLink, AtomLinkAttribute.HREF); if (href != null) { link.setHref(href); } final String title = getAttributeValue(eLink, AtomLinkAttribute.TITLE); if (title != null) { link.setTitle(title); } final String hrefLang = getAttributeValue(eLink, AtomLinkAttribute.HREF_LANG); if (hrefLang != null) { link.setHreflang(hrefLang); } final String length = getAttributeValue(eLink, AtomLinkAttribute.LENGTH); if (length != null) { final Long val = NumberParser.parseLong(length); if (val != null) { link.setLength(val.longValue()); } } return link; }
Example 6
Source File: ConverterForAtom10.java From rome with Apache License 2.0 | 5 votes |
public Link createAtomEnclosure(final SyndEnclosure syndEnclosure) { final Link link = new Link(); link.setRel("enclosure"); link.setType(syndEnclosure.getType()); link.setHref(syndEnclosure.getUrl()); link.setLength(syndEnclosure.getLength()); return link; }
Example 7
Source File: ConverterForAtom10.java From rome with Apache License 2.0 | 5 votes |
public Link createAtomLink(final SyndLink syndLink) { final Link link = new Link(); link.setRel(syndLink.getRel()); link.setType(syndLink.getType()); link.setHref(syndLink.getHref()); link.setHreflang(syndLink.getHreflang()); link.setLength(syndLink.getLength()); link.setTitle(syndLink.getTitle()); return link; }
Example 8
Source File: ConverterForAtom03.java From rome with Apache License 2.0 | 5 votes |
public Link createAtomLink(final SyndLink syndLink) { final Link link = new Link(); link.setRel(syndLink.getRel()); link.setType(syndLink.getType()); link.setHref(syndLink.getHref()); link.setTitle(syndLink.getTitle()); return link; }
Example 9
Source File: ConverterForAtom03.java From rome with Apache License 2.0 | 5 votes |
public Link createAtomEnclosure(final SyndEnclosure syndEnclosure) { final Link link = new Link(); link.setRel("enclosure"); link.setType(syndEnclosure.getType()); link.setHref(syndEnclosure.getUrl()); link.setLength(syndEnclosure.getLength()); return link; }
Example 10
Source File: OpenSearchModuleParser.java From rome with Apache License 2.0 | 4 votes |
private static Link parseLink(final Element e, final URL baseURI) { final Link link = new Link(); String att = e.getAttributeValue("rel");// getAtomNamespace()); DONT // KNOW WHY DOESN'T WORK if (att != null) { link.setRel(att); } att = e.getAttributeValue("type");// getAtomNamespace()); DONT KNOW WHY // DOESN'T WORK if (att != null) { link.setType(att); } att = e.getAttributeValue("href");// getAtomNamespace()); DONT KNOW WHY // DOESN'T WORK if (att != null) { if (isRelativeURI(att)) { // link.setHref(resolveURI(baseURI, e, "")); } else { link.setHref(att); } } att = e.getAttributeValue("hreflang");// getAtomNamespace()); DONT KNOW // WHY DOESN'T WORK if (att != null) { link.setHreflang(att); } att = e.getAttributeValue("length");// getAtomNamespace()); DONT KNOW // WHY DOESN'T WORK return link; }
Example 11
Source File: Atom10Parser.java From rome with Apache License 2.0 | 4 votes |
private Link parseLink(final Feed feed, final Entry entry, final String baseURI, final Element eLink) { final Link link = new Link(); final String rel = getAttributeValue(eLink, "rel"); if (rel != null) { link.setRel(rel); } final String type = getAttributeValue(eLink, "type"); if (type != null) { link.setType(type); } final String href = getAttributeValue(eLink, "href"); if (href != null) { link.setHref(href); if (isRelativeURI(href)) { link.setHrefResolved(resolveURI(baseURI, eLink, href)); } } final String title = getAttributeValue(eLink, "title"); if (title != null) { link.setTitle(title); } final String hrefLang = getAttributeValue(eLink, "hreflang"); if (hrefLang != null) { link.setHreflang(hrefLang); } final String length = getAttributeValue(eLink, "length"); if (length != null) { final Long val = NumberParser.parseLong(length); if (val != null) { link.setLength(val.longValue()); } } return link; }