Hi all,I have defined an association that relates a 'DocsAdmin' type content to 'Invoice' type content:
<type name="inv:DocsAdmin">
<title>Admin Documents</title>
<parent>cm:content</parent>
<properties>
<property name="inv:date">
<title>Fecha</title>
<type>d:date</type>
</property>
<property name="inv:type">
<title>Tipo</title>
<type>d:text</type>
</property>
</properties>
<mandatory-aspects>
<aspect>inv:docsAssocs</aspect>
</mandatory-aspects>
</type>
<aspect name="inv:docsAssocs">
<associations>
<association name="inv:relatedInvoices">
<title>Facturas relacionadas</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>inv:invoice</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
I have created a custom dialog to create and remove relationships of this association. Basically, the dialog retrieves all 'inv:relatedInvoices' associations of a document for display to the user and saves new associations that user sets.This is the code used to save associations:
//associationsIni = list of retrived associations of the document
for(NodeRef assocFile: this.associations){
if(!this.associationsIni.contains(assocFile)){
this.getNodeService().createAssociation(this.editableNode.getNodeRef(), assocFile, ASSOC_FRAS);
}
}
//associations = list of associations set by user
for(NodeRef assocFile: this.associationsIni){
if(!this.associations.contains(assocFile)){
this.getNodeService().removeAssociation(this.editableNode.getNodeRef(), assocFile, ASSOC_FRAS);
}
}
Well, it´s work fine. I have a custom action for each invoice type content to show all documents associated with it. That is, retrieve documents related to the inverse of the following way:
List<AssociationRef> associationRefList=
this.getNodeService().getSourceAssocs(this.currentNode.getNodeRef(), Constants.ASSOC_INVOICE);
This action shows the associations created. The problem is when the user deletes one of them, the action continues to show the relationship removed. Why is this? The association is defined for the 'DocsAdmin' type. If the user deletes the association of a document of the 'DocsAdmin' type, should not be completely removed? Should we also remove the relationship in the other document of 'Invoice' type?Thanks a lot in advance