AnsweredAssumed Answered

CmisObjectNotFoundException: how to get documentLibrary folder?

Question asked by Aleksey Bykov on Oct 8, 2017
Latest reply on Oct 9, 2017 by Aleksey Bykov

I'm using Alfresco Community v5.2 and trying to create a folder on the site by using Apache Chemistry OpenCMIS API.

 

Let's say, the test-folder on the test site (I can create that folder in company_home). For that, I'm trying to get the root folder as follows:

 

private Folder getDocLibFolder(Session cmisSession) {
    String docLibPath = "...";

    // here I get the exception
    Folder docLibFolder = (Folder) cmisSession.getObjectByPath(path);

    return docLibFolder;
}

 

Paths that I tried to use:

 

/Sites/test/documentLibrary/test-folder
/Sites/test/documentlibrary/test-folder
/Sites/test/test-folder
/company_home/Sites/test/documentLibrary/test-folder
/company_home/Sites/test/documentlibrary/test-folder
/company_home/Sites/test/test-folder

 

In all cases, I get this exception (/Sites/test/test-folder - as an example here):

org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /Sites/test/test-folder

 

By using the Node Browser I can see the content of the documentLibrary folder:

 

SELECT * 
FROM cmis:document
WHERE CONTAINS('PATH:"/app:company_home/st:sites/cm:test/cm:documentLibrary//*"')

 

To get the session I'm using this method:

 

private Session getCmisSession() {
    SessionFactory factory = SessionFactoryImpl.newInstance();
    Map<String, String> conf = new HashMap<>();

    conf.put(SessionParameter.ATOMPUB_URL, ATOMPUB_URL);
    conf.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    conf.put(SessionParameter.USER, USER_NAME);
    conf.put(SessionParameter.PASSWORD, PASSWORD);
    conf.put(SessionParameter.OBJECT_FACTORY_CLASS, OBJECT_FACTORY_CLASS);

    List<Repository> repositories = factory.getRepositories(conf);
    Repository cmisRepository = repositories.get(0);

    conf.put(SessionParameter.REPOSITORY_ID, cmisRepository.getId());
    cmisSession = factory.createSession(conf);

    return cmisSession;
}

Where:

 

ATOMPUB_URL == "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom" (1.0, without 'public' too)
OBJECT_FACTORY_CLASS == "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl"

 

What am I doing wrong?..

I would be very grateful for the information. Thanks to all.

Outcomes