What is rendition?
Rendition is the alternative representation of a
document. Not all the repositories support renditions.
Where can I use
rendition?
Rendtions can be used while previewing a document,
without downloading the actual content of a document.
RepositoryCapabilities interface provides
'getRenditionsCapability' method to get the rendition capabilities of the
repository.
Following table summarizes valid values of rendition
capability.
Value
|
Description
|
none
|
The repository does not expose renditions at all.
|
read
|
Renditions are provided by the repository and readable
by the client.
|
Example
RepositoryInfo
repoInfo = session.getRepositoryInfo();
CapabilityRenditions
renditionsCapability = repoInfo.getCapabilities().getRenditionsCapability();
if
(renditionsCapability == null) {
System.out.println("Repository
is not providing this value");
}
else if (CapabilityRenditions.NONE == renditionsCapability) {
System.out.println("Repository
does not expose renditions at all");
}
else if (CapabilityRenditions.READ == renditionsCapability) {
System.out.println("Renditions
are provided by the repository and readable by the client");
}
else {
System.out.println("Other
value is written, which is not supported by repository");
}
Following is the complete 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; import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions; 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(); CapabilityRenditions renditionsCapability = repoInfo.getCapabilities().getRenditionsCapability(); if (renditionsCapability == null) { System.out.println("Repository is not providing this value"); } else if (CapabilityRenditions.NONE == renditionsCapability) { System.out.println("Repository does not expose renditions at all"); } else if (CapabilityRenditions.READ == renditionsCapability) { System.out.println("Renditions are provided by the repository and readable by the client"); } else { System.out.println("Other value is written, which is not supported by repository"); } } }
Output
Renditions are provided by the repository and readable by
the client
No comments:
Post a Comment