@PathParam("assetName") String assetName) {
try {
//Throws RulesRepositoryException if the package or asset does not exist
AssetItem asset = rulesRepository.loadModule(packageName).loadAsset(assetName);
Factory factory = Abdera.getNewFactory();
Feed f = factory.getAbdera().newFeed();
f.setTitle("Version history of " + asset.getName());
URI base;
if (asset.isHistoricalVersion()) {
base = uriInfo.getBaseUriBuilder()
.path("packages/{packageName}/assets/{assetName}/versions/{versionNumber}")
.build(asset.getModuleName(), asset.getName(), Long.toString(asset.getVersionNumber()));
} else {
base = uriInfo.getBaseUriBuilder()
.path("packages/{packageName}/assets/{assetName}/versions")
.build(asset.getModuleName(), asset.getName());
}
f.setBaseUri(base.toString());
AssetHistoryIterator it = asset.getHistory();
while (it.hasNext()) {
AssetItem historicalAsset = it.next();
if (historicalAsset.getVersionNumber() != 0) {
Entry e = factory.getAbdera().newEntry();
e.setTitle(Long.toString(historicalAsset
.getVersionNumber()));
e.setUpdated(historicalAsset.getLastModified().getTime());
Link l = factory.newLink();
l.setHref(uriInfo
.getBaseUriBuilder()
.path("packages/{packageName}/assets/{assetName}/versions/{versionNumber}")
.build(asset.getModuleName(), asset.getName(),
Long.toString(historicalAsset.getVersionNumber())).toString());