Package org.pentaho.platform.api.engine

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


      ScriptableObject scriptable = new RhinoScriptable();
      // initialize the standard javascript objects
      Scriptable scope = cx.initStandardObjects( scriptable );
      ScriptableObject.defineClass( scope, JavaScriptResultSet.class );
      Object inputValue;
      IActionParameter inputParameter;
      String inputName;
      Iterator inputs = currentInputs.entrySet().iterator();
      Map.Entry mapEntry;
      while ( inputs.hasNext() ) {
        mapEntry = (Map.Entry) inputs.next();
        inputName = (String) mapEntry.getKey();
        if ( inputName.indexOf( '-' ) >= 0 ) {
          logger.info( "Ignoring Input: " + inputName ); //$NON-NLS-1$
          continue;
        }
        inputParameter = (IActionParameter) mapEntry.getValue();
        inputValue = inputParameter.getValue();

        Object wrapper;
        if ( inputValue instanceof IPentahoResultSet ) {
          JavaScriptResultSet results = new JavaScriptResultSet();
View Full Code Here


    if ( engine == null ) {
      throw new IllegalArgumentException( Messages.getInstance().getErrorString(
          "ScriptableCondition.ERROR_0001_ENGINE_NOT_AVAILABLE", this.getScriptLanguage() ) ); //$NON-NLS-1$
    }
    Object inputValue;
    IActionParameter inputParameter;
    String inputName = null;
    Iterator inputs = currentInputs.entrySet().iterator();
    Map.Entry mapEntry;
    while ( inputs.hasNext() ) {
      mapEntry = (Map.Entry) inputs.next();
      inputName = (String) mapEntry.getKey();
      if ( this.getIgnoreInputNamesWithMinus() && inputName.indexOf( '-' ) >= 0 ) {
        logger.info( Messages.getInstance().getString( "ScriptableCondition.INFO_IGNORED_INPUT", inputName ) ); //$NON-NLS-1$
        continue;
      }
      inputParameter = (IActionParameter) mapEntry.getValue();
      inputValue = inputParameter.getValue();
      engine.put( inputName, inputValue ); // What happens to resultset objects I wonder...
    }
    engine.put( "out", System.out );
    engine.put( "rule", this );
    Object resultObject = engine.eval( this.getScript() );
View Full Code Here

  public Map getInputDefinitionsForParameterProvider( final String parameterProviderName ) {
    Map rtnMap = new ListOrderedMap();

    Map paramList = getInputDefinitions();
    for ( Iterator it = paramList.values().iterator(); it.hasNext(); ) {
      IActionParameter actionParameter = (IActionParameter) it.next();
      List vars = actionParameter.getVariables();
      for ( int i = 0; i < vars.size(); i++ ) {
        ActionParameterSource source = (ActionParameterSource) ( vars.get( i ) );
        if ( source.getSourceName().equals( parameterProviderName ) ) {
          rtnMap.put( source.getValue(), actionParameter );
        }
View Full Code Here

    for ( IActionInput element : actionInputs ) {
      Object paramValue = element.getValue();
      String inputName = element.getName();
      if ( ( paramValue == null ) || ( "".equals( paramValue ) ) ) //$NON-NLS-1$
      {
        IActionParameter paramParameter = getInputParameter( inputName );
        if ( paramParameter.getPromptStatus() == IActionParameter.PROMPT_PENDING ) {
          result = JFreeReportComponent.INIT_REPORT_PARAMS_STATUS_PROMPT_PENDING;
          continue;
        }
        if ( isParameterUIAvailable() ) {
          // The parameter value was not provided, and we are allowed
View Full Code Here

      currentResources = resetMap( sequenceResourceNames, allParams );

      for ( Iterator it = sequenceOutputDefs.entrySet().iterator(); it.hasNext(); ) {
        Map.Entry entry = (Map.Entry) it.next();
        String outputName = (String) entry.getKey();
        IActionParameter param = (IActionParameter) allParams.get( outputName );

        if ( ( (IActionParameter) entry.getValue() ).isOutputParameter() ) {
          if ( param == null ) {
            currentOutputs.put( outputName, entry.getValue() );
          } else {
            currentOutputs.put( outputName, param );
          }
        }
      }
      return;
    }

    String key;
    Object value;
    for ( Iterator it = actionDefinition.getActionInputDefinitions().keySet().iterator(); it.hasNext(); ) {
      key = (String) it.next();
      value = allParams.get( actionDefinition.getMappedInputName( key ) );
      if ( value == null ) {
        value = actionDefinition.getActionInputDefinitions().get( key );
        if ( !( (ActionParameter) value ).hasDefaultValue() ) {
          value = null; // Only use if there is a default value;
        }
      }

      if ( value != null ) {
        currentInputs.put( key, value );
      }
    }

    // currentOutputs.putAll(actionDefinition.getActionOutputDefinitions());
    // only put output parameters
    Map outParams = actionDefinition.getActionOutputDefinitions();
    for ( Object outKey : outParams.keySet() ) {
      ActionParameter param = (ActionParameter) outParams.get( outKey );
      if ( param.isOutputParameter() ) {
        currentOutputs.put( outKey, param );
      }
    }

    // This enables the old behavior - It should eventually be removed
View Full Code Here

      }
    }
  }

  public void addToAllInputs( final String key, final IActionParameter param ) {
    IActionParameter old = (IActionParameter) allParams.put( key, param );
    if ( ( old != null ) && !allParams.containsValue( old ) ) {
      waitingToDieParams.add( old ); // Just in case a parameter gets over written delete it at the final dispose
    }
  }
View Full Code Here

  public boolean addOutputParameters( final ISolutionActionDefinition actionDefinition ) {

    String key;
    for ( Iterator it = actionDefinition.getActionOutputDefinitions().keySet().iterator(); it.hasNext(); ) {
      key = (String) it.next();
      IActionParameter outputParam = (IActionParameter) currentOutputs.get( key );
      key = actionDefinition.getMappedOutputName( key );

      // If we already have a parameter with this name, set the value and reuse the definition.
      IActionParameter param = (IActionParameter) allParams.get( key );
      if ( param != null ) {
        if ( param != outputParam ) { // This is a trap for catching temp params that didn't get deleted at the end
                                      // of
                                      // the last loop
          param.dispose();
          param.setValue( outputParam.getValue() );
        }
      } else {
        addToAllInputs( key, outputParam );
      }
    }
View Full Code Here

    // Iterate for each output defined
    for ( Iterator it = sequenceOutputDefs.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry entry = (Map.Entry) it.next();
      String outputName = (String) entry.getKey();
      IActionParameter outputParam = (IActionParameter) entry.getValue();

      if ( !outputParam.isOutputParameter() ) {
        continue;
      }

      // The output Action Parameter objects do not have values - they are just the definition
      // Pull the value from allParams
      IActionParameter inputParam = (IActionParameter) allParams.get( outputName );
      if ( inputParam == null ) {
        returnMap.put( outputParam.getName(), null );
      } else {
        for ( Iterator varIt = outputParam.getVariables().iterator(); varIt.hasNext(); ) {
          ActionParameterSource src = (ActionParameterSource) varIt.next();
          returnMap.put( outputParam.getName(), new ReturnParameter( src.getSourceName(), src.getValue(), inputParam
              .getValue() ) );
        }
      }
    }
    return ( returnMap );
View Full Code Here

     * request. Before this fix, the XForm would generate code that puts REGION on the request, not regn.
     *
     * MB
     */
    // TODO - figure out the actual name used - this is just a guess - maybe store in the ActionParam
    IActionParameter actionParameter = getCurrentInput( fieldName );
    if ( actionParameter != null ) {
      List vars = actionParameter.getVariables();

      for ( int i = 0; i < vars.size(); i++ ) {
        ActionParameterSource source = (ActionParameterSource) ( vars.get( i ) );
        if ( source.getSourceName().equals( IParameterProvider.SCOPE_REQUEST ) ) {
          return source.getValue();
View Full Code Here

      String name = (String) it.next();
      //CHECKSTYLE IGNORE EmptyBlock FOR NEXT 3 LINES
      if ( name.equals( "outputstream" ) ) { //$NON-NLS-1$
        // we should be done
      } else {
        IActionParameter param = getOutputItem( name );
        Method method = getMethods.get( name.toUpperCase() );
        if ( method != null ) {
          Object value = method.invoke( pojo, new Object[] {} );
          param.setValue( value );
        } else {
          Object value = outputMap.get( name );
          if ( value != null ) {
            param.setValue( value );
          } else {
            throw new NoSuchMethodException( name );
          }
        }
      }
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.