{
List filteredList = new ArrayList();
Iterator iterator = children.iterator();
while(iterator.hasNext())
{
ContentVO contentVO = (ContentVO) iterator.next();
if(contentVO.getContentTypeDefinitionId() != null && !contentVO.getIsBranch().booleanValue())
{
try
{
ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId());
boolean exists = false;
for(int i=0; i<allowedContentTypeIds.length; i++)
{
String allowedId = allowedContentTypeIds[i];
if(allowedId.equalsIgnoreCase(contentTypeDefinitionVO.getId().toString()))
{
exists = true;
break;
}
}
if(exists)
{
filteredList.add(contentVO);
}
}
catch (Exception e)
{
logger.warn("The content " + contentVO.getName() + " (" + contentVO.getId() + " ) points to a removed content type perhaps: " + e.getMessage());
}
}
else
{
filteredList.add(contentVO);
}
}
children = filteredList;
}
}
catch(Exception e)
{
logger.warn("Error filtering Content Children", e);
}
if(logger.isDebugEnabled())
t.printElapsedTime("Done filtering children");
//Sort the tree nodes if setup to do so
String sortProperty = CmsPropertyHandler.getContentTreeSort();
if(sortProperty != null)
Collections.sort(children, new ReflectionComparator(sortProperty));
t.printElapsedTime("sorting children took");
Iterator i = children.iterator();
while(i.hasNext())
{
ContentVO vo = (ContentVO) i.next();
boolean hasUserContentAccess = true;
String useAccessRightsOnContentTreeString = CmsPropertyHandler.getUseAccessRightsOnContentTree();
if(useAccessRightsOnContentTreeString != null && useAccessRightsOnContentTreeString.equalsIgnoreCase("true"))
hasUserContentAccess = getHasUserContentAccess(this.infogluePrincipal, vo.getId());
if(vo.getName().equals("Meta info folder"))
{
try
{
hasUserContentAccess = AccessRightController.getController().getIsPrincipalAuthorized(this.infogluePrincipal, "ContentTool.ShowMetaInfoFolders", false, true);
}
catch (Exception e)
{
logger.warn("Problem getting access to meta info:" + e.getMessage(), e);
}
}
t.printElapsedTime("Access right took");
if(hasUserContentAccess)
{
BaseNode node = new ContentNodeImpl();
node.setId(vo.getId());
node.setTitle(vo.getName());
//String disableCustomIcons = CmsPropertyHandler.getDisableCustomIcons();
//if(disableCustomIcons == null || !disableCustomIcons.equals("true"))
node.getParameters().put("contentTypeDefinitionId", vo.getContentTypeDefinitionId());
if(vo.getIsProtected().intValue() == ContentVO.YES.intValue())
node.getParameters().put("isProtected", "true");
if(vo.getStateId() != null && vo.getStateId() < ContentVersionVO.PUBLISHED_STATE)
node.getParameters().put("stateId", "" + vo.getStateId());
t.printElapsedTime("Getting state took");
/*
try
{
Iterator languageVOListIterator = languageVOList.iterator();
while(languageVOListIterator.hasNext())
{
LanguageVO languageVO = (LanguageVO)languageVOListIterator.next();
ContentVersionVO latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(vo.getId(), languageVO.getId());
if(latestContentVersion != null && !latestContentVersion.getStateId().equals(ContentVersionVO.PUBLISHED_STATE))
{
node.getParameters().put("stateId", "" + latestContentVersion.getStateId());
break;
}
}
}
catch (Exception e)
{
logger.warn("A problem when fecthing latest master content version: " + e.getMessage(), e);
}
*/
if (vo.getIsBranch().booleanValue())
{
node.setContainer(true);
node.setChildren((vo.getChildCount().intValue() > 0));
ret.add(node);
}
else if(showLeafs)
{