use of org.restlet.ext.atom.Text in project qi4j-sdk by Qi4j.
the class EntitiesResource method representAtom.
private Representation representAtom() throws ResourceException {
try {
Feed feed = new Feed();
feed.setTitle(new Text(MediaType.TEXT_PLAIN, "All entities"));
List<Entry> entries = feed.getEntries();
final Iterable<EntityReference> query = entityFinder.findEntities(EntityComposite.class, null, null, null, null, Collections.<String, Object>emptyMap());
for (EntityReference entityReference : query) {
Entry entry = new Entry();
entry.setTitle(new Text(MediaType.TEXT_PLAIN, entityReference.toString()));
Link link = new Link();
link.setHref(getRequest().getResourceRef().clone().addSegment(entityReference.identity()));
entry.getLinks().add(link);
entries.add(entry);
}
return feed;
} catch (Exception e) {
throw new ResourceException(e);
}
}
Aggregations