Java Code Examples for org.eclipse.birt.core.exception.BirtException#printStackTrace()

The following examples show how to use org.eclipse.birt.core.exception.BirtException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroupOnXSeries.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private IDesignEngine getDesignEngine( )
{

	DesignConfig config = new DesignConfig( );
	try
	{
		Platform.startup( config );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}

	Object factory = Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );

	return ( (IDesignEngineFactory) factory ).createDesignEngine( config );
}
 
Example 2
Source File: MeterChartExample.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private IDesignEngine getDesignEngine( )
{
	DesignConfig config = new DesignConfig( );
	try
	{
		Platform.startup( config );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}

	Object factory = Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );

	return ( (IDesignEngineFactory) factory ).createDesignEngine( config );
}
 
Example 3
Source File: StockReport.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private IDesignEngine getDesignEngine( )
{

	DesignConfig config = new DesignConfig( );
	try
	{
		Platform.startup( config );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}

	Object factory = Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );

	return ( (IDesignEngineFactory) factory ).createDesignEngine( config );
}
 
Example 4
Source File: SalesReport.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private IDesignEngine getDesignEngine( )
{

	DesignConfig config = new DesignConfig( );
	try
	{
		Platform.startup( config );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}

	Object factory = Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );

	return ( (IDesignEngineFactory) factory ).createDesignEngine( config );
}
 
Example 5
Source File: ResourceLocatorTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void testResourceImage( )
{
	path = "file://" + this.genInputFolder( ) + separator + "resources"
			+ separator;
	// path="http://192.168.218.234:88/resource/";
	IResourceLocator locator = new EngineResourceLocator( path );
	try
	{
		renderReport( "resource_image", locator );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
		fail( "Failed to find image resource from custom resource locator" );
	}
	File f = new File( this.genOutputFile( "resource_image.html" ) );
	assertTrue( "Failed render report from image resource", f.exists( ) );
}
 
Example 6
Source File: ResourceLocatorTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void testResourceProperties( )
{
	path = "file://" + this.genInputFolder( ) + separator + "resources"
			+ separator;
	// path="http://192.168.218.234:88/resource/";
	IResourceLocator locator = new EngineResourceLocator( path );
	try
	{
		renderReport( "resource_properties", locator );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
		fail( "Failed to find library resource from custom resource locator" );
	}
	File f = new File( this.genOutputFile( "resource_properties.html" ) );
	assertTrue( "Failed render report from properties resource", f.exists( ) );
}
 
Example 7
Source File: ResourceLocatorTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void testResourceLibrary( )
{
	path = "file://" + this.genInputFolder( ) + separator + "resources"
			+ separator;
	// path="http://192.168.218.234:88/resource/";
	IResourceLocator locator = new EngineResourceLocator( path );
	try
	{
		renderReport( "resource_library", locator );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
		fail( "Failed to find properties resource from custom resource locator" );
	}

	File f = new File( this.genOutputFile( "resource_library.html" ) );
	assertTrue( "Failed render report from library", f.exists( ) );
}
 
Example 8
Source File: GroupOnYAxis.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private IDesignEngine getDesignEngine( )
{

	DesignConfig config = new DesignConfig( );
	try
	{
		Platform.startup( config );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}

	Object factory = Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );

	return ( (IDesignEngineFactory) factory ).createDesignEngine( config );
}
 
Example 9
Source File: ViewerServletContextListener.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void contextInitialized( ServletContextEvent event )
{
	ParameterAccessor.initParameters( event.getServletContext( ) );
	IViewerReportService instance = new BirtViewerReportService( event
			.getServletContext( ) );
	BirtReportServiceFactory.init( instance );
	try
	{
		BirtReportServiceFactory.getReportService( ).setContext(
				event.getServletContext( ), null );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}
}
 
Example 10
Source File: DataSetFiltersPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void initColumnNames( )
{
	try
	{
		columns = ( (DataSetEditor) this.getContainer( ) ).getCurrentItemModel( true );
		if ( columns != null )
		{
			columnExpressions = new String[columns.length];
			for ( int n = 0; n < columns.length; n++ )
			{
				columnExpressions[n] = columns[n].getName( );
			}
		}
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}
}
 
Example 11
Source File: DataTypeUtilTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Test
   public void testToBoolean( )
{
	Boolean result;
	for ( int i = 0; i < testObject.length; i++ )
	{
		System.out.println(i);
		try
		{
			result = DataTypeUtil.toBoolean( testObject[i] );
			if ( resultBoolean[i] instanceof Exception )
				fail( "Should throw Exception." );
			assertEquals( result, resultBoolean[i] );
		}
		catch ( BirtException dteEx )
		{
			if ( !( resultBoolean[i] instanceof Exception ) )
				fail( "Should not throw Exception." );
		}
	}
	
	try
	{
		assertTrue( DataTypeUtil.toBoolean( new Double(0.1) ).booleanValue( ));
		assertTrue( DataTypeUtil.toBoolean( new Double(-0.1) ).booleanValue( ));
		assertTrue( DataTypeUtil.toBoolean( new Double(1) ).booleanValue( ));
		assertTrue( DataTypeUtil.toBoolean( new Double(1) ).booleanValue( ));
		assertFalse( DataTypeUtil.toBoolean( new Double(0) ).booleanValue( ));
	}
	catch ( BirtException e )
	{
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
 
Example 12
Source File: BirtViewerReportService.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Default constructor
 * 
 * @param context
 */
public BirtViewerReportService( ServletContext context )
{
	try
	{
		ReportEngineService.initEngineInstance( context );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
	}
}
 
Example 13
Source File: AbstractGroupStructureProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private GroupHandle convertGroup( ElementFactory factory,
		DataGroupHandle dataGroup )
{
	try
	{
		TableGroupHandle group = factory.newTableGroup( );

		group.setName( dataGroup.getGroupName( ) );
		group.setExpressionProperty( IGroupElementModel.KEY_EXPR_PROP,
				(Expression) dataGroup.getExpressionProperty( IDataGroupModel.KEY_EXPR_PROP )
						.getValue( ) );
		group.setInterval( dataGroup.getInterval( ) );
		group.setIntervalBase( dataGroup.getIntervalBase( ) );
		group.setIntervalRange( dataGroup.getIntervalRange( ) );

		group.setSortDirection( dataGroup.getSortDirection( ) );

		// TODO copy sort/filter definitions and other properties, so far
		// only the properties above are used, the main purpose is to
		// populate the value list from UI.

		return group;
	}
	catch ( BirtException e )
	{
		// TODO Auto-generated catch block
		e.printStackTrace( );
	}

	return null;
}
 
Example 14
Source File: DataSetComputedColumnsPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 
 */
public DataSetComputedColumnsPage( )
{
	super( );
	try
	{
		aggregationManager = DataUtil.getAggregationManager( ).getInstance( );
	}
	catch ( BirtException e )
	{
		e.printStackTrace();
	}
}
 
Example 15
Source File: IDataIteratorTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void checkNext( IDataIterator iterator )
{
	int count = 0;
	try
	{
		while ( iterator.next( ) )
			count++;
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
		fail( );
	}
	assertEquals( 6, count );
}
 
Example 16
Source File: IDataIteratorTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void checkGetResultMetaData( IDataIterator iterator )
{
	try
	{
		IResultMetaData metaData = iterator.getResultMetaData( );
		assertEquals( 4, metaData.getColumnCount( ) );
	}
	catch ( BirtException e )
	{
		e.printStackTrace( );
		fail( );
	}
}
 
Example 17
Source File: DataSetComputedColumnsPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected IStatus validateSyntax( Object structureOrHandle )
		{
			try
			{
				// duplicated columnName check
				if ( !isUniqueColumnName( ) )
					return getMiscStatus( IStatus.ERROR,
							Messages.getString( "DataSetComputedColumnsPage.duplicatedName" ) ); //$NON-NLS-1$

				// blankProperty check
				if ( isBlankProperty( txtColumnName.getText( ) ) )
					return getBlankPropertyStatus( dialogLabels[COLUMN_NAME_INDEX] );
				if ( isBlankProperty( cmbDataType.getText( ) ) )
					return getBlankPropertyStatus( dialogLabels[DATA_TYPE_INDEX] );
				//ColumnName is number
				if ( isNumeric( txtColumnName.getText( ) ) )
				{
					return getMiscStatus( IStatus.ERROR,
							Messages.getString( "DataSetComputedColumnsPage.numberName" ) );
				}
//				if ( expression!=null && isBlankProperty( expression.getText( ) ) )
//				{
//					String funcName = getSelectedFunction( ).getName( );
//					if ( isFunctionCount( funcName ) == false )
//						return getBlankPropertyStatus( cellLabels[EXPRESSION_INDEX] );
//				}
				// validate arguments
				IAggrFunction aggrFunc = getSelectedFunction( );
				if ( aggrFunc != null )
				{
					IParameterDefn[] paramDefns = aggrFunc.getParameterDefn( );
					for ( int i = 0; i < paramDefns.length; i++ )
					{
						if ( !paramDefns[i].isOptional( )
								&& isBlankProperty( txtParams[i].getText( ) ) )
						{
							return getBlankPropertyStatus( paramDefns[i].getDisplayName( ) );
						}
					}
				}
				else if ( txtParams != null
						&& isBlankProperty( txtParams[0].getText( ) ) )
				{
					return getBlankPropertyStatus( dialogLabels[EXPRESSION_INDEX] );
				}


				if ( cmbAggregation != null
						&& cmbAggregation.getText( ).trim( ).length( ) > 0
						&& !checkExpressionBindingFields( ) )
				{
					return getMiscStatus( IStatus.ERROR,
							Messages.getString( "DataSetComputedColumnsPage.InputDialog.message.error.AggregationExpression" ) ); //$NON-NLS-1$
				}
			}
			catch ( BirtException e )
			{
				e.printStackTrace( );
			}
			return getOKStatus( );
		}