use of org.apache.abdera.model.Content in project cxf by apache.
the class JAXRSAtomBookTest method createBookEntry.
private Entry createBookEntry(int id, String name) throws Exception {
Book b = new Book();
b.setId(id);
b.setName(name);
Factory factory = Abdera.getNewFactory();
JAXBContext jc = JAXBContext.newInstance(Book.class);
Entry e = factory.getAbdera().newEntry();
e.setTitle(b.getName());
e.setId(Long.toString(b.getId()));
StringWriter writer = new StringWriter();
jc.createMarshaller().marshal(b, writer);
Content ct = factory.newContent(Content.Type.XML);
ct.setValue(writer.toString());
e.setContentElement(ct);
return e;
}
use of org.apache.abdera.model.Content in project cxf by apache.
the class AtomPojoProvider method setEntryContent.
protected void setEntryContent(Factory factory, Entry e, String content) {
Content ct = factory.newContent(Content.Type.XML);
ct.setValue(content);
e.setContentElement(ct);
}
Aggregations