cancel
Showing results for 
Search instead for 
Did you mean: 

getChildAssocs(NodeRef) not returning all child nodes?

fnduy
Champ in-the-making
Champ in-the-making
Hello,

I am using Alfresco 2.1 Community, and I am trying to retrieve all the child nodes of a folder (sourceDir). So I use this code:

ApplicationContext context = ApplicationContextHelper.getApplicationContext();
ServiceRegistry serviceRegistry = (ServiceRegistry) context.getBean(ServiceRegistry.SERVICE_REGISTRY);
NodeService nodeService = serviceRegistry.getNodeService();
List<ChildAssociationRef> sourceChildNodesRef = nodeService.getChildAssocs(sourceDir);

The folder contains a relatively large number of file (325 files), but nodeService.getChildAssocs only returns 270 files. If I run the program in debug mode (with eclipse), I only have about 40 files (?!).

Has anyone got this problem?

Thank you in advance for any help.
8 REPLIES 8

kevinr
Star Contributor
Star Contributor
What users are you logging in as? Permissions are applied to the nodes and they are filtered out if the user does not have at least READ. Also, are you pointing to the same alf_data store when in debug mode?

Thanks,

Kevin

sidra
Champ in-the-making
Champ in-the-making
Hello,
   please tell how to use ApplicationContext..is that a class you created? If so, please show me how it looks like..
My problem is that i don't know how to give the path to a node, root for example, and involving this, what should be done before that..
I need to list the files of a folder, and also the files for a specific user..

Thank you,
   sidra

calle
Champ in-the-making
Champ in-the-making
I have a similar error. I call getChildAssocs() on a ScriptNode object and when not running in debug mode (-Xdebug) I always get a NullPointer at org.alfresco.repo.jscript.ScriptNode.getChildAssocs(ScriptNode.java:510). But when debugging and stepping through the code I retrieve all the child associations (which are expected to be there…) Looking at the code in ScriptNode it seems most likely that the current javascript context is null when not stepping.

(I am running Alfresco Enterprise 2.2)

//Carl

calle
Champ in-the-making
Champ in-the-making
An issue has been reported on this, see http://issues.alfresco.com/jira/browse/ALFCOM-1666

d_segato
Champ in-the-making
Champ in-the-making
i don't think that NPE is related with the problem reported by fnduy

we had similar problem with WCM deployments report.
we implemented a method to automatically deploy all submitted contents and after only 7 days we started to notice performance issues and strange behavior including errors.

we investigated the problem and found out that the performance issue was caused by "too much deployment reports inside the webproject node" and the strange behavior/errors was caused by the getChildAssocs() not returning all nodes but only "someone of them" apparently at random.

it seems like if there is a timeout somewhere on that call that stop extracting child when it is reached.
This means, for example, that when you cycle the webproject children to search for webusers or webforms you may not found some of them or, if there are many many reports (as in our case) you may either not found any of them at all.

may be this is something related to the Database+Alfresco (which is oracle for us) or Architecture+Alfresco, we don't know at the moment.
We are further investigating and then we will officially report the issue to alfresco.

Please provide any additional information on that issue, did you solved it? what database were you using? On which operating system (our was Linux)?
we are using the 2.2 enterprise sp4.

kevinr
Star Contributor
Star Contributor
You are correct there is a timeout that will cause this - you can modify these properties from repository.properties by overriding them using the usual extension pattern:

#
# Properties to limit resources spent on individual searches
#
# The maximum time spent pruning results
system.acl.maxPermissionCheckTimeMillis=10000
# The maximum number of results to perform permission checks against
system.acl.maxPermissionChecks=1000

Cheers,

Kev

d_segato
Champ in-the-making
Champ in-the-making
I see…
Thank you Kevin.
I was aware of this issue on the DM but I never encounter it since I've always worked with WCM 2.1 until lately.

Increasing that value would only delay our problems to a later time (when deploymentattempts will be enough to brake the new limit)

If I use the unprotected node service (not proxed) it should always return me all the results, right? (either nodeService and Lucene)

I think we have a bug here with deployment attempts management but this is off topic so I will not discuss this further here.

kevinr
Star Contributor
Star Contributor
The unprotectednodeservice will be much faster and yes will not be impacted by permission checks.

Thanks,

Kev