Package org.pentaho.platform.api.engine

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


      if ( status == IRuntimeContext.RUNTIME_STATUS_SUCCESS ) {
        // now pass any outputs back
        Iterator<?> it = this.getOutputNames().iterator();
        while ( it.hasNext() ) {
          String outputName = (String) it.next();
          IActionParameter param = solutionEngine.getExecutionContext().getOutputParameter( outputName );
          if ( param != null ) {
            setOutputValue( outputName, param.getValue() );
            ignoreParameters.add( param.getValue() );
          }
        }
        return true;
      } else {
        return false;
View Full Code Here


    for ( Iterator it = selNodes.iterator(); it.hasNext(); ) {
      Node node = (Node) it.next();
      try {
        inputName = node.getName(); // Get the Data Node
        IActionParameter inputParam = getInputParameter( inputName );
        String filterType = XmlDom4JHelper.getNodeText( "@filter", node, null ); //$NON-NLS-1$

        // BISERVER-149 Changed isOptional param to default to false in order to
        // enable prompting when no default value AND no selection list is given...
        // This is also the default that Design Studio presumes.

        String optionalParm = XmlDom4JHelper.getNodeText( "@optional", node, "false" ); //$NON-NLS-1$ //$NON-NLS-2$
        boolean isOptional = "true".equals( optionalParm ); //$NON-NLS-1$

        if ( "none".equalsIgnoreCase( filterType ) ) { //$NON-NLS-1$
          IActionParameter selectParam = getInputParameter( inputName );
          String title = XmlDom4JHelper.getNodeText( "title", node, inputName ); //$NON-NLS-1$
          String valueCol = ""; //$NON-NLS-1$
          String dispCol = ""; //$NON-NLS-1$
          String displayStyle = XmlDom4JHelper.getNodeText( "@style", node, null ); //$NON-NLS-1$
          boolean promptOne =
              "true".equalsIgnoreCase( XmlDom4JHelper.getNodeText( "@prompt-if-one-value", node, "false" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          if ( "hidden".equals( displayStyle ) ) { //$NON-NLS-1$
            hiddenList.add( new SelEntry( inputParam, selectParam, valueCol, dispCol, title, displayStyle, promptOne,
                isOptional ) );
          } else {
            selList.add( new SelEntry( inputParam, selectParam, valueCol, dispCol, title, displayStyle, promptOne,
                isOptional ) );
          }
        } else {
          Node filterNode = node.selectSingleNode( "filter" ); //$NON-NLS-1$
          IActionParameter selectParam = getInputParameter( filterNode.getText().trim() );

          String valueCol = XmlDom4JHelper.getNodeText( "@value-col-name", filterNode, null ); //$NON-NLS-1$
          String dispCol = XmlDom4JHelper.getNodeText( "@display-col-name", filterNode, null ); //$NON-NLS-1$

          String title = XmlDom4JHelper.getNodeText( "title", node, null ); //$NON-NLS-1$
View Full Code Here

  @Test
  public void shouldExecute_returns_true_for_result_with_rows() throws Exception {
    ScriptableCondition conditionalExecution = new ScriptableCondition();
    conditionalExecution.setScript( RESULT_ELEMENT_SCRIPT );
    IActionParameter parameter = createParameterWithResult( 1 );
    boolean actualResult =
        conditionalExecution.shouldExecute( Collections.singletonMap( RESULT_ELEMENT, parameter ), logger );
    assertTrue( actualResult );
  }
View Full Code Here

  @Test
  public void shouldExecute_returns_false_for_result_without_rows() throws Exception {
    ScriptableCondition conditionalExecution = new ScriptableCondition();
    conditionalExecution.setScript( RESULT_ELEMENT_SCRIPT );
    IActionParameter parameter = createParameterWithResult( 0 );
    boolean actualResult =
        conditionalExecution.shouldExecute( Collections.singletonMap( RESULT_ELEMENT, parameter ), logger );
    assertFalse( actualResult );
  }
View Full Code Here

  @Test
  public void shouldExecute_returns_default_value_for_result_of_unsupported_type() throws Exception {
    ScriptableCondition conditionalExecution = new ScriptableCondition();
    conditionalExecution.setScript( RESULT_ELEMENT_SCRIPT );
    IActionParameter parameter = createParameterWithUnsupportedResultType();
    conditionalExecution.setDefaultResult( true );
    boolean actualResult =
        conditionalExecution.shouldExecute( Collections.singletonMap( RESULT_ELEMENT, parameter ), logger );
    assertTrue( actualResult );
View Full Code Here

        conditionalExecution.shouldExecute( Collections.singletonMap( RESULT_ELEMENT, parameter ), logger );
    assertFalse( actualResult2 );
  }

  private static IActionParameter createParameterWithResult( int rowsCount ) {
    IActionParameter parameter = mock( IActionParameter.class );
    IPentahoResultSet resultSet = mock( IPentahoResultSet.class );
    when( resultSet.getRowCount() ).thenReturn( rowsCount );
    when( parameter.getValue() ).thenReturn( resultSet );
    return parameter;
  }
View Full Code Here

    when( parameter.getValue() ).thenReturn( resultSet );
    return parameter;
  }

  private static IActionParameter createParameterWithUnsupportedResultType() {
    IActionParameter parameter = mock( IActionParameter.class );
    when( parameter.getValue() ).thenReturn( new UnsupportedResultType() );
    return parameter;
  }
View Full Code Here

        IActionSequenceResource resource = getResource( "template" ); //$NON-NLS-1$
        template = getResourceAsString( resource );
      }

      String outputName = (String) getOutputNames().iterator().next();
      IActionParameter outputParam = getOutputItem( outputName );

      if ( outputParam.getType().equals( IActionParameter.TYPE_CONTENT ) ) {

        String mimeType = actionDefinition.getMimeType().getStringValue();
        String extension = actionDefinition.getExtension().getStringValue();

        // This would prevent null values being passed as parameters to getOutputItem
View Full Code Here

  public void testRSCompareOK() {
    startTest();
    IRuntimeContext context = run( "/test/rules/ResultSetCompareTest.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$
    IActionParameter rtn = context.getOutputParameter( "COMPARERESULT" ); //$NON-NLS-1$
    assertNotNull( rtn );
    String compareResult = rtn.getStringValue();
    assertEquals( compareResult, "No Mismatches" ); //$NON-NLS-1$
    finishTest();
  }
View Full Code Here

  }

  public void testRSCompareNotOK1() {
    startTest();
    IRuntimeContext context = run( "/test/rules/ResultSetCompareTest_error1.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    IActionParameter rtn = context.getOutputParameter( "COMPARERESULT" ); //$NON-NLS-1$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$
    assertNotNull( rtn );
    String compareResult = rtn.getStringValue();
    assertEquals( compareResult, "Eastern" ); //$NON-NLS-1$
    finishTest();
  }
View Full Code Here

TOP

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

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.