CMIS find a folder for object path

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

CMIS find a folder for object path

Jump to solution

I have the below findFolder method, when I pass the path I am not able to find the folder. Please can you let me know what the path should be or what is incorrect below.

I have a folder at the path specified.

FindFolder method

public static Folder findFolder(@NotNull Session session, @NotNull String path) throws FolderNotFoundException{
    CmisObject obj = session.getObjectByPath(path);
    if(obj instanceof Folder){
        return (Folder)obj;
    }else{
        throw new FolderNotFoundException("The path " + path + " does not return reference to a folder");
    }
}

Test class

String user = "admin";
String pwd = "admin";
String serviceUrl = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser";
Session session = SessionManager.getInstance().createSession(new SessionContext(user, pwd, serviceUrl));
try {
    Folder folder = FolderService.findFolder(session, "/app:company_home/st:sites/cm:testsite/cm:documentLibrary/cm:Contracts");
    assertNotNull(folder);
} catch (FolderNotFoundException e) {
    e.printStackTrace();
}

Exception

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /app:company_home/st:sites/cm:test-site/cm:documentLibrary/cm:Contracts
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.convertStatusCode(AbstractBrowserBindingService.java:296)
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.read(AbstractBrowserBindingService.java:410)

1 Solution

Accepted Solutions
Highlighted
Alfresco Employee

Re: CMIS find a folder for object path

Jump to solution

"app:company_home" is known as "/" for CMIS.

Try typing "/Sites/Test Site/documentLibrary/Contracts" or so.

Software Engineer in Alfresco Search Team.

View solution in original post

1 Reply
Highlighted
Alfresco Employee

Re: CMIS find a folder for object path

Jump to solution

"app:company_home" is known as "/" for CMIS.

Try typing "/Sites/Test Site/documentLibrary/Contracts" or so.

Software Engineer in Alfresco Search Team.

View solution in original post