How to select a document whit a specific child?

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

How to select a document whit a specific child?

I have a set of documents where some of them have a child (associtaion type "ecmccontent:content_origin") and some of them don't have such child association. I need a result set of documents without such association, how to do that (in any query language)? Thank you!

3 Replies
Highlighted
Partner

Re: How to select a document whit a specific child?

Hi,

To my mind your case is caused by a conception/modelization problem. You have to find documents which don't have a particular property instead searching documents having a particular property.

In other words, "searching documents you want" will be more simple than "searching ones you don't want and next search for the others".

Maybe what I say is wrong but I think that whatever your algorithm, you will have to loop into your results to check if your documents have this association or not.

In order to code that, I think Java API will be more helpful than Javascript because Java API offers more functions : http://dev.alfresco.com/resource/AlfrescoOne/5.2/PublicAPI/overview-summary.html

I'm not an expert in development but maybe  DictionaryService class could help you :
http://dev.alfresco.com/resource/AlfrescoOne/5.2/PublicAPI/org/alfresco/service/cmr/dictionary/Dicti...

Hope it helps.

Highlighted
Active Member

Re: How to select a document whit a specific child?

The subject was to select a document with the specific association via single query and there is no method to do it in the single query.

Highlighted
Intermediate II

Re: How to select a document whit a specific child?

I'm afraid three is no such query .
you can try to add a custom property to your document and use this custom property to save the number of associations .
When you update the association ,you also update this property.
For documents withou association  ,the property value is 0 or null.
As for existing data ,you need to write code to update it one bye one.