cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice: i need a suggestion

alexey
Champ in-the-making
Champ in-the-making
Hello.
I need a suggestion about getting  properties from files in a defined space through Web Services.
Example: i have a files (file1, file2, file3) in the space "Some Space". How can i choose this space and get the files properties (e.g. name,description) recursively?
I tried to use Lucene Search, but it's not convenient for me. Can i find the space "Some Space" directly like XPath?
Or maybe could you suggest another best way?
Thank you.
3 REPLIES 3

lukateake
Champ in-the-making
Champ in-the-making
Without doing all the work, try fleshing out the following psuedocode:

Reference ref = new Reference(STORE, null, PATH_TO_SOME_SPACE);

QueryResult result = WebServiceFactory.getRepositoryService().queryChildren(ref);

if (result != null) {
   ResultSet rs = result.getResultSet();
   if (rs != null) {
      ResultSetRow[] rows = rs.getRows();
      if (rows != null) {
         for (ResultSetRow row : rows) {
            NamedValue[] namedValues = row.getColumns();
            for (NamedValue namedValue : namedValues) {
               System.out.println(namedValue.getName() + " (name) | " + namedValue.getValue()  + " (value)");

sisao
Champ in-the-making
Champ in-the-making
You can use XPath strings directly, just remember those use ISO9075 encoding for names.

alexey
Champ in-the-making
Champ in-the-making
Thank you vey much, lukateake!
sisao, could you give me a short example how to use XPath in this case? Thanks.