Esempio n. 1
0
  @SuppressWarnings("rawtypes")
  protected static IRuntimeContext executeInternal(
      RepositoryFile file,
      IParameterProvider requestParams,
      HttpServletRequest httpServletRequest,
      IOutputHandler outputHandler,
      Map<String, IParameterProvider> parameterProviders,
      IPentahoSession userSession,
      boolean forcePrompt,
      List messages)
      throws Exception {
    String processId = XactionUtil.class.getName();
    String instanceId = httpServletRequest.getParameter("instance-id"); // $NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory(""); // $NON-NLS-1$
    ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, userSession);
    ISystemSettings systemSettings = PentahoSystem.getSystemSettings();

    if (solutionEngine == null) {
      throw new ObjectFactoryException("No Solution Engine");
    }

    boolean instanceEnds =
        "true"
            .equalsIgnoreCase(
                requestParams.getStringParameter(
                    "instanceends", "true")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    String parameterXsl =
        systemSettings.getSystemSetting(
            "default-parameter-xsl", "DefaultParameterForm.xsl"); // $NON-NLS-1$ //$NON-NLS-2$

    solutionEngine.setLoggingLevel(2);
    solutionEngine.init(userSession);
    solutionEngine.setForcePrompt(forcePrompt);
    if (parameterXsl != null) {
      solutionEngine.setParameterXsl(parameterXsl);
    }
    return solutionEngine.execute(
        file.getPath(),
        processId,
        false,
        instanceEnds,
        instanceId,
        false,
        parameterProviders,
        outputHandler,
        null,
        urlFactory,
        messages);
  }
  public IRuntimeContext handleActionRequest(final int timeout, final int timeoutType) {

    // Get the solution engine
    ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
    solutionEngine.setCreateFeedbackParameterCallback(createFeedbackParameterCallback);
    if (solutionEngine == null) {
      Logger.error(
          this,
          Messages.getInstance()
              .getErrorString("BaseRequestHandler.ERROR_0001_NO_SOLUTION_ENGINE")); // $NON-NLS-1$
      return null;
    }
    solutionEngine.setLoggingLevel(ILogger.DEBUG);
    solutionEngine.init(session);
    solutionEngine.setForcePrompt(forcePrompt);
    if (parameterXsl != null) {
      solutionEngine.setParameterXsl(parameterXsl);
    }

    dispose();
    runtime =
        solutionEngine.execute(
            actionPath,
            processId,
            false,
            instanceEnds,
            instanceId,
            true,
            parameterProviders,
            outputHandler,
            this,
            urlFactory,
            messages);

    // need to wait until this is complete
    // TODO

    // if this times out check the timeoutType before cancelling or
    // returning and leaving the component running

    return runtime;
  }