@Produces( {MediaType.WILDCARD, MediaType.APPLICATION_JSON})
public SyndEntry getSyndEntry(@Context Providers providers,
@Context UriInfo uriInfo,
@Context LinkBuilders linkBuilders) throws IOException {
SyndEntry entry = new SyndEntry();
entry.setId("urn:com:hp:qadefects:defect:" + defect.getId());
entry.setTitle(new SyndText(defect.getName()));
entry.setSummary(new SyndText(defect.getDescription()));
entry.addAuthor(new SyndPerson(defect.getAuthor()));
entry.addCategory(new SyndCategory("urn:com:hp:qadefects:categories:severity", defect
.getSeverity(), null));
entry.addCategory(new SyndCategory("urn:com:hp:qadefects:categories:status", defect
.getStatus(), null));
if (defect.getCreated() != null) {
entry.setPublished(new Date(defect.getCreated().getTime()));
}
// serialize the defect xml
String contentString =
ProviderUtils.writeToString(providers, defect, MediaType.APPLICATION_XML_TYPE);
entry.setContent(new SyndContent(contentString, MediaType.APPLICATION_XML, false));
// set base uri if this is a standalone entry
if (!child) {
entry.setBase(uriInfo.getAbsolutePath().toString());
}
// generate system links
linkBuilders.createSystemLinksBuilder().subResource(defect.getId()).build(entry.getLinks());
return entry;
}