Details
-
Type:
New Feature
-
Status: Closed
-
Priority:
Should
-
Resolution: Fixed
-
Affects Version/s: Reporting 0.7.3.1
-
Fix Version/s: Reporting 0.7.5
-
Component/s: Cohort Definitions
-
Labels:
-
Complexity:Low
-
Sprint:2013 - January 9-23
Description
Create a type of cohort definition that the user can define in any JSR-223 (javax.script) supported script (Groovy, Javascript, etc):
- Should have 2 configuration properties:
- String scriptType
- String scriptCode
- The evalutor should do something like:
ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine scriptEngine = manager.getEngineByName(scriptType); scriptEngine.put("context", context); // this is the reporting scriptEngine.put("parameters", context.getParameters()); Object result = scriptEngine.eval(scriptCode); try { if (result instanceof Cohort) return (Cohort) result; } else { return new Cohort((Collection<Integer>) result); } } catch (Exception e) { throw new EvaluationException("A Scripted Cohort Definition must return either a Cohort or a Collection<Integer>"); }
- Should have a user interface similar (or exactly like) the Sql Cohort Definition UI. The user should be able to define parameters that it accepts, and there should be a big text area for defining the script. There also needs to be a dropdown list of available Script types in order for the user to specify the type of script that they are authoring. You can get these from the javax.script package easily.
For examples of using javax.script, see:
Gliffy Diagrams
Attachments
Issue Links
- relates to
-
REPORT-469 @ConfigurationProperty and UI related metadata
-
- Closed
-