This blog explains about how to download a specific file from UCM using RIDC API
Use this method in FileDownloadListener component in .jsff or .jspx.
Use this method in FileDownloadListener component in .jsff or .jspx.
public void downloadUCMFile(FacesContext facesContext,
OutputStream outputStream) {
try {
import org.apache.commons.io.IOUtils;
String docName = "VMOHSKEND05482003131";
String path =
"https://privdev-oneinc.oracleoutsourcing.com/cs/groups/insight_application1/documents/document/ndgy/mdaz/~edisp/vmohskend05482003131.html";
//need get docId dynamically
Object obj =JSFUtils.getFromRequest("docID");
System.out.println(obj);
String docID = "2874";
//String docID=downloadLink.getText();
RIDCUtil ridc = new RIDCUtil();
InputStream inputStream = ridc.getDocumentByID(docID, "ohsadmin");
// copy hte data from the BlobDomain to the output stream
IOUtils.copy(inputStream, outputStream);
// Tike tika = new Tika();
// System.out.println(tika.detect(inputStream));
outputStream.flush();
} catch (Exception e) {
// handle errors
e.printStackTrace();
FacesMessage msg =
new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(),
"");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
No comments:
Post a Comment