RepositoryCapabilities interface provides
isAllVersionsSearchableSupported() method, it returns true, if the repository
is able to include all versions of document in search query, else false.
Example
Boolean
isAllVersionsSearchable = repoInfo.getCapabilities().isAllVersionsSearchableSupported();
if
(isAllVersionsSearchable == null) {
System.out.println("Repository
is not providing this value");
}
else if (isAllVersionsSearchable) {
System.out.println("You
can search all the versions of a document");
}
else {
System.out.println("You
can't search all the versions");
}
Find the following working application.
TestCmis.java
package com.sample.util; import java.util.HashMap; import java.util.Map; import org.apache.chemistry.opencmis.client.api.Session; import org.apache.chemistry.opencmis.client.api.SessionFactory; import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.data.RepositoryInfo; import org.apache.chemistry.opencmis.commons.enums.BindingType; public class TestCmis { private static String serverURL = "http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/browser"; private static String repositoryId = "A1"; public static Session getSession() { Map<String, String> parameters = new HashMap<>(); parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value()); parameters.put(SessionParameter.USER, ""); parameters.put(SessionParameter.PASSWORD, ""); parameters.put(SessionParameter.REPOSITORY_ID, repositoryId); parameters.put(SessionParameter.BROWSER_URL, serverURL); SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); return sessionFactory.createSession(parameters); } public static void main(String args[]) { Session session = getSession(); RepositoryInfo repoInfo = session.getRepositoryInfo(); Boolean isAllVersionsSearchable = repoInfo.getCapabilities().isAllVersionsSearchableSupported(); if (isAllVersionsSearchable == null) { System.out.println("Repository is not providing this value"); } else if (isAllVersionsSearchable) { System.out.println("You can search all the versions of a document"); } else { System.out.println("You can't search all the versions"); } } }
Output
You can't search all the versions
No comments:
Post a Comment