|
|
|
|
|
Re: View a Process Document [message #1715120 is a reply to message #1713466] |
Thu, 19 November 2015 11:51  |
Ashish Khole Messages: 28 Registered: April 2015 |
Junior Member |
|
|
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 11:52] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01725 seconds