itemGeneration.setReportQueries( ( (ExtendedItemDesign) item ) .getQueries( ) );
IBaseQueryDefinition[] queries = ( (ExtendedItemDesign) item ) .getQueries( ); if ( queries == null ) { if ( item.getQuery( ) != null ) { queries = new IBaseQueryDefinition[]{item.getQuery( )}; } } itemGeneration.setReportQueries( queries );
	protected void generateContent( ExtendedItemDesign item,			IForeignContent content )	{		// create user-defined generation-time helper object		ExtendedItemHandle handle = (ExtendedItemHandle) item.getHandle( );		String tagName = handle.getExtensionName( );		String name = item.getName( );		IReportItemGeneration itemGeneration = ExtensionManager.getInstance( )				.createGenerationItem( tagName );		byte[] generationStatus = null;		if ( itemGeneration != null )		{			itemGeneration.setModelObject( handle );			itemGeneration.setScriptContext( context.getReportContext( ) );			itemGeneration.setReportQueries( ( (ExtendedItemDesign) item )					.getQueries( ) );			IRowSet[] rowSets = executeQueries( item );			try			{				if ( rowSets != null )				{					itemGeneration.onRowSets( rowSets );				}				if ( itemGeneration.needSerialization( ) )				{					ByteArrayOutputStream out = new ByteArrayOutputStream( );					itemGeneration.serialize( out );					generationStatus = out.toByteArray( );				}				itemGeneration.finish( );			}			catch ( BirtException ex )			{				logger.log( Level.SEVERE, ex.getMessage( ), ex );				context.addException( new EngineException(						MessageConstants.EXTENDED_ITEM_GENERATION_ERROR, handle								.getExtensionName( )								+ ( name != null ? " " + name : "" ), ex ) );//$NON-NLS-1$			}			closeQueries( rowSets );		}		content.setRawType( IForeignContent.EXTERNAL_TYPE );		content.setRawValue( generationStatus );	}