Hello,i'm trying to create associations using CMIS on Java.my "model.xml" is this:<aspect name="myCustomSpaceName:expediente">
<title>Associate to expedient</title>
<associations>
<association name="myCustomSpaceName:clientsProduct">
<title>Associated customers</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>myCustomSpaceName:cliente</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
If I do the association using JavaScript I have not problem:
var expediente = companyhome.childByNamePath("/Delegaciones/0001 - Barcelona/Negocio/Expedientes/EXPH100001");
var cliente = companyhome.childByNamePath("/Delegaciones/0001 - Barcelona/Negocio/Clientes/12345678N");
expediente.createAssociation(cliente, "myCustomSpaceName:clientsProduct");
This code works fine.But I need to create the association using CMIS. But if I use CMIS on Java (using Apache Chemistry 0.6.0 client libraries), I can't do it. After I connect successfully using Session class, I'm triyng to do the association with this Java Code:
Folder carpetaExpediente = (Folder)session.getObjectByPath("/Delegaciones/0001 - Barcelona/Negocio/Expedientes/EXPH100001");
Folder carpetaCliente = (Folder)session.getObjectByPath("/Delegaciones/0001 - Barcelona/Negocio/Clientes/12345678N");
Map<String, String> propiedades = new HashMap<String, String>();
propiedades.put(PropertyIds.SOURCE_ID, carpetaExpediente.getId());
propiedades.put(PropertyIds.TARGET_ID, carpetaCliente.getId());
propiedades.put(PropertyIds.OBJECT_TYPE_ID, "myCustomSpaceName:clientsProduct");
//I try also with propiedades.put(PropertyIds.OBJECT_TYPE_ID, "R:myCustomSpaceName:clientsProduct"); but do not works.
session.createRelationship(propiedades, null, null, null);
I obtain the next stack trace:
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Bad Request
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createRelationship(ObjectServiceImpl.java:237)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createRelationship(SessionImpl.java:805)
at es.privatbank.alfresco.CMISPrivatTest.crearAsociacionEnCarpeta(CMISPrivatTest.java:243)
at es.privatbank.alfresco.CMISPrivatTest.test(CMISPrivatTest.java:56)
at es.privatbank.alfresco.CMISPrivatTest.main(CMISPrivatTest.java:36)
Someone can help me? Pleaseeee!! I can't solve the problem!!