* also has the correct state for this delivery-instance.
*/
public SmallestContentVersionVO getSmallestContentVersionVO(Database db, Integer siteNodeId, Integer contentId, Integer languageId, boolean useLanguageFallback, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
{
SmallestContentVersionVO contentVersionVO = null;
SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
String contentVersionKey = "smallestContentVersionVO_" + siteNodeVO.getRepositoryId() + "_" + contentId + "_" + languageId + "_" + useLanguageFallback;
if(logger.isInfoEnabled())
logger.info("contentVersionKey:" + contentVersionKey);
contentVersionVO = (SmallestContentVersionVO)CacheController.getCachedObjectFromAdvancedCache("contentVersionCache", contentVersionKey);
if(contentVersionVO != null)
{
//logger.info("There was an cached contentVersionVO:" + contentVersionVO.getContentVersionId());
}
else
{
contentVersionVO = this.getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
if(contentVersionVO != null)
{
//contentVersionVO = contentVersion.getValueObject();
CacheController.cacheObjectInAdvancedCache("contentVersionCache", contentVersionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
}
}
if(contentVersionVO != null && deliveryContext != null)
deliveryContext.addUsedContentVersion(CacheController.getPooledString(2, contentVersionVO.getId()));
return contentVersionVO;
}