Create associations to custom object types

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2012 04:17 AM
Hello,
i'm trying to create associations using CMIS on Java.
my "model.xml" is this:
If I do the association using JavaScript I have not problem:
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:
I obtain the next stack trace:
Someone can help me?
Pleaseeee!! I can't solve the problem!!
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!!
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2012 06:03 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.
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.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Thank you mitpatoliya for your response!!
But I don't understand very good your utterance. Could you be more specific with this phrase?
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2012 01:13 AM
I don't see anything wrong with your code after a quick scan. Note that the relationship name definitely needs to be "R:myCustomSpaceName:clientsProduct".
Can you create two fresh objects you haven't tested with and try again using the "R:myCustomSpaceName:clientsProduct" name for the relationship?
Jeff
Can you create two fresh objects you haven't tested with and try again using the "R:myCustomSpaceName:clientsProduct" name for the relationship?
Jeff
