get and ignore fm:discussion association in alfresco

cancel
Showing results for 
Search instead for 
Did you mean: 
ayushi_agrahari
Active Member II

get and ignore fm:discussion association in alfresco

I am trying to count the number of files present in a folder.It is working fine but the only problem that I am facing is that it also takes a comment as a file.So,the number of files increases on adding a comment and so it gives the wrong count of the number of files.

My java class for this is as follows-:

NodeSizeWebScript.java - Pastebin.com 

Further,what I have noticed is that a child association called fm:discussion of the parent folder is created that holds all the comments.So,plz tell me how to actually catch and ignore that child association of the parent folder in java

2 Replies
mehe
Senior Member II

Re: get and ignore fm:discussion association in alfresco

I use the Alfresco 5.2 REST search API with a query like

"query":"ANCESTOR:\"<folder node ref>\" AND TYPE:\"cm:content\""

wich gives me a json response with the total Number of items found:

{
"list": {
"pagination": {
"count": 100,
"hasMoreItems": true,
"totalItems": 1687,
"skipCount": 0,
"maxItems": 100
},...

kalpesh_c2
Senior Member

Re: get and ignore fm:discussion association in alfresco

Hi Ayushi

There are many ways to achieve your requirement but after looking to your class, best way would be to add set containing type of children expected.

Set<QName> types = new HashSet<QName>();
types.add(ContentModel. TYPE_CONTENT);
List<ChildAssociationRef> chilAssocsList = nodeService.getChildAssocs(childNodeRef,types); 

Thanks,

Kalpesh

ContCentric