cancel
Showing results for 
Search instead for 
Did you mean: 

how to retry Repository path location starting form content_url

peodrom
Champ in-the-making
Champ in-the-making
Hi to all,

using Alfresco DB I should retry information about the path in repository starting from content_url

for example if I have "store://2016/2/26/9/52/14cd3e4d-82dc-4de5-b7a0-05ebec18e53d.bin" i like to know that for Alfresco it is in
"Repository> Sites> my-site> my-folder> my-subfolder"


thanks
3 REPLIES 3

gravitonian
Star Collaborator
Star Collaborator
To resolve the display path do something like this:

NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "14cd3e4d-82dc-4de5-b7a0-05ebec18e53d");
NodeService ns = serviceRegistry.getNodeService();
PermissionService ps = serviceRegistry.getPermissionService();
String nodePath = ns.getPath(nodeRef).toDisplayPath(ns, ps);
String nodeName = (String)ns.getProperty(nodeRef, ContentModel.PROP_NAME);
String nodeLocation = nodePath + "/" + nodeName;

This assumes that the node is located in the workspace://SpacesStore (live content).

Note that "Repository> Sites> my-site> my-folder> my-subfolder", will resolve to Company Home/Sites/my-site/my-folder/my-subfolder. Company Home is the name of the top folder under the hood, not Repository.

peodrom
Champ in-the-making
Champ in-the-making
thanks Gravitonian, i will try this way.
do you know if there is also a sql query that can manage this point?

Hi,

There is probably a way to do this via SQL. However, it is not supported to access the database directly. Also, the schema can change and your code would then break.