本文整理汇总了Java中com.rometools.rome.feed.atom.Link类的典型用法代码示例。如果您正苦于以下问题:Java Link类的具体用法?Java Link怎么用?Java Link使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Link类属于com.rometools.rome.feed.atom包,在下文中一共展示了Link类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFeedMetadata
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
feed.setId("https://github.com/mploed/event-driven-spring-boot/customer");
feed.setTitle("Customer");
List<Link> alternateLinks = new ArrayList<>();
Link link = new Link();
link.setRel("self");
link.setHref(baseUrl(request) + "feed");
alternateLinks.add(link);
List<SyndPerson> authors = new ArrayList<SyndPerson>();
Person person = new Person();
person.setName("Big Pug Bank");
authors.add(person);
feed.setAuthors(authors);
feed.setAlternateLinks(alternateLinks);
feed.setUpdated(customerRepository.lastUpdate());
Content subtitle = new Content();
subtitle.setValue("List of all customers");
feed.setSubtitle(subtitle);
}
示例2: buildFeedMetadata
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
feed.setId("tag:ewolff.com/microservice-atom/order");
feed.setTitle("Order");
List<Link> alternateLinks = new ArrayList<>();
Link link = new Link();
link.setRel("self");
link.setHref(baseUrl(request) + "feed");
alternateLinks.add(link);
List<SyndPerson> authors = new ArrayList<SyndPerson>();
Person person = new Person();
person.setName("Big Money Online Commerce Inc.");
authors.add(person);
feed.setAuthors(authors);
feed.setAlternateLinks(alternateLinks);
feed.setUpdated(orderRepository.lastUpdate());
Content subtitle = new Content();
subtitle.setValue("List of all orders");
feed.setSubtitle(subtitle);
}
示例3: generateLinkElement
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
protected Element generateLinkElement(final Link link) {
final Element linkElement = new Element("link", OS_NS);
if (link.getRel() != null) {
final Attribute relAttribute = new Attribute("rel", "search");
linkElement.setAttribute(relAttribute);
}
if (link.getType() != null) {
final Attribute typeAttribute = new Attribute("type", link.getType());
linkElement.setAttribute(typeAttribute);
}
if (link.getHref() != null) {
final Attribute hrefAttribute = new Attribute("href", link.getHref());
linkElement.setAttribute(hrefAttribute);
}
if (link.getHreflang() != null) {
final Attribute hreflangAttribute = new Attribute("hreflang", link.getHreflang());
linkElement.setAttribute(hreflangAttribute);
}
return linkElement;
}
示例4: clone
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@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;
}
示例5: generateLinkElement
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
protected Element generateLinkElement(final Link link) {
final Element linkElement = new Element("link", getFeedNamespace());
final String rel = link.getRel();
if (rel != null) {
final Attribute relAttribute = new Attribute("rel", rel);
linkElement.setAttribute(relAttribute);
}
final String type = link.getType();
if (type != null) {
final Attribute typeAttribute = new Attribute("type", type);
linkElement.setAttribute(typeAttribute);
}
final String href = link.getHref();
if (href != null) {
final Attribute hrefAttribute = new Attribute("href", href);
linkElement.setAttribute(hrefAttribute);
}
return linkElement;
}
示例6: parseLink
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
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;
}
示例7: parseLinks
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private List<Link> parseLinks(final List<Element> eLinks, final boolean alternate) {
final List<Link> links = new ArrayList<Link>();
for (final Element eLink : eLinks) {
final String rel = getAttributeValue(eLink, "rel");
if (alternate) {
if ("alternate".equals(rel)) {
links.add(parseLink(eLink));
}
} else {
if (!"alternate".equals(rel)) {
links.add(parseLink(eLink));
}
}
}
return Lists.emptyToNull(links);
}
示例8: buildFeedEntries
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@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;
}
示例9: toLink
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private Link toLink(OPDSLink opdsLinkI) {
Link link = new Link();
link.setHref(opdsLinkI.getHref());
link.setRel(opdsLinkI.getRel());
link.setType(opdsLinkI.getType());
return link;
}
示例10: getAvatar
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
* Get the value of avatar
*
* @return the value of avatar
*/
public Link getAvatar() {
final Link result = findRelatedLink("avatar");
if (result != null) {
return result;
}
return findRelatedLink("userpic");
}
示例11: setAvatar
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
* Set the value of avatar
*
* @param newavatar new value of avatar
*/
public void setAvatar(final Link newavatar) {
final Link old = getAvatar();
if (old != null) {
getOtherLinks().remove(old);
}
newavatar.setRel("avatar");
getOtherLinks().add(newavatar);
}
示例12: setThumbnail
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
* Set the value of thumbnail
*
* @param newthumbnail new value of thumbnail
*/
public void setThumbnail(final Link newthumbnail) {
Link old = null;
for (final Link l : getOtherLinks()) {
if ("thumbnail".equals(l.getRel())) {
old = l;
break;
}
}
if (old != null) {
getOtherLinks().remove(old);
newthumbnail.setRel("thumbnail");
}
getOtherLinks().add(newthumbnail);
}
示例13: getLink
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public Link getLink() {
if(links.size() > 0) {
return links.get(0);
}
return null;
}
示例14: setLink
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public void setLink(Link link) {
if(links.size() > 0) {
links.set(0, link);
} else {
links.add(link);
}
}
示例15: copyFrom
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@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);
}
}