cancel
Showing results for 
Search instead for 
Did you mean: 

Facing problem in getting NodeRef from absolute path

awkhan
Champ in-the-making
Champ in-the-making
Hi,

I have created a user "Jack" using PersonService
psrvc.createPerson(contentProps);

I have verified using webclient, that user's folder gets created under /company_home/user home/Jack.     

Now I am trying to get NodeRef from absolute path which can be /company_home/user home/Jack,/company_home/user home/Jack/folder1,/company_home/user home/Jack/folder2 .

I am able to get the NodeRef for following path (/company_home/user home/)

ResultSet resultSet = searchService.query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore") ,   SearchService.LANGUAGE_LUCENE, "PATH:\"/app:company_home/app:user_homes\"");

but when I am trying to get Jack folder (/company_home/user home/Jack) with following query , the resultset is empty

ResultSet resultSet = searchService.query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore") ,   SearchService.LANGUAGE_LUCENE, :"PATH:\"/app:company_home/app:user_homes/cm:Jack\"");

OR the following also returns empty resultset

ResultSet resultSet = searchService.query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore") ,   SearchService.LANGUAGE_LUCENE, :"PATH:\"/app:company_home/app:user_homes/cm:Jack/cm:folder1\"");

Please let me know if I am doing anything wrong ?

Is there a better way to get NodeRef from absolute path with Alfresco API's (I know it can be done using JCR API's but looking for doing it using Alfresco API's)?

Thanks in advance.

arshad
2 REPLIES 2

janv
Employee
Employee
The home folder is a system folder, so you will need to use "sys" instead of "cm", eg.

PATH:"/app:company_home/app:user_homes/sys:Jack"
PATH:"/app:company_home/app:user_homes/sys:Jack/cm:folder1"

Regards,
Jan

awkhan
Champ in-the-making
Champ in-the-making
hi janv,

thanks for the clarification.

i have gone with using filefolderservice to simply and remove the complication.

thanks again for the help.

-arshad