use of org.jboss.resteasy.plugins.providers.atom.Person in project wildfly-camel by wildfly-extras.
the class AtomFeed method getFeed.
@GET
@Produces("application/atom+xml")
public Feed getFeed() throws URISyntaxException {
Feed feed = new Feed();
feed.setId(new URI("http://test.com/1"));
feed.setTitle("WildFly Camel Test Feed");
feed.setUpdated(new Date());
Link link = new Link();
link.setHref(new URI("http://localhost"));
link.setRel("edit");
feed.getLinks().add(link);
feed.getAuthors().add(new Person("WildFly Camel"));
Entry entry = new Entry();
entry.setTitle("Hello Kermit");
Content content = new Content();
content.setType(MediaType.TEXT_HTML_TYPE);
content.setText("Greeting Kermit");
entry.setContent(content);
feed.getEntries().add(entry);
return feed;
}
use of org.jboss.resteasy.plugins.providers.atom.Person in project candlepin by candlepin.
the class EventAdapterImpl method toFeed.
@Override
public Feed toFeed(List<Event> events, String path) {
String url = config.getString(ConfigProperties.CANDLEPIN_URL) + path + "/";
Feed feed = new Feed();
feed.setUpdated(new Date());
feed.getAuthors().add(new Person("Red Hat, Inc."));
try {
feed.setId(new URI(url));
} catch (Exception e) {
// ignore, shouldn't happen
}
if (events == null) {
return feed;
}
// Add the friendly message text
this.addMessageText(events);
for (Event e : events) {
Entry entry = new Entry();
entry.setTitle(e.getTarget().toString() + " " + e.getType().toString());
entry.setPublished(e.getTimestamp());
entry.setUpdated(e.getTimestamp());
entry.getAuthors().add(new Person("Red Hat, Inc."));
URI eventURI = null;
try {
eventURI = new URI(url + e.getId());
} catch (Exception error) {
// ignore, shouldn't happen
}
entry.setId(eventURI);
entry.getLinks().add(new Link("alternate", eventURI, MediaType.APPLICATION_JSON_TYPE));
Content content = new Content();
content.setType(MediaType.APPLICATION_XML_TYPE);
content.setJAXBObject(e);
entry.setContent(content);
entry.setSummary(e.getMessageText());
feed.getEntries().add(entry);
}
// get modified, if they do then the feed published date could be inaccurate.
if (events.size() > 0) {
feed.setUpdated(events.get(0).getTimestamp());
}
return feed;
}
Aggregations