*
* In the query section you can either execute the query right away or prepare it to be used later by a sub report.
*/
try {
if ( getActionDefinition() instanceof MdxQueryAction ) {
MdxQueryAction queryAction = (MdxQueryAction) getActionDefinition();
// if there is a prepared component specified as an input, use its connection
// instead of creating our own.
if ( queryAction.getMdxConnection() != ActionInputConstant.NULL_INPUT ) {
if ( queryAction.getMdxConnection().getValue() != null ) {
connectionOwner = false;
IPreparedComponent component = (IPreparedComponent) queryAction.getMdxConnection().getValue();
IPentahoConnection conn = component.shareConnection();
if ( conn.getDatasourceType() == IPentahoConnection.MDX_DATASOURCE ) {
connection = conn;
} else {
error( Messages.getInstance().getErrorString(
"IPreparedComponent.ERROR_0001_INVALID_CONNECTION_TYPE", getActionName() ) ); //$NON-NLS-1$
}
} else {
error( Messages.getInstance().getErrorString(
"IPreparedComponent.ERROR_0002_CONNECTION_NOT_AVAILABLE", getActionName() ) ); //$NON-NLS-1$
}
} else {
dispose();
connection = getDatasourceConnection();
}
if ( connection != null ) {
String query = queryAction.getQuery().getStringValue();
if ( queryAction.getOutputPreparedStatement() != null ) {
// prepare the query for execution, but don't execute quite yet.
prepareQuery( query );
// set the output as self, which will be used later by another component.
setOutputValue( IPreparedComponent.PREPARED_COMPONENT_NAME, this );
value = true;