AnsweredAssumed Answered

busqueda por propiedad

Question asked by ijr87 on May 6, 2010
Latest reply on May 10, 2010 by ijr87
hola estoy intentando hacer una funcion que pasandole una propiedad me hiciera la busqueda del documento y me retornara el objeto documento. Tengo echo este codigo de prueba, no me da errores pero me parece que no me hace bien la busqueda, alguien me puede ayudar?


public void search(docEv document, String path) {
   
      
      try {
         WebServiceFactory.setEndpointAddress("http://...:8080/alfresco/api");
         AuthenticationUtils.startSession("admin", "admin");

         Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
         RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory
         .getRepositoryService("http://...:8080/alfresco/api");
      
         Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"" +path + "AND TYPE:\"@ev\\:IDdoc:" + document.getIDdoc());
         QueryResult queryResult = repositoryService.query(storeRef, query, false);
       
         // Display the results
         ResultSet results = queryResult.getResultSet();
         ResultSetRow[] rows = results.getRows();
       
         System.out.println("La busqueda da algo asi:");
         if(rows != null){
            for(ResultSetRow row : rows){
                                   for (NamedValue namedValue : row.getColumns()){
                                          if (namedValue.getName().endsWith(Constants.PROP_CREATED) == true)
                                                     System.out.println(namedValue.getValue());
                                          if (namedValue.getName().endsWith(Constants.PROP_NAME) == true)
                                                     System.out.println(namedValue.getValue());
                                          else if (namedValue.getName().endsWith(document.getDescripcio())== true)
                                                     System.out.println(namedValue.getValue());
                                   }
            }
         }
      }catch (Exception e) {
         e.printStackTrace();
      } finally {
         // tanca sessió
         System.out.println("Desconectant…");
         AuthenticationUtils.endSession();
      }

}

Outcomes