Wednesday, August 1, 2012

Creating Bookmarks/Links with Alfresco

A link to a file (bookmark) is of type "app:filelink" (which extends the base 'cm:link' type). The object has a single NodeRef value property called "cm:destination" which you set to the object you wish to link to -that's it.

Creating a link to a folder is very similar expect you create a node of type "app:folderlink" and set the same property.

Application-model.xml
FILE BOOKMARK
<type name="app:filelink">
<title>File Link Object</title>
<parent>cm:link</parent>
</type>
FOLDER BOOKMARK
<type name="app:folderlink">
<title>Folder Link Object</title>
<parent>cm:link</parent>
</type>

Content-model.xml
<type name="cm:link">
<title>Link Object</title>
<parent>cm:cmobject</parent>
<properties>
<property name="cm:destination">
<title>Link Destination</title>
<type>d:noderef</type>
<mandatory>true</mandatory>
</property>
</properties>
</type


It will show up in share like another document in the document library.  Clicking on the link will open the referenced document or folder in the details view.