I am trying to get the node ref of file uploaded to default root directory in my java class.
I tried this link.
But it is returning empty result set. How can I write search query to get the particular file node. Or Is there any way to create node ref from sting in java class.
My code :
NodeRef companyHomeNodeRef = null;
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE,
"SpacesStore");
ResultSet rs = searchService.query(storeRef,
SearchService.LANGUAGE_LUCENE, "\\\"/app:company_home/app:user_homes/sys:boris/cm:mypics\\");
try {
System.out.println("length :" + rs.length());
if (rs.length() == 0) {
// throw new Exception("Didn't find Company Home");
} else {
companyHomeNodeRef = rs.getNodeRef(0);
}
} finally {
rs.close();
}
thanks
I have resolved the issue. Below is code to create node ref of file from node ref string and update the content of file.