Java Code Examples for org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask#setAppContext()

The following examples show how to use org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask#setAppContext() . 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: ScalarParameter.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public IGetParameterDefinitionTask createParameterDefinitionTask()
{
	IGetParameterDefinitionTask task = null;
	if (engineTask != null)
	{
		task = engineTask.getEngine( )
			.createGetParameterDefinitionTask( engineTask.getReportRunnable( ) );
	}
	if (taskContext != null)
	{
	
		Map context = new HashMap( );
		Iterator itor = taskContext.keySet( ).iterator( );
		while(itor.hasNext( ))
		{
			Object obj = itor.next( );
			context.put( obj, taskContext.get( obj ) );
		}
		// TODO replace with DtE constant
		context.put( "com.actuate.birt.data.linkeddatamodel.LinkedDataModelDataModeSize",
				ReportPlugin.getDefault( ).getPluginPreferences( ).getString( ReportPlugin.DATA_MODEL_MEMORY_LIMIT_PREFERENCE ) );
		task.setAppContext( context );
		
	}
	return task;
}
 
Example 2
Source File: ReportEngineService.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * createGetParameterDefinitionTask.
 * 
 * @param runnable
 * @return the get parameter definition task
 */
public IGetParameterDefinitionTask createGetParameterDefinitionTask(
		IReportRunnable runnable, InputOptions options )
{
	IGetParameterDefinitionTask task = null;

	try
	{
		HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST );
		Locale locale = (Locale) options.getOption( InputOptions.OPT_LOCALE );
		TimeZone timeZone = (TimeZone) options.getOption( InputOptions.OPT_TIMEZONE );

		task = engine.createGetParameterDefinitionTask( runnable );
		task.setLocale( locale );

		com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone( timeZone );
		if ( tz != null )
		{
			task.setTimeZone( tz );
		}

		// set app context
		Map context = BirtUtility.getAppContext( request );
		task.setAppContext( context );
	}
	catch ( Exception e )
	{
	}

	return task;
}
 
Example 3
Source File: BirtViewerReportService.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns the GetParameterDefinitionTask
 * 
 * @param design
 * @param options
 * @return
 * @throws ReportServiceException
 */
private IGetParameterDefinitionTask getParameterDefinitionTask(
		IViewerReportDesignHandle design, InputOptions options )
		throws ReportServiceException
{
	IGetParameterDefinitionTask task;
	if ( design.getContentType( ) == IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT )
	{
		// IReportRunnable is specified in IViewerReportDesignHandle.
		IReportRunnable runnable = (IReportRunnable) design.getDesignObject( );
		task = ReportEngineService.getInstance( )
				.createGetParameterDefinitionTask( runnable, options );
	}
	else
	{
		// report design name is specified in IViewerReportDesignHandle.
		try
		{
			task = getParameterDefinitionTask( design.getFileName( ),
					options );
		}
		catch ( EngineException e )
		{
			throw new ReportServiceException( e.getLocalizedMessage( ),
					e.getCause( ) );
		}
	}

	// set AppConext
	if ( task != null )
	{
		HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST );
		HashMap context = new HashMap( );
		context.put( EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,
				request );
		ParameterAccessor.pushAppContext( context, request );
		task.setAppContext( context );
	}

	return task;
}