Page 1 of 1

Generate document from template

PostPosted:Tue May 28, 2019 10:28 am
by Under5hadow
Hi,

I'm trying to generate a document from template when the worflow start.
I got the generated file but it's empty :/
all the template field value got replace by "". Don't really know where to start the debug.
If I create the document from the template by the user interface, I got all the field replaced.

I defined my metadata :
Code: Select all
<property-group label="Fre" name="okg:fre">
    <input label="Input label" name="okp:fre.input"/>
    <textarea label="Comment" name="okp:fre.comment" />
    <input label="Input label2" name="okp:fre.input2" />
    <input label="Document" name="okp:fre.document" />
</property-group>
My template as the Template field value :
capturewf.PNG
capturewf.PNG (1.46 KiB) Viewed 2252 times
I use the code below to create the final document :
Code: Select all
Map<String, String> map = new HashMap<String, String>(); 
map.put("okp_fre_Input2","Alicia"); 
List<Map<String,String>> lista = new ArrayList<>(); 
lista.add(map);
List<GWTFormElement> elementos = new ArrayList<>();
Map<String,List<Map<String,String>>> mapa = new HashMap<>(); 
mapa.put("okp_fre_Input2", lista); 
DocumentServlet ds = new DocumentServlet();
GWTDocument  file = ds.createFromTemplate("/okm:templates/PMGI_0_TE_07_TemplateFRE.odt", "/okm:root/finaldoc.odt", elementos, mapa);
Catalina log :
catalina.png
catalina.png (9.07 KiB) Viewed 2252 times
How the final document look like:
finaldoc.png
finaldoc.png (853 Bytes) Viewed 2252 times
Any idea about my issue ? thanks !

Re: Generate document from template

PostPosted:Fri May 31, 2019 5:25 pm
by jllort
You have a lot of wrong concepts in your code. You should not use Servlet in the way you are using, also you should not use GWTXXX into workflow classes.

I suggest first debug step by step the Servlet code and then understanding what it does, try to apply from workflow class.

Re: Generate document from template

PostPosted:Sun Jun 02, 2019 2:58 pm
by Under5hadow
Oh ok sorry, I followed this post viewtopic.php?t=22144
I didn't find any tutorial on how to debug nor how to modify the source code.
Can you guide me please on debugging the Document Servlet and modifying the source code ?

Thanks for the help !

Re: Generate document from template

PostPosted:Fri Jun 07, 2019 6:38 pm
by jllort
If you do not know how to debug with eclipse or IntelliJ a JAVA application means you are starting with JAVA development and you will take some time until you get the minimum skills for playing with the code.

https://www.vogella.com/tutorials/Eclip ... ticle.html
https://www.google.com/search?q=youtube ... bu+eclipse ( youtube java debug with eclipse )