Posted By

wearetherock on 01/12/10


Tagged

alfresco


Versions (?)

Alfresco: List Directory


 / Published in: Java
 

  1. package sample;
  2.  
  3. import java.rmi.RemoteException;
  4.  
  5. import org.alfresco.webservice.repository.QueryResult;
  6. import org.alfresco.webservice.repository.RepositoryFault;
  7. import org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub;
  8. import org.alfresco.webservice.types.*;
  9. import org.alfresco.webservice.util.*;
  10.  
  11. public class TestBrowse {
  12.  
  13. public static void main(String args[]) throws RepositoryFault, RemoteException {
  14.  
  15. AuthenticationUtils.startSession("admin", "admin1234");
  16. RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory
  17. .getRepositoryService("http://localhost:8080/alfresco/api");
  18.  
  19. Store store = new Store(Constants.WORKSPACE_STORE,"SpacesStore");
  20. Reference myFolder = new Reference(store,null,"/app:company_home/cm:sample_folder");
  21.  
  22. QueryResult queryResult = repositoryService.queryChildren(myFolder);
  23. ResultSet resultSet = queryResult.getResultSet();
  24.  
  25. ResultSetRow[] rows = resultSet.getRows();
  26. for (ResultSetRow row : rows) {
  27. System.out.println("UID: " + row.getNode().getId());
  28. System.out.println("Type: " + row.getNode().getType());
  29. NamedValue[] values = row.getColumns();
  30. System.out.println("Properties: ");
  31. for (NamedValue col : values) {
  32. System.out.println("\tName: " + col.getName());
  33. System.out.println("\tValue: " + col.getValue());
  34. }
  35.  
  36. }
  37. }
  38. }

Report this snippet  

You need to login to post a comment.