Hi Jelle,
You can write any Java code within the rules so for example you can call one of your REST
apis to fetch the values to display for the multiple choice answers. You'll need to
convert whatever this returns into various PossibleAnswer objects. It'll be cleaner
if you put most of the code in a Java class and then declare this as a global within the
rules.
Also if you wish to persist the data that the user enters then
use KnowledgeSessionHelper.getAnswers() to get the values for saving. Then to recreate a
questionnaire from saved data you need to instantiate Answer objects and insert them into
the session. xml-example illustrates both of these using a dummy textarea containing XML
as the "persisted storage". See OutputServlet for saving and submit.jsp for
reading back. In your case you'll probably want to convert the Map returned by
getAnswers() into JSON which you can pass to your REST backend.
Re documentation, I'm sorry but there is only what's on the WIki
(
https://developer.jboss.org/wiki/Tohu) plus the examples and Javadoc. But I'm happy
to answer any questions.
Regards, Damon
________________________________
From: Jelle Victoor <jelle.victoor(a)conundra.eu>
To: "tohu-users(a)lists.jboss.org" <tohu-users(a)lists.jboss.org>
Sent: Monday, 1 September 2014 8:24 PM
Subject: [tohu-users] questionair to include into larger application
Hi
I’m building large application with angularjs. Now I have a need to use a questionair and
I’ve been looking at tohu and decided that this seems a solid framework for the job. The
only question is how this will integrate with the rest of my application which is a pure
rest based back-end with a angularjs front-end.
Any suggestions? Is there also more documentation to be found? Now I’m just engineering on
top of the examples to build something I want. Everything works as long as I stay inside
the tohu framework, but what if I want to get my multiple choice answers from my database
etc?
_______________________________________________
tohu-users mailing list
tohu-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/tohu-users