if(logger.isInfoEnabled())
logger.info("contentVersionVOList:" + contentVersionVOList.size());
Iterator<SmallestContentVersionVO> contentVersionsIterator = contentVersionVOList.iterator();
while(contentVersionsIterator.hasNext())
{
SmallestContentVersionVO version = contentVersionsIterator.next();
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("contentVersionsIterator", t.getElapsedTime());
ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(version.getId(), db2);
Document document = getDocumentFromDigitalAsset(asset, cvVO, db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromDigitalAsset", t.getElapsedTime());
logger.info("00000000000000000: Adding asset document:" + document);
if(document != null)
returnDocuments.add(document);
}
commitTransaction(db2);
}
catch(Exception e)
{
logger.error("An error occurred so we should not complete the transaction:" + e, e);
rollbackTransaction(db2);
throw new SystemException(e.getMessage());
}
}
else if(notificationMessage.getClassName().equals(SiteNodeImpl.class.getName()) || notificationMessage.getClassName().equals(SiteNode.class.getName()))
{
SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId((Integer)notificationMessage.getObjectId(), db);
if (siteNodeVO == null)
{
logger.warn("Could not find SiteNode with id: " + notificationMessage.getObjectId());
}
else
{
siteNodeIdsToIndex.add(siteNodeVO.getId());
}
}
logger.info("Indexing:" + siteNodeIdsToIndex.size());
for(Integer siteNodeId : siteNodeIdsToIndex)
{
//Deleting all info based on content
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
logger.info("Deleting all info on:" + siteNodeId);
//TODO - Fixa s inte assets tas med hr....
Query query = new QueryParser(Version.LUCENE_34, "siteNodeId", analyzer).parse("" + siteNodeId);
writer.deleteDocuments(query);
//End
logger.info("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ:" + notificationMessage.getObjectId());
SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId((Integer)notificationMessage.getObjectId(), db);
logger.info("$$$$$$$$$$Getting doc for " + siteNodeVO.getName());
Document document = getDocumentFromSiteNode(siteNodeVO, writer, db);
logger.info("document " + document);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromSiteNode", t.getElapsedTime());
if(document != null)
returnDocuments.add(document);
}
logger.info("Indexing contentIdsToIndex:" + contentIdsToIndex.size());
for(Integer contentId : contentIdsToIndex)
{
//Deleting all info based on content
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
logger.info("Deleting all info on:" + contentId);
//TODO - Fixa s inte assets tas med hr....
String[] fields = new String[]{"isAsset","contentId"};
String[] queries = new String[]{"true","" + contentId};
BooleanClause.Occur[] flags = new BooleanClause.Occur[]{BooleanClause.Occur.MUST_NOT,BooleanClause.Occur.MUST};
Query query = MultiFieldQueryParser.parse(Version.LUCENE_34, queries, fields, flags, analyzer);
//Query query = new QueryParser(Version.LUCENE_34, "contentId", analyzer).parse("" + contentId);
writer.deleteDocuments(query);
//End
ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId, db);
Document document = getDocumentFromContent(contentVO, notificationMessage, writer, forceVersionIndexing, db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromContent", (t.getElapsedTimeNanos() / 1000));
if(document != null)
{
returnDocuments.add(document);
logger.info("++++++++++++++Forcing cv indexing");
List<ContentVersionVO> versions = new ArrayList<ContentVersionVO>();
if(CmsPropertyHandler.getApplicationName().equalsIgnoreCase("cms"))
{
//List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId());
List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId(), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLanguageVOList", (t.getElapsedTimeNanos() / 1000));
for(LanguageVO language : languages)
{
ContentVersionVO latestVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), Integer.parseInt(CmsPropertyHandler.getOperatingMode()), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));
if(latestVersion != null)
versions.add(latestVersion);
ContentVersionVO latestVersionPublishedVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), ContentVersionVO.PUBLISHED_STATE, db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));
if(latestVersionPublishedVersion != null && latestVersionPublishedVersion.getId().intValue() != latestVersion.getId().intValue())
versions.add(latestVersionPublishedVersion);
}
}
else
{
List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId(), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLanguageVOList", (t.getElapsedTimeNanos() / 1000));
for(LanguageVO language : languages)
{
ContentVersionVO version = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), Integer.parseInt(CmsPropertyHandler.getOperatingMode()), db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));
if(version != null)
versions.add(version);
}
}
logger.info("versions:" + versions.size());
for(ContentVersionVO version : versions)
{
logger.info("version:" + version.getId());
Document versionDocument = getDocumentFromContentVersion(version, db);
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromContentVersion", t.getElapsedTime());
if(versionDocument != null)
returnDocuments.add(versionDocument);
if(version.getId() > this.lastCommitedContentVersionId)
lastCommitedContentVersionId = version.getId();
}
}
}
return returnDocuments;