Hello Stephen, I use Camunda Modeler template to fill InputParameter (very long HTML message). The InputParameter is defined as freemarker inline script. Same as you I have String variable length limitation problem (since freemarker automatically renders output to Camunda String variable type). So I am thinking about manual freemarker rendering, but to a File.
So to begin I wrote custom class with static method, which transforms input String to File and returns it:
package com.test;
import org.camunda.bpm.engine.variable.Variables;
import org.camunda.bpm.engine.variable.value.FileValue;
import org.camunda.bpm.engine.variable.value.builder.FileValueBuilder;
import java.io.UnsupportedEncodingException;
public class MyUtils {
public static FileValue ConvertToFile(String inputString) throws UnsupportedEncodingException {
FileValueBuilder fileValueBuilder = Variables.fileValue("test.txt");
FileValue fileValue = fileValueBuilder.file(inputString.getBytes("UTF-8"))
.mimeType("text/plain")
.encoding("UTF-8")
.create();
return fileValue;
}
}
Then the InputParameter will be defined as groovy inline script like:
com.test.MyUtils.ConvertToFile("My sample ${template} to be processed inside method above later.")
It works fine, but problem is that user has to place everything to the method (and escape some chars). Which he has to know obviously.
My template is defined like:
{
"label": "Message",
"description": "(FreeMarker script is allowed, e.g. ${MyVariable}).",
"type": "Text",
"value": "",
"binding": {
"type": "camunda:inputParameter",
"name": "HTMLMessage",
"scriptFormat": "groovy"
},
"constraints": {
"notEmpty": true
}
}
If we could specify something like below, problem will be solved for me:
{
"label": "Message",
"description": "(FreeMarker script is allowed, e.g. ${MyVariable}).",
"type": "Text",
"value": "com.test.MyUtils.ConvertToFile(" + value + ")",
"binding": {
"type": "camunda:inputParameter",
"name": "HTMLMessage",
"scriptFormat": "groovy"
},
"constraints": {
"notEmpty": true
}
}
Do you have any idea how to solve it?
Thanks, Jan.