Project: Birt
Bug 101685 Unable to use the Report Item Extension framework, when no query exists
Reported: 2005-06-24 14:40:47 | Status: resolved fixed

The current version of BIRT has a framework to enable a user to define , and use his own report components. This is done by extending several extension points such as org.eclipse.birt.report.designer.ui.reportItemUI org.eclipse.birt.report.designer.model.reportItemModel org.eclipse.birt.report.engine.reportItemPresentationEngine There however exists a problem in rendering the item , when the report is to be viewed. The current framework does not allow any method / API which gets invoked when there is no query defined for the Report. To be more specific, the org.eclipse.birt.report.engine.executor.ExtendedItemExecutor has a method called execute. Please refer to the following code snippet from this method which is invoked, when the user tries to view the report. //call the presentation peer to create the content object IReportItemPresentation itemPresentation = ExtensionManager .getInstance( ).createPresentationItem( tagName ); if ( itemPresentation != null ) { itemPresentation.setModelObject( handle ); itemPresentation.setReportQueries(((ExtendedItemDesign) item).getQueries()); //itemPresentation.setResolution(); itemPresentation.setLocale(context.getLocale()); itemPresentation.setSupportedImageFormats ( "GIF;PNG;JPG;BMP" ); itemPresentation.setOutputFormat( emitter.getOutputFormat( ) ); if ( generationStatus != null ) { itemPresentation.deserialize( new ByteArrayInputStream( generationStatus ) ); } Object output = null; IRowSet[] rowSets = null; try { rowSets = executeQueries( item ); if ( rowSets != null ) { try { output = itemPresentation.onRowSets( rowSets ); } catch ( BirtException ex ) { logger.log( Level.SEVERE, ex.getMessage( ), ex ); context.addException( new EngineException( MessageConstants.EXTENDED_ITEM_RENDERING_ERROR, new String[] {handle.getExtensionName( ), ( name != null ? " " + name : "" )}, ex ) );//$NON- NLS-1$ //$NON-NLS-2$ } } if ( output != null ) { int type = itemPresentation.getOutputType( ); handleItemContent( item, emitter, content, type, output ); } itemPresentation.finish( ); } catch ( Throwable t ) { logger.log( Level.SEVERE, "Error:", t );//$NON- NLS-1$ context.addException(new EngineException( MessageConstants.EXTENDED_ITEM_RENDERING_ERROR, new String[] {handle.getExtensionName( ), ( name != null ? " " + name : "" )}, t ) );//$NON- NLS-1$ //$NON-NLS-2$ } finally { closeQueries( rowSets ); } } 1) It can be seen from here that if there is no rowSet or no query , nothing is done 2) There does exist a method called getOutputContent() in the ReportItemPresentationBase , which is not being used anywhere in the framework. May be this method or a similar method can be used , when there is no associated query. The ExtendedItemExecutor need to be modified to handle this case

Files changed in fix:
engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/ExtendedItemExecutor.java