baseURL = uriInfo.getBaseUriBuilder()
.path("packages/{packageName}/assets/{assetName}")
.build(a.getModuleName(), a.getName());
}
Factory factory = Abdera.getNewFactory();
org.apache.abdera.model.Entry e = factory.getAbdera().newEntry();
e.setTitle(a.getTitle());
e.setSummary(a.getDescription());
e.setPublished(new Date(a.getLastModified().getTimeInMillis()));
e.setBaseUri(baseURL.toString());
e.addAuthor(a.getLastContributor());
e.setId(baseURL.toString());
/* Iterator<AssetItem> i = p.getAssets();
while (i.hasNext()) {
AssetItem item = i.next();
org.apache.abdera.model.Link l = factory.newLink();
l.setHref((base.clone().path("assets").path(item.getName())).build().toString());
l.setTitle(item.getTitle());
l.setRel("asset");
e.addLink(l);
}*/
//generate meta data
ExtensibleElement extension = e.addExtension(METADATA);
ExtensibleElement childExtension = extension.addExtension(ARCHIVED);
//childExtension.setAttributeValue("type", ArtifactsRepository.METADATA_TYPE_STRING);
childExtension.addSimpleExtension(VALUE, a.isArchived() ? "true" : "false");
childExtension = extension.addExtension(UUID);
childExtension.addSimpleExtension(VALUE, a.getUUID());
childExtension = extension.addExtension(STATE);
childExtension.addSimpleExtension(VALUE, a.getState() == null ? "" : a.getState().getName());
childExtension = extension.addExtension(FORMAT);
childExtension.addSimpleExtension(VALUE, a.getFormat());
List<CategoryItem> categories = a.getCategories();
childExtension = extension.addExtension(CATEGORIES);
for (CategoryItem c : categories) {
childExtension.addSimpleExtension(VALUE, c.getName());
}
org.apache.abdera.model.Content content = factory.newContent();
content.setSrc(UriBuilder.fromUri(baseURL).path("binary").build().toString());
content.setMimeType("application/octet-stream");
content.setContentType(Type.MEDIA);
e.setContentElement(content);