Java Code Examples for org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask#close()
The following examples show how to use
org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask#close() .
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: AbstractViewer.java From birt with Eclipse Public License 1.0 | 6 votes |
protected List getInputParameters( String reportDesignFile ) { try { IGetParameterDefinitionTask task = engine.createGetParameterDefinitionTask( engine.openReportDesign( reportDesignFile ) ); ParameterFactory factory = new ParameterFactory( task ); List parameters = factory.getRootChildren( ); task.close( ); task = null; return parameters; } catch ( EngineException e ) { } return null; }
Example 2
Source File: BirtViewerReportService.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * @see org.eclipse.birt.report.service.api.IViewerReportService#getParameterDefinitions(org.eclipse.birt.report.service.api.IViewerReportDesignHandle, * org.eclipse.birt.report.service.api.InputOptions, boolean) */ public Collection getParameterDefinitions( IViewerReportDesignHandle design, InputOptions runOptions, boolean includeGroups ) throws ReportServiceException { IGetParameterDefinitionTask task = null; try { task = getParameterDefinitionTask( design, runOptions ); if ( task != null ) { Collection params = task.getParameterDefns( true ); return convertEngineParameters( params, includeGroups ); } } finally { if ( task != null ) task.close( ); } return null; }
Example 3
Source File: BirtViewerReportService.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * @see org.eclipse.birt.report.service.api.IViewerReportService#getParameterDefaultValue(org.eclipse.birt.report.service.api.IViewerReportDesignHandle, * java.lang.String, org.eclipse.birt.report.service.api.InputOptions) */ public Object getParameterDefaultValue( IViewerReportDesignHandle design, String parameterName, InputOptions options ) throws ReportServiceException { IGetParameterDefinitionTask task = null; Object defaultValue = null; try { task = getParameterDefinitionTask( design, options ); if ( task != null ) defaultValue = task.getDefaultValue( parameterName ); } finally { if ( task != null ) task.close( ); } return defaultValue; }
Example 4
Source File: ListingParameter.java From birt with Eclipse Public License 1.0 | 5 votes |
public List getValueList( ) { List values = new ArrayList( ); boolean isCascading = isCascadingParameter( ); String name = handle.getName( ); IGetParameterDefinitionTask task = createParameterDefinitionTask( ); try { if ( isCascading ) { values = getCascadingValues( values, task ); } else { List selectionList = (List) task.getSelectionList( name ); /* * Iterator iterator = selectionList.iterator( ); while ( * iterator.hasNext( ) ) { IParameterSelectionChoice choice = * (IParameterSelectionChoice) iterator .next( ); values.add( * choice.getValue( ) ); } */ // TODO change IParameterSelectionChoice to parameter choice. values.addAll( selectionList ); } return values; } finally { if ( task != null ) task.close(); } }
Example 5
Source File: BirtViewerReportService.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @see org.eclipse.birt.report.service.api.IViewerReportService#getParameterSelectionList(org.eclipse.birt.report.service.api.IViewerReportDesignHandle, * org.eclipse.birt.report.service.api.InputOptions, java.lang.String) */ public Collection getParameterSelectionList( IViewerReportDesignHandle design, InputOptions runOptions, String paramName ) throws ReportServiceException { IGetParameterDefinitionTask task = null; try { task = getParameterDefinitionTask( design, runOptions ); if ( task != null ) { ViewerAttributeBean bean = getViewerAttrBean( runOptions ); if ( bean != null ) { com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone( bean.getTimeZone( ) ); if ( tz != null ) { task.setTimeZone( tz ); } task.setLocale( bean.getLocale( ) ); task.setParameterValues( bean.getParameters( ) ); } Collection selectionList = task.getSelectionList( paramName ); return convertEngineParameterSelectionChoice( selectionList ); } } finally { if ( task != null ) task.close( ); } return null; }
Example 6
Source File: ScalarParameter.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Gets default value. * * @return default value */ public String getDefaultValue( ) { IGetParameterDefinitionTask task = createParameterDefinitionTask( ); try { Object obj = task.getDefaultValue( handle.getName( ) ); if (obj == null) { return null; } if (obj instanceof Object[] ) { Object[] objs = (Object[])obj; if (objs.length > 0) { oriDefaultValue = objs[0]; return objs[0] != null ? objs[0].toString( ) : null; } else { return null; } } oriDefaultValue = obj; if (obj instanceof Date) { try { return DataTypeUtil.toString( obj ); } catch ( BirtException e ) { //return toString } } return obj.toString( ); } finally { if ( task != null ) task.close(); } }
Example 7
Source File: ScalarParameter.java From birt with Eclipse Public License 1.0 | 4 votes |
public List getDefaultValues( ) { IGetParameterDefinitionTask task = createParameterDefinitionTask( ); try { Object obj = task.getDefaultValue( handle.getName( ) ); List retValue = new ArrayList(); if (obj == null) { return retValue; } if (obj instanceof Object[]) { Object[] objs = (Object[])obj; for (int i=0; i<objs.length; i++) { retValue.add( objs[i] ); } } else if (obj instanceof Collection) { Collection collection = (Collection)obj; Iterator itor = collection.iterator( ); while(itor.hasNext( )) { retValue.add( itor.next( ) ); } } else { retValue.add( obj ); } return retValue; } finally { if ( task != null ) task.close(); } }
Example 8
Source File: ReportLaunchHelper.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Gets the parameter * * @param params * @return */ private static boolean getParameterValues( String reportDesignFile, int taskType, IReportEngine engine, Map paramValues ) { IGetParameterDefinitionTask task = null; IReportDocument document = null; boolean launch = false; try { if ( taskType == TASK_TYPE_RENDER ) { document = engine.openReportDocument( reportDesignFile ); task = engine.createGetParameterDefinitionTask( document .getReportRunnable( ) ); } else { task = engine.createGetParameterDefinitionTask( engine.openReportDesign( reportDesignFile ) ); } ParameterFactory factory = new ParameterFactory( task ); List params = factory.getRootChildren( false ); if ( params != null && params.size( ) > 0 ) { InputParameterDialog dialog = new InputParameterDialog( DebugUI.getShell( ), params, paramValues ); // InputParameterDailog uses reportrunnable set in // GetParameterDefinitionTask execution context.Close // GetParameterDefinitionTask after InputParameterDialog // completes reading the default values for the report // parameters. if ( dialog.open( ) == Window.OK ) { paramValues.clear( ); paramValues.putAll( dialog.getParameters( ) ); launch = true; } } else { launch = true; } } catch ( EngineException e ) { logger.log( Level.SEVERE, e.getMessage( ), e); }finally{ if ( task != null ) { task.close( ); } if (document != null) { document.close(); } } return launch; }
Example 9
Source File: BirtViewerReportService.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.birt.report.service.api.IViewerReportService#getSelectionListForCascadingGroup(org.eclipse.birt.report.service.api.IViewerReportDesignHandle, * java.lang.String, java.lang.Object[], * org.eclipse.birt.report.service.api.InputOptions) */ public Collection getSelectionListForCascadingGroup( IViewerReportDesignHandle design, String groupName, Object[] groupKeys, InputOptions options ) throws ReportServiceException { IGetParameterDefinitionTask task = null; HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST ); try { task = getParameterDefinitionTask( design, options ); if ( task != null ) { ViewerAttributeBean bean = getViewerAttrBean( options ); if ( bean != null ) { com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone( bean.getTimeZone( ) ); if ( tz != null ) { task.setTimeZone( tz ); } task.setLocale( bean.getLocale( ) ); task.setParameterValues( bean.getParameters( ) ); } // Add task into session BirtUtility.addTask( request, task ); task.evaluateQuery( groupName ); Collection selectionList = task.getSelectionListForCascadingGroup( groupName, groupKeys ); return convertEngineParameterSelectionChoice( selectionList ); } } finally { // Remove task from http session BirtUtility.removeTask( request ); if ( task != null ) task.close( ); } return null; }