AnsweredAssumed Answered

Removing association -> Integrity violation

Question asked by calle on Oct 24, 2008
Latest reply on Oct 24, 2008 by calle
On a type I have the association

<aspect name="tk:relatedDocuments">
                    <title>Related documents</title>
                    <associations>
                                  <association name="tk:relateByAssocation">
                                               <title>Associated documents</title>
                                               <target>
                                                       <class>ver:version</class>
                                                       <mandatory>false</mandatory>
                                                       <many>true</many>
                                               </target>
                                  </association>
                    </associations>
</aspect>

Essentially this is only used for creating references between content.

The association is populated by a search and when a new search is conducted the old associations should be replaced with new ones. And this is resulting in a integrity violation:
The association source multiplicity has been violated:
   Target Node: workspace://lightWeightVersionStore/dba1ad09-a10f-11dd-9061-815ef8c051c2
   Association: Association[ class=ClassDef[name={http://www.jonkoping.se/alfresco/model/tk}relatedDocuments], name={http://www.jonkoping.se/alfresco/model/tk}relateByAssocation, target class={http://www.alfresco.org/model/content/1.0}content, source role=null, target role=null]
   Required source Multiplicity: 1..1
   Actual source Multiplicity: 0

The code to delete the association is as follows:
nodeService.removeAssociation(a.getSourceRef(), a.getTargetRef(), JkpTkModel.ASSOC_RELATE_BY);
where "a" is the association.

The same error occurs if I try to delete the association in the contents property sheet so my guess it is not in the code but in the model…

//Carl

Outcomes