cancel
Showing results for 
Search instead for 
Did you mean: 

Can the association order be defined?

alr
Champ in-the-making
Champ in-the-making
Hello,

I am currently doing a project using a lot of associations. The order of these associations is very important to me, because I am using things like "element.assocs['ns:elementAssoc'][0]" in my freemarker templates. Now, if I want to keep my template in shape, but instead just switching my first association of "element", can I do this with the Java API? It seems that nodeService.createAssociation() simply appends to the currently existing associations.

However, simply debugging into the createAssociation method didn't really prove successful yet, as some library either changes the bytecode (spring aop maybe) or the source code supplied with the SDK of Alfresco Labs 3b is not the correct one.

So any hints and tips, how I could force a certain order of Associations - or how I could just exchange two associations - are gratefully accepted.

Thanks and have a nice day.


–Alexander
2 REPLIES 2

tommorris
Champ in-the-making
Champ in-the-making
Perhaps removing all the associations and adding them again in the correct order might help.
Not sure this is a good idea - it may have knock-on effects.

Tom

alr
Champ in-the-making
Champ in-the-making
Hi

I considered this as a last resort solution, as you have to parse all associations, and remove all (if you want to replace the first one), only to add them again. But right now, there does not seem another possibility.


–Alexander