int counter = 0;
for (CategoryItem c : categories) {
cats[counter++] = c.getName();
}
Asset ret = new Asset();
ret.setTitle(a.getTitle());
ret.setBinaryContentAttachmentFileName(a.getBinaryContentAttachmentFileName());
ret.setPublished(a.getLastModified().getTime());
ret.setAuthor(a.getLastContributor());
ret.setMetadata(metadata);
ret.setDescription(a.getDescription());
ret.setRefLink(uriInfo.getBaseUriBuilder()
.path("/packages/{packageName}/assets/{assetName}")
.build(a.getModule().getName(), a.getName()));
ret.setBinaryLink(uriInfo.getBaseUriBuilder()
.path("/packages/{packageName}/assets/{assetName}/binary")
.build(a.getModule().getName(), a.getName()));
ret.setSourceLink(uriInfo.getBaseUriBuilder()
.path("/packages/{packageName}/assets/{assetName}/source")
.build(a.getModule().getName(), a.getName()));
return ret;
}