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

The following examples show how to use org.eclipse.birt.core.exception.BirtException#getLocalizedMessage() . 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: DataSetIterator.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * @param session
 * @param query
 * @param appContext
 * @throws AdapterException
 */
private void executeQuery( DataRequestSessionImpl session, IQueryDefinition query, Map appContext )
		throws AdapterException
{
	try
	{
		
		Scriptable scope = session.getScope( );
		TempDateTransformer tt = new TempDateTransformer( session.getDataSessionContext( )
				.getDataEngineContext( )
				.getLocale( ) );
		ScriptableObject.putProperty( scope, tt.getClassName( ), tt );

		queryResult = session.prepare( query, appContext ).execute( scope );
		this.it = queryResult.getResultIterator( );
	}
	catch ( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}
 
Example 2
Source File: ServiceForQueryResults.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * @param expr
 * @return
 * @throws BirtException
 * @throws DataException
 */
private boolean hasRowNumRefExpr( IScriptExpression expr ) throws DataException
{
	try
	{
		if ( expr == null || expr.getText( ) == null || BaseExpression.constantId.equals( expr.getScriptId( ) ) )
			return false;
		if ( expr.getText( ).matches( ".*\\Qrow.__rownum\\E.*" ) )
			return true;
		return findRowNumReferenceInBindings( ExpressionUtil.extractColumnExpressions( expr.getText( ) ) );
	}
	catch ( BirtException e )
	{
		throw new DataException( e.getLocalizedMessage( ) );
	}
}
 
Example 3
Source File: TimeDimensionDatasetIterator.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
TimeDimensionDatasetIterator( DataRequestSessionImpl session, Date startTime, Date endTime, String[] fieldName, String[] timeType ) throws AdapterException
{
	try
	{
		if( startTime != null )
		{
			this.calendar = Calendar.getInstance( session.getDataSessionContext( )
					.getDataEngineContext( )
					.getLocale( ) ); 
			this.calendar.setTimeZone( session.getDataSessionContext( )
					.getDataEngineContext( ).getTimeZone( ) );
			this.calendar.clear( );
			this.calendar.setTime( startTime );
		}
		
		this.endTime = endTime;
		this.fieldName = fieldName;
		this.timeType = timeType;
		this.firstNext = false;
	}
	catch( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}
 
Example 4
Source File: BirtComp.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Object execute( Object[] args, IScriptFunctionContext context ) throws BirtException
{
	Collator collator = (Collator) context.findProperty( "compare_locale" );
	if ( args == null || args.length != 3 )
		throw new IllegalArgumentException( MessageFormat.format( WRONG_ARGUMENT,
				new Object[]{
					BETWEEN
				} ) );
	
	try
	{
		return this.mode
				? Boolean.valueOf( compare( args[0], args[1],collator ) >= 0
						&& compare( args[0], args[2],collator ) <= 0 )
				: Boolean.valueOf( !( compare( args[0], args[1],collator ) >= 0 && compare( args[0],
						args[2],collator ) <= 0 ) );
	}
	catch ( BirtException e )
	{
		throw new IllegalArgumentException( e.getLocalizedMessage( ) );
	}
}
 
Example 5
Source File: DataSetInstance.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets value of a data set output parameter
 */
public void setOutputParameterValue(String paramName, Object paramValue)
		throws ScriptException 
{
	try 
	{
		dataSet.setOutputParameterValue(paramName, paramValue);
	} catch (BirtException e) 
	{
		throw new ScriptException (e.getLocalizedMessage());
	}
}
 
Example 6
Source File: DataSetInstance.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets value of a data set output parameter by name 
 */
public Object getOutputParameterValue(String paramName)
		throws ScriptException 
{
	try 
	{
		return dataSet.getOutputParameterValue(paramName);
	} catch (BirtException e) 
	{
		throw new ScriptException( e.getLocalizedMessage());
	}
}
 
Example 7
Source File: DataSetInstance.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets value of  a data set input parameter by name
 */
public Object getInputParameterValue(String paramName)
		throws ScriptException 
{
	try 
	{
		return dataSet.getInputParameterValue(paramName);
	} catch (BirtException e) {
		throw new ScriptException( e.getLocalizedMessage());
	}
}
 
Example 8
Source File: DataSetRow.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getColumnValue( int index ) throws ScriptException
{
	try
	{
		return row.getColumnValue( index );
	} catch ( BirtException e )
	{
		throw new ScriptException( e.getLocalizedMessage( ) );
	}
}
 
Example 9
Source File: ColumnMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getColumnAlias(int index) throws ScriptException {
	try {
		return meta.getColumnAlias(index);
	} catch (BirtException e) {
		throw new ScriptException(e.getLocalizedMessage());
	}
}
 
Example 10
Source File: ReportElementInstance.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IReportElementInstance getParent( ) throws ScriptException
{
	try
	{
		return ElementUtil.getInstance( content.getParent( ), context,
				runningState );
	}
	catch ( BirtException e )
	{
		ScriptException scriptException = new ScriptException( e
				.getLocalizedMessage( ) );
		scriptException.initCause( e );
		throw scriptException;
	}
}
 
Example 11
Source File: ColumnMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public int getColumnType(int index) throws ScriptException {
	try {
		return meta.getColumnType(index);
	} catch (BirtException e) {
		throw new ScriptException(e.getLocalizedMessage());
	}
}
 
Example 12
Source File: ColumnMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getColumnNativeTypeName(int index) throws ScriptException {
	try {
		return meta.getColumnNativeTypeName(index);
	} catch (BirtException e) {
		throw new ScriptException(e.getLocalizedMessage());
	}
}
 
Example 13
Source File: CubeQueryUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Iterator getMemberValueIterator( TabularCubeHandle cubeHandle,
		String dataBindingExpr, ICubeQueryDefinition queryDefn, Map appContext )
		throws AdapterException
{
	try
	{
		if ( cubeHandle == null
				|| dataBindingExpr == null || queryDefn == null )
			return null;

		List bindings = queryDefn.getBindings();
		Set dimLevels = OlapExpressionCompiler.getReferencedDimLevel( new ScriptExpression( dataBindingExpr ),
				bindings,
				true );
		if ( dimLevels.size( ) == 0 || dimLevels.size( ) > 1 )
			return null;

		DimLevel target = (DimLevel) dimLevels.iterator( ).next( );
		int targetDataType = getTargetDataType( bindings, dataBindingExpr );
		TabularHierarchyHandle hierHandle = (TabularHierarchyHandle) ( cubeHandle.getDimension( target.getDimensionName( ) ).getContent( TabularDimensionHandle.HIERARCHIES_PROP,
				0 ) );
		if ( hierHandle.getDataSet( ) != null )
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( hierHandle.getDataSet( ),
					this.sessionImpl );
		else
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( cubeHandle.getDataSet( ),
					this.sessionImpl );
		Map levelValueMap = new HashMap( );

		DataSetIterator it = createDataSetIterator( appContext, cubeHandle.getDimension( target.getDimensionName( ) ), String.valueOf( cubeHandle.getElement( ).getID( )) );
		return new MemberValueIterator( it,
				levelValueMap,
				target.getLevelName( ), target.getAttrName( ) ,targetDataType);
	}
	catch ( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}
 
Example 14
Source File: ColumnMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getColumnLabel(int index) throws ScriptException {
	try {
		return meta.getColumnLabel(index);
	} catch (BirtException e) {
		throw new ScriptException(e.getLocalizedMessage());
	}
}
 
Example 15
Source File: ColumnMetaData.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getColumnTypeName(int index) throws ScriptException {
	try {
		return meta.getColumnTypeName(index);
	} catch (BirtException e) {
		throw new ScriptException(e.getLocalizedMessage());
	}
}
 
Example 16
Source File: DataSetRow.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getColumnValue( String name ) throws ScriptException
{
	try
	{
		return row.getColumnValue( name );
	} catch ( BirtException e )
	{
		throw new ScriptException( e.getLocalizedMessage( ) );
	}
}
 
Example 17
Source File: CubeQueryUtil.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Iterator getMemberValueIterator( TabularCubeHandle cubeHandle,
		String targetLevel, DimensionLevel[] dimensionLevels,
		Object[] values, Map appContext ) throws AdapterException
{
	try
	{
		if ( ( dimensionLevels == null && values != null )
				|| ( dimensionLevels != null && values == null )
				|| cubeHandle == null || targetLevel == null )
			return null;
		DimLevel target = OlapExpressionUtil.getTargetDimLevel( targetLevel );
		TabularHierarchyHandle hierHandle = (TabularHierarchyHandle) ( cubeHandle.getDimension( target.getDimensionName( ) ).getContent( TabularDimensionHandle.HIERARCHIES_PROP,
				0 ) );
		if ( hierHandle.getDataSet( ) != null )
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( hierHandle.getDataSet( ),
					this.sessionImpl );
		else
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( cubeHandle.getDataSet( ),
					this.sessionImpl );
		Map levelValueMap = new HashMap( );
		if ( dimensionLevels != null )
		{
			for ( int i = 0; i < dimensionLevels.length; i++ )
			{
				if ( target.getDimensionName( )
						.equals( dimensionLevels[i].getDimensionName( ) ) )
				{
					levelValueMap.put( dimensionLevels[i].getLevelName( ),
							values[i] );
				}
			}
		}
		DataSetIterator it = createDataSetIterator( appContext, cubeHandle.getDimension( target.getDimensionName( ) ), String.valueOf( cubeHandle.getElement( ).getID( )) );
		
		return new MemberValueIterator( it,
				levelValueMap,
				target.getLevelName( ),
				target.getAttrName( ) );
	}
	catch ( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}
 
Example 18
Source File: CubeQueryUtil.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Iterator getMemberValueIterator( CubeHandle cubeHandle,
		String targetLevel, DimensionLevel[] dimensionLevels,
		Object[] values, Map appContext ) throws AdapterException
{
	try
	{
		if ( ( dimensionLevels == null && values != null )
				|| ( dimensionLevels != null && values == null )
				|| cubeHandle == null || targetLevel == null )
			return null;
		DimLevel target = OlapExpressionUtil.getTargetDimLevel( targetLevel );
		TabularHierarchyHandle hierHandle = (TabularHierarchyHandle) ( cubeHandle.getDimension( target.getDimensionName( ) ).getContent( TabularDimensionHandle.HIERARCHIES_PROP,
				0 ) );
		if ( hierHandle.getDataSet( ) != null )
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( hierHandle.getDataSet( ),
					this.sessionImpl );
		else
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( (DataSetHandle) cubeHandle.getElementProperty( ITabularCubeModel.DATA_SET_PROP ),
					this.sessionImpl );
		Map levelValueMap = new HashMap( );
		if ( dimensionLevels != null )
		{
			for ( int i = 0; i < dimensionLevels.length; i++ )
			{
				if ( target.getDimensionName( )
						.equals( dimensionLevels[i].getDimensionName( ) ) )
				{
					levelValueMap.put( dimensionLevels[i].getLevelName( ),
							values[i] );
				}
			}
		}
		DataSetIterator it = createDataSetIterator( appContext,
				cubeHandle.getDimension( target.getDimensionName( ) ),
				String.valueOf( cubeHandle.getElement( ).getID( ) ) );

		return new MemberValueIterator( it,
				levelValueMap,
				target.getLevelName( ),
				target.getAttrName( ) );
	}
	catch ( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}
 
Example 19
Source File: AbstractGetCascadeParameterActionHandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private List doQueryCascadeParameterSelectionList(
		IViewerReportDesignHandle design, String groupName,
		Object[] groupKeys, InputOptions options ) throws RemoteException,
		ReportServiceException
{
	List selectionList = new ArrayList( );

	Collection list = getReportService( )
			.getSelectionListForCascadingGroup( design, groupName,
					groupKeys, options );

	if ( list != null && list.size( ) > 0 )
	{
		Iterator iList = list.iterator( );
		int index = 0;
		while ( iList != null && iList.hasNext( ) )
		{
			ParameterSelectionChoice item = (ParameterSelectionChoice) iList
					.next( );
			if ( item != null && item.getValue( ) != null )
			{
				try
				{
					SelectItemChoice selectItemChoice = new SelectItemChoice( );
					selectItemChoice.setLabel( item.getLabel( ) );
					selectItemChoice.setValue( (String) DataTypeUtil
							.convert( item.getValue( ),
									DataType.STRING_TYPE ) );
					selectionList.add( index++, selectItemChoice );
				}
				catch ( BirtException e )
				{
					throw new ReportServiceException( e
							.getLocalizedMessage( ) );
				}
			}
		}
	}

	return selectionList;
}
 
Example 20
Source File: CubeQueryUtil.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Iterator getMemberValueIterator( CubeHandle cubeHandle,
		String dataBindingExpr, ICubeQueryDefinition queryDefn, Map appContext )
		throws AdapterException
{
	try
	{
		if ( cubeHandle == null
				|| dataBindingExpr == null || queryDefn == null )
			return null;

		List bindings = queryDefn.getBindings();
		Set dimLevels = OlapExpressionCompiler.getReferencedDimLevel( new ScriptExpression( dataBindingExpr ),
				bindings,
				true );
		if ( dimLevels.size( ) == 0 || dimLevels.size( ) > 1 )
			return null;

		DimLevel target = (DimLevel) dimLevels.iterator( ).next( );
		int targetDataType = getTargetDataType( bindings, dataBindingExpr );
		
		TabularHierarchyHandle hierHandle = (TabularHierarchyHandle) ( cubeHandle.getDimension( target.getDimensionName( ) ).getContent( TabularDimensionHandle.HIERARCHIES_PROP,
				0 ) );
		if ( hierHandle.getDataSet( ) != null )
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( hierHandle.getDataSet( ),
					this.sessionImpl );
		else
		{
			DefineDataSourceSetUtil.defineDataSourceAndDataSet( (DataSetHandle) cubeHandle.getElementProperty( ITabularCubeModel.DATA_SET_PROP ),
					this.sessionImpl );
		}
		
		Map levelValueMap = new HashMap( );

		DataSetIterator it = createDataSetIterator( appContext, cubeHandle.getDimension( target.getDimensionName( ) ), String.valueOf( cubeHandle.getElement( ).getID( )) );
		return new MemberValueIterator( it,
				levelValueMap,
				target.getLevelName( ), target.getAttrName( ) ,targetDataType);
	}
	catch ( BirtException e )
	{
		throw new AdapterException( e.getLocalizedMessage( ), e );
	}
}