protected void runScript(
      PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    String language = ParamUtil.getString(actionRequest, "language");
    String script = ParamUtil.getString(actionRequest, "script");

    PortletContext portletContext = portletConfig.getPortletContext();

    Map<String, Object> portletObjects =
        ScriptingUtil.getPortletObjects(
            portletConfig, portletContext, actionRequest, actionResponse);

    UnsyncByteArrayOutputStream unsyncByteArrayOutputStream = new UnsyncByteArrayOutputStream();

    UnsyncPrintWriter unsyncPrintWriter = UnsyncPrintWriterPool.borrow(unsyncByteArrayOutputStream);

    portletObjects.put("out", unsyncPrintWriter);

    try {
      SessionMessages.add(actionRequest, "language", language);
      SessionMessages.add(actionRequest, "script", script);

      ScriptingUtil.exec(null, portletObjects, language, script);

      unsyncPrintWriter.flush();

      SessionMessages.add(actionRequest, "scriptOutput", unsyncByteArrayOutputStream.toString());
    } catch (ScriptingException se) {
      SessionErrors.add(actionRequest, ScriptingException.class.getName(), se);

      _log.error(se.getMessage());
    }
  }
  @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);
  }
  public String evaluate(
      KaleoCondition kaleoCondition, ExecutionContext executionContext, ClassLoader... classLoaders)
      throws PortalException, SystemException {

    Map<String, Object> inputObjects =
        ScriptingContextBuilder.buildScriptingContext(executionContext);

    Map<String, Object> results =
        ScriptingUtil.eval(
            null,
            inputObjects,
            _outputNames,
            kaleoCondition.getScriptLanguage(),
            kaleoCondition.getScript(),
            classLoaders);

    String returnValue = (String) results.get(_RETURN_VALUE);

    if (returnValue != null) {
      return returnValue;
    }

    throw new IllegalStateException(
        "Conditional did not return value for script " + kaleoCondition.getScript());
  }