Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IBackgroundExecution


  }

  protected boolean doBackgroundExecution( final HttpServletRequest request, final HttpServletResponse response,
      final IPentahoSession userSession ) throws ServletException, IOException {
    if ( "true".equals( request.getParameter( "background" ) ) ) { //$NON-NLS-1$ //$NON-NLS-2$
      IBackgroundExecution backgroundExecutionHandler = PentahoSystem.get( IBackgroundExecution.class, userSession );
      if ( backgroundExecutionHandler != null ) {
        HttpRequestParameterProvider parameterProvider = new HttpRequestParameterProvider( request );
        String intro = ""; //$NON-NLS-1$
        String footer = ""; //$NON-NLS-1$
        IUITemplater templater = PentahoSystem.get( IUITemplater.class, userSession );
        if ( templater != null ) {
          String[] sections = templater.breakTemplate( "template-dialog.html", "", userSession ); //$NON-NLS-1$ //$NON-NLS-2$
          if ( ( sections != null ) && ( sections.length > 0 ) ) {
            intro = sections[0];
          }
          if ( ( sections != null ) && ( sections.length > 1 ) ) {
            footer = sections[1];
          }
        } else {
          intro = Messages.getInstance().getString( "ViewAction.ERROR_0002_BAD_TEMPLATE_OBJECT" ); //$NON-NLS-1$
        }

        response.getWriter().print( intro );
        String backgroundResponse = null;
        try {
          backgroundResponse = backgroundExecutionHandler.backgroundExecuteAction( userSession, parameterProvider );
        } catch ( BackgroundExecutionException bex ) {
          backgroundResponse = bex.getLocalizedMessage();
          response.getWriter().print( backgroundResponse );
          response.getWriter().print( footer );
          error(
View Full Code Here


    when( request.getParameter( eq( "background" ) ) ).thenReturn( Boolean.TRUE.toString() );

    final PrintWriter printWriter = mock( PrintWriter.class );
    when( response.getWriter() ).thenReturn( printWriter );

    final IBackgroundExecution backgroundExecution = mock( IBackgroundExecution.class );
    mp.defineInstance( IBackgroundExecution.class, backgroundExecution );

    servlet.service( request, response );

    verify( backgroundExecution ).backgroundExecuteAction( eq( PentahoSessionHolder.getSession() ),
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IBackgroundExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.