if(snVO == null)
return;
List<LanguageVO> languages = LanguageController.getController().getAvailableLanguageVOListForRepository(snVO.getRepositoryId(), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getAvailableLanguageVOListForRepository..", t.getElapsedTime());
LanguageVO masterLanguage = LanguageController.getController().getMasterLanguage(snVO.getRepositoryId(), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getMasterLanguage..", t.getElapsedTime());
ContentVO contentVO = null;
if(snVO.getMetaInfoContentId() != null)
{
try
{
contentVO = ContentController.getContentController().getSmallContentVOWithId(snVO.getMetaInfoContentId(), db, null);
}
catch (Exception e)
{
if(e.getCause().getClass().getName().equals(ObjectNotFoundException.class.getName()))
{
logger.error("No meta info found on " + snVO.getId() + ". Returning as if ok.");
return;
}
}
}
else
{
logger.warn("There was no metaInfoContentId on the siteNode... run validation to improve performance..");
Integer metaInfoAvailableServiceBindingId = null;
Integer serviceBindingId = null;
AvailableServiceBindingVO availableServiceBindingVO = AvailableServiceBindingController.getController().getAvailableServiceBindingVOWithName("Meta information", db);
if(availableServiceBindingVO != null)
metaInfoAvailableServiceBindingId = availableServiceBindingVO.getAvailableServiceBindingId();
logger.info("after loading service binding for meta info");
List<SmallServiceBindingImpl> serviceBindings = ServiceBindingController.getController().getSmallServiceBindingsListForSiteNodeVersion(siteNodeVersionVO.getSiteNodeVersionId(), db);
Iterator<SmallServiceBindingImpl> serviceBindingIterator = serviceBindings.iterator();
while(serviceBindingIterator.hasNext())
{
SmallServiceBindingImpl serviceBinding = serviceBindingIterator.next();
if(serviceBinding.getAvailableServiceBinding().getId().intValue() == metaInfoAvailableServiceBindingId.intValue())
{
serviceBindingId = serviceBinding.getId();
break;
}
}
if(serviceBindingId != null)
{
List boundContents = ContentController.getBoundContents(db, serviceBindingId);
logger.info("boundContents:" + boundContents.size());
if(boundContents.size() > 0)
{
contentVO = (ContentVO)boundContents.get(0);
logger.info("contentVO:" + contentVO.getId());
}
}
}
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getSmallContentVOWithId..", t.getElapsedTime());
if(contentVO != null)
{
Iterator<LanguageVO> languageIterator = languages.iterator();
while(languageIterator.hasNext())
{
LanguageVO language = languageIterator.next();
ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), db);
//if(contentVersion != null && contentVersion.getStateId().intValue() == siteNodeVersion.getStateId().intValue())
if(contentVersionVO != null && contentVersionVO.getStateId().intValue() != stateId.intValue())
{
logger.info("State on current:" + contentVersionVO.getStateId());
logger.info("changing state on contentVersion:" + contentVersionVO.getId());
ContentVersion contentVersion = ContentStateController.changeState(contentVersionVO.getId(), contentVO, stateId, versionComment, overrideVersionModifyer, null, infoGluePrincipal, contentVO.getId(), db, events);
contentVersionVO = contentVersion.getValueObject();
}
if(language.getId().equals(masterLanguage.getId()) && contentVersionVO != null)
{
//TODO - lets keep the ref to meta info alive...
//RegistryController.getController().updateSiteNodeVersion(siteNodeVersion, db);
//RegistryController.getController().updateContentVersion(contentVersionVO, siteNodeVersionVO, db);
RegistryController.getController().updateContentVersionThreaded(contentVersionVO, siteNodeVersionVO);