View a Process Document [message #1713171] |
Sun, 01 November 2015 16:52  |
Eclipse User |
|
|
|
Hi,
I have a query related to viewing a process document.
I have attached a PDF document to a process through some activity. Now, I want to view this document through some other activity of the same process in a NEW TAB on the browser. Is there any URL that gets created for each and every attached process document using its documentID, so that we can view it separately on the browser.
Please suggest.
Thanks
Ajay
|
|
|
|
|
|
|
Re: View a Process Document [message #1715120 is a reply to message #1713466] |
Thu, 19 November 2015 06:51  |
Eclipse User |
|
|
|
Hi Ajay,
I have attached a sample model which takes pdf documents as process attachments in first manualActivity and the next activity(i.e JavaApplication) gets the documentList from the process and the third activity(i.e UIMashup) shows list of those documents with a link which on click opens the document.
Following is the code to get the ProcessDocs used in JavaApp:
public ArrayList<HashMap<String, String>> getDocuments(Long processOid) {
ArrayList<HashMap<String, String>> docList = new ArrayList<HashMap<String,String>>();
ServiceFactory sf= ServiceFactoryLocator.get("motu","motu");
DocumentManagementService dms = sf.getDocumentManagementService();
Object processAttachment = sf.getWorkflowService().getInDataPath(processOid, "PROCESS_ATTACHMENTS");
if (processAttachment instanceof Collection) {
Collection<?> pAttCol = (Collection<?>) processAttachment;
for (Object obj : pAttCol) {
if (obj instanceof Document) {
HashMap<String,String> doc = new HashMap<String,String>();
Document saveDoc = (Document) obj;
byte[] byteArr= dms.retrieveDocumentContent(saveDoc.getPath());
String content = new BASE64Encoder().encode(byteArr).toString();
doc.put("docId", saveDoc.getName());
doc.put("docContent", content);
doc.put("mimeType", saveDoc.getContentType());
docList.add(doc);
}
}
}
return docList;
}
}
The Sample model is just for PDF. You can enhance it further as per your needs.
Hope this helps.
Cheers!!!!
Ashish
[Updated on: Thu, 19 November 2015 06:52] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05153 seconds