use of com.axelor.apps.baml.xml.ProcessActionNode in project axelor-open-suite by axelor.
the class BamlServiceImpl method generateGroovyCode.
@Override
public String generateGroovyCode(String xml) throws AxelorException {
ProcessActionRootNode rootNode = null;
rootNode = BamlParser.parse(IOUtils.toInputStream(xml, "utf-8"));
if (rootNode == null) {
return null;
}
List<ProcessActionNode> processActionNodes = rootNode.getProcessActions();
StringBuilder codeBuilder = new StringBuilder();
if (processActionNodes != null) {
ProcessActionNode processActionNode = processActionNodes.get(0);
generateCode(codeBuilder, processActionNode);
}
return codeBuilder.toString();
}
use of com.axelor.apps.baml.xml.ProcessActionNode in project axelor-open-suite by axelor.
the class TestBamlParser method test.
public void test() {
InputStream is = ResourceUtils.getResourceStream("BamlTest.xml");
ProcessActionRootNode rootNode = BamlParser.parse(is);
List<ProcessActionNode> processActionNodes = rootNode.getProcessActions();
String script = "";
if (processActionNodes != null) {
script = processActionNodes.get(0).toCode(true);
}
Context ctx = new Context(User.class);
GroovyScriptHelper helper = new GroovyScriptHelper(ctx);
helper.eval(script);
}
Aggregations