Package org.pentaho.platform.api.engine

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


  private void doParameter( final String solutionName, final String actionPath, final String actionName,
      final IParameterProvider parameterProvider, final OutputStream outputStream, final IPentahoSession userSession,
      final HttpServletResponse response ) throws IOException {

    final IActionSequence actionSequence =
        new ActionSequenceJCRHelper().getActionSequence( ActionInfo.buildSolutionPath( solutionName, actionPath,
            actionName ), PentahoSystem.loggingLevel, RepositoryFilePermission.READ );
    if ( actionSequence == null ) {
      logger.debug( Messages.getInstance().getString( "HttpWebService.ERROR_0002_NOTFOUND", solutionName, actionPath,
        actionName ) );
      response.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
      return;
    }

    final Document document = DocumentHelper.createDocument();
    try {
      final Element parametersElement = document.addElement( "parameters" );

      // noinspection unchecked
      final Map<String, IActionParameter> params =
          actionSequence.getInputDefinitionsForParameterProvider( IParameterProvider.SCOPE_REQUEST );
      for ( final Map.Entry<String, IActionParameter> entry : params.entrySet() ) {
        final String paramName = entry.getKey();
        final IActionParameter paramDef = entry.getValue();
        final String value = paramDef.getStringValue();
        final Class type;
View Full Code Here


      IPentahoSession userSession = getPentahoSession( request );
      if ( !doBackgroundExecution( request, response, userSession ) ) {
        OutputStream outputStream = getOutputStream( response, doMessages( request ) );
        ActionSequenceJCRHelper actionHelper = new ActionSequenceJCRHelper( userSession );
        String actionPath = request.getParameter( "path" ); //$NON-NLS-1$
        IActionSequence actionSequence =
            actionHelper.getActionSequence( actionPath, PentahoSystem.loggingLevel, RepositoryFilePermission.READ );
        String fileName = null;
        if ( actionSequence != null ) {
          String title = actionSequence.getTitle();
          if ( ( title != null ) && ( title.length() > 0 ) ) {
            fileName = title;
          } else {
            String sequenceName = actionSequence.getSequenceName();

            if ( ( sequenceName != null ) && ( sequenceName.length() > 0 ) ) {
              fileName = sequenceName;
            } else {
              List actionDefinitionsList = actionSequence.getActionDefinitionsAndSequences();
              int i = 0;
              boolean done = false;

              while ( ( actionDefinitionsList.size() > i ) && !done ) {
                IActionDefinition actionDefinition = (IActionDefinition) actionDefinitionsList.get( i );
View Full Code Here

        return null;
      }

      String path = solutionFile.getSolutionPath();

      IActionSequence actionSequence =
          SequenceDefinition.ActionSequenceFactory( actionSequenceDocument, path, logger, PentahoSystem
              .getApplicationContext(), Logger.getLogLevel() );
      if ( actionSequence == null ) {
        Logger.error( getClass().toString(), Messages.getInstance().getErrorString(
            "SolutionRepository.ERROR_0016_FAILED_TO_CREATE_ACTION_SEQUENCE", //$NON-NLS-1$
            path ) );
        return null;
      }

      IFileInfo info = new FileInfo();
      info.setAuthor( actionSequence.getAuthor() );
      info.setDescription( actionSequence.getDescription() );
      info.setDisplayType( actionSequence.getResultType() );
      info.setIcon( actionSequence.getIcon() );
      info.setTitle( actionSequence.getTitle() );
      return info;
    } catch ( Exception e ) {
      if ( logger != null ) {
        logger.error( getClass().toString(), e );
      }
View Full Code Here

   */
  @Override
  public Document getXmlContent() {

    ActionSequenceJCRHelper actionHelper = new ActionSequenceJCRHelper( getSession() );
    IActionSequence actionSequence =
        actionHelper.getActionSequence( ActionInfo.buildSolutionPath( solution, path, actionName ), getLoggingLevel(),
            RepositoryFilePermission.READ );

    if ( actionSequence == null ) {
      // TODO log this
      error( Messages.getInstance().getString( "InputForm.ERROR_0004_ACTION_NOT_FOUND" ) + solution + path + actionName ); //$NON-NLS-1$
      return null;
    }

    List actions = actionSequence.getActionDefinitionsAndSequences();
    ISolutionActionDefinition action = (ISolutionActionDefinition) actions.get( 0 );

    Node node = action.getComponentSection();
    if ( node == null ) {
      error( Messages.getInstance().getString( "InputForm.ERROR_0005_INBOX_DEFINITION_MISSING" ) + solution + path + actionName ); //$NON-NLS-1$
      return null;
    }

    if ( templateName == null ) {

      // see if the template is specified in the action document
      Node templateNode = node.selectSingleNode( "//template" ); //$NON-NLS-1$
      if ( templateNode != null ) {
        templateName = templateNode.getText();
      }
      if ( templateName == null ) {
        error( Messages.getInstance().getString( "InputForm.ERROR_0006_TEMPLATE_NOT_SPECIFIED" ) ); //$NON-NLS-1$
        return null;
      }
    }
    Node xFormNode = node.selectSingleNode( "//xForm" ); //$NON-NLS-1$

    try {

      String actionTitle = actionSequence.getTitle();
      if ( actionTitle != null ) {
        setXslProperty( "title", actionTitle ); //$NON-NLS-1$
      }

      String description = actionSequence.getDescription();
      if ( description != null ) {
        setXslProperty( "description", description ); //$NON-NLS-1$
      }

      String xFormHtml = XForm.transformSnippet( xFormNode, getSession(), new SolutionURIResolver() );
View Full Code Here

      RepositoryFilePermission actionOperation ) {
    Document actionSequenceDocument = getSolutionDocument( actionPath, actionOperation );
    if ( actionSequenceDocument == null ) {
      return null;
    }
    IActionSequence actionSequence =
        SequenceDefinition.ActionSequenceFactory( actionSequenceDocument, actionPath, pentahoSession, PentahoSystem
            .getApplicationContext(), loggingLevel );
    if ( actionSequence == null ) {
      return null;
    }
View Full Code Here

    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "services/" + xactionName );

    Document actionSequenceDocument = XmlDom4JHelper.getDocFromString( xactionStr, null );
    IActionSequence actionSequence =
        SequenceDefinition.ActionSequenceFactory( actionSequenceDocument,
            "", this, PentahoSystem.getApplicationContext(), DEBUG ); //$NON-NLS-1$
    Map allParameters = actionSequence.getOutputDefinitions();
    Set<String> outParameters = new HashSet<String>();
    Set<String> nonOutParameters = new HashSet<String>();
    for ( Object key : allParameters.keySet() ) {
      IActionParameter param = (IActionParameter) allParameters.get( key );
      if ( param.isOutputParameter() ) {
View Full Code Here

  @SuppressWarnings ( "rawtypes" )
  public static void createOutputFileName( RepositoryFile file, IOutputHandler outputHandler ) {
    IPentahoSession userSession = PentahoSessionHolder.getSession();
    ActionSequenceJCRHelper actionHelper = new ActionSequenceJCRHelper( userSession );
    IActionSequence actionSequence =
      actionHelper.getActionSequence( file.getPath(), PentahoSystem.loggingLevel, RepositoryFilePermission.READ );

    String fileName = "content"; //$NON-NLS-1$
    if ( actionSequence != null ) {
      String title = actionSequence.getTitle();
      if ( ( title != null ) && ( title.length() > 0 ) ) {
        fileName = title;
      } else {
        String sequenceName = actionSequence.getSequenceName();

        if ( ( sequenceName != null ) && ( sequenceName.length() > 0 ) ) {
          fileName = sequenceName;
        } else {
          List actionDefinitionsList = actionSequence.getActionDefinitionsAndSequences();
          int i = 0;
          boolean done = false;

          while ( ( actionDefinitionsList.size() > i ) && ( !done ) ) {
            IActionDefinition actionDefinition = (IActionDefinition) actionDefinitionsList.get( i );
View Full Code Here

  @SuppressWarnings ( { "unchecked", "rawtypes" } )
  public static String doParameter( final RepositoryFile file, IParameterProvider parameterProvider,
                                    final IPentahoSession userSession ) throws IOException {
    ActionSequenceJCRHelper helper = new ActionSequenceJCRHelper();
    final IActionSequence actionSequence =
      helper.getActionSequence( file.getPath(), PentahoSystem.loggingLevel, RepositoryFilePermission.READ );
    final Document document = DocumentHelper.createDocument();
    try {
      final Element parametersElement = document.addElement( "parameters" );

      // noinspection unchecked
      final Map<String, IActionParameter> params =
        actionSequence.getInputDefinitionsForParameterProvider( IParameterProvider.SCOPE_REQUEST );
      for ( final Map.Entry<String, IActionParameter> entry : params.entrySet() ) {
        final String paramName = entry.getKey();
        final IActionParameter paramDef = entry.getValue();
        final String value = paramDef.getStringValue();
        final Class type;
View Full Code Here

      IPentahoSession userSession = getPentahoSession( request );
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      String solutionName = request.getParameter( "solution" ); //$NON-NLS-1$
      String actionPath = request.getParameter( "path" ); //$NON-NLS-1$
      String actionName = request.getParameter( "action" ); //$NON-NLS-1$
      IActionSequence actionSequence =
          new ActionSequenceJCRHelper().getActionSequence( ActionInfo.buildSolutionPath( solutionName, actionPath,
            actionName ), PentahoSystem.loggingLevel, RepositoryFilePermission.READ );
      String fileName = null;
      if ( actionSequence != null ) {
        String title = actionSequence.getTitle();
        if ( ( title != null ) && ( title.length() > 0 ) ) {
          fileName = title;
        } else {
          String sequenceName = actionSequence.getSequenceName();

          if ( ( sequenceName != null ) && ( sequenceName.length() > 0 ) ) {
            fileName = sequenceName;
          } else {
            List actionDefinitionsList = actionSequence.getActionDefinitionsAndSequences();
            int i = 0;
            boolean done = false;

            while ( ( actionDefinitionsList.size() > i ) && !done ) {
              IActionDefinition actionDefinition = (IActionDefinition) actionDefinitionsList.get( i );
View Full Code Here

    // load the solution action document
    if ( debug ) {
      debug( Messages.getInstance().getString( "SolutionEngine.DEBUG_LOADING_ACTION_DEFINITION" ) ); //$NON-NLS-1$
    }

    IActionSequence actionSequence = null;
    if ( actionSequenceXML != null ) {
      actionSequence = createActionSequenceFromXml( actionSequenceXML );
    } else {
      actionSequence = createActionSequence( sequencePath );
    }
View Full Code Here

TOP

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

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.