I am using the openCMIS library against a cmis 1.0 compliant server and I noticed that whenever I call getRepositories on the server (an alfresco v3.2 & v5.0 server) I only receive a list with one repository as opposed to what I was expecting, i.e. the list of roots on the server. How do I retrieve the list of repository roots using the opencmis library?
EDIT
I inappropriately phrased the question so I will explain better.
What I would like to do is to be able to get the actual repository root id
(i.e. store_root in alfresco for instance) NOT the root folder id
, such that I can leverage that against the api to retrieve it's direct children i.e. objects at the same hierarchical level as root folder (Company Home in alfresco)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Alfresco only has one repository, so what you are seeing is correct.
To understand how to get the root folder (which is Company Home), then how to get the root folder's children, see here.
回答2:
worked fine for me test it : first you have to create a session and connect it with this :
private static Session getSession(String serverUrl, String username, String password) {
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> params = new HashMap<>();
params.put(SessionParameter.USER, username);
params.put(SessionParameter.PASSWORD, password);
params.put(SessionParameter.ATOMPUB_URL, serverUrl);
params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
List<Repository> repos = sessionFactory.getRepositories(params);
if (repos.isEmpty()) {
throw new RuntimeException("Server has no repositories!");
}
return repos.get(0).createSession();
}
after that only use this
Folder folder = session.getRootFolder();
hope that helped you