@Override public String evaluate(KaleoCondition kaleoCondition, ExecutionContext executionContext) throws PortalException { Map<String, Object> inputObjects = ScriptingContextBuilderUtil.buildScriptingContext(executionContext); Map<String, Object> results = _scripting.eval( null, inputObjects, _outputNames, kaleoCondition.getScriptLanguage(), kaleoCondition.getScript()); Map<String, Serializable> resultsWorkflowContext = (Map<String, Serializable>) results.get(WorkflowContextUtil.WORKFLOW_CONTEXT_NAME); WorkflowContextUtil.mergeWorkflowContexts(executionContext, resultsWorkflowContext); String returnValue = (String) results.get(_RETURN_VALUE); if (returnValue != null) { return returnValue; } throw new IllegalStateException( "Conditional did not return value for script " + kaleoCondition.getScript()); }
@Override public Collection<KaleoTaskAssignment> calculateTaskAssignments( KaleoTaskAssignment kaleoTaskAssignment, ExecutionContext executionContext, ClassLoader... classLoaders) throws PortalException, SystemException { Map<String, Object> inputObjects = ScriptingContextBuilderUtil.buildScriptingContext(executionContext); String assigneeScript = kaleoTaskAssignment.getAssigneeScript(); String assigneeScriptingLanguage = kaleoTaskAssignment.getAssigneeScriptLanguage(); Map<String, Object> results = ScriptingUtil.eval( null, inputObjects, _outputNames, assigneeScriptingLanguage, assigneeScript, classLoaders); Map<String, Serializable> resultsWorkflowContext = (Map<String, Serializable>) results.get(WorkflowContextUtil.WORKFLOW_CONTEXT_NAME); WorkflowContextUtil.mergeWorkflowContexts(executionContext, resultsWorkflowContext); return getKaleoTaskAssignments(results); }