cancel
Showing results for 
Search instead for 
Did you mean: 

getRelatedAssets() and associations

dsaum
Champ in-the-making
Champ in-the-making
Trying to display some associations I've created and populated in Share/Alfresco through the WCMQS API.

I defined the association (salesRep) against an aspect (salesTerritory) as follows:

<aspect name="sagedoc:salesTerritory">
   <title>Sales Territory (State)</title>
   <associations>
      <association name="sagedoc:reps">
         <source>
            <mandatory>false</mandatory>
            <many>true</many>
         </source>
         <target>
            <class>sagedoc:salesRep</class>
            <mandatory>false</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>
</aspect>

This part works well. I'm able to go into share, create a salesTerritory and assign it some reps.

The problem, however, is display this relationship through the WCMQS API.

I have a reference to an instance of an Asset representing the territory. I expect that when I call getRelatedAssets() with no args or getRelatedAssets("sagedoc:reps") I should get back either a map or a collection containing the reps I've assigned to this territory.

What I get, however, is an empty collection if I provide an arg and a null result if I call the method with no args.

Does Asset.getRelatedAssets() method not provide access to the underlying associations?

Does it only provide access to a subset that have been defined in the WCMQS model?

Is there another way to access the associations I've defined?

Thanks a lot!
4 REPLIES 4

bremmington
Champ on-the-rise
Champ on-the-rise
Please would you tell me what version of Alfresco you are using?

dsaum
Champ in-the-making
Champ in-the-making
Hi Brian,

I'm using 3.4.d

bremmington
Champ on-the-rise
Champ on-the-rise
Thanks. I'll try to take a look at this tomorrow. I know that the code on HEAD at the moment handles relationships quite differently, and I think what you're seeing may be due to the way CMIS handles relationships that are defined on aspects, since aspects aren't directly supported by CMIS. The code on HEAD currently no longer uses CMIS when reading relationships, and that's one of the reasons why not.

As I say, I'll take a look just to refresh my memory, but it may be a case of either moving your association definition onto a type rather than an aspect, or waiting to take a new cut from HEAD. If the latter then I would suggest waiting for a week or two, as we have just finished merging another code line onto HEAD, and that normally causes a few issues that need ironing out.

dsaum
Champ in-the-making
Champ in-the-making
Thanks again Brian.

I'll try defining the association against a type for the time being.