AnsweredAssumed Answered

Listing the repo

Question asked by sledwich on Jan 10, 2008
Latest reply on Jan 10, 2008 by sledwich
I have originally posted this
I am new to alfresco and tried everywhere to find out how to iterate through the repository using the soap interface but so far can only see the Query interface which is not really an iterative process.


I just want to iterate the tree to put all the contents in the repository into a java tree.

Can anybody point me in the right direction thanks.
to the prog env. which is the wrong place I think (sorry for that)

I need to put the entire contents of the SpacesStore into a java tree and I am using soap. So far I have managed to find

        Reference reference = new Reference(STORE, null, "/app:company_home/*[@cm:name=\"" + spaceName + "\"]");
       
        Predicate predicate = new Predicate(new Reference[]{reference}, null, null);

        Node[] nodes = repositoryService.get(predicate);
       
        Query query = new Query(
                Constants.QUERY_LANG_LUCENE,
                "+PARENT:\"workspace://SpacesStore/"+ nodes[0].getReference().getUuid() + "\"");
       
        // Execute the query
        QueryResult queryResult = repositoryService.query(STORE, query, false);
       
        // Display the results
        ResultSet resultSet = queryResult.getResultSet();
        ResultSetRow[] rows = resultSet.getRows();
       
        if (rows != null)
        {
            // Get the infomation from the result set
            for(ResultSetRow row : rows)
            {
                String nodeId = row.getNode().getId();
//                ContentResult contentResult = new ContentResult(nodeId);
               
                for (NamedValue namedValue : row.getColumns())
                {
                   System.out.println(namedValue.getName()+"  :  "+namedValue.getValue());
                 if(namedValue.getName().endsWith(Constants.PROP_NAME) == true )
                 {
                       TreeItem item = new TreeItem( treeMailMerge, SWT.NONE );
                       item.setText(namedValue.getValue());
   
                 }
                        }
           }
        }
   }

This code will list me the contents of a particular folder which I can iteratively work through but When I change the folder name to * it does not work it reports an exception saying the line
Node[] nodes = repositoryService.get(predicate);
only supports a single reference. I am stuck and ANY help would be really appreciated. Thanks in advance.

Outcomes