cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS find a folder for object path

kartech11
Confirmed Champ
Confirmed Champ

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 ACCEPTED ANSWER

angelborroy
Community Manager Community Manager
Community Manager

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

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

Hyland Developer Evangelist

View answer in original post

1 REPLY 1

angelborroy
Community Manager Community Manager
Community Manager

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

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

Hyland Developer Evangelist