String queryID = String.valueOf( queryElement.getID( ) );
String queryID = (String) queryIDMap.get( query );
	protected IResultSet doExecute( IBaseQueryDefinition query )	{		assert query instanceof IQueryDefinition;		IPreparedQuery preparedQuery = (IPreparedQuery) mapQueryToPreparedQuery.get( query );		ReportElementDesign queryElement = (ReportElementDesign) queryIDMap				.get( query );		String queryID = String.valueOf( queryElement.getID( ) );		assert preparedQuery != null;		Scriptable queryScope = context.getSharedScope( );		IQueryResults queryResults = null;		DteResultSet parentResult = (DteResultSet) getParentResultSet( );		if ( parentResult != null )		{			queryResults = parentResult.getQueryResults( );		}		DteResultSet resultSet = null;		try		{			if ( queryResults == null )			{				queryResults = preparedQuery.execute( queryScope );				validateQueryResult( queryResults );				resultSet = new DteResultSet( queryResults, this, context );			}			else			{ // the query is NestedQuery				String parentRSID = queryResults.getID( );				String rowid = "" + parentResult.getCurrentPosition( );				queryResults = preparedQuery.execute( queryResults, queryScope );				validateQueryResult( queryResults );				String childRSID = queryResults.getID( );				Key key = new Key( parentRSID, rowid, childRSID );				queryResultRelations.add( key );				resultSet = new DteResultSet( queryResults, this, context );			}			queryResultStack.addLast( resultSet );			LinkedList qidList = (LinkedList) mapQueryIDToResultSetIDs.get( queryID );			if ( qidList == null )			{				qidList = new LinkedList( );			}			qidList.add( queryResults.getID( ) );			mapQueryIDToResultSetIDs.put( queryID, qidList );		}		catch ( BirtException be )		{			logger.log( Level.SEVERE, be.getMessage( ) );			context.addException( be );		}		return resultSet;	}