cancel
Showing results for 
Search instead for 
Did you mean: 

How to search for all sub folders in a folder using CMIS

archimadhu86
Champ in-the-making
Champ in-the-making
Hi,

I am using Alfresco v4.1 and cmis v0.13 jar files.

I want to know 2 things:

1)How do I find list of Sites in root folder
2) How do I find list of sub folders in a folder?

I tried following but I got exceptions –


CmisObject object = cmisSession.getObject(cmisSession.createObjectId(folderId));
        Folder folder = (Folder)object;
        OperationContext operationContext = cmisSession.createOperationContext();
        operationContext.setMaxItemsPerPage(maxItemsPerPage);

        ItemIterable<CmisObject> children = folder.getChildren(operationContext);
         for(CmisObject child :children){
             System.out.println(child.getName());
         }


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/TransientCmisObject
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:348)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:523)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:493)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:485)
   at com.alfresco.api.example.CmisBasicQuery.doQuery(CmisBasicQuery.java:37)
   at com.alfresco.api.example.CmisBasicQuery.doExample(CmisBasicQuery.java:23)
   at com.alfresco.api.example.CmisBasicQuery.main(CmisBasicQuery.java:19)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.apache.chemistry.opencmis.client.api.TransientCmisObject
2 REPLIES 2

rahulmackdani
Champ in-the-making
Champ in-the-making
Hi

You can get list of children using

Iterator <CmisObject> objectList = folder.getChildren().iterator();
         while(objectList.hasNext()){
            CmisObject object = objectList.next();
            if(object instanceof Folder){
               //folder logic
            }
            else if(object instanceof Document){
               //file logic
            }
         }
         
Also verify CMIS URL.Use CMIS 1.1 URL

I have fixed problem by adding JAR chemistry-opencmis-client-impl-0.13.0.jar to project
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.