protected Set getInputNames() { return runtimeContext.getInputNames(); }
protected boolean isDefinedInput( final String inputName ) { if ( runtimeContext.getInputNames().contains( inputName ) ) { return true; } else { return getComponentSetting( inputName ) != null; } }
@SuppressWarnings( { "unchecked" } ) InputProperties( final IRuntimeContext context ) { this.context = context; inputs = new HashSet<String>(); inputs.addAll( context.getInputNames() ); inputs.addAll( context.getParameterManager().getCurrentInputNames() ); inputs.add( "$user" ); //$NON-NLS-1$ inputs.add( "$url" ); //$NON-NLS-1$ inputs.add( "$solution" ); //$NON-NLS-1$ }
private String getComponentSetting( final String path ) { // first check to see if we have an input parameter that we can use for // this. if ( runtimeContext.getInputNames().contains( path ) ) { return runtimeContext.getInputParameterStringValue( path ); } if ( componentDefinitionMap != null && componentDefinitionMap.containsKey( path ) ) { return componentDefinitionMap.get( path ); } else { // now check the component node from the action definition. Node node = componentDefinition.selectSingleNode( path ); if ( node == null ) { return null; } return node.getText(); } }
public Object getInputValue( final IActionInput actionInput ) { Object value = null; String variableName = actionInput.getName(); if ( runtimeContext.getInputNames().contains( variableName ) ) { value = runtimeContext.getInputParameterValue( variableName ); } if ( value instanceof IContentItem ) { value = ( (IContentItem) value ).getInputStream(); } return value; }
protected Object getInputValue( final String inputName ) { // first check to see if we have an input parameter that we can use for // this. if ( runtimeContext.getInputNames().contains( inputName ) ) { return runtimeContext.getInputParameterValue( inputName ); } // now check the component node from the action definition. Node node = componentDefinition.selectSingleNode( inputName ); if ( node == null ) { return null; } return node.getText(); }
protected String getInputStringValue( final String inputName, final boolean applyTemplates ) { // first check to see if we have an input parameter that we can use for // this. String value = null; if ( runtimeContext.getInputNames().contains( inputName ) ) { value = runtimeContext.getInputParameterStringValue( inputName ); } else { value = getComponentSetting( inputName ); } if ( value != null ) { if ( applyTemplates ) { // TODO make the format appliation configurable value = this.applyInputsToFormat( value ); } } return value; }
if ( ( context != null ) && context.getInputNames().contains( outerParamName ) ) { value = context.getInputParameterValue( outerParamName );
public String getProperty( final String parameter, final String keyColumn, String keyValue, final String valueColumn, final String defaultValue ) { if ( !context.getInputNames().contains( parameter ) ) {
public void testKeyedTableTemplate() { IRuntimeContext mockRuntimeContext = mock( IRuntimeContext.class ); IPentahoSession mockSession = mock( IPentahoSession.class ); IParameterManager mockParameterManager = mock( IParameterManager.class ); IPentahoResultSet mockPentahoResultSet = createMockResultSet(); IPentahoMetaData mockPentahoMetaData = mock( IPentahoMetaData.class ); final Set inputNames = new HashSet<Object>( Arrays.asList( new String[] { "param1" } ) ); when( mockParameterManager.getCurrentInputNames() ).thenReturn( inputNames ); when( mockRuntimeContext.getSession() ).thenReturn( mockSession ); when( mockRuntimeContext.getParameterManager() ).thenReturn( mockParameterManager ); when( mockRuntimeContext.getInputParameterValue( "param1" ) ).thenReturn( mockPentahoResultSet ); when( mockRuntimeContext.getInputNames() ).thenReturn( inputNames ); String template = "{param1:keycol:key_Value:valcol:defaultValue}"; // "key_value" is parsed as "key value" assertEquals( "field Value", TemplateUtil.applyTemplate( template, mockRuntimeContext ) ); }
when( mockParameterManager.getCurrentInputNames() ).thenReturn( paramMap.keySet() ); when( mockParameterManager.getAllParameters() ).thenReturn( paramMap ); when( mockRuntimeContext.getInputNames() ).thenReturn( inputMap.keySet() );