String groupKey1 = null;
String groupKey2 = null;
while (results.hasMore())
{
SiteNode siteNode = (SiteNode)results.next();
String siteNodeCacheKey = "" + siteNode.getValueObject().getId();
CacheController.cacheObjectInAdvancedCache("siteNodeCache", siteNodeCacheKey, siteNode.getValueObject());
String versionValue = siteNode.getValueObject().getAttributes();
Integer contentId = siteNode.getValueObject().getMetaInfoContentId();
Integer languageId = siteNode.getValueObject().getLanguageId();
Integer contentVersionId = siteNode.getValueObject().getContentVersionId();
if(versionValue == null)
{
logger.info("Null version for " + siteNode.getSiteNodeId() + ":" + siteNode.getValueObject().getSiteNodeVersionId());
}
else
{
groupKey1 = CacheController.getPooledString(2, contentVersionId);
groupKey2 = CacheController.getPooledString(1, contentId);
for(ContentTypeAttribute attribute : attributes)
{
if(!attribute.getName().equals("ComponentStructure"))
{
String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
//System.out.println("Caching empty on " + attributeKey);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, "", new String[]{groupKey1, groupKey2}, true);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, "", new String[]{groupKey1, groupKey2}, true);
}
}
for(ContentTypeAttribute attribute : attributes)
{
//if(!attribute.getName().equals("ComponentStructure"))
//{
String value = ContentDeliveryController.getContentDeliveryController().getAttributeValue(versionValue, attribute.getName(), false);
String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
//System.out.println("Caching " + value + " on " + attributeKey);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
//}
}
}
/*
if(attributesString != null)
{
String[] attributesArray = attributesString.split("igcomma");
for(String attr : attributesArray)
{
if(attr != null && !attr.equals(""))
{
String name = attr.substring(0, attr.indexOf("="));
String value = attr.substring(attr.indexOf("=") + 1);
String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + name;
String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + name;
//System.out.println("Caching " + name + "=" + value + " on " + attributeKey);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
}
}
}
else
System.out.println("Error null on " + siteNode.getId());
*/
//if(allSiteNodeVOMap.get(siteNode.getId()) != null)
//{
// allSiteNodeVOMap.get(siteNode.getId()).addAttributes(siteNode.getValueObject().getLanguageId(), siteNode.getValueObject().getAttributes());
// continue;
//}
allSiteNodeVOMap.put(siteNode.getId(), siteNode.getValueObject());
//System.out.println("siteNode:" + siteNode.getName());
if(isValidSiteNode(siteNode, db))
{
//System.out.println("Caching empty list initially on " + siteNode.getId());
//CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+siteNode.getId(), new ArrayList<SiteNodeVO>(), new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, siteNode.getId())}, true);
//populatedSiteNodeVOList.put(siteNode.getId(), new ArrayList<SiteNodeVO>());
if(parentSiteNodeId != null && !siteNode.getValueObject().getParentSiteNodeId().equals(parentSiteNodeId))
{
//System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+parentSiteNodeId, siteNodeVOList, new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, parentSiteNodeId)}, true);
//populatedSiteNodeVOList.put(parentSiteNodeId, siteNodeVOList);
siteNodeVOList = new ArrayList<SiteNodeVO>();
}
parentSiteNodeId = siteNode.getValueObject().getParentSiteNodeId();
siteNodeVOList.add(siteNode.getValueObject());
}
}
//System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
if(groupKey1 == null) groupKey1 = "";
if(groupKey2 == null) groupKey2 = "";