Page 1 of 1

Download a document's notes using a worklfow

PostPosted:Wed Aug 29, 2012 4:11 pm
by noxious
Hello,
I want to create a worklfow which, when called, will firstly create a text file with the notes of the selected document and secondly will download this file to the web client.
The first part is easy for me but the second seems really difficult. Can I call the DownloadServlet Class or use WebUtils.sendFile() inside an ActionHandler? How?
Sorry if my question seems stupid, I am comfortable with OpenKM classes for handling documents but I have no experience with Java Servlets and any hint would be appreciated :D .

Re: Download a document's notes using a worklfow

PostPosted:Fri Aug 31, 2012 10:23 am
by jllort
I want understanding better:
1- User start document workflow. Do you want the same user after starting workflow automatically download the document or a user who has asigned the next workflow task ?

Re: Download a document's notes using a worklfow

PostPosted:Fri Aug 31, 2012 11:37 am
by noxious
I want to create this workflow so that the user's will be able to download a document's notes.
The document will be downloaded from the iniator of the workflow. No task assignment to other user.
I have created an ActionHandler that reads the document's notes and then creates a txt file with the notes inside the repository.
My problem is that I dont'n know how to call DownloadServlet inside this ActionHandler so that the txt file will be sent for download at the user's browser.
I thought I could do something like that:
Code: Select all
String pathParam=URLEncoder.encode(path, "UTF-8");
String uuidParam=URLEncoder.encode(uuid, "UTF-8");
String tokenParam=URLEncoder.encode(token, "UTF-8"); 
URL url = new URL("http://localhost:8080/OpenKM/frontend/DownloadServlet?path="+pathParam+"&uuid="+uuidParam+"&token="+tokenParam);
URLConnection conn = url.openConnection();
but it didn't work.
How can I download the file?Can I do it without a servlet?

Re: Download a document's notes using a worklfow

PostPosted:Sun Sep 02, 2012 8:51 am
by jllort
I suppose which was your problem but I want to be sure about it. Actually at starting workflow task this can not be done with the actual workflow, will need to make some changes to return some UI action after workflow has been started ( that can be done more easy with assigned task, but is more difficult with starting process ).
This kind of feature need source code changes. The most easiest solution I can give to you is sending some mail address with notes attachment.

Re: Download a document's notes using a worklfow

PostPosted:Mon Sep 03, 2012 12:57 pm
by noxious
Ok so,
Let's suppose that I create a task node and I assign it to a user. Then, this user enters the task node, inserts the path of a document in the task form and presses the submit button.
If all the above take place, can I then create an ActionHandler or a script that on submit will download the selected document's notes?
Can you please show me the code that I would need inside this ActionHandler to make the download?

Re: Download a document's notes using a worklfow

PostPosted:Wed Sep 05, 2012 5:41 pm
by jllort
Actions has only visibility in code execution but not in UI ( here I think is not where should be done ). In UI only has effects formElements, here we got a formElement called Download ( http://www.openkm.com/dtd/workflow-forms-2.1.dtd ) but need end user action ( click button ). Otherside should be implemented something when is getting pending task, indicating this task needs inmediate action ( evaluating something within formelements will be the most easiest way for doing it ).

Re: Download a document's notes using a worklfow

PostPosted:Sat Sep 08, 2012 9:52 am
by noxious
Ok, thank you jllort :D