cancel
Showing results for 
Search instead for 
Did you mean: 

Retrive path by db

mikmontana
Champ in-the-making
Champ in-the-making
Hi all,

I'm trying to get the physical path of a file stored in alfresco repository by a query on db of alfresco.
I found the url_content in table alf_content_url. This table is related to alf_content_data by alf_content_data.content_url_id = alf_content_url.id.
How can I have the relation between alf_node and alf_content_data??
I have an alfresco 3.4 platform with postgre.

Regards.
2 REPLIES 2

sglover
Champ in-the-making
Champ in-the-making
Why do you need to know the physical path? The ContentService and rest apis should be used to manage content (bear in mind that the system manages the content and bypassing it in any way by altering content is likely to interfere with its proper management).

Having said that, content urls are stored in the database as content node properties of type "{http://www.alfresco.org/model/dictionary/1.0}content" (the standard one being "{http://www.alfresco.org/model/content/1.0}content") and are of the form "store://….". This is mapped onto a physical location in the content store by the content store abstraction, one implementation of which is the FileContentStore (see here for more information http://wiki.alfresco.com/wiki/Content_Store_Configuration). In the case of the FileContentStore,
the url part after the "//" is the relative path of the content in the content store on the filesystem.

Given a node id, the following SQL will give you the content url:


select n.id, u.content_url
from alf_node n, alf_node_properties p, alf_namespace ns, alf_qname q, alf_content_data d, alf_content_url u
where n.id = p.node_id
and q.local_name = 'content'
and ns.uri = 'http://www.alfresco.org/model/content/1.0'
and ns.id = q.ns_id
and p.qname_id = q.id
and p.long_value = d.id
and d.content_url_id = u.id
and n.id=<node id>

If you have the node ref of the node, you could use n.store_id and n.uuid instead of the node id.

ggrall
Champ in-the-making
Champ in-the-making
thank you for this request, that's exactly what i was searching