Integer expectedSortOrder = 0;
Iterator<SiteNodeVO> i = childrenVOList.iterator();
while(i.hasNext())
{
SiteNodeVO vo = i.next();
LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(vo.getRepositoryId(), db);
boolean hasUserPageAccess = true;
String useAccessRightsOnStructureTreeString = CmsPropertyHandler.getUseAccessRightsOnStructureTree();
if(useAccessRightsOnStructureTreeString != null && useAccessRightsOnStructureTreeString.equalsIgnoreCase("true"))
hasUserPageAccess = getHasUserPageAccess(this.infogluePrincipal, vo.getId());
if(hasUserPageAccess)
{
BaseNode node = new SiteNodeNodeImpl();
node.setId(vo.getId());
node.setTitle(vo.getName());
Boolean isLanguageAvailable = SiteNodeController.getController().getIsLanguageAvailable(vo.getId(), this.sortLanguageId, db, this.infogluePrincipal);
node.getParameters().put("isLanguageAvailable", "" + isLanguageAvailable);
ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(vo.getMetaInfoContentId(), this.sortLanguageId, db);
if(cvVO != null)
{
node.getParameters().put("isLocalized", "true");
String navigationTitle = ContentVersionController.getContentVersionController().getAttributeValue(cvVO, "NavigationTitle", true);
node.setLocalizedTitle(navigationTitle);
}
else
{
node.getParameters().put("isLocalized", "false");
if(this.sortLanguageId != null && masterLanguageVO.getId().intValue() != this.sortLanguageId.intValue())
{
ContentVersionVO masterCVVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(vo.getMetaInfoContentId(), masterLanguageVO.getId(), db);
if(masterCVVO != null)
{
String navigationTitle = ContentVersionController.getContentVersionController().getAttributeValue(masterCVVO, "NavigationTitle", true);
node.setLocalizedTitle(navigationTitle);
}
}
}
if(vo.getIsHidden() != null)
node.getParameters().put("isHidden", "" + vo.getIsHidden());
if(vo.getStateId() != null)
{
if(vo.getStateId() != SiteNodeVersionVO.PUBLISHED_STATE)
{
Timer t = new Timer();
Set<SiteNodeVersionVO> siteNodeVersionVOList = new HashSet<SiteNodeVersionVO>();
Set<ContentVersionVO> contentVersionVOList = new HashSet<ContentVersionVO>();
ProcessBean processBean = ProcessBean.createProcessBean(ViewListSiteNodeVersionAction.class.getName(), "" + infogluePrincipal.getName());
SiteNodeVersionController.getController().getSiteNodeAndAffectedItemsRecursive(vo.getId(), SiteNodeVersionVO.WORKING_STATE, siteNodeVersionVOList, contentVersionVOList, false, false, infogluePrincipal, processBean, masterLanguageVO.getLocale(), -1);
if(siteNodeVersionVOList.size() > 0 || contentVersionVOList.size() > 0)
node.getParameters().put("stateId", "0");
else
node.getParameters().put("stateId", "" + vo.getStateId());
RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getSiteNodeAndAffectedItemsRecursive", t.getElapsedTime());
}
else
{
node.getParameters().put("stateId", "" + vo.getStateId());
}
}
if(vo.getIsProtected() != null && vo.getIsProtected().intValue() == SiteNodeVersionVO.YES.intValue())
node.getParameters().put("isProtected", "true");
if (vo.getIsBranch().booleanValue())
{
node.setContainer(true);
node.setChildren((vo.getChildCount().intValue() > 0)); //
ret.add(node);
}
else
{
node.setContainer(false);