// For backwards compatibility, call into the new metadata query component
//
MetadataQueryComponent component = new MetadataQueryComponent();
// setup component
MQLAction actionDefinition = (MQLAction) getActionDefinition();
String mql = actionDefinition.getQuery().getStringValue();
component.setQuery( mql );
if ( actionDefinition.getMaxRows() != ActionInputConstant.NULL_INPUT ) {
component.setMaxRows( actionDefinition.getMaxRows().getIntValue() );
}
if ( actionDefinition.getQueryTimeout() != ActionInputConstant.NULL_INPUT ) {
component.setTimeout( actionDefinition.getQueryTimeout().getIntValue() );
}
if ( actionDefinition.getReadOnly() != ActionInputConstant.NULL_INPUT ) {
component.setReadOnly( actionDefinition.getReadOnly().getBooleanValue() );
}
// log the sql to info if set
if ( isDefinedInput( "logSql" ) ) { //$NON-NLS-1$
component.setLogSql( "true".equals( actionDefinition.getInput( "logSql" ).getStringValue() ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
// TODO: We also need to pass in the component definitions
Set<String> inputNames = getInputNames();
if ( inputNames != null ) {
Map<String, Object> inputMap = new HashMap<String, Object>();
for ( String inputName : inputNames ) {
inputMap.put( ActionDefinitionEncoder.decodeBlankSpaces( inputName ), getInputValue( inputName ) );
}
component.setInputs( inputMap );
}
boolean success = component.execute();
if ( success ) {
IActionOutput actionOutput = actionDefinition.getOutputResultSet();
if ( actionOutput != null ) {
actionOutput.setValue( component.getResultSet() );
}
}