06-13-2012 04:17 AM
<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>
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.
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);
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)
06-14-2012 06:03 AM
06-21-2012 08:35 AM
I think this post could help you
https://forums.alfresco.com/en/viewtopic.php?f=45&t=27219
Also there is one more problem in your code.
If you want to create association then some where in your code you have to use both the references of folder altogether.
O/W how does it takes which folder to be associated with which one.
Also there is one more problem in your code.
If you want to create association then some where in your code you have to use both the references of folder altogether.
O/W how does it takes which folder to be associated with which one.
06-22-2012 01:13 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.