cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a link between external object and documents in Alfresco?

tis
Champ in-the-making
Champ in-the-making

Hello to everybody!

I'm a newcomer in alfresco. I use CMIS to work with Alfresco repository in my java application.

Have anybody encountered with the issue when you need to create a link or reference between some external object and corresponding documents in alfresco repository?

For instance, an external object could be a record in database, which describes, for example, some product. And in alfresco we have commercial documents which should be linked with this product.

Thanks in advance.

1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator

For each product you can create a dedicated space in Alfresco where you drop contents related to the product.

Then you can bind in your external database the node reference of the product space in Alfresco.

The node reference (NodeRef) is the unique identifier for each content (node) in Alfresco and for any content you can see its own noderef in the URL when you try to see the details of a node. A NodeRef consists of three sections:

Store Protocol + Store Identifier (or name) + UUID

An example of node reference could be:

workspace://SpacesStore/e8137d5d-cf50-41c4-844a-ec98a44ee73a

In this way you can execute CMIS SQL query for the product by NodeRef as the following:

SELECT *

FROM cmis:document

WHERE cmis:objectid = 'e8137d5d-cf50-41c4-844a-ec98a44ee73a'

Another way is to get the space using the Session object of the OpenCMIS library:

Folder folder = session.getObject(uuid);

Then you can get all the children of the result node:

Folder folder = session.getObject(uuid);

for (CmisObject child: folder.getChildren()) {

   System.out.println(child.getName());

}

Hope this helps Smiley Happy