cancel
Showing results for 
Search instead for 
Did you mean: 

How can I show associations in the search?

rleones
Champ in-the-making
Champ in-the-making
Is it possible to filter the search by associated types?

Suppose I have two content-type (employee and role). Employee has a association to the actual role, something like this:

<type name="rl:employee">
   <title>Employee</title>
   <parent>cm:content</parent>

   <associations>
      <association name="rl:actualRole">
         <title>Actual Role</title>
         <source>
            <mandatory>false</mandatory>
            <many>true</many>
         </source>
         <target>
            <class>rl:role</class>
            <mandatory>false</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>

</type>

So, I would like to retrieve the employees that have the role X. Is it possible? How can I do this?
1 REPLY 1

amitabhandari1
Champ in-the-making
Champ in-the-making
Hi Rleones ,

There is no direct way to get search employee with specific role .
You can search  using nodeService api.

Below is the method you can use:
public List<AssociationRef> getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)


targetRef = find the noderef of role which you want to search
qnamePattern = qname of the association

Thanks,