AnsweredAssumed Answered

Search for a Node

Question asked by luisg on Jun 26, 2009
Latest reply on Sep 7, 2009 by luisg
Hi there
I'm trying to do a Web Service that can get the path for a Node. I did this:

protected static ResultSet getResultSpace(String idNode){
      ResultSet result = null;
      
      String searchQuery = "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:\"" + idNode+ "\"";
      Query query = new Query();
                query.setLanguage(Constants.QUERY_LANG_LUCENE);
                query.setStatement(searchQuery);
       
        try {
            QueryResult resultQuery = WebServiceFactory.getRepositoryService().query(STORE, query, false);
            result = resultQuery.getResultSet();
           
            //imprime os resultados
            ResultSetRow[] rows = result.getRows();
            System.out.println("–>"+rows.length);
        }
        catch(Exception e){}
       
        return result;
}

All the folders in Alfresco have different names.
The thing is, if I search for a Node with name 'id123', I will get some nodes I dont want. eg: 'id', '123', 'id123456'.
The method I create return all the results that have, as sub-string, the given string, but I just want the space with full name equals to the given string, so I will ALWAYS get 1 result.

One more thing…
With this method I get a path like this:
/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1.0}folderX/{http://www.alfresco.org/model/content/1.0}id.123
from the resultSetRow.path.
How can I get this path as: /app:company_home/cm:folderX/… ?

Can somebody help me?

Thanks
Luis

Can you help me?

Outcomes