cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the value of Node association?

jlbarrera
Champ in-the-making
Champ in-the-making
Hello

I want to get the value of Node association, for example:

If a Node has the translatable aspect, i want get the association:

<association name="cm:translations">
               <title>Translations</title>
               <source>
                  <role>cm:translationOf</role>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <role>cm:hasTranslation</role>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>

thanks!
1 REPLY 1

jlbarrera
Champ in-the-making
Champ in-the-making
Ok i have solved the problem:

List asociaciones = (List)ref.getAssociations().get(Repository.resolveToQName("translations"));

while (iter.hasNext()){
         AssociationRef assoc = (AssociationRef)iter.next();
         NodeRef target = assoc.getTargetRef();
         String associationName = Repository.getNameForNode(nodeService,target);

}