logger.info("originalContentVersionId:" + originalContentVersionId);
logger.info("oldAssetKey:" + oldAssetKey);
logger.info("newContentVersionId:" + newContentVersionId);
logger.info("newAssetKey:" + newAssetKey);
DigitalAsset oldDigitalAsset = getDigitalAsset(originalContentVersionId, oldAssetKey, db);
ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(newContentVersionId, db);
Collection contentVersions = new ArrayList();
contentVersions.add(contentVersion);
logger.info("Added contentVersion:" + contentVersion.getId());
DigitalAssetVO digitalAssetVO = new DigitalAssetVO();
digitalAssetVO.setAssetContentType(oldDigitalAsset.getAssetContentType());
digitalAssetVO.setAssetFileName(oldDigitalAsset.getAssetFileName());
digitalAssetVO.setAssetFilePath(oldDigitalAsset.getAssetFilePath());
digitalAssetVO.setAssetFileSize(oldDigitalAsset.getAssetFileSize());
digitalAssetVO.setAssetKey(newAssetKey);
DigitalAsset digitalAsset = new DigitalAssetImpl();
digitalAsset.setValueObject(digitalAssetVO);
digitalAsset.setAssetBlob(oldDigitalAsset.getAssetBlob());
digitalAsset.setContentVersions(contentVersions);
try
{
db.create(digitalAsset);
}
catch(Exception e)
{
logger.error("An error occurred so we should not complete the transaction:" + e, e);
throw new SystemException(e.getMessage());
}
//contentVersion.getDigitalAssets().add(digitalAsset);
return digitalAsset.getValueObject();
}