AnsweredAssumed Answered

Performance issues - getChildAssocs alternatives

Question asked by dave984 on Aug 28, 2014
Latest reply on Sep 1, 2014 by dave984
Hi all, referring to the Alfresco NodeRef cookbook i retrieve all the files existing in a folder in this way:

List<ChildAssociationRef> filesFolderList = nodeService.getChildAssocs(folderNodeRef);
for (ChildAssociationRef file : filesFolderList) {
  NodeRef childRef = file.getChildRef();
  FileInfo fileInfo = fileFolderService.getFileInfo(childRef);
  if(fileInfo != null && !nodeService.hasAspect(childRef, Prop.MY_ASPECT)
     && !nodeService.hasAspect(childRef, Prop.MY_SECOND_ASPECT)
     && !fileInfo.isFolder()
     && !childRef.equals(actualDocumentRef)){          
    //do something

This works, but if the folder contains something like 1500 files we notice a deep performance slowdown.
Is there a way to optimize this?Do you have some suggestions?